From nobody Thu Oct 2 07:43:36 2025 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 978952F3620; Thu, 18 Sep 2025 21:16:29 +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=1758230191; cv=none; b=AqEMz8rFki+4141wCnQ1xaRlUn94SLvZlmkCWyNXyC1ly6ygNk4T0Trbk7AsObNX+hXATc7EtZo3/B3kEKeSQzY4eIDrPrfuU9ztjxj6HIV+6IpK7SzjYXG4gmsmOkTs64rZtIDhzUb1oED18ZBgcyzfiffAl8V91tf3+gmmD+Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230191; c=relaxed/simple; bh=eiAbsnGms6AR3/Kbu9EsaYVOqnu8+/1DgwnZm9I3Xpk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=f0aA5cHBh0EAZ5MUq6PAz3F83hVgOCa9oNyebdQec/jY1ZszEKjPjOLloyAgH3rbeG1gl5SEAoyTw2mTIDoDCF1pHwfJ9cgMcONg1EXNR930yogDvxeOlPEr2nwBz+4Od3PZRuuVHtUYYoeHjxsmDp1HodW9ZvhVWuFdf0Jhv1s= 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=qog+rh7t; 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="qog+rh7t" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230189; x=1789766189; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eiAbsnGms6AR3/Kbu9EsaYVOqnu8+/1DgwnZm9I3Xpk=; b=qog+rh7tjVqpD5sqnCZfMHp8+2/fQWwGyC8IOWf6inlIH8b5S6kAmPBu u0I9RJHtM/4hgJiQojASvtXDHJcCsXvAra5ckFt3GHIwZUqtACaZrIVSx iHkcqP7D/1XL7D20EgYPGfW8f45iqv+xQbj1d153xqAaw2vfeERbEyXjm jRtqy+/VrxXrMe8OGPJT3Hvv14VBsUbZibBcHaRC8ZSZJ8amiAgLHP/av n2Ae3ilf9HR+KkomKPDJjVKAN1yL/hAnBkncvKS5/jjwPnTBX604StGlO /LGuMdGtM9scMgfq3OfYh22s5Ue/jJms1evTjNCcwBMN1+/nd6wr0Q2yV Q==; X-CSE-ConnectionGUID: 1s1RKV33Q2arVnZUGnGVZA== X-CSE-MsgGUID: ME2EnWGiRN6AnUXUU3fLVg== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="214079911" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 18 Sep 2025 14:16:28 -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; Thu, 18 Sep 2025 14:15:50 -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; Thu, 18 Sep 2025 14:15:50 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 01/31] clk: at91: pmc: add macros for clk_parent_data Date: Thu, 18 Sep 2025 14:15:43 -0700 Message-ID: <0221c90ab3025c8e72fcdcf54c685da058c0fe4d.1758226719.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 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 --- 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..4a416d227c50 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 Thu Oct 2 07:43:36 2025 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 12E982820DB; Thu, 18 Sep 2025 21:16: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=1758230189; cv=none; b=RgkOFrQvzU+1LNclUcCokZVihut07Xaji/nLiy7K2rHvJxHTk9izR+8AMPK6BDXDnISKK51wAVJiGeVoyljhhgWowr/nKZrVm08vOxKOzZYZcOiR1sRK3AL7E7e8L9hTrelhBEan/K0z4YaCRlqWQ4WyvkpEJ30V+D48hZqMnLs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230189; c=relaxed/simple; bh=1hwWQkXg0mws8PjElqjxpMsAUmyOGjqz1fTxScdIq6I=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=s3YMgf9Kdd5qYw3KqO1KMxE/Yy3Y0rq3WDWZp57Z0jdfH0GgWG7q2Uj4dDIVmsgoughtm5i1JkCily2De135bDZ5pTzBgyDwjc6L4/96bWmYTST/UKPiz8IdhxlG12S9fYYUqnzeTgF1XONDKFwF/V0gFzprAcNcNTVf2x3wWp4= 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=qI4EYjYq; 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="qI4EYjYq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230189; x=1789766189; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1hwWQkXg0mws8PjElqjxpMsAUmyOGjqz1fTxScdIq6I=; b=qI4EYjYqCghpQsrQ4O5QgDZjKGUVC/+OIjaf4FPa01PFc3vQ6cVg6K2v /YBBaBdQVwfQuvVRFz152aAWwuL3H2wTVkX91wt9bEVNwO6EJU7jMJ4oy VcEiwYmhiqxWHCW0x4Ic1HRkNHtqCu/BSkhF4BIr1Hw5gJizjjf4XJxXH QHaamKb1rKBRggGrmitcv1rtFHUBVSoPhrZNRD14M5bYiIsBgaCCnwmnJ 5Y0pRQ/BYMBMkraA00cXwCYobc8CY468V4JH42ncRFKHZTPyW0YT+ThYq oJcr/0gf1G3R2O12/+03jjvTES73UB56y79WbzL1Xm9zqNPvTZsNF9gBR g==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: WUC3l1bMTKia6RDJacDqUw== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071376" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:22 -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; Thu, 18 Sep 2025 14:15:51 -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; Thu, 18 Sep 2025 14:15:51 -0700 From: To: , , , , CC: , , , , "Ryan Wanner" Subject: [PATCH v4 02/31] clk: at91: pmc: Move macro to header file Date: Thu, 18 Sep 2025 14:15:44 -0700 Message-ID: <0e9bd3a3aaf4c3168a78f95625eb0e1beb07d35d.1758226719.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 Move this macro to the header file as it is used by more than one driver file. Signed-off-by: Ryan Wanner --- 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 4a416d227c50..16c2559889aa 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 Thu Oct 2 07:43:36 2025 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 5401D2C08AA; Thu, 18 Sep 2025 21:16: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=1758230191; cv=none; b=nKtRB30nC6OseEg4Q2Py/5OYQiPMpwhtwGO1Uxiy0xWX+OMDWLfZK/00SrQDrWFQgLVb9RyW1LyGL601Mbsu3fwAR5nMQyjygoftNVeDKJ0T8Eccxga0igzoi+Z6E5S7ZcJiAJs+mtKRNQAHALcxRotpsZxXHPv/nBrAScIE5Qg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230191; c=relaxed/simple; bh=EGNab37xwDaXeQqQ4XsAZk+vGgUUKqm2uIGGIuG5b8M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=O7H6CzOFZ4rM9bh+FlpsUSirsFOysk7hTtPFvg0l3GyRQxrwI+gmgkvkSSzi29UCRtPwKFf83cW66os+dIARUUE6iMb5ugoKYQx3hQKPt83MdamTggVmzlu5OO57I4UTI2dGfWcVvqT3eyxjlh3w6eXx7lLeht1hrSOA6uV8LgI= 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=Gxi29Njc; 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="Gxi29Njc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230190; x=1789766190; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EGNab37xwDaXeQqQ4XsAZk+vGgUUKqm2uIGGIuG5b8M=; b=Gxi29Njc8sWhJ2ES8Kfwb0CFG1cNsNX00RXM4PX03DC2eiBLBQfYueWs LDZMB+aKcL24DFX+b2zqc4KXc7xQ7iJpL9l25qhwqUywnTOclG/uQIsue Y3Cemzd/xXgCUiICEQIZbO6y24WOfwErVRXsakw8zJt6uMx84TVimaFnL +MhhlDvTbhGNFDaOX0ZefPLavCT9PecGpi8h4H30ql/rjtuETAmJGeSgp jKjUdCGHO092tjlMZQzYKZz8wOc+xdFJMzOK4Zm8tD1bCIhPljZfA3vrO x1KIGL6bLnFoq7V2XyAOf5PPwzxXS0YmydQhFlhFhgL9R9Kcvc8pE0zN+ w==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: vV/vjRtuTMyIB2N+XpB5cA== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071377" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:22 -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; Thu, 18 Sep 2025 14:15:51 -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; Thu, 18 Sep 2025 14:15:51 -0700 From: To: , , , , CC: , , , , "Ryan Wanner" Subject: [PATCH v4 03/31] clk: at91: sam9x75: switch to parent_hw and parent_data Date: Thu, 18 Sep 2025 14:15:45 -0700 Message-ID: <42d01c533eecf4018174ab5c3e0a6130e3dc34f0.1758226719.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 | 308 +++++++++++++++++++++----------------- 1 file changed, 173 insertions(+), 135 deletions(-) diff --git a/drivers/clk/at91/sam9x7.c b/drivers/clk/at91/sam9x7.c index 89868a0aeaba..cb5849da494f 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,33 +744,25 @@ 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", "md_slck"); - if (i < 0) - return; - - 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")); i =3D of_property_match_string(np, "clock-names", "main_xtal"); - if (i < 0) + + if (!td_slck_hw || !md_slck_hw || !i) return; - mainxtal_name =3D of_clk_get_parent_name(np, i); =20 + main_xtal_name =3D of_clk_get_parent_name(np, i); regmap =3D device_node_to_regmap(np); if (IS_ERR(regmap)) return; @@ -760,26 +780,25 @@ 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, &AT9= 1_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 +806,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 +832,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 +845,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 +873,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 +899,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 +919,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 +929,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 +946,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 Thu Oct 2 07:43:36 2025 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 711132E0905; Thu, 18 Sep 2025 21:16: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=1758230191; cv=none; b=jAnKkLWfhOJIsjVeFzA7uJ2ofroxVQHepQgxsOV6cTXnlPTqgFTnRV6/nvtKMVDcB/P3w+4aUUNRK1UJapN+ddSMtA6bsoes44flRbtZvMYEW+8cS+x7MNuOlxXCI1gbAy0pIVbxNZBW7+sLfVPD2FtLkVoHTwx5qjesWFwjy6Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230191; c=relaxed/simple; bh=c4Gn9p0qYQJUQcD3GCxEYQYm9cnkaiQMPpmWCJHuy3c=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ekFAJrlq0kYq1tOpskMzyv1VJEcbecyM4g4kZgvuitSgvceIUdz40TxF98H5yeJXCsZd5bhWvauWPYTF9qGU/B2s5bMhW/SqUUFZ/90Tz8wqvFbXbxDQ2pgCM9WiC+veRI6Fh4rTM3e0fiHOLoy7K3SJ1wN8h9Li+KacktivAFY= 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=SUzgkUZc; 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="SUzgkUZc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230190; x=1789766190; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=c4Gn9p0qYQJUQcD3GCxEYQYm9cnkaiQMPpmWCJHuy3c=; b=SUzgkUZcW5V+DjdPMM1PuQ1xvhPg89aV+wZK7RhxwNArQMokgpc6OzCJ GXDRQGkPiIqW9DBrGNCs2q45orR6QObElIqhY23XmUxBQTK7X/m0LH5cA YhuiVjJkDzQz2IFT5JBN/DiDnxFZqk+guLQZWY2ubcdDFi5JTL75HCoyw xW5DV/Ps7hL55SaQEGUd5vNwWqCJDbKTvzzVD7kngLTscbQVthSSKNROz J4rAOxl5sKMbwogGUEudGQaXqw/Wo1GPX0IAtek7je81xgbLgrNIBpUSW TZaSllCERCfTG9Y7UdVBcOHwwptLZFUTRbP3imhb50WterFHxrmLmEsBZ w==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: IKJ+PEi9TmWU1HZZ0Omi+w== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071378" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:23 -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; Thu, 18 Sep 2025 14:15:51 -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; Thu, 18 Sep 2025 14:15:51 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 04/31] clk: at91: clk-sam9x60-pll: use clk_parent_data Date: Thu, 18 Sep 2025 14:15:46 -0700 Message-ID: <259824455f5325b35d0fb85163866a81ff24304e.1758226719.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. 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 | 25 ++++++++++++++----------- drivers/clk/at91/sama7g5.c | 26 +++++++++++++++----------- 6 files changed, 53 insertions(+), 41 deletions(-) diff --git a/drivers/clk/at91/clk-sam9x60-pll.c b/drivers/clk/at91/clk-sam9= x60-pll.c index 3dc75a394ce1..9895881c67d7 100644 --- a/drivers/clk/at91/clk-sam9x60-pll.c +++ b/drivers/clk/at91/clk-sam9x60-pll.c @@ -630,19 +630,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); @@ -650,10 +650,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; @@ -684,7 +681,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 16c2559889aa..d3fc38cf90eb 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 cb5849da494f..c80306715d90 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 @@ -799,7 +800,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; @@ -808,21 +809,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..6229b7dfbea1 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; @@ -1108,10 +1108,11 @@ static void __init sama7d65_pmc_setup(struct device= _node *np) =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")); - main_xtal_hw =3D __clk_get_hw(of_clk_get_by_name(np, main_xtal_name)); + i =3D of_property_match_string(np, "clock-names", "main_xtal"); =20 - if (!td_slck_hw || !md_slck_hw || !main_xtal_hw) + if (!td_slck_hw || !md_slck_hw || !i) return; + main_xtal_name =3D of_clk_get_parent_name(np, i); =20 regmap =3D device_node_to_regmap(np); if (IS_ERR(regmap)) @@ -1137,10 +1138,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 +1153,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 +1162,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..654c9f43fcf8 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; @@ -985,10 +985,11 @@ static void __init sama7g5_pmc_setup(struct device_no= de *np) =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")); - main_xtal_hw =3D __clk_get_hw(of_clk_get_by_name(np, main_xtal_name)); + i =3D of_property_match_string(np, "clock-names", "main_xtal"); =20 - if (!td_slck_hw || !md_slck_hw || !main_xtal_hw) + if (!td_slck_hw || !md_slck_hw || !i) return; + main_xtal_name =3D of_clk_get_parent_name(np, i); =20 regmap =3D device_node_to_regmap(np); if (IS_ERR(regmap)) @@ -1014,10 +1015,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 +1030,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 +1039,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 Thu Oct 2 07:43:36 2025 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 954092ED848; Thu, 18 Sep 2025 21:16: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=1758230192; cv=none; b=qzXonMRX3l1U05h2+3+S/sBsIuLHkVyYOK5v7wLAwDCpBL+0SaXuvcWrFEQ5zii5yLA/sROpHFdb8iAyzQvOiv2s6miXrmcxnXIfegEqgpGKnACKvPlhriVqFLBOfKdaYm8uNCuTw+CLPoOUxb/fw1ggcEbkfIwC3SuIdSpANbI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230192; c=relaxed/simple; bh=7//6SEF4/nqy23m5qcrWxDmvp9XtxNmHgq9vRtxZiFk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QpiGNeEmAao0TTMdqjU8T3bZ7b4SeII1K9WxJADjpTvOW8MdL3mtv6CivClW0Nuly2APD1+F7Z+MSg2APf20y0VJWo2FZxZHu+RooPFcqNTP0B803c93XUeRXJMZ161TvHqw+TX5ejOrObp1A26kpr0L+ZuhFiI0OJ9fb+AhJlU= 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=XzubgEwr; 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="XzubgEwr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230190; x=1789766190; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7//6SEF4/nqy23m5qcrWxDmvp9XtxNmHgq9vRtxZiFk=; b=XzubgEwrB2/OfooGFVABvOpzFft8ioEsw6IcAF6jnS1JaFkR5wxuxgLI T/uCQ02c+zc26XI7FV5S/yN+dmWQ9X9y6mBCVnG3nnvM1HTOeCF3ylVk3 ihdMi9gemChb4a8Fult+u2hw7wDM2XMcRmqC1i9BzfGyRzxbKrypfSgmF Sa1VK98ffqo7j07YkzWCmD5XjhxTZAg4Af3FwELwLnUZ2QKBPeoYMil35 uHsAT2RDQbtjPfOektxVB4wnqYNKgzjJqFOl3Y3eleGTY/+Ev0ddIVYmV /MueJt7352doON3ZwJoYuSJGWZPAPkgt0SZJHqq151uiaAddrp001avT5 w==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: TIB6OPY+RsS8E3zaqlRJsA== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071379" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:23 -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; Thu, 18 Sep 2025 14:15:51 -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; Thu, 18 Sep 2025 14:15:51 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 05/31] clk: at91: clk-peripheral: switch to clk_parent_data Date: Thu, 18 Sep 2025 14:15:47 -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. Signed-off-by: Claudiu Beznea [ryan.wanner@microchip.com: Add SAMA7D65 and SAM9X7 SoCs to the use the structs.] Signed-off-by: Ryan Wanner --- 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 c173a44c800a..ed97b3c0a66b 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; @@ -448,7 +448,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) { @@ -457,7 +457,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); @@ -465,8 +465,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 d3fc38cf90eb..9b0c641e747b 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 c80306715d90..ff9dbaac5f04 100644 --- a/drivers/clk/at91/sam9x7.c +++ b/drivers/clk/at91/sam9x7.c @@ -925,7 +925,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 6229b7dfbea1..6367fa7efd06 100644 --- a/drivers/clk/at91/sama7d65.c +++ b/drivers/clk/at91/sama7d65.c @@ -1307,7 +1307,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 654c9f43fcf8..091845ca251c 100644 --- a/drivers/clk/at91/sama7g5.c +++ b/drivers/clk/at91/sama7g5.c @@ -1180,7 +1180,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 Thu Oct 2 07:43:36 2025 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 80F342F9D92; Thu, 18 Sep 2025 21:16: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=1758230193; cv=none; b=nwkQV+y6UOCikhJk1KIHcL7lT+emJQot5duboYP6zLEDGlv0t8egRWYHwxllx/dSWGI+EJJnqM+1AkR69uMUKDeDWph3w03wCVl2W6nHawAHTXsfjUiVqfrhMidkSmyvVvJtrHukbC4K+Fx3IHZmRGN7SNSeuMCTarl3Abr24ag= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230193; c=relaxed/simple; bh=87vLGMW5OjSBWLqBweghZ7yHNC7moDT8cDc12mxnWN0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=acPvkcWowUUEJ5l/ojmEWzyHQil6uD6kv4Kr25iUizhTcbNEGrGzjihSV7+VXLV4JFxdqEAjB4Nu9IqaQcFDuEApNrT7trqGLKIfpXzRuX8wLy30YuOMmcijMM0ZiFDNeCDrGxkBJeMSgrEDRV3HK0enBVPTBZqWHi9wYjFAJy8= 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=cnb2Yqx3; 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="cnb2Yqx3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230192; x=1789766192; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=87vLGMW5OjSBWLqBweghZ7yHNC7moDT8cDc12mxnWN0=; b=cnb2Yqx3u2sypraBfQkdWk9dSWv6zVkzkm5Nby2CWM916UJtZWG9rFp/ 9JGl1SutYOnOPu1mAEU0RAc+pH3BUCQwVaSZIItq7AuDF9w7yLGzZcKTB 00Q79noDe7Lk5TQdr8rxLr2vE6g/jO4Ok8zku+QgiHRaMfuzxWO1uq92k SMYGfSZJ3DPiJJ5Aa+WM1DaaKRiQUWjCo9ir7dxYpdbLkV4vltk/JiYNl LwVphDlT4/rmQ2lqdORwz+r5Y+HoA8yltt3ZezSa8P7vyV6ENOewXc1Dl EomWqkBV9W72wwkZ3MbRsAoJ1uHIDu9O+xSyDiohIN4gQgYKnf7aIJOd4 Q==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: mAIXgCm0TBKiGhgmGwBc7g== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071380" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:23 -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; Thu, 18 Sep 2025 14:15:51 -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; Thu, 18 Sep 2025 14:15:51 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 06/31] clk: at91: clk-main: switch to clk parent data Date: Thu, 18 Sep 2025 14:15:48 -0700 Message-ID: <0f8054488ac3cd658d7a6fc0d5cd4f684ce8355a.1758226719.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 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. 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 --- 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 | 8 ++++---- 5 files changed, 28 insertions(+), 28 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 9b0c641e747b..13d125793216 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 ff9dbaac5f04..f00045d4f425 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 @@ -790,9 +790,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 @@ -809,11 +809,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: @@ -828,7 +828,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 6367fa7efd06..b12d796cbea4 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; @@ -1143,9 +1143,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 @@ -1162,11 +1162,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: @@ -1179,7 +1179,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 091845ca251c..b1b0e9e67228 100644 --- a/drivers/clk/at91/sama7g5.c +++ b/drivers/clk/at91/sama7g5.c @@ -1020,9 +1020,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 @@ -1057,7 +1057,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 Thu Oct 2 07:43:36 2025 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 BE8CE2FA0F3; Thu, 18 Sep 2025 21:16: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=1758230194; cv=none; b=VUe4ZfNXGIPPMT2Skvs2W+blsxNwbGNpBQ18B+1M/RCW44ixHQUbVklt8weCB4u0BMvbJnlxWMJ8EuP4bgvojvMxFKIiry+205TK/GENOku4MEC9hthyQPddxCwwv87Qs/lG1gGzsvfiO1kOIu8oy4HQYaXCCo88+EIEtNl+NzE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230194; c=relaxed/simple; bh=oZGENw4vb+tfySYsNBjLTxe488qgzlulFlS2raDJbfU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Zton4E7RPzdFgYlRLy9l85/ZzqFuCRCAGr1FVr5ao4Dp8UiAWICcV2/jGJCZOCrv5QEJ3SjdidOwNCTWtv93BZSnlh7bvutrqA+LuuubQt31OzW4x0HU0pp2Q12scAOBFqOFoXDYHXG7sIYVjiKT9ipgwbfw/KLmneyhPKkWQP8= 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=VS5J3oSx; 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="VS5J3oSx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230192; x=1789766192; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oZGENw4vb+tfySYsNBjLTxe488qgzlulFlS2raDJbfU=; b=VS5J3oSxuxsjcO6cEDH2TxIMzb0I2xVhmlnJ+EtUh2B+OUZ0mbX8CGEA RAgQv0nZdKcSbXcK18IhepsZM8zKUAWGzjz9z1thNt7SJuygM6gpCSeWR VfiPg7DOH0bSi5vE6PveetNZW8n8vlydxPfG3AWHMqKQy10HzhcsxSg1N m6rDLx576HMGVH1gUMHlj+0tzp63qszSQ2os1rmL1C/4porixWgj34A/m NdO+I2lV3dXUb8CE1dZnk+W/URpPuE8gi0FGkDYSj7g3IVrPCEFuVl6b3 dGk7dwKSB0mhUPSjJXVpd6LjV/A/eGM8hCFbO+xLKdp8Mq+NAJuShSePk g==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: r0LEZkz+T7mlrWOiC40L+Q== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071381" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:23 -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; Thu, 18 Sep 2025 14:15:51 -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; Thu, 18 Sep 2025 14:15:51 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 07/31] clk: at91: clk-utmi: use clk_parent_data Date: Thu, 18 Sep 2025 14:15:49 -0700 Message-ID: <87a3e3615345c975acc669207cd8bd9f849b0fb0.1758226719.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 Signed-off-by: Ryan Wanner --- drivers/clk/at91/clk-utmi.c | 16 ++++++++-------- drivers/clk/at91/pmc.h | 4 ++-- drivers/clk/at91/sama7g5.c | 21 +++++++++++++-------- 3 files changed, 23 insertions(+), 18 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 13d125793216..ee77c14e8b25 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 b1b0e9e67228..dde662a6133f 100644 --- a/drivers/clk/at91/sama7g5.c +++ b/drivers/clk/at91/sama7g5.c @@ -976,10 +976,11 @@ static void __init sama7g5_pmc_setup(struct device_no= de *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; - static struct clk_parent_data parent_data; + struct clk_parent_data parent_data[2]; struct clk_hw *parent_hws[10]; + struct clk *main_xtal; bool bypass; int i, j; =20 @@ -1039,19 +1040,22 @@ 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; + 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 @@ -1135,7 +1139,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 Thu Oct 2 07:43:36 2025 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 098BE2F83D8; Thu, 18 Sep 2025 21:16: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=1758230194; cv=none; b=Ky19io3hErNRoM84cxYwcLBonqxOqF3oCK7Dq9CvN9M3c11WRBZKQru/97iwfoh/T61YyMMGpnL4oKR0BzmeAs4fSVBolu9fFyAsUoXSC4SJtlDKcrq5yB8eo9Af6jRy6X56KbVRqCYtNJKxPhLbULHKxY0Oj6pBc96gEp3wZQ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230194; c=relaxed/simple; bh=Bzwb9+zFUpS1/Y7MegoKgHFqkUPMSfLevAbby0Iezv4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=U9R7542ij7KHD62eMb2+4VkwXRI+0n3Wwih3V5F7AaZjjLF0kWwL9h2yaM17HMI1OEAbF2PLrDXYAFDxAxoQDEh83v8oGdIfutAv/4xnLdKLrMk5B4Ubx8uII/ax6ekojepM59IYNCxcDKkS2bhEhE1BSF819xPCtb+ubAaEOq0= 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=yE4F/OUk; 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="yE4F/OUk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230193; x=1789766193; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Bzwb9+zFUpS1/Y7MegoKgHFqkUPMSfLevAbby0Iezv4=; b=yE4F/OUk9wp+G2wWCOZC9gML7GvbDxA/iW/6bu6sc6B+02mcKnUYBWbx 87HPmyDIq0EnxD2Yt6BdmmndiqZ6GUdkMu8jFzBI62epNlhvQABKiQPx9 du4h7w98NITolfJIHgnoGR6GswopRXxtHrN8SzcBzI1zsZiju/SF6UOoZ HQRnfRYQ11HxsNZUIdwOZb68EYE2D8/4zIfihIFBRtFcqdVuHtaMIZQUF VetDxQRgaNR5cNyvTxTeXLmCXag2RXMUYZ/Ru0DCuEkn6/gbxDBZvQ16R +hIEppED8gakWE07p/ifXxlbkhJ0bZkskwYX3qMjpamMrYcqA1MaGrerp A==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: FCWrCzNISvOi8dY9NHpumw== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071382" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:24 -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; Thu, 18 Sep 2025 14:15:52 -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; Thu, 18 Sep 2025 14:15:52 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 08/31] clk: at91: clk-master: use clk_parent_data Date: Thu, 18 Sep 2025 14:15:50 -0700 Message-ID: <160f139d5a5647104826c5878ca077faa26916bc.1758226719.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 | 20 +++++++++++--------- drivers/clk/at91/sama7d65.c | 17 +++++++---------- drivers/clk/at91/sama7g5.c | 17 +++++++---------- 5 files changed, 40 insertions(+), 44 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 ee77c14e8b25..c7973c063b59 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 f00045d4f425..191e2566d64a 100644 --- a/drivers/clk/at91/sam9x7.c +++ b/drivers/clk/at91/sam9x7.c @@ -752,15 +752,17 @@ static void __init sam9x7_pmc_setup(struct device_nod= e *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 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", "main_xtal"); + if (!td_slck_hw || !md_slck_hw) + return; =20 - if (!td_slck_hw || !md_slck_hw || !i) + i =3D of_property_match_string(np, "clock-names", "main_xtal"); + if (i < 0) return; =20 main_xtal_name =3D of_clk_get_parent_name(np, i); @@ -857,18 +859,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 b12d796cbea4..ab63e36cf0da 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; @@ -1209,7 +1209,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)) @@ -1218,12 +1218,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), @@ -1240,13 +1239,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 dde662a6133f..acf45319abe7 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]; struct clk *main_xtal; bool bypass; @@ -1091,7 +1091,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)) @@ -1099,12 +1099,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), @@ -1119,13 +1118,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 Thu Oct 2 07:43:36 2025 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 4CF882FB080; Thu, 18 Sep 2025 21:16: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=1758230195; cv=none; b=tKDYOB6XKrpYGkygepG02LuJNDVeAarjY3PFmaTPlwN1tj3JpktlDRflBgboFFE2XZAOi9Q6jylDQINqNOXATxbxp1Sky21UBIahEXdi4dTBrskhkL1sU6EWRYTRVnQ4UzcArSL1QugaB8owbEviSx74WmmyFvVZVRSpZmbfHoQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230195; c=relaxed/simple; bh=PXB6tTjcet0UbEtDutZyM+jMVOH38XEQs3nmOg59YOw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pSKRBLPLzZThgossFH6TAftrawn2hC8+CQxVp6RH8T/kTXetpMhv3EtZ4ZpWFsOh1kEKK5+Fr2tFkLTT6qOAFMwXpEPuVbxleRQgnO4EuVTd38TmKbcqGksh+tpqs5pR2dYhV3Vyg7f75gZ5evuXyXhS/zOJ1+yapuzIE/QG4Q4= 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=T5nQdXL1; 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="T5nQdXL1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230193; x=1789766193; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PXB6tTjcet0UbEtDutZyM+jMVOH38XEQs3nmOg59YOw=; b=T5nQdXL1Xz1XjCDK4P2q7JNYE7xbxDYmIxOvAlAJiPQFBE7foyil8USf ZptxZe6NbpdGD3lIKSz6V2zz9ero2AZEZ7wMJzfS9Msr7wBHlxlBBLdiH qfxt3ByXdCPj0EE87SL8+W994AiCfrGgeMkIDfOcboDUThYyyUiQHLW4i sfny20gaZpuQ4rrjgAMRHOoL6ZFjwFT0gk47NYhHz373z0FadF3vj+iZE 6FaYvRT1Bo8h1PaZgzrRQtTXYLykEZFZBkxPBR8Dk+m0/v4G6u2tIvbbI BHAOWBcETXV6qYcI0JQ+eBKZworUo7RbvfmH2oSqbTum5XYhr4iZbJj46 A==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: qBTcqfinSUmp0herXLu/kA== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071383" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:24 -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; Thu, 18 Sep 2025 14:15:52 -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; Thu, 18 Sep 2025 14:15:52 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 09/31] clk: at91: clk-programmable: use clk_parent_data Date: Thu, 18 Sep 2025 14:15:51 -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. 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 --- 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 c7973c063b59..51a87a535504 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 191e2566d64a..6afa4e6bcbad 100644 --- a/drivers/clk/at91/sam9x7.c +++ b/drivers/clk/at91/sam9x7.c @@ -885,20 +885,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 ab63e36cf0da..8538c3e5fa5a 100644 --- a/drivers/clk/at91/sama7d65.c +++ b/drivers/clk/at91/sama7d65.c @@ -1264,22 +1264,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 acf45319abe7..ddd5ad318990 100644 --- a/drivers/clk/at91/sama7g5.c +++ b/drivers/clk/at91/sama7g5.c @@ -1143,21 +1143,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 Thu Oct 2 07:43:36 2025 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 ABF062FBE05; Thu, 18 Sep 2025 21:16: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=1758230195; cv=none; b=Xj1GCTXz/b8m+/tysbMJwegHpl3FdIN7mhTpu+oTbL1To1BI1E2akH6BnXraLjLT9Xyq/YsgoTL6unLeQ7MI2e55wctVqf2pK8YNNXaSFpL103TqIwvaeM4S5yhMjInkjjs6vrptceLBsciJ2Yhg8iHstohJcR1UwY0RViGZ8JU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230195; c=relaxed/simple; bh=WCJq+bPBE6oP69qXgqacpPnfJrw13T86YvENIHlj29w=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lGUHIdskJRuuXfH+zLxdmbWHkPLqvm5p4kEvoPis6sN/+pLySWRVkmUZ7OO97uuKiRCbl1ip5BQJ8Vk1qrYwh9mKMGS7osdMl9+kxpy5MhQNJn0+mHcLDjAmjhcwSE81oyg86iy88p7sP2n1jS30/3TQtoM/ZnYHP+e1/LjBT0E= 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=RL2hvv65; 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="RL2hvv65" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230194; x=1789766194; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WCJq+bPBE6oP69qXgqacpPnfJrw13T86YvENIHlj29w=; b=RL2hvv65gkT/bcac0VLNuyPRLX2JRjIRMQ/EUXo9q97rpAoX00quH7vG rBZCmWgihD39bURC2BOn/xtFJkhSRJosZCC6j+Ak6Em4RgZx1xiGtej/v EKM0ALsrpcTDU892LazppmpUiKPGq6KxNxQGX7NDSBDJCMsrM0Bq3gMM3 kIQirr6vApkAX1j8IOtWFMfpyL4QXtH3bjo0qjP5mCkvUz4GSjaLPHerL VaA5T1u7a9+wAKdJhXUKmyqKCZZaUqTwFn4Ue7JsNJZidtBgU0JibtDlB 3COaAScmmxur3HtE7iK4peeZkCpozC7V1w0gusE/Z1BAJnJLXg2/slrP2 g==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: mePe3jeWRDmWpD2tNFx1NQ== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071384" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:24 -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; Thu, 18 Sep 2025 14:15:52 -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; Thu, 18 Sep 2025 14:15:52 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 10/31] clk: at91: clk-generated: use clk_parent_data Date: Thu, 18 Sep 2025 14:15:52 -0700 Message-ID: <645beaecf4b81c7e08f8adf3b9c74fa4b0176993.1758226719.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 --- drivers/clk/at91/clk-generated.c | 8 +++---- drivers/clk/at91/pmc.h | 2 +- drivers/clk/at91/sam9x7.c | 38 ++++++++++++++--------------- drivers/clk/at91/sama7d65.c | 41 +++++++++++++++++--------------- drivers/clk/at91/sama7g5.c | 39 ++++++++++++++++-------------- 5 files changed, 67 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 51a87a535504..2aa84c49bd2f 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 6afa4e6bcbad..0266119e125e 100644 --- a/drivers/clk/at91/sam9x7.c +++ b/drivers/clk/at91/sam9x7.c @@ -744,22 +744,26 @@ 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 - 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")); - if (!td_slck_hw || !md_slck_hw) + 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", "md_slck"); + if (i < 0) return; + md_slck_name =3D of_clk_get_parent_name(np, i); =20 i =3D of_property_match_string(np, "clock-names", "main_xtal"); if (i < 0) @@ -859,7 +863,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); @@ -885,8 +889,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); @@ -937,13 +941,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), @@ -959,16 +962,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 8538c3e5fa5a..faad4fd28e85 100644 --- a/drivers/clk/at91/sama7d65.c +++ b/drivers/clk/at91/sama7d65.c @@ -1093,24 +1093,30 @@ 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 - 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); + + 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); + i =3D of_property_match_string(np, "clock-names", "main_xtal"); =20 - if (!td_slck_hw || !md_slck_hw || !i) + if (i < 0) return; main_xtal_name =3D of_clk_get_parent_name(np, i); =20 @@ -1218,8 +1224,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; @@ -1264,8 +1270,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); @@ -1315,13 +1321,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), @@ -1338,15 +1343,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 ddd5ad318990..ddbf69beb495 100644 --- a/drivers/clk/at91/sama7g5.c +++ b/drivers/clk/at91/sama7g5.c @@ -971,24 +971,30 @@ 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]; struct clk *main_xtal; bool bypass; int i, j; =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); + + 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); + i =3D of_property_match_string(np, "clock-names", "main_xtal"); =20 - if (!td_slck_hw || !md_slck_hw || !i) + if (i < 0) return; main_xtal_name =3D of_clk_get_parent_name(np, i); =20 @@ -1099,8 +1105,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; @@ -1143,8 +1149,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); @@ -1193,12 +1199,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), @@ -1213,15 +1218,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 Thu Oct 2 07:43:36 2025 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 35EE62FC007; Thu, 18 Sep 2025 21:16:34 +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=1758230196; cv=none; b=nb8Wo35/elld/8CjcrdB1uNHJKypo7LL2ShdkkBl6reKNHno/KEJehcCn+6YOK2m46YKCMCTVljRP+x6V8a96lwFkzR0upEy0xU4k6Y4fyIlt0E0Hn9TP4vZ3fYlaQXX/y477BDpJkMcdmj0n/7WcqC8owR7/S+Hgm/6ReDe6GI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230196; c=relaxed/simple; bh=Wf79rFOX8K0bDHuXbUvrCx8GNF3GY+kFIQyuorcPp+E=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NxrMUJ6FHULEbbH8d7Rmvlc4Q14UbaboxGAl+7vyXYbOr3k53YlygK9nsGf5tXfcPHNMs9/kZARqL02pubyW3YQbSfEzZMStD62InSNQiTUX+HAby+2IxT0++DWxgnhJVJPhgXJGl4X8rljiYC+hxEawth/7I99ICoqLdjKKT7c= 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=izRI1nMU; 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="izRI1nMU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230195; x=1789766195; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Wf79rFOX8K0bDHuXbUvrCx8GNF3GY+kFIQyuorcPp+E=; b=izRI1nMU26NQeNeQQU4NtTfRMbS6BmEN16jaNAnd2Ipf6uW3PcAtCfLl rRCZ8/FImNhfbR1zkemDqsciignUt+IcKjfXZSk555wFG9kuSAidDGRCK +m0VbnZa0wkkp5AK+8x4Pn+CzSePIQ2corDLSMR+84lmwkCc8L4+RAccJ NsAjIYNZbCU5646ZzVFMQXs4URGbJxfN4EouVKdCgQgAACKClUmlIPcQ+ 73IHJEB+2iqtyPvotz7FoD5jVRgV+9L+VrFBJhB1WoNNXlxNLuTl2MY7Q wn1OYmcN5W2bk3fzImJaVQeLM3S5cVBX2R3jrd5Pl5zIVs4cgxd4fAPb8 Q==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: B/mbOGIqQf2w/Wtnudxn9Q== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071385" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:24 -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; Thu, 18 Sep 2025 14:15:52 -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; Thu, 18 Sep 2025 14:15:52 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 11/31] clk: at91: clk-usb: add support for clk_parent_data Date: Thu, 18 Sep 2025 14:15:53 -0700 Message-ID: <6979b3734462c97381159f3968a3f22b6193e04d.1758226719.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 b0696a928aa9..b2503fad4543 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 @@ -390,11 +399,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); @@ -403,7 +413,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 2aa84c49bd2f..84dc53849ae2 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 0266119e125e..536f1271d62a 100644 --- a/drivers/clk/at91/sam9x7.c +++ b/drivers/clk/at91/sam9x7.c @@ -746,12 +746,12 @@ 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 *main_xtal; struct clk_parent_data parent_data[9]; int i, j; =20 @@ -816,18 +816,21 @@ 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: + 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 @@ -882,10 +885,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 faad4fd28e85..986e8ef57dea 100644 --- a/drivers/clk/at91/sama7d65.c +++ b/drivers/clk/at91/sama7d65.c @@ -1095,11 +1095,11 @@ 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 clk *main_xtal; 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; @@ -1169,17 +1169,21 @@ 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: + 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 @@ -1263,11 +1267,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 Thu Oct 2 07:43:36 2025 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 6F9112F3620; Thu, 18 Sep 2025 21:16:34 +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=1758230196; cv=none; b=N6IGnlwp9U/uLc/8FMX6lt5T1YcInzWuQnl854wd8ibTwY0ANE+n5/TPI5DNMrJWbwObKMMs12pHliXtN8x/YdoIwYu6Lhdehfa2xnL+uQYK2nJneuEld0tVlvp1gE81JUXoyn9WCxBhLl0QQiCufyX3bsBsNxRvMcWF6CyzhrA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230196; c=relaxed/simple; bh=jzw7cbv8gGSdDKCkOVCyqm1lNPDSOzs55ychUDzk7Aw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AezpkY9r8x0yRg8LrRXIE+aGwwiUeDuv8o34cebDKhKcN6goNeHIVjLCajBYwI1heZ2SBZDsdErX1ljjAdjkcChULuVVgbl/TXnCnNxB0VN3WHC67zCgiu1j+GNdoYwTqG891oXSUu5D35W2I9g1eWiyDAxvRjDg19mzbpmG/3c= 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=UkHHHz07; 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="UkHHHz07" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230195; x=1789766195; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jzw7cbv8gGSdDKCkOVCyqm1lNPDSOzs55ychUDzk7Aw=; b=UkHHHz07vQr9XBQTx4uwis64ioryqqSo2xdtKSGeQEDe7IrLUI3Y2UjT 4gmHJKPQN0dguAOINB79QukIGO92BKkJCS0EXV7ZJuQG3BS7+uu2OZckY mhfP8TPE4xR6/jeS26v0U6p6XFaYeR28/mU5GeDghUQXPicPz+Uo6Ovw0 GM7mSNDL1hJ7pKSWTpVZ+YzN1R8NOKasJnAAZeW6Mjf+7SfuaEjQ4wpFv cj3lx+/9vDTi1lU78kwk4tdBTfNIKbY+blm14s5HIc3RU3DWSHU6XQJkq nL6tfUnxL8FPYjYVUaiXUPWzBg0O33/c0/UwbHFaQRs33ZeSj3A/E1sAC A==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: XNbh6R03R9SLup+zPIhyOQ== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071386" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:25 -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; Thu, 18 Sep 2025 14:15:52 -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; Thu, 18 Sep 2025 14:15:52 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 12/31] clk: at91: clk-system: use clk_parent_data Date: Thu, 18 Sep 2025 14:15:54 -0700 Message-ID: <333d27a5ffdfd18a4dffd501aad7e8dcc3ff3b28.1758226719.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 --- 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 84dc53849ae2..d6ba32e348ba 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 536f1271d62a..9262875c414b 100644 --- a/drivers/clk/at91/sam9x7.c +++ b/drivers/clk/at91/sam9x7.c @@ -921,7 +921,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 ddbf69beb495..c8219fbd5d1a 100644 --- a/drivers/clk/at91/sama7g5.c +++ b/drivers/clk/at91/sama7g5.c @@ -1175,7 +1175,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 Thu Oct 2 07:43:36 2025 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 94FAF2FC892; Thu, 18 Sep 2025 21:16:35 +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=1758230197; cv=none; b=X5fe1cgP0kN6YTVCUILlwvDgv2GKycGQjYk9znFz/xRa9oW4+uBdGEDs5ZmTJ19Si51ACjky3+WyJOqFmyubOdXUe3XbxJ4cgaPZNwgLiP9SuDm1froCXnWRFJU8SWx3v4g/iJEnoJNhHiVEVR7wZ2VZ9dbeGuU1q2/ydy7EU9k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230197; c=relaxed/simple; bh=xVtTdz67TIDJp0bBOLbwWbSjBCKlKESMlqlocbWr/nQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UVTajH5LaLBbH7xq8IwdYqo2kEghmpaPE1RIxTln3Iz65znfQ8v3lpYX1AazF9iLBxMzDapD/KSPfdtTuninZNrmk8XdnwNr0ure3DqMrVzrkyLoyZYCdJAs6h8KXZTY9UmXnGyxm9Q0s9UEkqA+o/nkWYbAfgFPVFQEOG90gZQ= 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=Kt8Qd0S8; 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="Kt8Qd0S8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230196; x=1789766196; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xVtTdz67TIDJp0bBOLbwWbSjBCKlKESMlqlocbWr/nQ=; b=Kt8Qd0S8b3yU9prXdM/JPQCo19zTW/FtntW2QJAKy7IffFARM9mahgLr NoJfhx5Nm/9zVKhRkIdfk+gnCf/H+8xzUGKaznp0llmpMJD1KIzJyguBR e2vq45EX3VSi80GvMSQMvxuZ73W+eSPEaZ0dKcsEgNTzgvwgq//zeDwbT h/TviLm/VdKp8u25Lc51Yas6NNcNdLAFRrGPxdrA5xAEJBH9nVcarDCUS SXe5U67gcmSIaNnu5b8/iqqdRCsb/P8ZtfyhA06GvATvR0/Qcd1AOM4br gViGaemD65cwI9hYrQ6bNGy9HhgVXXQ8KAMKrpNrfy92OaVUBKmkaYa8S w==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: jwVSVcSDQpybBC905lv1Ug== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071387" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:25 -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; Thu, 18 Sep 2025 14:15:52 -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; Thu, 18 Sep 2025 14:15:52 -0700 From: To: , , , , CC: , , , , "Ryan Wanner" Subject: [PATCH v4 13/31] clk: at91: sama7d65: switch to parent_hw and parent_data Date: Thu, 18 Sep 2025 14:15: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 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 --- 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 986e8ef57dea..38c44b5d5d42 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. */ @@ -1299,9 +1299,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 Thu Oct 2 07:43:36 2025 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 106162FD1B2; Thu, 18 Sep 2025 21:16: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=1758230198; cv=none; b=mFmCoq2h3GrbIRjL7g0ENSJzaUr8X09Xq6RpiiUgEBtCgv904Fp9X7t4ASi4YeYZ4SVba5zaE2ci/zAFGXdZBvCrflMpXRL1dCayDy4zV5eJmGOibQNCW/lBeuxjaB6iw+qAY66Dq6eXDDthkIg1wly5lsF2z3oCFGjtxHzlnEc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230198; c=relaxed/simple; bh=crCaMaSWmdFRamt2gOK8NsRYsA2FYBdVL6EFcIXUhYQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YFIJJH1En783bMa1iISifcZpPzcgmINrb8Y1aFmAIkwH8piyRJRqr4aPLCw5geuIbzcT4sUttWYi2q8ehCZGp9DB93h6xFXdWsSLJMQcP33iEm5P0Mjm88g7JKm+dj7XxO8vDNIhgy/ua0n/A+VDe1RAkJUmSaxjLrdOHeyFkoo= 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=Nrlwr765; 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="Nrlwr765" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230197; x=1789766197; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=crCaMaSWmdFRamt2gOK8NsRYsA2FYBdVL6EFcIXUhYQ=; b=Nrlwr765mqomGpYRgZSbRFhE6SVJE47FrEZglrjdosDj8yukEkJFwn2T FgfV4LtJ7WUrD9W1VJuqCWi2yQl1WQxe1QIXqf5HaxgXm612BqP5qhtVR L5HqbImDX2gpK0Vj49drOVeBKch6H61+0PG2cg6+erMazZIqLEuo2gY2t Y0Wh/HEZ3YbFYOFW7TenvY7gNp/sWVryx5ROS14ThTbK1Bet/RMbV5PQw p4WQWbppVGFyUf29lZggqkqOwAMduWgxPbGKFKfXOEPNcDVNzTwgGE7GL fgNbK3fSMZhcmIj5WY456vzG+GqkmaUb5IYu+z0i/b2rJ9K29Y4rJFOLy Q==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: n94q5wq5R9aAaD4TEZQ/3Q== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071388" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:25 -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; Thu, 18 Sep 2025 14:15:52 -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; Thu, 18 Sep 2025 14:15:52 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 14/31] clk: at91: clk-pll: add support for parent_hw Date: Thu, 18 Sep 2025 14:15:56 -0700 Message-ID: <50f2f18fb795c6f1e11073ba6ebe61cee9386433.1758226719.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 --- 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 249d6a53cedf..f973c3b1bbec 100644 --- a/drivers/clk/at91/clk-pll.c +++ b/drivers/clk/at91/clk-pll.c @@ -310,13 +310,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; @@ -330,7 +330,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 d6ba32e348ba..b983e44b742a 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 Thu Oct 2 07:43:36 2025 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 822A62FD7D2; Thu, 18 Sep 2025 21:16: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=1758230198; cv=none; b=DLoQ7njqIqdj1spcx0NvyzQUFs03fX0TNFLSwER3zZHvosoBY8eiW9Y9YuNI8YAd4s2MGH+QY2uNARytMBPLVOhK137wYqhXObLsvdql+LzteTzVvfeOGy2nCre6DXdV0hHuesO4D1AItoqPB67GChQsLY9lLh4i/QsIeV6z26w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230198; c=relaxed/simple; bh=fdvDSnlhCekCN9FzIZPS7s3nu6PC8FPbHxM35J6ZGKU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TdCxYZJD4fdavjfxtKdS1XTATe70O0GzMPVWjzOjl0eNhXD42fDYhTgkWUNfk2xIFTCX2kNt4fHf2v56ToPCCdDQdLuGrElB724/4wSpL73uFXpoDOv3zfSjPwsyS/JGHAgeBzlEBNY7ONOvlAGtyX0tXXksUko1yBBDACQlzgY= 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=d+Z3MCxn; 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="d+Z3MCxn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230197; x=1789766197; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fdvDSnlhCekCN9FzIZPS7s3nu6PC8FPbHxM35J6ZGKU=; b=d+Z3MCxnoE8KYKTkozSzgtDQBZbtUg01Soc0ShErjpK6ifcjnnWZPMGA 8c68nCJ8vjYJ/SmOWhAgvpByRHZihOLWxpeFJnMPZBcmEk6g1h1Aum4Qg 3DY8Kye+Fd/YFZnQANKrJGRXQxcrLhIbUKVQAnQIdKSqRFtCVgPpJ9j6O LB0HzwUUoZF7z33iQPOw7JCkiQqCDICpBjkQOr+vykHDFGs5EwCVPD1R2 wSDTyHUGuCjlRdgfmPOHCr/86C32tYrElbzJoBw3rj+lm+zoX3FOnSe2F gpyd/GDEyQGQJQn6NXlE5UDAYvrvowOvaAvHUcZYxPhOL1RCWvuHTCanB g==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: Dml2vJ7aQV6a8e9MD778wQ== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071389" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:25 -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; Thu, 18 Sep 2025 14:15:53 -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; Thu, 18 Sep 2025 14:15:53 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 15/31] clk: at91: clk-audio-pll: add support for parent_hw Date: Thu, 18 Sep 2025 14:15:57 -0700 Message-ID: <3b706a9f568c08a35f054ac574f47be6037de889.1758226719.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 --- 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 a92da64c12e1..da9b2e699dcc 100644 --- a/drivers/clk/at91/clk-audio-pll.c +++ b/drivers/clk/at91/clk-audio-pll.c @@ -450,7 +450,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 {}; @@ -462,7 +463,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 @@ -480,10 +484,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); @@ -492,7 +497,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; @@ -511,10 +519,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); @@ -523,7 +532,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 b983e44b742a..37ef6f63de26 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 Thu Oct 2 07:43:36 2025 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 C9DB82FDC47; Thu, 18 Sep 2025 21:16: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=1758230199; cv=none; b=QSsni0MA8Q0FNLzzO2bCYn+kDuKq4jWHmA7kQ09VchyyXzuR32NbdzxxcYsK+pehgmFGhkMu6AxVnUTbCMO/lKk6o4u5C/az6MkeWqkgapnAiVknNAsggsc3TudMLMbVKBJdS9bPYRfc8VRQsmT7oq9WjWksP7aOD+Gt+lenWwI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230199; c=relaxed/simple; bh=dtc6B1UvbIsG8HdKb8XJYGcqdo1EPUsmQ9nFCtQkpDM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OdZcnOpz88nveAPtCKMCpaPUONc1QDNvI2SJh134lfHlyCsxzsHvRN8K2muPylw0Rsu+Lhc0mFm2JYZyvEEWSittMXmtJgce52fJK/7prf8YoJKpOPD8H9rRlMnafEPylI6vm8egBZ0s675Kr2l25w/VgTLsdolmgdRQhDsQ5HQ= 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=AA1mzgqt; 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="AA1mzgqt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230197; x=1789766197; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dtc6B1UvbIsG8HdKb8XJYGcqdo1EPUsmQ9nFCtQkpDM=; b=AA1mzgqtmq8VCfPQuDlWnf0hvqZWPBEDhMUy6v+g/H5XGEVHisZP7irt j4jYw90jxHZaMkG/flDjBY4i0aqAuubaT0az58KjPGHDSNg6rxF2X/VNA CGlV4DXhXpmNVq3C1S2EkkyfT/Ma6x4cV6LkWWG/M5FTbBBUC5N3/P1C5 kPuGYYnbZODDIxbUXV/Mhkc/noFKjrYtZS4EP30cV0s+Iksv72P5P8HmW 4PY4sekOmqwGSKLVz6e78Ayuu/MpELhGjHEg5/5WnbLvG0I3PGXNwNWsF ZAgpep+4PQW+w3J0+mBcoA6iVw7LGA030w/1ZdgV3mRhz9M4mDHplsHzJ A==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: +v74NaneQRq7ezlDHErkgQ== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071391" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:26 -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; Thu, 18 Sep 2025 14:15:53 -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; Thu, 18 Sep 2025 14:15:53 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 16/31] clk: at91: clk-plldiv: add support for parent_hw Date: Thu, 18 Sep 2025 14:15: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 Add support for parent_hw 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 --- 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 ba3a1839a96d..c5d0c6e27397 100644 --- a/drivers/clk/at91/clk-plldiv.c +++ b/drivers/clk/at91/clk-plldiv.c @@ -72,11 +72,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); @@ -85,8 +85,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 37ef6f63de26..db067177e6ef 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 Thu Oct 2 07:43:36 2025 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 924532FE56D; Thu, 18 Sep 2025 21:16:37 +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=1758230199; cv=none; b=riSUpgGqgFNXe9tGawztCpC2OZAtGDBP14nfNcSi9tlBDltn132IheRYoNh+Y76HI/U5yXZ66UH2Lb5pBJMlhpqn0onFoTCu9iK8inp37XSgnrm6eMFXq4VYFjDDYm9hK1DB6LGY0uFfMI9tAdfaRLcPS0wRn07wp6ayvni0q1U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230199; c=relaxed/simple; bh=hZmKwcigFn/Avgkau1VnG/mv5eV+/qvPhkwd2AcWV2c=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CRloXp0Sf5H03cAvsRiuva4TCKlz2TIXslzWP3O22FNID5LSmTvl0hqsMhuyOarE0K2L+PTHsUdw5ZMNQBgU2bbdd3ilEh5Yj+w6KJA8lx7wecGWGvCn+EXb6zT4oJ5t72Zz35cLzNOLRSSsUXq3QMLktlIucPgNGPgz+6wOGyk= 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=HQ9nuHgd; 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="HQ9nuHgd" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230198; x=1789766198; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hZmKwcigFn/Avgkau1VnG/mv5eV+/qvPhkwd2AcWV2c=; b=HQ9nuHgddwUpuKFGkqt6O0RgAkh/4+aFYlD3MB6240Jab9uKK3EeU9Kp 1LsuNcPl4+xiOUndIheHs33zb+9Z5a04yBr5f6ANl+4e5KEeeCTrjaOKe Y1r1gNCS9b8wUWtSNp07EIyJIbEAadrSQENybBR0Z8rN6SqKcFQ718z2E cMPmhfaeKLNqJs/ZD+QPQYY5MiLVvdH7deLXbH18wY4i6jp6KwSas3whJ lE3jE0LjrfMlDbkcW1nEESC0xNOi21DQq6iClgJPA/C526dCq5Elve+Fx Qp9DHPOr6tP1D4H0nTPn5m9/1GGTG0HOQLGMdQpzYQn1se3DGr2OaPGkf Q==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: yinyVvRuSa2Q83S8uk8Ugw== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071392" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:26 -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; Thu, 18 Sep 2025 14:15:53 -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; Thu, 18 Sep 2025 14:15:53 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 17/31] clk: at91: clk-h32mx: add support for parent_hw Date: Thu, 18 Sep 2025 14:15:59 -0700 Message-ID: <9d37104c581548a995e20a86f3501bee10b6acce.1758226719.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 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 --- 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 1e6c12eeda10..4b709f9bd831 100644 --- a/drivers/clk/at91/clk-h32mx.c +++ b/drivers/clk/at91/clk-h32mx.c @@ -83,10 +83,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); @@ -95,8 +95,11 @@ at91_clk_register_h32mx(struct regmap *regmap, const cha= r *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 db067177e6ef..64faaa8123c9 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 Thu Oct 2 07:43:36 2025 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 6EB9930EF97; Thu, 18 Sep 2025 21:16: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=1758230200; cv=none; b=lDwq8wL7wWpS9OWk6ZvAWPfz+NqsW8lfRrEzS1FHQeAwhONavgjEiETKYyYTKq9eDKvmRQLeBCiS0+BbwQsI1BfWlPcpEpXal3DVKadl5QQR2621Q2cPrKjBGXAV5hVeEwp/dFYTokfTA62E6lkUMVat96vGqFZ++AerT0bMSI4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230200; c=relaxed/simple; bh=4kVZWG6e0OXi5wjRbH85D47K7J0KyI2P518ayHRsyBE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cV98w5F3Gb6UM+okhDfKeQvhAuaBX1+br685lq6QIWApFlUoV5A21kfpVJvKqkojVRXInYouxdWJtvNdGTrPPhLRj7AXAWeO/BkVEQghoUGxlBWtIK5MAlI13IEnNA4DQX6X39SgdcVldw4ZiGW2mK7EYEkI/pNcWdbGyUQoMuY= 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=REjeozVB; 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="REjeozVB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230199; x=1789766199; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4kVZWG6e0OXi5wjRbH85D47K7J0KyI2P518ayHRsyBE=; b=REjeozVB4VGfUETj/8LSLUT45GkOZGOOYKmq7kERIVUol9sYpWVP4ILx /AXitGy6xnr5D1euSyqP3RV0HGc2MigyHsMOM440Dk2JwCNVbOBLG4jtH vg0q0zBsV7ndC+1vT2BR1PfiRo7L3t3K4p22v/tjsnsw/tzjlXI3LG1Ij 66U7RcUgtTWryAp08XNCyKt0mbmeflmBSrUChnIZVUKLXDnryxjLut2oW 6pqXwX73aX6GNGPPxQ9jYYnADuqw58UFEzKlU30joXslecsaBTDkynGWo 2sEjl75Kf2Tik1kzx04g3IXUK5LPWjJMzkacwxI7sI0zOPRrVdO6r5y0h w==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: Mh/QYQTgQDadXleJvaJb6A== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071393" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:26 -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; Thu, 18 Sep 2025 14:15:53 -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; Thu, 18 Sep 2025 14:15:53 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 18/31] clk: at91: clk-i2s-mux: add support for parent_hw Date: Thu, 18 Sep 2025 14:16:00 -0700 Message-ID: <276cf23db4b81668bedbcb7b2dd310b62c2ad025.1758226719.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 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 --- 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 64faaa8123c9..0a03e44237f1 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 Thu Oct 2 07:43:36 2025 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 BE96D313D42; Thu, 18 Sep 2025 21:16: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=1758230201; cv=none; b=YiaWj205ybM3J9SXIhHNFRlnCua/dwin3jgRAFc3m6+Kdg3zh+SXMQQJE23l0jvI+vBnhqto7Ukv7PidmgeLosOuIHtlA7QxYWS5RocqKt7S/P9yuGJfdxVfM5AzrRRx7Xwupzr+Z8Rhc4sAJ8HlcdqU8kG0HXHPZCs6HTpa+Es= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230201; c=relaxed/simple; bh=exJ53jdmPDn4o8MZUDqAr7iOCtElm6cqfxMbjBXrCww=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RpNWbJuHXow6XsPp7rPhYhfn7toJUxcIrF2NGWfKaEb9cS2vpOw+fyqLtxkIlqYf22cJABuhh+dIli3Dsb+Scdwl1eYp4yEzchF+RQnJ2xblsbFxKJ+E3879EyTh19l2GY5iCRgHqw6CQosTbk/5QUA0YAAiNiPWmQ48kddFA3Q= 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=LotrB3mO; 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="LotrB3mO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230199; x=1789766199; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=exJ53jdmPDn4o8MZUDqAr7iOCtElm6cqfxMbjBXrCww=; b=LotrB3mO4aPsj9f6mkS3CHVU3lVMhiuiVKCxinHnHUNsuJyWfqBMrYyP YW3H9bCKWwlE9n4pPp9aL4RvAC+pCZmcBHYp+0ykIjqagogeNcYS3uPUj fxZlMfa+iZORiuaqg91+cs9zIpTCfHygA2AT7QpzWUXpbj1VRLJl4vzBQ 4z7PFZHlQHndjmDAex5NXQMR+j4VgdEmAimi87H4zPkCwJ/agFYfkieZ2 /m3czrtcPNVaJgRGtNUtHVsvMNr+JS24s5i1eoDHWrNHkNUYjjKKmv+wi sDOzBbxJK/GZN7iHe+wOqQNXeoh7Kg8hYMdEzItkNX3mNJxtSq+BnlL4X Q==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: bluABRnfTUWYvZa/ZQ2CVg== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071394" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:26 -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; Thu, 18 Sep 2025 14:15:53 -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; Thu, 18 Sep 2025 14:15:53 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 19/31] clk: at91: clk-smd: add support for clk_parent_data Date: Thu, 18 Sep 2025 14:16:01 -0700 Message-ID: <4e3f834e6901f7fcad0e697b56c85573c8e7ae52.1758226719.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 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 --- 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 0a03e44237f1..e16621e01678 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 Thu Oct 2 07:43:36 2025 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 1E3DC31960C; Thu, 18 Sep 2025 21:16: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=1758230201; cv=none; b=jOHcSSiYbW0kvfK9uOKXcTBw89KScah3NgmcEOatrKKt7fDA3bQ+SL6RUJ23MgnI5Ytlu35aPDh2qU+UPkHmfD6/St26VJoOAX60nM452LHRfiUCxLzSqXYLZyYeaRj8ASvrtoJ966dGtMQThS2h1aTXSPZFZHw5XSRaeLt0Lg8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230201; c=relaxed/simple; bh=TmdcBDGd1EsQ14kmaZJL0sFDV/0wAi+LwYya0DCX0V4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oRGHgLKIqqGqfsdVDdlKz+CcunZxlE1u9kIpvMJcfc4EjG7NG7f2t1GqtMCsd2URs30UB+Dbh4+liMB25Jn7fT2eqgEX+JHGXyVZzM75B4WvYPDIzhXUKV5yK9crY7QmpIozDBLdYosmars6w4AfNS5BbNR4lh8zu1jpnRAzAwM= 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=SMtVUM1b; 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="SMtVUM1b" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230200; x=1789766200; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TmdcBDGd1EsQ14kmaZJL0sFDV/0wAi+LwYya0DCX0V4=; b=SMtVUM1b9ZvjtlUy91RbbDio/uBRg0xrT7WaBclZQd+PSXMrQwLbww7P 2Y7a7tcPz274VYDYtJGKq93rOb04rihdn/sQzI3QbBkU0sr/Z8y52R0qA uZS1vo352t3qFGISkQB5zn6u2/YPYSwsH1Cjd1ptpIsi5+wJicsCFG7dN ksbT4wWAsXXhvf4TiGsheiy7BwOYQR1AXhpQIWjnCGU+eSy0908YbybJ+ vboj33/4Cy8uitxZHo5n80Lr/BBNiI3SToTYSnwAzhC6DgtYkbiVqORec SJk7VWON8cPU611Yo1LpmS63zzw3T+6CZuUcpKDKT9FecZLjLcU/F8j51 A==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: LD1SDXhNQnm8xAY+SKdYoA== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071395" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:27 -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; Thu, 18 Sep 2025 14:15:53 -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; Thu, 18 Sep 2025 14:15:53 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 20/31] clk: at91: clk-slow: add support for parent_hw Date: Thu, 18 Sep 2025 14:16:02 -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_hw 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 --- 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 e16621e01678..1af0d5bd2e08 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 Thu Oct 2 07:43:36 2025 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 C667331B838; Thu, 18 Sep 2025 21:16: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=1758230202; cv=none; b=dOmfiGgbXb//+vsvODtx++jWkp28mlIcfe7zAKY1Tq0mOF5qWKBjLXZ9eH0KYJa9kidzYENeNrTYPQyz/gWBVLIbAbvOT0KhDyhFFvu5wtDoYEh7/1MOCJBXnHldH6RPVuBPGX7VMRHgVVSu1zG9N5b6Nr11TT6zo73d2lWv01U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230202; c=relaxed/simple; bh=l9bNuAZzkq8mBVyacoUSJx8C49OSIJiPibpV3FonOUY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gtXG58cjR8l/LjMsDh8d4U+SxAibXOfVVUHYo/2DWBI+UybQZp4kmxLvZzjNx+jiCynBc40aCtXRD36gcuE5I9B0vEfTs6cbykt6kIr0K01PMOLhIMczjcPkiBS9jxq6lP4Cor4nvvtzJd7oCNQAmx4GUOMqJpw5lQpZN1kTNcA= 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=PEAHq/Nt; 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="PEAHq/Nt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230200; x=1789766200; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=l9bNuAZzkq8mBVyacoUSJx8C49OSIJiPibpV3FonOUY=; b=PEAHq/NtFhu9rTNzf3ivusIzNEHHpEc0JLcVBCE9zomn2BxuRNkpAxMI xJLJG39WkRCfes0U6cXRsLJOr1nZtKaL2ukx1ZFTEatUe4XBej/LreEj1 asyWd+b/YxLT0XBfJbiGfHvQMA1Kl85xKe2LFP0tuj3EB+Eu7t0VW8wpw /W2yeHQ1np91trGcMN9zSjku2Wheal9xFnm6EVk73wv1uaDPBrcoRAvY9 yOXCTounblTDgXeP6zIzEkRU4uf6/74w5GTYKQ5/djJYfgrBmRc65EYSr 4fxx4NXrdBPoh9PYDv5Z0BMStQG2QV6Hds8bUyxQhh7RUSfGjnsUH7zRg A==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: rIFI/dNBSJSYZRQDALX+QA== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071396" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:27 -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; Thu, 18 Sep 2025 14:15:54 -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; Thu, 18 Sep 2025 14:15:54 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 21/31] clk: at91: dt-compat: switch to parent_hw and parent_data Date: Thu, 18 Sep 2025 14:16:03 -0700 Message-ID: <628859234f4b2523f43b3ac05d5e29ceb05a7f61.1758226719.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 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 --- 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 Thu Oct 2 07:43:36 2025 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 9B25D31D745; Thu, 18 Sep 2025 21:16: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=1758230203; cv=none; b=Ot0BnjMQav+5M9METpVOWAfsQRr7o/P/IY9AORf8i+hJ5bfuMJGc0BnUm4uqGdOqcqa8Fj0r9amN9C1KVvkjg5VPEeHs3UxokQZQ0hqlpjiaPmasJedfp2eoOPVNg1Kf7Q78bgX/tcQMB+pOM+MCDoiVmBTeISa/Fty9kEOSerk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230203; c=relaxed/simple; bh=iAP3KtoYiGiAIDJG+rRnha3nTkdIhSYADFJkd7bf+bU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IitA5sEkjq1GPREqpkzTLpiWeESvNvUirYdVn4agf7EI/Rxw0GWEw+ZkbbmyJsrYEqK2xejxwqhOapD2WfdMDGrlXqO9bMuIh3EvSZZDEvwjSWE5NUGc7HeyqBLH/hoAWyN/Hymp7XZTxIxtNNNsHr4Pnah03JEljcsM3fHHTmU= 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=ZgGccALd; 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="ZgGccALd" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230201; x=1789766201; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iAP3KtoYiGiAIDJG+rRnha3nTkdIhSYADFJkd7bf+bU=; b=ZgGccALd2uoLG9zBEIOTeOMyvLUZ4i4Uv2jiHgaQq92I4G6HfBgUh91W rI69w7AH8pi3BqhH52noE4ofJNqwKmIVig64oThiCOgXC0IQR8vP9oOwF J9mPTYZ4Qr1gaKWK+1p6NprONDevJ80czLXP1CDVKoE08H1vtF9a075Dv EgqGWU7GCjy96XManU5QxPIGj+cP9zSki8/utxUyxfx9Yl4s1uWMIXYxP xAg8OyscZTzXM4h8p4Gh5sDOpDTxP5aYewfhB1ymFhAwJN49isRbdHrqI Ool8Z129TKiSvOKQzaggWA3OgCXVUvRYqKe5Qdav4fwYhuNQDI9LBcfwl A==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: PRQVu+OTROaUqDILN1QvBg== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071397" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:27 -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; Thu, 18 Sep 2025 14:15:54 -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; Thu, 18 Sep 2025 14:15:54 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 22/31] clk: at91: sam9x60: switch to parent_hw and parent_data Date: Thu, 18 Sep 2025 14:16:04 -0700 Message-ID: <17196aeed3bcba15219b7e6513aa3badc2540066.1758226719.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 --- 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 Thu Oct 2 07:43:36 2025 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 1E4C831E10B; Thu, 18 Sep 2025 21:16:41 +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=1758230203; cv=none; b=jTEuta9BAO0wCzgoX1FGJfi0DlrHJclomNMFHpuiYkDhotXdDhJKC9BCW8at/TB5AKiGobL0l/iLRHXu4ZB8Y4O4r7hm6Wr45m/4GgjC/4NF5HHnLjP9/PwmyEb6fW7Ay+stLRJDMhyqtbO2dXp6a4ZBoYrdCLnNgJVliRpVg3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230203; c=relaxed/simple; bh=QB8JyTFY0ZzZF+uXc9lQ99fQbGsgSmcvnNL5f+ljo/E=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ga0hrM45Is/7dfhNS2E5e/Wd46gqxemKmqJkqlXnFsGsJ95Ba6Tn+GMEvMihyIBVVKxCSTIP+/y+DsPPP363rfmobGU9oa/J8GB0um4dr/BHOIghAKYWIzZVPKc+VOn1YQKbsxLX+Bq1+ZobfrUsRTR5L9YxU1Aj+mDMb+i7zeY= 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=lOGosYGD; 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="lOGosYGD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230202; x=1789766202; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QB8JyTFY0ZzZF+uXc9lQ99fQbGsgSmcvnNL5f+ljo/E=; b=lOGosYGDNL+7Xa284SBFTaIuZIcMmDYFLZgETTw+n+40qJYY6s7OCNwV xqYdYDpQ3VmfSA7uxu6FiHIQRtCvWKniED0pjRe65Lt1FWMFBqeyKtFCb 40nX2l0HtudDmnk2xj74P4r1pfibOErhKs1weaToqBE0dVMoDthOb/5DV Bj/81pZiTZMmG4pR/hAQ3Dg65VZ1d+DC+fgT66QPY5ovZfzcagJlgv2Nt E6P6Tvx7AyMTlSo5NgmCv80oG9uObb4zpBIg/tP3lgt6TpGM5DId0NBfa Jbxuxkk28Nu4v24CJn75PmfTLqg0X4vNXwgF/oGeDg+V5ykL7/WWttxn5 w==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: slar8cZ1SXexvpo0+Uj5Xw== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071398" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:27 -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; Thu, 18 Sep 2025 14:15:54 -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; Thu, 18 Sep 2025 14:15:54 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 23/31] clk: at91: sama5d2: switch to parent_hw and parent_data Date: Thu, 18 Sep 2025 14:16:05 -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_hw and parent_data. Having parent_hw instead of parent names improves to clock registration speed and re-parenting. Signed-off-by: Claudiu Beznea [ryan.wanner@microchip.com: Adjust commit message.] Signed-off-by: Ryan Wanner --- drivers/clk/at91/sama5d2.c | 157 ++++++++++++++++++++----------------- 1 file changed, 85 insertions(+), 72 deletions(-) diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c index f5d6c7a96cf2..231cec1f80e1 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_hw *hw, *audio_fracck_hw, *usbck_hw, *main_rc_hw, *main_osc_hw; + const char *slow_clk_name, *main_xtal_name; struct clk_range range =3D CLK_RANGE(0, 0); - const char *slck_name, *mainxtal_name; - struct pmc_data *sama5d2_pmc; - const char *parent_names[6]; + 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 @@ -177,12 +177,12 @@ static void __init sama5d2_pmc_setup(struct device_no= de *np) if (i < 0) return; =20 - slck_name =3D of_clk_get_parent_name(np, i); + slow_clk_name =3D of_clk_get_parent_name(np, i); =20 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)) @@ -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(main_xtal_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(slow_clk_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(slow_clk_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(slow_clk_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 Thu Oct 2 07:43:36 2025 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 7480331E89C; Thu, 18 Sep 2025 21:16:41 +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=1758230203; cv=none; b=kZFG9NiJZ1nrneQWlrDAqsi0MqEi1xDOF4/q4aipqNI/8EUu/dRjrQdeNfSNBT/Vw4b4VA65C/Tl7LqZo+z/twiB1O0S6Sul3t0xy40HVcuqkgHl3y+381sXv9UmmPEViem0Spa08cZ/MboXC0olhNuykd9+jmfubAOdHa2RK1U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230203; c=relaxed/simple; bh=lvaurE692FNh174h6e4E8YiXCoEBA9AEZ6HXWtw9NGg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=obnTPewmB/1thL31GBkTpTeL6lbfdo6rrRm29OixY9IbJ+9iM9fitdbupFefXPm0eCcsMdDP4U9SZDjzCK7RBmEE97HBKk0xeJkvWI6WiFHKUsMg6eF0m1etrcu5jy2ot4y8/UqhtpKwJ8Ol64kxfgpszBgzHOOie5BT0fI9qu8= 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=k8bC2Y7K; 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="k8bC2Y7K" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230202; x=1789766202; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lvaurE692FNh174h6e4E8YiXCoEBA9AEZ6HXWtw9NGg=; b=k8bC2Y7KyWH+1uV/yvBSMplTeZm4hEGzrQfKDU2+KScI1HNr3/TFzkmr a1ClXqiVb+74duDozsQtRWQ9Znn8DDe+NIGzSkwmuH5MRrnyrEmaNlsFD oXriwomaUqpXyHcQ3SNN7KAp+cTGXhhuDK0lxnk43zxmUwk1a1S+YahY7 esgmMhplkf3ofNLW76xsIzNqRwBDzf+05MqdCA4ycQ3rA1id3jGR+sEnH IQ4mZLi9TIfzoqvHCgPgXbjH0Il7x3Wu+fCGRIFUvQmgF39MSAKjiP8A2 cY4kUnp5f3ZoG2d+AvgzBsEi9wM6DRVSJhpj4A8E/z4Lr2rthOi31OQCb Q==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: +gF/1ptHRAWKgnpTdYHxiQ== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071399" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:28 -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; Thu, 18 Sep 2025 14:15:54 -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; Thu, 18 Sep 2025 14:15:54 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 24/31] clk: at91: sama5d3: switch to parent_hw and parent_data Date: Thu, 18 Sep 2025 14:16:06 -0700 Message-ID: <35853aa4f7d06a7aeec45dc553c7286e74cb53c0.1758226719.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_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/sama5d3.c | 112 +++++++++++++++++++++---------------- 1 file changed, 63 insertions(+), 49 deletions(-) diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c index 8326bb6a291c..65b0e776dc13 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) { - const char *slck_name, *mainxtal_name; + struct clk_hw *main_rc_hw, *main_osc_hw, *mainck_hw; + const char *slow_clk_name, *main_xtal_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 @@ -126,12 +127,12 @@ static void __init sama5d3_pmc_setup(struct device_no= de *np) if (i < 0) return; =20 - slck_name =3D of_clk_get_parent_name(np, i); + slow_clk_name =3D of_clk_get_parent_name(np, i); =20 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)) @@ -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(main_xtal_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(slow_clk_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,30 @@ 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)) + 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]); + 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(slow_clk_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 +233,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 +257,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 Thu Oct 2 07:43:36 2025 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 8238731FEE7; Thu, 18 Sep 2025 21:16: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=1758230204; cv=none; b=PE43jJB0uBJIYf+KlBbGSGTkFkI88D5CY2IIWibBPVlrxjt1gcvYRP1a0V8WZdyyoM4o5ktZA0caM9kmiFVrh0F4XBFhudqoL3doH7Wd+xCeuffzU2OHW3spB1C/Ph8NsY3Ltz3azyWok48A19Cenu5XbcVsIY4Y5cnaVL3vPlk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230204; c=relaxed/simple; bh=kL/TjbM8ca1xTfr+VQS5i/u+a7O27yD2bzK6kzqWDdY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XxxQIqpUJ7E5ZIHH644dvfol9e2Uas+vGdIyzz+uYceqM/mWn5bX2dsEEH/7cOTk84U3YMa3BqFli5KeTlmB7d4htDRtPGUME/YgRp7LASXe0ea1FpaZxeICTE/2aAEG24myScuZ0Iv4NAIjQ1Ut0tJVn06dDnMWnkfYBvz4bLg= 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=J4o3VJbY; 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="J4o3VJbY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230203; x=1789766203; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kL/TjbM8ca1xTfr+VQS5i/u+a7O27yD2bzK6kzqWDdY=; b=J4o3VJbYDXPahAu0AFM4V7+lei8jqRwCHcjtCbjrw+HcTuqjM6HJqO5b LPNng5rixpYLS2AXABChtAjidLq0VIGkRmO3gMfemJZwOC6UoGA7bPr0V lsvMZLgSF58tOWimkeGJdLpiP0ibeoSVvQ7Fgq0DENaXPsmWuldeCZ0d8 JJ6zfgGAhcnEPchPlfSCTO0rRW4gXdH9iwQa3HOazhLvwcGU/0HcjXhE4 iYudA4eatofHU4MxWId18cyHXI2B9ZJ/2kkPXjKdXmiuBXUlpa0zaicOT Ex4i//6S0cbKcmwsnx6Y++8YvDigulVZeLovGt5mvOUe6jMgtboA6WV+R w==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: 5VOez6SUS7aheHkdYxGwhw== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071401" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:28 -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; Thu, 18 Sep 2025 14:15:54 -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; Thu, 18 Sep 2025 14:15:54 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 25/31] clk: at91: sama5d4: switch to parent_hw and parent_data Date: Thu, 18 Sep 2025 14:16:07 -0700 Message-ID: <9fcc028fd62aa2f1a79b0d6bc4fb08c3637c1646.1758226719.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_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/sama5d4.c | 118 ++++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 53 deletions(-) diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c index 1ff9286148da..788683e87ccf 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_hw *main_rc_hw, *main_osc_hw, *mainck_hw; + const char *slow_clk_name, *main_xtal_name; + struct clk_hw *smdck_hw, *usbck_hw, *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 *sama5d4_pmc; - const char *parent_names[5]; struct regmap *regmap; - struct clk_hw *hw; int i; bool bypass; =20 @@ -141,12 +142,12 @@ static void __init sama5d4_pmc_setup(struct device_no= de *np) if (i < 0) return; =20 - slck_name =3D of_clk_get_parent_name(np, i); + slow_clk_name =3D of_clk_get_parent_name(np, i); =20 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)) @@ -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(main_xtal_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(slow_clk_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,37 @@ 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)) + 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]); + 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(slow_clk_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 +253,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 +277,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 +292,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 Thu Oct 2 07:43:36 2025 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 3CEFE320CD3; Thu, 18 Sep 2025 21:16:43 +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=1758230205; cv=none; b=cv3IamsxnrHF0qOu9LDhpaSE8S7Pg7rPBfU3yKFTS9ac1sI/Shf29Hv+ESmbvafIEUr52snkpWwgZIkWV2OaCVp3cTXY3g+4oUPxkjXSmStshW8VgJjZUEzJkqIzcxICeZ/bEtNn2znTlWY+jFrDzv6bwcxBRjPGqz6fR0hreAo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230205; c=relaxed/simple; bh=jz3tgRGRyI6GC9l2gIhHwJ05zKr/E2Q0GiCbAAitlSY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ft8Ds/Eda81qt1I3u3zp4IcLZvzkyNoGRkupoBPFMmTQiGb7Mp48353/JmQ1TXAiTZoIVxUQXLYIWOwCoSnpnb9PfroI9aBYBA/v4lnUiDos4LP0Rx9wh6YoHUvjO6hHHERZHJQGCEW2FoPquvkAdwJvA1C4k2QWmUUkerguVz0= 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=uc8/mAVj; 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="uc8/mAVj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230204; x=1789766204; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jz3tgRGRyI6GC9l2gIhHwJ05zKr/E2Q0GiCbAAitlSY=; b=uc8/mAVjw8UB7DQpvTHSjudhN+FlTj53EZ7W1s1ilmWGYQgW61mSTJFM aq3zaYoXy8aWGO8zKxZ5mgShtiiiImGjeNJEYg2CQBfjvkyLZmAxgzwfS cucLl0n9WdTw32jl8IpXSg+Vs2WRrTf0OAh/69Fk1zu2Zl7uiPhir0xx8 SlXBBWfbRRcKFvY/RdoU5tpOsEA8F2TZ8l3kV6WSDsM+vl16CXnigoLmj 5aIahBMQRhntPjVmQYryEHxX5RGSwKt0VRJZo79scdv4VvJLEfiCUzSXt ytXIKPyG+jOiJMjTc5M9e0CDwoOasl2tGD5/MSnOs2lfCGAPILu1rAGTu w==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: zmXHEi4HRHSg/jWFrFxgUA== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071402" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:28 -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; Thu, 18 Sep 2025 14:15:54 -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; Thu, 18 Sep 2025 14:15:54 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 26/31] clk: at91: at91sam9x5: switch to parent_hw and parent_data Date: Thu, 18 Sep 2025 14:16:08 -0700 Message-ID: <015b98fa475f97ae8e952343ee9703c9c0d37d19.1758226719.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 AT91SAM9X5 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/at91sam9x5.c | 108 +++++++++++++++++++--------------- 1 file changed, 61 insertions(+), 47 deletions(-) diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c index 13331e015dd7..46d5ea2e6417 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,30 @@ 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)) + 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]); + 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 +255,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 +274,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 +286,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 +300,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 Thu Oct 2 07:43:36 2025 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 C0E8F321277; Thu, 18 Sep 2025 21:16:43 +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=1758230206; cv=none; b=iXOmqrlBF/IoXuftYdLix3bW7mKPWcKXJQrKxgA1D9Krw3C1JbSr6Ak5dQ/N4avfAnMzqdRvIZTPAIMWx+wcPVVbw1FB3Wdt4/Uree7cOfF0CjpcYW99DPXMceEtxuZDnXVIRTr0zXUlDJacxEyKl8uP4njQT35uHVQo/BOCzD8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230206; c=relaxed/simple; bh=XCKw/fzhILEu49Iq3bKLiDkP1UiVyTS4zAjU4YzgJmU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KqrEH2QfGU8zkK2X0D6Cu3oz0qWkK65Bru0RrZzrG1vrqHikRdRJ0krM/pg8FUFSRa3o3gzKrs1HjMmHSEp1XM2LyX/7JKZswa+4jiVTaRMVgl9yKw9dZmjwQct6eg1mDSwEw3dIrB49xAJqjELxBv/cPPw+byKOepEqoGsZgqA= 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=lVA88iBH; 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="lVA88iBH" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230204; x=1789766204; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XCKw/fzhILEu49Iq3bKLiDkP1UiVyTS4zAjU4YzgJmU=; b=lVA88iBH6+Wdhsm/zgy/+waXbvpbehcBm20FajJeAPYQd7bK/4r71Nuq X7bSMBAG4UhTiIMTxBlN4Bbzc+7kUhEz/IODdWaDATBO3zW4qUiaFdrsJ 7z0rzefJMdK2ANoGoxX6zdCDPBXIFhYpATTRICFkRN0ZKlcegxOTLxFZW lt2oI87k+Xgjg3Lvl/MBjKRlis73sZ9MqaWtH75XMNvVqvkCEh72qu28H QarM1uvSk96j4XZTd7h/pOBHTPnYPsDeslUJWrWAO158MWDcMfVBqYX0P ZuQ9ZEjrVVzlDDZ7ejeGF2lOa53nKb/2eoqh24O0CQRMRqqV15du6D1aK Q==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: LDGvG1grRlSsjNlf0ectfA== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071403" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:28 -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; Thu, 18 Sep 2025 14:15:54 -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; Thu, 18 Sep 2025 14:15:54 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 27/31] clk: at91: at91rm9200: switch to parent_hw and parent_data Date: Thu, 18 Sep 2025 14:16:09 -0700 Message-ID: <95a91edf982c6a567640b226dfea75e2fdcaf93b.1758226719.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. 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/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 Thu Oct 2 07:43:36 2025 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 F08E3321284; Thu, 18 Sep 2025 21:16:43 +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=1758230206; cv=none; b=mj8y3WcyULo+m/LeUU4CwmQPeFbzbjNuEmZIxID/oqNPAheVn/zFNUn0GlsvBAcgm4Sf84tlmrNuChd1pxYCIvQ70B/SpWdPmHL1P0QHcwsI/v0wKMQPBUZjYFRJ7qbNkB5yHe1ZYwVt6mLANrhWD0hAw4th7Mrqp873AAwPkd0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230206; c=relaxed/simple; bh=vVhRnuOxtx40U4X6AiR/OMJ1gOwse9+LnGmz9ZDzWwY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YrDW6URcm8xbC/GbMqWUP++44QcR7iYCyM8cZID4lb+2tcKriFCMlbKL2igpwCAvNrG8kr1yPJ/anS/AOlZhgeVN49tAhjjEzLOCvIwMvQGwpxv7fOLiqHaMm9l7O6rcaSFFEgy+zYSkifP1ygmHbLXMOMNN+pYZDsAM40QdV1I= 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=n3agaUsc; 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="n3agaUsc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230205; x=1789766205; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vVhRnuOxtx40U4X6AiR/OMJ1gOwse9+LnGmz9ZDzWwY=; b=n3agaUscp9TJgh42kOx+YsLjsExVHArq9eaKv+eh7BH6sRbf9C6lLN7a XrhKw4Rqe/NMxvTKfNgGNOX8NKQfL42Cdh9JRH1tu/hFFY1OObpn/8h23 F1gXudzxJxLeDmRA4254eYyStx1WkU1b4rnXuLaKCpy79Q2HkxTYzAjE4 bVuS6V9E97d8jIqk8Jxq4jE5WPDyRyYSQtb2F+FdnX3ImhqHpdx7cOxAn ISvaSF5Tje40ZNbSltfTZdIeNXH7jsTktbSV0A01YTU4n6wCrW26VOiMc od1IjAJpD1RayjwmGPR/Wm4zAm3UDnPxiFZN5jXSBgRLIUmPjZdwGhPxH Q==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: CW3luNmXSj6B+P7uGSImMg== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071404" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:29 -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; Thu, 18 Sep 2025 14:15:55 -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; Thu, 18 Sep 2025 14:15:55 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 28/31] clk: at91: at91sam9260: switch to parent_hw and parent_data Date: Thu, 18 Sep 2025 14:16:10 -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 AT91SAM92600 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/at91sam9260.c | 120 ++++++++++++++++++--------------- 1 file changed, 67 insertions(+), 53 deletions(-) diff --git a/drivers/clk/at91/at91sam9260.c b/drivers/clk/at91/at91sam9260.c index 55350331b07e..2ac2a340da2f 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 { @@ -330,12 +330,11 @@ static void __init at91sam926x_pmc_setup(struct devic= e_node *np, struct at91sam926x_data *data) { const char *slowxtal_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,20 +382,17 @@ static void __init at91sam926x_pmc_setup(struct devic= e_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 at91sam9260_pmc->chws[PMC_SLOW] =3D hw; - slck_name =3D "slck"; - } else { - 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 +400,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 +409,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(slowxtal_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 +422,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 +432,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(slowxtal_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 +457,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 +483,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 Thu Oct 2 07:43:36 2025 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 E8AAB32145B; Thu, 18 Sep 2025 21:16:44 +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=1758230207; cv=none; b=uRIqlMz3SNwBb7yrqWxMcdo6oFVUvad17hawzT4tgj/vr0KLkdKzshEDrz/+ZY44QkduheBtyPzYM8rWORkSlzyoQh/e9RiaO4B7cHtTKPDTY9yeJNNhw2xXM1qUtVxZs8pVrQYLQCHp/hi/MnC7ZQULLN44yHDlTBcN+NLPQXc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230207; c=relaxed/simple; bh=BEQXOJKWpxyFqzghfCssvHtpcN2ttraChzvVk74xo8g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=trr4gBCJTB1t8KCYNV2ROtF8ej+aSg3I8L/CshrQ4DfwTDoR6lrQexgrIBqX8Yqb6VyyKdfYsJCSS2K/xxme6SeMS4OH0bn7OAjNI04U5N1ak+ZdLjssXJTzvVa1kveE96SmoiHj9J/3kRaigcEhiuNMUT+9UsltJrEQ0qpOcOM= 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=T4Nn4bVJ; 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="T4Nn4bVJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230206; x=1789766206; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BEQXOJKWpxyFqzghfCssvHtpcN2ttraChzvVk74xo8g=; b=T4Nn4bVJk8R57bOSsxdut8MciVdSNJa03Ezuhh1fB9kuFMapDTsxyMQL C6ktou6U/N3UyM7rPeysGp2lt2BwrRhPresfmVJ89YcXqCpjNUkdJ+ADH d8zNr/rSctvh9RaW1KYHwOmNOQYukl6xmTM7D4mkIeDaUocA/0PNBwnKf vZ8v5P4aCxjrMTgrsL+aEUNAGsHGX90NlJ/BkdBn9h/zJgntkuBDR1R0B PXH7TZqpih36Q+JyNSq/Za0qFqru/Wd2oa5dRBP890JVhfrwWV8uavH3i 40JgjMYXePMMNuoG6j3VLmdzLKJ839ahVCQin2jJmBbniEyQviCebAxfk A==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: c63PvV3GR7+ZUaUI/K4X/g== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071405" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:29 -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; Thu, 18 Sep 2025 14:15:55 -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; Thu, 18 Sep 2025 14:15:55 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 29/31] clk: at91: at91sam9g45: switch to parent_hw and parent_data Date: Thu, 18 Sep 2025 14:16:11 -0700 Message-ID: <834a4851a288d18d9d32c64cbbe2d380e01177c4.1758226719.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_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/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 Thu Oct 2 07:43:36 2025 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 076CB321F44; Thu, 18 Sep 2025 21:16:45 +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=1758230208; cv=none; b=Ek1k7yVEkQATBOWucL1yaBZHObPR0gfzRXQDqVLUSCXlZ5Eo6oR0bJFYIrREOME084ILtO7N23BWfgA9FhK/9dBrj6FvmJkVjz9QMSG3hz3XzIAZwFNWfd/QYChiTCt9gkt0+SiqnQujOV9BJAoD/EQLZu9HD1ZUCZCS6LxEfxc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230208; 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=Rs4NxZk8bbIDmb0zlLXQGRb6/h/Up60Drl8RA85MEarKxNRW/9NzUkWSoUDkwzVnOpeQ7slj46JxbdrQZ6ed0gq8cQWlrf68DIsWur61L7EwoVSUTQXmqPta3slqfxn64MRSdQ/+263LXt57gSyM0IZWcavDrIYqBZWhdwPU/MY= 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=m9aQT79E; 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="m9aQT79E" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230207; x=1789766207; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uTkFVJoez1/J0P1G+rNdaomAw0JniamhmbMDOed+tkE=; b=m9aQT79EH3feeB+x5XM73A6rcGN42JP0+mmKzr+6g5pZPRjRO9XCcxHb 78/LjX+zmgl6rUgilaCgNbNy+W1RZx1SRDzB3yjDa4XAUyYSkpLLxX//v QXbi9e1Va3QCzUGJumRkA2qeVbWxhIodz9qx6EvPP7vjUxcjUOlREjDKI aLKR9sRap0vBu3njvSVgExt2A1Sh2UzmHqBakyMtbSxfuaYeLTbxNwvwS JywnAHFiRLf6T1xCJGN/eNu4GSQkpQ+Ym//6wxmQf9PjaeWymIZNFG0Q9 +26pEZNq0xlXbwmqlq3P7SDL+Af6mFvMJQTVcr+UUMBrMDDeMGqmrucDu A==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: LMnB/X5AQYiGI6BEcfk3wg== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071406" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:29 -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; Thu, 18 Sep 2025 14:15:55 -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; Thu, 18 Sep 2025 14:15:55 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 30/31] clk: at91: at91sam9n12: switch to parent_hw and parent_data Date: Thu, 18 Sep 2025 14:16:12 -0700 Message-ID: <404c8ce6f337c8f5eea3d1c91075e14ce5d5af35.1758226719.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 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 Thu Oct 2 07:43:36 2025 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 5615132252F; Thu, 18 Sep 2025 21:16:46 +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=1758230208; cv=none; b=U/uFmYpssSaIyH2KDeEJOTAv5w4KlYwBUXEpM9A5cclnDcxhbaUqLpiG+T8sXDStaXsgRAsCmqGCTCJcSYpwjarcp7QJIUJAk2bTTBVM8VkwhEXq+jVWJKH0FHj9f1ACwUJviSnMhyyBo82FW0P4o+Bi9c/2Culs6u7tsv5q5qI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758230208; c=relaxed/simple; bh=xqoF1rlYiCbyUzgobq3CKtOYoiAr0pjHL3GMBCRIJXM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hl0lT+FlQc6aK3H3Jif2Ee3FKUiRLl/65B50K9xznd8uAFw8Vkd5v3nXwOEZmPNOzOsejHdm0/mTptJtu+tIiDpYkclhcnO54o7qVBMebJfiIBLY390pxRqJSBhG0JGhuggFe69pEYbjKC/zyiejPiD5ChYrLbQAxqdW+xZ5kko= 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=U0zeq66l; 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="U0zeq66l" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1758230207; x=1789766207; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xqoF1rlYiCbyUzgobq3CKtOYoiAr0pjHL3GMBCRIJXM=; b=U0zeq66lOh7/60iCTqJBKnHYpnHkCmIE85O0AxhbT54278xsMbQLEvHB Uiy84aV5WPR0ZjX88T9qqyvfy7y/L7bxAKISc/pEZ02faFy8eAATEZh43 fDEJFh9VLtQcMGYx/eMOMWEtMnp528MI3ZI3SlCY6+kptSGjDwsTg+0P5 b7CVnpBBVrbXf/BG2LYQl73c9NpxzPVGukc6afl/iHyIRdH2CiGQ9KQrK QEBu/oS7YqweD9c55xiHh0kT4q2x3Q8YkF9DShTLsW63KQ6iGwGeKDwnf hgH3JDEBakBu8KPw4/qLWUZRMYVN2fBVSds6dA0dZjvPc29ByJUu4/E1C g==; X-CSE-ConnectionGUID: 31sRM3ybQuOqhqj3gb2ViA== X-CSE-MsgGUID: Q3ofXCo9Qz24xVkPcr8Hpw== X-IronPort-AV: E=Sophos;i="6.18,276,1751266800"; d="scan'208";a="278071407" 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-AES128-GCM-SHA256; 18 Sep 2025 14:16:29 -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; Thu, 18 Sep 2025 14:15:55 -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; Thu, 18 Sep 2025 14:15:55 -0700 From: To: , , , , CC: , , , Subject: [PATCH v4 31/31] clk: at91: at91sam9rl: switch to clk_parent_data Date: Thu, 18 Sep 2025 14:16: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 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 --- 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