* [PATCH v2 1/3] dt-bindings: clock: add ID for eMMC for EN7581
@ 2024-12-18 9:11 Christian Marangi
2024-12-18 9:11 ` [PATCH v2 2/3] clk: en7523: Rework clock handling for different clock numbers Christian Marangi
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Christian Marangi @ 2024-12-18 9:11 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-clk, linux-kernel, devicetree, upstream
Cc: Christian Marangi
Add ID for eMMC for EN7581. This is to control clock selection of eMMC
between 200MHz and 150MHz.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
Changes v2:
- Drop additional define for EN7581_NUM_CLOCKS
include/dt-bindings/clock/en7523-clk.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/dt-bindings/clock/en7523-clk.h b/include/dt-bindings/clock/en7523-clk.h
index 717d23a5e5ae..c4f8a161b981 100644
--- a/include/dt-bindings/clock/en7523-clk.h
+++ b/include/dt-bindings/clock/en7523-clk.h
@@ -12,6 +12,8 @@
#define EN7523_CLK_CRYPTO 6
#define EN7523_CLK_PCIE 7
+#define EN7581_CLK_EMMC 8
+
#define EN7523_NUM_CLOCKS 8
#endif /* _DT_BINDINGS_CLOCK_AIROHA_EN7523_H_ */
--
2.45.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/3] clk: en7523: Rework clock handling for different clock numbers
2024-12-18 9:11 [PATCH v2 1/3] dt-bindings: clock: add ID for eMMC for EN7581 Christian Marangi
@ 2024-12-18 9:11 ` Christian Marangi
2024-12-18 9:11 ` [PATCH v2 3/3] clk: en7523: Add clock for eMMC for EN7581 Christian Marangi
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Christian Marangi @ 2024-12-18 9:11 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-clk, linux-kernel, devicetree, upstream
Cc: Christian Marangi
Airoha EN7581 SoC have additional clock compared to EN7523 but current
driver permits to only support up to EN7523 clock numbers.
To handle this, rework the clock handling and permit to declare the
clocks number in match_data and alloca clk_data based on the compatible
match_data.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
Changes v2:
- Add this patch
drivers/clk/clk-en7523.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/clk/clk-en7523.c b/drivers/clk/clk-en7523.c
index 495c0d607c7d..d77d3d459b40 100644
--- a/drivers/clk/clk-en7523.c
+++ b/drivers/clk/clk-en7523.c
@@ -75,6 +75,7 @@ struct en_rst_data {
};
struct en_clk_soc_data {
+ u32 num_clocks;
const struct clk_ops pcie_ops;
int (*hw_init)(struct platform_device *pdev,
struct clk_hw_onecell_data *clk_data);
@@ -504,8 +505,6 @@ static void en7523_register_clocks(struct device *dev, struct clk_hw_onecell_dat
u32 rate;
int i;
- clk_data->num = EN7523_NUM_CLOCKS;
-
for (i = 0; i < ARRAY_SIZE(en7523_base_clks); i++) {
const struct en_clk_desc *desc = &en7523_base_clks[i];
u32 reg = desc->div_reg ? desc->div_reg : desc->base_reg;
@@ -587,8 +586,6 @@ static void en7581_register_clocks(struct device *dev, struct clk_hw_onecell_dat
hw = en7523_register_pcie_clk(dev, base);
clk_data->hws[EN7523_CLK_PCIE] = hw;
-
- clk_data->num = EN7523_NUM_CLOCKS;
}
static int en7523_reset_update(struct reset_controller_dev *rcdev,
@@ -702,21 +699,24 @@ static int en7523_clk_probe(struct platform_device *pdev)
struct clk_hw_onecell_data *clk_data;
int r;
+ soc_data = device_get_match_data(&pdev->dev);
+
clk_data = devm_kzalloc(&pdev->dev,
- struct_size(clk_data, hws, EN7523_NUM_CLOCKS),
+ struct_size(clk_data, hws, soc_data->num_clocks),
GFP_KERNEL);
if (!clk_data)
return -ENOMEM;
- soc_data = device_get_match_data(&pdev->dev);
r = soc_data->hw_init(pdev, clk_data);
if (r)
return r;
+ clk_data->num = soc_data->num_clocks;
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
}
static const struct en_clk_soc_data en7523_data = {
+ .num_clocks = EN7523_NUM_CLOCKS,
.pcie_ops = {
.is_enabled = en7523_pci_is_enabled,
.prepare = en7523_pci_prepare,
@@ -726,6 +726,8 @@ static const struct en_clk_soc_data en7523_data = {
};
static const struct en_clk_soc_data en7581_data = {
+ /* We increment num_clocks by 1 to account for additional PCIe clock */
+ .num_clocks = ARRAY_SIZE(en7581_base_clks) + 1,
.pcie_ops = {
.is_enabled = en7581_pci_is_enabled,
.enable = en7581_pci_enable,
--
2.45.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 3/3] clk: en7523: Add clock for eMMC for EN7581
2024-12-18 9:11 [PATCH v2 1/3] dt-bindings: clock: add ID for eMMC for EN7581 Christian Marangi
2024-12-18 9:11 ` [PATCH v2 2/3] clk: en7523: Rework clock handling for different clock numbers Christian Marangi
@ 2024-12-18 9:11 ` Christian Marangi
2024-12-18 17:04 ` [PATCH v2 1/3] dt-bindings: clock: add ID " Conor Dooley
2024-12-18 17:46 ` Conor Dooley
3 siblings, 0 replies; 7+ messages in thread
From: Christian Marangi @ 2024-12-18 9:11 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-clk, linux-kernel, devicetree, upstream
Cc: Christian Marangi
Add clock for eMMC for EN7581. This is used to give info of the current
eMMC source clock and to switch it from 200MHz or 150MHz.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
Changes v2:
- Rename emmc_base to emmc7581_base to make it more clear
drivers/clk/clk-en7523.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/clk/clk-en7523.c b/drivers/clk/clk-en7523.c
index d77d3d459b40..5bfba57a00f5 100644
--- a/drivers/clk/clk-en7523.c
+++ b/drivers/clk/clk-en7523.c
@@ -91,6 +91,7 @@ static const u32 emi7581_base[] = { 540000000, 480000000, 400000000, 300000000 }
static const u32 bus7581_base[] = { 600000000, 540000000 };
static const u32 npu7581_base[] = { 800000000, 750000000, 720000000, 600000000 };
static const u32 crypto_base[] = { 540000000, 480000000 };
+static const u32 emmc7581_base[] = { 200000000, 150000000 };
static const struct en_clk_desc en7523_base_clks[] = {
{
@@ -281,6 +282,15 @@ static const struct en_clk_desc en7581_base_clks[] = {
.base_shift = 0,
.base_values = crypto_base,
.n_base_values = ARRAY_SIZE(crypto_base),
+ }, {
+ .id = EN7581_CLK_EMMC,
+ .name = "emmc",
+
+ .base_reg = REG_CRYPTO_CLKSRC2,
+ .base_bits = 1,
+ .base_shift = 12,
+ .base_values = emmc7581_base,
+ .n_base_values = ARRAY_SIZE(emmc7581_base),
}
};
--
2.45.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] dt-bindings: clock: add ID for eMMC for EN7581
2024-12-18 9:11 [PATCH v2 1/3] dt-bindings: clock: add ID for eMMC for EN7581 Christian Marangi
2024-12-18 9:11 ` [PATCH v2 2/3] clk: en7523: Rework clock handling for different clock numbers Christian Marangi
2024-12-18 9:11 ` [PATCH v2 3/3] clk: en7523: Add clock for eMMC for EN7581 Christian Marangi
@ 2024-12-18 17:04 ` Conor Dooley
2024-12-18 17:20 ` Christian Marangi
2024-12-18 17:46 ` Conor Dooley
3 siblings, 1 reply; 7+ messages in thread
From: Conor Dooley @ 2024-12-18 17:04 UTC (permalink / raw)
To: Christian Marangi
Cc: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-clk, linux-kernel, devicetree, upstream
[-- Attachment #1: Type: text/plain, Size: 906 bytes --]
On Wed, Dec 18, 2024 at 10:11:33AM +0100, Christian Marangi wrote:
> Add ID for eMMC for EN7581. This is to control clock selection of eMMC
> between 200MHz and 150MHz.
>
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
> Changes v2:
> - Drop additional define for EN7581_NUM_CLOCKS
>
> include/dt-bindings/clock/en7523-clk.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/include/dt-bindings/clock/en7523-clk.h b/include/dt-bindings/clock/en7523-clk.h
> index 717d23a5e5ae..c4f8a161b981 100644
> --- a/include/dt-bindings/clock/en7523-clk.h
> +++ b/include/dt-bindings/clock/en7523-clk.h
> @@ -12,6 +12,8 @@
> #define EN7523_CLK_CRYPTO 6
> #define EN7523_CLK_PCIE 7
>
Why the gap?
> +#define EN7581_CLK_EMMC 8
> +
> #define EN7523_NUM_CLOCKS 8
Can you delete this please? Your changelog appears to suggest you did,
but I see it still.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] dt-bindings: clock: add ID for eMMC for EN7581
2024-12-18 17:04 ` [PATCH v2 1/3] dt-bindings: clock: add ID " Conor Dooley
@ 2024-12-18 17:20 ` Christian Marangi
2024-12-18 17:45 ` Conor Dooley
0 siblings, 1 reply; 7+ messages in thread
From: Christian Marangi @ 2024-12-18 17:20 UTC (permalink / raw)
To: Conor Dooley
Cc: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-clk, linux-kernel, devicetree, upstream
On Wed, Dec 18, 2024 at 05:04:03PM +0000, Conor Dooley wrote:
> On Wed, Dec 18, 2024 at 10:11:33AM +0100, Christian Marangi wrote:
> > Add ID for eMMC for EN7581. This is to control clock selection of eMMC
> > between 200MHz and 150MHz.
> >
> > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> > ---
> > Changes v2:
> > - Drop additional define for EN7581_NUM_CLOCKS
> >
> > include/dt-bindings/clock/en7523-clk.h | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/include/dt-bindings/clock/en7523-clk.h b/include/dt-bindings/clock/en7523-clk.h
> > index 717d23a5e5ae..c4f8a161b981 100644
> > --- a/include/dt-bindings/clock/en7523-clk.h
> > +++ b/include/dt-bindings/clock/en7523-clk.h
> > @@ -12,6 +12,8 @@
> > #define EN7523_CLK_CRYPTO 6
> > #define EN7523_CLK_PCIE 7
> >
>
> Why the gap?
>
It's only present in en7523 so maybe it's a good idea to have the gap to
make that more clear?
> > +#define EN7581_CLK_EMMC 8
> > +
> > #define EN7523_NUM_CLOCKS 8
>
> Can you delete this please? Your changelog appears to suggest you did,
> but I see it still.
Yes sure didn't want to change this too much to cause regression
downstream if anyone was using it. Will drop in a dedicated patch when I
will post v3 tomorrow.
--
Ansuel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] dt-bindings: clock: add ID for eMMC for EN7581
2024-12-18 17:20 ` Christian Marangi
@ 2024-12-18 17:45 ` Conor Dooley
0 siblings, 0 replies; 7+ messages in thread
From: Conor Dooley @ 2024-12-18 17:45 UTC (permalink / raw)
To: Christian Marangi
Cc: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-clk, linux-kernel, devicetree, upstream
[-- Attachment #1: Type: text/plain, Size: 1495 bytes --]
On Wed, Dec 18, 2024 at 06:20:27PM +0100, Christian Marangi wrote:
> On Wed, Dec 18, 2024 at 05:04:03PM +0000, Conor Dooley wrote:
> > On Wed, Dec 18, 2024 at 10:11:33AM +0100, Christian Marangi wrote:
> > > Add ID for eMMC for EN7581. This is to control clock selection of eMMC
> > > between 200MHz and 150MHz.
> > >
> > > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> > > ---
> > > Changes v2:
> > > - Drop additional define for EN7581_NUM_CLOCKS
> > >
> > > include/dt-bindings/clock/en7523-clk.h | 2 ++
> > > 1 file changed, 2 insertions(+)
> > >
> > > diff --git a/include/dt-bindings/clock/en7523-clk.h b/include/dt-bindings/clock/en7523-clk.h
> > > index 717d23a5e5ae..c4f8a161b981 100644
> > > --- a/include/dt-bindings/clock/en7523-clk.h
> > > +++ b/include/dt-bindings/clock/en7523-clk.h
> > > @@ -12,6 +12,8 @@
> > > #define EN7523_CLK_CRYPTO 6
> > > #define EN7523_CLK_PCIE 7
> > >
> >
> > Why the gap?
> >
>
> It's only present in en7523 so maybe it's a good idea to have the gap to
> make that more clear?
>
> > > +#define EN7581_CLK_EMMC 8
> > > +
> > > #define EN7523_NUM_CLOCKS 8
> >
> > Can you delete this please? Your changelog appears to suggest you did,
> > but I see it still.
>
> Yes sure didn't want to change this too much to cause regression
> downstream if anyone was using it. Will drop in a dedicated patch when I
> will post v3 tomorrow.
Oh, I'm dumb. I didn't notice 1 instead of 3, sorry.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] dt-bindings: clock: add ID for eMMC for EN7581
2024-12-18 9:11 [PATCH v2 1/3] dt-bindings: clock: add ID for eMMC for EN7581 Christian Marangi
` (2 preceding siblings ...)
2024-12-18 17:04 ` [PATCH v2 1/3] dt-bindings: clock: add ID " Conor Dooley
@ 2024-12-18 17:46 ` Conor Dooley
3 siblings, 0 replies; 7+ messages in thread
From: Conor Dooley @ 2024-12-18 17:46 UTC (permalink / raw)
To: Christian Marangi
Cc: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-clk, linux-kernel, devicetree, upstream
[-- Attachment #1: Type: text/plain, Size: 906 bytes --]
On Wed, Dec 18, 2024 at 10:11:33AM +0100, Christian Marangi wrote:
> Add ID for eMMC for EN7581. This is to control clock selection of eMMC
> between 200MHz and 150MHz.
>
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
> Changes v2:
> - Drop additional define for EN7581_NUM_CLOCKS
>
> include/dt-bindings/clock/en7523-clk.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/include/dt-bindings/clock/en7523-clk.h b/include/dt-bindings/clock/en7523-clk.h
> index 717d23a5e5ae..c4f8a161b981 100644
> --- a/include/dt-bindings/clock/en7523-clk.h
> +++ b/include/dt-bindings/clock/en7523-clk.h
> @@ -12,6 +12,8 @@
> #define EN7523_CLK_CRYPTO 6
> #define EN7523_CLK_PCIE 7
>
> +#define EN7581_CLK_EMMC 8
> +
> #define EN7523_NUM_CLOCKS 8
>
> #endif /* _DT_BINDINGS_CLOCK_AIROHA_EN7523_H_ */
Acked-by: Conor Dooley <conor.dooley@microchip.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-12-18 17:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-18 9:11 [PATCH v2 1/3] dt-bindings: clock: add ID for eMMC for EN7581 Christian Marangi
2024-12-18 9:11 ` [PATCH v2 2/3] clk: en7523: Rework clock handling for different clock numbers Christian Marangi
2024-12-18 9:11 ` [PATCH v2 3/3] clk: en7523: Add clock for eMMC for EN7581 Christian Marangi
2024-12-18 17:04 ` [PATCH v2 1/3] dt-bindings: clock: add ID " Conor Dooley
2024-12-18 17:20 ` Christian Marangi
2024-12-18 17:45 ` Conor Dooley
2024-12-18 17:46 ` Conor Dooley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).