All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Add definitions for AST2600 i3c clocks and resets
@ 2023-02-13  6:02 Jeremy Kerr
  2023-02-13  6:02 ` [PATCH v2 1/3] clk: ast2600: allow empty entries in aspeed_g6_gates Jeremy Kerr
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Jeremy Kerr @ 2023-02-13  6:02 UTC (permalink / raw)
  To: linux-aspeed, linux-clk
  Cc: devicetree, Krzysztof Kozlowski, Michael Turquette, Rob Herring,
	Stephen Boyd, Dylan Hung, Joel Stanley, Andrew Jeffery

This series adds some base configuration for the i3c controllers on
ast2600 hardware. We'll use the reset and clock definitions in the
proposed dt binding example, hence sending these first.

v2:
 * based on feedback from Joel Stanley: avoid adding RESERVED clock
   definitions, allowing empty entries in aspeed_g6_gates instead.


Jeremy Kerr (3):
  clk: ast2600: allow empty entries in aspeed_g6_gates
  clk: aspeed: Add full configs for i3c clocks
  dts: ast2600: Add reset config for I3C

 drivers/clk/clk-ast2600.c                 | 41 ++++++++++++++++++-----
 include/dt-bindings/clock/ast2600-clock.h |  9 +++--
 2 files changed, 40 insertions(+), 10 deletions(-)

-- 
2.39.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 1/3] clk: ast2600: allow empty entries in aspeed_g6_gates
  2023-02-13  6:02 [PATCH v2 0/3] Add definitions for AST2600 i3c clocks and resets Jeremy Kerr
@ 2023-02-13  6:02 ` Jeremy Kerr
  2023-02-13  6:02 ` [PATCH v2 2/3] clk: aspeed: Add full configs for i3c clocks Jeremy Kerr
  2023-02-13  6:02 ` [PATCH v2 3/3] dts: ast2600: Add reset config for I3C Jeremy Kerr
  2 siblings, 0 replies; 12+ messages in thread
From: Jeremy Kerr @ 2023-02-13  6:02 UTC (permalink / raw)
  To: linux-aspeed, linux-clk
  Cc: devicetree, Krzysztof Kozlowski, Michael Turquette, Rob Herring,
	Stephen Boyd, Dylan Hung, Joel Stanley, Andrew Jeffery

We're about to remove an entry from aspeed_g6_gates, but we won't want
to alter existing entries. This change allows empty entries in the gates
array.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
---
 drivers/clk/clk-ast2600.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clk/clk-ast2600.c b/drivers/clk/clk-ast2600.c
index 9c3305bcb27a..1f08ff3c60fa 100644
--- a/drivers/clk/clk-ast2600.c
+++ b/drivers/clk/clk-ast2600.c
@@ -652,6 +652,9 @@ static int aspeed_g6_clk_probe(struct platform_device *pdev)
 		const struct aspeed_gate_data *gd = &aspeed_g6_gates[i];
 		u32 gate_flags;
 
+		if (!gd->name)
+			continue;
+
 		/*
 		 * Special case: the USB port 1 clock (bit 14) is always
 		 * working the opposite way from the other ones.
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 2/3] clk: aspeed: Add full configs for i3c clocks
  2023-02-13  6:02 [PATCH v2 0/3] Add definitions for AST2600 i3c clocks and resets Jeremy Kerr
  2023-02-13  6:02 ` [PATCH v2 1/3] clk: ast2600: allow empty entries in aspeed_g6_gates Jeremy Kerr
@ 2023-02-13  6:02 ` Jeremy Kerr
  2023-02-13  8:44   ` Krzysztof Kozlowski
  2023-02-13  9:48   ` Krzysztof Kozlowski
  2023-02-13  6:02 ` [PATCH v2 3/3] dts: ast2600: Add reset config for I3C Jeremy Kerr
  2 siblings, 2 replies; 12+ messages in thread
From: Jeremy Kerr @ 2023-02-13  6:02 UTC (permalink / raw)
  To: linux-aspeed, linux-clk
  Cc: devicetree, Krzysztof Kozlowski, Michael Turquette, Rob Herring,
	Stephen Boyd, Dylan Hung, Joel Stanley, Andrew Jeffery

The current ast2600 i3c clock definitions are top-level (rather than
based on their actual hw sources: either HCLK or APLL), and include a
couple of definitions for (non-existent) i3c6 and i3c7.

This change re-parents these to the main i3c clock, explicitly sourced
from the APLL rather than whatever G6_CLK_SELECTION5 was last set to. We
also remove the i3c6 and i3c7 definitions.

This change is a partial cherry-pick and rework of ed44b8cdfdb and
1a35eb926d7 from Aspeed's own tree, originally by Dylan Hung
<dylan_hung@aspeedtech.com>.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
---
 drivers/clk/clk-ast2600.c                 | 38 ++++++++++++++++++-----
 include/dt-bindings/clock/ast2600-clock.h |  3 +-
 2 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/drivers/clk/clk-ast2600.c b/drivers/clk/clk-ast2600.c
index 1f08ff3c60fa..45549cb18107 100644
--- a/drivers/clk/clk-ast2600.c
+++ b/drivers/clk/clk-ast2600.c
@@ -4,6 +4,7 @@
 
 #define pr_fmt(fmt) "clk-ast2600: " fmt
 
+#include <linux/bitfield.h>
 #include <linux/mfd/syscon.h>
 #include <linux/of_address.h>
 #include <linux/of_device.h>
@@ -32,6 +33,18 @@
 #define ASPEED_G6_CLK_SELECTION1	0x300
 #define ASPEED_G6_CLK_SELECTION2	0x304
 #define ASPEED_G6_CLK_SELECTION4	0x310
+#define ASPEED_G6_CLK_SELECTION5	0x314
+#define   I3C_CLK_SELECTION		BIT(31)
+#define     I3C_CLK_SELECT_HCLK		0
+#define     I3C_CLK_SELECT_APLL_DIV	1
+#define   APLL_DIV_SELECTION		GENMASK(30, 28)
+#define     APLL_DIV_2			0b001
+#define     APLL_DIV_3			0b010
+#define     APLL_DIV_4			0b011
+#define     APLL_DIV_5			0b100
+#define     APLL_DIV_6			0b101
+#define     APLL_DIV_7			0b110
+#define     APLL_DIV_8			0b111
 
 #define ASPEED_HPLL_PARAM		0x200
 #define ASPEED_APLL_PARAM		0x210
@@ -97,14 +110,13 @@ static const struct aspeed_gate_data aspeed_g6_gates[] = {
 	[ASPEED_CLK_GATE_LHCCLK]	= { 37, -1, "lhclk-gate",	"lhclk", 0 },	/* LPC master/LPC+ */
 	/* Reserved 38 RSA: no longer used */
 	/* Reserved 39 */
-	[ASPEED_CLK_GATE_I3C0CLK]	= { 40,  40, "i3c0clk-gate",	NULL,	 0 },	/* I3C0 */
-	[ASPEED_CLK_GATE_I3C1CLK]	= { 41,  41, "i3c1clk-gate",	NULL,	 0 },	/* I3C1 */
-	[ASPEED_CLK_GATE_I3C2CLK]	= { 42,  42, "i3c2clk-gate",	NULL,	 0 },	/* I3C2 */
-	[ASPEED_CLK_GATE_I3C3CLK]	= { 43,  43, "i3c3clk-gate",	NULL,	 0 },	/* I3C3 */
-	[ASPEED_CLK_GATE_I3C4CLK]	= { 44,  44, "i3c4clk-gate",	NULL,	 0 },	/* I3C4 */
-	[ASPEED_CLK_GATE_I3C5CLK]	= { 45,  45, "i3c5clk-gate",	NULL,	 0 },	/* I3C5 */
-	[ASPEED_CLK_GATE_I3C6CLK]	= { 46,  46, "i3c6clk-gate",	NULL,	 0 },	/* I3C6 */
-	[ASPEED_CLK_GATE_I3C7CLK]	= { 47,  47, "i3c7clk-gate",	NULL,	 0 },	/* I3C7 */
+	[ASPEED_CLK_GATE_I3C0CLK]	= { 40,  40, "i3c0clk-gate",	"i3cclk", 0 }, /* I3C0 */
+	[ASPEED_CLK_GATE_I3C1CLK]	= { 41,  41, "i3c1clk-gate",	"i3cclk", 0 }, /* I3C1 */
+	[ASPEED_CLK_GATE_I3C2CLK]	= { 42,  42, "i3c2clk-gate",	"i3cclk", 0 }, /* I3C2 */
+	[ASPEED_CLK_GATE_I3C3CLK]	= { 43,  43, "i3c3clk-gate",	"i3cclk", 0 }, /* I3C3 */
+	[ASPEED_CLK_GATE_I3C4CLK]	= { 44,  44, "i3c4clk-gate",	"i3cclk", 0 }, /* I3C4 */
+	[ASPEED_CLK_GATE_I3C5CLK]	= { 45,  45, "i3c5clk-gate",	"i3cclk", 0 }, /* I3C5 */
+	/* Reserved: 46 & 47 */
 	[ASPEED_CLK_GATE_UART1CLK]	= { 48,  -1, "uart1clk-gate",	"uart",	 0 },	/* UART1 */
 	[ASPEED_CLK_GATE_UART2CLK]	= { 49,  -1, "uart2clk-gate",	"uart",	 0 },	/* UART2 */
 	[ASPEED_CLK_GATE_UART3CLK]	= { 50,  -1, "uart3clk-gate",	"uart",  0 },	/* UART3 */
@@ -775,6 +787,16 @@ static void __init aspeed_g6_cc(struct regmap *map)
 	/* USB 2.0 port1 phy 40MHz clock */
 	hw = clk_hw_register_fixed_rate(NULL, "usb-phy-40m", NULL, 0, 40000000);
 	aspeed_g6_clk_data->hws[ASPEED_CLK_USBPHY_40M] = hw;
+
+	/* i3c clock: source from apll, divide by 8 */
+	regmap_read(map, ASPEED_G6_CLK_SELECTION5, &val);
+	val &= ~(I3C_CLK_SELECTION | APLL_DIV_SELECTION);
+	val |= FIELD_PREP(I3C_CLK_SELECTION, I3C_CLK_SELECT_APLL_DIV);
+	val |= FIELD_PREP(APLL_DIV_SELECTION, APLL_DIV_8);
+	regmap_write(map, ASPEED_G6_CLK_SELECTION5, val);
+
+	hw = clk_hw_register_fixed_factor(NULL, "i3cclk", "apll", 0, 1, 8);
+	aspeed_g6_clk_data->hws[ASPEED_CLK_I3C] = hw;
 };
 
 static void __init aspeed_g6_cc_init(struct device_node *np)
diff --git a/include/dt-bindings/clock/ast2600-clock.h b/include/dt-bindings/clock/ast2600-clock.h
index d8b0db2f7a7d..600549d7bee8 100644
--- a/include/dt-bindings/clock/ast2600-clock.h
+++ b/include/dt-bindings/clock/ast2600-clock.h
@@ -57,8 +57,6 @@
 #define ASPEED_CLK_GATE_I3C3CLK		40
 #define ASPEED_CLK_GATE_I3C4CLK		41
 #define ASPEED_CLK_GATE_I3C5CLK		42
-#define ASPEED_CLK_GATE_I3C6CLK		43
-#define ASPEED_CLK_GATE_I3C7CLK		44
 
 #define ASPEED_CLK_GATE_FSICLK		45
 
@@ -87,6 +85,7 @@
 #define ASPEED_CLK_MAC2RCLK		68
 #define ASPEED_CLK_MAC3RCLK		69
 #define ASPEED_CLK_MAC4RCLK		70
+#define ASPEED_CLK_I3C			74
 
 /* Only list resets here that are not part of a gate */
 #define ASPEED_RESET_ADC		55
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 3/3] dts: ast2600: Add reset config for I3C
  2023-02-13  6:02 [PATCH v2 0/3] Add definitions for AST2600 i3c clocks and resets Jeremy Kerr
  2023-02-13  6:02 ` [PATCH v2 1/3] clk: ast2600: allow empty entries in aspeed_g6_gates Jeremy Kerr
  2023-02-13  6:02 ` [PATCH v2 2/3] clk: aspeed: Add full configs for i3c clocks Jeremy Kerr
@ 2023-02-13  6:02 ` Jeremy Kerr
  2023-02-13  8:44   ` Krzysztof Kozlowski
  2 siblings, 1 reply; 12+ messages in thread
From: Jeremy Kerr @ 2023-02-13  6:02 UTC (permalink / raw)
  To: linux-aspeed, linux-clk
  Cc: devicetree, Krzysztof Kozlowski, Michael Turquette, Rob Herring,
	Stephen Boyd, Dylan Hung, Joel Stanley, Andrew Jeffery

This change adds the reset line definitions for the AST2600 I3C block's
reset inputs.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
---
 include/dt-bindings/clock/ast2600-clock.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/dt-bindings/clock/ast2600-clock.h b/include/dt-bindings/clock/ast2600-clock.h
index 600549d7bee8..16b7389bbb9c 100644
--- a/include/dt-bindings/clock/ast2600-clock.h
+++ b/include/dt-bindings/clock/ast2600-clock.h
@@ -90,6 +90,12 @@
 /* Only list resets here that are not part of a gate */
 #define ASPEED_RESET_ADC		55
 #define ASPEED_RESET_JTAG_MASTER2	54
+#define ASPEED_RESET_I3C5		45
+#define ASPEED_RESET_I3C4		44
+#define ASPEED_RESET_I3C3		43
+#define ASPEED_RESET_I3C2		42
+#define ASPEED_RESET_I3C1		41
+#define ASPEED_RESET_I3C0		40
 #define ASPEED_RESET_I3C_DMA		39
 #define ASPEED_RESET_PWM		37
 #define ASPEED_RESET_PECI		36
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 3/3] dts: ast2600: Add reset config for I3C
  2023-02-13  6:02 ` [PATCH v2 3/3] dts: ast2600: Add reset config for I3C Jeremy Kerr
@ 2023-02-13  8:44   ` Krzysztof Kozlowski
  2023-02-13  9:02     ` Jeremy Kerr
  0 siblings, 1 reply; 12+ messages in thread
From: Krzysztof Kozlowski @ 2023-02-13  8:44 UTC (permalink / raw)
  To: Jeremy Kerr, linux-aspeed, linux-clk
  Cc: devicetree, Krzysztof Kozlowski, Michael Turquette, Rob Herring,
	Stephen Boyd, Dylan Hung, Joel Stanley, Andrew Jeffery

On 13/02/2023 07:02, Jeremy Kerr wrote:
> This change adds the reset line definitions for the AST2600 I3C block's
> reset inputs.

1. Do not use "This commit/patch".
https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95

2. This is not DTS. There is nothing from DTS here.
Use subject prefixes matching the subsystem (which you can get for
example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory
your patch is touching).


Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 2/3] clk: aspeed: Add full configs for i3c clocks
  2023-02-13  6:02 ` [PATCH v2 2/3] clk: aspeed: Add full configs for i3c clocks Jeremy Kerr
@ 2023-02-13  8:44   ` Krzysztof Kozlowski
  2023-02-13  9:48   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2023-02-13  8:44 UTC (permalink / raw)
  To: Jeremy Kerr, linux-aspeed, linux-clk
  Cc: devicetree, Krzysztof Kozlowski, Michael Turquette, Rob Herring,
	Stephen Boyd, Dylan Hung, Joel Stanley, Andrew Jeffery

On 13/02/2023 07:02, Jeremy Kerr wrote:
> The current ast2600 i3c clock definitions are top-level (rather than
> based on their actual hw sources: either HCLK or APLL), and include a
> couple of definitions for (non-existent) i3c6 and i3c7.

Why do you use subject prefix in patch 1 different than in patch 2?

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 3/3] dts: ast2600: Add reset config for I3C
  2023-02-13  8:44   ` Krzysztof Kozlowski
@ 2023-02-13  9:02     ` Jeremy Kerr
  2023-02-13  9:06       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 12+ messages in thread
From: Jeremy Kerr @ 2023-02-13  9:02 UTC (permalink / raw)
  To: Krzysztof Kozlowski, linux-aspeed, linux-clk
  Cc: devicetree, Krzysztof Kozlowski, Michael Turquette, Rob Herring,
	Stephen Boyd, Dylan Hung, Joel Stanley, Andrew Jeffery

Hi Krzysztof,

> 2. This is not DTS. There is nothing from DTS here.

[and from, your reply on patch 2/3:]

> Why do you use subject prefix in patch 1 different than in patch 2?

Ack, will change to "clk:"; there is quite a mix of "dt-bindings:" and
"clk:" on the changes within this dir. I'll unify across the series.

Cheers,


Jeremy

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 3/3] dts: ast2600: Add reset config for I3C
  2023-02-13  9:02     ` Jeremy Kerr
@ 2023-02-13  9:06       ` Krzysztof Kozlowski
  2023-02-13  9:23         ` Jeremy Kerr
  0 siblings, 1 reply; 12+ messages in thread
From: Krzysztof Kozlowski @ 2023-02-13  9:06 UTC (permalink / raw)
  To: Jeremy Kerr, linux-aspeed, linux-clk
  Cc: devicetree, Krzysztof Kozlowski, Michael Turquette, Rob Herring,
	Stephen Boyd, Dylan Hung, Joel Stanley, Andrew Jeffery

On 13/02/2023 10:02, Jeremy Kerr wrote:
> Hi Krzysztof,
> 
>> 2. This is not DTS. There is nothing from DTS here.
> 
> [and from, your reply on patch 2/3:]
> 
>> Why do you use subject prefix in patch 1 different than in patch 2?
> 
> Ack, will change to "clk:"; there is quite a mix of "dt-bindings:" and
> "clk:" on the changes within this dir. I'll unify across the series.
> 

There was clk already, wasn't it? What do you want to change? I asked
why do you call it in the same patchset aspeed and as2600?

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 3/3] dts: ast2600: Add reset config for I3C
  2023-02-13  9:06       ` Krzysztof Kozlowski
@ 2023-02-13  9:23         ` Jeremy Kerr
  2023-02-13  9:31           ` Krzysztof Kozlowski
  0 siblings, 1 reply; 12+ messages in thread
From: Jeremy Kerr @ 2023-02-13  9:23 UTC (permalink / raw)
  To: Krzysztof Kozlowski, linux-aspeed, linux-clk
  Cc: devicetree, Krzysztof Kozlowski, Michael Turquette, Rob Herring,
	Stephen Boyd, Dylan Hung, Joel Stanley, Andrew Jeffery

Hi Krzysztof,

> There was clk already, wasn't it? What do you want to change?
> I asked why do you call it in the same patchset aspeed and as2600?

There was "clk" and "dts", where the latter should have probably been either
also "clk" or "dt-bindings".

I'll unify the "aspeed" to "ast2600".

Cheers,


Jeremy

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 3/3] dts: ast2600: Add reset config for I3C
  2023-02-13  9:23         ` Jeremy Kerr
@ 2023-02-13  9:31           ` Krzysztof Kozlowski
  0 siblings, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2023-02-13  9:31 UTC (permalink / raw)
  To: Jeremy Kerr, linux-aspeed, linux-clk
  Cc: devicetree, Krzysztof Kozlowski, Michael Turquette, Rob Herring,
	Stephen Boyd, Dylan Hung, Joel Stanley, Andrew Jeffery

On 13/02/2023 10:23, Jeremy Kerr wrote:
> Hi Krzysztof,
> 
>> There was clk already, wasn't it? What do you want to change?
>> I asked why do you call it in the same patchset aspeed and as2600?
> 
> There was "clk" and "dts",

In patch 1 and 2? Please point me.

> where the latter should have probably been either
> also "clk" or "dt-bindings".

Aren't you referring to some other comment now?

> 
> I'll unify the "aspeed" to "ast2600".
> 
> Cheers,
> 
> 
> Jeremy

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 2/3] clk: aspeed: Add full configs for i3c clocks
  2023-02-13  6:02 ` [PATCH v2 2/3] clk: aspeed: Add full configs for i3c clocks Jeremy Kerr
  2023-02-13  8:44   ` Krzysztof Kozlowski
@ 2023-02-13  9:48   ` Krzysztof Kozlowski
  2023-02-13 12:34     ` Jeremy Kerr
  1 sibling, 1 reply; 12+ messages in thread
From: Krzysztof Kozlowski @ 2023-02-13  9:48 UTC (permalink / raw)
  To: Jeremy Kerr, linux-aspeed, linux-clk
  Cc: devicetree, Krzysztof Kozlowski, Michael Turquette, Rob Herring,
	Stephen Boyd, Dylan Hung, Joel Stanley, Andrew Jeffery

On 13/02/2023 07:02, Jeremy Kerr wrote:
> The current ast2600 i3c clock definitions are top-level (rather than
> based on their actual hw sources: either HCLK or APLL), and include a
> couple of definitions for (non-existent) i3c6 and i3c7.
> 
> This change re-parents these to the main i3c clock, explicitly sourced
> from the APLL rather than whatever G6_CLK_SELECTION5 was last set to. We
> also remove the i3c6 and i3c7 definitions.
> 
> This change is a partial cherry-pick and rework of ed44b8cdfdb and
> 1a35eb926d7 from Aspeed's own tree, originally by Dylan Hung
> <dylan_hung@aspeedtech.com>.
> 
> Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
> ---
>  drivers/clk/clk-ast2600.c                 | 38 ++++++++++++++++++-----
>  include/dt-bindings/clock/ast2600-clock.h |  3 +-

My comments from v1:

Bindings are always separate patches.

>  2 files changed, 31 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/clk/clk-ast2600.c b/drivers/clk/clk-ast2600.c
> index 1f08ff3c60fa..45549cb18107 100644
> --- a/drivers/clk/clk-ast2600.c
> +++ b/drivers/clk/clk-ast2600.c
> @@ -4,6 +4,7 @@
>  
>  #define pr_fmt(fmt) "clk-ast2600: " fmt
>  
> +#include <linux/bitfield.h>
>  #include <linux/mfd/syscon.h>
>  #include <linux/of_address.h>
>  #include <linux/of_device.h>
> @@ -32,6 +33,18 @@
>  #define ASPEED_G6_CLK_SELECTION1	0x300
>  #define ASPEED_G6_CLK_SELECTION2	0x304
>  #define ASPEED_G6_CLK_SELECTION4	0x310
> +#define ASPEED_G6_CLK_SELECTION5	0x314
> +#define   I3C_CLK_SELECTION		BIT(31)
> +#define     I3C_CLK_SELECT_HCLK		0
> +#define     I3C_CLK_SELECT_APLL_DIV	1
> +#define   APLL_DIV_SELECTION		GENMASK(30, 28)
> +#define     APLL_DIV_2			0b001
> +#define     APLL_DIV_3			0b010
> +#define     APLL_DIV_4			0b011
> +#define     APLL_DIV_5			0b100
> +#define     APLL_DIV_6			0b101
> +#define     APLL_DIV_7			0b110
> +#define     APLL_DIV_8			0b111
>  
>  #define ASPEED_HPLL_PARAM		0x200
>  #define ASPEED_APLL_PARAM		0x210
> @@ -97,14 +110,13 @@ static const struct aspeed_gate_data aspeed_g6_gates[] = {
>  	[ASPEED_CLK_GATE_LHCCLK]	= { 37, -1, "lhclk-gate",	"lhclk", 0 },	/* LPC master/LPC+ */
>  	/* Reserved 38 RSA: no longer used */
>  	/* Reserved 39 */
> -	[ASPEED_CLK_GATE_I3C0CLK]	= { 40,  40, "i3c0clk-gate",	NULL,	 0 },	/* I3C0 */
> -	[ASPEED_CLK_GATE_I3C1CLK]	= { 41,  41, "i3c1clk-gate",	NULL,	 0 },	/* I3C1 */
> -	[ASPEED_CLK_GATE_I3C2CLK]	= { 42,  42, "i3c2clk-gate",	NULL,	 0 },	/* I3C2 */
> -	[ASPEED_CLK_GATE_I3C3CLK]	= { 43,  43, "i3c3clk-gate",	NULL,	 0 },	/* I3C3 */
> -	[ASPEED_CLK_GATE_I3C4CLK]	= { 44,  44, "i3c4clk-gate",	NULL,	 0 },	/* I3C4 */
> -	[ASPEED_CLK_GATE_I3C5CLK]	= { 45,  45, "i3c5clk-gate",	NULL,	 0 },	/* I3C5 */
> -	[ASPEED_CLK_GATE_I3C6CLK]	= { 46,  46, "i3c6clk-gate",	NULL,	 0 },	/* I3C6 */
> -	[ASPEED_CLK_GATE_I3C7CLK]	= { 47,  47, "i3c7clk-gate",	NULL,	 0 },	/* I3C7 */
> +	[ASPEED_CLK_GATE_I3C0CLK]	= { 40,  40, "i3c0clk-gate",	"i3cclk", 0 }, /* I3C0 */
> +	[ASPEED_CLK_GATE_I3C1CLK]	= { 41,  41, "i3c1clk-gate",	"i3cclk", 0 }, /* I3C1 */
> +	[ASPEED_CLK_GATE_I3C2CLK]	= { 42,  42, "i3c2clk-gate",	"i3cclk", 0 }, /* I3C2 */
> +	[ASPEED_CLK_GATE_I3C3CLK]	= { 43,  43, "i3c3clk-gate",	"i3cclk", 0 }, /* I3C3 */
> +	[ASPEED_CLK_GATE_I3C4CLK]	= { 44,  44, "i3c4clk-gate",	"i3cclk", 0 }, /* I3C4 */
> +	[ASPEED_CLK_GATE_I3C5CLK]	= { 45,  45, "i3c5clk-gate",	"i3cclk", 0 }, /* I3C5 */
> +	/* Reserved: 46 & 47 */
>  	[ASPEED_CLK_GATE_UART1CLK]	= { 48,  -1, "uart1clk-gate",	"uart",	 0 },	/* UART1 */
>  	[ASPEED_CLK_GATE_UART2CLK]	= { 49,  -1, "uart2clk-gate",	"uart",	 0 },	/* UART2 */
>  	[ASPEED_CLK_GATE_UART3CLK]	= { 50,  -1, "uart3clk-gate",	"uart",  0 },	/* UART3 */
> @@ -775,6 +787,16 @@ static void __init aspeed_g6_cc(struct regmap *map)
>  	/* USB 2.0 port1 phy 40MHz clock */
>  	hw = clk_hw_register_fixed_rate(NULL, "usb-phy-40m", NULL, 0, 40000000);
>  	aspeed_g6_clk_data->hws[ASPEED_CLK_USBPHY_40M] = hw;
> +
> +	/* i3c clock: source from apll, divide by 8 */
> +	regmap_read(map, ASPEED_G6_CLK_SELECTION5, &val);
> +	val &= ~(I3C_CLK_SELECTION | APLL_DIV_SELECTION);
> +	val |= FIELD_PREP(I3C_CLK_SELECTION, I3C_CLK_SELECT_APLL_DIV);
> +	val |= FIELD_PREP(APLL_DIV_SELECTION, APLL_DIV_8);
> +	regmap_write(map, ASPEED_G6_CLK_SELECTION5, val);
> +
> +	hw = clk_hw_register_fixed_factor(NULL, "i3cclk", "apll", 0, 1, 8);
> +	aspeed_g6_clk_data->hws[ASPEED_CLK_I3C] = hw;
>  };
>  
>  static void __init aspeed_g6_cc_init(struct device_node *np)
> diff --git a/include/dt-bindings/clock/ast2600-clock.h b/include/dt-bindings/clock/ast2600-clock.h
> index d8b0db2f7a7d..600549d7bee8 100644
> --- a/include/dt-bindings/clock/ast2600-clock.h
> +++ b/include/dt-bindings/clock/ast2600-clock.h
> @@ -57,8 +57,6 @@
>  #define ASPEED_CLK_GATE_I3C3CLK		40
>  #define ASPEED_CLK_GATE_I3C4CLK		41
>  #define ASPEED_CLK_GATE_I3C5CLK		42
> -#define ASPEED_CLK_GATE_I3C6CLK		43
> -#define ASPEED_CLK_GATE_I3C7CLK		44

This is an ABI break and commit msg does not really justify it.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 2/3] clk: aspeed: Add full configs for i3c clocks
  2023-02-13  9:48   ` Krzysztof Kozlowski
@ 2023-02-13 12:34     ` Jeremy Kerr
  0 siblings, 0 replies; 12+ messages in thread
From: Jeremy Kerr @ 2023-02-13 12:34 UTC (permalink / raw)
  To: Krzysztof Kozlowski, linux-aspeed, linux-clk
  Cc: devicetree, Krzysztof Kozlowski, Michael Turquette, Rob Herring,
	Stephen Boyd, Dylan Hung, Joel Stanley, Andrew Jeffery

Hi Krzysztof,

> Bindings are always separate patches.

OK, I'll split these up into the dt-bindings and the clk changes.

> > diff --git a/include/dt-bindings/clock/ast2600-clock.h b/include/dt-bindings/clock/ast2600-clock.h
> > index d8b0db2f7a7d..600549d7bee8 100644
> > --- a/include/dt-bindings/clock/ast2600-clock.h
> > +++ b/include/dt-bindings/clock/ast2600-clock.h
> > @@ -57,8 +57,6 @@
> >  #define ASPEED_CLK_GATE_I3C3CLK                40
> >  #define ASPEED_CLK_GATE_I3C4CLK                41
> >  #define ASPEED_CLK_GATE_I3C5CLK                42
> > -#define ASPEED_CLK_GATE_I3C6CLK                43
> > -#define ASPEED_CLK_GATE_I3C7CLK                44
> 
> This is an ABI break and commit msg does not really justify it.

I'll add more rationale there.

Cheers,


Jeremy


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-02-13 12:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-13  6:02 [PATCH v2 0/3] Add definitions for AST2600 i3c clocks and resets Jeremy Kerr
2023-02-13  6:02 ` [PATCH v2 1/3] clk: ast2600: allow empty entries in aspeed_g6_gates Jeremy Kerr
2023-02-13  6:02 ` [PATCH v2 2/3] clk: aspeed: Add full configs for i3c clocks Jeremy Kerr
2023-02-13  8:44   ` Krzysztof Kozlowski
2023-02-13  9:48   ` Krzysztof Kozlowski
2023-02-13 12:34     ` Jeremy Kerr
2023-02-13  6:02 ` [PATCH v2 3/3] dts: ast2600: Add reset config for I3C Jeremy Kerr
2023-02-13  8:44   ` Krzysztof Kozlowski
2023-02-13  9:02     ` Jeremy Kerr
2023-02-13  9:06       ` Krzysztof Kozlowski
2023-02-13  9:23         ` Jeremy Kerr
2023-02-13  9:31           ` Krzysztof Kozlowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.