From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 915313A1D1D; Fri, 16 Jan 2026 20:07:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594050; cv=none; b=eY0UIIOuON6dUEBJqBVs68ktRH/XBvYSAJwoA8jCRdoiLdzdBIopnttYyh4Q3TYukhIk3L4MByB9cdKsIg2e7YGXQ2uvXHqDpJ0vWsNwwBAQHs29l/0l0qVFATp63gVek7Agz8Sy4SrgMZ2jxl9F25Oi+I/V7tAcc0ipN1WhvX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594050; c=relaxed/simple; bh=Aw/tGbpDi+/qWY26Y9sF33D9NnFYEfAjwfpj8Zdq7M8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bvouabeNkDkJ7WS9NPfO1EWoslEZFIaT07nPq+kHPI3gyuKNrW73S8zd+cq+AGfc/KdYfzpDjJCJpS3K8kD13Riqjf3dAbBTE7l1WLvs0sm6GVjPImwgzVRPGbSsXrcd2UM4p7GuI8sKe8gDF1PSGmSoC9e4dtm3FuDjggY96Bs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=kGBB8syi; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="kGBB8syi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594046; x=1800130046; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Aw/tGbpDi+/qWY26Y9sF33D9NnFYEfAjwfpj8Zdq7M8=; b=kGBB8syiA7Jkrg1bOZBPYnyLCi/In8xIDHad3jRcZJkrl28kWu9eIHzu mY6FA1QcXQKwRzUcZ6HbSTLamz1w1YrdgOAVG/Ahn3X3MoG/QfKBGC+zx bvLqu2NU+SbvruWU7kx7nhFpmlTH6mjlstGuICJK4/1/nnPA2XKCbbrDO jnCHdzww4OqoqvVsyCbgObRt5h+kNM4g91CThi1azuOJsD0K5l+y7MuM5 N2jvC2T01ClZIXlr5KldnqWzE03czeYeDqQzHlaGoZu9dDJekXqI6o7gh df2HLOTBLlxOuA7PkRKM6txRmsVuS1PvG9Q5hyFeQaUqL93/KKZUIpDC8 Q==; X-CSE-ConnectionGUID: OTooRcwrRNCxZBlF1StIPQ== X-CSE-MsgGUID: es4YwJhhRvuprFsOtjO9Cg== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="59042231" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2026 13:07:24 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex3.mchp-main.com (10.10.87.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.29; Fri, 16 Jan 2026 13:07:03 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:03 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 01/31] clk: at91: pmc: add macros for clk_parent_data Date: Fri, 16 Jan 2026 13:06:54 -0700 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Add helpers to set parent_data objects in platform specific drivers. Signed-off-by: Claudiu Beznea [ryan.wanner@microchip.com: enclose complex macro with parentheses.] Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/pmc.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index 5daa32c4cf25..1ac0f77a867a 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -15,6 +15,14 @@ =20 #include =20 +#define AT91_CLK_PD_NAME(n) ((struct clk_parent_data){ \ + .hw =3D NULL, .name =3D (n), .fw_name =3D NULL, .index =3D -1, \ +}) + +#define AT91_CLK_PD_HW(h) ((struct clk_parent_data){ \ + .hw =3D (h), .name =3D NULL, .fw_name =3D NULL, .index =3D -1, \ +}) + extern spinlock_t pmc_pcr_lock; =20 struct pmc_data { --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8958346A05; Fri, 16 Jan 2026 20:07:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594051; cv=none; b=plIKwWs/UAKRJLPO2CcaSUaojIz3XPdhT02mFmfDYd7GfHme6OBZ4VSFwbnL7ysxm8zX/E2JscmmW8NH5mI+L/lNXyru4a0y8DUDf8ccrreHI2k9tStG2nMNOQTB6EZKWQ6lH6yKfspav8+BEUNyj83iX5tgtH8nHpoqog2+5vo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594051; c=relaxed/simple; bh=BLTRwtz3YBs2pngVg5PWFf38tW2Rp+sMMO/EaDd4FZk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Y7lAcheINmacdvWWriizyGvmQWCUH2ca6LMqrsfuJGPNbjQdDMqjVKuX47TSqNUGR98CT4AsIKq53CxNStFC9eLUv9XCOTcvDqDpPjXg3MdzHDFTBTA8aPe0kkLDeniUeo4Qqp/kUIDKkzNakxpxiRemLtQJopUakJUtwxR3Tss= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=zQYYf40y; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="zQYYf40y" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594047; x=1800130047; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BLTRwtz3YBs2pngVg5PWFf38tW2Rp+sMMO/EaDd4FZk=; b=zQYYf40yKw5S4PYSEMgxNYkx0fihho7UVVH4el82uK7+ZjqDg6KN1Lcy 226PpW64s7Qis6LqZfUK6A+f58Y+/qN7tqdAiIWKaVHdXz63r0k4ikFxP 9Av8VXYvHgUORoTdBBEuWH6Q3J3VKzYTDDRnoePV9Gdn6E3vHBMZ4m9yE S0PF4exs5NuXjaqF/h+qGgLH7mZ8NCnoCK1mFVWVT5g8mlo+NQ9sE9/o/ JZfp9o6OZ7SNkxB/nQSrljD853GtFE9z9WLAXYbHwUD3wbrUCyjdgzsSp 7+DEKxWqyZyV7iwcfIaVHNdoaXr3javQKw4CP4+5Lh1ik8adRDiyxei00 g==; X-CSE-ConnectionGUID: OTooRcwrRNCxZBlF1StIPQ== X-CSE-MsgGUID: RRO7qsQtQm61jURZdILAnw== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="59042233" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2026 13:07:24 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex3.mchp-main.com (10.10.87.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.29; Fri, 16 Jan 2026 13:07:03 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:03 -0700 From: To: , , , , , , , CC: , , , , , "Ryan Wanner" Subject: [PATCH v5 02/31] clk: at91: pmc: Move macro to header file Date: Fri, 16 Jan 2026 13:06:55 -0700 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ryan Wanner Move this macro to the header file as it is used by more than one driver file. Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/pmc.h | 3 +++ drivers/clk/at91/sama7d65.c | 3 --- drivers/clk/at91/sama7g5.c | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index 1ac0f77a867a..63c028b7b54c 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -23,6 +23,9 @@ .hw =3D (h), .name =3D NULL, .fw_name =3D NULL, .index =3D -1, \ }) =20 +/* Used to create an array entry identifying a PLL by its components. */ +#define PLL_IDS_TO_ARR_ENTRY(_id, _comp) { PLL_ID_##_id, PLL_COMPID_##_com= p} + extern spinlock_t pmc_pcr_lock; =20 struct pmc_data { diff --git a/drivers/clk/at91/sama7d65.c b/drivers/clk/at91/sama7d65.c index 7dee2b160ffb..ec2ef1a0249a 100644 --- a/drivers/clk/at91/sama7d65.c +++ b/drivers/clk/at91/sama7d65.c @@ -432,9 +432,6 @@ static struct sama7d65_pll { }, }; =20 -/* Used to create an array entry identifying a PLL by its components. */ -#define PLL_IDS_TO_ARR_ENTRY(_id, _comp) { PLL_ID_##_id, PLL_COMPID_##_com= p} - /* * Master clock (MCK[0..9]) description * @n: clock name diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c index 1340c2b00619..713f5dfe7be2 100644 --- a/drivers/clk/at91/sama7g5.c +++ b/drivers/clk/at91/sama7g5.c @@ -343,9 +343,6 @@ static struct sama7g5_pll { }, }; =20 -/* Used to create an array entry identifying a PLL by its components. */ -#define PLL_IDS_TO_ARR_ENTRY(_id, _comp) { PLL_ID_##_id, PLL_COMPID_##_com= p} - /* * Master clock (MCK[1..4]) description * @n: clock name --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59FA72853E9; Fri, 16 Jan 2026 20:07:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594053; cv=none; b=kYqVqsMwOiv05oZ0mJ64XBw/glbBYXfsd7MflRoOLrkca1845pZqd0JXFgjP+nT14e3h5AQVZkfnKygzZqeR9cqE/otGFds/9hFeeDIv/FUf42UVEZcc9dIglPefAkeOBZ2bAzJzKgfC5iN8DH2NTvq3xAOTBgmW7jcYyhmB9lI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594053; c=relaxed/simple; bh=NbFY8j22LoZrz5QHk0SMMWMHG/99YZmbYHxUpEdPYWc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qb662mPLrNAvQClm8+m3aQIBWSvcMq+hBvu0QrlSJB6TAYEPAVt9BCTMT4zAmcsZ35gi1vHkT6UazissOu1JYVcWuwm0s1bYc7KAeEwv9a6YxnPflxH43DAquj9/NwU8JWguptOAYF9mLkNYaWVEcbz7uJYdIeIVkEJtIIM42LE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=XjtAa3Zb; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="XjtAa3Zb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594049; x=1800130049; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NbFY8j22LoZrz5QHk0SMMWMHG/99YZmbYHxUpEdPYWc=; b=XjtAa3ZbD9eQzXMauF2hvut2A1KR4/Jqw3wAVSf0xU4EZlSMfckIsy0S MM9uOQWQDIY73OXNS2ACpboYfrEpP6f0cDlX6HGFWSaIjp0Z4fU1mIm7P uFP0R6sPLGHuWuA2rdDwWZOmpxdMliv2Wzp7gN3JEGsUBe8p4MpnDKkEW ptirH7jviGB6GlKMaZTT4v8idlLlCdC6zciDs4bvKKU2ijiZr+Ptz4aKI YZBEs+oRU5FKo8v4NbZcgi0TrnnB7+QrFtvHTR5xlowbI1AgwiPYYfkKH uX+2NQwOS+MrZ36bYkVMzTLXtaFv8QKNlPY2Nrl5cOfbNWncCeJLN+9CX Q==; X-CSE-ConnectionGUID: OTooRcwrRNCxZBlF1StIPQ== X-CSE-MsgGUID: m+tfrlt1S3m7umrzCfIEXw== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="59042237" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2026 13:07:24 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex3.mchp-main.com (10.10.87.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.29; Fri, 16 Jan 2026 13:07:03 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:03 -0700 From: To: , , , , , , , CC: , , , , , "Ryan Wanner" Subject: [PATCH v5 03/31] clk: at91: sam9x75: switch to parent_hw and parent_data Date: Fri, 16 Jan 2026 13:06:56 -0700 Message-ID: <30ba2ce066b788f5b5bcbf3db927b30293d881b6.1768512290.git.ryan.wanner@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ryan Wanner Switch SAM9X75 clocks to use parent_hw and parent_data. Having parent_hw instead of parent names improves to clock registration speed and re-parenting. The USBCLK will be updated in subsequent patches that update the clock registration functions to use parent_hw and parent_data. __clk_get_hw() will be removed in subsequent patches in this series. Signed-off-by: Ryan Wanner --- drivers/clk/at91/sam9x7.c | 305 ++++++++++++++++++++++---------------- 1 file changed, 174 insertions(+), 131 deletions(-) diff --git a/drivers/clk/at91/sam9x7.c b/drivers/clk/at91/sam9x7.c index 89868a0aeaba..c48c91da914e 100644 --- a/drivers/clk/at91/sam9x7.c +++ b/drivers/clk/at91/sam9x7.c @@ -33,10 +33,22 @@ enum pll_ids { PLL_ID_UPLL, PLL_ID_AUDIO, PLL_ID_LVDS, - PLL_ID_PLLA_DIV2, PLL_ID_MAX, }; =20 +/* + * PLL component identifier + * @PLL_COMPID_FRAC: Fractional PLL component identifier + * @PLL_COMPID_DIV0: 1st PLL divider component identifier + * @PLL_COMPID_DIV1: 2nd PLL divider component identifier + */ +enum pll_component_id { + PLL_COMPID_FRAC, + PLL_COMPID_DIV0, + PLL_COMPID_DIV1, + PLL_COMPID_MAX, +}; + /** * enum pll_type - PLL type identifiers * @PLL_TYPE_FRAC: fractional PLL identifier @@ -185,6 +197,18 @@ static const struct clk_pll_layout pll_divio_layout = =3D { .endiv_shift =3D 30, }; =20 +/* + * SAM9X7 PLL possible parents + * @SAM9X7_PLL_PARENT_MAINCK: MAINCK is PLL a parent + * @SAM9X7_PLL_PARENT_MAIN_XTAL: MAIN XTAL is a PLL parent + * @SAM9X7_PLL_PARENT_FRACCK: Frac PLL is a PLL parent (for PLL dividers) + */ +enum sam9x7_pll_parent { + SAM9X7_PLL_PARENT_MAINCK, + SAM9X7_PLL_PARENT_MAIN_XTAL, + SAM9X7_PLL_PARENT_FRACCK +}; + /* * PLL clocks description * @n: clock name @@ -192,22 +216,24 @@ static const struct clk_pll_layout pll_divio_layout = =3D { * @l: clock layout * @t: clock type * @c: pll characteristics + * @hw: pointer to clk_hw * @f: clock flags * @eid: export index in sam9x7->chws[] array */ -static const struct { +static struct { const char *n; - const char *p; const struct clk_pll_layout *l; u8 t; const struct clk_pll_characteristics *c; + struct clk_hw *hw; unsigned long f; + enum sam9x7_pll_parent p; u8 eid; -} sam9x7_plls[][3] =3D { +} sam9x7_plls[][PLL_COMPID_MAX] =3D { [PLL_ID_PLLA] =3D { - { + [PLL_COMPID_FRAC] =3D { .n =3D "plla_fracck", - .p =3D "mainck", + .p =3D SAM9X7_PLL_PARENT_MAINCK, .l =3D &plla_frac_layout, .t =3D PLL_TYPE_FRAC, /* @@ -218,9 +244,9 @@ static const struct { .c =3D &plla_characteristics, }, =20 - { + [PLL_COMPID_DIV0] =3D { .n =3D "plla_divpmcck", - .p =3D "plla_fracck", + .p =3D SAM9X7_PLL_PARENT_FRACCK, .l =3D &pll_divpmc_layout, .t =3D PLL_TYPE_DIV, /* This feeds CPU. It should not be disabled */ @@ -228,21 +254,35 @@ static const struct { .eid =3D PMC_PLLACK, .c =3D &plla_characteristics, }, + + [PLL_COMPID_DIV1] =3D { + .n =3D "plla_div2pmcck", + .p =3D SAM9X7_PLL_PARENT_FRACCK, + .l =3D &plladiv2_divpmc_layout, + /* + * This may feed critical parts of the system like timers. + * It should not be disabled. + */ + .f =3D CLK_IS_CRITICAL | CLK_SET_RATE_GATE, + .c =3D &plladiv2_characteristics, + .eid =3D PMC_PLLADIV2, + .t =3D PLL_TYPE_DIV, + }, }, =20 [PLL_ID_UPLL] =3D { - { + [PLL_COMPID_FRAC] =3D { .n =3D "upll_fracck", - .p =3D "main_osc", + .p =3D SAM9X7_PLL_PARENT_MAIN_XTAL, .l =3D &pll_frac_layout, .t =3D PLL_TYPE_FRAC, .f =3D CLK_SET_RATE_GATE, .c =3D &upll_characteristics, }, =20 - { + [PLL_COMPID_DIV0] =3D { .n =3D "upll_divpmcck", - .p =3D "upll_fracck", + .p =3D SAM9X7_PLL_PARENT_FRACCK, .l =3D &pll_divpmc_layout, .t =3D PLL_TYPE_DIV, .f =3D CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE | @@ -253,18 +293,18 @@ static const struct { }, =20 [PLL_ID_AUDIO] =3D { - { + [PLL_COMPID_FRAC] =3D { .n =3D "audiopll_fracck", - .p =3D "main_osc", + .p =3D SAM9X7_PLL_PARENT_MAIN_XTAL, .l =3D &pll_frac_layout, .f =3D CLK_SET_RATE_GATE, .c =3D &audiopll_characteristics, .t =3D PLL_TYPE_FRAC, }, =20 - { + [PLL_COMPID_DIV0] =3D { .n =3D "audiopll_divpmcck", - .p =3D "audiopll_fracck", + .p =3D SAM9X7_PLL_PARENT_FRACCK, .l =3D &pll_divpmc_layout, .f =3D CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE | CLK_SET_RATE_PARENT, @@ -273,9 +313,9 @@ static const struct { .t =3D PLL_TYPE_DIV, }, =20 - { + [PLL_COMPID_DIV1] =3D { .n =3D "audiopll_diviock", - .p =3D "audiopll_fracck", + .p =3D SAM9X7_PLL_PARENT_FRACCK, .l =3D &pll_divio_layout, .f =3D CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE | CLK_SET_RATE_PARENT, @@ -286,18 +326,18 @@ static const struct { }, =20 [PLL_ID_LVDS] =3D { - { + [PLL_COMPID_FRAC] =3D { .n =3D "lvdspll_fracck", - .p =3D "main_osc", + .p =3D SAM9X7_PLL_PARENT_MAIN_XTAL, .l =3D &pll_frac_layout, .f =3D CLK_SET_RATE_GATE, .c =3D &lvdspll_characteristics, .t =3D PLL_TYPE_FRAC, }, =20 - { + [PLL_COMPID_DIV0] =3D { .n =3D "lvdspll_divpmcck", - .p =3D "lvdspll_fracck", + .p =3D SAM9X7_PLL_PARENT_FRACCK, .l =3D &pll_divpmc_layout, .f =3D CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE | CLK_SET_RATE_PARENT, @@ -306,22 +346,6 @@ static const struct { .t =3D PLL_TYPE_DIV, }, }, - - [PLL_ID_PLLA_DIV2] =3D { - { - .n =3D "plla_div2pmcck", - .p =3D "plla_fracck", - .l =3D &plladiv2_divpmc_layout, - /* - * This may feed critical parts of the system like timers. - * It should not be disabled. - */ - .f =3D CLK_IS_CRITICAL | CLK_SET_RATE_GATE, - .c =3D &plladiv2_characteristics, - .eid =3D PMC_PLLADIV2, - .t =3D PLL_TYPE_DIV, - }, - }, }; =20 static const struct clk_programmable_layout sam9x7_programmable_layout =3D= { @@ -339,9 +363,9 @@ static const struct clk_pcr_layout sam9x7_pcr_layout = =3D { .pid_mask =3D GENMASK(6, 0), }; =20 -static const struct { +static struct { char *n; - char *p; + struct clk_hw *parent_hw; u8 id; unsigned long flags; } sam9x7_systemck[] =3D { @@ -349,10 +373,10 @@ static const struct { * ddrck feeds DDR controller and is enabled by bootloader thus we need * to keep it enabled in case there is no Linux consumer for it. */ - { .n =3D "ddrck", .p =3D "masterck_div", .id =3D 2, .flags =3D CLK_IS_CR= ITICAL }, - { .n =3D "uhpck", .p =3D "usbck", .id =3D 6 }, - { .n =3D "pck0", .p =3D "prog0", .id =3D 8 }, - { .n =3D "pck1", .p =3D "prog1", .id =3D 9 }, + { .n =3D "ddrck", .id =3D 2, .flags =3D CLK_IS_CRITICAL }, + { .n =3D "uhpck", .id =3D 6 }, + { .n =3D "pck0", .id =3D 8 }, + { .n =3D "pck1", .id =3D 9 }, }; =20 /* @@ -426,7 +450,8 @@ static const struct { /* * Generic clock description * @n: clock name - * @pp: PLL parents + * @pp: PLL parents (entry formed by PLL components identifiers + * (see enum pll_component_id)) * @pp_mux_table: PLL parents mux table * @r: clock output range * @pp_chg_id: id in parent array of changeable PLL parent @@ -435,7 +460,10 @@ static const struct { */ static const struct { const char *n; - const char *pp[8]; + struct { + int pll_id; + int pll_compid; + } pp[8]; const char pp_mux_table[8]; struct clk_range r; int pp_chg_id; @@ -445,7 +473,7 @@ static const struct { { .n =3D "flex0_gclk", .id =3D 5, - .pp =3D { "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(PLLA, DIV1), }, .pp_mux_table =3D { 8, }, .pp_count =3D 1, .pp_chg_id =3D INT_MIN, @@ -454,7 +482,7 @@ static const struct { { .n =3D "flex1_gclk", .id =3D 6, - .pp =3D { "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(PLLA, DIV1), }, .pp_mux_table =3D { 8, }, .pp_count =3D 1, .pp_chg_id =3D INT_MIN, @@ -463,7 +491,7 @@ static const struct { { .n =3D "flex2_gclk", .id =3D 7, - .pp =3D { "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(PLLA, DIV1), }, .pp_mux_table =3D { 8, }, .pp_count =3D 1, .pp_chg_id =3D INT_MIN, @@ -472,7 +500,7 @@ static const struct { { .n =3D "flex3_gclk", .id =3D 8, - .pp =3D { "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(PLLA, DIV1), }, .pp_mux_table =3D { 8, }, .pp_count =3D 1, .pp_chg_id =3D INT_MIN, @@ -481,7 +509,7 @@ static const struct { { .n =3D "flex6_gclk", .id =3D 9, - .pp =3D { "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(PLLA, DIV1), }, .pp_mux_table =3D { 8, }, .pp_count =3D 1, .pp_chg_id =3D INT_MIN, @@ -490,7 +518,7 @@ static const struct { { .n =3D "flex7_gclk", .id =3D 10, - .pp =3D { "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(PLLA, DIV1), }, .pp_mux_table =3D { 8, }, .pp_count =3D 1, .pp_chg_id =3D INT_MIN, @@ -499,7 +527,7 @@ static const struct { { .n =3D "flex8_gclk", .id =3D 11, - .pp =3D { "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(PLLA, DIV1), }, .pp_mux_table =3D { 8, }, .pp_count =3D 1, .pp_chg_id =3D INT_MIN, @@ -509,7 +537,7 @@ static const struct { .n =3D "sdmmc0_gclk", .id =3D 12, .r =3D { .max =3D 105000000 }, - .pp =3D { "audiopll_divpmcck", "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(AUDIO, DIV0), PLL_IDS_TO_ARR_ENTRY(PLLA, = DIV1), }, .pp_mux_table =3D { 6, 8, }, .pp_count =3D 2, .pp_chg_id =3D INT_MIN, @@ -518,7 +546,7 @@ static const struct { { .n =3D "flex4_gclk", .id =3D 13, - .pp =3D { "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(PLLA, DIV1), }, .pp_mux_table =3D { 8, }, .pp_count =3D 1, .pp_chg_id =3D INT_MIN, @@ -527,7 +555,7 @@ static const struct { { .n =3D "flex5_gclk", .id =3D 14, - .pp =3D { "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(PLLA, DIV1), }, .pp_mux_table =3D { 8, }, .pp_count =3D 1, .pp_chg_id =3D INT_MIN, @@ -536,7 +564,7 @@ static const struct { { .n =3D "flex9_gclk", .id =3D 15, - .pp =3D { "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(PLLA, DIV1), }, .pp_mux_table =3D { 8, }, .pp_count =3D 1, .pp_chg_id =3D INT_MIN, @@ -545,7 +573,7 @@ static const struct { { .n =3D "flex10_gclk", .id =3D 16, - .pp =3D { "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(PLLA, DIV1), }, .pp_mux_table =3D { 8, }, .pp_count =3D 1, .pp_chg_id =3D INT_MIN, @@ -554,7 +582,7 @@ static const struct { { .n =3D "tcb0_gclk", .id =3D 17, - .pp =3D { "audiopll_divpmcck", "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(AUDIO, DIV0), PLL_IDS_TO_ARR_ENTRY(PLLA, = DIV1), }, .pp_mux_table =3D { 6, 8, }, .pp_count =3D 2, .pp_chg_id =3D INT_MIN, @@ -563,7 +591,7 @@ static const struct { { .n =3D "adc_gclk", .id =3D 19, - .pp =3D { "upll_divpmcck", "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(UPLL, DIV0), PLL_IDS_TO_ARR_ENTRY(PLLA, D= IV1), }, .pp_mux_table =3D { 5, 8, }, .pp_count =3D 2, .pp_chg_id =3D INT_MIN, @@ -573,7 +601,7 @@ static const struct { .n =3D "lcd_gclk", .id =3D 25, .r =3D { .max =3D 75000000 }, - .pp =3D { "audiopll_divpmcck", "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(AUDIO, DIV0), PLL_IDS_TO_ARR_ENTRY(PLLA, = DIV1), }, .pp_mux_table =3D { 6, 8, }, .pp_count =3D 2, .pp_chg_id =3D INT_MIN, @@ -583,7 +611,7 @@ static const struct { .n =3D "sdmmc1_gclk", .id =3D 26, .r =3D { .max =3D 105000000 }, - .pp =3D { "audiopll_divpmcck", "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(AUDIO, DIV0), PLL_IDS_TO_ARR_ENTRY(PLLA, = DIV1), }, .pp_mux_table =3D { 6, 8, }, .pp_count =3D 2, .pp_chg_id =3D INT_MIN, @@ -593,7 +621,7 @@ static const struct { .n =3D "mcan0_gclk", .id =3D 29, .r =3D { .max =3D 80000000 }, - .pp =3D { "upll_divpmcck", "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(UPLL, DIV0), PLL_IDS_TO_ARR_ENTRY(PLLA, D= IV1), }, .pp_mux_table =3D { 5, 8, }, .pp_count =3D 2, .pp_chg_id =3D INT_MIN, @@ -603,7 +631,7 @@ static const struct { .n =3D "mcan1_gclk", .id =3D 30, .r =3D { .max =3D 80000000 }, - .pp =3D { "upll_divpmcck", "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(UPLL, DIV0), PLL_IDS_TO_ARR_ENTRY(PLLA, D= IV1), }, .pp_mux_table =3D { 5, 8, }, .pp_count =3D 2, .pp_chg_id =3D INT_MIN, @@ -612,7 +640,7 @@ static const struct { { .n =3D "flex11_gclk", .id =3D 32, - .pp =3D { "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(PLLA, DIV1), }, .pp_mux_table =3D { 8, }, .pp_count =3D 1, .pp_chg_id =3D INT_MIN, @@ -621,7 +649,7 @@ static const struct { { .n =3D "flex12_gclk", .id =3D 33, - .pp =3D { "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(PLLA, DIV1), }, .pp_mux_table =3D { 8, }, .pp_count =3D 1, .pp_chg_id =3D INT_MIN, @@ -631,7 +659,7 @@ static const struct { .n =3D "i2s_gclk", .id =3D 34, .r =3D { .max =3D 100000000 }, - .pp =3D { "audiopll_divpmcck", "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(AUDIO, DIV0), PLL_IDS_TO_ARR_ENTRY(PLLA, = DIV1), }, .pp_mux_table =3D { 6, 8, }, .pp_count =3D 2, .pp_chg_id =3D INT_MIN, @@ -641,7 +669,7 @@ static const struct { .n =3D "qspi_gclk", .id =3D 35, .r =3D { .max =3D 200000000 }, - .pp =3D { "audiopll_divpmcck", "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(AUDIO, DIV0), PLL_IDS_TO_ARR_ENTRY(PLLA, = DIV1), }, .pp_mux_table =3D { 6, 8, }, .pp_count =3D 2, .pp_chg_id =3D INT_MIN, @@ -650,7 +678,7 @@ static const struct { { .n =3D "pit64b0_gclk", .id =3D 37, - .pp =3D { "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(PLLA, DIV1), }, .pp_mux_table =3D { 8, }, .pp_count =3D 1, .pp_chg_id =3D INT_MIN, @@ -660,7 +688,7 @@ static const struct { .n =3D "classd_gclk", .id =3D 42, .r =3D { .max =3D 100000000 }, - .pp =3D { "audiopll_divpmcck", "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(AUDIO, DIV0), PLL_IDS_TO_ARR_ENTRY(PLLA, = DIV1), }, .pp_mux_table =3D { 6, 8, }, .pp_count =3D 2, .pp_chg_id =3D INT_MIN, @@ -669,7 +697,7 @@ static const struct { { .n =3D "tcb1_gclk", .id =3D 45, - .pp =3D { "audiopll_divpmcck", "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(AUDIO, DIV0), PLL_IDS_TO_ARR_ENTRY(PLLA, = DIV1), }, .pp_mux_table =3D { 6, 8, }, .pp_count =3D 2, .pp_chg_id =3D INT_MIN, @@ -678,7 +706,7 @@ static const struct { { .n =3D "dbgu_gclk", .id =3D 47, - .pp =3D { "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(PLLA, DIV1), }, .pp_mux_table =3D { 8, }, .pp_count =3D 1, .pp_chg_id =3D INT_MIN, @@ -688,7 +716,7 @@ static const struct { .n =3D "mipiphy_gclk", .id =3D 55, .r =3D { .max =3D 27000000 }, - .pp =3D { "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(PLLA, DIV1), }, .pp_mux_table =3D { 8, }, .pp_count =3D 1, .pp_chg_id =3D INT_MIN, @@ -697,7 +725,7 @@ static const struct { { .n =3D "pit64b1_gclk", .id =3D 58, - .pp =3D { "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(PLLA, DIV1), }, .pp_mux_table =3D { 8, }, .pp_count =3D 1, .pp_chg_id =3D INT_MIN, @@ -706,7 +734,7 @@ static const struct { { .n =3D "gmac_gclk", .id =3D 67, - .pp =3D { "audiopll_divpmcck", "plla_div2pmcck", }, + .pp =3D { PLL_IDS_TO_ARR_ENTRY(AUDIO, DIV0), PLL_IDS_TO_ARR_ENTRY(PLLA, = DIV1), }, .pp_mux_table =3D { 6, 8, }, .pp_count =3D 2, .pp_chg_id =3D INT_MIN, @@ -716,32 +744,28 @@ static const struct { static void __init sam9x7_pmc_setup(struct device_node *np) { struct clk_range range =3D CLK_RANGE(0, 0); - const char *td_slck_name, *md_slck_name, *mainxtal_name; + const char *main_xtal_name; struct pmc_data *sam9x7_pmc; const char *parent_names[9]; void **clk_mux_buffer =3D NULL; int clk_mux_buffer_size =3D 0; - struct clk_hw *main_osc_hw; struct regmap *regmap; - struct clk_hw *hw; + struct clk_hw *hw, *main_rc_hw, *main_osc_hw, *main_xtal_hw; + struct clk_hw *td_slck_hw, *md_slck_hw, *usbck_hw; + struct clk_hw *parent_hws[9]; int i, j; =20 - i =3D of_property_match_string(np, "clock-names", "td_slck"); - if (i < 0) - return; - - td_slck_name =3D of_clk_get_parent_name(np, i); + i =3D of_property_match_string(np, "clock-names", "main_xtal"); =20 - i =3D of_property_match_string(np, "clock-names", "md_slck"); if (i < 0) return; + main_xtal_name =3D of_clk_get_parent_name(np, i); =20 - md_slck_name =3D of_clk_get_parent_name(np, i); + td_slck_hw =3D __clk_get_hw(of_clk_get_by_name(np, "td_slck")); + md_slck_hw =3D __clk_get_hw(of_clk_get_by_name(np, "md_slck")); =20 - i =3D of_property_match_string(np, "clock-names", "main_xtal"); - if (i < 0) + if (!td_slck_hw || !md_slck_hw) return; - mainxtal_name =3D of_clk_get_parent_name(np, i); =20 regmap =3D device_node_to_regmap(np); if (IS_ERR(regmap)) @@ -760,26 +784,26 @@ static void __init sam9x7_pmc_setup(struct device_nod= e *np) if (!clk_mux_buffer) goto err_free; =20 - hw =3D at91_clk_register_main_rc_osc(regmap, "main_rc_osc", 12000000, - 50000000); - if (IS_ERR(hw)) + main_rc_hw =3D at91_clk_register_main_rc_osc(regmap, "main_rc_osc", 12000= 000, + 50000000); + if (IS_ERR(main_rc_hw)) goto err_free; =20 - hw =3D at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL= , 0); - if (IS_ERR(hw)) + main_osc_hw =3D at91_clk_register_main_osc(regmap, "main_osc", NULL, + &AT91_CLK_PD_NAME(main_xtal_name), 0); + if (IS_ERR(main_osc_hw)) goto err_free; - main_osc_hw =3D hw; =20 - parent_names[0] =3D "main_rc_osc"; - parent_names[1] =3D "main_osc"; - hw =3D at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, NULL= , 2); + parent_hws[0] =3D main_rc_hw; + parent_hws[1] =3D main_osc_hw; + hw =3D at91_clk_register_sam9x5_main(regmap, "mainck", NULL, parent_hws, = 2); if (IS_ERR(hw)) goto err_free; =20 sam9x7_pmc->chws[PMC_MAIN] =3D hw; =20 for (i =3D 0; i < PLL_ID_MAX; i++) { - for (j =3D 0; j < 3; j++) { + for (j =3D 0; j < PLL_COMPID_MAX; j++) { struct clk_hw *parent_hw; =20 if (!sam9x7_plls[i][j].n) @@ -787,19 +811,23 @@ static void __init sam9x7_pmc_setup(struct device_nod= e *np) =20 switch (sam9x7_plls[i][j].t) { case PLL_TYPE_FRAC: - if (!strcmp(sam9x7_plls[i][j].p, "mainck")) + switch (sam9x7_plls[i][j].p) { + case SAM9X7_PLL_PARENT_MAINCK: parent_hw =3D sam9x7_pmc->chws[PMC_MAIN]; - else if (!strcmp(sam9x7_plls[i][j].p, "main_osc")) - parent_hw =3D main_osc_hw; - else - parent_hw =3D __clk_get_hw(of_clk_get_by_name - (np, sam9x7_plls[i][j].p)); + break; + case SAM9X7_PLL_PARENT_MAIN_XTAL: + parent_hw =3D main_xtal_hw; + break; + default: + /* Should not happen. */ + parent_hw =3D NULL; + break; + } =20 hw =3D sam9x60_clk_register_frac_pll(regmap, &pmc_pll_lock, sam9x7_plls[i][j].n, - sam9x7_plls[i][j].p, - parent_hw, i, + NULL, parent_hw, i, sam9x7_plls[i][j].c, sam9x7_plls[i][j].l, sam9x7_plls[i][j].f); @@ -809,7 +837,7 @@ static void __init sam9x7_pmc_setup(struct device_node = *np) hw =3D sam9x60_clk_register_div_pll(regmap, &pmc_pll_lock, sam9x7_plls[i][j].n, - sam9x7_plls[i][j].p, NULL, i, + NULL, sam9x7_plls[i][0].hw, i, sam9x7_plls[i][j].c, sam9x7_plls[i][j].l, sam9x7_plls[i][j].f, 0); @@ -822,23 +850,24 @@ static void __init sam9x7_pmc_setup(struct device_nod= e *np) if (IS_ERR(hw)) goto err_free; =20 + sam9x7_plls[i][j].hw =3D hw; if (sam9x7_plls[i][j].eid) sam9x7_pmc->chws[sam9x7_plls[i][j].eid] =3D hw; } } =20 - parent_names[0] =3D md_slck_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "plla_divpmcck"; - parent_names[3] =3D "upll_divpmcck"; + parent_hws[0] =3D md_slck_hw; + parent_hws[1] =3D sam9x7_pmc->chws[PMC_MAIN]; + parent_hws[2] =3D sam9x7_plls[PLL_ID_PLLA][PLL_COMPID_DIV0].hw; + parent_hws[3] =3D sam9x7_plls[PLL_ID_UPLL][PLL_COMPID_DIV0].hw; hw =3D at91_clk_register_master_pres(regmap, "masterck_pres", 4, - parent_names, NULL, &sam9x7_master_layout, + NULL, parent_hws, &sam9x7_master_layout, &mck_characteristics, &mck_lock); if (IS_ERR(hw)) goto err_free; =20 hw =3D at91_clk_register_master_div(regmap, "masterck_div", - "masterck_pres", NULL, &sam9x7_master_layout, + NULL, hw, &sam9x7_master_layout, &mck_characteristics, &mck_lock, CLK_SET_RATE_GATE, 0); if (IS_ERR(hw)) @@ -849,24 +878,24 @@ static void __init sam9x7_pmc_setup(struct device_nod= e *np) parent_names[0] =3D "plla_divpmcck"; parent_names[1] =3D "upll_divpmcck"; parent_names[2] =3D "main_osc"; - hw =3D sam9x60_clk_register_usb(regmap, "usbck", parent_names, 3); - if (IS_ERR(hw)) + usbck_hw =3D sam9x60_clk_register_usb(regmap, "usbck", parent_names, 3); + if (IS_ERR(usbck_hw)) goto err_free; =20 - parent_names[0] =3D md_slck_name; - parent_names[1] =3D td_slck_name; - parent_names[2] =3D "mainck"; - parent_names[3] =3D "masterck_div"; - parent_names[4] =3D "plla_divpmcck"; - parent_names[5] =3D "upll_divpmcck"; - parent_names[6] =3D "audiopll_divpmcck"; + parent_hws[0] =3D md_slck_hw; + parent_hws[1] =3D td_slck_hw; + parent_hws[2] =3D sam9x7_pmc->chws[PMC_MAIN]; + parent_hws[3] =3D sam9x7_pmc->chws[PMC_MCK]; + parent_hws[4] =3D sam9x7_plls[PLL_ID_PLLA][PLL_COMPID_DIV0].hw; + parent_hws[5] =3D sam9x7_plls[PLL_ID_UPLL][PLL_COMPID_DIV0].hw; + parent_hws[6] =3D sam9x7_plls[PLL_ID_AUDIO][PLL_COMPID_DIV0].hw; for (i =3D 0; i < 2; i++) { char name[6]; =20 snprintf(name, sizeof(name), "prog%d", i); =20 hw =3D at91_clk_register_programmable(regmap, name, - parent_names, NULL, 7, i, + NULL, parent_hws, 7, i, &sam9x7_programmable_layout, NULL); if (IS_ERR(hw)) @@ -875,9 +904,14 @@ static void __init sam9x7_pmc_setup(struct device_node= *np) sam9x7_pmc->pchws[i] =3D hw; } =20 + /* Set systemck parent hws. */ + sam9x7_systemck[0].parent_hw =3D sam9x7_pmc->chws[PMC_MCK]; + sam9x7_systemck[1].parent_hw =3D usbck_hw; + sam9x7_systemck[2].parent_hw =3D sam9x7_pmc->pchws[0]; + sam9x7_systemck[3].parent_hw =3D sam9x7_pmc->pchws[1]; for (i =3D 0; i < ARRAY_SIZE(sam9x7_systemck); i++) { hw =3D at91_clk_register_system(regmap, sam9x7_systemck[i].n, - sam9x7_systemck[i].p, NULL, + NULL, sam9x7_systemck[i].parent_hw, sam9x7_systemck[i].id, sam9x7_systemck[i].flags); if (IS_ERR(hw)) @@ -890,7 +924,7 @@ static void __init sam9x7_pmc_setup(struct device_node = *np) hw =3D at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock, &sam9x7_pcr_layout, sam9x7_periphck[i].n, - "masterck_div", NULL, + NULL, sam9x7_pmc->chws[PMC_MCK], sam9x7_periphck[i].id, &range, INT_MIN, sam9x7_periphck[i].f); @@ -900,12 +934,13 @@ static void __init sam9x7_pmc_setup(struct device_nod= e *np) sam9x7_pmc->phws[sam9x7_periphck[i].id] =3D hw; } =20 - parent_names[0] =3D md_slck_name; - parent_names[1] =3D td_slck_name; - parent_names[2] =3D "mainck"; - parent_names[3] =3D "masterck_div"; + parent_hws[0] =3D md_slck_hw; + parent_hws[1] =3D td_slck_hw; + parent_hws[2] =3D sam9x7_pmc->chws[PMC_MAIN]; + parent_hws[3] =3D sam9x7_pmc->chws[PMC_MCK]; for (i =3D 0; i < ARRAY_SIZE(sam9x7_gck); i++) { u8 num_parents =3D 4 + sam9x7_gck[i].pp_count; + struct clk_hw *tmp_parent_hws[6]; u32 *mux_table; =20 mux_table =3D kmalloc_array(num_parents, sizeof(*mux_table), @@ -916,13 +951,21 @@ static void __init sam9x7_pmc_setup(struct device_nod= e *np) PMC_INIT_TABLE(mux_table, 4); PMC_FILL_TABLE(&mux_table[4], sam9x7_gck[i].pp_mux_table, sam9x7_gck[i].pp_count); - PMC_FILL_TABLE(&parent_names[4], sam9x7_gck[i].pp, + + for (j =3D 0; j < sam9x7_gck[i].pp_count; j++) { + u8 pll_id =3D sam9x7_gck[i].pp[j].pll_id; + u8 pll_compid =3D sam9x7_gck[i].pp[j].pll_compid; + + tmp_parent_hws[j] =3D sam9x7_plls[pll_id][pll_compid].hw; + } + + PMC_FILL_TABLE(&parent_hws[4], tmp_parent_hws, sam9x7_gck[i].pp_count); =20 hw =3D at91_clk_register_generated(regmap, &pmc_pcr_lock, &sam9x7_pcr_layout, sam9x7_gck[i].n, - parent_names, NULL, mux_table, + NULL, parent_hws, mux_table, num_parents, sam9x7_gck[i].id, &sam9x7_gck[i].r, --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 651C33A35AC; Fri, 16 Jan 2026 20:07:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594063; cv=none; b=jHT0aiucetkhJj+NYVjYhfaTcfDhyIsZX9isczFL+i34PXg2JksGzijZvS1mq/97qD1NY93a4wAabMbIUkw9Az84Bcbg6OTMTzhyZCqyuOPSRu7IWvab9NuF/hYXIFbR7ZFbmV8gu4iHu1Jq/vJEQFWttJUj23zU4Wcjubwmtgg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594063; c=relaxed/simple; bh=53DNaidMA1vaVQPCMvqJAIB1kyJdHBWN47UGR13FwEI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aAk48G77hmWmjLo6QAYlSllIo4eWXzx3ibPumSI5Ne1S45+KVzPoK+JMmE9Vtu/VfnMTfO+wQBEUtmdNVCB1FfOmiex6JrGjCY28f4EbvgDChqvysL9h2Tat7eI+0Y4gs1mTLoiEhi/li1yz4IndxYykeH9AXbzFY4fAypzAy/4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=CSTdEjWW; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="CSTdEjWW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594059; x=1800130059; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=53DNaidMA1vaVQPCMvqJAIB1kyJdHBWN47UGR13FwEI=; b=CSTdEjWWkO7OPCoZaInSyVx0U44Jh6z/A1qIUzt0kr8ysgkMKE1rZAGy iNME9gol3Z2qi1XJHC5DvJCjYAcmUxTaHWZ2WMpNrXzyRRJThEP8/6v7H MTQS24FNU8yjm6nSro0bturXKJlv4CR6w59NoU3JHa14s1/H0Vv+rYOoB hes8x8mHO6CmFj2LRPMcwKX3AI6cBlw4zvTMCMxwEMlZTX6bIPpWVd/UG NqSjSWtFH/pLGYssGLCiDYit6UI0u2yO4dUGu+VhNOdZoyozLR6jUweOM 4kTiT+esGX61sqqDBv2HGl2Qs+f/ocfiWBEp++S0hcJ5nv5bbYDjg7K0H w==; X-CSE-ConnectionGUID: 3LvvvroxTJyR6T9mab+TNA== X-CSE-MsgGUID: fVrDNjIaRxO4fFS0CxjTTw== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="51290358" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Jan 2026 13:07:33 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Fri, 16 Jan 2026 13:07:04 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:04 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 04/31] clk: at91: clk-sam9x60-pll: use clk_parent_data Date: Fri, 16 Jan 2026 13:06:57 -0700 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Use struct clk_parent_data instead of struct parent_hw as this leads to less usage of __clk_get_hw() in SoC specific clock drivers and simpler conversion of existing SoC specific clock drivers from parent_names to modern clk_parent_data structures. As clk-sam9x60-pll need to know parent's rate at initialization we pass it now from SoC specific drivers. This will lead in the end at removing __clk_get_hw() in SoC specific drivers (that will be solved by subsequent commits). Get the main_xtal name via of_clk_get_parent_name() to consistently get the correct name for the main_xtal. Signed-off-by: Claudiu Beznea [ryan.wanner@microchip.com: Add SAMA7D65 and SAM9X75 SoCs to the change set= .] Signed-off-by: Ryan Wanner --- drivers/clk/at91/clk-sam9x60-pll.c | 14 +++++--------- drivers/clk/at91/pmc.h | 5 +++-- drivers/clk/at91/sam9x60.c | 8 +++++--- drivers/clk/at91/sam9x7.c | 16 +++++++++++----- drivers/clk/at91/sama7d65.c | 28 +++++++++++++++++----------- drivers/clk/at91/sama7g5.c | 29 ++++++++++++++++++----------- 6 files changed, 59 insertions(+), 41 deletions(-) diff --git a/drivers/clk/at91/clk-sam9x60-pll.c b/drivers/clk/at91/clk-sam9= x60-pll.c index 3b965057ba0d..bccd674bc616 100644 --- a/drivers/clk/at91/clk-sam9x60-pll.c +++ b/drivers/clk/at91/clk-sam9x60-pll.c @@ -637,19 +637,19 @@ static const struct clk_ops sam9x60_fixed_div_pll_ops= =3D { =20 struct clk_hw * __init sam9x60_clk_register_frac_pll(struct regmap *regmap, spinlock_t *lock, - const char *name, const char *parent_name, - struct clk_hw *parent_hw, u8 id, + const char *name, const struct clk_parent_data *parent_data, + unsigned long parent_rate, u8 id, const struct clk_pll_characteristics *characteristics, const struct clk_pll_layout *layout, u32 flags) { struct sam9x60_frac *frac; struct clk_hw *hw; struct clk_init_data init =3D {}; - unsigned long parent_rate, irqflags; + unsigned long irqflags; unsigned int val; int ret; =20 - if (id > PLL_MAX_ID || !lock || !parent_hw) + if (id > PLL_MAX_ID || !lock || !parent_data) return ERR_PTR(-EINVAL); =20 frac =3D kzalloc(sizeof(*frac), GFP_KERNEL); @@ -657,10 +657,7 @@ sam9x60_clk_register_frac_pll(struct regmap *regmap, s= pinlock_t *lock, return ERR_PTR(-ENOMEM); =20 init.name =3D name; - if (parent_name) - init.parent_names =3D &parent_name; - else - init.parent_hws =3D (const struct clk_hw **)&parent_hw; + init.parent_data =3D (const struct clk_parent_data *)parent_data; init.num_parents =3D 1; if (flags & CLK_SET_RATE_GATE) init.ops =3D &sam9x60_frac_pll_ops; @@ -691,7 +688,6 @@ sam9x60_clk_register_frac_pll(struct regmap *regmap, sp= inlock_t *lock, * its rate leading to enabling this PLL with unsupported * rate. This will lead to PLL not being locked at all. */ - parent_rate =3D clk_hw_get_rate(parent_hw); if (!parent_rate) { hw =3D ERR_PTR(-EINVAL); goto free; diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index 63c028b7b54c..577a6db65ed0 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -258,8 +258,9 @@ sam9x60_clk_register_div_pll(struct regmap *regmap, spi= nlock_t *lock, =20 struct clk_hw * __init sam9x60_clk_register_frac_pll(struct regmap *regmap, spinlock_t *lock, - const char *name, const char *parent_name, - struct clk_hw *parent_hw, u8 id, + const char *name, + const struct clk_parent_data *parent_data, + unsigned long parent_rate, u8 id, const struct clk_pll_characteristics *characteristics, const struct clk_pll_layout *layout, u32 flags); =20 diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c index 18baf4a256f4..bee35c65aceb 100644 --- a/drivers/clk/at91/sam9x60.c +++ b/drivers/clk/at91/sam9x60.c @@ -242,7 +242,8 @@ static void __init sam9x60_pmc_setup(struct device_node= *np) sam9x60_pmc->chws[PMC_MAIN] =3D hw; =20 hw =3D sam9x60_clk_register_frac_pll(regmap, &pmc_pll_lock, "pllack_fracc= k", - "mainck", sam9x60_pmc->chws[PMC_MAIN], + &AT91_CLK_PD_HW(sam9x60_pmc->chws[PMC_MAIN]), + clk_hw_get_rate(sam9x60_pmc->chws[PMC_MAIN]), 0, &plla_characteristics, &pll_frac_layout, /* @@ -268,8 +269,9 @@ static void __init sam9x60_pmc_setup(struct device_node= *np) sam9x60_pmc->chws[PMC_PLLACK] =3D hw; =20 hw =3D sam9x60_clk_register_frac_pll(regmap, &pmc_pll_lock, "upllck_fracc= k", - "main_osc", main_osc_hw, 1, - &upll_characteristics, + &AT91_CLK_PD_HW(main_osc_hw), + clk_hw_get_rate(main_osc_hw), + 1, &upll_characteristics, &pll_frac_layout, CLK_SET_RATE_GATE); if (IS_ERR(hw)) goto err_free; diff --git a/drivers/clk/at91/sam9x7.c b/drivers/clk/at91/sam9x7.c index c48c91da914e..6ec4d09e0b56 100644 --- a/drivers/clk/at91/sam9x7.c +++ b/drivers/clk/at91/sam9x7.c @@ -752,6 +752,7 @@ static void __init sam9x7_pmc_setup(struct device_node = *np) struct regmap *regmap; struct clk_hw *hw, *main_rc_hw, *main_osc_hw, *main_xtal_hw; struct clk_hw *td_slck_hw, *md_slck_hw, *usbck_hw; + static struct clk_parent_data parent_data; struct clk_hw *parent_hws[9]; int i, j; =20 @@ -804,7 +805,7 @@ static void __init sam9x7_pmc_setup(struct device_node = *np) =20 for (i =3D 0; i < PLL_ID_MAX; i++) { for (j =3D 0; j < PLL_COMPID_MAX; j++) { - struct clk_hw *parent_hw; + unsigned long parent_rate; =20 if (!sam9x7_plls[i][j].n) continue; @@ -813,21 +814,26 @@ static void __init sam9x7_pmc_setup(struct device_nod= e *np) case PLL_TYPE_FRAC: switch (sam9x7_plls[i][j].p) { case SAM9X7_PLL_PARENT_MAINCK: - parent_hw =3D sam9x7_pmc->chws[PMC_MAIN]; + parent_data =3D AT91_CLK_PD_NAME("mainck"); + hw =3D sam9x7_pmc->chws[PMC_MAIN]; break; case SAM9X7_PLL_PARENT_MAIN_XTAL: - parent_hw =3D main_xtal_hw; + parent_data =3D AT91_CLK_PD_NAME(main_xtal_name); + hw =3D main_xtal_hw; break; default: /* Should not happen. */ - parent_hw =3D NULL; break; } =20 + parent_rate =3D clk_hw_get_rate(hw); + if (!parent_rate) + return; + hw =3D sam9x60_clk_register_frac_pll(regmap, &pmc_pll_lock, sam9x7_plls[i][j].n, - NULL, parent_hw, i, + &parent_data, parent_rate, i, sam9x7_plls[i][j].c, sam9x7_plls[i][j].l, sam9x7_plls[i][j].f); diff --git a/drivers/clk/at91/sama7d65.c b/drivers/clk/at91/sama7d65.c index ec2ef1a0249a..fd4bf70323ab 100644 --- a/drivers/clk/at91/sama7d65.c +++ b/drivers/clk/at91/sama7d65.c @@ -1093,7 +1093,7 @@ static const struct clk_pcr_layout sama7d65_pcr_layou= t =3D { =20 static void __init sama7d65_pmc_setup(struct device_node *np) { - const char *main_xtal_name =3D "main_xtal"; + const char *main_xtal_name; struct pmc_data *sama7d65_pmc; const char *parent_names[11]; void **alloc_mem =3D NULL; @@ -1106,11 +1106,15 @@ static void __init sama7d65_pmc_setup(struct device= _node *np) bool bypass; int i, j; =20 + i =3D of_property_match_string(np, "clock-names", "main_xtal"); + if (i < 0) + return; + main_xtal_name =3D of_clk_get_parent_name(np, i); + td_slck_hw =3D __clk_get_hw(of_clk_get_by_name(np, "td_slck")); md_slck_hw =3D __clk_get_hw(of_clk_get_by_name(np, "md_slck")); - main_xtal_hw =3D __clk_get_hw(of_clk_get_by_name(np, main_xtal_name)); =20 - if (!td_slck_hw || !md_slck_hw || !main_xtal_hw) + if (!td_slck_hw || !md_slck_hw) return; =20 regmap =3D device_node_to_regmap(np); @@ -1137,10 +1141,8 @@ static void __init sama7d65_pmc_setup(struct device_= node *np) =20 bypass =3D of_property_read_bool(np, "atmel,osc-bypass"); =20 - parent_data.name =3D main_xtal_name; - parent_data.fw_name =3D main_xtal_name; main_osc_hw =3D at91_clk_register_main_osc(regmap, "main_osc", NULL, - &parent_data, bypass); + &AT91_CLK_PD_NAME(main_xtal_name), bypass); if (IS_ERR(main_osc_hw)) goto err_free; =20 @@ -1154,7 +1156,7 @@ static void __init sama7d65_pmc_setup(struct device_n= ode *np) =20 for (i =3D 0; i < PLL_ID_MAX; i++) { for (j =3D 0; j < PLL_COMPID_MAX; j++) { - struct clk_hw *parent_hw; + unsigned long parent_rate; =20 if (!sama7d65_plls[i][j].n) continue; @@ -1163,20 +1165,24 @@ static void __init sama7d65_pmc_setup(struct device= _node *np) case PLL_TYPE_FRAC: switch (sama7d65_plls[i][j].p) { case SAMA7D65_PLL_PARENT_MAINCK: - parent_hw =3D sama7d65_pmc->chws[PMC_MAIN]; + parent_data =3D AT91_CLK_PD_NAME("mainck"); + hw =3D sama7d65_pmc->chws[PMC_MAIN]; break; case SAMA7D65_PLL_PARENT_MAIN_XTAL: - parent_hw =3D main_xtal_hw; + parent_data =3D AT91_CLK_PD_NAME(main_xtal_name); + hw =3D main_xtal_hw; break; default: /* Should not happen. */ - parent_hw =3D NULL; break; } + parent_rate =3D clk_hw_get_rate(hw); + if (!parent_rate) + return; =20 hw =3D sam9x60_clk_register_frac_pll(regmap, &pmc_pll_lock, sama7d65_plls[i][j].n, - NULL, parent_hw, i, + &parent_data, parent_rate, i, sama7d65_plls[i][j].c, sama7d65_plls[i][j].l, sama7d65_plls[i][j].f); diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c index 713f5dfe7be2..c6550044cba1 100644 --- a/drivers/clk/at91/sama7g5.c +++ b/drivers/clk/at91/sama7g5.c @@ -971,7 +971,7 @@ static const struct clk_pcr_layout sama7g5_pcr_layout = =3D { =20 static void __init sama7g5_pmc_setup(struct device_node *np) { - const char *main_xtal_name =3D "main_xtal"; + const char *main_xtal_name; struct pmc_data *sama7g5_pmc; void **alloc_mem =3D NULL; int alloc_mem_size =3D 0; @@ -983,11 +983,15 @@ static void __init sama7g5_pmc_setup(struct device_no= de *np) bool bypass; int i, j; =20 + i =3D of_property_match_string(np, "clock-names", "main_xtal"); + if (i < 0) + return; + main_xtal_name =3D of_clk_get_parent_name(np, i); + td_slck_hw =3D __clk_get_hw(of_clk_get_by_name(np, "td_slck")); md_slck_hw =3D __clk_get_hw(of_clk_get_by_name(np, "md_slck")); - main_xtal_hw =3D __clk_get_hw(of_clk_get_by_name(np, main_xtal_name)); =20 - if (!td_slck_hw || !md_slck_hw || !main_xtal_hw) + if (!td_slck_hw || !md_slck_hw) return; =20 regmap =3D device_node_to_regmap(np); @@ -1014,10 +1018,8 @@ static void __init sama7g5_pmc_setup(struct device_n= ode *np) =20 bypass =3D of_property_read_bool(np, "atmel,osc-bypass"); =20 - parent_data.name =3D main_xtal_name; - parent_data.fw_name =3D main_xtal_name; main_osc_hw =3D at91_clk_register_main_osc(regmap, "main_osc", NULL, - &parent_data, bypass); + &AT91_CLK_PD_NAME(main_xtal_name), bypass); if (IS_ERR(main_osc_hw)) goto err_free; =20 @@ -1031,7 +1033,7 @@ static void __init sama7g5_pmc_setup(struct device_no= de *np) =20 for (i =3D 0; i < PLL_ID_MAX; i++) { for (j =3D 0; j < PLL_COMPID_MAX; j++) { - struct clk_hw *parent_hw; + unsigned long parent_rate; =20 if (!sama7g5_plls[i][j].n) continue; @@ -1040,20 +1042,25 @@ static void __init sama7g5_pmc_setup(struct device_= node *np) case PLL_TYPE_FRAC: switch (sama7g5_plls[i][j].p) { case SAMA7G5_PLL_PARENT_MAINCK: - parent_hw =3D sama7g5_pmc->chws[PMC_MAIN]; + parent_data =3D AT91_CLK_PD_NAME("mainck"); + hw =3D sama7g5_pmc->chws[PMC_MAIN]; break; case SAMA7G5_PLL_PARENT_MAIN_XTAL: - parent_hw =3D main_xtal_hw; + parent_data =3D AT91_CLK_PD_NAME(main_xtal_name); + hw =3D main_xtal_hw; break; default: /* Should not happen. */ - parent_hw =3D NULL; break; } =20 + parent_rate =3D clk_hw_get_rate(hw); + if (!parent_rate) + return; + hw =3D sam9x60_clk_register_frac_pll(regmap, &pmc_pll_lock, sama7g5_plls[i][j].n, - NULL, parent_hw, i, + &parent_data, parent_rate, i, sama7g5_plls[i][j].c, sama7g5_plls[i][j].l, sama7g5_plls[i][j].f); --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37ECC3A8FF1; Fri, 16 Jan 2026 20:07:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594066; cv=none; b=J1cVesNQafE+V4HBl4Emqsv8wQrgQREdD5QJh0jR9XsuK6NSecPrU66COQbw8qnQ12gUnyOqEtWJFxyAPO3Z0sA4ucLSV00TpdG4itU2tazspq1TyNSJlvhGUU6LE9naNrzxIi9cPGVh91TcupUch9rhObZvu+1XvE5h2Js6fcQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594066; c=relaxed/simple; bh=RwuCeJAoS6L7ZHwLftG1bOzhbbKscMkg3opGOon6QHo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TZcK+WFVr2CwkEbf0X6HGaC3t/g0CcIl0JZGbZ+qFB14fKhJ1jqhC7YmpXDzWavRyvcJ1IgmACTxcKQuGULCruXBgpkyKXeMPbCOkNHvXJ/09iTRm89pd84Bh2CyeIoDBkp8QGfOOsXpivDzkG0MOnF3LxSm0xUyOW/XidDyRxM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=koTU4pyJ; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="koTU4pyJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594062; x=1800130062; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RwuCeJAoS6L7ZHwLftG1bOzhbbKscMkg3opGOon6QHo=; b=koTU4pyJjlt57ZKydJMZqyKM17clfN/1s8L8JSYAHAhRk6NTFxvhiykQ eT4fG6S8nsGFrTCFLkVzDMiXqoXVRyW8TZ/J83CiKy3FdUNL+YMznyrLS bPtYEttoHfjAyHpk8Yt1XT9OQNdzCxHmMtz6p5AekkOWJ638npJDOTqjX cO1wUtBxOXmagwrvQZBEv+bel6tirypqrtIKb1E/O9edxfLWWAm2e/8zu B2fR5Bo3uUcg0/LOKbUdJtSl4Kmc8YUR/FbaYrFZNP37z10rKeevhF5Ar nDiTF7Kt+NzbUk3vsIrXynBd8CAildCJ0Z9oY9aIwWMWPe0QM7JV1oyfB g==; X-CSE-ConnectionGUID: 3LvvvroxTJyR6T9mab+TNA== X-CSE-MsgGUID: uBHpHoHlSb+hcYTZXMj5Eg== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="51290364" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Jan 2026 13:07:33 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Fri, 16 Jan 2026 13:07:04 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:04 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 05/31] clk: at91: clk-peripheral: switch to clk_parent_data Date: Fri, 16 Jan 2026 13:06:58 -0700 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Use struct clk_parent_data instead of parent_hw for peripheral clocks. The clk_parent_data is a more modern approach to the clock parent registration. Signed-off-by: Claudiu Beznea [ryan.wanner@microchip.com: Add SAMA7D65 and SAM9X7 SoCs to the use the structs.] Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/clk-peripheral.c | 16 ++++++++-------- drivers/clk/at91/pmc.h | 4 ++-- drivers/clk/at91/sam9x7.c | 2 +- drivers/clk/at91/sama7d65.c | 2 +- drivers/clk/at91/sama7g5.c | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/clk/at91/clk-peripheral.c b/drivers/clk/at91/clk-perip= heral.c index e700f40fd87f..497724811141 100644 --- a/drivers/clk/at91/clk-peripheral.c +++ b/drivers/clk/at91/clk-peripheral.c @@ -97,7 +97,7 @@ static const struct clk_ops peripheral_ops =3D { =20 struct clk_hw * __init at91_clk_register_peripheral(struct regmap *regmap, const char *name, - const char *parent_name, struct clk_hw *parent_hw, + const char *parent_name, struct clk_parent_data *parent_data, u32 id) { struct clk_peripheral *periph; @@ -105,7 +105,7 @@ at91_clk_register_peripheral(struct regmap *regmap, con= st char *name, struct clk_hw *hw; int ret; =20 - if (!name || !(parent_name || parent_hw) || id > PERIPHERAL_ID_MAX) + if (!name || !(parent_name || parent_data) || id > PERIPHERAL_ID_MAX) return ERR_PTR(-EINVAL); =20 periph =3D kzalloc(sizeof(*periph), GFP_KERNEL); @@ -114,8 +114,8 @@ at91_clk_register_peripheral(struct regmap *regmap, con= st char *name, =20 init.name =3D name; init.ops =3D &peripheral_ops; - if (parent_hw) - init.parent_hws =3D (const struct clk_hw **)&parent_hw; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; else init.parent_names =3D &parent_name; init.num_parents =3D 1; @@ -458,7 +458,7 @@ struct clk_hw * __init at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *loc= k, const struct clk_pcr_layout *layout, const char *name, const char *parent_name, - struct clk_hw *parent_hw, + struct clk_parent_data *parent_data, u32 id, const struct clk_range *range, int chg_pid, unsigned long flags) { @@ -467,7 +467,7 @@ at91_clk_register_sam9x5_peripheral(struct regmap *regm= ap, spinlock_t *lock, struct clk_hw *hw; int ret; =20 - if (!name || !(parent_name || parent_hw)) + if (!name || !(parent_name || parent_data)) return ERR_PTR(-EINVAL); =20 periph =3D kzalloc(sizeof(*periph), GFP_KERNEL); @@ -475,8 +475,8 @@ at91_clk_register_sam9x5_peripheral(struct regmap *regm= ap, spinlock_t *lock, return ERR_PTR(-ENOMEM); =20 init.name =3D name; - if (parent_hw) - init.parent_hws =3D (const struct clk_hw **)&parent_hw; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; else init.parent_names =3D &parent_name; init.num_parents =3D 1; diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index 577a6db65ed0..950a4e570ebe 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -229,13 +229,13 @@ at91_clk_sama7g5_register_master(struct regmap *regma= p, =20 struct clk_hw * __init at91_clk_register_peripheral(struct regmap *regmap, const char *name, - const char *parent_name, struct clk_hw *parent_hw, + const char *parent_name, struct clk_parent_data *parent_data, u32 id); struct clk_hw * __init at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *loc= k, const struct clk_pcr_layout *layout, const char *name, const char *parent_name, - struct clk_hw *parent_hw, + struct clk_parent_data *parent_data, u32 id, const struct clk_range *range, int chg_pid, unsigned long flags); =20 diff --git a/drivers/clk/at91/sam9x7.c b/drivers/clk/at91/sam9x7.c index 6ec4d09e0b56..a764f2fe0f23 100644 --- a/drivers/clk/at91/sam9x7.c +++ b/drivers/clk/at91/sam9x7.c @@ -930,7 +930,7 @@ static void __init sam9x7_pmc_setup(struct device_node = *np) hw =3D at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock, &sam9x7_pcr_layout, sam9x7_periphck[i].n, - NULL, sam9x7_pmc->chws[PMC_MCK], + NULL, &AT91_CLK_PD_HW(sam9x7_pmc->chws[PMC_MCK]), sam9x7_periphck[i].id, &range, INT_MIN, sam9x7_periphck[i].f); diff --git a/drivers/clk/at91/sama7d65.c b/drivers/clk/at91/sama7d65.c index fd4bf70323ab..7d99823ec5dc 100644 --- a/drivers/clk/at91/sama7d65.c +++ b/drivers/clk/at91/sama7d65.c @@ -1310,7 +1310,7 @@ static void __init sama7d65_pmc_setup(struct device_n= ode *np) &sama7d65_pcr_layout, sama7d65_periphck[i].n, NULL, - sama7d65_mckx[sama7d65_periphck[i].p].hw, + &AT91_CLK_PD_HW(sama7d65_mckx[sama7d65_periphck[i].p].hw), sama7d65_periphck[i].id, &sama7d65_periphck[i].r, sama7d65_periphck[i].chgp ? 0 : diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c index c6550044cba1..e4c18b8a5c20 100644 --- a/drivers/clk/at91/sama7g5.c +++ b/drivers/clk/at91/sama7g5.c @@ -1183,7 +1183,7 @@ static void __init sama7g5_pmc_setup(struct device_no= de *np) &sama7g5_pcr_layout, sama7g5_periphck[i].n, NULL, - sama7g5_mckx[sama7g5_periphck[i].p].hw, + &AT91_CLK_PD_HW(sama7g5_mckx[sama7g5_periphck[i].p].hw), sama7g5_periphck[i].id, &sama7g5_periphck[i].r, sama7g5_periphck[i].chgp ? 0 : --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89D9734DB5C; Fri, 16 Jan 2026 20:07:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594043; cv=none; b=fW7D0Z0KpL9nGqjYwCd+Y4I6qvbG8hLTID4SUetFrVuPK4+ik7qgrGjd41PQcsenjjOjXutniTIsEvuW/PaYarKtUm1xLZ7g8DK31UcMlC1p/OmE4hxqVtm+ul3+eaXdd3s3bRuMcEHitZrjrHHjhEZZZf+FjlgN7s/Oqh5hmHk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594043; c=relaxed/simple; bh=r74+n+MWabdkatGTW9hVYS/1Zc1wfxpGbfVLjpxFHcE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kk5pnNyuIu9hWdBDekBIPIAzTEtmPYrbr1YdNOjG20ckVWaBV9Oa8HwaPRfEnbn0f1lcYqq+sQzRbsad0Nf/ZLR8od7yujwjP2Z6xqtUTiLhTfUZCpPJkZn89z6RZpjJfIoLOJjJN1IK70kvjiQwktBnLdXBQoZUoo4HQEDzCB0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=H9WaV9Sw; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="H9WaV9Sw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594042; x=1800130042; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=r74+n+MWabdkatGTW9hVYS/1Zc1wfxpGbfVLjpxFHcE=; b=H9WaV9SwXanxF4OQuKTtEnlmuS2zb05TqViSYNcjdfnTRaxh9O37/NF5 AKsD8K5jEuyC5+VsLd4QuVOdrYhDfDIi7fCXGdOpMzWqiyIhK6mMxr0Vl hWkf3sW8QgbVhwhlvKQaIAm5mqgr+VGS+Zsuy6RjWIO0t0SYGnaEGAgKd yBajb73Yq0BOH2iNjaIBZkm7vYeOrIY0yhCgJTT61B7qYNVie8vpi+KuS X/FH81srVZPPrKVzTxWP9XBPFESzII0Y8lT3Qe9krfcl5n2KquQ7jAOSK PNhrSfeyAFg//zDumBW16f3O3iVYyrJTluSppy4HOUF+yK1pIRK1a7Dam Q==; X-CSE-ConnectionGUID: +9RSiAtvRY+RhxWEUm06Wg== X-CSE-MsgGUID: Ivm3HtRVSTqnn9wEKaMpSw== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="283397047" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2026 13:07:15 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex1.mchp-main.com (10.10.87.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.29; Fri, 16 Jan 2026 13:07:04 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:04 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 06/31] clk: at91: clk-main: switch to clk parent data Date: Fri, 16 Jan 2026 13:06:59 -0700 Message-ID: <1cb33a80d61ee10b77800b9a0535a6b289a84d25.1768512290.git.ryan.wanner@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Use struct clk_parent_data instead of parent_hw for the main clock. So there is less usage of __clk_get_hw() in SoC specific clock drivers and simpler conversion of existing SoC specific clock drivers from parent_names= to modern clk_parent_data structures. This will lead in the end at removing __clk_get_hw() in SoC specific drivers (that will be solved by subsequent commits). Signed-off-by: Claudiu Beznea [ryan.wanner@microchip: Add SAMA7D65 and SAM9X75 SoCs to use parent_data.] Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/clk-main.c | 16 ++++++++-------- drivers/clk/at91/pmc.h | 4 ++-- drivers/clk/at91/sam9x7.c | 14 +++++++------- drivers/clk/at91/sama7d65.c | 14 +++++++------- drivers/clk/at91/sama7g5.c | 10 +++++----- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c index 9b462becc693..514c5690253f 100644 --- a/drivers/clk/at91/clk-main.c +++ b/drivers/clk/at91/clk-main.c @@ -402,7 +402,7 @@ struct clk_hw * __init at91_clk_register_rm9200_main(struct regmap *regmap, const char *name, const char *parent_name, - struct clk_hw *parent_hw) + struct clk_parent_data *parent_data) { struct clk_rm9200_main *clkmain; struct clk_init_data init =3D {}; @@ -412,7 +412,7 @@ at91_clk_register_rm9200_main(struct regmap *regmap, if (!name) return ERR_PTR(-EINVAL); =20 - if (!(parent_name || parent_hw)) + if (!(parent_name || parent_data)) return ERR_PTR(-EINVAL); =20 clkmain =3D kzalloc(sizeof(*clkmain), GFP_KERNEL); @@ -421,8 +421,8 @@ at91_clk_register_rm9200_main(struct regmap *regmap, =20 init.name =3D name; init.ops =3D &rm9200_main_ops; - if (parent_hw) - init.parent_hws =3D (const struct clk_hw **)&parent_hw; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; else init.parent_names =3D &parent_name; init.num_parents =3D 1; @@ -552,7 +552,7 @@ struct clk_hw * __init at91_clk_register_sam9x5_main(struct regmap *regmap, const char *name, const char **parent_names, - struct clk_hw **parent_hws, + struct clk_parent_data *parent_data, int num_parents) { struct clk_sam9x5_main *clkmain; @@ -564,7 +564,7 @@ at91_clk_register_sam9x5_main(struct regmap *regmap, if (!name) return ERR_PTR(-EINVAL); =20 - if (!(parent_hws || parent_names) || !num_parents) + if (!(parent_data || parent_names) || !num_parents) return ERR_PTR(-EINVAL); =20 clkmain =3D kzalloc(sizeof(*clkmain), GFP_KERNEL); @@ -573,8 +573,8 @@ at91_clk_register_sam9x5_main(struct regmap *regmap, =20 init.name =3D name; init.ops =3D &sam9x5_main_ops; - if (parent_hws) - init.parent_hws =3D (const struct clk_hw **)parent_hws; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; else init.parent_names =3D parent_names; init.num_parents =3D num_parents; diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index 950a4e570ebe..2d2e7c20d72d 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -198,11 +198,11 @@ struct clk_hw * __init at91_clk_register_rm9200_main(struct regmap *regmap, const char *name, const char *parent_name, - struct clk_hw *parent_hw); + struct clk_parent_data *parent_data); struct clk_hw * __init at91_clk_register_sam9x5_main(struct regmap *regmap, const char *name, const char **parent_names, - struct clk_hw **parent_hws, int num_parents); + struct clk_parent_data *parent_data, int num_parents); =20 struct clk_hw * __init at91_clk_register_master_pres(struct regmap *regmap, const char *name, diff --git a/drivers/clk/at91/sam9x7.c b/drivers/clk/at91/sam9x7.c index a764f2fe0f23..aee1d60492aa 100644 --- a/drivers/clk/at91/sam9x7.c +++ b/drivers/clk/at91/sam9x7.c @@ -752,7 +752,7 @@ static void __init sam9x7_pmc_setup(struct device_node = *np) struct regmap *regmap; struct clk_hw *hw, *main_rc_hw, *main_osc_hw, *main_xtal_hw; struct clk_hw *td_slck_hw, *md_slck_hw, *usbck_hw; - static struct clk_parent_data parent_data; + struct clk_parent_data parent_data[2]; struct clk_hw *parent_hws[9]; int i, j; =20 @@ -795,9 +795,9 @@ static void __init sam9x7_pmc_setup(struct device_node = *np) if (IS_ERR(main_osc_hw)) goto err_free; =20 - parent_hws[0] =3D main_rc_hw; - parent_hws[1] =3D main_osc_hw; - hw =3D at91_clk_register_sam9x5_main(regmap, "mainck", NULL, parent_hws, = 2); + parent_data[0] =3D AT91_CLK_PD_HW(main_rc_hw); + parent_data[1] =3D AT91_CLK_PD_HW(main_osc_hw); + hw =3D at91_clk_register_sam9x5_main(regmap, "mainck", NULL, parent_data,= 2); if (IS_ERR(hw)) goto err_free; =20 @@ -814,11 +814,11 @@ static void __init sam9x7_pmc_setup(struct device_nod= e *np) case PLL_TYPE_FRAC: switch (sam9x7_plls[i][j].p) { case SAM9X7_PLL_PARENT_MAINCK: - parent_data =3D AT91_CLK_PD_NAME("mainck"); + parent_data[0] =3D AT91_CLK_PD_NAME("mainck"); hw =3D sam9x7_pmc->chws[PMC_MAIN]; break; case SAM9X7_PLL_PARENT_MAIN_XTAL: - parent_data =3D AT91_CLK_PD_NAME(main_xtal_name); + parent_data[0] =3D AT91_CLK_PD_NAME(main_xtal_name); hw =3D main_xtal_hw; break; default: @@ -833,7 +833,7 @@ static void __init sam9x7_pmc_setup(struct device_node = *np) hw =3D sam9x60_clk_register_frac_pll(regmap, &pmc_pll_lock, sam9x7_plls[i][j].n, - &parent_data, parent_rate, i, + parent_data, parent_rate, i, sam9x7_plls[i][j].c, sam9x7_plls[i][j].l, sam9x7_plls[i][j].f); diff --git a/drivers/clk/at91/sama7d65.c b/drivers/clk/at91/sama7d65.c index 7d99823ec5dc..94e3fe78929d 100644 --- a/drivers/clk/at91/sama7d65.c +++ b/drivers/clk/at91/sama7d65.c @@ -1101,7 +1101,7 @@ static void __init sama7d65_pmc_setup(struct device_n= ode *np) struct regmap *regmap; struct clk_hw *hw, *main_rc_hw, *main_osc_hw, *main_xtal_hw; struct clk_hw *td_slck_hw, *md_slck_hw; - static struct clk_parent_data parent_data; + struct clk_parent_data parent_data[2]; struct clk_hw *parent_hws[10]; bool bypass; int i, j; @@ -1146,9 +1146,9 @@ static void __init sama7d65_pmc_setup(struct device_n= ode *np) if (IS_ERR(main_osc_hw)) goto err_free; =20 - parent_hws[0] =3D main_rc_hw; - parent_hws[1] =3D main_osc_hw; - hw =3D at91_clk_register_sam9x5_main(regmap, "mainck", NULL, parent_hws, = 2); + parent_data[0] =3D AT91_CLK_PD_HW(main_rc_hw); + parent_data[1] =3D AT91_CLK_PD_HW(main_osc_hw); + hw =3D at91_clk_register_sam9x5_main(regmap, "mainck", NULL, parent_data,= 2); if (IS_ERR(hw)) goto err_free; =20 @@ -1165,11 +1165,11 @@ static void __init sama7d65_pmc_setup(struct device= _node *np) case PLL_TYPE_FRAC: switch (sama7d65_plls[i][j].p) { case SAMA7D65_PLL_PARENT_MAINCK: - parent_data =3D AT91_CLK_PD_NAME("mainck"); + parent_data[0] =3D AT91_CLK_PD_NAME("mainck"); hw =3D sama7d65_pmc->chws[PMC_MAIN]; break; case SAMA7D65_PLL_PARENT_MAIN_XTAL: - parent_data =3D AT91_CLK_PD_NAME(main_xtal_name); + parent_data[0] =3D AT91_CLK_PD_NAME(main_xtal_name); hw =3D main_xtal_hw; break; default: @@ -1182,7 +1182,7 @@ static void __init sama7d65_pmc_setup(struct device_n= ode *np) =20 hw =3D sam9x60_clk_register_frac_pll(regmap, &pmc_pll_lock, sama7d65_plls[i][j].n, - &parent_data, parent_rate, i, + parent_data, parent_rate, i, sama7d65_plls[i][j].c, sama7d65_plls[i][j].l, sama7d65_plls[i][j].f); diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c index e4c18b8a5c20..d7fb42166a14 100644 --- a/drivers/clk/at91/sama7g5.c +++ b/drivers/clk/at91/sama7g5.c @@ -978,7 +978,7 @@ static void __init sama7g5_pmc_setup(struct device_node= *np) struct regmap *regmap; struct clk_hw *hw, *main_rc_hw, *main_osc_hw, *main_xtal_hw; struct clk_hw *td_slck_hw, *md_slck_hw; - static struct clk_parent_data parent_data; + struct clk_parent_data parent_data[2]; struct clk_hw *parent_hws[10]; bool bypass; int i, j; @@ -1023,9 +1023,9 @@ static void __init sama7g5_pmc_setup(struct device_no= de *np) if (IS_ERR(main_osc_hw)) goto err_free; =20 - parent_hws[0] =3D main_rc_hw; - parent_hws[1] =3D main_osc_hw; - hw =3D at91_clk_register_sam9x5_main(regmap, "mainck", NULL, parent_hws, = 2); + parent_data[0] =3D AT91_CLK_PD_HW(main_rc_hw); + parent_data[1] =3D AT91_CLK_PD_HW(main_osc_hw); + hw =3D at91_clk_register_sam9x5_main(regmap, "mainck", NULL, parent_data,= 2); if (IS_ERR(hw)) goto err_free; =20 @@ -1060,7 +1060,7 @@ static void __init sama7g5_pmc_setup(struct device_no= de *np) =20 hw =3D sam9x60_clk_register_frac_pll(regmap, &pmc_pll_lock, sama7g5_plls[i][j].n, - &parent_data, parent_rate, i, + parent_data, parent_rate, i, sama7g5_plls[i][j].c, sama7g5_plls[i][j].l, sama7g5_plls[i][j].f); --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 88F6D3A1D1A; Fri, 16 Jan 2026 20:07:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594046; cv=none; b=HFBrVt6NZFM3n/0Pi24TXiLStzq8D/3s3uYrpvwBwxCUg/Ez80noum7A2fL2QgePMg6jFdDdAUIDLDlPzNpoypRMi1IuRrNR3KSUlnGS4u4qrbStTzxBR4NSK0KSxSDQuMWyh2b6fcWOlFYFelLJRFcs90T/vncOdWkXyrbdK+Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594046; c=relaxed/simple; bh=OTMXgJdF/7MTA4sJqHAQpMGm2af+yWIy+XmatDrrxP4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mF8XSSN/WBdW4SFDxa86PP0C4C/YthUNAaDtcLOLXoZQEgh5SCQGYXqEvrz+RYJ3zL7JG0jnI9Qi/pPr73hGixP+S0xUps+OpM5Kor22s/R43dhJMPVq10iX6FmYOtCcvt7cDNRZa1/BfZ2D2Ofixhb1BzfsyTXnIiYAYdsAxeU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=VyNyGwAQ; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="VyNyGwAQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594044; x=1800130044; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OTMXgJdF/7MTA4sJqHAQpMGm2af+yWIy+XmatDrrxP4=; b=VyNyGwAQ40/Rg7BQKdsQGeRyJ22bHI4kh1XKn0Ge9XOim2FPePHcCiKY dK6rNs1xvLCpOB6srFza0TT4RmalRiVKIa1iknOZjyvVJz4E0Enfjwb79 vUkGxlhZRCQyF5rYv57R3v1Kgw1U26+UZ3z0zLgj1kM+74NYXWiLbI3hc cdvYPgzmvj/UT+YEpnCECPpWxuj2rE/WGeghU6/cHH8MoWLuaZc4fIRXj NzpJ2/aWaMRR6ByMt+S/6M8icOJLPED0rAdkO/awtJUJsVs2UJ1h4+uQ8 ISSwlU0z/mO2OER5qD+MoQI6qZ1vWRBBV5I54kIL2irU/9tHDAj3itlwn A==; X-CSE-ConnectionGUID: +9RSiAtvRY+RhxWEUm06Wg== X-CSE-MsgGUID: 5FgGJAS1SOCVS7wRgzOGOQ== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="283397048" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2026 13:07:16 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex1.mchp-main.com (10.10.87.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.29; Fri, 16 Jan 2026 13:07:04 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:04 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 07/31] clk: at91: clk-utmi: use clk_parent_data Date: Fri, 16 Jan 2026 13:07:00 -0700 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Use struct clk_parent_data instead of struct parent_hw as this leads to less usage of __clk_get_hw() in SoC specific clock drivers and simpler conversion of existing SoC specific clock drivers from parent_names to modern clk_parent_data structures. Signed-off-by: Claudiu Beznea Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/clk-utmi.c | 16 ++++++++-------- drivers/clk/at91/pmc.h | 4 ++-- drivers/clk/at91/sama7g5.c | 19 ++++++++++++------- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/drivers/clk/at91/clk-utmi.c b/drivers/clk/at91/clk-utmi.c index b991180beea1..38ffe4d712a5 100644 --- a/drivers/clk/at91/clk-utmi.c +++ b/drivers/clk/at91/clk-utmi.c @@ -144,7 +144,7 @@ static struct clk_hw * __init at91_clk_register_utmi_internal(struct regmap *regmap_pmc, struct regmap *regmap_sfr, const char *name, const char *parent_name, - struct clk_hw *parent_hw, + struct clk_parent_data *parent_data, const struct clk_ops *ops, unsigned long flags) { struct clk_utmi *utmi; @@ -152,7 +152,7 @@ at91_clk_register_utmi_internal(struct regmap *regmap_p= mc, struct clk_init_data init =3D {}; int ret; =20 - if (!(parent_name || parent_hw)) + if (!(parent_name || parent_data)) return ERR_PTR(-EINVAL); =20 utmi =3D kzalloc(sizeof(*utmi), GFP_KERNEL); @@ -161,8 +161,8 @@ at91_clk_register_utmi_internal(struct regmap *regmap_p= mc, =20 init.name =3D name; init.ops =3D ops; - if (parent_hw) - init.parent_hws =3D (const struct clk_hw **)&parent_hw; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; else init.parent_names =3D &parent_name; init.num_parents =3D 1; @@ -185,10 +185,10 @@ at91_clk_register_utmi_internal(struct regmap *regmap= _pmc, struct clk_hw * __init at91_clk_register_utmi(struct regmap *regmap_pmc, struct regmap *regmap_sf= r, const char *name, const char *parent_name, - struct clk_hw *parent_hw) + struct clk_parent_data *parent_data) { return at91_clk_register_utmi_internal(regmap_pmc, regmap_sfr, name, - parent_name, parent_hw, &utmi_ops, CLK_SET_RATE_GATE); + parent_name, parent_data, &utmi_ops, CLK_SET_RATE_GATE); } =20 static int clk_utmi_sama7g5_prepare(struct clk_hw *hw) @@ -287,8 +287,8 @@ static const struct clk_ops sama7g5_utmi_ops =3D { =20 struct clk_hw * __init at91_clk_sama7g5_register_utmi(struct regmap *regmap_pmc, const char *name, - const char *parent_name, struct clk_hw *parent_hw) + const char *parent_name, struct clk_parent_data *parent_data) { return at91_clk_register_utmi_internal(regmap_pmc, NULL, name, - parent_name, parent_hw, &sama7g5_utmi_ops, 0); + parent_name, parent_data, &sama7g5_utmi_ops, 0); } diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index 2d2e7c20d72d..dcb678732471 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -302,10 +302,10 @@ at91rm9200_clk_register_usb(struct regmap *regmap, co= nst char *name, struct clk_hw * __init at91_clk_register_utmi(struct regmap *regmap_pmc, struct regmap *regmap_sf= r, const char *name, const char *parent_name, - struct clk_hw *parent_hw); + struct clk_parent_data *parent_data); =20 struct clk_hw * __init at91_clk_sama7g5_register_utmi(struct regmap *regmap, const char *name, - const char *parent_name, struct clk_hw *parent_hw); + const char *parent_name, struct clk_parent_data *parent_data); =20 #endif /* __PMC_H_ */ diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c index d7fb42166a14..058004379ce9 100644 --- a/drivers/clk/at91/sama7g5.c +++ b/drivers/clk/at91/sama7g5.c @@ -976,7 +976,7 @@ static void __init sama7g5_pmc_setup(struct device_node= *np) void **alloc_mem =3D NULL; int alloc_mem_size =3D 0; struct regmap *regmap; - struct clk_hw *hw, *main_rc_hw, *main_osc_hw, *main_xtal_hw; + struct clk_hw *hw, *main_rc_hw, *main_osc_hw; struct clk_hw *td_slck_hw, *md_slck_hw; struct clk_parent_data parent_data[2]; struct clk_hw *parent_hws[10]; @@ -1042,19 +1042,23 @@ static void __init sama7g5_pmc_setup(struct device_= node *np) case PLL_TYPE_FRAC: switch (sama7g5_plls[i][j].p) { case SAMA7G5_PLL_PARENT_MAINCK: - parent_data =3D AT91_CLK_PD_NAME("mainck"); - hw =3D sama7g5_pmc->chws[PMC_MAIN]; + parent_data[0] =3D AT91_CLK_PD_NAME("mainck"); + parent_rate =3D clk_hw_get_rate(sama7g5_pmc->chws[PMC_MAIN]); break; case SAMA7G5_PLL_PARENT_MAIN_XTAL: - parent_data =3D AT91_CLK_PD_NAME(main_xtal_name); - hw =3D main_xtal_hw; + struct clk *main_xtal; + main_xtal =3D of_clk_get_by_name(np, main_xtal_name); + if (IS_ERR(main_xtal)) + goto err_free; + parent_data[0] =3D AT91_CLK_PD_NAME(main_xtal_name); + parent_rate =3D clk_get_rate(main_xtal); + clk_put(main_xtal); break; default: /* Should not happen. */ break; } =20 - parent_rate =3D clk_hw_get_rate(hw); if (!parent_rate) return; =20 @@ -1138,7 +1142,8 @@ static void __init sama7g5_pmc_setup(struct device_no= de *np) sama7g5_pmc->chws[sama7g5_mckx[i].eid] =3D hw; } =20 - hw =3D at91_clk_sama7g5_register_utmi(regmap, "utmick", NULL, main_xtal_h= w); + hw =3D at91_clk_sama7g5_register_utmi(regmap, "utmick", NULL, + &AT91_CLK_PD_NAME(main_xtal_name)); if (IS_ERR(hw)) goto err_free; =20 --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08D9F34CFA8; Fri, 16 Jan 2026 20:07:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594046; cv=none; b=ZNU2RqKiAdIvOfS6CFHtE/+yRl9g8DIolaeqDeNHXJEUfrr5YaCqawJ037dNXPC3Jpa+JI/c8ZbTequTlhoE3mggUqxFOHpXzX/4l8ydG/D8g/jzmgvcgdxJF46LsPqa/StepjDMZNpXrPwOKLNYNmMogcod58uQG/4RrG1XFCU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594046; c=relaxed/simple; bh=i+HmjWJwmg1Ne8dMrp2TjmodU6BZus8Si32RJLHwbok=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=M/dONxs1gSVR+jVAkdsDWr9Bs04Sn/XC88ohO/NweoNIWOkWvb3HdZmafgZzxjjyjsQi0TWwI4bsZOYBaYTxsrjBilAj5wzucjwvpNCE9X4T1/V3VE3Xg0frV6b7O+7rOpJpiWSCwY+k2W+luc5BPGPiKWd+YwItfnvYBuzgywQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=0N6Yrbnh; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="0N6Yrbnh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594045; x=1800130045; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=i+HmjWJwmg1Ne8dMrp2TjmodU6BZus8Si32RJLHwbok=; b=0N6YrbnhurT3eh5778PONvKgPMKurF7MrolvMBbPq9PZeK/7WvMGP+vK rd2KSZ/d83KVRLGshD/awNzDOPHeINs0tCLNUfIyUl3SNudDVO2J6wDXU LefEZl6BU7xdLQkaFrNZp6P6BYnQFN9FuB9/b8i5kxX58pccO7n2CqVR/ J7iY9FJjpn20EMUbQKZlBUeEr6xzGATwpZ77wsdQC5We6k3i/uhA7Je/T uy9RLV7IH8Byqd8TBZLxFKX4JY2aXPSZjDj18RMHdlSw2JLbsZjbW65eh lEJ8mNdqpqu0wWqdt/Qcn1Rg73ieYEw9oOtGqH2VC4UM2+V2HXToAFzRk A==; X-CSE-ConnectionGUID: +9RSiAtvRY+RhxWEUm06Wg== X-CSE-MsgGUID: OLs2/IBpSlyI+ueSWyzIrg== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="283397049" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2026 13:07:16 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex1.mchp-main.com (10.10.87.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.29; Fri, 16 Jan 2026 13:07:04 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:04 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 08/31] clk: at91: clk-master: use clk_parent_data Date: Fri, 16 Jan 2026 13:07:01 -0700 Message-ID: <548c567b5144e3556aee5e39a9c11ed13167a14a.1768512290.git.ryan.wanner@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Use struct clk_parent_data instead of struct parent_hw as this leads to less usage of __clk_get_hw() in SoC specific clock drivers and simpler conversion of existing SoC specific clock drivers from parent_names to modern clk_parent_data structures. __clk_get_hw will be removed in subsequent patches. Signed-off-by: Claudiu Beznea [ryan.wanner@microchip.com: Add clk-master changes to SAM9X75 and SAMA7D65 SoCs. As well as add md_slck commit message.] Signed-off-by: Ryan Wanner --- drivers/clk/at91/clk-master.c | 24 ++++++++++++------------ drivers/clk/at91/pmc.h | 6 +++--- drivers/clk/at91/sam9x7.c | 14 +++++++------- drivers/clk/at91/sama7d65.c | 17 +++++++---------- drivers/clk/at91/sama7g5.c | 17 +++++++---------- 5 files changed, 36 insertions(+), 42 deletions(-) diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c index d5ea2069ec83..b8d000b3b180 100644 --- a/drivers/clk/at91/clk-master.c +++ b/drivers/clk/at91/clk-master.c @@ -473,7 +473,7 @@ static struct clk_hw * __init at91_clk_register_master_internal(struct regmap *regmap, const char *name, int num_parents, const char **parent_names, - struct clk_hw **parent_hws, + struct clk_parent_data *parent_data, const struct clk_master_layout *layout, const struct clk_master_characteristics *characteristics, const struct clk_ops *ops, spinlock_t *lock, u32 flags) @@ -485,7 +485,7 @@ at91_clk_register_master_internal(struct regmap *regmap, unsigned long irqflags; int ret; =20 - if (!name || !num_parents || !(parent_names || parent_hws) || !lock) + if (!name || !num_parents || !(parent_names || parent_data) || !lock) return ERR_PTR(-EINVAL); =20 master =3D kzalloc(sizeof(*master), GFP_KERNEL); @@ -494,8 +494,8 @@ at91_clk_register_master_internal(struct regmap *regmap, =20 init.name =3D name; init.ops =3D ops; - if (parent_hws) - init.parent_hws =3D (const struct clk_hw **)parent_hws; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; else init.parent_names =3D parent_names; init.num_parents =3D num_parents; @@ -531,13 +531,13 @@ struct clk_hw * __init at91_clk_register_master_pres(struct regmap *regmap, const char *name, int num_parents, const char **parent_names, - struct clk_hw **parent_hws, + struct clk_parent_data *parent_data, const struct clk_master_layout *layout, const struct clk_master_characteristics *characteristics, spinlock_t *lock) { return at91_clk_register_master_internal(regmap, name, num_parents, - parent_names, parent_hws, layout, + parent_names, parent_data, layout, characteristics, &master_pres_ops, lock, CLK_SET_RATE_GATE); @@ -546,7 +546,7 @@ at91_clk_register_master_pres(struct regmap *regmap, struct clk_hw * __init at91_clk_register_master_div(struct regmap *regmap, const char *name, const char *parent_name, - struct clk_hw *parent_hw, const struct clk_master_layout *layout, + struct clk_parent_data *parent_data, const struct clk_master_layout *lay= out, const struct clk_master_characteristics *characteristics, spinlock_t *lock, u32 flags, u32 safe_div) { @@ -560,7 +560,7 @@ at91_clk_register_master_div(struct regmap *regmap, =20 hw =3D at91_clk_register_master_internal(regmap, name, 1, parent_name ? &parent_name : NULL, - parent_hw ? &parent_hw : NULL, layout, + parent_data, layout, characteristics, ops, lock, flags); =20 @@ -815,7 +815,7 @@ struct clk_hw * __init at91_clk_sama7g5_register_master(struct regmap *regmap, const char *name, int num_parents, const char **parent_names, - struct clk_hw **parent_hws, + struct clk_parent_data *parent_data, u32 *mux_table, spinlock_t *lock, u8 id, bool critical, int chg_pid) @@ -827,7 +827,7 @@ at91_clk_sama7g5_register_master(struct regmap *regmap, unsigned int val; int ret; =20 - if (!name || !num_parents || !(parent_names || parent_hws) || !mux_table = || + if (!name || !num_parents || !(parent_names || parent_data) || !mux_table= || !lock || id > MASTER_MAX_ID) return ERR_PTR(-EINVAL); =20 @@ -837,8 +837,8 @@ at91_clk_sama7g5_register_master(struct regmap *regmap, =20 init.name =3D name; init.ops =3D &sama7g5_master_ops; - if (parent_hws) - init.parent_hws =3D (const struct clk_hw **)parent_hws; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; else init.parent_names =3D parent_names; init.num_parents =3D num_parents; diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index dcb678732471..24ef879c712c 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -207,14 +207,14 @@ at91_clk_register_sam9x5_main(struct regmap *regmap, = const char *name, struct clk_hw * __init at91_clk_register_master_pres(struct regmap *regmap, const char *name, int num_parents, const char **parent_names, - struct clk_hw **parent_hws, + struct clk_parent_data *parent_data, const struct clk_master_layout *layout, const struct clk_master_characteristics *characteristics, spinlock_t *lock); =20 struct clk_hw * __init at91_clk_register_master_div(struct regmap *regmap, const char *name, - const char *parent_names, struct clk_hw *parent_hw, + const char *parent_names, struct clk_parent_data *parent_data, const struct clk_master_layout *layout, const struct clk_master_characteristics *characteristics, spinlock_t *lock, u32 flags, u32 safe_div); @@ -223,7 +223,7 @@ struct clk_hw * __init at91_clk_sama7g5_register_master(struct regmap *regmap, const char *name, int num_parents, const char **parent_names, - struct clk_hw **parent_hws, u32 *mux_table, + struct clk_parent_data *parent_data, u32 *mux_table, spinlock_t *lock, u8 id, bool critical, int chg_pid); =20 diff --git a/drivers/clk/at91/sam9x7.c b/drivers/clk/at91/sam9x7.c index aee1d60492aa..e8005b727a6b 100644 --- a/drivers/clk/at91/sam9x7.c +++ b/drivers/clk/at91/sam9x7.c @@ -752,7 +752,7 @@ static void __init sam9x7_pmc_setup(struct device_node = *np) struct regmap *regmap; struct clk_hw *hw, *main_rc_hw, *main_osc_hw, *main_xtal_hw; struct clk_hw *td_slck_hw, *md_slck_hw, *usbck_hw; - struct clk_parent_data parent_data[2]; + struct clk_parent_data parent_data[9]; struct clk_hw *parent_hws[9]; int i, j; =20 @@ -862,18 +862,18 @@ static void __init sam9x7_pmc_setup(struct device_nod= e *np) } } =20 - parent_hws[0] =3D md_slck_hw; - parent_hws[1] =3D sam9x7_pmc->chws[PMC_MAIN]; - parent_hws[2] =3D sam9x7_plls[PLL_ID_PLLA][PLL_COMPID_DIV0].hw; - parent_hws[3] =3D sam9x7_plls[PLL_ID_UPLL][PLL_COMPID_DIV0].hw; + parent_data[0] =3D AT91_CLK_PD_NAME("md_slck"); + parent_data[1] =3D AT91_CLK_PD_HW(sam9x7_pmc->chws[PMC_MAIN]); + parent_data[2] =3D AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_PLLA][PLL_COMPID_DIV= 0].hw); + parent_data[3] =3D AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_UPLL][PLL_COMPID_DIV= 0].hw); hw =3D at91_clk_register_master_pres(regmap, "masterck_pres", 4, - NULL, parent_hws, &sam9x7_master_layout, + NULL, parent_data, &sam9x7_master_layout, &mck_characteristics, &mck_lock); if (IS_ERR(hw)) goto err_free; =20 hw =3D at91_clk_register_master_div(regmap, "masterck_div", - NULL, hw, &sam9x7_master_layout, + NULL, &AT91_CLK_PD_HW(hw), &sam9x7_master_layout, &mck_characteristics, &mck_lock, CLK_SET_RATE_GATE, 0); if (IS_ERR(hw)) diff --git a/drivers/clk/at91/sama7d65.c b/drivers/clk/at91/sama7d65.c index 94e3fe78929d..ccbc459edd31 100644 --- a/drivers/clk/at91/sama7d65.c +++ b/drivers/clk/at91/sama7d65.c @@ -1101,7 +1101,7 @@ static void __init sama7d65_pmc_setup(struct device_n= ode *np) struct regmap *regmap; struct clk_hw *hw, *main_rc_hw, *main_osc_hw, *main_xtal_hw; struct clk_hw *td_slck_hw, *md_slck_hw; - struct clk_parent_data parent_data[2]; + struct clk_parent_data parent_data[10]; struct clk_hw *parent_hws[10]; bool bypass; int i, j; @@ -1212,7 +1212,7 @@ static void __init sama7d65_pmc_setup(struct device_n= ode *np) } =20 hw =3D at91_clk_register_master_div(regmap, "mck0", NULL, - sama7d65_plls[PLL_ID_CPU][1].hw, + &AT91_CLK_PD_HW(sama7d65_plls[PLL_ID_CPU][1].hw), &mck0_layout, &mck0_characteristics, &pmc_mck0_lock, CLK_GET_RATE_NOCACHE, 5); if (IS_ERR(hw)) @@ -1221,12 +1221,11 @@ static void __init sama7d65_pmc_setup(struct device= _node *np) sama7d65_pmc->chws[PMC_MCK] =3D hw; sama7d65_mckx[PCK_PARENT_HW_MCK0].hw =3D hw; =20 - parent_hws[0] =3D md_slck_hw; - parent_hws[1] =3D td_slck_hw; - parent_hws[2] =3D sama7d65_pmc->chws[PMC_MAIN]; + parent_data[0] =3D AT91_CLK_PD_NAME("md_slck"); + parent_data[1] =3D AT91_CLK_PD_NAME("td_slck"); + parent_data[2] =3D AT91_CLK_PD_HW(sama7d65_pmc->chws[PMC_MAIN]); for (i =3D PCK_PARENT_HW_MCK1; i < ARRAY_SIZE(sama7d65_mckx); i++) { u8 num_parents =3D 3 + sama7d65_mckx[i].ep_count; - struct clk_hw *tmp_parent_hws[8]; u32 *mux_table; =20 mux_table =3D kmalloc_array(num_parents, sizeof(*mux_table), @@ -1243,13 +1242,11 @@ static void __init sama7d65_pmc_setup(struct device= _node *np) u8 pll_id =3D sama7d65_mckx[i].ep[j].pll_id; u8 pll_compid =3D sama7d65_mckx[i].ep[j].pll_compid; =20 - tmp_parent_hws[j] =3D sama7d65_plls[pll_id][pll_compid].hw; + parent_data[3 + j] =3D AT91_CLK_PD_HW(sama7d65_plls[pll_id][pll_compid]= .hw); } - PMC_FILL_TABLE(&parent_hws[3], tmp_parent_hws, - sama7d65_mckx[i].ep_count); =20 hw =3D at91_clk_sama7g5_register_master(regmap, sama7d65_mckx[i].n, - num_parents, NULL, parent_hws, + num_parents, NULL, parent_data, mux_table, &pmc_mckX_lock, sama7d65_mckx[i].id, sama7d65_mckx[i].c, diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c index 058004379ce9..74cf712f2820 100644 --- a/drivers/clk/at91/sama7g5.c +++ b/drivers/clk/at91/sama7g5.c @@ -978,7 +978,7 @@ static void __init sama7g5_pmc_setup(struct device_node= *np) struct regmap *regmap; struct clk_hw *hw, *main_rc_hw, *main_osc_hw; struct clk_hw *td_slck_hw, *md_slck_hw; - struct clk_parent_data parent_data[2]; + struct clk_parent_data parent_data[10]; struct clk_hw *parent_hws[10]; bool bypass; int i, j; @@ -1094,7 +1094,7 @@ static void __init sama7g5_pmc_setup(struct device_no= de *np) } =20 hw =3D at91_clk_register_master_div(regmap, "mck0", NULL, - sama7g5_plls[PLL_ID_CPU][1].hw, + &AT91_CLK_PD_HW(sama7g5_plls[PLL_ID_CPU][1].hw), &mck0_layout, &mck0_characteristics, &pmc_mck0_lock, CLK_GET_RATE_NOCACHE, 5); if (IS_ERR(hw)) @@ -1102,12 +1102,11 @@ static void __init sama7g5_pmc_setup(struct device_= node *np) =20 sama7g5_mckx[PCK_PARENT_HW_MCK0].hw =3D sama7g5_pmc->chws[PMC_MCK] =3D hw; =20 - parent_hws[0] =3D md_slck_hw; - parent_hws[1] =3D td_slck_hw; - parent_hws[2] =3D sama7g5_pmc->chws[PMC_MAIN]; + parent_data[0] =3D AT91_CLK_PD_NAME("md_slck"); + parent_data[1] =3D AT91_CLK_PD_NAME("td_slck"); + parent_data[2] =3D AT91_CLK_PD_HW(sama7g5_pmc->chws[PMC_MAIN]); for (i =3D PCK_PARENT_HW_MCK1; i < ARRAY_SIZE(sama7g5_mckx); i++) { u8 num_parents =3D 3 + sama7g5_mckx[i].ep_count; - struct clk_hw *tmp_parent_hws[8]; u32 *mux_table; =20 mux_table =3D kmalloc_array(num_parents, sizeof(*mux_table), @@ -1122,13 +1121,11 @@ static void __init sama7g5_pmc_setup(struct device_= node *np) u8 pll_id =3D sama7g5_mckx[i].ep[j].pll_id; u8 pll_compid =3D sama7g5_mckx[i].ep[j].pll_compid; =20 - tmp_parent_hws[j] =3D sama7g5_plls[pll_id][pll_compid].hw; + parent_data[3 + j] =3D AT91_CLK_PD_HW(sama7g5_plls[pll_id][pll_compid].= hw); } - PMC_FILL_TABLE(&parent_hws[3], tmp_parent_hws, - sama7g5_mckx[i].ep_count); =20 hw =3D at91_clk_sama7g5_register_master(regmap, sama7g5_mckx[i].n, - num_parents, NULL, parent_hws, mux_table, + num_parents, NULL, parent_data, mux_table, &pmc_mckX_lock, sama7g5_mckx[i].id, sama7g5_mckx[i].c, sama7g5_mckx[i].ep_chg_id); --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9132B3A9630; Fri, 16 Jan 2026 20:07:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594068; cv=none; b=rornZyG71VmSWJJlxISa/bVau3uj/FE/4WbhW4KjCIIRo2RjmAIXMPonJE14jH9hJoAxBLdjVtny3SdkixfwlsQ5Ibv+qYrhmN5Wt/hXlWCYfLJLNfQDhCOAp1pECbvWgaS7Fo9AsUTzGmLNUskRR0+pWfRZlChv3Br++Yz2d+w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594068; c=relaxed/simple; bh=ZQjcyRY9e5iNE8CAhpxZuNgtiYbb5egXID9V0jq/KLA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NXrL0A2O6z6BocvoVzvUQKokMp2/eimid+Fx7bXthDVHRxj3RMx/PbJQ1KblIFHzcieGDsyJUNLA3rs0b1ChX7Hmgc0s8b2j7ZJ3BAnEom4a9XQGGQ6SYS5oWLqPlJdK7zVOa1jnV1IBNiUzNupmRuwHMzXsFzc1xunQofRsB48= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=vK1xaxNP; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="vK1xaxNP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594065; x=1800130065; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZQjcyRY9e5iNE8CAhpxZuNgtiYbb5egXID9V0jq/KLA=; b=vK1xaxNP79dNCw9VBO0EWb1M7SDwV2v2iXBIGdrxNMhtsLtJWRqafKZn w9sXYrTHv6zvxaukMoU3+s/V11EuXxQ69P16CscGxdXmIaV5WTbjnk7OY EMeo8UHzA67TXq80V3lBg74x8Ze2KEbIxyWE5XpuwfKz9qQcJgDrWKDyA XlZzMCGPofrXXtO11qDK/SBYOaQzuedM20r8wS4pm5u/Ff37Fa1YBu2W0 7TVePQVTLM8hlB8wi8MhECSllSzis2pvY7XfOr7rTxN9E/FY3FBt8weEH I40WkfSdcZ5oN/8ejB07CAhGgTfMHCO3j/Z6fIR0EbHXg05RZxA7EEzOs w==; X-CSE-ConnectionGUID: 3LvvvroxTJyR6T9mab+TNA== X-CSE-MsgGUID: HoJZ+6TzRu23azwuOoT4DA== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="51290366" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Jan 2026 13:07:34 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Fri, 16 Jan 2026 13:07:04 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:04 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 09/31] clk: at91: clk-programmable: use clk_parent_data Date: Fri, 16 Jan 2026 13:07:02 -0700 Message-ID: <6139b579434c16fefacd3635d2c7ea67b9ef7822.1768512290.git.ryan.wanner@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Use struct clk_parent_data instead of struct parent_hw as this leads to less usage of __clk_get_hw() in SoC specific clock drivers and simpler conversion of existing SoC specific clock drivers from parent_names to modern clk_parent_data structures. Subsequent patches will aim to completely remove __clk_get_hw(). Signed-off-by: Claudiu Beznea [ryan.wanner@microchip.com: Add the clk-programmable changes to the SAMA7D65 and SAM9X75 SoCs.] Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/clk-programmable.c | 8 ++++---- drivers/clk/at91/pmc.h | 2 +- drivers/clk/at91/sam9x7.c | 16 ++++++++-------- drivers/clk/at91/sama7d65.c | 20 ++++++++++---------- drivers/clk/at91/sama7g5.c | 20 ++++++++++---------- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/drivers/clk/at91/clk-programmable.c b/drivers/clk/at91/clk-pro= grammable.c index 1195fb405503..275ca701f294 100644 --- a/drivers/clk/at91/clk-programmable.c +++ b/drivers/clk/at91/clk-programmable.c @@ -215,7 +215,7 @@ static const struct clk_ops programmable_ops =3D { struct clk_hw * __init at91_clk_register_programmable(struct regmap *regmap, const char *name, const char **parent_names, - struct clk_hw **parent_hws, u8 num_parents, u8 id, + struct clk_parent_data *parent_data, u8 num_parents, u8 id, const struct clk_programmable_layout *layout, u32 *mux_table) { @@ -224,7 +224,7 @@ at91_clk_register_programmable(struct regmap *regmap, struct clk_init_data init =3D {}; int ret; =20 - if (id > PROG_ID_MAX || !(parent_names || parent_hws)) + if (id > PROG_ID_MAX || !(parent_names || parent_data)) return ERR_PTR(-EINVAL); =20 prog =3D kzalloc(sizeof(*prog), GFP_KERNEL); @@ -233,8 +233,8 @@ at91_clk_register_programmable(struct regmap *regmap, =20 init.name =3D name; init.ops =3D &programmable_ops; - if (parent_hws) - init.parent_hws =3D (const struct clk_hw **)parent_hws; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; else init.parent_names =3D parent_names; init.num_parents =3D num_parents; diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index 24ef879c712c..3d06b1c41f13 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -266,7 +266,7 @@ sam9x60_clk_register_frac_pll(struct regmap *regmap, sp= inlock_t *lock, =20 struct clk_hw * __init at91_clk_register_programmable(struct regmap *regmap, const char *name, - const char **parent_names, struct clk_hw **parent_hws, + const char **parent_names, struct clk_parent_data *parent_data, u8 num_parents, u8 id, const struct clk_programmable_layout *layout, u32 *mux_table); diff --git a/drivers/clk/at91/sam9x7.c b/drivers/clk/at91/sam9x7.c index e8005b727a6b..f98aecdd6f88 100644 --- a/drivers/clk/at91/sam9x7.c +++ b/drivers/clk/at91/sam9x7.c @@ -888,20 +888,20 @@ static void __init sam9x7_pmc_setup(struct device_nod= e *np) if (IS_ERR(usbck_hw)) goto err_free; =20 - parent_hws[0] =3D md_slck_hw; - parent_hws[1] =3D td_slck_hw; - parent_hws[2] =3D sam9x7_pmc->chws[PMC_MAIN]; - parent_hws[3] =3D sam9x7_pmc->chws[PMC_MCK]; - parent_hws[4] =3D sam9x7_plls[PLL_ID_PLLA][PLL_COMPID_DIV0].hw; - parent_hws[5] =3D sam9x7_plls[PLL_ID_UPLL][PLL_COMPID_DIV0].hw; - parent_hws[6] =3D sam9x7_plls[PLL_ID_AUDIO][PLL_COMPID_DIV0].hw; + parent_data[0] =3D AT91_CLK_PD_NAME("md_slck"); + parent_data[1] =3D AT91_CLK_PD_NAME("td_slck"); + parent_data[2] =3D AT91_CLK_PD_HW(sam9x7_pmc->chws[PMC_MAIN]); + parent_data[3] =3D AT91_CLK_PD_HW(sam9x7_pmc->chws[PMC_MCK]); + parent_data[4] =3D AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_PLLA][PLL_COMPID_DIV= 0].hw); + parent_data[5] =3D AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_UPLL][PLL_COMPID_DIV= 0].hw); + parent_data[6] =3D AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_AUDIO][PLL_COMPID_DI= V0].hw); for (i =3D 0; i < 2; i++) { char name[6]; =20 snprintf(name, sizeof(name), "prog%d", i); =20 hw =3D at91_clk_register_programmable(regmap, name, - NULL, parent_hws, 7, i, + NULL, parent_data, 7, i, &sam9x7_programmable_layout, NULL); if (IS_ERR(hw)) diff --git a/drivers/clk/at91/sama7d65.c b/drivers/clk/at91/sama7d65.c index ccbc459edd31..988b86fb0c35 100644 --- a/drivers/clk/at91/sama7d65.c +++ b/drivers/clk/at91/sama7d65.c @@ -1267,22 +1267,22 @@ static void __init sama7d65_pmc_setup(struct device= _node *np) if (IS_ERR(hw)) goto err_free; =20 - parent_hws[0] =3D md_slck_hw; - parent_hws[1] =3D td_slck_hw; - parent_hws[2] =3D sama7d65_pmc->chws[PMC_MAIN]; - parent_hws[3] =3D sama7d65_plls[PLL_ID_SYS][PLL_COMPID_DIV0].hw; - parent_hws[4] =3D sama7d65_plls[PLL_ID_DDR][PLL_COMPID_DIV0].hw; - parent_hws[5] =3D sama7d65_plls[PLL_ID_GPU][PLL_COMPID_DIV0].hw; - parent_hws[6] =3D sama7d65_plls[PLL_ID_BAUD][PLL_COMPID_DIV0].hw; - parent_hws[7] =3D sama7d65_plls[PLL_ID_AUDIO][PLL_COMPID_DIV0].hw; - parent_hws[8] =3D sama7d65_plls[PLL_ID_ETH][PLL_COMPID_DIV0].hw; + parent_data[0] =3D AT91_CLK_PD_NAME("md_slck"); + parent_data[1] =3D AT91_CLK_PD_NAME("td_slck"); + parent_data[2] =3D AT91_CLK_PD_HW(sama7d65_pmc->chws[PMC_MAIN]); + parent_data[3] =3D AT91_CLK_PD_HW(sama7d65_plls[PLL_ID_SYS][PLL_COMPID_DI= V0].hw); + parent_data[4] =3D AT91_CLK_PD_HW(sama7d65_plls[PLL_ID_DDR][PLL_COMPID_DI= V0].hw); + parent_data[5] =3D AT91_CLK_PD_HW(sama7d65_plls[PLL_ID_GPU][PLL_COMPID_DI= V0].hw); + parent_data[6] =3D AT91_CLK_PD_HW(sama7d65_plls[PLL_ID_BAUD][PLL_COMPID_D= IV0].hw); + parent_data[7] =3D AT91_CLK_PD_HW(sama7d65_plls[PLL_ID_AUDIO][PLL_COMPID_= DIV0].hw); + parent_data[8] =3D AT91_CLK_PD_HW(sama7d65_plls[PLL_ID_ETH][PLL_COMPID_DI= V0].hw); =20 for (i =3D 0; i < 8; i++) { char name[6]; =20 snprintf(name, sizeof(name), "prog%d", i); =20 - hw =3D at91_clk_register_programmable(regmap, name, NULL, parent_hws, + hw =3D at91_clk_register_programmable(regmap, name, NULL, parent_data, 9, i, &programmable_layout, sama7d65_prog_mux_table); diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c index 74cf712f2820..b772b9e15b78 100644 --- a/drivers/clk/at91/sama7g5.c +++ b/drivers/clk/at91/sama7g5.c @@ -1146,21 +1146,21 @@ static void __init sama7g5_pmc_setup(struct device_= node *np) =20 sama7g5_pmc->chws[PMC_UTMI] =3D hw; =20 - parent_hws[0] =3D md_slck_hw; - parent_hws[1] =3D td_slck_hw; - parent_hws[2] =3D sama7g5_pmc->chws[PMC_MAIN]; - parent_hws[3] =3D sama7g5_plls[PLL_ID_SYS][PLL_COMPID_DIV0].hw; - parent_hws[4] =3D sama7g5_plls[PLL_ID_DDR][PLL_COMPID_DIV0].hw; - parent_hws[5] =3D sama7g5_plls[PLL_ID_IMG][PLL_COMPID_DIV0].hw; - parent_hws[6] =3D sama7g5_plls[PLL_ID_BAUD][PLL_COMPID_DIV0].hw; - parent_hws[7] =3D sama7g5_plls[PLL_ID_AUDIO][PLL_COMPID_DIV0].hw; - parent_hws[8] =3D sama7g5_plls[PLL_ID_ETH][PLL_COMPID_DIV0].hw; + parent_data[0] =3D AT91_CLK_PD_NAME("md_slck"); + parent_data[1] =3D AT91_CLK_PD_NAME("td_slck"); + parent_data[2] =3D AT91_CLK_PD_HW(sama7g5_pmc->chws[PMC_MAIN]); + parent_data[3] =3D AT91_CLK_PD_HW(sama7g5_plls[PLL_ID_SYS][PLL_COMPID_DIV= 0].hw); + parent_data[4] =3D AT91_CLK_PD_HW(sama7g5_plls[PLL_ID_DDR][PLL_COMPID_DIV= 0].hw); + parent_data[5] =3D AT91_CLK_PD_HW(sama7g5_plls[PLL_ID_IMG][PLL_COMPID_DIV= 0].hw); + parent_data[6] =3D AT91_CLK_PD_HW(sama7g5_plls[PLL_ID_BAUD][PLL_COMPID_DI= V0].hw); + parent_data[7] =3D AT91_CLK_PD_HW(sama7g5_plls[PLL_ID_AUDIO][PLL_COMPID_D= IV0].hw); + parent_data[8] =3D AT91_CLK_PD_HW(sama7g5_plls[PLL_ID_ETH][PLL_COMPID_DIV= 0].hw); for (i =3D 0; i < 8; i++) { char name[6]; =20 snprintf(name, sizeof(name), "prog%d", i); =20 - hw =3D at91_clk_register_programmable(regmap, name, NULL, parent_hws, + hw =3D at91_clk_register_programmable(regmap, name, NULL, parent_data, 9, i, &programmable_layout, sama7g5_prog_mux_table); --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F7713A9628; Fri, 16 Jan 2026 20:07:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594068; cv=none; b=LB/CfddXxMwBR97ThdlzElrfTggW2baLzxshtq9A9Qyfw+XteWlCHrlt4RhpwwqFhgvCbU4u5ffeDP9hvd5kT7FmIgPTCm/ist9BWVwPKa7Xrb39CyBIH7ztkh6P7mGLf7PGbs3ojOkCXqM3oC+67qIITIm7J3OCnAJ+eeDmHhM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594068; c=relaxed/simple; bh=/0auepPc0BBFivSCmGbtSCZiAbhCYr28sOuFJy1oeyw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aW65SYZmCs0+BnRH1EgoocyC53fNfsS5y49T+RBCqPojxrxoBT5nZa6oPZD4wch5UJRbIbu5rWjnn5lK3oAlInTpsgbd9QmoCgGXBJNLZJKsGl08ns19sRH/vGwrJzwOLVxGKV2bSeufrxgeFv8GlAsrS1J20ewOYAXaGbhPC+4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=sSi8QH75; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="sSi8QH75" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594065; x=1800130065; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/0auepPc0BBFivSCmGbtSCZiAbhCYr28sOuFJy1oeyw=; b=sSi8QH75fn/u5VyRLUGyQmOm20Xfi7IWFj4jnPJCCaatfSIlQM2GwstY 7rMVZyR6Bs6QXFCVufmPfv69RDoshc1RDyXhk55vEgUFpm8eMDmpjIFbR W7BlhA/H08LPE9vFF64eWXw+D1nVi3oEf3LFs/CwnugN8RH2XJ0AG+CiF +Qe+F2VzlwUWrld2w1ecG315ZUcqSj1hlzv4T3273J6tNPG7rWwSjL3hP x8hGUOZ8/4O/QbIv/kPUCy16fFmuyGfwyTcECNhh/WjD8pfEOEhwwAA6U 4+Gc4zpx8hpwUVCwY2MhCFsdf24vkvcnI2SFwbZXNvpKr/5reda2M5bb6 w==; X-CSE-ConnectionGUID: 3LvvvroxTJyR6T9mab+TNA== X-CSE-MsgGUID: 8tPnzI7KR9SlDKGfmMipAA== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="51290367" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Jan 2026 13:07:34 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Fri, 16 Jan 2026 13:07:05 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:05 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 10/31] clk: at91: clk-generated: use clk_parent_data Date: Fri, 16 Jan 2026 13:07:03 -0700 Message-ID: <564e91919099ad05f11d22ff20a6dc674f1d0ba4.1768512290.git.ryan.wanner@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Use struct clk_parent_data instead of struct parent_hw as this leads to less usage of __clk_get_hw() in SoC specific clock drivers and simpler conversion of existing SoC specific clock drivers from parent_names to modern clk_parent_data structures. Remove the last of the usage of __clk_get_hw(). Signed-off-by: Claudiu Beznea [ryan.wanner@microchip.com: Added SAMA7D65 and SAM9X75 SoCs to the clk-generated changes. Adjust clk name variable order.] Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/clk-generated.c | 8 +++---- drivers/clk/at91/pmc.h | 2 +- drivers/clk/at91/sam9x7.c | 37 ++++++++++++++++---------------- drivers/clk/at91/sama7d65.c | 37 ++++++++++++++++---------------- drivers/clk/at91/sama7g5.c | 35 +++++++++++++++--------------- 5 files changed, 58 insertions(+), 61 deletions(-) diff --git a/drivers/clk/at91/clk-generated.c b/drivers/clk/at91/clk-genera= ted.c index 4b4edeecc889..d9e00167dbc8 100644 --- a/drivers/clk/at91/clk-generated.c +++ b/drivers/clk/at91/clk-generated.c @@ -319,7 +319,7 @@ struct clk_hw * __init at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock, const struct clk_pcr_layout *layout, const char *name, const char **parent_names, - struct clk_hw **parent_hws, + struct clk_parent_data *parent_data, u32 *mux_table, u8 num_parents, u8 id, const struct clk_range *range, int chg_pid) @@ -329,7 +329,7 @@ at91_clk_register_generated(struct regmap *regmap, spin= lock_t *lock, struct clk_hw *hw; int ret; =20 - if (!(parent_names || parent_hws)) + if (!(parent_names || parent_data)) return ERR_PTR(-ENOMEM); =20 gck =3D kzalloc(sizeof(*gck), GFP_KERNEL); @@ -338,8 +338,8 @@ at91_clk_register_generated(struct regmap *regmap, spin= lock_t *lock, =20 init.name =3D name; init.ops =3D &generated_ops; - if (parent_hws) - init.parent_hws =3D (const struct clk_hw **)parent_hws; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; else init.parent_names =3D parent_names; init.num_parents =3D num_parents; diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index 3d06b1c41f13..d8d491096c0d 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -174,7 +174,7 @@ struct clk_hw * __init at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock, const struct clk_pcr_layout *layout, const char *name, const char **parent_names, - struct clk_hw **parent_hws, u32 *mux_table, + struct clk_parent_data *parent_data, u32 *mux_table, u8 num_parents, u8 id, const struct clk_range *range, int chg_pid); =20 diff --git a/drivers/clk/at91/sam9x7.c b/drivers/clk/at91/sam9x7.c index f98aecdd6f88..d549bdd988e8 100644 --- a/drivers/clk/at91/sam9x7.c +++ b/drivers/clk/at91/sam9x7.c @@ -744,16 +744,15 @@ static const struct { static void __init sam9x7_pmc_setup(struct device_node *np) { struct clk_range range =3D CLK_RANGE(0, 0); - const char *main_xtal_name; + const char *main_xtal_name, *td_slck_name, *md_slck_name; struct pmc_data *sam9x7_pmc; const char *parent_names[9]; void **clk_mux_buffer =3D NULL; int clk_mux_buffer_size =3D 0; struct regmap *regmap; struct clk_hw *hw, *main_rc_hw, *main_osc_hw, *main_xtal_hw; - struct clk_hw *td_slck_hw, *md_slck_hw, *usbck_hw; + struct clk_hw *usbck_hw; struct clk_parent_data parent_data[9]; - struct clk_hw *parent_hws[9]; int i, j; =20 i =3D of_property_match_string(np, "clock-names", "main_xtal"); @@ -762,11 +761,15 @@ static void __init sam9x7_pmc_setup(struct device_nod= e *np) return; main_xtal_name =3D of_clk_get_parent_name(np, i); =20 - td_slck_hw =3D __clk_get_hw(of_clk_get_by_name(np, "td_slck")); - md_slck_hw =3D __clk_get_hw(of_clk_get_by_name(np, "md_slck")); + i =3D of_property_match_string(np, "clock-names", "td_slck"); + if (i < 0) + return; + td_slck_name =3D of_clk_get_parent_name(np, i); =20 - if (!td_slck_hw || !md_slck_hw) + i =3D of_property_match_string(np, "clock-names", "md_slck"); + if (i < 0) return; + md_slck_name =3D of_clk_get_parent_name(np, i); =20 regmap =3D device_node_to_regmap(np); if (IS_ERR(regmap)) @@ -862,7 +865,7 @@ static void __init sam9x7_pmc_setup(struct device_node = *np) } } =20 - parent_data[0] =3D AT91_CLK_PD_NAME("md_slck"); + parent_data[0] =3D AT91_CLK_PD_NAME(md_slck_name); parent_data[1] =3D AT91_CLK_PD_HW(sam9x7_pmc->chws[PMC_MAIN]); parent_data[2] =3D AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_PLLA][PLL_COMPID_DIV= 0].hw); parent_data[3] =3D AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_UPLL][PLL_COMPID_DIV= 0].hw); @@ -888,8 +891,8 @@ static void __init sam9x7_pmc_setup(struct device_node = *np) if (IS_ERR(usbck_hw)) goto err_free; =20 - parent_data[0] =3D AT91_CLK_PD_NAME("md_slck"); - parent_data[1] =3D AT91_CLK_PD_NAME("td_slck"); + parent_data[0] =3D AT91_CLK_PD_NAME(md_slck_name); + parent_data[1] =3D AT91_CLK_PD_NAME(td_slck_name); parent_data[2] =3D AT91_CLK_PD_HW(sam9x7_pmc->chws[PMC_MAIN]); parent_data[3] =3D AT91_CLK_PD_HW(sam9x7_pmc->chws[PMC_MCK]); parent_data[4] =3D AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_PLLA][PLL_COMPID_DIV= 0].hw); @@ -940,13 +943,12 @@ static void __init sam9x7_pmc_setup(struct device_nod= e *np) sam9x7_pmc->phws[sam9x7_periphck[i].id] =3D hw; } =20 - parent_hws[0] =3D md_slck_hw; - parent_hws[1] =3D td_slck_hw; - parent_hws[2] =3D sam9x7_pmc->chws[PMC_MAIN]; - parent_hws[3] =3D sam9x7_pmc->chws[PMC_MCK]; + parent_data[0] =3D AT91_CLK_PD_NAME(md_slck_name); + parent_data[1] =3D AT91_CLK_PD_NAME(td_slck_name); + parent_data[2] =3D AT91_CLK_PD_HW(sam9x7_pmc->chws[PMC_MAIN]); + parent_data[3] =3D AT91_CLK_PD_HW(sam9x7_pmc->chws[PMC_MCK]); for (i =3D 0; i < ARRAY_SIZE(sam9x7_gck); i++) { u8 num_parents =3D 4 + sam9x7_gck[i].pp_count; - struct clk_hw *tmp_parent_hws[6]; u32 *mux_table; =20 mux_table =3D kmalloc_array(num_parents, sizeof(*mux_table), @@ -962,16 +964,13 @@ static void __init sam9x7_pmc_setup(struct device_nod= e *np) u8 pll_id =3D sam9x7_gck[i].pp[j].pll_id; u8 pll_compid =3D sam9x7_gck[i].pp[j].pll_compid; =20 - tmp_parent_hws[j] =3D sam9x7_plls[pll_id][pll_compid].hw; + parent_data[4 + j] =3D AT91_CLK_PD_HW(sam9x7_plls[pll_id][pll_compid].h= w); } =20 - PMC_FILL_TABLE(&parent_hws[4], tmp_parent_hws, - sam9x7_gck[i].pp_count); - hw =3D at91_clk_register_generated(regmap, &pmc_pcr_lock, &sam9x7_pcr_layout, sam9x7_gck[i].n, - NULL, parent_hws, mux_table, + NULL, parent_data, mux_table, num_parents, sam9x7_gck[i].id, &sam9x7_gck[i].r, diff --git a/drivers/clk/at91/sama7d65.c b/drivers/clk/at91/sama7d65.c index 988b86fb0c35..355eaf941681 100644 --- a/drivers/clk/at91/sama7d65.c +++ b/drivers/clk/at91/sama7d65.c @@ -1093,16 +1093,14 @@ static const struct clk_pcr_layout sama7d65_pcr_lay= out =3D { =20 static void __init sama7d65_pmc_setup(struct device_node *np) { - const char *main_xtal_name; + const char *main_xtal_name, *md_slck_name, *td_slck_name; struct pmc_data *sama7d65_pmc; const char *parent_names[11]; void **alloc_mem =3D NULL; int alloc_mem_size =3D 0; struct regmap *regmap; struct clk_hw *hw, *main_rc_hw, *main_osc_hw, *main_xtal_hw; - struct clk_hw *td_slck_hw, *md_slck_hw; struct clk_parent_data parent_data[10]; - struct clk_hw *parent_hws[10]; bool bypass; int i, j; =20 @@ -1111,11 +1109,15 @@ static void __init sama7d65_pmc_setup(struct device= _node *np) return; main_xtal_name =3D of_clk_get_parent_name(np, i); =20 - td_slck_hw =3D __clk_get_hw(of_clk_get_by_name(np, "td_slck")); - md_slck_hw =3D __clk_get_hw(of_clk_get_by_name(np, "md_slck")); + i =3D of_property_match_string(np, "clock-names", "td_slck"); + if (i < 0) + return; + td_slck_name =3D of_clk_get_parent_name(np, i); =20 - if (!td_slck_hw || !md_slck_hw) + i =3D of_property_match_string(np, "clock-names", "md_slck"); + if (i < 0) return; + md_slck_name =3D of_clk_get_parent_name(np, i); =20 regmap =3D device_node_to_regmap(np); if (IS_ERR(regmap)) @@ -1221,8 +1223,8 @@ static void __init sama7d65_pmc_setup(struct device_n= ode *np) sama7d65_pmc->chws[PMC_MCK] =3D hw; sama7d65_mckx[PCK_PARENT_HW_MCK0].hw =3D hw; =20 - parent_data[0] =3D AT91_CLK_PD_NAME("md_slck"); - parent_data[1] =3D AT91_CLK_PD_NAME("td_slck"); + parent_data[0] =3D AT91_CLK_PD_NAME(md_slck_name); + parent_data[1] =3D AT91_CLK_PD_NAME(td_slck_name); parent_data[2] =3D AT91_CLK_PD_HW(sama7d65_pmc->chws[PMC_MAIN]); for (i =3D PCK_PARENT_HW_MCK1; i < ARRAY_SIZE(sama7d65_mckx); i++) { u8 num_parents =3D 3 + sama7d65_mckx[i].ep_count; @@ -1267,8 +1269,8 @@ static void __init sama7d65_pmc_setup(struct device_n= ode *np) if (IS_ERR(hw)) goto err_free; =20 - parent_data[0] =3D AT91_CLK_PD_NAME("md_slck"); - parent_data[1] =3D AT91_CLK_PD_NAME("td_slck"); + parent_data[0] =3D AT91_CLK_PD_NAME(md_slck_name); + parent_data[1] =3D AT91_CLK_PD_NAME(td_slck_name); parent_data[2] =3D AT91_CLK_PD_HW(sama7d65_pmc->chws[PMC_MAIN]); parent_data[3] =3D AT91_CLK_PD_HW(sama7d65_plls[PLL_ID_SYS][PLL_COMPID_DI= V0].hw); parent_data[4] =3D AT91_CLK_PD_HW(sama7d65_plls[PLL_ID_DDR][PLL_COMPID_DI= V0].hw); @@ -1318,13 +1320,12 @@ static void __init sama7d65_pmc_setup(struct device= _node *np) sama7d65_pmc->phws[sama7d65_periphck[i].id] =3D hw; } =20 - parent_hws[0] =3D md_slck_hw; - parent_hws[1] =3D td_slck_hw; - parent_hws[2] =3D sama7d65_pmc->chws[PMC_MAIN]; - parent_hws[3] =3D sama7d65_pmc->chws[PMC_MCK1]; + parent_data[0] =3D AT91_CLK_PD_NAME(md_slck_name); + parent_data[1] =3D AT91_CLK_PD_NAME(td_slck_name); + parent_data[2] =3D AT91_CLK_PD_HW(sama7d65_pmc->chws[PMC_MAIN]); + parent_data[3] =3D AT91_CLK_PD_HW(sama7d65_pmc->chws[PMC_MCK1]); for (i =3D 0; i < ARRAY_SIZE(sama7d65_gck); i++) { u8 num_parents =3D 4 + sama7d65_gck[i].pp_count; - struct clk_hw *tmp_parent_hws[8]; u32 *mux_table; =20 mux_table =3D kmalloc_array(num_parents, sizeof(*mux_table), @@ -1341,15 +1342,13 @@ static void __init sama7d65_pmc_setup(struct device= _node *np) u8 pll_id =3D sama7d65_gck[i].pp[j].pll_id; u8 pll_compid =3D sama7d65_gck[i].pp[j].pll_compid; =20 - tmp_parent_hws[j] =3D sama7d65_plls[pll_id][pll_compid].hw; + parent_data[4 + j] =3D AT91_CLK_PD_HW(sama7d65_plls[pll_id][pll_compid]= .hw); } - PMC_FILL_TABLE(&parent_hws[4], tmp_parent_hws, - sama7d65_gck[i].pp_count); =20 hw =3D at91_clk_register_generated(regmap, &pmc_pcr_lock, &sama7d65_pcr_layout, sama7d65_gck[i].n, NULL, - parent_hws, mux_table, + parent_data, mux_table, num_parents, sama7d65_gck[i].id, &sama7d65_gck[i].r, diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c index b772b9e15b78..252a5e9cfd3c 100644 --- a/drivers/clk/at91/sama7g5.c +++ b/drivers/clk/at91/sama7g5.c @@ -971,15 +971,13 @@ static const struct clk_pcr_layout sama7g5_pcr_layout= =3D { =20 static void __init sama7g5_pmc_setup(struct device_node *np) { - const char *main_xtal_name; + const char *main_xtal_name, *md_slck_name, *td_slck_name; struct pmc_data *sama7g5_pmc; void **alloc_mem =3D NULL; int alloc_mem_size =3D 0; struct regmap *regmap; struct clk_hw *hw, *main_rc_hw, *main_osc_hw; - struct clk_hw *td_slck_hw, *md_slck_hw; struct clk_parent_data parent_data[10]; - struct clk_hw *parent_hws[10]; bool bypass; int i, j; =20 @@ -988,11 +986,15 @@ static void __init sama7g5_pmc_setup(struct device_no= de *np) return; main_xtal_name =3D of_clk_get_parent_name(np, i); =20 - td_slck_hw =3D __clk_get_hw(of_clk_get_by_name(np, "td_slck")); - md_slck_hw =3D __clk_get_hw(of_clk_get_by_name(np, "md_slck")); + i =3D of_property_match_string(np, "clock-names", "td_slck"); + if (i < 0) + return; + td_slck_name =3D of_clk_get_parent_name(np, i); =20 - if (!td_slck_hw || !md_slck_hw) + i =3D of_property_match_string(np, "clock-names", "md_slck"); + if (i < 0) return; + md_slck_name =3D of_clk_get_parent_name(np, i); =20 regmap =3D device_node_to_regmap(np); if (IS_ERR(regmap)) @@ -1102,8 +1104,8 @@ static void __init sama7g5_pmc_setup(struct device_no= de *np) =20 sama7g5_mckx[PCK_PARENT_HW_MCK0].hw =3D sama7g5_pmc->chws[PMC_MCK] =3D hw; =20 - parent_data[0] =3D AT91_CLK_PD_NAME("md_slck"); - parent_data[1] =3D AT91_CLK_PD_NAME("td_slck"); + parent_data[0] =3D AT91_CLK_PD_NAME(md_slck_name); + parent_data[1] =3D AT91_CLK_PD_NAME(td_slck_name); parent_data[2] =3D AT91_CLK_PD_HW(sama7g5_pmc->chws[PMC_MAIN]); for (i =3D PCK_PARENT_HW_MCK1; i < ARRAY_SIZE(sama7g5_mckx); i++) { u8 num_parents =3D 3 + sama7g5_mckx[i].ep_count; @@ -1146,8 +1148,8 @@ static void __init sama7g5_pmc_setup(struct device_no= de *np) =20 sama7g5_pmc->chws[PMC_UTMI] =3D hw; =20 - parent_data[0] =3D AT91_CLK_PD_NAME("md_slck"); - parent_data[1] =3D AT91_CLK_PD_NAME("td_slck"); + parent_data[0] =3D AT91_CLK_PD_NAME(md_slck_name); + parent_data[1] =3D AT91_CLK_PD_NAME(td_slck_name); parent_data[2] =3D AT91_CLK_PD_HW(sama7g5_pmc->chws[PMC_MAIN]); parent_data[3] =3D AT91_CLK_PD_HW(sama7g5_plls[PLL_ID_SYS][PLL_COMPID_DIV= 0].hw); parent_data[4] =3D AT91_CLK_PD_HW(sama7g5_plls[PLL_ID_DDR][PLL_COMPID_DIV= 0].hw); @@ -1196,12 +1198,11 @@ static void __init sama7g5_pmc_setup(struct device_= node *np) sama7g5_pmc->phws[sama7g5_periphck[i].id] =3D hw; } =20 - parent_hws[0] =3D md_slck_hw; - parent_hws[1] =3D td_slck_hw; - parent_hws[2] =3D sama7g5_pmc->chws[PMC_MAIN]; + parent_data[0] =3D AT91_CLK_PD_NAME(md_slck_name); + parent_data[1] =3D AT91_CLK_PD_NAME(td_slck_name); + parent_data[2] =3D AT91_CLK_PD_HW(sama7g5_pmc->chws[PMC_MAIN]); for (i =3D 0; i < ARRAY_SIZE(sama7g5_gck); i++) { u8 num_parents =3D 3 + sama7g5_gck[i].pp_count; - struct clk_hw *tmp_parent_hws[8]; u32 *mux_table; =20 mux_table =3D kmalloc_array(num_parents, sizeof(*mux_table), @@ -1216,15 +1217,13 @@ static void __init sama7g5_pmc_setup(struct device_= node *np) u8 pll_id =3D sama7g5_gck[i].pp[j].pll_id; u8 pll_compid =3D sama7g5_gck[i].pp[j].pll_compid; =20 - tmp_parent_hws[j] =3D sama7g5_plls[pll_id][pll_compid].hw; + parent_data[3 + j] =3D AT91_CLK_PD_HW(sama7g5_plls[pll_id][pll_compid].= hw); } - PMC_FILL_TABLE(&parent_hws[3], tmp_parent_hws, - sama7g5_gck[i].pp_count); =20 hw =3D at91_clk_register_generated(regmap, &pmc_pcr_lock, &sama7g5_pcr_layout, sama7g5_gck[i].n, NULL, - parent_hws, mux_table, + parent_data, mux_table, num_parents, sama7g5_gck[i].id, &sama7g5_gck[i].r, --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80D0D3A1A27; Fri, 16 Jan 2026 20:07:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594050; cv=none; b=IpR7ltoaHZYN/1man4kvDMbZzxozbxkFtbg2tAsur45OEJEbrH330M0fJUYlTcfm+pFFGsctoQMe2q+eWC20pCrC8RxeLeDKXjDFdWbOmL8mJ0Bgmr/CJGGWQzD+O/aOghJvs5Bz0qZjVXVsQMkg3fTmXobGP+Db89+MEzxXXyM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594050; c=relaxed/simple; bh=GkKb/SHr65VrFL8RvBJ9kmOdQR95wfAQhqGQ9wp0eL4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gPXqmCkroll0ztLVkIWCOkmSBzlvDw833ngj61NXAjaYTJmtswBn+FPMgR3DPYHXukmtsWC5/vMsG8GUhuHIgd+reKuMXwzPXhWli7OmLfjiRTs9OKAws/3il3j/0VvNdI600Yt4mPoQ67yfVOCA8mIgKLpqGB6tpEpwSedbiG8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=umHgtFKD; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="umHgtFKD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594047; x=1800130047; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GkKb/SHr65VrFL8RvBJ9kmOdQR95wfAQhqGQ9wp0eL4=; b=umHgtFKDBDDlenfgWJYfMIer2WfiP65WteB2pzm13Amc4XPXRW43sJYw AWedJl5dJ9SdHkqTEko+YEJfGRYGjMcdaf9EJImZYI2fnx4UbG4QTGZ+X gbAplTmXB95vt1uxh47hxaSgoCLg4tday17wF1MvUsNlpGOfGM5K0/jF2 yUfIVv6z9OiMM4qNRALvnQl4soOKzsvhe0flXc6ZMRzp34GycdZonRYdT 7mKfnM+j0leshbo7AvuU+pClnoFe3Dk+Qdc27iIc4BEX1v56tkMEjqBw9 9/z5vVDWWLhR59jZ1pb3jPx4kNF7spDlgI3dSzSpKlNmQOZY9NGhbbxK6 g==; X-CSE-ConnectionGUID: +9RSiAtvRY+RhxWEUm06Wg== X-CSE-MsgGUID: UIL5fltrT+2IvF1zZCe3+g== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="283397050" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2026 13:07:16 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex1.mchp-main.com (10.10.87.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.29; Fri, 16 Jan 2026 13:07:05 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:05 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 11/31] clk: at91: clk-usb: add support for clk_parent_data Date: Fri, 16 Jan 2026 13:07:04 -0700 Message-ID: <37dfe16abee98a6b768fbb3b82c0b8cd23bb6e44.1768512290.git.ryan.wanner@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Add support for clk_parent_data in usb clock driver. All the SoC based drivers that rely on clk-usb were adapted to the new API change. The switch itself for SoCs will be done in subsequent patches. Remove the use of __clk_get_hw() for the slow clocks. Signed-off-by: Claudiu Beznea [ryan.wanner@microchip: Add SAMA7D65 and SAM9X75 SoCs to the changes. Change how the main_xtal and slcks are initialized so they match the parent_data API] Signed-off-by: Ryan Wanner --- drivers/clk/at91/at91rm9200.c | 2 +- drivers/clk/at91/at91sam9260.c | 2 +- drivers/clk/at91/at91sam9g45.c | 2 +- drivers/clk/at91/at91sam9n12.c | 2 +- drivers/clk/at91/at91sam9x5.c | 2 +- drivers/clk/at91/clk-usb.c | 41 ++++++++++++++++++++++------------ drivers/clk/at91/dt-compat.c | 6 ++--- drivers/clk/at91/pmc.h | 11 +++++---- drivers/clk/at91/sam9x60.c | 2 +- drivers/clk/at91/sam9x7.c | 21 +++++++++-------- drivers/clk/at91/sama5d2.c | 2 +- drivers/clk/at91/sama5d3.c | 2 +- drivers/clk/at91/sama5d4.c | 2 +- drivers/clk/at91/sama7d65.c | 24 +++++++++++--------- 14 files changed, 72 insertions(+), 49 deletions(-) diff --git a/drivers/clk/at91/at91rm9200.c b/drivers/clk/at91/at91rm9200.c index 3f19e737ae4d..e5a034f208d8 100644 --- a/drivers/clk/at91/at91rm9200.c +++ b/drivers/clk/at91/at91rm9200.c @@ -157,7 +157,7 @@ static void __init at91rm9200_pmc_setup(struct device_n= ode *np) =20 at91rm9200_pmc->chws[PMC_MCK] =3D hw; =20 - hw =3D at91rm9200_clk_register_usb(regmap, "usbck", "pllbck", usb_div); + hw =3D at91rm9200_clk_register_usb(regmap, "usbck", "pllbck", NULL, usb_d= iv); if (IS_ERR(hw)) goto err_free; =20 diff --git a/drivers/clk/at91/at91sam9260.c b/drivers/clk/at91/at91sam9260.c index 0799a13060ea..ae6f126f204a 100644 --- a/drivers/clk/at91/at91sam9260.c +++ b/drivers/clk/at91/at91sam9260.c @@ -434,7 +434,7 @@ static void __init at91sam926x_pmc_setup(struct device_= node *np, =20 at91sam9260_pmc->chws[PMC_MCK] =3D hw; =20 - hw =3D at91rm9200_clk_register_usb(regmap, "usbck", "pllbck", usb_div); + hw =3D at91rm9200_clk_register_usb(regmap, "usbck", "pllbck", NULL, usb_d= iv); if (IS_ERR(hw)) goto err_free; =20 diff --git a/drivers/clk/at91/at91sam9g45.c b/drivers/clk/at91/at91sam9g45.c index f45a7b80f7d8..684d2bcb36e8 100644 --- a/drivers/clk/at91/at91sam9g45.c +++ b/drivers/clk/at91/at91sam9g45.c @@ -176,7 +176,7 @@ static void __init at91sam9g45_pmc_setup(struct device_= node *np) =20 parent_names[0] =3D "plladivck"; parent_names[1] =3D "utmick"; - hw =3D at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, 2); + hw =3D at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, NULL, 2= ); if (IS_ERR(hw)) goto err_free; =20 diff --git a/drivers/clk/at91/at91sam9n12.c b/drivers/clk/at91/at91sam9n12.c index 751786184ae2..9fc20b177b13 100644 --- a/drivers/clk/at91/at91sam9n12.c +++ b/drivers/clk/at91/at91sam9n12.c @@ -201,7 +201,7 @@ static void __init at91sam9n12_pmc_setup(struct device_= node *np) =20 at91sam9n12_pmc->chws[PMC_MCK] =3D hw; =20 - hw =3D at91sam9n12_clk_register_usb(regmap, "usbck", "pllbck"); + hw =3D at91sam9n12_clk_register_usb(regmap, "usbck", "pllbck", NULL); if (IS_ERR(hw)) goto err_free; =20 diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c index 3b801d12fac0..5728cfb9036f 100644 --- a/drivers/clk/at91/at91sam9x5.c +++ b/drivers/clk/at91/at91sam9x5.c @@ -222,7 +222,7 @@ static void __init at91sam9x5_pmc_setup(struct device_n= ode *np, =20 parent_names[0] =3D "plladivck"; parent_names[1] =3D "utmick"; - hw =3D at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, 2); + hw =3D at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, NULL, 2= ); if (IS_ERR(hw)) goto err_free; =20 diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c index e906928cfbf0..fb3db8425db9 100644 --- a/drivers/clk/at91/clk-usb.c +++ b/drivers/clk/at91/clk-usb.c @@ -221,12 +221,12 @@ static const struct clk_ops at91sam9n12_usb_ops =3D { =20 static struct clk_hw * __init _at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name, - const char **parent_names, u8 num_parents, - u32 usbs_mask) + const char **parent_names, struct clk_parent_data *parent_data, + u8 num_parents, u32 usbs_mask) { struct at91sam9x5_clk_usb *usb; struct clk_hw *hw; - struct clk_init_data init; + struct clk_init_data init =3D {}; int ret; =20 usb =3D kzalloc(sizeof(*usb), GFP_KERNEL); @@ -235,7 +235,10 @@ _at91sam9x5_clk_register_usb(struct regmap *regmap, co= nst char *name, =20 init.name =3D name; init.ops =3D &at91sam9x5_usb_ops; - init.parent_names =3D parent_names; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; + else + init.parent_names =3D parent_names; init.num_parents =3D num_parents; init.flags =3D CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE | CLK_SET_RATE_PARENT; @@ -257,27 +260,30 @@ _at91sam9x5_clk_register_usb(struct regmap *regmap, c= onst char *name, =20 struct clk_hw * __init at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name, - const char **parent_names, u8 num_parents) + const char **parent_names, struct clk_parent_data *parent_data, + u8 num_parents) { return _at91sam9x5_clk_register_usb(regmap, name, parent_names, - num_parents, SAM9X5_USBS_MASK); + parent_data, num_parents, SAM9X5_USBS_MASK); } =20 struct clk_hw * __init sam9x60_clk_register_usb(struct regmap *regmap, const char *name, - const char **parent_names, u8 num_parents) + const char **parent_names, struct clk_parent_data *parent_data, + u8 num_parents) { return _at91sam9x5_clk_register_usb(regmap, name, parent_names, - num_parents, SAM9X60_USBS_MASK); + parent_data, num_parents, + SAM9X60_USBS_MASK); } =20 struct clk_hw * __init at91sam9n12_clk_register_usb(struct regmap *regmap, const char *name, - const char *parent_name) + const char *parent_name, struct clk_parent_data *parent_data) { struct at91sam9x5_clk_usb *usb; struct clk_hw *hw; - struct clk_init_data init; + struct clk_init_data init =3D {}; int ret; =20 usb =3D kzalloc(sizeof(*usb), GFP_KERNEL); @@ -286,7 +292,10 @@ at91sam9n12_clk_register_usb(struct regmap *regmap, co= nst char *name, =20 init.name =3D name; init.ops =3D &at91sam9n12_usb_ops; - init.parent_names =3D &parent_name; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; + else + init.parent_names =3D &parent_name; init.num_parents =3D 1; init.flags =3D CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT; =20 @@ -392,11 +401,12 @@ static const struct clk_ops at91rm9200_usb_ops =3D { =20 struct clk_hw * __init at91rm9200_clk_register_usb(struct regmap *regmap, const char *name, - const char *parent_name, const u32 *divisors) + const char *parent_name, struct clk_parent_data *parent_data, + const u32 *divisors) { struct at91rm9200_clk_usb *usb; struct clk_hw *hw; - struct clk_init_data init; + struct clk_init_data init =3D {}; int ret; =20 usb =3D kzalloc(sizeof(*usb), GFP_KERNEL); @@ -405,7 +415,10 @@ at91rm9200_clk_register_usb(struct regmap *regmap, con= st char *name, =20 init.name =3D name; init.ops =3D &at91rm9200_usb_ops; - init.parent_names =3D &parent_name; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; + else + init.parent_names =3D &parent_name; init.num_parents =3D 1; init.flags =3D CLK_SET_RATE_PARENT; =20 diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c index f5a5f9ba7634..7883198f6a98 100644 --- a/drivers/clk/at91/dt-compat.c +++ b/drivers/clk/at91/dt-compat.c @@ -946,7 +946,7 @@ static void __init of_at91sam9x5_clk_usb_setup(struct d= evice_node *np) if (IS_ERR(regmap)) return; =20 - hw =3D at91sam9x5_clk_register_usb(regmap, name, parent_names, + hw =3D at91sam9x5_clk_register_usb(regmap, name, parent_names, NULL, num_parents); if (IS_ERR(hw)) return; @@ -976,7 +976,7 @@ static void __init of_at91sam9n12_clk_usb_setup(struct = device_node *np) if (IS_ERR(regmap)) return; =20 - hw =3D at91sam9n12_clk_register_usb(regmap, name, parent_name); + hw =3D at91sam9n12_clk_register_usb(regmap, name, parent_name, NULL); if (IS_ERR(hw)) return; =20 @@ -1009,7 +1009,7 @@ static void __init of_at91rm9200_clk_usb_setup(struct= device_node *np) of_node_put(parent_np); if (IS_ERR(regmap)) return; - hw =3D at91rm9200_clk_register_usb(regmap, name, parent_name, divisors); + hw =3D at91rm9200_clk_register_usb(regmap, name, parent_name, NULL, divis= ors); if (IS_ERR(hw)) return; =20 diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index d8d491096c0d..238d9d06efc5 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -288,16 +288,19 @@ at91_clk_register_system(struct regmap *regmap, const= char *name, =20 struct clk_hw * __init at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name, - const char **parent_names, u8 num_parents); + const char **parent_names, struct clk_parent_data *parent_data, + u8 num_parents); struct clk_hw * __init at91sam9n12_clk_register_usb(struct regmap *regmap, const char *name, - const char *parent_name); + const char *parent_name, struct clk_parent_data *parent_data); struct clk_hw * __init sam9x60_clk_register_usb(struct regmap *regmap, const char *name, - const char **parent_names, u8 num_parents); + const char **parent_names, struct clk_parent_data *parent_data, + u8 num_parents); struct clk_hw * __init at91rm9200_clk_register_usb(struct regmap *regmap, const char *name, - const char *parent_name, const u32 *divisors); + const char *parent_name, struct clk_parent_data *parent_data, + const u32 *divisors); =20 struct clk_hw * __init at91_clk_register_utmi(struct regmap *regmap_pmc, struct regmap *regmap_sf= r, diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c index bee35c65aceb..2ab7deab95f3 100644 --- a/drivers/clk/at91/sam9x60.c +++ b/drivers/clk/at91/sam9x60.c @@ -308,7 +308,7 @@ static void __init sam9x60_pmc_setup(struct device_node= *np) parent_names[0] =3D "pllack_divck"; parent_names[1] =3D "upllck_divck"; parent_names[2] =3D "main_osc"; - hw =3D sam9x60_clk_register_usb(regmap, "usbck", parent_names, 3); + hw =3D sam9x60_clk_register_usb(regmap, "usbck", parent_names, NULL, 3); if (IS_ERR(hw)) goto err_free; =20 diff --git a/drivers/clk/at91/sam9x7.c b/drivers/clk/at91/sam9x7.c index d549bdd988e8..4cb0ba8b6cf9 100644 --- a/drivers/clk/at91/sam9x7.c +++ b/drivers/clk/at91/sam9x7.c @@ -746,11 +746,10 @@ static void __init sam9x7_pmc_setup(struct device_nod= e *np) struct clk_range range =3D CLK_RANGE(0, 0); const char *main_xtal_name, *td_slck_name, *md_slck_name; struct pmc_data *sam9x7_pmc; - const char *parent_names[9]; void **clk_mux_buffer =3D NULL; int clk_mux_buffer_size =3D 0; struct regmap *regmap; - struct clk_hw *hw, *main_rc_hw, *main_osc_hw, *main_xtal_hw; + struct clk_hw *hw, *main_rc_hw, *main_osc_hw; struct clk_hw *usbck_hw; struct clk_parent_data parent_data[9]; int i, j; @@ -818,18 +817,22 @@ static void __init sam9x7_pmc_setup(struct device_nod= e *np) switch (sam9x7_plls[i][j].p) { case SAM9X7_PLL_PARENT_MAINCK: parent_data[0] =3D AT91_CLK_PD_NAME("mainck"); - hw =3D sam9x7_pmc->chws[PMC_MAIN]; + parent_rate =3D clk_hw_get_rate(sam9x7_pmc->chws[PMC_MAIN]); break; case SAM9X7_PLL_PARENT_MAIN_XTAL: + struct clk *main_xtal; + main_xtal =3D of_clk_get_by_name(np, main_xtal_name); + if (IS_ERR(main_xtal)) + goto err_free; parent_data[0] =3D AT91_CLK_PD_NAME(main_xtal_name); - hw =3D main_xtal_hw; + parent_rate =3D clk_get_rate(main_xtal); + clk_put(main_xtal); break; default: /* Should not happen. */ break; } =20 - parent_rate =3D clk_hw_get_rate(hw); if (!parent_rate) return; =20 @@ -884,10 +887,10 @@ static void __init sam9x7_pmc_setup(struct device_nod= e *np) =20 sam9x7_pmc->chws[PMC_MCK] =3D hw; =20 - parent_names[0] =3D "plla_divpmcck"; - parent_names[1] =3D "upll_divpmcck"; - parent_names[2] =3D "main_osc"; - usbck_hw =3D sam9x60_clk_register_usb(regmap, "usbck", parent_names, 3); + parent_data[0] =3D AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_PLLA][PLL_COMPID_DIV= 0].hw); + parent_data[1] =3D AT91_CLK_PD_HW(sam9x7_plls[PLL_ID_UPLL][PLL_COMPID_DIV= 0].hw); + parent_data[2] =3D AT91_CLK_PD_HW(main_osc_hw); + usbck_hw =3D sam9x60_clk_register_usb(regmap, "usbck", NULL, parent_data,= 3); if (IS_ERR(usbck_hw)) goto err_free; =20 diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c index c16594fce90c..8bbc34e22cda 100644 --- a/drivers/clk/at91/sama5d2.c +++ b/drivers/clk/at91/sama5d2.c @@ -284,7 +284,7 @@ static void __init sama5d2_pmc_setup(struct device_node= *np) =20 parent_names[0] =3D "plladivck"; parent_names[1] =3D "utmick"; - hw =3D at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, 2); + hw =3D at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, NULL, 2= ); if (IS_ERR(hw)) goto err_free; =20 diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c index 522ce6031446..05d0cdd22bc4 100644 --- a/drivers/clk/at91/sama5d3.c +++ b/drivers/clk/at91/sama5d3.c @@ -201,7 +201,7 @@ static void __init sama5d3_pmc_setup(struct device_node= *np) =20 parent_names[0] =3D "plladivck"; parent_names[1] =3D "utmick"; - hw =3D at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, 2); + hw =3D at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, NULL, 2= ); if (IS_ERR(hw)) goto err_free; =20 diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c index 160c0bddb6a3..da84b4cef827 100644 --- a/drivers/clk/at91/sama5d4.c +++ b/drivers/clk/at91/sama5d4.c @@ -222,7 +222,7 @@ static void __init sama5d4_pmc_setup(struct device_node= *np) =20 parent_names[0] =3D "plladivck"; parent_names[1] =3D "utmick"; - hw =3D at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, 2); + hw =3D at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, NULL, 2= ); if (IS_ERR(hw)) goto err_free; =20 diff --git a/drivers/clk/at91/sama7d65.c b/drivers/clk/at91/sama7d65.c index 355eaf941681..8aea926094d8 100644 --- a/drivers/clk/at91/sama7d65.c +++ b/drivers/clk/at91/sama7d65.c @@ -1095,11 +1095,10 @@ static void __init sama7d65_pmc_setup(struct device= _node *np) { const char *main_xtal_name, *md_slck_name, *td_slck_name; struct pmc_data *sama7d65_pmc; - const char *parent_names[11]; void **alloc_mem =3D NULL; int alloc_mem_size =3D 0; struct regmap *regmap; - struct clk_hw *hw, *main_rc_hw, *main_osc_hw, *main_xtal_hw; + struct clk_hw *hw, *main_rc_hw, *main_osc_hw, *usbck_hw; struct clk_parent_data parent_data[10]; bool bypass; int i, j; @@ -1168,17 +1167,22 @@ static void __init sama7d65_pmc_setup(struct device= _node *np) switch (sama7d65_plls[i][j].p) { case SAMA7D65_PLL_PARENT_MAINCK: parent_data[0] =3D AT91_CLK_PD_NAME("mainck"); - hw =3D sama7d65_pmc->chws[PMC_MAIN]; + parent_rate =3D clk_hw_get_rate(sama7d65_pmc->chws[PMC_MAIN]); break; case SAMA7D65_PLL_PARENT_MAIN_XTAL: + struct clk *main_xtal; + main_xtal =3D of_clk_get_by_name(np, main_xtal_name); + if (IS_ERR(main_xtal)) + goto err_free; parent_data[0] =3D AT91_CLK_PD_NAME(main_xtal_name); - hw =3D main_xtal_hw; + parent_rate =3D clk_get_rate(main_xtal); + clk_put(main_xtal); break; default: /* Should not happen. */ break; } - parent_rate =3D clk_hw_get_rate(hw); + if (!parent_rate) return; =20 @@ -1262,11 +1266,11 @@ static void __init sama7d65_pmc_setup(struct device= _node *np) sama7d65_pmc->chws[sama7d65_mckx[i].eid] =3D hw; } =20 - parent_names[0] =3D "syspll_divpmcck"; - parent_names[1] =3D "usbpll_divpmcck"; - parent_names[2] =3D "main_osc"; - hw =3D sam9x60_clk_register_usb(regmap, "usbck", parent_names, 3); - if (IS_ERR(hw)) + parent_data[0] =3D AT91_CLK_PD_HW(sama7d65_plls[PLL_ID_SYS][PLL_COMPID_DI= V0].hw); + parent_data[1] =3D AT91_CLK_PD_HW(sama7d65_plls[PLL_ID_USB][PLL_COMPID_DI= V0].hw); + parent_data[2] =3D AT91_CLK_PD_HW(main_osc_hw); + usbck_hw =3D sam9x60_clk_register_usb(regmap, "usbck", NULL, parent_data,= 3); + if (IS_ERR(usbck_hw)) goto err_free; =20 parent_data[0] =3D AT91_CLK_PD_NAME(md_slck_name); --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 894623A1E70; Fri, 16 Jan 2026 20:07:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594051; cv=none; b=E3n6j6BP7l4i49Yct9la+oGmV7b8F1cUjixt/7TWu60EAEgM8qpf865EPQrHgYApNLL52432XaAdIFhDAGdLfj7YDTpfOdiEn0Fx9Tf4YkKSiWLu6t8T6d6kjN2kcPNEbeGFUPs83sEJ42ThiFGX2WmSvMzO3WwQFNYmc0WmWic= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594051; c=relaxed/simple; bh=BuDLvUI0gXXL+sAMfsCM6uqttzROVeaAE5P1ijRX1/0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CodgBMNcG2TkqsinEhiGCCByOg6XHe6HPohUHlu5hhUlYYkTFLkLiJoWjR7+dC85fzvPX9I6YAMbFZRpFl5+cujC40DOts/EVyZUjKnZmC4tvtkP4GNYeygPzQK50DJ4SZUGzzavG2p/Q48dWhIBvQaOGLDw9VJF2Sb8733lI2U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=1Hkc6fqR; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="1Hkc6fqR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594047; x=1800130047; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BuDLvUI0gXXL+sAMfsCM6uqttzROVeaAE5P1ijRX1/0=; b=1Hkc6fqRiA+BuJV0dpo7fMLRX5sGElOHJL/jruI/QtwpfGsMelGquqRB ECowmlH0cwGchCi73Yqd4Tx7ePYukQAAiL9rr6GUhzSylQUXwG0JYdvru zmB6UY2wb0lJI8bI8kUertgZjARI2cXgljRNyJ5KBABKMGk1RCYk4fK1Q jBMS3qgLQ5EjPnSntF9pQmr9HyM1jzNzJpAOncwb3QXK0iyNXCxvF2PiL 13IR58cfTacmvsNTKtwTV6+LnkAYHCJ763ZWI4A3yLrHotgtahL2VNvJw osyPLfg6S1cUpp0ZAp0wLjj8xZjGwJogPjbZDyD4W+lis4MFw4WFpk1kn w==; X-CSE-ConnectionGUID: +9RSiAtvRY+RhxWEUm06Wg== X-CSE-MsgGUID: LLerEwPyQTas4GJIqdU+8g== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="283397052" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2026 13:07:17 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex1.mchp-main.com (10.10.87.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.29; Fri, 16 Jan 2026 13:07:05 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:05 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 12/31] clk: at91: clk-system: use clk_parent_data Date: Fri, 16 Jan 2026 13:07:05 -0700 Message-ID: <7537c90e81803116bbf440c08f883c4e0f30a28d.1768512290.git.ryan.wanner@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Use struct clk_parent_data instead of struct parent_hw as this leads to less usage of __clk_get_hw() in SoC specific clock drivers and simpler conversion of existing SoC specific clock drivers from parent_names to modern clk_parent_data structures. Signed-off-by: Claudiu Beznea [ryan.wanner@microchip: Update SAM9X75 clk-system to use parent_data.] Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/clk-system.c | 8 ++++---- drivers/clk/at91/pmc.h | 2 +- drivers/clk/at91/sam9x7.c | 2 +- drivers/clk/at91/sama7g5.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/clk/at91/clk-system.c b/drivers/clk/at91/clk-system.c index 90eed39d0785..55f8e46fe9c7 100644 --- a/drivers/clk/at91/clk-system.c +++ b/drivers/clk/at91/clk-system.c @@ -105,7 +105,7 @@ static const struct clk_ops system_ops =3D { =20 struct clk_hw * __init at91_clk_register_system(struct regmap *regmap, const char *name, - const char *parent_name, struct clk_hw *parent_hw, u8 id, + const char *parent_name, struct clk_parent_data *parent_data, u8 id, unsigned long flags) { struct clk_system *sys; @@ -113,7 +113,7 @@ at91_clk_register_system(struct regmap *regmap, const c= har *name, struct clk_init_data init =3D {}; int ret; =20 - if (!(parent_name || parent_hw) || id > SYSTEM_MAX_ID) + if (!(parent_name || parent_data) || id > SYSTEM_MAX_ID) return ERR_PTR(-EINVAL); =20 sys =3D kzalloc(sizeof(*sys), GFP_KERNEL); @@ -122,8 +122,8 @@ at91_clk_register_system(struct regmap *regmap, const c= har *name, =20 init.name =3D name; init.ops =3D &system_ops; - if (parent_hw) - init.parent_hws =3D (const struct clk_hw **)&parent_hw; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; else init.parent_names =3D &parent_name; init.num_parents =3D 1; diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index 238d9d06efc5..cd8f286f4711 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -283,7 +283,7 @@ at91sam9x5_clk_register_smd(struct regmap *regmap, cons= t char *name, =20 struct clk_hw * __init at91_clk_register_system(struct regmap *regmap, const char *name, - const char *parent_name, struct clk_hw *parent_hw, + const char *parent_name, struct clk_parent_data *parent_data, u8 id, unsigned long flags); =20 struct clk_hw * __init diff --git a/drivers/clk/at91/sam9x7.c b/drivers/clk/at91/sam9x7.c index 4cb0ba8b6cf9..4cc61b56a13a 100644 --- a/drivers/clk/at91/sam9x7.c +++ b/drivers/clk/at91/sam9x7.c @@ -923,7 +923,7 @@ static void __init sam9x7_pmc_setup(struct device_node = *np) sam9x7_systemck[3].parent_hw =3D sam9x7_pmc->pchws[1]; for (i =3D 0; i < ARRAY_SIZE(sam9x7_systemck); i++) { hw =3D at91_clk_register_system(regmap, sam9x7_systemck[i].n, - NULL, sam9x7_systemck[i].parent_hw, + NULL, &AT91_CLK_PD_HW(sam9x7_systemck[i].parent_hw), sam9x7_systemck[i].id, sam9x7_systemck[i].flags); if (IS_ERR(hw)) diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c index 252a5e9cfd3c..558406b83b5f 100644 --- a/drivers/clk/at91/sama7g5.c +++ b/drivers/clk/at91/sama7g5.c @@ -1174,7 +1174,7 @@ static void __init sama7g5_pmc_setup(struct device_no= de *np) =20 for (i =3D 0; i < ARRAY_SIZE(sama7g5_systemck); i++) { hw =3D at91_clk_register_system(regmap, sama7g5_systemck[i].n, - NULL, sama7g5_pmc->pchws[i], + NULL, &AT91_CLK_PD_HW(sama7g5_pmc->pchws[i]), sama7g5_systemck[i].id, 0); if (IS_ERR(hw)) goto err_free; --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7521F395252; Fri, 16 Jan 2026 20:07:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594050; cv=none; b=FHKxsRGUiGxd6EGq5AmPTmR71lEX8MkI1dlI8KhZtAqCH9z/mEBv/t9/MMn3T+dcnCKdpdLq+pl+WHb9UWig5K7UlOyc00xM/n+QFk7xsbaon1YeOJKvOTYCCAFX1jKHbXCaYhzStktxaUJzz/Yny8Cb4gLmVyrtw/Ft1nZhNVI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594050; c=relaxed/simple; bh=neIWWmyypnNHqZZGX8lfunmzpOCJxCwV8FKTDxUQwLE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=s5oogVTr9cXdWXzUu0mY78AYo6qptylEkxh0LEqcw5/WzW3BLEKmLI+4WuyfS3GcZ+c0loZDuzwuFdpZZSNn8SxVaAM937n+QkG16XO0YNZSsxun2rLpeTE3n+rFtAMYOas6BZFt5jliivgN8NLHh7aiBWdPoOe/olNcO0vGgy4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=PPr8yAkh; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="PPr8yAkh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594048; x=1800130048; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=neIWWmyypnNHqZZGX8lfunmzpOCJxCwV8FKTDxUQwLE=; b=PPr8yAkhx6mOx0LsgdQBiONjm78osbqE1QgBvEeaFA5JhVrp9fpE9fwd 6f+WrGMuWLAEnM6AB6xDKiHmadYGmVI1NDySFXBLW/ffXbrxec/XZHplP NYMuFjQiqSGB/+tN141rjbJfS/J3JMXjqiqbQgu5tpaCBKA+JXh/aIQYh noRCeQrq3KdGNp1SidC9d6mMkNXETRF65n9o7wr2tc3Zjr1Wc3Zne22oF e/mO0S+kKZTy+BV+lzInmZrnUpbAIE2xDBGXVzj/1W53yLfeY6MKZnjbv OQLyB5hjSF+GWNP5+Ll+udz/qDZCWP1Q/sZAIfTLwsLZqiB1eK+uslH++ w==; X-CSE-ConnectionGUID: +9RSiAtvRY+RhxWEUm06Wg== X-CSE-MsgGUID: PhczZzwKQji/3pi6D4ywRQ== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="283397053" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2026 13:07:17 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex1.mchp-main.com (10.10.87.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.29; Fri, 16 Jan 2026 13:07:05 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:05 -0700 From: To: , , , , , , , CC: , , , , , "Ryan Wanner" Subject: [PATCH v5 13/31] clk: at91: sama7d65: switch system clocks to parent_hw and parent_data Date: Fri, 16 Jan 2026 13:07:06 -0700 Message-ID: <96e09d47cbff0fb4593d642a1151791e20c15c48.1768512290.git.ryan.wanner@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ryan Wanner Switch the system clocks to use parent_hw and parent_data. Having this allows the driver to conform to the new clk-system API. The parent registration is after the USBCK registration due to one of the system clocks being dependent on USBCK. Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/sama7d65.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/drivers/clk/at91/sama7d65.c b/drivers/clk/at91/sama7d65.c index 8aea926094d8..0c9d43fa01c1 100644 --- a/drivers/clk/at91/sama7d65.c +++ b/drivers/clk/at91/sama7d65.c @@ -537,23 +537,23 @@ static struct { /* * System clock description * @n: clock name - * @p: clock parent name + * @p: clock parent hw * @id: clock id */ -static const struct { +static struct { const char *n; - const char *p; + struct clk_hw *parent_hw; u8 id; } sama7d65_systemck[] =3D { - { .n =3D "uhpck", .p =3D "usbck", .id =3D 6 }, - { .n =3D "pck0", .p =3D "prog0", .id =3D 8, }, - { .n =3D "pck1", .p =3D "prog1", .id =3D 9, }, - { .n =3D "pck2", .p =3D "prog2", .id =3D 10, }, - { .n =3D "pck3", .p =3D "prog3", .id =3D 11, }, - { .n =3D "pck4", .p =3D "prog4", .id =3D 12, }, - { .n =3D "pck5", .p =3D "prog5", .id =3D 13, }, - { .n =3D "pck6", .p =3D "prog6", .id =3D 14, }, - { .n =3D "pck7", .p =3D "prog7", .id =3D 15, }, + { .n =3D "uhpck", .id =3D 6 }, + { .n =3D "pck0", .id =3D 8, }, + { .n =3D "pck1", .id =3D 9, }, + { .n =3D "pck2", .id =3D 10, }, + { .n =3D "pck3", .id =3D 11, }, + { .n =3D "pck4", .id =3D 12, }, + { .n =3D "pck5", .id =3D 13, }, + { .n =3D "pck6", .id =3D 14, }, + { .n =3D "pck7", .id =3D 15, }, }; =20 /* Mux table for programmable clocks. */ @@ -1298,9 +1298,19 @@ static void __init sama7d65_pmc_setup(struct device_= node *np) sama7d65_pmc->pchws[i] =3D hw; } =20 + /* Set systemck parent hws. */ + sama7d65_systemck[0].parent_hw =3D usbck_hw; + sama7d65_systemck[1].parent_hw =3D sama7d65_pmc->pchws[0]; + sama7d65_systemck[2].parent_hw =3D sama7d65_pmc->pchws[1]; + sama7d65_systemck[3].parent_hw =3D sama7d65_pmc->pchws[2]; + sama7d65_systemck[4].parent_hw =3D sama7d65_pmc->pchws[3]; + sama7d65_systemck[5].parent_hw =3D sama7d65_pmc->pchws[4]; + sama7d65_systemck[6].parent_hw =3D sama7d65_pmc->pchws[5]; + sama7d65_systemck[7].parent_hw =3D sama7d65_pmc->pchws[6]; + sama7d65_systemck[8].parent_hw =3D sama7d65_pmc->pchws[7]; for (i =3D 0; i < ARRAY_SIZE(sama7d65_systemck); i++) { hw =3D at91_clk_register_system(regmap, sama7d65_systemck[i].n, - sama7d65_systemck[i].p, NULL, + NULL, &AT91_CLK_PD_HW(sama7d65_systemck[i].parent_hw), sama7d65_systemck[i].id, 0); if (IS_ERR(hw)) goto err_free; --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D1F53A4F5E; Fri, 16 Jan 2026 20:07:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594062; cv=none; b=J0x+TN6WE55g6cEhWtwH98S0OdDXJAt4hGBk+hDujgz2Nx+jUEIEkdyvyLYDpEztBcZ9JQJMlCO5CxzvI1BfkQ6RxG1ptrNhJDpxZtK8h+SdaOUYj8Bk/IWBEitqGrps+qx+LPMqxruXuWB1f/XpusKrALsYCxvdgLiuflLr8P4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594062; c=relaxed/simple; bh=Za5xV6LaoahVj0xivZJaxL2FKgmFye7FKP1DStmu9rM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PqPZTaCIcCZr0dsmBMh33TMAK9wFGiDPZ0/vaUVFJM0ygyc2BA6vMkHMplizA/atp3ynYY6OuSRtKQltE+NLkyPYvqmHQykT7/WRHTmOnvEae3V2c9Siioq1vMpXcYhRR0EaaYak3gt6oRUMmJli0U4RvY2Jd0soYqzz+esWSCU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=OAy2WNcb; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="OAy2WNcb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594060; x=1800130060; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Za5xV6LaoahVj0xivZJaxL2FKgmFye7FKP1DStmu9rM=; b=OAy2WNcbTYIIBHoPIEmaXUYnQSSAJl12pWNK1tHmXUsIOQgWzXVpVnQZ HK+l0WDP0JEYTUg+jZgxKz0fN6r2+cqsYDOcNYnbS12wh5fNNR2PX9F7k ulTXTwMDZkY/HWtT9LB4Bt0Yy/n/vf4Ae628Epdo9Sn/A9fM63yTEAO9C fP2XRgEef7s1iqJkkgyuiHo8/T9XQsE1NmqKFeC5tbPLxx/LJVYi4AhIU EycfHogRUccuMmnhcOP6V24vQCG2kB9qDE0bmN8XOWuKlnR2PmLJjrM3/ gyZC8fylL54kA5V5o423khs1P5S59fI39GbxTLCj7ALqfx4ZA3NMSkc+S g==; X-CSE-ConnectionGUID: MqTcJu0RSESfeq27zLZvsQ== X-CSE-MsgGUID: iQVZJsy7SICUJujys1tGrA== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="52013858" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Jan 2026 13:07:39 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Fri, 16 Jan 2026 13:07:05 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:05 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 14/31] clk: at91: clk-pll: add support for parent_hw Date: Fri, 16 Jan 2026 13:07:07 -0700 Message-ID: <7b6cc0e89a31b5f0196c0770dc692edf550e01d2.1768512290.git.ryan.wanner@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Add support for parent_hw in pll clock driver. With this parent-child relation is described with pointers rather than strings making registration a bit faster. All the SoC based drivers that rely on clk-pll were adapted to the new API change. The switch itself for SoCs will be done in subsequent patches. Signed-off-by: Claudiu Beznea Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/at91rm9200.c | 4 ++-- drivers/clk/at91/at91sam9260.c | 4 ++-- drivers/clk/at91/at91sam9g45.c | 2 +- drivers/clk/at91/at91sam9n12.c | 4 ++-- drivers/clk/at91/at91sam9rl.c | 2 +- drivers/clk/at91/at91sam9x5.c | 2 +- drivers/clk/at91/clk-pll.c | 9 ++++++--- drivers/clk/at91/dt-compat.c | 2 +- drivers/clk/at91/pmc.h | 2 +- drivers/clk/at91/sama5d2.c | 2 +- drivers/clk/at91/sama5d3.c | 2 +- drivers/clk/at91/sama5d4.c | 2 +- 12 files changed, 20 insertions(+), 17 deletions(-) diff --git a/drivers/clk/at91/at91rm9200.c b/drivers/clk/at91/at91rm9200.c index e5a034f208d8..623e232ec9c6 100644 --- a/drivers/clk/at91/at91rm9200.c +++ b/drivers/clk/at91/at91rm9200.c @@ -119,7 +119,7 @@ static void __init at91rm9200_pmc_setup(struct device_n= ode *np) =20 at91rm9200_pmc->chws[PMC_MAIN] =3D hw; =20 - hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", 0, + hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, &at91rm9200_pll_layout, &rm9200_pll_characteristics); if (IS_ERR(hw)) @@ -127,7 +127,7 @@ static void __init at91rm9200_pmc_setup(struct device_n= ode *np) =20 at91rm9200_pmc->chws[PMC_PLLACK] =3D hw; =20 - hw =3D at91_clk_register_pll(regmap, "pllbck", "mainck", 1, + hw =3D at91_clk_register_pll(regmap, "pllbck", "mainck", NULL, 1, &at91rm9200_pll_layout, &rm9200_pll_characteristics); if (IS_ERR(hw)) diff --git a/drivers/clk/at91/at91sam9260.c b/drivers/clk/at91/at91sam9260.c index ae6f126f204a..f39deb3ec00a 100644 --- a/drivers/clk/at91/at91sam9260.c +++ b/drivers/clk/at91/at91sam9260.c @@ -395,7 +395,7 @@ static void __init at91sam926x_pmc_setup(struct device_= node *np, slck_name =3D slowxtal_name; } =20 - hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", 0, + hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, data->plla_layout, data->plla_characteristics); if (IS_ERR(hw)) @@ -403,7 +403,7 @@ static void __init at91sam926x_pmc_setup(struct device_= node *np, =20 at91sam9260_pmc->chws[PMC_PLLACK] =3D hw; =20 - hw =3D at91_clk_register_pll(regmap, "pllbck", "mainck", 1, + hw =3D at91_clk_register_pll(regmap, "pllbck", "mainck", NULL, 1, data->pllb_layout, data->pllb_characteristics); if (IS_ERR(hw)) diff --git a/drivers/clk/at91/at91sam9g45.c b/drivers/clk/at91/at91sam9g45.c index 684d2bcb36e8..3436a09a6e8a 100644 --- a/drivers/clk/at91/at91sam9g45.c +++ b/drivers/clk/at91/at91sam9g45.c @@ -134,7 +134,7 @@ static void __init at91sam9g45_pmc_setup(struct device_= node *np) =20 at91sam9g45_pmc->chws[PMC_MAIN] =3D hw; =20 - hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", 0, + hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, &at91rm9200_pll_layout, &plla_characteristics); if (IS_ERR(hw)) goto err_free; diff --git a/drivers/clk/at91/at91sam9n12.c b/drivers/clk/at91/at91sam9n12.c index 9fc20b177b13..80ccd4a49df3 100644 --- a/drivers/clk/at91/at91sam9n12.c +++ b/drivers/clk/at91/at91sam9n12.c @@ -160,7 +160,7 @@ static void __init at91sam9n12_pmc_setup(struct device_= node *np) =20 at91sam9n12_pmc->chws[PMC_MAIN] =3D hw; =20 - hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", 0, + hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, &at91rm9200_pll_layout, &plla_characteristics); if (IS_ERR(hw)) goto err_free; @@ -171,7 +171,7 @@ static void __init at91sam9n12_pmc_setup(struct device_= node *np) =20 at91sam9n12_pmc->chws[PMC_PLLACK] =3D hw; =20 - hw =3D at91_clk_register_pll(regmap, "pllbck", "mainck", 1, + hw =3D at91_clk_register_pll(regmap, "pllbck", "mainck", NULL, 1, &at91rm9200_pll_layout, &pllb_characteristics); if (IS_ERR(hw)) goto err_free; diff --git a/drivers/clk/at91/at91sam9rl.c b/drivers/clk/at91/at91sam9rl.c index 969f809e7d65..0e8657aac491 100644 --- a/drivers/clk/at91/at91sam9rl.c +++ b/drivers/clk/at91/at91sam9rl.c @@ -101,7 +101,7 @@ static void __init at91sam9rl_pmc_setup(struct device_n= ode *np) =20 at91sam9rl_pmc->chws[PMC_MAIN] =3D hw; =20 - hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", 0, + hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, &at91rm9200_pll_layout, &sam9rl_plla_characteristics); if (IS_ERR(hw)) diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c index 5728cfb9036f..6b8c755fefdf 100644 --- a/drivers/clk/at91/at91sam9x5.c +++ b/drivers/clk/at91/at91sam9x5.c @@ -182,7 +182,7 @@ static void __init at91sam9x5_pmc_setup(struct device_n= ode *np, =20 at91sam9x5_pmc->chws[PMC_MAIN] =3D hw; =20 - hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", 0, + hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, &at91rm9200_pll_layout, &plla_characteristics); if (IS_ERR(hw)) goto err_free; diff --git a/drivers/clk/at91/clk-pll.c b/drivers/clk/at91/clk-pll.c index 5c5f7398effe..138024db514f 100644 --- a/drivers/clk/at91/clk-pll.c +++ b/drivers/clk/at91/clk-pll.c @@ -312,13 +312,13 @@ static const struct clk_ops pll_ops =3D { =20 struct clk_hw * __init at91_clk_register_pll(struct regmap *regmap, const char *name, - const char *parent_name, u8 id, + const char *parent_name, struct clk_parent_data *parent_data, u8 i= d, const struct clk_pll_layout *layout, const struct clk_pll_characteristics *characteristics) { struct clk_pll *pll; struct clk_hw *hw; - struct clk_init_data init; + struct clk_init_data init =3D {}; int offset =3D PLL_REG(id); unsigned int pllr; int ret; @@ -332,7 +332,10 @@ at91_clk_register_pll(struct regmap *regmap, const cha= r *name, =20 init.name =3D name; init.ops =3D &pll_ops; - init.parent_names =3D &parent_name; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; + else + init.parent_names =3D &parent_name; init.num_parents =3D 1; init.flags =3D CLK_SET_RATE_GATE; =20 diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c index 7883198f6a98..2c5faa3b1cfd 100644 --- a/drivers/clk/at91/dt-compat.c +++ b/drivers/clk/at91/dt-compat.c @@ -665,7 +665,7 @@ of_at91_clk_pll_setup(struct device_node *np, if (!characteristics) return; =20 - hw =3D at91_clk_register_pll(regmap, name, parent_name, id, layout, + hw =3D at91_clk_register_pll(regmap, name, parent_name, NULL, id, layout, characteristics); if (IS_ERR(hw)) goto out_free_characteristics; diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index cd8f286f4711..0b1c21eae4fb 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -241,7 +241,7 @@ at91_clk_register_sam9x5_peripheral(struct regmap *regm= ap, spinlock_t *lock, =20 struct clk_hw * __init at91_clk_register_pll(struct regmap *regmap, const char *name, - const char *parent_name, u8 id, + const char *parent_name, struct clk_parent_data *parent_data, u8 i= d, const struct clk_pll_layout *layout, const struct clk_pll_characteristics *characteristics); struct clk_hw * __init diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c index 8bbc34e22cda..bc62b9ed4ea0 100644 --- a/drivers/clk/at91/sama5d2.c +++ b/drivers/clk/at91/sama5d2.c @@ -215,7 +215,7 @@ static void __init sama5d2_pmc_setup(struct device_node= *np) =20 sama5d2_pmc->chws[PMC_MAIN] =3D hw; =20 - hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", 0, + hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, &sama5d3_pll_layout, &plla_characteristics); if (IS_ERR(hw)) goto err_free; diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c index 05d0cdd22bc4..9d86c350a1e7 100644 --- a/drivers/clk/at91/sama5d3.c +++ b/drivers/clk/at91/sama5d3.c @@ -161,7 +161,7 @@ static void __init sama5d3_pmc_setup(struct device_node= *np) if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", 0, + hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, &sama5d3_pll_layout, &plla_characteristics); if (IS_ERR(hw)) goto err_free; diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c index da84b4cef827..8491b1e0391d 100644 --- a/drivers/clk/at91/sama5d4.c +++ b/drivers/clk/at91/sama5d4.c @@ -176,7 +176,7 @@ static void __init sama5d4_pmc_setup(struct device_node= *np) if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", 0, + hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, &sama5d3_pll_layout, &plla_characteristics); if (IS_ERR(hw)) goto err_free; --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A1883A35D2; Fri, 16 Jan 2026 20:07:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594054; cv=none; b=rYuzkmeEh1u+BdSrMjA9R0bzAWiKzyijTaDFpZkYue06eirH4FosZi+JqLJJAgdXQmsy6jmOJFUv7hylAhDiDEIlLLu+q0dtRtlZZDe30Zk6W+BzLxAMWO8evBF/0zS6WBavYeKs9DAgAME3lOgMeerNFuuRIrmVQELBYuYLPNY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594054; c=relaxed/simple; bh=2ct+wfuFTOZqeIGPQXmVjdzHQAKJ9Gsz1qeWAD28gdQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kbPCbiY15iDK2u+oNsAcHTmZQ4xV1DB3X/yC3eLjRWjVyvNjTw2ePwd46J9xPPWtYArUPT2XwGkILMTdqn/W+q8TgPD/jp+Llx17j4lSr7Hta2I3f79GRKvW8mPrYwM/C8sTYQPPPcYeuqMfIVlv5Cyk3Zc0JKYINw1daaekLUg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=k1PA5GJY; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="k1PA5GJY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594052; x=1800130052; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2ct+wfuFTOZqeIGPQXmVjdzHQAKJ9Gsz1qeWAD28gdQ=; b=k1PA5GJYTP5wIiC96HnXLeo1w9Wq6ZmAQfu5IxGi2B31t/spmLZxdaIq +IYmHwy1hG+wUlJ24RmXj9wrmEkue7uGZ4PcQDr+S+oE2i2BDwvg4rGXs a8iWvnEa0kcb5bDhTF1aQ6zRznmwBE1R8/yeLDE1NldHtRFgBUnvQCiSw +GrAT80FNSTDxoBJvOaSMGCZoRzlV7C4CdW0gFo29kRblGNKO6Ft2CjAV JCVRIQMTJw55lq7FDY2UwtS5VX/lN7AJ5R27yu2xvK+4zdz9nOL57ZtkC HaMQEHVNjIZcCkQmapZExk6g4+YLIbh+xE1KqFctf95OpvBHh+2pNcru8 Q==; X-CSE-ConnectionGUID: +9RSiAtvRY+RhxWEUm06Wg== X-CSE-MsgGUID: JUjBWKdnRFqBvmy/zMCTnw== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="283397054" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2026 13:07:17 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex1.mchp-main.com (10.10.87.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.29; Fri, 16 Jan 2026 13:07:05 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:05 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 15/31] clk: at91: clk-audio-pll: add support for parent_hw Date: Fri, 16 Jan 2026 13:07:08 -0700 Message-ID: <7b75764e380508c6c2c11a405bda60a801e2f494.1768512290.git.ryan.wanner@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Add support for parent_hw in audio pll clock drivers. With this parent-child relation is described with pointers rather than strings making registration a bit faster. All the SoC based drivers that rely on clk-audio-pll were adapted to the new API change. The switch itself for SoCs will be done in subsequent patches. Signed-off-by: Claudiu Beznea Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/clk-audio-pll.c | 28 ++++++++++++++++++++-------- drivers/clk/at91/dt-compat.c | 6 +++--- drivers/clk/at91/pmc.h | 6 +++--- drivers/clk/at91/sama5d2.c | 6 +++--- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/drivers/clk/at91/clk-audio-pll.c b/drivers/clk/at91/clk-audio-= pll.c index bf9b635ac9d6..4ab462cf5094 100644 --- a/drivers/clk/at91/clk-audio-pll.c +++ b/drivers/clk/at91/clk-audio-pll.c @@ -454,7 +454,8 @@ static const struct clk_ops audio_pll_pmc_ops =3D { =20 struct clk_hw * __init at91_clk_register_audio_pll_frac(struct regmap *regmap, const char *name, - const char *parent_name) + const char *parent_name, + struct clk_parent_data *parent_data) { struct clk_audio_frac *frac_ck; struct clk_init_data init =3D {}; @@ -466,7 +467,10 @@ at91_clk_register_audio_pll_frac(struct regmap *regmap= , const char *name, =20 init.name =3D name; init.ops =3D &audio_pll_frac_ops; - init.parent_names =3D &parent_name; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; + else + init.parent_names =3D &parent_name; init.num_parents =3D 1; init.flags =3D CLK_SET_RATE_GATE; =20 @@ -484,10 +488,11 @@ at91_clk_register_audio_pll_frac(struct regmap *regma= p, const char *name, =20 struct clk_hw * __init at91_clk_register_audio_pll_pad(struct regmap *regmap, const char *name, - const char *parent_name) + const char *parent_name, + struct clk_parent_data *parent_data) { struct clk_audio_pad *apad_ck; - struct clk_init_data init; + struct clk_init_data init =3D {}; int ret; =20 apad_ck =3D kzalloc(sizeof(*apad_ck), GFP_KERNEL); @@ -496,7 +501,10 @@ at91_clk_register_audio_pll_pad(struct regmap *regmap,= const char *name, =20 init.name =3D name; init.ops =3D &audio_pll_pad_ops; - init.parent_names =3D &parent_name; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; + else + init.parent_names =3D &parent_name; init.num_parents =3D 1; init.flags =3D CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE | CLK_SET_RATE_PARENT; @@ -515,10 +523,11 @@ at91_clk_register_audio_pll_pad(struct regmap *regmap= , const char *name, =20 struct clk_hw * __init at91_clk_register_audio_pll_pmc(struct regmap *regmap, const char *name, - const char *parent_name) + const char *parent_name, + struct clk_parent_data *parent_data) { struct clk_audio_pmc *apmc_ck; - struct clk_init_data init; + struct clk_init_data init =3D {}; int ret; =20 apmc_ck =3D kzalloc(sizeof(*apmc_ck), GFP_KERNEL); @@ -527,7 +536,10 @@ at91_clk_register_audio_pll_pmc(struct regmap *regmap,= const char *name, =20 init.name =3D name; init.ops =3D &audio_pll_pmc_ops; - init.parent_names =3D &parent_name; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; + else + init.parent_names =3D &parent_name; init.num_parents =3D 1; init.flags =3D CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE | CLK_SET_RATE_PARENT; diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c index 2c5faa3b1cfd..22bcaa3b28dd 100644 --- a/drivers/clk/at91/dt-compat.c +++ b/drivers/clk/at91/dt-compat.c @@ -43,7 +43,7 @@ static void __init of_sama5d2_clk_audio_pll_frac_setup(st= ruct device_node *np) =20 parent_name =3D of_clk_get_parent_name(np, 0); =20 - hw =3D at91_clk_register_audio_pll_frac(regmap, name, parent_name); + hw =3D at91_clk_register_audio_pll_frac(regmap, name, parent_name, NULL); if (IS_ERR(hw)) return; =20 @@ -69,7 +69,7 @@ static void __init of_sama5d2_clk_audio_pll_pad_setup(str= uct device_node *np) =20 parent_name =3D of_clk_get_parent_name(np, 0); =20 - hw =3D at91_clk_register_audio_pll_pad(regmap, name, parent_name); + hw =3D at91_clk_register_audio_pll_pad(regmap, name, parent_name, NULL); if (IS_ERR(hw)) return; =20 @@ -95,7 +95,7 @@ static void __init of_sama5d2_clk_audio_pll_pmc_setup(str= uct device_node *np) =20 parent_name =3D of_clk_get_parent_name(np, 0); =20 - hw =3D at91_clk_register_audio_pll_pmc(regmap, name, parent_name); + hw =3D at91_clk_register_audio_pll_pmc(regmap, name, parent_name, NULL); if (IS_ERR(hw)) return; =20 diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index 0b1c21eae4fb..f4b2a07db0d5 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -160,15 +160,15 @@ struct clk_hw *of_clk_hw_pmc_get(struct of_phandle_ar= gs *clkspec, void *data); =20 struct clk_hw * __init at91_clk_register_audio_pll_frac(struct regmap *regmap, const char *name, - const char *parent_name); + const char *parent_name, struct clk_parent_data *parent_data); =20 struct clk_hw * __init at91_clk_register_audio_pll_pad(struct regmap *regmap, const char *name, - const char *parent_name); + const char *parent_name, struct clk_parent_data *parent_data); =20 struct clk_hw * __init at91_clk_register_audio_pll_pmc(struct regmap *regmap, const char *name, - const char *parent_name); + const char *parent_name, struct clk_parent_data *parent_data); =20 struct clk_hw * __init at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock, diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c index bc62b9ed4ea0..d2af421abddc 100644 --- a/drivers/clk/at91/sama5d2.c +++ b/drivers/clk/at91/sama5d2.c @@ -227,19 +227,19 @@ static void __init sama5d2_pmc_setup(struct device_no= de *np) sama5d2_pmc->chws[PMC_PLLACK] =3D hw; =20 hw =3D at91_clk_register_audio_pll_frac(regmap, "audiopll_fracck", - "mainck"); + "mainck", NULL); if (IS_ERR(hw)) goto err_free; =20 hw =3D at91_clk_register_audio_pll_pad(regmap, "audiopll_padck", - "audiopll_fracck"); + "audiopll_fracck", NULL); if (IS_ERR(hw)) goto err_free; =20 sama5d2_pmc->chws[PMC_AUDIOPINCK] =3D hw; =20 hw =3D at91_clk_register_audio_pll_pmc(regmap, "audiopll_pmcck", - "audiopll_fracck"); + "audiopll_fracck", NULL); if (IS_ERR(hw)) goto err_free; =20 --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC94D3A9639; Fri, 16 Jan 2026 20:07:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594070; cv=none; b=P1niwnQve8iHkQlwp0UMfoHhvRLZIWGt1K/79Hjb8zwRvfZShN95wXswVnZMqH+XBOrMRjwEplcSRHR0zh9yl9GHfFtwGNfwtYYbFaaXqpwp8hAT1QAsWzFSfEWymXclHajiHQ/7A6uYfQ+PCtuT2WPxzDpwH+d7B1w+syUJMZg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594070; c=relaxed/simple; bh=GxvQznf2eXLiKCsYUlxA1ko9KsUsTDGByQa+O4mTKYs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=l2C6o/rK4mR6v0q8KdRgYcjVDEn/lmmsO9C40Fet4ZfV7Ou119SxSAXKsO2k7DfIKbMshuOxH1auS8EpueiN/udTCbrOzbo4EZMNiSObvdCqI1Q7zs6Q6DzIO9u/R54G6KNfHWTwb6GbQfLhKKwK2xCTBF5kON9RswM10yok48c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=G2qa2yD4; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="G2qa2yD4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594065; x=1800130065; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GxvQznf2eXLiKCsYUlxA1ko9KsUsTDGByQa+O4mTKYs=; b=G2qa2yD4zSwH1t/jfR5D/auUlQI6f0ilz3UrxX0CW8Pu5DgHxqEUdAEi +/fhwM1LpN2kE8Av0CDoHZtew+IkOQ6qS2YYV7SngWp7FPLIrYxLIO9UY QoHYW/nTc9YeBCfR//cZqXRYTwqc1XK5svBp4o+i9hgia6lfBuGnO/ve1 /RzGgjf7JP+aW/J9/EmfwItpUuj99ri3HqpM25X+SJyLJ/G18p+iwtOM/ KkVeOoZHi0ZY0jBWAoojLVq0DrlPGIusUI73QEzr+fk5b6o49RY2/LPDE QDkO7yP408i2aIvwZWLZn16Y5ta0M+feLX0r/UE3mi2K5IzxnOZGqO7hs g==; X-CSE-ConnectionGUID: 3LvvvroxTJyR6T9mab+TNA== X-CSE-MsgGUID: GGrG8uPeQfClVkJ01q9C8A== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="51290370" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Jan 2026 13:07:35 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Fri, 16 Jan 2026 13:07:06 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:06 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 16/31] clk: at91: clk-plldiv: add support for parent_data Date: Fri, 16 Jan 2026 13:07:09 -0700 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Add support for parent_data in plldiv clock driver. With this parent-child relation is described with pointers rather than strings making registration a bit faster. All the SoC based drivers that rely on clk-plldiv were adapted to the new API change. The switch itself for SoCs will be done in subsequent patches. Signed-off-by: Claudiu Beznea Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/at91sam9g45.c | 2 +- drivers/clk/at91/at91sam9n12.c | 2 +- drivers/clk/at91/at91sam9x5.c | 2 +- drivers/clk/at91/clk-plldiv.c | 11 +++++++---- drivers/clk/at91/dt-compat.c | 2 +- drivers/clk/at91/pmc.h | 2 +- drivers/clk/at91/sama5d2.c | 2 +- drivers/clk/at91/sama5d3.c | 2 +- drivers/clk/at91/sama5d4.c | 2 +- 9 files changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/clk/at91/at91sam9g45.c b/drivers/clk/at91/at91sam9g45.c index 3436a09a6e8a..cb98d22c2e30 100644 --- a/drivers/clk/at91/at91sam9g45.c +++ b/drivers/clk/at91/at91sam9g45.c @@ -139,7 +139,7 @@ static void __init at91sam9g45_pmc_setup(struct device_= node *np) if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_plldiv(regmap, "plladivck", "pllack"); + hw =3D at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL); if (IS_ERR(hw)) goto err_free; =20 diff --git a/drivers/clk/at91/at91sam9n12.c b/drivers/clk/at91/at91sam9n12.c index 80ccd4a49df3..34dd7645f964 100644 --- a/drivers/clk/at91/at91sam9n12.c +++ b/drivers/clk/at91/at91sam9n12.c @@ -165,7 +165,7 @@ static void __init at91sam9n12_pmc_setup(struct device_= node *np) if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_plldiv(regmap, "plladivck", "pllack"); + hw =3D at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL); if (IS_ERR(hw)) goto err_free; =20 diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c index 6b8c755fefdf..37280852f086 100644 --- a/drivers/clk/at91/at91sam9x5.c +++ b/drivers/clk/at91/at91sam9x5.c @@ -187,7 +187,7 @@ static void __init at91sam9x5_pmc_setup(struct device_n= ode *np, if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_plldiv(regmap, "plladivck", "pllack"); + hw =3D at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL); if (IS_ERR(hw)) goto err_free; =20 diff --git a/drivers/clk/at91/clk-plldiv.c b/drivers/clk/at91/clk-plldiv.c index 3ac09fecc54e..43de0543e8d1 100644 --- a/drivers/clk/at91/clk-plldiv.c +++ b/drivers/clk/at91/clk-plldiv.c @@ -84,11 +84,11 @@ static const struct clk_ops plldiv_ops =3D { =20 struct clk_hw * __init at91_clk_register_plldiv(struct regmap *regmap, const char *name, - const char *parent_name) + const char *parent_name, struct clk_parent_data *parent_data) { struct clk_plldiv *plldiv; struct clk_hw *hw; - struct clk_init_data init; + struct clk_init_data init =3D {}; int ret; =20 plldiv =3D kzalloc(sizeof(*plldiv), GFP_KERNEL); @@ -97,8 +97,11 @@ at91_clk_register_plldiv(struct regmap *regmap, const ch= ar *name, =20 init.name =3D name; init.ops =3D &plldiv_ops; - init.parent_names =3D parent_name ? &parent_name : NULL; - init.num_parents =3D parent_name ? 1 : 0; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; + else + init.parent_names =3D &parent_name; + init.num_parents =3D 1; init.flags =3D CLK_SET_RATE_GATE; =20 plldiv->hw.init =3D &init; diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c index 22bcaa3b28dd..3285e3110b58 100644 --- a/drivers/clk/at91/dt-compat.c +++ b/drivers/clk/at91/dt-compat.c @@ -724,7 +724,7 @@ of_at91sam9x5_clk_plldiv_setup(struct device_node *np) if (IS_ERR(regmap)) return; =20 - hw =3D at91_clk_register_plldiv(regmap, name, parent_name); + hw =3D at91_clk_register_plldiv(regmap, name, parent_name, NULL); if (IS_ERR(hw)) return; =20 diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index f4b2a07db0d5..e6465259521e 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -246,7 +246,7 @@ at91_clk_register_pll(struct regmap *regmap, const char= *name, const struct clk_pll_characteristics *characteristics); struct clk_hw * __init at91_clk_register_plldiv(struct regmap *regmap, const char *name, - const char *parent_name); + const char *parent_name, struct clk_parent_data *parent_data); =20 struct clk_hw * __init sam9x60_clk_register_div_pll(struct regmap *regmap, spinlock_t *lock, diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c index d2af421abddc..7904f2122ed7 100644 --- a/drivers/clk/at91/sama5d2.c +++ b/drivers/clk/at91/sama5d2.c @@ -220,7 +220,7 @@ static void __init sama5d2_pmc_setup(struct device_node= *np) if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_plldiv(regmap, "plladivck", "pllack"); + hw =3D at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL); if (IS_ERR(hw)) goto err_free; =20 diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c index 9d86c350a1e7..7f2ac8f648dd 100644 --- a/drivers/clk/at91/sama5d3.c +++ b/drivers/clk/at91/sama5d3.c @@ -166,7 +166,7 @@ static void __init sama5d3_pmc_setup(struct device_node= *np) if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_plldiv(regmap, "plladivck", "pllack"); + hw =3D at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL); if (IS_ERR(hw)) goto err_free; =20 diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c index 8491b1e0391d..7cda8032653e 100644 --- a/drivers/clk/at91/sama5d4.c +++ b/drivers/clk/at91/sama5d4.c @@ -181,7 +181,7 @@ static void __init sama5d4_pmc_setup(struct device_node= *np) if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_plldiv(regmap, "plladivck", "pllack"); + hw =3D at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL); if (IS_ERR(hw)) goto err_free; =20 --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 508CE3A35DE; Fri, 16 Jan 2026 20:07:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594056; cv=none; b=T2ZLyWbuS3i83rVl3c4c2weH/OFXYHbyZvgajHIrjAXqG72RV19VK9VnTi9neDiZjTS80ohRY/CTuAXNKxnb7jT8H71emEgdiY7NqjcqSlJP50qe0SmfSbd8UKf1ZUW5c/sxIKMctJRjZae8G2JQUHLvait1B450lMRHjphYX4U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594056; c=relaxed/simple; bh=n7mIBMggA516wAOxYTsWouwXOvs5xr+CGDAMpD99kJg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=vCxmxE/Er3zljOluj38/x8M7Lhw203IMQiwo+DNtpA/cFAkoUn9q1b6NomyBzahOV/CRdDCo5/xQIfaCyDcasvMBjX/5BFewxcRSvUfqczExEVBtw4reQNHNruXYEmDWHop78aTgxRA3wXEDfdImQeleE4Y/vRZzmHyiHEk6EAs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=xQSdBjgv; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="xQSdBjgv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594051; x=1800130051; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=n7mIBMggA516wAOxYTsWouwXOvs5xr+CGDAMpD99kJg=; b=xQSdBjgv/vlDjQ4aYzMdP0dUVpgYWJvkVTMAcYwi5VMALOjAIsb1MnmQ Jk7yMF+bSDY0WCSzVAIXT1Ff0yT5V/jgZNfUUIov+19c5BvTBEOvHYxJL N1E4bun/K51Y0l2Bj1b+k1sGZOkmjx/ERfZCueHQh5J/BwUMz6guxkzs9 167/yO3VVau/sBsFF1gDdlUXi6RHkEITrIacd5KvCPcobxf5X7bql9FS4 xYlaFradJcljK8G9CbLEFe4ekRlD94OrW1S4ilT34XUIYh8FCnuTKIZsX Qp4dYF7SL4fAuclzn1IZ6jPacsyX8FBkBColeXkOtZKEhXRlpTFlz0HNI g==; X-CSE-ConnectionGUID: OTooRcwrRNCxZBlF1StIPQ== X-CSE-MsgGUID: 4EQoo9cNRY+exmGaOQL3iw== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="59042239" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2026 13:07:25 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex3.mchp-main.com (10.10.87.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.29; Fri, 16 Jan 2026 13:07:06 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:06 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 17/31] clk: at91: clk-h32mx: add support for parent_data Date: Fri, 16 Jan 2026 13:07:10 -0700 Message-ID: <9f6f22bfd5ca47e4d1608282d13eb80a9c01865a.1768512290.git.ryan.wanner@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Add support for parent_data in h32mx clock driver. With this parent-child relation is described with pointers rather than strings making registration a bit faster. All the SoC based drivers that rely on clk-h32mx were adapted to the new API change. The switch itself for SoCs will be done in subsequent patches. Signed-off-by: Claudiu Beznea Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/clk-h32mx.c | 11 +++++++---- drivers/clk/at91/dt-compat.c | 2 +- drivers/clk/at91/pmc.h | 2 +- drivers/clk/at91/sama5d2.c | 2 +- drivers/clk/at91/sama5d4.c | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/clk/at91/clk-h32mx.c b/drivers/clk/at91/clk-h32mx.c index a9aa93b5a870..c691a3b1526f 100644 --- a/drivers/clk/at91/clk-h32mx.c +++ b/drivers/clk/at91/clk-h32mx.c @@ -94,10 +94,10 @@ static const struct clk_ops h32mx_ops =3D { =20 struct clk_hw * __init at91_clk_register_h32mx(struct regmap *regmap, const char *name, - const char *parent_name) + const char *parent_name, struct clk_parent_data *parent_data) { struct clk_sama5d4_h32mx *h32mxclk; - struct clk_init_data init; + struct clk_init_data init =3D {}; int ret; =20 h32mxclk =3D kzalloc(sizeof(*h32mxclk), GFP_KERNEL); @@ -106,8 +106,11 @@ at91_clk_register_h32mx(struct regmap *regmap, const c= har *name, =20 init.name =3D name; init.ops =3D &h32mx_ops; - init.parent_names =3D parent_name ? &parent_name : NULL; - init.num_parents =3D parent_name ? 1 : 0; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; + else + init.parent_names =3D &parent_name; + init.num_parents =3D 1; init.flags =3D CLK_SET_RATE_GATE; =20 h32mxclk->hw.init =3D &init; diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c index 3285e3110b58..ccdeba3a1130 100644 --- a/drivers/clk/at91/dt-compat.c +++ b/drivers/clk/at91/dt-compat.c @@ -201,7 +201,7 @@ static void __init of_sama5d4_clk_h32mx_setup(struct de= vice_node *np) =20 parent_name =3D of_clk_get_parent_name(np, 0); =20 - hw =3D at91_clk_register_h32mx(regmap, name, parent_name); + hw =3D at91_clk_register_h32mx(regmap, name, parent_name, NULL); if (IS_ERR(hw)) return; =20 diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index e6465259521e..32bb041c1466 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -180,7 +180,7 @@ at91_clk_register_generated(struct regmap *regmap, spin= lock_t *lock, =20 struct clk_hw * __init at91_clk_register_h32mx(struct regmap *regmap, const char *name, - const char *parent_name); + const char *parent_name, struct clk_parent_data *parent_data); =20 struct clk_hw * __init at91_clk_i2s_mux_register(struct regmap *regmap, const char *name, diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c index 7904f2122ed7..8c7ff0108b41 100644 --- a/drivers/clk/at91/sama5d2.c +++ b/drivers/clk/at91/sama5d2.c @@ -276,7 +276,7 @@ static void __init sama5d2_pmc_setup(struct device_node= *np) =20 sama5d2_pmc->chws[PMC_MCK] =3D hw; =20 - hw =3D at91_clk_register_h32mx(regmap, "h32mxck", "masterck_div"); + hw =3D at91_clk_register_h32mx(regmap, "h32mxck", "masterck_div", NULL); if (IS_ERR(hw)) goto err_free; =20 diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c index 7cda8032653e..04c848cd7001 100644 --- a/drivers/clk/at91/sama5d4.c +++ b/drivers/clk/at91/sama5d4.c @@ -214,7 +214,7 @@ static void __init sama5d4_pmc_setup(struct device_node= *np) =20 sama5d4_pmc->chws[PMC_MCK] =3D hw; =20 - hw =3D at91_clk_register_h32mx(regmap, "h32mxck", "masterck_div"); + hw =3D at91_clk_register_h32mx(regmap, "h32mxck", "masterck_div", NULL); if (IS_ERR(hw)) goto err_free; =20 --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C9563A4AAB; Fri, 16 Jan 2026 20:07:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594056; cv=none; b=rxLzUD+LTqXpeZB2aG9w7bRi2J09ES+qRCstGtpCEdyCMoBKlXGJlm7N3enpLYKdnTG2aapuAcity+r3/R90BGUnyxoRpZRboiZO0RoY/xu7ly4eQTjTzmElIWEp6TGTwH6lQxWPN7/J1ImQ34yfUvD65cgFNO26ssyU3A5NGZk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594056; c=relaxed/simple; bh=4j7JJmu0bl4xjlY1WxBs2ZZlXxj0JOHqAkmnYdAEZ7g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=d33jwj0/oWmocE2DmNj33x8dc2nUd1mY7kpIterN5243GDjEiok2e1LG0joAWI7OolH8CpO8gP1ae/eNX2zWFCKkEPmphTd6oTPm7rNJ1QtJYEkbiiZuz4THko0aRIlW0B5PaImSk93Qk3+Q6EbXyu6a0SMFXkU6oUlcIxZvd8g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=tJPxidHx; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="tJPxidHx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594052; x=1800130052; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4j7JJmu0bl4xjlY1WxBs2ZZlXxj0JOHqAkmnYdAEZ7g=; b=tJPxidHxhpX1g59f6Naaw6w+kcV6HWPU7eRSC3egcXS8tXfW2aY30iNK Lle95AGpzAJ9xEfzvLnoz3eMe1cZh4i8T2b7fSMIJ2PJPctbx3+3v506U Ew7t+v1SQT+AeL1ouEN1wQXviD+xqhrZO2e7e/kYbzCDaBDKrorXl5PBT u3zvWFEZYqKXGKQTIRKgJm5Yj0bZku11l8cx8L3OCRFIV/eznEdGPeiDN rOw1wv37Yi1ilw/mPm0b6a98EJXQzZtPI+618SeJdYh7CdzwhSfcpdW9S JN6SebPFpTD8qaGsNeI9JKgCkL8Ms5YWuqcQ6nY8XeaW3ML6zV79tJd9a A==; X-CSE-ConnectionGUID: OTooRcwrRNCxZBlF1StIPQ== X-CSE-MsgGUID: M6+9SkXyQtu+UZN+kxO0mQ== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="59042241" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2026 13:07:25 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex3.mchp-main.com (10.10.87.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.29; Fri, 16 Jan 2026 13:07:06 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:06 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 18/31] clk: at91: clk-i2s-mux: add support for parent_data Date: Fri, 16 Jan 2026 13:07:11 -0700 Message-ID: <0d5517f708a262924c6aa6f97a23d078891c218a.1768512290.git.ryan.wanner@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Add support for parent_data in i2s mux clock driver. With this parent-child relation is described with pointers rather than strings making registration a bit faster. All the SoC based drivers that rely on clk-i2s-mux were adapted to the new API change. The switch itself for SoCs will be done in subsequent patches. Signed-off-by: Claudiu Beznea Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/clk-i2s-mux.c | 6 +++++- drivers/clk/at91/dt-compat.c | 2 +- drivers/clk/at91/pmc.h | 1 + drivers/clk/at91/sama5d2.c | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/clk/at91/clk-i2s-mux.c b/drivers/clk/at91/clk-i2s-mux.c index fe6ce172b8b0..04d9fcf940fb 100644 --- a/drivers/clk/at91/clk-i2s-mux.c +++ b/drivers/clk/at91/clk-i2s-mux.c @@ -51,6 +51,7 @@ static const struct clk_ops clk_i2s_mux_ops =3D { struct clk_hw * __init at91_clk_i2s_mux_register(struct regmap *regmap, const char *name, const char * const *parent_names, + struct clk_parent_data *parent_data, unsigned int num_parents, u8 bus_id) { struct clk_init_data init =3D {}; @@ -63,7 +64,10 @@ at91_clk_i2s_mux_register(struct regmap *regmap, const c= har *name, =20 init.name =3D name; init.ops =3D &clk_i2s_mux_ops; - init.parent_names =3D parent_names; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; + else + init.parent_names =3D parent_names; init.num_parents =3D num_parents; =20 i2s_ck->hw.init =3D &init; diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c index ccdeba3a1130..2b1aa834f111 100644 --- a/drivers/clk/at91/dt-compat.c +++ b/drivers/clk/at91/dt-compat.c @@ -239,7 +239,7 @@ static void __init of_sama5d2_clk_i2s_mux_setup(struct = device_node *np) continue; =20 hw =3D at91_clk_i2s_mux_register(regmap_sfr, i2s_mux_np->name, - parent_names, 2, bus_id); + parent_names, NULL, 2, bus_id); if (IS_ERR(hw)) continue; =20 diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index 32bb041c1466..3680e2d489d8 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -185,6 +185,7 @@ at91_clk_register_h32mx(struct regmap *regmap, const ch= ar *name, struct clk_hw * __init at91_clk_i2s_mux_register(struct regmap *regmap, const char *name, const char * const *parent_names, + struct clk_parent_data *parent_data, unsigned int num_parents, u8 bus_id); =20 struct clk_hw * __init diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c index 8c7ff0108b41..f5d6c7a96cf2 100644 --- a/drivers/clk/at91/sama5d2.c +++ b/drivers/clk/at91/sama5d2.c @@ -372,7 +372,7 @@ static void __init sama5d2_pmc_setup(struct device_node= *np) parent_names[0] =3D "i2s0_clk"; parent_names[1] =3D "i2s0_gclk"; hw =3D at91_clk_i2s_mux_register(regmap_sfr, "i2s0_muxclk", - parent_names, 2, 0); + parent_names, NULL, 2, 0); if (IS_ERR(hw)) goto err_free; =20 @@ -381,7 +381,7 @@ static void __init sama5d2_pmc_setup(struct device_node= *np) parent_names[0] =3D "i2s1_clk"; parent_names[1] =3D "i2s1_gclk"; hw =3D at91_clk_i2s_mux_register(regmap_sfr, "i2s1_muxclk", - parent_names, 2, 1); + parent_names, NULL, 2, 1); if (IS_ERR(hw)) goto err_free; =20 --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58EDC3A1E7B; Fri, 16 Jan 2026 20:07:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594062; cv=none; b=RfxiVlj/AcBO0U2WfaWanEZx/AXyb4tI7VcDpFEnRxJ3aLeKjjEgTPUyaqIqkBT4R5MsKIiknGZ2oWexVbca+GkMcKX/H44ww7uDFOyoZLRliT6pw6N2QpqBf7EaroGCZIt1rggMzVWYCEZI8YRcXsiblWMQnKItGwv86erxqh8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594062; c=relaxed/simple; bh=gAK0nimLOIAx5kqVpIz48AFoNgNBNFLudz2LhKw6EFU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ohiVxCc6TDtPBCIDp8b3KO8iQsXqVSDCRe5QkAQhUxrU9VgE3utbRltAyNSqf9CzipHlF+CRnnZLXYAV5UTVBlcRRyZLgYPlVKz6ihhlkLqMIap4iOtNZi1wa9mny1t5Uaroi6M4narjQl+g6/WsiUISYRxC4D5oyPLCHpgD7N0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=DWiweyJb; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="DWiweyJb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594061; x=1800130061; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gAK0nimLOIAx5kqVpIz48AFoNgNBNFLudz2LhKw6EFU=; b=DWiweyJbV6bsTjoRCC53GbGBVU6NTKXDb7zXznff3Krz/TXf1+ij9oin lmIZ/Z+apjnyskAru0Q6Lo0AoXnm7ZepM4TRK89jMVZvK84v7XJUEzV3b UdnhD3cIZ99Rtxa4YOwWB+2WqGlkJbntMl9bIL64Io2ChuALo9z4qp5mW aj3/ihV8A4mm6zLsyzX/F7ludPs3CLyUIJ60LWEan9TZfoH3zUBMxL1KD cDgX7b8axxPi/Y/HBm5sbK+u74cT1epXms9eoiiEVzje0ucpa7dx5IwPL XLkNkHJCmdSn37FPHD95lodDmcIj3a2+I+6X/WYTF1a9SZNDMhDobsuec Q==; X-CSE-ConnectionGUID: MqTcJu0RSESfeq27zLZvsQ== X-CSE-MsgGUID: TvN56jmMQXerNh5RhpRVvA== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="52013861" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Jan 2026 13:07:39 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Fri, 16 Jan 2026 13:07:06 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:06 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 19/31] clk: at91: clk-smd: add support for clk_parent_data Date: Fri, 16 Jan 2026 13:07:12 -0700 Message-ID: <92f9e1fc621d30e9692f2d398372b5a862647d40.1768512290.git.ryan.wanner@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Add support for parent_data in smd clock drivers. With this parent-child relation is described with pointers rather than strings making registration a bit faster. All the SoC based drivers that rely on clk-smd were adapted to the new API change. The switch itself for SoCs will be done in subsequent patches. Signed-off-by: Claudiu Beznea Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/at91sam9x5.c | 2 +- drivers/clk/at91/clk-smd.c | 10 +++++++--- drivers/clk/at91/dt-compat.c | 2 +- drivers/clk/at91/pmc.h | 3 ++- drivers/clk/at91/sama5d3.c | 2 +- drivers/clk/at91/sama5d4.c | 2 +- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c index 37280852f086..13331e015dd7 100644 --- a/drivers/clk/at91/at91sam9x5.c +++ b/drivers/clk/at91/at91sam9x5.c @@ -226,7 +226,7 @@ static void __init at91sam9x5_pmc_setup(struct device_n= ode *np, if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91sam9x5_clk_register_smd(regmap, "smdclk", parent_names, 2); + hw =3D at91sam9x5_clk_register_smd(regmap, "smdclk", parent_names, NULL, = 2); if (IS_ERR(hw)) goto err_free; =20 diff --git a/drivers/clk/at91/clk-smd.c b/drivers/clk/at91/clk-smd.c index 09c649c8598e..d53dc32b36be 100644 --- a/drivers/clk/at91/clk-smd.c +++ b/drivers/clk/at91/clk-smd.c @@ -111,11 +111,12 @@ static const struct clk_ops at91sam9x5_smd_ops =3D { =20 struct clk_hw * __init at91sam9x5_clk_register_smd(struct regmap *regmap, const char *name, - const char **parent_names, u8 num_parents) + const char **parent_names, struct clk_parent_data *parent_data, + u8 num_parents) { struct at91sam9x5_clk_smd *smd; struct clk_hw *hw; - struct clk_init_data init; + struct clk_init_data init =3D {}; int ret; =20 smd =3D kzalloc(sizeof(*smd), GFP_KERNEL); @@ -124,7 +125,10 @@ at91sam9x5_clk_register_smd(struct regmap *regmap, con= st char *name, =20 init.name =3D name; init.ops =3D &at91sam9x5_smd_ops; - init.parent_names =3D parent_names; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)parent_data; + else + init.parent_names =3D parent_names; init.num_parents =3D num_parents; init.flags =3D CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE; =20 diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c index 2b1aa834f111..5afd7c9f53fd 100644 --- a/drivers/clk/at91/dt-compat.c +++ b/drivers/clk/at91/dt-compat.c @@ -859,7 +859,7 @@ static void __init of_at91sam9x5_clk_smd_setup(struct d= evice_node *np) if (IS_ERR(regmap)) return; =20 - hw =3D at91sam9x5_clk_register_smd(regmap, name, parent_names, + hw =3D at91sam9x5_clk_register_smd(regmap, name, parent_names, NULL, num_parents); if (IS_ERR(hw)) return; diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index 3680e2d489d8..08c3138fef8f 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -280,7 +280,8 @@ at91_clk_register_sam9260_slow(struct regmap *regmap, =20 struct clk_hw * __init at91sam9x5_clk_register_smd(struct regmap *regmap, const char *name, - const char **parent_names, u8 num_parents); + const char **parent_names, struct clk_parent_data *parent_data, + u8 num_parents); =20 struct clk_hw * __init at91_clk_register_system(struct regmap *regmap, const char *name, diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c index 7f2ac8f648dd..8326bb6a291c 100644 --- a/drivers/clk/at91/sama5d3.c +++ b/drivers/clk/at91/sama5d3.c @@ -205,7 +205,7 @@ static void __init sama5d3_pmc_setup(struct device_node= *np) if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91sam9x5_clk_register_smd(regmap, "smdclk", parent_names, 2); + hw =3D at91sam9x5_clk_register_smd(regmap, "smdclk", parent_names, NULL, = 2); if (IS_ERR(hw)) goto err_free; =20 diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c index 04c848cd7001..1ff9286148da 100644 --- a/drivers/clk/at91/sama5d4.c +++ b/drivers/clk/at91/sama5d4.c @@ -228,7 +228,7 @@ static void __init sama5d4_pmc_setup(struct device_node= *np) =20 parent_names[0] =3D "plladivck"; parent_names[1] =3D "utmick"; - hw =3D at91sam9x5_clk_register_smd(regmap, "smdclk", parent_names, 2); + hw =3D at91sam9x5_clk_register_smd(regmap, "smdclk", parent_names, NULL, = 2); if (IS_ERR(hw)) goto err_free; =20 --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 386613A89A4; Fri, 16 Jan 2026 20:07:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594064; cv=none; b=E6tPaeoJNXCEdnnPaw6QqKE/rPMWkeDD/sYXLMwPQyuq4TAhrEMZvtPrXBuPltTsPhM4EWKbYDBNU/E1uyHifRQ6iCqWOCNWQIMAO6a7lOXlm9dByiif/6Rqdi+qcbvW8INustEsvdfYyNI0+TPorsvCR23XYtzwaYjPTfzVd0c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594064; c=relaxed/simple; bh=6Tjj+ZTqhOQ3NVpdkwEPxGTifoxhf2PbMwWee8sOAGc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iSnQMh4A+nP/aeZNIBbDjZY9A3hCoIY9Ky3A/2rHxZReq6ku0VLUUqSMvZ8iurke1mYrwh9sQS1XKPjCzDpHg62LpY5ypPVYHlzG8+6h9B44j8vULEZunZYsPjGy7SNH8M+XI1GuZWBNG+KDGYXqaaZKBBWL0rx9GZbbDBsjuok= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=VcnQ7ngM; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="VcnQ7ngM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594063; x=1800130063; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6Tjj+ZTqhOQ3NVpdkwEPxGTifoxhf2PbMwWee8sOAGc=; b=VcnQ7ngMNaDK8SWgNXA1n5d05GmKgAJTUQMrswgXt0G4WkVtcG314QcP 9MjCQC7JHizWuDjqIcyehRDdnNCWyZdHmjTJVvu9/an3LA35+4ZgcGHVo OxOcbJOcZpagAj7Ab6SSf2tJRbpsxdgsOJmOa6+pbdTQsQxtxHMtygb/1 NxLte28Xi9ByF5z/yftN5VoH5hQbRelSMrpqvKZIHY0ck23A17/KDsjBx B4G9WSxjZdAvJWQRQwoLse4GL1Ydj5I0Gwz7PPEulWK87CnI6q1J4qHT+ imqI7QqsMAvfxomvJsKbLD7Adks3gI7jCaJd/vZqGFqFOIcgBPw/T9coN A==; X-CSE-ConnectionGUID: MqTcJu0RSESfeq27zLZvsQ== X-CSE-MsgGUID: LHGoYih3RnqFBhRPfBHMlQ== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="52013863" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Jan 2026 13:07:39 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Fri, 16 Jan 2026 13:07:06 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:06 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 20/31] clk: at91: clk-slow: add support for parent_data Date: Fri, 16 Jan 2026 13:07:13 -0700 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Add support for parent_data in slow clock drivers. With this parent-child relation is described with pointers rather than strings making registration a bit faster. All the SoC based drivers that rely on clk-slow were adapted to the new API change. The switch itself for SoCs will be done in subsequent patches. Signed-off-by: Claudiu Beznea Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/at91sam9260.c | 2 +- drivers/clk/at91/clk-slow.c | 8 ++++++-- drivers/clk/at91/dt-compat.c | 2 +- drivers/clk/at91/pmc.h | 1 + 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/clk/at91/at91sam9260.c b/drivers/clk/at91/at91sam9260.c index f39deb3ec00a..55350331b07e 100644 --- a/drivers/clk/at91/at91sam9260.c +++ b/drivers/clk/at91/at91sam9260.c @@ -385,7 +385,7 @@ static void __init at91sam926x_pmc_setup(struct device_= node *np, parent_names[0] =3D "slow_rc_osc"; parent_names[1] =3D "slow_xtal"; hw =3D at91_clk_register_sam9260_slow(regmap, "slck", - parent_names, 2); + parent_names, NULL, 2); if (IS_ERR(hw)) goto err_free; =20 diff --git a/drivers/clk/at91/clk-slow.c b/drivers/clk/at91/clk-slow.c index ac9f7a48b76e..5b7fc6210e09 100644 --- a/drivers/clk/at91/clk-slow.c +++ b/drivers/clk/at91/clk-slow.c @@ -39,11 +39,12 @@ struct clk_hw * __init at91_clk_register_sam9260_slow(struct regmap *regmap, const char *name, const char **parent_names, + struct clk_parent_data *parent_data, int num_parents) { struct clk_sam9260_slow *slowck; struct clk_hw *hw; - struct clk_init_data init; + struct clk_init_data init =3D {}; int ret; =20 if (!name) @@ -58,7 +59,10 @@ at91_clk_register_sam9260_slow(struct regmap *regmap, =20 init.name =3D name; init.ops =3D &sam9260_slow_ops; - init.parent_names =3D parent_names; + if (parent_data) + init.parent_data =3D (const struct clk_parent_data *)&parent_data; + else + init.parent_names =3D parent_names; init.num_parents =3D num_parents; init.flags =3D 0; =20 diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c index 5afd7c9f53fd..fa8658d3be7b 100644 --- a/drivers/clk/at91/dt-compat.c +++ b/drivers/clk/at91/dt-compat.c @@ -823,7 +823,7 @@ static void __init of_at91sam9260_clk_slow_setup(struct= device_node *np) =20 of_property_read_string(np, "clock-output-names", &name); =20 - hw =3D at91_clk_register_sam9260_slow(regmap, name, parent_names, + hw =3D at91_clk_register_sam9260_slow(regmap, name, parent_names, NULL, num_parents); if (IS_ERR(hw)) return; diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index 08c3138fef8f..efc8e8f0889e 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -276,6 +276,7 @@ struct clk_hw * __init at91_clk_register_sam9260_slow(struct regmap *regmap, const char *name, const char **parent_names, + struct clk_parent_data *parent_data, int num_parents); =20 struct clk_hw * __init --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95DBB3A35CC; Fri, 16 Jan 2026 20:07:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594054; cv=none; b=Fo/4PN/FKh4CX1A0SnxoKDglsomy2KL+VHHzCcbFPx9q2uGDsvgUwIoeXQq17E9vQbXid69Rqt0dlkNtwGZdfXBSTEVAW+9/oV+QDGfWkgIWGJGq21a5crrBrjH/URy9sag81Mtq6wyBfyovNR2GP9SJq7Q6jUl7xs2MS9+/qOA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594054; c=relaxed/simple; bh=l9bNuAZzkq8mBVyacoUSJx8C49OSIJiPibpV3FonOUY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lLTQY3mIxn3R9wGnr6O46SdXW5zrFEVMa6a1gIyJcDtNwkD19iA7X4tMGQUIYrwE4FY2erTDjFrS+sqxfu07tdZZ8fVy1X2ZgYItvoGxBbWs/b+jCtHuqirDYYMqu2GAOkVKYfRQxnEJwveso0NHon7ANPOjcyGUVEc0NN4pbJ4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=qt9GUHH5; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="qt9GUHH5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594052; x=1800130052; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=l9bNuAZzkq8mBVyacoUSJx8C49OSIJiPibpV3FonOUY=; b=qt9GUHH53lDBorA/eDoHturSR7086xJCeARxlueJMLKTkGMfy0Rww6by DElZnhfCHQInXHCYkBNKKIL/ddezepCIlPpOqor9AD3xqTQE66SY+2UZu 3DCjVCFNIImtia9oXxw7RZedIPkkWDeMGnODtHkhwAFw10+h+GOXF3aVT HCYuoGKmhvMyLTX8JOi6r6XVTwXwDCBYTDSxZGvnhZQNc50H5mLDUG5IJ +6i5JADK2NvcPafbj/+Fh+BzAM9EX5PmubGBvsVpZRKnaEXV43hwhL1/1 8jtmLcIJSqIRGPaaDlM2S3iNBG1RfZOs55g0AztzFKer4QQxGa/3D5kD1 g==; X-CSE-ConnectionGUID: +9RSiAtvRY+RhxWEUm06Wg== X-CSE-MsgGUID: ha5V64RQRl6AICPBfKgavQ== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="283397055" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2026 13:07:17 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex1.mchp-main.com (10.10.87.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.29; Fri, 16 Jan 2026 13:07:06 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:06 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 21/31] clk: at91: dt-compat: switch to parent_hw and parent_data Date: Fri, 16 Jan 2026 13:07:14 -0700 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Switch old dt-compat clocks to use parent_hw and parent_data. Having parent_hw instead of parent names improves to clock registration speed and re-parenting. Signed-off-by: Claudiu Beznea Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/dt-compat.c | 80 +++++++++++++++++++++++++----------- 1 file changed, 56 insertions(+), 24 deletions(-) diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c index fa8658d3be7b..9ca871b817e0 100644 --- a/drivers/clk/at91/dt-compat.c +++ b/drivers/clk/at91/dt-compat.c @@ -43,7 +43,8 @@ static void __init of_sama5d2_clk_audio_pll_frac_setup(st= ruct device_node *np) =20 parent_name =3D of_clk_get_parent_name(np, 0); =20 - hw =3D at91_clk_register_audio_pll_frac(regmap, name, parent_name, NULL); + hw =3D at91_clk_register_audio_pll_frac(regmap, name, NULL, + &AT91_CLK_PD_NAME(parent_name)); if (IS_ERR(hw)) return; =20 @@ -69,7 +70,8 @@ static void __init of_sama5d2_clk_audio_pll_pad_setup(str= uct device_node *np) =20 parent_name =3D of_clk_get_parent_name(np, 0); =20 - hw =3D at91_clk_register_audio_pll_pad(regmap, name, parent_name, NULL); + hw =3D at91_clk_register_audio_pll_pad(regmap, name, NULL, + &AT91_CLK_PD_NAME(parent_name)); if (IS_ERR(hw)) return; =20 @@ -95,7 +97,7 @@ static void __init of_sama5d2_clk_audio_pll_pmc_setup(str= uct device_node *np) =20 parent_name =3D of_clk_get_parent_name(np, 0); =20 - hw =3D at91_clk_register_audio_pll_pmc(regmap, name, parent_name, NULL); + hw =3D at91_clk_register_audio_pll_pmc(regmap, name, NULL, &AT91_CLK_PD_N= AME(parent_name)); if (IS_ERR(hw)) return; =20 @@ -129,6 +131,7 @@ static void __init of_sama5d2_clk_generated_setup(struc= t device_node *np) struct clk_hw *hw; unsigned int num_parents; const char *parent_names[GENERATED_SOURCE_MAX]; + struct clk_parent_data parent_data[GENERATED_SOURCE_MAX]; struct device_node *gcknp, *parent_np; struct clk_range range =3D CLK_RANGE(0, 0); struct regmap *regmap; @@ -149,6 +152,8 @@ static void __init of_sama5d2_clk_generated_setup(struc= t device_node *np) if (IS_ERR(regmap)) return; =20 + for (unsigned int i =3D 0; i < num_parents; i++) + parent_data[i] =3D AT91_CLK_PD_NAME(parent_names[i]); for_each_child_of_node(np, gcknp) { int chg_pid =3D INT_MIN; =20 @@ -171,7 +176,7 @@ static void __init of_sama5d2_clk_generated_setup(struc= t device_node *np) =20 hw =3D at91_clk_register_generated(regmap, &pmc_pcr_lock, &dt_pcr_layout, name, - parent_names, NULL, NULL, + NULL, parent_data, NULL, num_parents, id, &range, chg_pid); if (IS_ERR(hw)) @@ -201,7 +206,7 @@ static void __init of_sama5d4_clk_h32mx_setup(struct de= vice_node *np) =20 parent_name =3D of_clk_get_parent_name(np, 0); =20 - hw =3D at91_clk_register_h32mx(regmap, name, parent_name, NULL); + hw =3D at91_clk_register_h32mx(regmap, name, NULL, &AT91_CLK_PD_NAME(pare= nt_name)); if (IS_ERR(hw)) return; =20 @@ -228,6 +233,8 @@ static void __init of_sama5d2_clk_i2s_mux_setup(struct = device_node *np) return; =20 for_each_child_of_node(np, i2s_mux_np) { + struct clk_parent_data parent_data[2]; + if (of_property_read_u8(i2s_mux_np, "reg", &bus_id)) continue; =20 @@ -238,8 +245,10 @@ static void __init of_sama5d2_clk_i2s_mux_setup(struct= device_node *np) if (ret !=3D 2) continue; =20 + parent_data[0] =3D AT91_CLK_PD_NAME(parent_names[0]); + parent_data[1] =3D AT91_CLK_PD_NAME(parent_names[1]); hw =3D at91_clk_i2s_mux_register(regmap_sfr, i2s_mux_np->name, - parent_names, NULL, 2, bus_id); + NULL, parent_data, 2, bus_id); if (IS_ERR(hw)) continue; =20 @@ -269,7 +278,8 @@ static void __init of_at91rm9200_clk_main_osc_setup(str= uct device_node *np) if (IS_ERR(regmap)) return; =20 - hw =3D at91_clk_register_main_osc(regmap, name, parent_name, NULL, bypass= ); + hw =3D at91_clk_register_main_osc(regmap, name, NULL, + &AT91_CLK_PD_NAME(parent_name), bypass); if (IS_ERR(hw)) return; =20 @@ -323,7 +333,7 @@ static void __init of_at91rm9200_clk_main_setup(struct = device_node *np) if (IS_ERR(regmap)) return; =20 - hw =3D at91_clk_register_rm9200_main(regmap, name, parent_name, NULL); + hw =3D at91_clk_register_rm9200_main(regmap, name, NULL, &AT91_CLK_PD_NAM= E(parent_name)); if (IS_ERR(hw)) return; =20 @@ -336,6 +346,7 @@ static void __init of_at91sam9x5_clk_main_setup(struct = device_node *np) { struct clk_hw *hw; const char *parent_names[2]; + struct clk_parent_data parent_data[2]; unsigned int num_parents; const char *name =3D np->name; struct regmap *regmap; @@ -354,7 +365,9 @@ static void __init of_at91sam9x5_clk_main_setup(struct = device_node *np) =20 of_property_read_string(np, "clock-output-names", &name); =20 - hw =3D at91_clk_register_sam9x5_main(regmap, name, parent_names, NULL, + parent_data[0] =3D AT91_CLK_PD_NAME(parent_names[0]); + parent_data[1] =3D AT91_CLK_PD_NAME(parent_names[1]); + hw =3D at91_clk_register_sam9x5_main(regmap, name, NULL, parent_data, num_parents); if (IS_ERR(hw)) return; @@ -396,6 +409,7 @@ of_at91_clk_master_setup(struct device_node *np, struct clk_hw *hw; unsigned int num_parents; const char *parent_names[MASTER_SOURCE_MAX]; + struct clk_parent_data parent_data[MASTER_SOURCE_MAX]; const char *name =3D np->name; struct clk_master_characteristics *characteristics; struct regmap *regmap; @@ -419,13 +433,15 @@ of_at91_clk_master_setup(struct device_node *np, if (IS_ERR(regmap)) return; =20 + for (unsigned int i =3D 0; i < MASTER_SOURCE_MAX; i++) + parent_data[i] =3D AT91_CLK_PD_NAME(parent_names[i]); hw =3D at91_clk_register_master_pres(regmap, "masterck_pres", num_parents, - parent_names, NULL, layout, + NULL, parent_data, layout, characteristics, &mck_lock); if (IS_ERR(hw)) goto out_free_characteristics; =20 - hw =3D at91_clk_register_master_div(regmap, name, "masterck_pres", NULL, + hw =3D at91_clk_register_master_div(regmap, name, NULL, &AT91_CLK_PD_HW(h= w), layout, characteristics, &mck_lock, CLK_SET_RATE_GATE, 0); if (IS_ERR(hw)) @@ -489,8 +505,8 @@ of_at91_clk_periph_setup(struct device_node *np, u8 typ= e) name =3D periphclknp->name; =20 if (type =3D=3D PERIPHERAL_AT91RM9200) { - hw =3D at91_clk_register_peripheral(regmap, name, - parent_name, NULL, id); + hw =3D at91_clk_register_peripheral(regmap, name, NULL, + &AT91_CLK_PD_NAME(parent_name), id); } else { struct clk_range range =3D CLK_RANGE(0, 0); unsigned long flags =3D 0; @@ -511,8 +527,8 @@ of_at91_clk_periph_setup(struct device_node *np, u8 typ= e) &pmc_pcr_lock, &dt_pcr_layout, name, - parent_name, NULL, + &AT91_CLK_PD_NAME(parent_name), id, &range, INT_MIN, flags); @@ -665,7 +681,8 @@ of_at91_clk_pll_setup(struct device_node *np, if (!characteristics) return; =20 - hw =3D at91_clk_register_pll(regmap, name, parent_name, NULL, id, layout, + hw =3D at91_clk_register_pll(regmap, name, NULL, &AT91_CLK_PD_NAME(parent= _name), + id, layout, characteristics); if (IS_ERR(hw)) goto out_free_characteristics; @@ -724,7 +741,7 @@ of_at91sam9x5_clk_plldiv_setup(struct device_node *np) if (IS_ERR(regmap)) return; =20 - hw =3D at91_clk_register_plldiv(regmap, name, parent_name, NULL); + hw =3D at91_clk_register_plldiv(regmap, name, NULL, &AT91_CLK_PD_NAME(par= ent_name)); if (IS_ERR(hw)) return; =20 @@ -743,6 +760,7 @@ of_at91_clk_prog_setup(struct device_node *np, struct clk_hw *hw; unsigned int num_parents; const char *parent_names[PROG_SOURCE_MAX]; + struct clk_parent_data parent_data[PROG_SOURCE_MAX]; const char *name; struct device_node *progclknp, *parent_np; struct regmap *regmap; @@ -763,6 +781,8 @@ of_at91_clk_prog_setup(struct device_node *np, if (IS_ERR(regmap)) return; =20 + for (unsigned int i =3D 0; i < PROG_SOURCE_MAX; i++) + parent_data[i] =3D AT91_CLK_PD_NAME(parent_names[i]); for_each_child_of_node(np, progclknp) { if (of_property_read_u32(progclknp, "reg", &id)) continue; @@ -771,7 +791,7 @@ of_at91_clk_prog_setup(struct device_node *np, name =3D progclknp->name; =20 hw =3D at91_clk_register_programmable(regmap, name, - parent_names, NULL, num_parents, + NULL, parent_data, num_parents, id, layout, mux_table); if (IS_ERR(hw)) continue; @@ -805,6 +825,7 @@ static void __init of_at91sam9260_clk_slow_setup(struct= device_node *np) { struct clk_hw *hw; const char *parent_names[2]; + struct clk_parent_data parent_data[2]; unsigned int num_parents; const char *name =3D np->name; struct regmap *regmap; @@ -823,7 +844,9 @@ static void __init of_at91sam9260_clk_slow_setup(struct= device_node *np) =20 of_property_read_string(np, "clock-output-names", &name); =20 - hw =3D at91_clk_register_sam9260_slow(regmap, name, parent_names, NULL, + parent_data[0] =3D AT91_CLK_PD_NAME(parent_names[0]); + parent_data[1] =3D AT91_CLK_PD_NAME(parent_names[1]); + hw =3D at91_clk_register_sam9260_slow(regmap, name, NULL, parent_data, num_parents); if (IS_ERR(hw)) return; @@ -841,6 +864,7 @@ static void __init of_at91sam9x5_clk_smd_setup(struct d= evice_node *np) struct clk_hw *hw; unsigned int num_parents; const char *parent_names[SMD_SOURCE_MAX]; + struct clk_parent_data parent_data[SMD_SOURCE_MAX]; const char *name =3D np->name; struct regmap *regmap; struct device_node *parent_np; @@ -859,7 +883,9 @@ static void __init of_at91sam9x5_clk_smd_setup(struct d= evice_node *np) if (IS_ERR(regmap)) return; =20 - hw =3D at91sam9x5_clk_register_smd(regmap, name, parent_names, NULL, + for (unsigned int i =3D 0; i < SMD_SOURCE_MAX; i++) + parent_data[i] =3D AT91_CLK_PD_NAME(parent_names[i]); + hw =3D at91sam9x5_clk_register_smd(regmap, name, NULL, parent_data, num_parents); if (IS_ERR(hw)) return; @@ -909,7 +935,8 @@ static void __init of_at91rm9200_clk_sys_setup(struct d= evice_node *np) if (!strcmp(sysclknp->name, "ddrck")) flags =3D CLK_IS_CRITICAL; =20 - hw =3D at91_clk_register_system(regmap, name, parent_name, NULL, + hw =3D at91_clk_register_system(regmap, name, NULL, + &AT91_CLK_PD_NAME(parent_name), id, flags); if (IS_ERR(hw)) continue; @@ -928,6 +955,7 @@ static void __init of_at91sam9x5_clk_usb_setup(struct d= evice_node *np) struct clk_hw *hw; unsigned int num_parents; const char *parent_names[USB_SOURCE_MAX]; + struct clk_parent_data parent_data[USB_SOURCE_MAX]; const char *name =3D np->name; struct regmap *regmap; struct device_node *parent_np; @@ -946,7 +974,9 @@ static void __init of_at91sam9x5_clk_usb_setup(struct d= evice_node *np) if (IS_ERR(regmap)) return; =20 - hw =3D at91sam9x5_clk_register_usb(regmap, name, parent_names, NULL, + for (unsigned int i =3D 0; i < USB_SOURCE_MAX; i++) + parent_data[i] =3D AT91_CLK_PD_NAME(parent_names[i]); + hw =3D at91sam9x5_clk_register_usb(regmap, name, NULL, parent_data, num_parents); if (IS_ERR(hw)) return; @@ -976,7 +1006,7 @@ static void __init of_at91sam9n12_clk_usb_setup(struct= device_node *np) if (IS_ERR(regmap)) return; =20 - hw =3D at91sam9n12_clk_register_usb(regmap, name, parent_name, NULL); + hw =3D at91sam9n12_clk_register_usb(regmap, name, NULL, &AT91_CLK_PD_NAME= (parent_name)); if (IS_ERR(hw)) return; =20 @@ -1009,7 +1039,8 @@ static void __init of_at91rm9200_clk_usb_setup(struct= device_node *np) of_node_put(parent_np); if (IS_ERR(regmap)) return; - hw =3D at91rm9200_clk_register_usb(regmap, name, parent_name, NULL, divis= ors); + hw =3D at91rm9200_clk_register_usb(regmap, name, NULL, &AT91_CLK_PD_NAME(= parent_name), + divisors); if (IS_ERR(hw)) return; =20 @@ -1056,7 +1087,8 @@ static void __init of_at91sam9x5_clk_utmi_setup(struc= t device_node *np) regmap_sfr =3D NULL; } =20 - hw =3D at91_clk_register_utmi(regmap_pmc, regmap_sfr, name, parent_name, = NULL); + hw =3D at91_clk_register_utmi(regmap_pmc, regmap_sfr, name, NULL, + &AT91_CLK_PD_NAME(parent_name)); if (IS_ERR(hw)) return; =20 --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5AFA73A1D1F; Fri, 16 Jan 2026 20:07:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594056; cv=none; b=pHf2E96lOHYgjA4Y+fBie+hfRc/Wx+xWElGYTCx/Zz+/TzUj2g1gOY4qqU/fOB52q5nTflCBODGXtB9x20WGCV5SeU62KN9FeHVz1a2LEMtZjSdYXC5FF3tpLDO7nCsFU0CFv1iaMM2IPlTCWJUYcpzv1JFNriZugEP6s7m9Vi8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594056; c=relaxed/simple; bh=iAP3KtoYiGiAIDJG+rRnha3nTkdIhSYADFJkd7bf+bU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=V+ipIBACBjojmtNLjweQdq5tOzfYwE7I+P9bOBAiRP7jjj9OYxBFU3UXWwxlyzY4pTO1oFJEeBlA9TwTuIQcLETcX8P/cYX7L6UvnrJ2u5QWrTT2GnOO0Wr25sf5lWzp+NRfMdFdwho9a+U6Y0eUY1daDgTVPvt6AaoIoPgLtQI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=xUIVt8UL; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="xUIVt8UL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594053; x=1800130053; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iAP3KtoYiGiAIDJG+rRnha3nTkdIhSYADFJkd7bf+bU=; b=xUIVt8ULbuqRk0g4JcG+OweLEUCsQHFUqlnZVWIrQUFm+rFboTsnoWIb Yrl0VIJvkBC1f369cf9Tw3UwRSWqAFLefmqWcLo5vnEWibG4684I1uw4H Fc8wAbjrZAmU+beAT6x8RBu3gz+TAkw4Y5dlA6hOYbaIT+LBQVzhmM5jl kHbqaBqWM+kaJtgJtIjIJIh5f3e3+LE9n7Kl4zLYD0s3mNsDG24CX21LU sZaS0jNYRzdDjisYosqiWEfwrVfyCLDxSTGPhWTZIXXh8h3gdg8bEJbZw jhMVsLu1oKaFAyvaM3S3Tg5IzhzbvLn6q3QcfLX3OeHjm2qXzAO16pf7g A==; X-CSE-ConnectionGUID: +9RSiAtvRY+RhxWEUm06Wg== X-CSE-MsgGUID: DW32LluFRU2OZ3svbRO+zQ== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="283397056" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2026 13:07:18 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex1.mchp-main.com (10.10.87.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.29; Fri, 16 Jan 2026 13:07:06 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:06 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 22/31] clk: at91: sam9x60: switch to parent_hw and parent_data Date: Fri, 16 Jan 2026 13:07:15 -0700 Message-ID: <562cb1e4a6890dd846720ecf68e0505ec32a450b.1768512290.git.ryan.wanner@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Switch SAM9X60 clocks to use modern parent_hw and parent_data. Signed-off-by: Claudiu Beznea Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/sam9x60.c | 93 +++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 42 deletions(-) diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c index 2ab7deab95f3..97131de5ba20 100644 --- a/drivers/clk/at91/sam9x60.c +++ b/drivers/clk/at91/sam9x60.c @@ -81,9 +81,9 @@ static const struct clk_pcr_layout sam9x60_pcr_layout =3D= { .pid_mask =3D GENMASK(6, 0), }; =20 -static const struct { +static struct { char *n; - char *p; + struct clk_hw *parent_hw; unsigned long flags; u8 id; } sam9x60_systemck[] =3D { @@ -91,11 +91,11 @@ static const struct { * ddrck feeds DDR controller and is enabled by bootloader thus we need * to keep it enabled in case there is no Linux consumer for it. */ - { .n =3D "ddrck", .p =3D "masterck_div", .id =3D 2, .flags =3D CLK_IS_CR= ITICAL }, - { .n =3D "uhpck", .p =3D "usbck", .id =3D 6 }, - { .n =3D "pck0", .p =3D "prog0", .id =3D 8 }, - { .n =3D "pck1", .p =3D "prog1", .id =3D 9 }, - { .n =3D "qspick", .p =3D "masterck_div", .id =3D 19 }, + { .n =3D "ddrck", .id =3D 2, .flags =3D CLK_IS_CRITICAL }, + { .n =3D "uhpck", .id =3D 6 }, + { .n =3D "pck0", .id =3D 8 }, + { .n =3D "pck1", .id =3D 9 }, + { .n =3D "qspick", .id =3D 19 }, }; =20 static const struct { @@ -186,13 +186,13 @@ static const struct { =20 static void __init sam9x60_pmc_setup(struct device_node *np) { + const char *main_xtal_name, *td_slck_name, *md_slck_name; + struct clk_hw *hw, *main_rc_hw, *main_osc_hw; struct clk_range range =3D CLK_RANGE(0, 0); - const char *td_slck_name, *md_slck_name, *mainxtal_name; + struct clk_parent_data parent_data[6]; struct pmc_data *sam9x60_pmc; - const char *parent_names[6]; - struct clk_hw *main_osc_hw; + struct clk_hw *usbck_hw; struct regmap *regmap; - struct clk_hw *hw; int i; =20 i =3D of_property_match_string(np, "clock-names", "td_slck"); @@ -210,7 +210,8 @@ static void __init sam9x60_pmc_setup(struct device_node= *np) i =3D of_property_match_string(np, "clock-names", "main_xtal"); if (i < 0) return; - mainxtal_name =3D of_clk_get_parent_name(np, i); + + main_xtal_name =3D of_clk_get_parent_name(np, i); =20 regmap =3D device_node_to_regmap(np); if (IS_ERR(regmap)) @@ -223,19 +224,20 @@ static void __init sam9x60_pmc_setup(struct device_no= de *np) if (!sam9x60_pmc) return; =20 - hw =3D at91_clk_register_main_rc_osc(regmap, "main_rc_osc", 12000000, - 50000000); - if (IS_ERR(hw)) + main_rc_hw =3D at91_clk_register_main_rc_osc(regmap, "main_rc_osc", 12000= 000, + 50000000); + if (IS_ERR(main_rc_hw)) goto err_free; =20 - hw =3D at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL= , 0); + main_osc_hw =3D at91_clk_register_main_osc(regmap, "main_osc", NULL, + &AT91_CLK_PD_NAME(main_xtal_name), + 0); if (IS_ERR(hw)) goto err_free; - main_osc_hw =3D hw; =20 - parent_names[0] =3D "main_rc_osc"; - parent_names[1] =3D "main_osc"; - hw =3D at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, NULL= , 2); + parent_data[0] =3D AT91_CLK_PD_HW(main_rc_hw); + parent_data[1] =3D AT91_CLK_PD_HW(main_osc_hw); + hw =3D at91_clk_register_sam9x5_main(regmap, "mainck", NULL, parent_data,= 2); if (IS_ERR(hw)) goto err_free; =20 @@ -256,7 +258,7 @@ static void __init sam9x60_pmc_setup(struct device_node= *np) goto err_free; =20 hw =3D sam9x60_clk_register_div_pll(regmap, &pmc_pll_lock, "pllack_divck", - "pllack_fracck", NULL, 0, &plla_characteristics, + NULL, hw, 0, &plla_characteristics, &pll_div_layout, /* * This feeds CPU. It should not @@ -277,7 +279,7 @@ static void __init sam9x60_pmc_setup(struct device_node= *np) goto err_free; =20 hw =3D sam9x60_clk_register_div_pll(regmap, &pmc_pll_lock, "upllck_divck", - "upllck_fracck", NULL, 1, &upll_characteristics, + NULL, hw, 1, &upll_characteristics, &pll_div_layout, CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE | @@ -287,17 +289,17 @@ static void __init sam9x60_pmc_setup(struct device_no= de *np) =20 sam9x60_pmc->chws[PMC_UTMI] =3D hw; =20 - parent_names[0] =3D md_slck_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "pllack_divck"; + parent_data[0] =3D AT91_CLK_PD_NAME(md_slck_name); + parent_data[1] =3D AT91_CLK_PD_HW(sam9x60_pmc->chws[PMC_MAIN]); + parent_data[2] =3D AT91_CLK_PD_HW(sam9x60_pmc->chws[PMC_PLLACK]); hw =3D at91_clk_register_master_pres(regmap, "masterck_pres", 3, - parent_names, NULL, &sam9x60_master_layout, + NULL, parent_data, &sam9x60_master_layout, &mck_characteristics, &mck_lock); if (IS_ERR(hw)) goto err_free; =20 hw =3D at91_clk_register_master_div(regmap, "masterck_div", - "masterck_pres", NULL, &sam9x60_master_layout, + NULL, &AT91_CLK_PD_HW(hw), &sam9x60_master_layout, &mck_characteristics, &mck_lock, CLK_SET_RATE_GATE, 0); if (IS_ERR(hw)) @@ -305,26 +307,26 @@ static void __init sam9x60_pmc_setup(struct device_no= de *np) =20 sam9x60_pmc->chws[PMC_MCK] =3D hw; =20 - parent_names[0] =3D "pllack_divck"; - parent_names[1] =3D "upllck_divck"; - parent_names[2] =3D "main_osc"; - hw =3D sam9x60_clk_register_usb(regmap, "usbck", parent_names, NULL, 3); - if (IS_ERR(hw)) + parent_data[0] =3D AT91_CLK_PD_HW(sam9x60_pmc->chws[PMC_PLLACK]); + parent_data[1] =3D AT91_CLK_PD_HW(sam9x60_pmc->chws[PMC_UTMI]); + parent_data[2] =3D AT91_CLK_PD_HW(main_osc_hw); + usbck_hw =3D sam9x60_clk_register_usb(regmap, "usbck", NULL, parent_data,= 3); + if (IS_ERR(usbck_hw)) goto err_free; =20 - parent_names[0] =3D md_slck_name; - parent_names[1] =3D td_slck_name; - parent_names[2] =3D "mainck"; - parent_names[3] =3D "masterck_div"; - parent_names[4] =3D "pllack_divck"; - parent_names[5] =3D "upllck_divck"; + parent_data[0] =3D AT91_CLK_PD_NAME(md_slck_name); + parent_data[1] =3D AT91_CLK_PD_NAME(td_slck_name); + parent_data[2] =3D AT91_CLK_PD_HW(sam9x60_pmc->chws[PMC_MAIN]); + parent_data[3] =3D AT91_CLK_PD_HW(sam9x60_pmc->chws[PMC_MCK]); + parent_data[4] =3D AT91_CLK_PD_HW(sam9x60_pmc->chws[PMC_PLLACK]); + parent_data[5] =3D AT91_CLK_PD_HW(sam9x60_pmc->chws[PMC_UTMI]); for (i =3D 0; i < 2; i++) { char name[6]; =20 snprintf(name, sizeof(name), "prog%d", i); =20 hw =3D at91_clk_register_programmable(regmap, name, - parent_names, NULL, 6, i, + NULL, parent_data, 6, i, &sam9x60_programmable_layout, NULL); if (IS_ERR(hw)) @@ -333,9 +335,15 @@ static void __init sam9x60_pmc_setup(struct device_nod= e *np) sam9x60_pmc->pchws[i] =3D hw; } =20 + /* Set systemck parent hws. */ + sam9x60_systemck[0].parent_hw =3D sam9x60_pmc->chws[PMC_MCK]; + sam9x60_systemck[1].parent_hw =3D usbck_hw; + sam9x60_systemck[2].parent_hw =3D sam9x60_pmc->pchws[0]; + sam9x60_systemck[3].parent_hw =3D sam9x60_pmc->pchws[1]; + sam9x60_systemck[4].parent_hw =3D sam9x60_pmc->chws[PMC_MCK]; for (i =3D 0; i < ARRAY_SIZE(sam9x60_systemck); i++) { hw =3D at91_clk_register_system(regmap, sam9x60_systemck[i].n, - sam9x60_systemck[i].p, NULL, + NULL, &AT91_CLK_PD_HW(sam9x60_systemck[i].parent_hw), sam9x60_systemck[i].id, sam9x60_systemck[i].flags); if (IS_ERR(hw)) @@ -348,7 +356,8 @@ static void __init sam9x60_pmc_setup(struct device_node= *np) hw =3D at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock, &sam9x60_pcr_layout, sam9x60_periphck[i].n, - "masterck_div", NULL, + NULL, + &AT91_CLK_PD_HW(sam9x60_pmc->chws[PMC_MCK]), sam9x60_periphck[i].id, &range, INT_MIN, sam9x60_periphck[i].flags); @@ -362,7 +371,7 @@ static void __init sam9x60_pmc_setup(struct device_node= *np) hw =3D at91_clk_register_generated(regmap, &pmc_pcr_lock, &sam9x60_pcr_layout, sam9x60_gck[i].n, - parent_names, NULL, NULL, 6, + NULL, parent_data, NULL, 6, sam9x60_gck[i].id, &sam9x60_gck[i].r, INT_MIN); if (IS_ERR(hw)) --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D0EF3A4AAD; Fri, 16 Jan 2026 20:07:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594065; cv=none; b=hTaJEOH2VIf7Xh+xH98qZPsBOtYTT3AGrCo4/aWU0/dtjDg9klx7i/p6Kx9q9UNIGbz6ys5IkO0QXPWxyDdVYmVxJneznM0TwyvtyQ9tup5ZHXqDyyilLEXezgJhAkgj0cAvro/Uk3sQS14EMamLc4KmAhWSJiKdJ5YfQd4lTrw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594065; c=relaxed/simple; bh=ooDYCmBCZih6oejY6gt4+eT3U3V3rEDD88ZRToGBFxQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WVq/+Tyr9RzcFFBEEmE9IxGGMBt+iZ/qk0x053B+bjaItQS8z6uC44aDsnaaxDLANyP8nBf9ECKtpvZXRmHscc2x4lsf/NRP9utl2x685V0MIvJugBQvWCXy6MhEFAMQJp8eIV+6/9AMzdCq7MbbikPWpNnkR5xVzstV0Dwu8T4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=VMBcR+nn; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="VMBcR+nn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594063; x=1800130063; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ooDYCmBCZih6oejY6gt4+eT3U3V3rEDD88ZRToGBFxQ=; b=VMBcR+nnCg+S2oYPBumlzyWNUO+p4mq+w1nz1tAHcLlpRQ+xzlUibpKR oPMc+Bevj+QhtiTzWRMR18xcRrIfb8eUi3DUEAAv/viIpLqgEwdUWB6Go Qlo7IuQhTHhjFKBjexoME3ZCGaqLlKRdJao4VR9MfCVqmVUIV1ihHHO8Q mUvOPHetqrxj0lLl3Mg5aiqt4XzQdura2CpwsSovtX3rB6eyBIvVHkoNO PhX+BcKbxNepHzTftvtab1xRqqoiouxILYjTszaRWQGDckelEbY/l8SB6 uaOees6j9oF219qA38rfjHZNusHe4LaxkJw0FXOW4JXEmFFTtR9TzP9V5 Q==; X-CSE-ConnectionGUID: MqTcJu0RSESfeq27zLZvsQ== X-CSE-MsgGUID: nanzQAmhQhWZl+2FzKF+Sg== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="52013864" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Jan 2026 13:07:40 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Fri, 16 Jan 2026 13:07:07 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:07 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 23/31] clk: at91: sama5d2: switch to parent_hw and parent_data Date: Fri, 16 Jan 2026 13:07:16 -0700 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Switch SAMA5D2 clocks to use parent_data and parent_hw whenever possible. Having parent_data instead of parent names improves to clock registration speed and re-parenting. Update the clock registration functions to use parent_data and to use clk_hw Macros. Signed-off-by: Claudiu Beznea [ryan.wanner@microchip.com: Adjust commit message.] Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/sama5d2.c | 153 ++++++++++++++++++++----------------- 1 file changed, 83 insertions(+), 70 deletions(-) diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c index f5d6c7a96cf2..cfff4aabdb3a 100644 --- a/drivers/clk/at91/sama5d2.c +++ b/drivers/clk/at91/sama5d2.c @@ -37,9 +37,9 @@ static const struct clk_pcr_layout sama5d2_pcr_layout =3D= { .pid_mask =3D GENMASK(6, 0), }; =20 -static const struct { +static struct { char *n; - char *p; + struct clk_hw *parent_hw; unsigned long flags; u8 id; } sama5d2_systemck[] =3D { @@ -47,14 +47,14 @@ static const struct { * ddrck feeds DDR controller and is enabled by bootloader thus we need * to keep it enabled in case there is no Linux consumer for it. */ - { .n =3D "ddrck", .p =3D "masterck_div", .id =3D 2, .flags =3D CLK_IS_CRI= TICAL }, - { .n =3D "lcdck", .p =3D "masterck_div", .id =3D 3 }, - { .n =3D "uhpck", .p =3D "usbck", .id =3D 6 }, - { .n =3D "udpck", .p =3D "usbck", .id =3D 7 }, - { .n =3D "pck0", .p =3D "prog0", .id =3D 8 }, - { .n =3D "pck1", .p =3D "prog1", .id =3D 9 }, - { .n =3D "pck2", .p =3D "prog2", .id =3D 10 }, - { .n =3D "iscck", .p =3D "masterck_div", .id =3D 18 }, + { .n =3D "ddrck", .id =3D 2, .flags =3D CLK_IS_CRITICAL }, + { .n =3D "lcdck", .id =3D 3 }, + { .n =3D "uhpck", .id =3D 6 }, + { .n =3D "udpck", .id =3D 7 }, + { .n =3D "pck0", .id =3D 8 }, + { .n =3D "pck1", .id =3D 9 }, + { .n =3D "pck2", .id =3D 10 }, + { .n =3D "iscck", .id =3D 18 }, }; =20 static const struct { @@ -164,12 +164,12 @@ static const struct clk_programmable_layout sama5d2_p= rogrammable_layout =3D { =20 static void __init sama5d2_pmc_setup(struct device_node *np) { - struct clk_range range =3D CLK_RANGE(0, 0); + struct clk_hw *hw, *audio_fracck_hw, *usbck_hw, *main_rc_hw, *main_osc_hw; const char *slck_name, *mainxtal_name; - struct pmc_data *sama5d2_pmc; - const char *parent_names[6]; + struct clk_range range =3D CLK_RANGE(0, 0); + struct clk_parent_data parent_data[6]; struct regmap *regmap, *regmap_sfr; - struct clk_hw *hw; + struct pmc_data *sama5d2_pmc; int i; bool bypass; =20 @@ -195,51 +195,51 @@ static void __init sama5d2_pmc_setup(struct device_no= de *np) if (!sama5d2_pmc) return; =20 - hw =3D at91_clk_register_main_rc_osc(regmap, "main_rc_osc", 12000000, - 100000000); - if (IS_ERR(hw)) + main_rc_hw =3D at91_clk_register_main_rc_osc(regmap, "main_rc_osc", 12000= 000, + 100000000); + if (IS_ERR(main_rc_hw)) goto err_free; =20 bypass =3D of_property_read_bool(np, "atmel,osc-bypass"); =20 - hw =3D at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL, - bypass); - if (IS_ERR(hw)) + main_osc_hw =3D at91_clk_register_main_osc(regmap, "main_osc", NULL, + &AT91_CLK_PD_NAME(mainxtal_name), bypass); + if (IS_ERR(main_osc_hw)) goto err_free; =20 - parent_names[0] =3D "main_rc_osc"; - parent_names[1] =3D "main_osc"; - hw =3D at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, NULL= , 2); + parent_data[0] =3D AT91_CLK_PD_HW(main_rc_hw); + parent_data[1] =3D AT91_CLK_PD_HW(main_osc_hw); + hw =3D at91_clk_register_sam9x5_main(regmap, "mainck", NULL, parent_data,= 2); if (IS_ERR(hw)) goto err_free; =20 sama5d2_pmc->chws[PMC_MAIN] =3D hw; - - hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, + hw =3D at91_clk_register_pll(regmap, "pllack", NULL, + &AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_MAIN]), 0, &sama5d3_pll_layout, &plla_characteristics); if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL); + hw =3D at91_clk_register_plldiv(regmap, "plladivck", NULL, &AT91_CLK_PD_H= W(hw)); if (IS_ERR(hw)) goto err_free; =20 sama5d2_pmc->chws[PMC_PLLACK] =3D hw; =20 - hw =3D at91_clk_register_audio_pll_frac(regmap, "audiopll_fracck", - "mainck", NULL); - if (IS_ERR(hw)) + audio_fracck_hw =3D at91_clk_register_audio_pll_frac(regmap, "audiopll_fr= acck", NULL, + &AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_MAIN])); + if (IS_ERR(audio_fracck_hw)) goto err_free; =20 - hw =3D at91_clk_register_audio_pll_pad(regmap, "audiopll_padck", - "audiopll_fracck", NULL); + hw =3D at91_clk_register_audio_pll_pad(regmap, "audiopll_padck", NULL, + &AT91_CLK_PD_HW(audio_fracck_hw)); if (IS_ERR(hw)) goto err_free; =20 sama5d2_pmc->chws[PMC_AUDIOPINCK] =3D hw; =20 - hw =3D at91_clk_register_audio_pll_pmc(regmap, "audiopll_pmcck", - "audiopll_fracck", NULL); + hw =3D at91_clk_register_audio_pll_pmc(regmap, "audiopll_pmcck", NULL, + &AT91_CLK_PD_HW(audio_fracck_hw)); if (IS_ERR(hw)) goto err_free; =20 @@ -249,25 +249,26 @@ static void __init sama5d2_pmc_setup(struct device_no= de *np) if (IS_ERR(regmap_sfr)) regmap_sfr =3D NULL; =20 - hw =3D at91_clk_register_utmi(regmap, regmap_sfr, "utmick", "mainck", NUL= L); + hw =3D at91_clk_register_utmi(regmap, regmap_sfr, "utmick", NULL, + &AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_MAIN])); if (IS_ERR(hw)) goto err_free; =20 sama5d2_pmc->chws[PMC_UTMI] =3D hw; =20 - parent_names[0] =3D slck_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "plladivck"; - parent_names[3] =3D "utmick"; + parent_data[0] =3D AT91_CLK_PD_NAME(slck_name); + parent_data[1] =3D AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_MAIN]); + parent_data[2] =3D AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_PLLACK]); + parent_data[3] =3D AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_UTMI]); hw =3D at91_clk_register_master_pres(regmap, "masterck_pres", 4, - parent_names, NULL, + NULL, parent_data, &at91sam9x5_master_layout, &mck_characteristics, &mck_lock); if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_master_div(regmap, "masterck_div", - "masterck_pres", NULL, + hw =3D at91_clk_register_master_div(regmap, "masterck_div", NULL, + &AT91_CLK_PD_HW(hw), &at91sam9x5_master_layout, &mck_characteristics, &mck_lock, CLK_SET_RATE_GATE, 0); @@ -276,31 +277,32 @@ static void __init sama5d2_pmc_setup(struct device_no= de *np) =20 sama5d2_pmc->chws[PMC_MCK] =3D hw; =20 - hw =3D at91_clk_register_h32mx(regmap, "h32mxck", "masterck_div", NULL); + hw =3D at91_clk_register_h32mx(regmap, "h32mxck", NULL, + &AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_MCK])); if (IS_ERR(hw)) goto err_free; =20 sama5d2_pmc->chws[PMC_MCK2] =3D hw; =20 - parent_names[0] =3D "plladivck"; - parent_names[1] =3D "utmick"; - hw =3D at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, NULL, 2= ); - if (IS_ERR(hw)) + parent_data[0] =3D AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_PLLACK]); + parent_data[1] =3D AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_UTMI]); + usbck_hw =3D at91sam9x5_clk_register_usb(regmap, "usbck", NULL, parent_da= ta, 2); + if (IS_ERR(usbck_hw)) goto err_free; =20 - parent_names[0] =3D slck_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "plladivck"; - parent_names[3] =3D "utmick"; - parent_names[4] =3D "masterck_div"; - parent_names[5] =3D "audiopll_pmcck"; + parent_data[0] =3D AT91_CLK_PD_NAME(slck_name); + parent_data[1] =3D AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_MAIN]); + parent_data[2] =3D AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_PLLACK]); + parent_data[3] =3D AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_UTMI]); + parent_data[4] =3D AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_MCK]); + parent_data[5] =3D AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_AUDIOPLLCK]); for (i =3D 0; i < 3; i++) { char name[6]; =20 snprintf(name, sizeof(name), "prog%d", i); =20 hw =3D at91_clk_register_programmable(regmap, name, - parent_names, NULL, 6, i, + NULL, parent_data, 6, i, &sama5d2_programmable_layout, NULL); if (IS_ERR(hw)) @@ -309,9 +311,18 @@ static void __init sama5d2_pmc_setup(struct device_nod= e *np) sama5d2_pmc->pchws[i] =3D hw; } =20 + /* Set systemck parent hws. */ + sama5d2_systemck[0].parent_hw =3D sama5d2_pmc->chws[PMC_MCK]; + sama5d2_systemck[1].parent_hw =3D sama5d2_pmc->chws[PMC_MCK]; + sama5d2_systemck[2].parent_hw =3D usbck_hw; + sama5d2_systemck[3].parent_hw =3D usbck_hw; + sama5d2_systemck[4].parent_hw =3D sama5d2_pmc->pchws[0]; + sama5d2_systemck[5].parent_hw =3D sama5d2_pmc->pchws[1]; + sama5d2_systemck[6].parent_hw =3D sama5d2_pmc->pchws[2]; + sama5d2_systemck[7].parent_hw =3D sama5d2_pmc->chws[PMC_MCK]; for (i =3D 0; i < ARRAY_SIZE(sama5d2_systemck); i++) { - hw =3D at91_clk_register_system(regmap, sama5d2_systemck[i].n, - sama5d2_systemck[i].p, NULL, + hw =3D at91_clk_register_system(regmap, sama5d2_systemck[i].n, NULL, + &AT91_CLK_PD_HW(sama5d2_systemck[i].parent_hw), sama5d2_systemck[i].id, sama5d2_systemck[i].flags); if (IS_ERR(hw)) @@ -324,7 +335,8 @@ static void __init sama5d2_pmc_setup(struct device_node= *np) hw =3D at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock, &sama5d2_pcr_layout, sama5d2_periphck[i].n, - "masterck_div", NULL, + NULL, + &AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_MCK]), sama5d2_periphck[i].id, &range, INT_MIN, sama5d2_periphck[i].flags); @@ -338,7 +350,8 @@ static void __init sama5d2_pmc_setup(struct device_node= *np) hw =3D at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock, &sama5d2_pcr_layout, sama5d2_periph32ck[i].n, - "h32mxck", NULL, + NULL, + &AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_MCK2]), sama5d2_periph32ck[i].id, &sama5d2_periph32ck[i].r, INT_MIN, 0); @@ -348,17 +361,17 @@ static void __init sama5d2_pmc_setup(struct device_no= de *np) sama5d2_pmc->phws[sama5d2_periph32ck[i].id] =3D hw; } =20 - parent_names[0] =3D slck_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "plladivck"; - parent_names[3] =3D "utmick"; - parent_names[4] =3D "masterck_div"; - parent_names[5] =3D "audiopll_pmcck"; + parent_data[0] =3D AT91_CLK_PD_NAME(slck_name); + parent_data[1] =3D AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_MAIN]); + parent_data[2] =3D AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_PLLACK]); + parent_data[3] =3D AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_UTMI]); + parent_data[4] =3D AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_MCK]); + parent_data[5] =3D AT91_CLK_PD_HW(sama5d2_pmc->chws[PMC_AUDIOPLLCK]); for (i =3D 0; i < ARRAY_SIZE(sama5d2_gck); i++) { hw =3D at91_clk_register_generated(regmap, &pmc_pcr_lock, &sama5d2_pcr_layout, sama5d2_gck[i].n, - parent_names, NULL, NULL, 6, + NULL, parent_data, NULL, 6, sama5d2_gck[i].id, &sama5d2_gck[i].r, sama5d2_gck[i].chg_pid); @@ -369,19 +382,19 @@ static void __init sama5d2_pmc_setup(struct device_no= de *np) } =20 if (regmap_sfr) { - parent_names[0] =3D "i2s0_clk"; - parent_names[1] =3D "i2s0_gclk"; + parent_data[0] =3D AT91_CLK_PD_HW(sama5d2_pmc->phws[54]); /* i2s0_clk */ + parent_data[1] =3D AT91_CLK_PD_HW(sama5d2_pmc->ghws[54]); /* i2s0_gclk */ hw =3D at91_clk_i2s_mux_register(regmap_sfr, "i2s0_muxclk", - parent_names, NULL, 2, 0); + NULL, parent_data, 2, 0); if (IS_ERR(hw)) goto err_free; =20 sama5d2_pmc->chws[PMC_I2S0_MUX] =3D hw; =20 - parent_names[0] =3D "i2s1_clk"; - parent_names[1] =3D "i2s1_gclk"; + parent_data[0] =3D AT91_CLK_PD_HW(sama5d2_pmc->phws[55]); /* i2s1_clk */ + parent_data[1] =3D AT91_CLK_PD_HW(sama5d2_pmc->ghws[55]); /* i2s1_gclk */ hw =3D at91_clk_i2s_mux_register(regmap_sfr, "i2s1_muxclk", - parent_names, NULL, 2, 1); + NULL, parent_data, 2, 1); if (IS_ERR(hw)) goto err_free; =20 --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B36FA3A89BE; Fri, 16 Jan 2026 20:07:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594066; cv=none; b=MlXMSf8gl3e3RFsKwWDtSVi+g2urfWy8c9roe0xnmMzaW2ZipVCCsV5t160XWifFy2yIxnKqkTZ2goJCB6H0o74d2ZZjvoXdziNP6EUNYBLVeRn+tvpMWQSCqbl3RTPKgAoW6NYksSq3iyu0jc/NSMZRjPVSh6APkG18aRXDhFc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594066; c=relaxed/simple; bh=HGKxUvj4jfbi7Q0zGZ98GiqkQgAgwIobvJTbwJ7/vCU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Q3U2DRZgRMxk+mt/U/eCNOQl3GPdp1JGcjHmmvH+dyZS1597v3MpnPFJOnNb0WhyK9G/Cv85m8250swg9HsDGHwnZP24zHCJJ44PhD2m8jzJ7GXgyJbOA9i0JQsxeAfpXb9n7wHOeVF3ZnMGvpXQAbkZkQgSnQJksx+mXRihSjc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=y0k4A/tC; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="y0k4A/tC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594063; x=1800130063; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HGKxUvj4jfbi7Q0zGZ98GiqkQgAgwIobvJTbwJ7/vCU=; b=y0k4A/tCu/j4WiA8FW+Sh6IhSTEAmhAdzUYHN1tAmli9YiWxK7Pb4czp xIH6x48KzPAr9Zb8yJsMqWsv71mJA0eHZOc2dm5kpVMUGQ5oRKyXDAAtv 2Oxjf7IkPI7r9DrUIFFz4Wtj3CGijGllQmimSrpcTK0/DInPHDF2rSok6 HoZrdc7+f/80nrcKL1Cs0pCgtaZnYOFGntb1FYKeRGLE9k/+50jfRImx7 80xMIWcqWzontgfFwcGNAT5Fz9DHWHHeowVU6ndHx1AEbU6OkeRTLl3GP 3RYSJKuZ3Gbn4t0uNyS0rJ7LPvhnpdAeo6lh4LRfS/HrQ0JvuePk1xeMk w==; X-CSE-ConnectionGUID: MqTcJu0RSESfeq27zLZvsQ== X-CSE-MsgGUID: bB3piR/rQYil78T484gdtA== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="52013866" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Jan 2026 13:07:40 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Fri, 16 Jan 2026 13:07:07 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:07 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 24/31] clk: at91: sama5d3: switch to parent_data and parent_hw Date: Fri, 16 Jan 2026 13:07:17 -0700 Message-ID: <9431385f28f6a5fad9b4ee37086be58d87643856.1768512290.git.ryan.wanner@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Switch SAMA5D3 clocks to use parent_data and parent_hw where possible. Having parent_data instead of parent names improves to clock registration speed and re-parenting. Update the clock registration functions to use clk_hw. Signed-off-by: Claudiu Beznea Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/sama5d3.c | 104 +++++++++++++++++++++---------------- 1 file changed, 58 insertions(+), 46 deletions(-) diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c index 8326bb6a291c..57f82c882e14 100644 --- a/drivers/clk/at91/sama5d3.c +++ b/drivers/clk/at91/sama5d3.c @@ -37,9 +37,9 @@ static const struct clk_pcr_layout sama5d3_pcr_layout =3D= { .div_mask =3D GENMASK(17, 16), }; =20 -static const struct { +static struct { char *n; - char *p; + struct clk_hw *parent_hw; unsigned long flags; u8 id; } sama5d3_systemck[] =3D { @@ -47,14 +47,14 @@ static const struct { * ddrck feeds DDR controller and is enabled by bootloader thus we need * to keep it enabled in case there is no Linux consumer for it. */ - { .n =3D "ddrck", .p =3D "masterck_div", .id =3D 2, .flags =3D CLK_IS_CRI= TICAL }, - { .n =3D "lcdck", .p =3D "masterck_div", .id =3D 3 }, - { .n =3D "smdck", .p =3D "smdclk", .id =3D 4 }, - { .n =3D "uhpck", .p =3D "usbck", .id =3D 6 }, - { .n =3D "udpck", .p =3D "usbck", .id =3D 7 }, - { .n =3D "pck0", .p =3D "prog0", .id =3D 8 }, - { .n =3D "pck1", .p =3D "prog1", .id =3D 9 }, - { .n =3D "pck2", .p =3D "prog2", .id =3D 10 }, + { .n =3D "ddrck", .id =3D 2, .flags =3D CLK_IS_CRITICAL }, + { .n =3D "lcdck", .id =3D 3 }, + { .n =3D "smdck", .id =3D 4 }, + { .n =3D "uhpck", .id =3D 6 }, + { .n =3D "udpck", .id =3D 7 }, + { .n =3D "pck0", .id =3D 8 }, + { .n =3D "pck1", .id =3D 9 }, + { .n =3D "pck2", .id =3D 10 }, }; =20 static const struct { @@ -114,11 +114,12 @@ static const struct { =20 static void __init sama5d3_pmc_setup(struct device_node *np) { + struct clk_hw *main_rc_hw, *main_osc_hw, *mainck_hw; const char *slck_name, *mainxtal_name; + struct clk_hw *smdck_hw, *usbck_hw, *hw; + struct clk_parent_data parent_data[5]; struct pmc_data *sama5d3_pmc; - const char *parent_names[5]; struct regmap *regmap; - struct clk_hw *hw; int i; bool bypass; =20 @@ -143,54 +144,55 @@ static void __init sama5d3_pmc_setup(struct device_no= de *np) if (!sama5d3_pmc) return; =20 - hw =3D at91_clk_register_main_rc_osc(regmap, "main_rc_osc", 12000000, - 50000000); - if (IS_ERR(hw)) + main_rc_hw =3D at91_clk_register_main_rc_osc(regmap, "main_rc_osc", 12000= 000, + 50000000); + if (IS_ERR(main_rc_hw)) goto err_free; =20 bypass =3D of_property_read_bool(np, "atmel,osc-bypass"); =20 - hw =3D at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL, - bypass); - if (IS_ERR(hw)) + main_osc_hw =3D at91_clk_register_main_osc(regmap, "main_osc", NULL, + &AT91_CLK_PD_NAME(mainxtal_name), + bypass); + if (IS_ERR(main_osc_hw)) goto err_free; =20 - parent_names[0] =3D "main_rc_osc"; - parent_names[1] =3D "main_osc"; - hw =3D at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, NULL= , 2); - if (IS_ERR(hw)) + parent_data[0] =3D AT91_CLK_PD_HW(main_rc_hw); + parent_data[1] =3D AT91_CLK_PD_HW(main_osc_hw); + mainck_hw =3D at91_clk_register_sam9x5_main(regmap, "mainck", NULL, paren= t_data, 2); + if (IS_ERR(mainck_hw)) goto err_free; =20 - hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, + hw =3D at91_clk_register_pll(regmap, "pllack", NULL, &AT91_CLK_PD_HW(main= ck_hw), 0, &sama5d3_pll_layout, &plla_characteristics); if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL); + hw =3D at91_clk_register_plldiv(regmap, "plladivck", NULL, &AT91_CLK_PD_H= W(hw)); if (IS_ERR(hw)) goto err_free; =20 sama5d3_pmc->chws[PMC_PLLACK] =3D hw; =20 - hw =3D at91_clk_register_utmi(regmap, NULL, "utmick", "mainck", NULL); + hw =3D at91_clk_register_utmi(regmap, NULL, "utmick", NULL, &AT91_CLK_PD_= HW(mainck_hw)); if (IS_ERR(hw)) goto err_free; =20 sama5d3_pmc->chws[PMC_UTMI] =3D hw; =20 - parent_names[0] =3D slck_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "plladivck"; - parent_names[3] =3D "utmick"; + parent_data[0] =3D AT91_CLK_PD_NAME(slck_name); + parent_data[1] =3D AT91_CLK_PD_HW(mainck_hw); + parent_data[2] =3D AT91_CLK_PD_HW(sama5d3_pmc->chws[PMC_PLLACK]); + parent_data[3] =3D AT91_CLK_PD_HW(sama5d3_pmc->chws[PMC_UTMI]); hw =3D at91_clk_register_master_pres(regmap, "masterck_pres", 4, - parent_names, NULL, + NULL, parent_data, &at91sam9x5_master_layout, &mck_characteristics, &mck_lock); if (IS_ERR(hw)) goto err_free; =20 hw =3D at91_clk_register_master_div(regmap, "masterck_div", - "masterck_pres", NULL, + NULL, &AT91_CLK_PD_HW(hw), &at91sam9x5_master_layout, &mck_characteristics, &mck_lock, CLK_SET_RATE_GATE, 0); @@ -199,28 +201,28 @@ static void __init sama5d3_pmc_setup(struct device_no= de *np) =20 sama5d3_pmc->chws[PMC_MCK] =3D hw; =20 - parent_names[0] =3D "plladivck"; - parent_names[1] =3D "utmick"; - hw =3D at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, NULL, 2= ); - if (IS_ERR(hw)) + parent_data[0] =3D AT91_CLK_PD_HW(sama5d3_pmc->chws[PMC_PLLACK]); + parent_data[1] =3D AT91_CLK_PD_HW(sama5d3_pmc->chws[PMC_UTMI]); + usbck_hw =3D at91sam9x5_clk_register_usb(regmap, "usbck", NULL, parent_da= ta, 2); + if (IS_ERR(usbck_hw)) goto err_free; =20 - hw =3D at91sam9x5_clk_register_smd(regmap, "smdclk", parent_names, NULL, = 2); - if (IS_ERR(hw)) + smdck_hw =3D at91sam9x5_clk_register_smd(regmap, "smdclk", NULL, parent_d= ata, 2); + if (IS_ERR(smdck_hw)) goto err_free; =20 - parent_names[0] =3D slck_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "plladivck"; - parent_names[3] =3D "utmick"; - parent_names[4] =3D "masterck_div"; + parent_data[0] =3D AT91_CLK_PD_NAME(slck_name); + parent_data[1] =3D AT91_CLK_PD_HW(mainck_hw); + parent_data[2] =3D AT91_CLK_PD_HW(sama5d3_pmc->chws[PMC_PLLACK]); + parent_data[3] =3D AT91_CLK_PD_HW(sama5d3_pmc->chws[PMC_UTMI]); + parent_data[4] =3D AT91_CLK_PD_HW(sama5d3_pmc->chws[PMC_MCK]); for (i =3D 0; i < 3; i++) { char name[6]; =20 snprintf(name, sizeof(name), "prog%d", i); =20 hw =3D at91_clk_register_programmable(regmap, name, - parent_names, NULL, 5, i, + NULL, parent_data, 5, i, &at91sam9x5_programmable_layout, NULL); if (IS_ERR(hw)) @@ -229,9 +231,18 @@ static void __init sama5d3_pmc_setup(struct device_nod= e *np) sama5d3_pmc->pchws[i] =3D hw; } =20 + /* Set systemck parent hws. */ + sama5d3_systemck[0].parent_hw =3D sama5d3_pmc->chws[PMC_MCK]; + sama5d3_systemck[1].parent_hw =3D sama5d3_pmc->chws[PMC_MCK]; + sama5d3_systemck[2].parent_hw =3D smdck_hw; + sama5d3_systemck[3].parent_hw =3D usbck_hw; + sama5d3_systemck[4].parent_hw =3D usbck_hw; + sama5d3_systemck[5].parent_hw =3D sama5d3_pmc->pchws[0]; + sama5d3_systemck[6].parent_hw =3D sama5d3_pmc->pchws[1]; + sama5d3_systemck[7].parent_hw =3D sama5d3_pmc->pchws[2]; for (i =3D 0; i < ARRAY_SIZE(sama5d3_systemck); i++) { - hw =3D at91_clk_register_system(regmap, sama5d3_systemck[i].n, - sama5d3_systemck[i].p, NULL, + hw =3D at91_clk_register_system(regmap, sama5d3_systemck[i].n, NULL, + &AT91_CLK_PD_HW(sama5d3_systemck[i].parent_hw), sama5d3_systemck[i].id, sama5d3_systemck[i].flags); if (IS_ERR(hw)) @@ -244,7 +255,8 @@ static void __init sama5d3_pmc_setup(struct device_node= *np) hw =3D at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock, &sama5d3_pcr_layout, sama5d3_periphck[i].n, - "masterck_div", NULL, + NULL, + &AT91_CLK_PD_HW(sama5d3_pmc->chws[PMC_MCK]), sama5d3_periphck[i].id, &sama5d3_periphck[i].r, INT_MIN, --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 273653A4ACB; Fri, 16 Jan 2026 20:07:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594058; cv=none; b=rKgv5kqZBiDmOca4quylT7a6P6VbXVrmTmbLTz+9xkQIDpkjQeYplY5IJYy6192a1RKxK4yBF1g6rumsxUMQjXoM5zlTFv8H8W//8FvkQ65+3hcB+RXTPJCjZv/8CR3PKd/clmewTMBFFE7PXuvANoNtBOWJqEPU1xHi8lAC+Eo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594058; c=relaxed/simple; bh=u9KONUZZXMIN1MFPlUpAZCGNYH1AMj/Rto7/sC9/R2E=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JQVklDWZrBhDN3XjMDP0kOnP90jk0d9Qj0TpT1HfGa4wpGZYKOfYFJR+52Unm8mT6C0BLPWENG/0GoltbwwfFBSInbk3HjVEo3o42q+QeyOmjdsJs18bZBTkd7XIDoU4K0WBegyWBMzDj793Hc6IVa4jedUkhNCQ2i4ypdw/ZH4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=mxthNl0j; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="mxthNl0j" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594054; x=1800130054; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=u9KONUZZXMIN1MFPlUpAZCGNYH1AMj/Rto7/sC9/R2E=; b=mxthNl0jM9SXQTFXkoqRlVo5V3WdeFAiw2mwFJC8Dufp9zqVHZ+TwaSr ttzWVZgy5yno+VCASWAHkg+6pl/Kd6zFkiX897UPWMjrekQmwj/uY/R+i YwsHz+K62n6uUqQrWyR8OeRd4zfgvfuvb3zL5myXzsuz7+c1dDAz6oEsW ZFsS1WajK0uSB+hKxtha8ZPotUIzOwUKhGUeAitO4CZOojG2rFobPwaDk WpGEI4/UBbx7wy/0dsvCTZRY3pRuQH9BZRpON+QDn5PzrrExm1QLppJa0 28k78eAcJtjJfkWtnddh4KOLjRBO6foZPUvrONEP5mIGD5bHFs9IRl588 g==; X-CSE-ConnectionGUID: OTooRcwrRNCxZBlF1StIPQ== X-CSE-MsgGUID: F7MMxJ+TTSKBkh4ohbnlFA== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="59042243" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2026 13:07:26 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex3.mchp-main.com (10.10.87.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.29; Fri, 16 Jan 2026 13:07:07 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:07 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 25/31] clk: at91: sama5d4: switch to parent_data and parent_hw Date: Fri, 16 Jan 2026 13:07:18 -0700 Message-ID: <67141a009da082eacfc2b1959750b479f8e03c63.1768512290.git.ryan.wanner@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Switch SAMA5D4 clocks to use parent_data and parent_hw where possible. Having parent_data instead of parent names improves to clock registration speed and re-parenting. Update clock registration functions to use clk_hw. Signed-off-by: Claudiu Beznea Signed-off-by: Ryan Wanner --- drivers/clk/at91/sama5d4.c | 112 ++++++++++++++++++++----------------- 1 file changed, 61 insertions(+), 51 deletions(-) diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c index 1ff9286148da..1dd2c81167e9 100644 --- a/drivers/clk/at91/sama5d4.c +++ b/drivers/clk/at91/sama5d4.c @@ -36,9 +36,9 @@ static const struct clk_pcr_layout sama5d4_pcr_layout =3D= { .pid_mask =3D GENMASK(6, 0), }; =20 -static const struct { +static struct { char *n; - char *p; + struct clk_hw *parent_hw; unsigned long flags; u8 id; } sama5d4_systemck[] =3D { @@ -46,14 +46,14 @@ static const struct { * ddrck feeds DDR controller and is enabled by bootloader thus we need * to keep it enabled in case there is no Linux consumer for it. */ - { .n =3D "ddrck", .p =3D "masterck_div", .id =3D 2, .flags =3D CLK_IS_CRI= TICAL }, - { .n =3D "lcdck", .p =3D "masterck_div", .id =3D 3 }, - { .n =3D "smdck", .p =3D "smdclk", .id =3D 4 }, - { .n =3D "uhpck", .p =3D "usbck", .id =3D 6 }, - { .n =3D "udpck", .p =3D "usbck", .id =3D 7 }, - { .n =3D "pck0", .p =3D "prog0", .id =3D 8 }, - { .n =3D "pck1", .p =3D "prog1", .id =3D 9 }, - { .n =3D "pck2", .p =3D "prog2", .id =3D 10 }, + { .n =3D "ddrck", .id =3D 2, .flags =3D CLK_IS_CRITICAL }, + { .n =3D "lcdck", .id =3D 3 }, + { .n =3D "smdck", .id =3D 4 }, + { .n =3D "uhpck", .id =3D 6 }, + { .n =3D "udpck", .id =3D 7 }, + { .n =3D "pck0", .id =3D 8 }, + { .n =3D "pck1", .id =3D 9 }, + { .n =3D "pck2", .id =3D 10 }, }; =20 static const struct { @@ -128,12 +128,13 @@ static const struct { =20 static void __init sama5d4_pmc_setup(struct device_node *np) { - struct clk_range range =3D CLK_RANGE(0, 0); + struct clk_hw *main_rc_hw, *main_osc_hw, *mainck_hw; const char *slck_name, *mainxtal_name; + struct clk_hw *smdck_hw, *usbck_hw, *hw; + struct clk_range range =3D CLK_RANGE(0, 0); + struct clk_parent_data parent_data[5]; struct pmc_data *sama5d4_pmc; - const char *parent_names[5]; struct regmap *regmap; - struct clk_hw *hw; int i; bool bypass; =20 @@ -158,54 +159,53 @@ static void __init sama5d4_pmc_setup(struct device_no= de *np) if (!sama5d4_pmc) return; =20 - hw =3D at91_clk_register_main_rc_osc(regmap, "main_rc_osc", 12000000, - 100000000); - if (IS_ERR(hw)) + main_rc_hw =3D at91_clk_register_main_rc_osc(regmap, "main_rc_osc", 12000= 000, + 100000000); + if (IS_ERR(main_rc_hw)) goto err_free; =20 bypass =3D of_property_read_bool(np, "atmel,osc-bypass"); =20 - hw =3D at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL, - bypass); - if (IS_ERR(hw)) + main_osc_hw =3D at91_clk_register_main_osc(regmap, "main_osc", NULL, + &AT91_CLK_PD_NAME(mainxtal_name), bypass); + if (IS_ERR(main_osc_hw)) goto err_free; =20 - parent_names[0] =3D "main_rc_osc"; - parent_names[1] =3D "main_osc"; - hw =3D at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, NULL= , 2); + parent_data[0] =3D AT91_CLK_PD_HW(main_rc_hw); + parent_data[1] =3D AT91_CLK_PD_HW(main_osc_hw); + mainck_hw =3D at91_clk_register_sam9x5_main(regmap, "mainck", NULL, paren= t_data, 2); if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, + hw =3D at91_clk_register_pll(regmap, "pllack", NULL, &AT91_CLK_PD_HW(main= ck_hw), 0, &sama5d3_pll_layout, &plla_characteristics); if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL); + hw =3D at91_clk_register_plldiv(regmap, "plladivck", NULL, &AT91_CLK_PD_H= W(hw)); if (IS_ERR(hw)) goto err_free; =20 sama5d4_pmc->chws[PMC_PLLACK] =3D hw; =20 - hw =3D at91_clk_register_utmi(regmap, NULL, "utmick", "mainck", NULL); + hw =3D at91_clk_register_utmi(regmap, NULL, "utmick", NULL, &AT91_CLK_PD_= HW(mainck_hw)); if (IS_ERR(hw)) goto err_free; =20 sama5d4_pmc->chws[PMC_UTMI] =3D hw; =20 - parent_names[0] =3D slck_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "plladivck"; - parent_names[3] =3D "utmick"; + parent_data[0] =3D AT91_CLK_PD_NAME(slck_name); + parent_data[1] =3D AT91_CLK_PD_HW(mainck_hw); + parent_data[2] =3D AT91_CLK_PD_HW(sama5d4_pmc->chws[PMC_PLLACK]); + parent_data[3] =3D AT91_CLK_PD_HW(sama5d4_pmc->chws[PMC_UTMI]); hw =3D at91_clk_register_master_pres(regmap, "masterck_pres", 4, - parent_names, NULL, + NULL, parent_data, &at91sam9x5_master_layout, &mck_characteristics, &mck_lock); if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_master_div(regmap, "masterck_div", - "masterck_pres", NULL, + hw =3D at91_clk_register_master_div(regmap, "masterck_div", NULL, &AT91_C= LK_PD_HW(hw), &at91sam9x5_master_layout, &mck_characteristics, &mck_lock, CLK_SET_RATE_GATE, 0); @@ -214,36 +214,35 @@ static void __init sama5d4_pmc_setup(struct device_no= de *np) =20 sama5d4_pmc->chws[PMC_MCK] =3D hw; =20 - hw =3D at91_clk_register_h32mx(regmap, "h32mxck", "masterck_div", NULL); + hw =3D at91_clk_register_h32mx(regmap, "h32mxck", NULL, + &AT91_CLK_PD_HW(sama5d4_pmc->chws[PMC_MCK])); if (IS_ERR(hw)) goto err_free; =20 sama5d4_pmc->chws[PMC_MCK2] =3D hw; =20 - parent_names[0] =3D "plladivck"; - parent_names[1] =3D "utmick"; - hw =3D at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, NULL, 2= ); - if (IS_ERR(hw)) + parent_data[0] =3D AT91_CLK_PD_HW(sama5d4_pmc->chws[PMC_PLLACK]); + parent_data[1] =3D AT91_CLK_PD_HW(sama5d4_pmc->chws[PMC_UTMI]); + usbck_hw =3D at91sam9x5_clk_register_usb(regmap, "usbck", NULL, parent_da= ta, 2); + if (IS_ERR(usbck_hw)) goto err_free; =20 - parent_names[0] =3D "plladivck"; - parent_names[1] =3D "utmick"; - hw =3D at91sam9x5_clk_register_smd(regmap, "smdclk", parent_names, NULL, = 2); - if (IS_ERR(hw)) + smdck_hw =3D at91sam9x5_clk_register_smd(regmap, "smdclk", NULL, parent_d= ata, 2); + if (IS_ERR(smdck_hw)) goto err_free; =20 - parent_names[0] =3D slck_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "plladivck"; - parent_names[3] =3D "utmick"; - parent_names[4] =3D "masterck_div"; + parent_data[0] =3D AT91_CLK_PD_NAME(slck_name); + parent_data[1] =3D AT91_CLK_PD_HW(mainck_hw); + parent_data[2] =3D AT91_CLK_PD_HW(sama5d4_pmc->chws[PMC_PLLACK]); + parent_data[3] =3D AT91_CLK_PD_HW(sama5d4_pmc->chws[PMC_UTMI]); + parent_data[4] =3D AT91_CLK_PD_HW(sama5d4_pmc->chws[PMC_MCK]); for (i =3D 0; i < 3; i++) { char name[6]; =20 snprintf(name, sizeof(name), "prog%d", i); =20 hw =3D at91_clk_register_programmable(regmap, name, - parent_names, NULL, 5, i, + NULL, parent_data, 5, i, &at91sam9x5_programmable_layout, NULL); if (IS_ERR(hw)) @@ -252,9 +251,18 @@ static void __init sama5d4_pmc_setup(struct device_nod= e *np) sama5d4_pmc->pchws[i] =3D hw; } =20 + /* Set systemck parent hws. */ + sama5d4_systemck[0].parent_hw =3D sama5d4_pmc->chws[PMC_MCK]; + sama5d4_systemck[1].parent_hw =3D sama5d4_pmc->chws[PMC_MCK]; + sama5d4_systemck[2].parent_hw =3D smdck_hw; + sama5d4_systemck[3].parent_hw =3D usbck_hw; + sama5d4_systemck[4].parent_hw =3D usbck_hw; + sama5d4_systemck[5].parent_hw =3D sama5d4_pmc->pchws[0]; + sama5d4_systemck[6].parent_hw =3D sama5d4_pmc->pchws[1]; + sama5d4_systemck[7].parent_hw =3D sama5d4_pmc->pchws[2]; for (i =3D 0; i < ARRAY_SIZE(sama5d4_systemck); i++) { - hw =3D at91_clk_register_system(regmap, sama5d4_systemck[i].n, - sama5d4_systemck[i].p, NULL, + hw =3D at91_clk_register_system(regmap, sama5d4_systemck[i].n, NULL, + &AT91_CLK_PD_HW(sama5d4_systemck[i].parent_hw), sama5d4_systemck[i].id, sama5d4_systemck[i].flags); if (IS_ERR(hw)) @@ -267,7 +275,8 @@ static void __init sama5d4_pmc_setup(struct device_node= *np) hw =3D at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock, &sama5d4_pcr_layout, sama5d4_periphck[i].n, - "masterck_div", NULL, + NULL, + &AT91_CLK_PD_HW(sama5d4_pmc->chws[PMC_MCK]), sama5d4_periphck[i].id, &range, INT_MIN, sama5d4_periphck[i].flags); @@ -281,7 +290,8 @@ static void __init sama5d4_pmc_setup(struct device_node= *np) hw =3D at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock, &sama5d4_pcr_layout, sama5d4_periph32ck[i].n, - "h32mxck", NULL, + NULL, + &AT91_CLK_PD_HW(sama5d4_pmc->chws[PMC_MCK2]), sama5d4_periph32ck[i].id, &range, INT_MIN, 0); if (IS_ERR(hw)) --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 630D63A4F4C; Fri, 16 Jan 2026 20:07:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594059; cv=none; b=WuKJ2HYnflkq+LbyP7+/n07bFHIpwbGHSGEKsCmiOToh+agrK80k0+aR8j2MQJsDsm5m8so5Xcj74KaO773YmkbaOTBLxun2HgTUhog5h9Q+Vcwnh5+//+g8tFJmy5OiZsRpyxzuia3wBziLS3c5bZ4lZwqvl70F0FRbh+pbWa8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594059; c=relaxed/simple; bh=wPqBPwqODrsLlkOAp1YdbcRd/JN5iK9rcwEnZWNnZM0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uK09o4sEyEXKRGW9xlkbKfc+rjam04bKlQIFCioEg+Hy2tr5/oqamMgms3rL9+YnttCBf+zFIicexVEFAln1YX4a16s4DL4xfThjokjUpJcKF/LZZoAhfBF9wMxF5opqRprBDd8DuZLwqi5w3IpsrQDrngs+g69maw6NFoBgp6A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=iYoKDw+V; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="iYoKDw+V" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594056; x=1800130056; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wPqBPwqODrsLlkOAp1YdbcRd/JN5iK9rcwEnZWNnZM0=; b=iYoKDw+VvUiEUtkdsILH1uW4710MQBfy2LHg5f71D8NsPgvppHezSd6M 5lHDEYggOb6tyY4vaSU0Ct2V7UfWWGnt62fcX+Qjm3ILE0MQCYitC2SlU 50yyk4NlSNrS6m3NjY/2p09zHxQsayNeEdravPlQDpPrUnHRyan8xGfmZ bpQOKaXFk03G10D0ew/5ahgrlIBds3wbcyHOGWabpYNgv2WZpONQJU7oF IeaOZfqf06PDcQ7Zbn3fCkfetDBHb2OIstIMph2H825xdXmOpLKU5vU4c k0tzUu7iIGXWYtOHJ6qR4bZApjA01RI/JjKm86B4TMhCAnWb+3o0X1Pf6 A==; X-CSE-ConnectionGUID: OTooRcwrRNCxZBlF1StIPQ== X-CSE-MsgGUID: 5Yc6oUcQSZWsG4x4jCzJZg== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="59042245" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2026 13:07:26 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex3.mchp-main.com (10.10.87.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.29; Fri, 16 Jan 2026 13:07:07 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:07 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 26/31] clk: at91: at91sam9x5: switch to parent_data and parent_hw Date: Fri, 16 Jan 2026 13:07:19 -0700 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Switch AT91SAM9X5 clocks to use parent_data and parent_hw where possible. Having parent_data instead of parent names improves to clock registration speed and re-parenting. Update clock registration functions to use clk_hw. Signed-off-by: Claudiu Beznea Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/at91sam9x5.c | 106 +++++++++++++++++++--------------- 1 file changed, 59 insertions(+), 47 deletions(-) diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c index 13331e015dd7..497ed68bc747 100644 --- a/drivers/clk/at91/at91sam9x5.c +++ b/drivers/clk/at91/at91sam9x5.c @@ -38,9 +38,9 @@ static const struct clk_pll_characteristics plla_characte= ristics =3D { .out =3D plla_out, }; =20 -static const struct { +static struct { char *n; - char *p; + struct clk_hw *parent_hw; unsigned long flags; u8 id; } at91sam9x5_systemck[] =3D { @@ -48,12 +48,12 @@ static const struct { * ddrck feeds DDR controller and is enabled by bootloader thus we need * to keep it enabled in case there is no Linux consumer for it. */ - { .n =3D "ddrck", .p =3D "masterck_div", .id =3D 2, .flags =3D CLK_IS_CRI= TICAL }, - { .n =3D "smdck", .p =3D "smdclk", .id =3D 4 }, - { .n =3D "uhpck", .p =3D "usbck", .id =3D 6 }, - { .n =3D "udpck", .p =3D "usbck", .id =3D 7 }, - { .n =3D "pck0", .p =3D "prog0", .id =3D 8 }, - { .n =3D "pck1", .p =3D "prog1", .id =3D 9 }, + { .n =3D "ddrck", .id =3D 2, .flags =3D CLK_IS_CRITICAL }, + { .n =3D "smdck", .id =3D 4 }, + { .n =3D "uhpck", .id =3D 6 }, + { .n =3D "udpck", .id =3D 7 }, + { .n =3D "pck0", .id =3D 8 }, + { .n =3D "pck1", .id =3D 9 }, }; =20 static const struct clk_pcr_layout at91sam9x5_pcr_layout =3D { @@ -133,12 +133,13 @@ static void __init at91sam9x5_pmc_setup(struct device= _node *np, const struct pck *extra_pcks, bool has_lcdck) { + struct clk_hw *main_rc_hw, *main_osc_hw, *hw; struct clk_range range =3D CLK_RANGE(0, 0); const char *slck_name, *mainxtal_name; struct pmc_data *at91sam9x5_pmc; - const char *parent_names[6]; + struct clk_parent_data parent_data[6]; struct regmap *regmap; - struct clk_hw *hw; + struct clk_hw *smdck_hw, *usbck_hw; int i; bool bypass; =20 @@ -162,56 +163,58 @@ static void __init at91sam9x5_pmc_setup(struct device= _node *np, if (!at91sam9x5_pmc) return; =20 - hw =3D at91_clk_register_main_rc_osc(regmap, "main_rc_osc", 12000000, - 50000000); - if (IS_ERR(hw)) + main_rc_hw =3D at91_clk_register_main_rc_osc(regmap, "main_rc_osc", 12000= 000, + 50000000); + if (IS_ERR(main_rc_hw)) goto err_free; =20 bypass =3D of_property_read_bool(np, "atmel,osc-bypass"); =20 - hw =3D at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL, - bypass); - if (IS_ERR(hw)) + main_osc_hw =3D at91_clk_register_main_osc(regmap, "main_osc", NULL, + &AT91_CLK_PD_NAME(mainxtal_name), bypass); + if (IS_ERR(main_osc_hw)) goto err_free; =20 - parent_names[0] =3D "main_rc_osc"; - parent_names[1] =3D "main_osc"; - hw =3D at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, NULL= , 2); + parent_data[0] =3D AT91_CLK_PD_HW(main_rc_hw); + parent_data[1] =3D AT91_CLK_PD_HW(main_osc_hw); + hw =3D at91_clk_register_sam9x5_main(regmap, "mainck", NULL, parent_data,= 2); if (IS_ERR(hw)) goto err_free; =20 at91sam9x5_pmc->chws[PMC_MAIN] =3D hw; =20 - hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, + hw =3D at91_clk_register_pll(regmap, "pllack", NULL, + &AT91_CLK_PD_HW(at91sam9x5_pmc->chws[PMC_MAIN]), 0, &at91rm9200_pll_layout, &plla_characteristics); if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL); + hw =3D at91_clk_register_plldiv(regmap, "plladivck", NULL, &AT91_CLK_PD_H= W(hw)); if (IS_ERR(hw)) goto err_free; =20 at91sam9x5_pmc->chws[PMC_PLLACK] =3D hw; =20 - hw =3D at91_clk_register_utmi(regmap, NULL, "utmick", "mainck", NULL); + hw =3D at91_clk_register_utmi(regmap, NULL, "utmick", NULL, + &AT91_CLK_PD_HW(at91sam9x5_pmc->chws[PMC_MAIN])); if (IS_ERR(hw)) goto err_free; =20 at91sam9x5_pmc->chws[PMC_UTMI] =3D hw; =20 - parent_names[0] =3D slck_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "plladivck"; - parent_names[3] =3D "utmick"; + parent_data[0] =3D AT91_CLK_PD_NAME(slck_name); + parent_data[1] =3D AT91_CLK_PD_HW(at91sam9x5_pmc->chws[PMC_MAIN]); + parent_data[2] =3D AT91_CLK_PD_HW(at91sam9x5_pmc->chws[PMC_PLLACK]); + parent_data[3] =3D AT91_CLK_PD_HW(at91sam9x5_pmc->chws[PMC_UTMI]); hw =3D at91_clk_register_master_pres(regmap, "masterck_pres", 4, - parent_names, NULL, + NULL, parent_data, &at91sam9x5_master_layout, &mck_characteristics, &mck_lock); if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_master_div(regmap, "masterck_div", - "masterck_pres", NULL, + hw =3D at91_clk_register_master_div(regmap, "masterck_div", NULL, + &AT91_CLK_PD_HW(hw), &at91sam9x5_master_layout, &mck_characteristics, &mck_lock, CLK_SET_RATE_GATE, 0); @@ -220,28 +223,28 @@ static void __init at91sam9x5_pmc_setup(struct device= _node *np, =20 at91sam9x5_pmc->chws[PMC_MCK] =3D hw; =20 - parent_names[0] =3D "plladivck"; - parent_names[1] =3D "utmick"; - hw =3D at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, NULL, 2= ); - if (IS_ERR(hw)) + parent_data[0] =3D AT91_CLK_PD_HW(at91sam9x5_pmc->chws[PMC_PLLACK]); + parent_data[1] =3D AT91_CLK_PD_HW(at91sam9x5_pmc->chws[PMC_UTMI]); + usbck_hw =3D at91sam9x5_clk_register_usb(regmap, "usbck", NULL, parent_da= ta, 2); + if (IS_ERR(usbck_hw)) goto err_free; =20 - hw =3D at91sam9x5_clk_register_smd(regmap, "smdclk", parent_names, NULL, = 2); - if (IS_ERR(hw)) + smdck_hw =3D at91sam9x5_clk_register_smd(regmap, "smdclk", NULL, parent_d= ata, 2); + if (IS_ERR(smdck_hw)) goto err_free; =20 - parent_names[0] =3D slck_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "plladivck"; - parent_names[3] =3D "utmick"; - parent_names[4] =3D "masterck_div"; + parent_data[0] =3D AT91_CLK_PD_NAME(slck_name); + parent_data[1] =3D AT91_CLK_PD_HW(at91sam9x5_pmc->chws[PMC_MAIN]); + parent_data[2] =3D AT91_CLK_PD_HW(at91sam9x5_pmc->chws[PMC_PLLACK]); + parent_data[3] =3D AT91_CLK_PD_HW(at91sam9x5_pmc->chws[PMC_UTMI]); + parent_data[4] =3D AT91_CLK_PD_HW(at91sam9x5_pmc->chws[PMC_MCK]); for (i =3D 0; i < 2; i++) { char name[6]; =20 snprintf(name, sizeof(name), "prog%d", i); =20 hw =3D at91_clk_register_programmable(regmap, name, - parent_names, NULL, 5, i, + NULL, parent_data, 5, i, &at91sam9x5_programmable_layout, NULL); if (IS_ERR(hw)) @@ -250,9 +253,16 @@ static void __init at91sam9x5_pmc_setup(struct device_= node *np, at91sam9x5_pmc->pchws[i] =3D hw; } =20 + /* Set systemck parent hws. */ + at91sam9x5_systemck[0].parent_hw =3D at91sam9x5_pmc->chws[PMC_MCK]; + at91sam9x5_systemck[1].parent_hw =3D smdck_hw; + at91sam9x5_systemck[2].parent_hw =3D usbck_hw; + at91sam9x5_systemck[3].parent_hw =3D usbck_hw; + at91sam9x5_systemck[4].parent_hw =3D at91sam9x5_pmc->pchws[0]; + at91sam9x5_systemck[5].parent_hw =3D at91sam9x5_pmc->pchws[1]; for (i =3D 0; i < ARRAY_SIZE(at91sam9x5_systemck); i++) { - hw =3D at91_clk_register_system(regmap, at91sam9x5_systemck[i].n, - at91sam9x5_systemck[i].p, NULL, + hw =3D at91_clk_register_system(regmap, at91sam9x5_systemck[i].n, NULL, + &AT91_CLK_PD_HW(at91sam9x5_systemck[i].parent_hw), at91sam9x5_systemck[i].id, at91sam9x5_systemck[i].flags); if (IS_ERR(hw)) @@ -262,8 +272,8 @@ static void __init at91sam9x5_pmc_setup(struct device_n= ode *np, } =20 if (has_lcdck) { - hw =3D at91_clk_register_system(regmap, "lcdck", "masterck_div", - NULL, 3, 0); + hw =3D at91_clk_register_system(regmap, "lcdck", NULL, + &AT91_CLK_PD_HW(at91sam9x5_pmc->chws[PMC_MCK]), 3, 0); if (IS_ERR(hw)) goto err_free; =20 @@ -274,7 +284,8 @@ static void __init at91sam9x5_pmc_setup(struct device_n= ode *np, hw =3D at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock, &at91sam9x5_pcr_layout, at91sam9x5_periphck[i].n, - "masterck_div", NULL, + NULL, + &AT91_CLK_PD_HW(at91sam9x5_pmc->chws[PMC_MCK]), at91sam9x5_periphck[i].id, &range, INT_MIN, 0); if (IS_ERR(hw)) @@ -287,7 +298,8 @@ static void __init at91sam9x5_pmc_setup(struct device_n= ode *np, hw =3D at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock, &at91sam9x5_pcr_layout, extra_pcks[i].n, - "masterck_div", NULL, + NULL, + &AT91_CLK_PD_HW(at91sam9x5_pmc->chws[PMC_MCK]), extra_pcks[i].id, &range, INT_MIN, 0); if (IS_ERR(hw)) --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77B203A4F57; Fri, 16 Jan 2026 20:07:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594059; cv=none; b=kkAR6RvtVllRh8WpJ+zLIRD9pVSolE/TjZiVlqx77lOHA4+HJ7Xs401ruH5tht5rGab/BgmNuYDXXoopi+7YIzL0eW+GwcxCSYt0vNgE6PQ2MUvF1aivsS+gIYcG+0TBsI6MgPD2icm0wxlehLns5xuHP8EoMeDQWCNJVYSaL1g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594059; c=relaxed/simple; bh=XOrLmDo0oGGZJwZMsl4Pm7e6/n02yWFCI7Nm5wQaK7M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ttYxXGq0WT8rl6L4cqjCiVNBpAzMJu6ybyPJcRYClkVOwS2/Qnor3X2otBXvtWZeYE+BxNh286VFWA45CiQhE9TAmpJfYNJoSpLIMjgJWzZXVypMmQeyQpBJLSYLmJuOJSaXHmONmY4HiXjkWdxZFqIzTpsiEC9KE4OxXDZ2wjI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=TAtgfqyo; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="TAtgfqyo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594056; x=1800130056; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XOrLmDo0oGGZJwZMsl4Pm7e6/n02yWFCI7Nm5wQaK7M=; b=TAtgfqyorbPBXEvOimB2D4KxNx9MAej3feX9LDxMV3ImFj/NHF2nsFSk 7udSXyzX7GZ5VdzDbnsfL0xiEGdZxb6YNsS150o4vPpToGHBuamaA+oB1 qjM3lao73owS5ONiAaQS+aPJ85KD+WFMCwxtMYWRZsIxmdURr4NwtQr5s /DtR+87DlppCwupvPbzhSpfOEDWQX2uw/VwGTcQpmwkdK4ls1JOrrc9aR khr6wuH39rze6qSddJjKWQlC7zt5U390iDpBvzEBrJuRVJ17IsZBV3TLG /kWg3cSuNBLb+96OzfLnNqdGGeRxKZTk4P65QfrI6eH5GdZUpaxDIx7tM w==; X-CSE-ConnectionGUID: OTooRcwrRNCxZBlF1StIPQ== X-CSE-MsgGUID: iEJe53QyQOa4M5YYxeqD2A== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="59042247" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2026 13:07:26 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex3.mchp-main.com (10.10.87.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.29; Fri, 16 Jan 2026 13:07:07 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:07 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 27/31] clk: at91: at91rm9200: switch to parent_hw and parent_data Date: Fri, 16 Jan 2026 13:07:20 -0700 Message-ID: <806fd8452ad32be1d129fd541b5cbd1be7fbb9f1.1768512290.git.ryan.wanner@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Switch AT91RM9200 clocks to use parent_hw and parent_data where possible. Having parent_hw instead of parent names improves to clock registration speed and re-parenting. Update clock registration functions to use clk_hw struct. Signed-off-by: Claudiu Beznea Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/at91rm9200.c | 79 ++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 33 deletions(-) diff --git a/drivers/clk/at91/at91rm9200.c b/drivers/clk/at91/at91rm9200.c index 623e232ec9c6..20bb51ec683f 100644 --- a/drivers/clk/at91/at91rm9200.c +++ b/drivers/clk/at91/at91rm9200.c @@ -11,7 +11,7 @@ static DEFINE_SPINLOCK(rm9200_mck_lock); =20 struct sck { char *n; - char *p; + struct clk_hw *parent_hw; u8 id; }; =20 @@ -39,13 +39,13 @@ static const struct clk_pll_characteristics rm9200_pll_= characteristics =3D { .out =3D rm9200_pll_out, }; =20 -static const struct sck at91rm9200_systemck[] =3D { - { .n =3D "udpck", .p =3D "usbck", .id =3D 1 }, - { .n =3D "uhpck", .p =3D "usbck", .id =3D 4 }, - { .n =3D "pck0", .p =3D "prog0", .id =3D 8 }, - { .n =3D "pck1", .p =3D "prog1", .id =3D 9 }, - { .n =3D "pck2", .p =3D "prog2", .id =3D 10 }, - { .n =3D "pck3", .p =3D "prog3", .id =3D 11 }, +static struct sck at91rm9200_systemck[] =3D { + { .n =3D "udpck", .id =3D 1 }, + { .n =3D "uhpck", .id =3D 4 }, + { .n =3D "pck0", .id =3D 8 }, + { .n =3D "pck1", .id =3D 9 }, + { .n =3D "pck2", .id =3D 10 }, + { .n =3D "pck3", .id =3D 11 }, }; =20 static const struct pck at91rm9200_periphck[] =3D { @@ -77,11 +77,11 @@ static const struct pck at91rm9200_periphck[] =3D { static void __init at91rm9200_pmc_setup(struct device_node *np) { const char *slowxtal_name, *mainxtal_name; + struct clk_hw *usbck_hw, *main_osc_hw, *hw; + struct clk_parent_data parent_data[6]; struct pmc_data *at91rm9200_pmc; u32 usb_div[] =3D { 1, 2, 0, 0 }; - const char *parent_names[6]; struct regmap *regmap; - struct clk_hw *hw; int i; bool bypass; =20 @@ -108,18 +108,21 @@ static void __init at91rm9200_pmc_setup(struct device= _node *np) =20 bypass =3D of_property_read_bool(np, "atmel,osc-bypass"); =20 - hw =3D at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL, - bypass); - if (IS_ERR(hw)) + main_osc_hw =3D at91_clk_register_main_osc(regmap, "main_osc", NULL, + &AT91_CLK_PD_NAME(mainxtal_name), + bypass); + if (IS_ERR(main_osc_hw)) goto err_free; =20 - hw =3D at91_clk_register_rm9200_main(regmap, "mainck", "main_osc", NULL); + hw =3D at91_clk_register_rm9200_main(regmap, "mainck", NULL, + &AT91_CLK_PD_HW(main_osc_hw)); if (IS_ERR(hw)) goto err_free; =20 at91rm9200_pmc->chws[PMC_MAIN] =3D hw; =20 - hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, + hw =3D at91_clk_register_pll(regmap, "pllack", NULL, + &AT91_CLK_PD_HW(at91rm9200_pmc->chws[PMC_MAIN]), 0, &at91rm9200_pll_layout, &rm9200_pll_characteristics); if (IS_ERR(hw)) @@ -127,7 +130,8 @@ static void __init at91rm9200_pmc_setup(struct device_n= ode *np) =20 at91rm9200_pmc->chws[PMC_PLLACK] =3D hw; =20 - hw =3D at91_clk_register_pll(regmap, "pllbck", "mainck", NULL, 1, + hw =3D at91_clk_register_pll(regmap, "pllbck", NULL, + &AT91_CLK_PD_HW(at91rm9200_pmc->chws[PMC_MAIN]), 1, &at91rm9200_pll_layout, &rm9200_pll_characteristics); if (IS_ERR(hw)) @@ -135,20 +139,19 @@ static void __init at91rm9200_pmc_setup(struct device= _node *np) =20 at91rm9200_pmc->chws[PMC_PLLBCK] =3D hw; =20 - parent_names[0] =3D slowxtal_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "pllack"; - parent_names[3] =3D "pllbck"; + parent_data[0] =3D AT91_CLK_PD_NAME(slowxtal_name); + parent_data[1] =3D AT91_CLK_PD_HW(at91rm9200_pmc->chws[PMC_MAIN]); + parent_data[2] =3D AT91_CLK_PD_HW(at91rm9200_pmc->chws[PMC_PLLACK]); + parent_data[3] =3D AT91_CLK_PD_HW(at91rm9200_pmc->chws[PMC_PLLBCK]); hw =3D at91_clk_register_master_pres(regmap, "masterck_pres", 4, - parent_names, NULL, + NULL, parent_data, &at91rm9200_master_layout, &rm9200_mck_characteristics, &rm9200_mck_lock); if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_master_div(regmap, "masterck_div", - "masterck_pres", NULL, + hw =3D at91_clk_register_master_div(regmap, "masterck_div", NULL, &AT91_C= LK_PD_HW(hw), &at91rm9200_master_layout, &rm9200_mck_characteristics, &rm9200_mck_lock, CLK_SET_RATE_GATE, 0); @@ -157,21 +160,23 @@ static void __init at91rm9200_pmc_setup(struct device= _node *np) =20 at91rm9200_pmc->chws[PMC_MCK] =3D hw; =20 - hw =3D at91rm9200_clk_register_usb(regmap, "usbck", "pllbck", NULL, usb_d= iv); - if (IS_ERR(hw)) + usbck_hw =3D at91rm9200_clk_register_usb(regmap, "usbck", NULL, + &AT91_CLK_PD_HW(at91rm9200_pmc->chws[PMC_PLLBCK]), + usb_div); + if (IS_ERR(usbck_hw)) goto err_free; =20 - parent_names[0] =3D slowxtal_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "pllack"; - parent_names[3] =3D "pllbck"; + parent_data[0] =3D AT91_CLK_PD_NAME(slowxtal_name); + parent_data[1] =3D AT91_CLK_PD_HW(at91rm9200_pmc->chws[PMC_MAIN]); + parent_data[2] =3D AT91_CLK_PD_HW(at91rm9200_pmc->chws[PMC_PLLACK]); + parent_data[3] =3D AT91_CLK_PD_HW(at91rm9200_pmc->chws[PMC_PLLBCK]); for (i =3D 0; i < 4; i++) { char name[6]; =20 snprintf(name, sizeof(name), "prog%d", i); =20 hw =3D at91_clk_register_programmable(regmap, name, - parent_names, NULL, 4, i, + NULL, parent_data, 4, i, &at91rm9200_programmable_layout, NULL); if (IS_ERR(hw)) @@ -180,9 +185,16 @@ static void __init at91rm9200_pmc_setup(struct device_= node *np) at91rm9200_pmc->pchws[i] =3D hw; } =20 + /* Set systemck parent hws. */ + at91rm9200_systemck[0].parent_hw =3D usbck_hw; + at91rm9200_systemck[1].parent_hw =3D usbck_hw; + at91rm9200_systemck[2].parent_hw =3D at91rm9200_pmc->pchws[0]; + at91rm9200_systemck[3].parent_hw =3D at91rm9200_pmc->pchws[1]; + at91rm9200_systemck[4].parent_hw =3D at91rm9200_pmc->pchws[2]; + at91rm9200_systemck[5].parent_hw =3D at91rm9200_pmc->pchws[3]; for (i =3D 0; i < ARRAY_SIZE(at91rm9200_systemck); i++) { - hw =3D at91_clk_register_system(regmap, at91rm9200_systemck[i].n, - at91rm9200_systemck[i].p, NULL, + hw =3D at91_clk_register_system(regmap, at91rm9200_systemck[i].n, NULL, + &AT91_CLK_PD_HW(at91rm9200_systemck[i].parent_hw), at91rm9200_systemck[i].id, 0); if (IS_ERR(hw)) goto err_free; @@ -193,7 +205,8 @@ static void __init at91rm9200_pmc_setup(struct device_n= ode *np) for (i =3D 0; i < ARRAY_SIZE(at91rm9200_periphck); i++) { hw =3D at91_clk_register_peripheral(regmap, at91rm9200_periphck[i].n, - "masterck_div", NULL, + NULL, + &AT91_CLK_PD_HW(at91rm9200_pmc->chws[PMC_MCK]), at91rm9200_periphck[i].id); if (IS_ERR(hw)) goto err_free; --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB6F03A4ACD; Fri, 16 Jan 2026 20:07:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594070; cv=none; b=lY9niYrHeqxv0TUIFmmF6qgvYb7P5QhLxMT7VCzMHeq0ZkN/P7W1T7nbCCmtekQjKFmdeIisc73Zfrsi97Jy9YMo2aMm6Q6hli7UJ8cpZhxmXbha3huA80EsK/InY7U4hXiJmB4Rv4bfgu3ssJNwCUsk5rBu0qBTca3oQ218raA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594070; c=relaxed/simple; bh=dt+T948wX97vg/vmfUsrTxDMSjFhznKN58WgJltEYkk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PFQ2S0aE0r+TmCAqXdFeIY0EFYi4ERd6NxO+CahnrKa4euQW33ZCAymGfCJLf+/wNx3yGXvECLn2qQIrkg+HE75Zc7tJEgR+J9p8qN/bwwwZJrmw0PzQkgk1vYXLc004sThdSi40EmtlSufe8Oh7qgRLurzK6ic55waWzLomfzE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=wni/Hcj5; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="wni/Hcj5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594067; x=1800130067; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dt+T948wX97vg/vmfUsrTxDMSjFhznKN58WgJltEYkk=; b=wni/Hcj5Unx4wKfIIwGz5rpEkgH5Bhb17Pw2kIJ37AeUcuYDvaqcfvv3 EvLcJEF8NbCXcdPdGlrUIiJVmCxFK6dUonjkR5E18nCD0hqK3NPuQr0T8 s28j+/SZplXaJ39MdqBDdYTe3sSnm+EvhCqoDY50Wfd++YIyiuXeX7vsW uPFb2WOCQwyArozX5WRYdY6c48Xydy0BzQdrzQJiBBkC65iWz1W0vkCgL zaxXabafKMgiGeXopnceXGOjGeu6tcahaxqP+TJ2EIg/jq6Xk2UEOQiJ+ iQOgSmbAb6JYIvP4DXyHRSbBrJ5Nx69FMblZe6/LVh15kYOBDODWRarni w==; X-CSE-ConnectionGUID: 3LvvvroxTJyR6T9mab+TNA== X-CSE-MsgGUID: K3gRkQ68SKm7S9kIC9BQWA== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="51290373" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Jan 2026 13:07:35 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Fri, 16 Jan 2026 13:07:07 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:07 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 28/31] clk: at91: at91sam9260: switch to parent_hw and parent_data Date: Fri, 16 Jan 2026 13:07:21 -0700 Message-ID: <76dfa9949ebe73621790f62752d6fc77954198b5.1768512290.git.ryan.wanner@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Switch AT91SAM92600 clocks to use parent_hw and parent_data where possible. Having parent_hw instead of parent names improves to clock registration speed and re-parenting. Update the clock registration functions to use clk_hw struct. Signed-off-by: Claudiu Beznea Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/at91sam9260.c | 119 +++++++++++++++++++-------------- 1 file changed, 68 insertions(+), 51 deletions(-) diff --git a/drivers/clk/at91/at91sam9260.c b/drivers/clk/at91/at91sam9260.c index 55350331b07e..c98145e17e80 100644 --- a/drivers/clk/at91/at91sam9260.c +++ b/drivers/clk/at91/at91sam9260.c @@ -9,7 +9,7 @@ =20 struct sck { char *n; - char *p; + struct clk_hw *parent_hw; u8 id; }; =20 @@ -24,7 +24,7 @@ struct at91sam926x_data { const struct clk_pll_layout *pllb_layout; const struct clk_pll_characteristics *pllb_characteristics; const struct clk_master_characteristics *mck_characteristics; - const struct sck *sck; + struct sck *sck; const struct pck *pck; u8 num_sck; u8 num_pck; @@ -72,11 +72,11 @@ static const struct clk_pll_characteristics sam9260_pll= b_characteristics =3D { .out =3D sam9260_pllb_out, }; =20 -static const struct sck at91sam9260_systemck[] =3D { - { .n =3D "uhpck", .p =3D "usbck", .id =3D 6 }, - { .n =3D "udpck", .p =3D "usbck", .id =3D 7 }, - { .n =3D "pck0", .p =3D "prog0", .id =3D 8 }, - { .n =3D "pck1", .p =3D "prog1", .id =3D 9 }, +static struct sck at91sam9260_systemck[] =3D { + { .n =3D "uhpck", .id =3D 6 }, + { .n =3D "udpck", .id =3D 7 }, + { .n =3D "pck0", .id =3D 8 }, + { .n =3D "pck1", .id =3D 9 }, }; =20 static const struct pck at91sam9260_periphck[] =3D { @@ -213,15 +213,15 @@ static const struct clk_pll_characteristics sam9261_p= llb_characteristics =3D { .out =3D sam9261_pllb_out, }; =20 -static const struct sck at91sam9261_systemck[] =3D { - { .n =3D "uhpck", .p =3D "usbck", .id =3D 6 }, - { .n =3D "udpck", .p =3D "usbck", .id =3D 7 }, - { .n =3D "pck0", .p =3D "prog0", .id =3D 8 }, - { .n =3D "pck1", .p =3D "prog1", .id =3D 9 }, - { .n =3D "pck2", .p =3D "prog2", .id =3D 10 }, - { .n =3D "pck3", .p =3D "prog3", .id =3D 11 }, - { .n =3D "hclk0", .p =3D "masterck_div", .id =3D 16 }, - { .n =3D "hclk1", .p =3D "masterck_div", .id =3D 17 }, +static struct sck at91sam9261_systemck[] =3D { + { .n =3D "uhpck", .id =3D 6 }, + { .n =3D "udpck", .id =3D 7 }, + { .n =3D "pck0", .id =3D 8 }, + { .n =3D "pck1", .id =3D 9 }, + { .n =3D "pck2", .id =3D 10 }, + { .n =3D "pck3", .id =3D 11 }, + { .n =3D "hclk0", .id =3D 16 }, + { .n =3D "hclk1", .id =3D 17 }, }; =20 static const struct pck at91sam9261_periphck[] =3D { @@ -277,13 +277,13 @@ static const struct clk_pll_characteristics sam9263_p= ll_characteristics =3D { .out =3D sam9260_plla_out, }; =20 -static const struct sck at91sam9263_systemck[] =3D { - { .n =3D "uhpck", .p =3D "usbck", .id =3D 6 }, - { .n =3D "udpck", .p =3D "usbck", .id =3D 7 }, - { .n =3D "pck0", .p =3D "prog0", .id =3D 8 }, - { .n =3D "pck1", .p =3D "prog1", .id =3D 9 }, - { .n =3D "pck2", .p =3D "prog2", .id =3D 10 }, - { .n =3D "pck3", .p =3D "prog3", .id =3D 11 }, +static struct sck at91sam9263_systemck[] =3D { + { .n =3D "uhpck", .id =3D 6 }, + { .n =3D "udpck", .id =3D 7 }, + { .n =3D "pck0", .id =3D 8 }, + { .n =3D "pck1", .id =3D 9 }, + { .n =3D "pck2", .id =3D 10 }, + { .n =3D "pck3", .id =3D 11 }, }; =20 static const struct pck at91sam9263_periphck[] =3D { @@ -329,13 +329,12 @@ static struct at91sam926x_data at91sam9263_data =3D { static void __init at91sam926x_pmc_setup(struct device_node *np, struct at91sam926x_data *data) { - const char *slowxtal_name, *mainxtal_name; + const char *slowxtal_name, *slck_name, *mainxtal_name; + struct clk_parent_data parent_data[4]; struct pmc_data *at91sam9260_pmc; u32 usb_div[] =3D { 1, 2, 4, 0 }; - const char *parent_names[6]; - const char *slck_name; + struct clk_hw *usbck_hw, *hw; struct regmap *regmap; - struct clk_hw *hw; int i; bool bypass; =20 @@ -363,12 +362,13 @@ static void __init at91sam926x_pmc_setup(struct devic= e_node *np, =20 bypass =3D of_property_read_bool(np, "atmel,osc-bypass"); =20 - hw =3D at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL, + hw =3D at91_clk_register_main_osc(regmap, "main_osc", NULL, + &AT91_CLK_PD_NAME(mainxtal_name), bypass); if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_rm9200_main(regmap, "mainck", "main_osc", NULL); + hw =3D at91_clk_register_rm9200_main(regmap, "mainck", NULL, &AT91_CLK_PD= _HW(hw)); if (IS_ERR(hw)) goto err_free; =20 @@ -382,10 +382,9 @@ static void __init at91sam926x_pmc_setup(struct device= _node *np, if (IS_ERR(hw)) goto err_free; =20 - parent_names[0] =3D "slow_rc_osc"; - parent_names[1] =3D "slow_xtal"; - hw =3D at91_clk_register_sam9260_slow(regmap, "slck", - parent_names, NULL, 2); + parent_data[0] =3D AT91_CLK_PD_HW(hw); + parent_data[1] =3D AT91_CLK_PD_NAME(slowxtal_name); + hw =3D at91_clk_register_sam9260_slow(regmap, "slck", NULL, parent_data,= 2); if (IS_ERR(hw)) goto err_free; =20 @@ -395,7 +394,8 @@ static void __init at91sam926x_pmc_setup(struct device_= node *np, slck_name =3D slowxtal_name; } =20 - hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, + hw =3D at91_clk_register_pll(regmap, "pllack", NULL, + &AT91_CLK_PD_HW(at91sam9260_pmc->chws[PMC_MAIN]), 0, data->plla_layout, data->plla_characteristics); if (IS_ERR(hw)) @@ -403,7 +403,8 @@ static void __init at91sam926x_pmc_setup(struct device_= node *np, =20 at91sam9260_pmc->chws[PMC_PLLACK] =3D hw; =20 - hw =3D at91_clk_register_pll(regmap, "pllbck", "mainck", NULL, 1, + hw =3D at91_clk_register_pll(regmap, "pllbck", NULL, + &AT91_CLK_PD_HW(at91sam9260_pmc->chws[PMC_MAIN]), 1, data->pllb_layout, data->pllb_characteristics); if (IS_ERR(hw)) @@ -411,12 +412,12 @@ static void __init at91sam926x_pmc_setup(struct devic= e_node *np, =20 at91sam9260_pmc->chws[PMC_PLLBCK] =3D hw; =20 - parent_names[0] =3D slck_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "pllack"; - parent_names[3] =3D "pllbck"; + parent_data[0] =3D AT91_CLK_PD_NAME(slck_name); + parent_data[1] =3D AT91_CLK_PD_HW(at91sam9260_pmc->chws[PMC_MAIN]); + parent_data[2] =3D AT91_CLK_PD_HW(at91sam9260_pmc->chws[PMC_PLLACK]); + parent_data[3] =3D AT91_CLK_PD_HW(at91sam9260_pmc->chws[PMC_PLLACK]); hw =3D at91_clk_register_master_pres(regmap, "masterck_pres", 4, - parent_names, NULL, + NULL, parent_data, &at91rm9200_master_layout, data->mck_characteristics, &at91sam9260_mck_lock); @@ -424,7 +425,7 @@ static void __init at91sam926x_pmc_setup(struct device_= node *np, goto err_free; =20 hw =3D at91_clk_register_master_div(regmap, "masterck_div", - "masterck_pres", NULL, + NULL, &AT91_CLK_PD_HW(hw), &at91rm9200_master_layout, data->mck_characteristics, &at91sam9260_mck_lock, @@ -434,21 +435,23 @@ static void __init at91sam926x_pmc_setup(struct devic= e_node *np, =20 at91sam9260_pmc->chws[PMC_MCK] =3D hw; =20 - hw =3D at91rm9200_clk_register_usb(regmap, "usbck", "pllbck", NULL, usb_d= iv); - if (IS_ERR(hw)) + usbck_hw =3D at91rm9200_clk_register_usb(regmap, "usbck", NULL, + &AT91_CLK_PD_HW(at91sam9260_pmc->chws[PMC_PLLBCK]), + usb_div); + if (IS_ERR(usbck_hw)) goto err_free; =20 - parent_names[0] =3D slck_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "pllack"; - parent_names[3] =3D "pllbck"; + parent_data[0] =3D AT91_CLK_PD_NAME(slck_name); + parent_data[1] =3D AT91_CLK_PD_HW(at91sam9260_pmc->chws[PMC_MAIN]); + parent_data[2] =3D AT91_CLK_PD_HW(at91sam9260_pmc->chws[PMC_PLLACK]); + parent_data[3] =3D AT91_CLK_PD_HW(at91sam9260_pmc->chws[PMC_PLLBCK]); for (i =3D 0; i < data->num_progck; i++) { char name[6]; =20 snprintf(name, sizeof(name), "prog%d", i); =20 hw =3D at91_clk_register_programmable(regmap, name, - parent_names, NULL, 4, i, + NULL, parent_data, 4, i, &at91rm9200_programmable_layout, NULL); if (IS_ERR(hw)) @@ -457,9 +460,22 @@ static void __init at91sam926x_pmc_setup(struct device= _node *np, at91sam9260_pmc->pchws[i] =3D hw; } =20 + /* Set systemck parent hws. */ + data->sck[0].parent_hw =3D usbck_hw; + data->sck[1].parent_hw =3D usbck_hw; + data->sck[2].parent_hw =3D at91sam9260_pmc->pchws[0]; + data->sck[3].parent_hw =3D at91sam9260_pmc->pchws[1]; + if (data->num_sck =3D=3D 6) { + data->sck[4].parent_hw =3D at91sam9260_pmc->pchws[2]; + data->sck[5].parent_hw =3D at91sam9260_pmc->pchws[3]; + } + if (data->num_sck =3D=3D 8) { + data->sck[6].parent_hw =3D at91sam9260_pmc->chws[PMC_MCK]; + data->sck[7].parent_hw =3D at91sam9260_pmc->chws[PMC_MCK]; + } for (i =3D 0; i < data->num_sck; i++) { - hw =3D at91_clk_register_system(regmap, data->sck[i].n, - data->sck[i].p, NULL, + hw =3D at91_clk_register_system(regmap, data->sck[i].n, NULL, + &AT91_CLK_PD_HW(data->sck[i].parent_hw), data->sck[i].id, 0); if (IS_ERR(hw)) goto err_free; @@ -470,7 +486,8 @@ static void __init at91sam926x_pmc_setup(struct device_= node *np, for (i =3D 0; i < data->num_pck; i++) { hw =3D at91_clk_register_peripheral(regmap, data->pck[i].n, - "masterck_div", NULL, + NULL, + &AT91_CLK_PD_HW(at91sam9260_pmc->chws[PMC_MCK]), data->pck[i].id); if (IS_ERR(hw)) goto err_free; --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0532A3A4ACC; Fri, 16 Jan 2026 20:07:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594070; cv=none; b=sgBlJl2moMtSCzb63D0tKF5BklFHZQx5q+vstcsiY5H+bRJV20fnTKC4Y0xm90xmXtJhzr8JO4PpgbtcCk/Ycj7GizVNvWeF8maq3IBkWYUu0EjNJECXXr2b1ToHI4F4uxJFjWaOfzG/lGcEkAONys/JRNLg+G+jK0WHYyQRzi4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594070; c=relaxed/simple; bh=yumqZTJwDBxAGa5DbwJo5mSLeX3jA54yKOI85jWAzfc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Zw9Zg/Z0ARU4ds2eDs8+9fNNdfyfR65f1MTXAmcRTZJ2E4uzor5sbevZUpYjEMwao+qGBN+xmcuf8Thzf2lMuEuFaT/B4Wiq82H7q0GN1gyUVjQa+rWG1xwhEBGKfHdHCOqK03JV2gyvs3Ll4/ROmXkQxd0pkNWl9nlIfKxiCFE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=Bxuz3LWu; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="Bxuz3LWu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594067; x=1800130067; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yumqZTJwDBxAGa5DbwJo5mSLeX3jA54yKOI85jWAzfc=; b=Bxuz3LWu8B7+av/WoUD+hPfPWiEWHRd79OsidhHAJzOceWdtWOZeOL3m q5wgkRixfEy6kmuiWzmqRf7/CQN861nh0Bd3uZ+fu+rIqSKx9Pw+89X5d o3Vg0aG1kgNOQCklUsKp/FbRFokgYdx4Vlisx/tNJHTk389wBeSKv9KxK od8gcOfv/JIhUwBNFJG+KCmdNa85iKEkWVTwz5ZTS/1XAkc8w8x1T61+6 av8q99vB8iMV8YgrvqEb6v12dK6/h0yJi6EOMd3jE8GzPrBBmSMkwQF2S ZXMCHlL/bDr8CMlGPyHdCOluW1AY0+83cwZNBLxUyIGqfUY/Os2WcAlEw Q==; X-CSE-ConnectionGUID: 3LvvvroxTJyR6T9mab+TNA== X-CSE-MsgGUID: PB9qj7k7SOmhVkn2UmKP4A== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="51290376" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Jan 2026 13:07:36 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Fri, 16 Jan 2026 13:07:08 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:07 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 29/31] clk: at91: at91sam9g45: switch to parent_data and parent_hw Date: Fri, 16 Jan 2026 13:07:22 -0700 Message-ID: <8ea67feaf45ddcaa32eab27c3b6716368979e198.1768512290.git.ryan.wanner@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Switch AT91SAM9G45 clocks to use parent_hw and parent_data. Having parent_data instead of parent names improves to clock registration speed and re-parenting. Signed-off-by: Claudiu Beznea Signed-off-by: Ryan Wanner --- drivers/clk/at91/at91sam9g45.c | 73 +++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/drivers/clk/at91/at91sam9g45.c b/drivers/clk/at91/at91sam9g45.c index cb98d22c2e30..b74e2dee8e4c 100644 --- a/drivers/clk/at91/at91sam9g45.c +++ b/drivers/clk/at91/at91sam9g45.c @@ -37,9 +37,9 @@ static const struct clk_pll_characteristics plla_characte= ristics =3D { .out =3D plla_out, }; =20 -static const struct { +static struct { char *n; - char *p; + struct clk_hw *parent_hw; unsigned long flags; u8 id; } at91sam9g45_systemck[] =3D { @@ -47,10 +47,10 @@ static const struct { * ddrck feeds DDR controller and is enabled by bootloader thus we need * to keep it enabled in case there is no Linux consumer for it. */ - { .n =3D "ddrck", .p =3D "masterck_div", .id =3D 2, .flags =3D CLK_IS_CRI= TICAL }, - { .n =3D "uhpck", .p =3D "usbck", .id =3D 6 }, - { .n =3D "pck0", .p =3D "prog0", .id =3D 8 }, - { .n =3D "pck1", .p =3D "prog1", .id =3D 9 }, + { .n =3D "ddrck", .id =3D 2, .flags =3D CLK_IS_CRITICAL }, + { .n =3D "uhpck", .id =3D 6 }, + { .n =3D "pck0", .id =3D 8 }, + { .n =3D "pck1", .id =3D 9 }, }; =20 struct pck { @@ -93,10 +93,10 @@ static const struct pck at91sam9g45_periphck[] =3D { static void __init at91sam9g45_pmc_setup(struct device_node *np) { const char *slck_name, *mainxtal_name; + struct clk_parent_data parent_data[5]; struct pmc_data *at91sam9g45_pmc; - const char *parent_names[6]; + struct clk_hw *usbck_hw, *hw; struct regmap *regmap; - struct clk_hw *hw; int i; bool bypass; =20 @@ -123,40 +123,43 @@ static void __init at91sam9g45_pmc_setup(struct devic= e_node *np) =20 bypass =3D of_property_read_bool(np, "atmel,osc-bypass"); =20 - hw =3D at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL, + hw =3D at91_clk_register_main_osc(regmap, "main_osc", NULL, + &AT91_CLK_PD_NAME(mainxtal_name), bypass); if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_rm9200_main(regmap, "mainck", "main_osc", NULL); + hw =3D at91_clk_register_rm9200_main(regmap, "mainck", NULL, &AT91_CLK_PD= _HW(hw)); if (IS_ERR(hw)) goto err_free; =20 at91sam9g45_pmc->chws[PMC_MAIN] =3D hw; =20 - hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, + hw =3D at91_clk_register_pll(regmap, "pllack", NULL, + &AT91_CLK_PD_HW(at91sam9g45_pmc->chws[PMC_MAIN]), 0, &at91rm9200_pll_layout, &plla_characteristics); if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL); + hw =3D at91_clk_register_plldiv(regmap, "plladivck", NULL, &AT91_CLK_PD_H= W(hw)); if (IS_ERR(hw)) goto err_free; =20 at91sam9g45_pmc->chws[PMC_PLLACK] =3D hw; =20 - hw =3D at91_clk_register_utmi(regmap, NULL, "utmick", "mainck", NULL); + hw =3D at91_clk_register_utmi(regmap, NULL, "utmick", NULL, + &AT91_CLK_PD_HW(at91sam9g45_pmc->chws[PMC_MAIN])); if (IS_ERR(hw)) goto err_free; =20 at91sam9g45_pmc->chws[PMC_UTMI] =3D hw; =20 - parent_names[0] =3D slck_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "plladivck"; - parent_names[3] =3D "utmick"; + parent_data[0] =3D AT91_CLK_PD_NAME(slck_name); + parent_data[1] =3D AT91_CLK_PD_HW(at91sam9g45_pmc->chws[PMC_MAIN]); + parent_data[2] =3D AT91_CLK_PD_HW(at91sam9g45_pmc->chws[PMC_PLLACK]); + parent_data[3] =3D AT91_CLK_PD_HW(at91sam9g45_pmc->chws[PMC_UTMI]); hw =3D at91_clk_register_master_pres(regmap, "masterck_pres", 4, - parent_names, NULL, + NULL, parent_data, &at91rm9200_master_layout, &mck_characteristics, &at91sam9g45_mck_lock); @@ -164,7 +167,7 @@ static void __init at91sam9g45_pmc_setup(struct device_= node *np) goto err_free; =20 hw =3D at91_clk_register_master_div(regmap, "masterck_div", - "masterck_pres", NULL, + NULL, &AT91_CLK_PD_HW(hw), &at91rm9200_master_layout, &mck_characteristics, &at91sam9g45_mck_lock, @@ -174,24 +177,24 @@ static void __init at91sam9g45_pmc_setup(struct devic= e_node *np) =20 at91sam9g45_pmc->chws[PMC_MCK] =3D hw; =20 - parent_names[0] =3D "plladivck"; - parent_names[1] =3D "utmick"; - hw =3D at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, NULL, 2= ); - if (IS_ERR(hw)) + parent_data[0] =3D AT91_CLK_PD_HW(at91sam9g45_pmc->chws[PMC_PLLACK]); + parent_data[1] =3D AT91_CLK_PD_HW(at91sam9g45_pmc->chws[PMC_UTMI]); + usbck_hw =3D at91sam9x5_clk_register_usb(regmap, "usbck", NULL, parent_da= ta, 2); + if (IS_ERR(usbck_hw)) goto err_free; =20 - parent_names[0] =3D slck_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "plladivck"; - parent_names[3] =3D "utmick"; - parent_names[4] =3D "masterck_div"; + parent_data[0] =3D AT91_CLK_PD_NAME(slck_name); + parent_data[1] =3D AT91_CLK_PD_HW(at91sam9g45_pmc->chws[PMC_MAIN]); + parent_data[2] =3D AT91_CLK_PD_HW(at91sam9g45_pmc->chws[PMC_PLLACK]); + parent_data[3] =3D AT91_CLK_PD_HW(at91sam9g45_pmc->chws[PMC_UTMI]); + parent_data[4] =3D AT91_CLK_PD_HW(at91sam9g45_pmc->chws[PMC_MCK]); for (i =3D 0; i < 2; i++) { char name[6]; =20 snprintf(name, sizeof(name), "prog%d", i); =20 hw =3D at91_clk_register_programmable(regmap, name, - parent_names, NULL, 5, i, + NULL, parent_data, 5, i, &at91sam9g45_programmable_layout, NULL); if (IS_ERR(hw)) @@ -200,9 +203,14 @@ static void __init at91sam9g45_pmc_setup(struct device= _node *np) at91sam9g45_pmc->pchws[i] =3D hw; } =20 + /* Set systemck parent hws. */ + at91sam9g45_systemck[0].parent_hw =3D at91sam9g45_pmc->chws[PMC_MCK]; + at91sam9g45_systemck[1].parent_hw =3D usbck_hw; + at91sam9g45_systemck[2].parent_hw =3D at91sam9g45_pmc->pchws[0]; + at91sam9g45_systemck[3].parent_hw =3D at91sam9g45_pmc->pchws[1]; for (i =3D 0; i < ARRAY_SIZE(at91sam9g45_systemck); i++) { - hw =3D at91_clk_register_system(regmap, at91sam9g45_systemck[i].n, - at91sam9g45_systemck[i].p, NULL, + hw =3D at91_clk_register_system(regmap, at91sam9g45_systemck[i].n, NULL, + &AT91_CLK_PD_HW(at91sam9g45_systemck[i].parent_hw), at91sam9g45_systemck[i].id, at91sam9g45_systemck[i].flags); if (IS_ERR(hw)) @@ -214,7 +222,8 @@ static void __init at91sam9g45_pmc_setup(struct device_= node *np) for (i =3D 0; i < ARRAY_SIZE(at91sam9g45_periphck); i++) { hw =3D at91_clk_register_peripheral(regmap, at91sam9g45_periphck[i].n, - "masterck_div", NULL, + NULL, + &AT91_CLK_PD_HW(at91sam9g45_pmc->chws[PMC_MCK]), at91sam9g45_periphck[i].id); if (IS_ERR(hw)) goto err_free; --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C40A3AA196; Fri, 16 Jan 2026 20:07:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594072; cv=none; b=NPu0qkcn4PIQTODKLqNyo8TqW6LtZBxeFY2+RZN60aOcQoEZqDHyFBIo0Ff0tQUZrwW7b+PohQulTcCWOIXj58GNylZ/ze1p8vOy6dtTZ4DXBHK8MMIQBV6I/tgiGoqDBvavLSi5Hvt0bHJkVcd1Qna+guBkDZe7I5AHqNbKb6I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594072; c=relaxed/simple; bh=uTkFVJoez1/J0P1G+rNdaomAw0JniamhmbMDOed+tkE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NhzVaZa51LPGhovDt1vlAKIiP3KOZuRp7Cn9WY6IYPgJ/8A32OfqbfT0dNisNafVph0OjGP47Vf2BxJf77l8+lQbt7ZaVPDI6erlHES29BFWKPXSyw0GdTcTDL/5mdKWgXAh5gj42mThnD/oNGTrwNwhlXr7q6BkXblhhe/0vzc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=k9ydaWov; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="k9ydaWov" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594068; x=1800130068; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uTkFVJoez1/J0P1G+rNdaomAw0JniamhmbMDOed+tkE=; b=k9ydaWovPxkw2sYNEtD2YbFA3cGcM7GmF0c0EFQJG2OveX1p10GqOfNw S6gOT2cUsD24kcR1Ep3dxE5TIaxqHxZcYl5xejljtGfVIPusaDjkerbrm h+iyjz0sd3GLmXR3Q2o/diegJlq4ZzkEfvF7bZxiPKyxiPtKAtHZ3zzpr PgEmN7RWiS0LG71BWvcyc16FY5CmVD2PL4V+hicX4Cmm4z/YT0MvAGkyE t4VFPkErQJk4vqjdKdczKYXOQiwsEMNJQx84Bfl1cqayjL5fxjPXl/80S uwlQjmOYTDllJLX5B0RCdPzu6CaymU8YqCDgPpUqiyVDrIq6fao+yElXt Q==; X-CSE-ConnectionGUID: 3LvvvroxTJyR6T9mab+TNA== X-CSE-MsgGUID: SrpWOxkmQI2dHwO2ucF53A== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="51290379" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Jan 2026 13:07:36 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Fri, 16 Jan 2026 13:07:08 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:08 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 30/31] clk: at91: at91sam9n12: switch to parent_hw and parent_data Date: Fri, 16 Jan 2026 13:07:23 -0700 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Switch AT91SAM9N12 clocks to use parent_hw and parent_data. Having parent_hw instead of parent names improves to clock registration speed and re-parenting. Signed-off-by: Claudiu Beznea Signed-off-by: Ryan Wanner --- drivers/clk/at91/at91sam9n12.c | 90 +++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 39 deletions(-) diff --git a/drivers/clk/at91/at91sam9n12.c b/drivers/clk/at91/at91sam9n12.c index 34dd7645f964..87c28d34f98d 100644 --- a/drivers/clk/at91/at91sam9n12.c +++ b/drivers/clk/at91/at91sam9n12.c @@ -51,9 +51,9 @@ static const struct clk_pll_characteristics pllb_characte= ristics =3D { .out =3D pllb_out, }; =20 -static const struct { +static struct { char *n; - char *p; + struct clk_hw *parent_hw; unsigned long flags; u8 id; } at91sam9n12_systemck[] =3D { @@ -61,12 +61,12 @@ static const struct { * ddrck feeds DDR controller and is enabled by bootloader thus we need * to keep it enabled in case there is no Linux consumer for it. */ - { .n =3D "ddrck", .p =3D "masterck_div", .id =3D 2, .flags =3D CLK_IS_CRI= TICAL }, - { .n =3D "lcdck", .p =3D "masterck_div", .id =3D 3 }, - { .n =3D "uhpck", .p =3D "usbck", .id =3D 6 }, - { .n =3D "udpck", .p =3D "usbck", .id =3D 7 }, - { .n =3D "pck0", .p =3D "prog0", .id =3D 8 }, - { .n =3D "pck1", .p =3D "prog1", .id =3D 9 }, + { .n =3D "ddrck", .id =3D 2, .flags =3D CLK_IS_CRITICAL }, + { .n =3D "lcdck", .id =3D 3 }, + { .n =3D "uhpck", .id =3D 6 }, + { .n =3D "udpck", .id =3D 7 }, + { .n =3D "pck0", .id =3D 8 }, + { .n =3D "pck1", .id =3D 9 }, }; =20 static const struct clk_pcr_layout at91sam9n12_pcr_layout =3D { @@ -111,12 +111,12 @@ static const struct pck at91sam9n12_periphck[] =3D { =20 static void __init at91sam9n12_pmc_setup(struct device_node *np) { + struct clk_hw *usbck_hw, *hw, *main_rc_hw, *main_osc_hw; struct clk_range range =3D CLK_RANGE(0, 0); const char *slck_name, *mainxtal_name; + struct clk_parent_data parent_data[5]; struct pmc_data *at91sam9n12_pmc; - const char *parent_names[6]; struct regmap *regmap; - struct clk_hw *hw; int i; bool bypass; =20 @@ -140,50 +140,53 @@ static void __init at91sam9n12_pmc_setup(struct devic= e_node *np) if (!at91sam9n12_pmc) return; =20 - hw =3D at91_clk_register_main_rc_osc(regmap, "main_rc_osc", 12000000, - 50000000); - if (IS_ERR(hw)) + main_rc_hw =3D at91_clk_register_main_rc_osc(regmap, "main_rc_osc", 12000= 000, + 50000000); + if (IS_ERR(main_rc_hw)) goto err_free; =20 bypass =3D of_property_read_bool(np, "atmel,osc-bypass"); =20 - hw =3D at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL, - bypass); - if (IS_ERR(hw)) + main_osc_hw =3D at91_clk_register_main_osc(regmap, "main_osc", NULL, + &AT91_CLK_PD_NAME(mainxtal_name), + bypass); + if (IS_ERR(main_osc_hw)) goto err_free; =20 - parent_names[0] =3D "main_rc_osc"; - parent_names[1] =3D "main_osc"; - hw =3D at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, NULL= , 2); + parent_data[0] =3D AT91_CLK_PD_HW(main_rc_hw); + parent_data[1] =3D AT91_CLK_PD_HW(main_osc_hw); + hw =3D at91_clk_register_sam9x5_main(regmap, "mainck", NULL, parent_data,= 2); if (IS_ERR(hw)) goto err_free; =20 at91sam9n12_pmc->chws[PMC_MAIN] =3D hw; =20 - hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, + hw =3D at91_clk_register_pll(regmap, "pllack", NULL, + &AT91_CLK_PD_HW(at91sam9n12_pmc->chws[PMC_MAIN]), 0, &at91rm9200_pll_layout, &plla_characteristics); if (IS_ERR(hw)) goto err_free; =20 - hw =3D at91_clk_register_plldiv(regmap, "plladivck", "pllack", NULL); + hw =3D at91_clk_register_plldiv(regmap, "plladivck", NULL, &AT91_CLK_PD_H= W(hw)); if (IS_ERR(hw)) goto err_free; =20 at91sam9n12_pmc->chws[PMC_PLLACK] =3D hw; =20 - hw =3D at91_clk_register_pll(regmap, "pllbck", "mainck", NULL, 1, + hw =3D at91_clk_register_pll(regmap, "pllbck", NULL, + &AT91_CLK_PD_HW(at91sam9n12_pmc->chws[PMC_MAIN]), 1, &at91rm9200_pll_layout, &pllb_characteristics); if (IS_ERR(hw)) goto err_free; =20 at91sam9n12_pmc->chws[PMC_PLLBCK] =3D hw; =20 - parent_names[0] =3D slck_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "plladivck"; - parent_names[3] =3D "pllbck"; + parent_data[0] =3D AT91_CLK_PD_NAME(slck_name); + parent_data[1] =3D AT91_CLK_PD_HW(at91sam9n12_pmc->chws[PMC_MAIN]); + parent_data[2] =3D AT91_CLK_PD_HW(at91sam9n12_pmc->chws[PMC_PLLACK]); + parent_data[3] =3D AT91_CLK_PD_HW(at91sam9n12_pmc->chws[PMC_PLLBCK]); hw =3D at91_clk_register_master_pres(regmap, "masterck_pres", 4, - parent_names, NULL, + NULL, parent_data, &at91sam9x5_master_layout, &mck_characteristics, &at91sam9n12_mck_lock); @@ -191,7 +194,7 @@ static void __init at91sam9n12_pmc_setup(struct device_= node *np) goto err_free; =20 hw =3D at91_clk_register_master_div(regmap, "masterck_div", - "masterck_pres", NULL, + NULL, &AT91_CLK_PD_HW(hw), &at91sam9x5_master_layout, &mck_characteristics, &at91sam9n12_mck_lock, @@ -201,22 +204,23 @@ static void __init at91sam9n12_pmc_setup(struct devic= e_node *np) =20 at91sam9n12_pmc->chws[PMC_MCK] =3D hw; =20 - hw =3D at91sam9n12_clk_register_usb(regmap, "usbck", "pllbck", NULL); - if (IS_ERR(hw)) + usbck_hw =3D at91sam9n12_clk_register_usb(regmap, "usbck", NULL, + &AT91_CLK_PD_HW(at91sam9n12_pmc->chws[PMC_PLLBCK])); + if (IS_ERR(usbck_hw)) goto err_free; =20 - parent_names[0] =3D slck_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "plladivck"; - parent_names[3] =3D "pllbck"; - parent_names[4] =3D "masterck_div"; + parent_data[0] =3D AT91_CLK_PD_NAME(slck_name); + parent_data[1] =3D AT91_CLK_PD_HW(at91sam9n12_pmc->chws[PMC_MAIN]); + parent_data[2] =3D AT91_CLK_PD_HW(at91sam9n12_pmc->chws[PMC_PLLACK]); + parent_data[3] =3D AT91_CLK_PD_HW(at91sam9n12_pmc->chws[PMC_PLLBCK]); + parent_data[4] =3D AT91_CLK_PD_HW(at91sam9n12_pmc->chws[PMC_MCK]); for (i =3D 0; i < 2; i++) { char name[6]; =20 snprintf(name, sizeof(name), "prog%d", i); =20 hw =3D at91_clk_register_programmable(regmap, name, - parent_names, NULL, 5, i, + NULL, parent_data, 5, i, &at91sam9x5_programmable_layout, NULL); if (IS_ERR(hw)) @@ -225,9 +229,16 @@ static void __init at91sam9n12_pmc_setup(struct device= _node *np) at91sam9n12_pmc->pchws[i] =3D hw; } =20 + /* Set systemck parent hws. */ + at91sam9n12_systemck[0].parent_hw =3D at91sam9n12_pmc->chws[PMC_MCK]; + at91sam9n12_systemck[1].parent_hw =3D at91sam9n12_pmc->chws[PMC_MCK]; + at91sam9n12_systemck[2].parent_hw =3D usbck_hw; + at91sam9n12_systemck[3].parent_hw =3D usbck_hw; + at91sam9n12_systemck[4].parent_hw =3D at91sam9n12_pmc->pchws[0]; + at91sam9n12_systemck[5].parent_hw =3D at91sam9n12_pmc->pchws[1]; for (i =3D 0; i < ARRAY_SIZE(at91sam9n12_systemck); i++) { - hw =3D at91_clk_register_system(regmap, at91sam9n12_systemck[i].n, - at91sam9n12_systemck[i].p, NULL, + hw =3D at91_clk_register_system(regmap, at91sam9n12_systemck[i].n, NULL, + &AT91_CLK_PD_HW(at91sam9n12_systemck[i].parent_hw), at91sam9n12_systemck[i].id, at91sam9n12_systemck[i].flags); if (IS_ERR(hw)) @@ -240,7 +251,8 @@ static void __init at91sam9n12_pmc_setup(struct device_= node *np) hw =3D at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock, &at91sam9n12_pcr_layout, at91sam9n12_periphck[i].n, - "masterck_div", NULL, + NULL, + &AT91_CLK_PD_HW(at91sam9n12_pmc->chws[PMC_MCK]), at91sam9n12_periphck[i].id, &range, INT_MIN, 0); if (IS_ERR(hw)) --=20 2.43.0 From nobody Sat Feb 7 08:43:45 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C510D3A7849; Fri, 16 Jan 2026 20:07:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594061; cv=none; b=cGRD6p7HR9/bojKUbBw6v35le9VTtH19OKiywDxpJyvzXhABLhStfWJhHbmYhDycMdc232o3ugw3wtz4oYqD8LJyrQt7DGa/zgmnas2W1iUfST4bGGQPJ6EwEjsLTsEaegKew/7WaTFmiG5zGnagIMZZAwtYtpn46PnoFAPpiqs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768594061; c=relaxed/simple; bh=xqoF1rlYiCbyUzgobq3CKtOYoiAr0pjHL3GMBCRIJXM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Sn74Q38JvnF6x1tRVXhtRSnYNFPMP8PHe6JqSgfvC6yevi5PSBVQtRj1w43fc0H/77Uz5jZGCZR/ph3qxUu1VDJy6hiYnwU7wzOr5Le0RGboog7NCnx4kfwwTUDhv9bswrjSZp0SJGPUUsEpg4R0Fd0FZ6H25SYo1hS3Z5Fx7Zs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=gS7ADnIn; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="gS7ADnIn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1768594058; x=1800130058; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xqoF1rlYiCbyUzgobq3CKtOYoiAr0pjHL3GMBCRIJXM=; b=gS7ADnInwYA1nA1fBQhT3XaiUMvXW76hkB0NEXHOUD7Bf7Q2GBWEALeM G3KzqEolVm9h3wQzLjGX71lS5NB2ITh/P4Ar+50+WZMrd03WsdAQtdAI5 Js2aAvEavrVHdGKb1dqWfQ77pufv49tUvyNaJJNXBpPnS289WZxWNeL5I XA+CN5iruLJ59ATw4QQu5w3luXo3m20Cev3ueasVriTJNBJnARRza9JH2 c2VSwVkzjDQEybVAn4XoxxQR3ID9fNt5IH76blRUy4lOuGlA/PAulcDDT sRpBtoCKN+xKszo/vWJo5QbTC43nCP0kOpQJSJCKtEnLAJQCKUKPcNMZr Q==; X-CSE-ConnectionGUID: OTooRcwrRNCxZBlF1StIPQ== X-CSE-MsgGUID: hdIM9vTcSNa+1t3Njsq8dA== X-IronPort-AV: E=Sophos;i="6.21,232,1763449200"; d="scan'208";a="59042249" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2026 13:07:27 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex3.mchp-main.com (10.10.87.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.29; Fri, 16 Jan 2026 13:07:08 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 16 Jan 2026 13:07:08 -0700 From: To: , , , , , , , CC: , , , , Subject: [PATCH v5 31/31] clk: at91: at91sam9rl: switch to clk_parent_data Date: Fri, 16 Jan 2026 13:07:24 -0700 Message-ID: <2eece965466a91c95b0a958e7396cb16f60e0ba4.1768512290.git.ryan.wanner@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Switch AT91SAM9RL clocks to use parent_hw and parent_data. Having parent_hw instead of parent names improves to clock registration speed and re-parenting. Signed-off-by: Claudiu Beznea Signed-off-by: Ryan Wanner Reviewed-by: Claudiu Beznea --- drivers/clk/at91/at91sam9rl.c | 49 +++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/drivers/clk/at91/at91sam9rl.c b/drivers/clk/at91/at91sam9rl.c index 0e8657aac491..a5cc0c1ed194 100644 --- a/drivers/clk/at91/at91sam9rl.c +++ b/drivers/clk/at91/at91sam9rl.c @@ -28,13 +28,12 @@ static const struct clk_pll_characteristics sam9rl_plla= _characteristics =3D { .out =3D sam9rl_plla_out, }; =20 -static const struct { +static struct { char *n; - char *p; u8 id; } at91sam9rl_systemck[] =3D { - { .n =3D "pck0", .p =3D "prog0", .id =3D 8 }, - { .n =3D "pck1", .p =3D "prog1", .id =3D 9 }, + { .n =3D "pck0", .id =3D 8 }, + { .n =3D "pck1", .id =3D 9 }, }; =20 static const struct { @@ -68,8 +67,8 @@ static const struct { static void __init at91sam9rl_pmc_setup(struct device_node *np) { const char *slck_name, *mainxtal_name; + struct clk_parent_data parent_data[6]; struct pmc_data *at91sam9rl_pmc; - const char *parent_names[6]; struct regmap *regmap; struct clk_hw *hw; int i; @@ -95,13 +94,15 @@ static void __init at91sam9rl_pmc_setup(struct device_n= ode *np) if (!at91sam9rl_pmc) return; =20 - hw =3D at91_clk_register_rm9200_main(regmap, "mainck", mainxtal_name, NUL= L); + hw =3D at91_clk_register_rm9200_main(regmap, "mainck", NULL, + &AT91_CLK_PD_NAME(mainxtal_name)); if (IS_ERR(hw)) goto err_free; =20 at91sam9rl_pmc->chws[PMC_MAIN] =3D hw; =20 - hw =3D at91_clk_register_pll(regmap, "pllack", "mainck", NULL, 0, + hw =3D at91_clk_register_pll(regmap, "pllack", NULL, + &AT91_CLK_PD_HW(at91sam9rl_pmc->chws[PMC_MAIN]), 0, &at91rm9200_pll_layout, &sam9rl_plla_characteristics); if (IS_ERR(hw)) @@ -109,18 +110,19 @@ static void __init at91sam9rl_pmc_setup(struct device= _node *np) =20 at91sam9rl_pmc->chws[PMC_PLLACK] =3D hw; =20 - hw =3D at91_clk_register_utmi(regmap, NULL, "utmick", "mainck", NULL); + hw =3D at91_clk_register_utmi(regmap, NULL, "utmick", NULL, + &AT91_CLK_PD_HW(at91sam9rl_pmc->chws[PMC_MAIN])); if (IS_ERR(hw)) goto err_free; =20 at91sam9rl_pmc->chws[PMC_UTMI] =3D hw; =20 - parent_names[0] =3D slck_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "pllack"; - parent_names[3] =3D "utmick"; + parent_data[0] =3D AT91_CLK_PD_NAME(slck_name); + parent_data[1] =3D AT91_CLK_PD_HW(at91sam9rl_pmc->chws[PMC_MAIN]); + parent_data[2] =3D AT91_CLK_PD_HW(at91sam9rl_pmc->chws[PMC_PLLACK]); + parent_data[3] =3D AT91_CLK_PD_HW(at91sam9rl_pmc->chws[PMC_UTMI]); hw =3D at91_clk_register_master_pres(regmap, "masterck_pres", 4, - parent_names, NULL, + NULL, parent_data, &at91rm9200_master_layout, &sam9rl_mck_characteristics, &sam9rl_mck_lock); @@ -128,7 +130,7 @@ static void __init at91sam9rl_pmc_setup(struct device_n= ode *np) goto err_free; =20 hw =3D at91_clk_register_master_div(regmap, "masterck_div", - "masterck_pres", NULL, + NULL, &AT91_CLK_PD_HW(hw), &at91rm9200_master_layout, &sam9rl_mck_characteristics, &sam9rl_mck_lock, CLK_SET_RATE_GATE, 0); @@ -137,18 +139,18 @@ static void __init at91sam9rl_pmc_setup(struct device= _node *np) =20 at91sam9rl_pmc->chws[PMC_MCK] =3D hw; =20 - parent_names[0] =3D slck_name; - parent_names[1] =3D "mainck"; - parent_names[2] =3D "pllack"; - parent_names[3] =3D "utmick"; - parent_names[4] =3D "masterck_div"; + parent_data[0] =3D AT91_CLK_PD_NAME(slck_name); + parent_data[1] =3D AT91_CLK_PD_HW(at91sam9rl_pmc->chws[PMC_MAIN]); + parent_data[2] =3D AT91_CLK_PD_HW(at91sam9rl_pmc->chws[PMC_PLLACK]); + parent_data[3] =3D AT91_CLK_PD_HW(at91sam9rl_pmc->chws[PMC_UTMI]); + parent_data[4] =3D AT91_CLK_PD_HW(at91sam9rl_pmc->chws[PMC_MCK]); for (i =3D 0; i < 2; i++) { char name[6]; =20 snprintf(name, sizeof(name), "prog%d", i); =20 hw =3D at91_clk_register_programmable(regmap, name, - parent_names, NULL, 5, i, + NULL, parent_data, 5, i, &at91rm9200_programmable_layout, NULL); if (IS_ERR(hw)) @@ -158,8 +160,8 @@ static void __init at91sam9rl_pmc_setup(struct device_n= ode *np) } =20 for (i =3D 0; i < ARRAY_SIZE(at91sam9rl_systemck); i++) { - hw =3D at91_clk_register_system(regmap, at91sam9rl_systemck[i].n, - at91sam9rl_systemck[i].p, NULL, + hw =3D at91_clk_register_system(regmap, at91sam9rl_systemck[i].n, NULL, + &AT91_CLK_PD_HW(at91sam9rl_pmc->pchws[0]), at91sam9rl_systemck[i].id, 0); if (IS_ERR(hw)) goto err_free; @@ -170,7 +172,8 @@ static void __init at91sam9rl_pmc_setup(struct device_n= ode *np) for (i =3D 0; i < ARRAY_SIZE(at91sam9rl_periphck); i++) { hw =3D at91_clk_register_peripheral(regmap, at91sam9rl_periphck[i].n, - "masterck_div", NULL, + NULL, + &AT91_CLK_PD_HW(at91sam9rl_pmc->chws[PMC_MCK]), at91sam9rl_periphck[i].id); if (IS_ERR(hw)) goto err_free; --=20 2.43.0