From nobody Thu Oct 2 09:16:59 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