All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12] PXA168 clock fixes
@ 2022-06-12 19:29 Doug Brown
  2022-06-12 19:29 ` [PATCH 01/12] clk: mmp: pxa168: add additional register defines Doug Brown
                   ` (11 more replies)
  0 siblings, 12 replies; 28+ messages in thread
From: Doug Brown @ 2022-06-12 19:29 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski
  Cc: linux-clk, devicetree

Hello,

I have been working on bringing the PXA168 support in the kernel up to
snuff. I found several mistakes in the clock muxing, and began work on
getting the SDHC controllers hooked up properly. I've been testing these
changes on a device that uses the PXA168 (Chumby 8).

I'm a little unsure if I'm following the correct approach in the last
two patches, and would definitely appreciate some feedback if there is
a more appropriate way to handle this situation where two peripherals
share a clock enable in a single register. In particular, I wasn't sure
if creating the shared clocks without a parent at all would be okay:

[11/12] dt-bindings: marvell,pxa168: add clock ids for SDH AXI clocks
[12/12] clk: mmp: pxa168: control shared SDH bits with separate clock

I'm aware that checkpatch warns about the long lines, but I was unsure
if that actually mattered given that the existing file also has the
warnings.

I plan on continuing to work on additional PXA168 fixes over time.

Thanks,
Doug


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

* [PATCH 01/12] clk: mmp: pxa168: add additional register defines
  2022-06-12 19:29 [PATCH 00/12] PXA168 clock fixes Doug Brown
@ 2022-06-12 19:29 ` Doug Brown
  2022-09-30 20:43   ` Stephen Boyd
  2022-06-12 19:29 ` [PATCH 02/12] clk: mmp: pxa168: fix incorrect dividers Doug Brown
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Doug Brown @ 2022-06-12 19:29 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski
  Cc: linux-clk, devicetree, Doug Brown

In preparation for adding additional peripherals over time, this commit
adds a bunch of extra APBC_* defines based on information from the
datasheet. It also reorganizes the list of defines to be ordered
sequentially by address (grouped by type).

Signed-off-by: Doug Brown <doug@schmorgal.com>
---
 drivers/clk/mmp/clk-of-pxa168.c | 31 ++++++++++++++++++++++++-------
 1 file changed, 24 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/mmp/clk-of-pxa168.c b/drivers/clk/mmp/clk-of-pxa168.c
index f110c02e83cb..c975a45f9bb6 100644
--- a/drivers/clk/mmp/clk-of-pxa168.c
+++ b/drivers/clk/mmp/clk-of-pxa168.c
@@ -22,9 +22,6 @@
 #include "clk.h"
 #include "reset.h"
 
-#define APBC_RTC	0x28
-#define APBC_TWSI0	0x2c
-#define APBC_KPC	0x30
 #define APBC_UART0	0x0
 #define APBC_UART1	0x4
 #define APBC_GPIO	0x8
@@ -32,20 +29,40 @@
 #define APBC_PWM1	0x10
 #define APBC_PWM2	0x14
 #define APBC_PWM3	0x18
+#define APBC_RTC	0x28
+#define APBC_TWSI0	0x2c
+#define APBC_KPC	0x30
 #define APBC_TIMER	0x34
+#define APBC_AIB	0x3c
+#define APBC_SW_JTAG	0x40
+#define APBC_ONEWIRE	0x48
+#define APBC_TWSI1	0x6c
+#define APBC_UART2	0x70
+#define APBC_AC97	0x84
 #define APBC_SSP0	0x81c
 #define APBC_SSP1	0x820
 #define APBC_SSP2	0x84c
 #define APBC_SSP3	0x858
 #define APBC_SSP4	0x85c
-#define APBC_TWSI1	0x6c
-#define APBC_UART2	0x70
+#define APMU_DISP0	0x4c
+#define APMU_CCIC0	0x50
 #define APMU_SDH0	0x54
 #define APMU_SDH1	0x58
 #define APMU_USB	0x5c
-#define APMU_DISP0	0x4c
-#define APMU_CCIC0	0x50
 #define APMU_DFC	0x60
+#define APMU_DMA	0x64
+#define APMU_BUS	0x6c
+#define APMU_GC		0xcc
+#define APMU_SMC	0xd4
+#define APMU_XD		0xdc
+#define APMU_SDH2	0xe0
+#define APMU_SDH3	0xe4
+#define APMU_CF		0xf0
+#define APMU_MSP	0xf4
+#define APMU_CMU	0xf8
+#define APMU_FE		0xfc
+#define APMU_PCIE	0x100
+#define APMU_EPD	0x104
 #define MPMU_UART_PLL	0x14
 
 struct pxa168_clk_unit {
-- 
2.25.1


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

* [PATCH 02/12] clk: mmp: pxa168: fix incorrect dividers
  2022-06-12 19:29 [PATCH 00/12] PXA168 clock fixes Doug Brown
  2022-06-12 19:29 ` [PATCH 01/12] clk: mmp: pxa168: add additional register defines Doug Brown
@ 2022-06-12 19:29 ` Doug Brown
  2022-09-30 20:43   ` Stephen Boyd
  2022-06-12 19:29 ` [PATCH 03/12] dt-bindings: marvell,pxa168: add clock ids for additional dividers Doug Brown
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Doug Brown @ 2022-06-12 19:29 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski
  Cc: linux-clk, devicetree, Doug Brown

These two clocks had multipliers and dividers that didn't match their
names. A subsequent commit goes through all of the existing peripherals
and ensure the correct clocks are being used everywhere.

Signed-off-by: Doug Brown <doug@schmorgal.com>
---
 drivers/clk/mmp/clk-of-pxa168.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/mmp/clk-of-pxa168.c b/drivers/clk/mmp/clk-of-pxa168.c
index c975a45f9bb6..42569cf3f42f 100644
--- a/drivers/clk/mmp/clk-of-pxa168.c
+++ b/drivers/clk/mmp/clk-of-pxa168.c
@@ -91,8 +91,8 @@ static struct mmp_param_fixed_factor_clk fixed_factor_clks[] = {
 	{PXA168_CLK_PLL1_96, "pll1_96", "pll1_48", 1, 2, 0},
 	{PXA168_CLK_PLL1_192, "pll1_192", "pll1_96", 1, 2, 0},
 	{PXA168_CLK_PLL1_13, "pll1_13", "pll1", 1, 13, 0},
-	{PXA168_CLK_PLL1_13_1_5, "pll1_13_1_5", "pll1_13", 2, 3, 0},
-	{PXA168_CLK_PLL1_2_1_5, "pll1_2_1_5", "pll1_2", 2, 3, 0},
+	{PXA168_CLK_PLL1_13_1_5, "pll1_13_1_5", "pll1_13", 1, 5, 0},
+	{PXA168_CLK_PLL1_2_1_5, "pll1_2_1_5", "pll1_2", 1, 5, 0},
 	{PXA168_CLK_PLL1_3_16, "pll1_3_16", "pll1", 3, 16, 0},
 };
 
-- 
2.25.1


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

* [PATCH 03/12] dt-bindings: marvell,pxa168: add clock ids for additional dividers
  2022-06-12 19:29 [PATCH 00/12] PXA168 clock fixes Doug Brown
  2022-06-12 19:29 ` [PATCH 01/12] clk: mmp: pxa168: add additional register defines Doug Brown
  2022-06-12 19:29 ` [PATCH 02/12] clk: mmp: pxa168: fix incorrect dividers Doug Brown
@ 2022-06-12 19:29 ` Doug Brown
  2022-06-16 17:48   ` Rob Herring
  2022-09-30 20:43   ` Stephen Boyd
  2022-06-12 19:29 ` [PATCH 04/12] clk: mmp: pxa168: add new clocks for peripherals Doug Brown
                   ` (8 subsequent siblings)
  11 siblings, 2 replies; 28+ messages in thread
From: Doug Brown @ 2022-06-12 19:29 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski
  Cc: linux-clk, devicetree, Doug Brown

This adds a few new clocks divided from PLL1 and CLK32 that are
potentially used by a few peripherals with muxed clocks.

Signed-off-by: Doug Brown <doug@schmorgal.com>
---
 include/dt-bindings/clock/marvell,pxa168.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/dt-bindings/clock/marvell,pxa168.h b/include/dt-bindings/clock/marvell,pxa168.h
index db2b41f1b127..8686bc7bf7b6 100644
--- a/include/dt-bindings/clock/marvell,pxa168.h
+++ b/include/dt-bindings/clock/marvell,pxa168.h
@@ -20,8 +20,11 @@
 #define PXA168_CLK_PLL1_2_1_5		19
 #define PXA168_CLK_PLL1_3_16		20
 #define PXA168_CLK_PLL1_192		21
+#define PXA168_CLK_PLL1_2_1_10		22
+#define PXA168_CLK_PLL1_2_3_16		23
 #define PXA168_CLK_UART_PLL		27
 #define PXA168_CLK_USB_PLL		28
+#define PXA168_CLK_CLK32_2		50
 
 /* apb peripherals */
 #define PXA168_CLK_TWSI0		60
-- 
2.25.1


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

* [PATCH 04/12] clk: mmp: pxa168: add new clocks for peripherals
  2022-06-12 19:29 [PATCH 00/12] PXA168 clock fixes Doug Brown
                   ` (2 preceding siblings ...)
  2022-06-12 19:29 ` [PATCH 03/12] dt-bindings: marvell,pxa168: add clock ids for additional dividers Doug Brown
@ 2022-06-12 19:29 ` Doug Brown
  2022-09-30 20:43   ` Stephen Boyd
  2022-06-12 19:29 ` [PATCH 05/12] clk: mmp: pxa168: fix const-correctness Doug Brown
                   ` (7 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Doug Brown @ 2022-06-12 19:29 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski
  Cc: linux-clk, devicetree, Doug Brown

This commit adds three new clocks that previously didn't exist, but are
needed in order to match the clock parenting as described in the PXA168
datasheet.

Signed-off-by: Doug Brown <doug@schmorgal.com>
---
 drivers/clk/mmp/clk-of-pxa168.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clk/mmp/clk-of-pxa168.c b/drivers/clk/mmp/clk-of-pxa168.c
index 42569cf3f42f..aba58ce6e60c 100644
--- a/drivers/clk/mmp/clk-of-pxa168.c
+++ b/drivers/clk/mmp/clk-of-pxa168.c
@@ -94,6 +94,9 @@ static struct mmp_param_fixed_factor_clk fixed_factor_clks[] = {
 	{PXA168_CLK_PLL1_13_1_5, "pll1_13_1_5", "pll1_13", 1, 5, 0},
 	{PXA168_CLK_PLL1_2_1_5, "pll1_2_1_5", "pll1_2", 1, 5, 0},
 	{PXA168_CLK_PLL1_3_16, "pll1_3_16", "pll1", 3, 16, 0},
+	{PXA168_CLK_PLL1_2_1_10, "pll1_2_1_10", "pll1_2", 1, 10, 0},
+	{PXA168_CLK_PLL1_2_3_16, "pll1_2_3_16", "pll1_2", 3, 16, 0},
+	{PXA168_CLK_CLK32_2, "clk32_2", "clk32", 1, 2, 0},
 };
 
 static struct mmp_clk_factor_masks uart_factor_masks = {
-- 
2.25.1


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

* [PATCH 05/12] clk: mmp: pxa168: fix const-correctness
  2022-06-12 19:29 [PATCH 00/12] PXA168 clock fixes Doug Brown
                   ` (3 preceding siblings ...)
  2022-06-12 19:29 ` [PATCH 04/12] clk: mmp: pxa168: add new clocks for peripherals Doug Brown
@ 2022-06-12 19:29 ` Doug Brown
  2022-09-30 20:44   ` Stephen Boyd
  2022-06-12 19:29 ` [PATCH 06/12] clk: mmp: pxa168: fix incorrect parent clocks Doug Brown
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Doug Brown @ 2022-06-12 19:29 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski
  Cc: linux-clk, devicetree, Doug Brown

While working on this series of patches, checkpatch recommended that
an extra const should be added to the mux parent arrays.

Signed-off-by: Doug Brown <doug@schmorgal.com>
---
 drivers/clk/mmp/clk-of-pxa168.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/mmp/clk-of-pxa168.c b/drivers/clk/mmp/clk-of-pxa168.c
index aba58ce6e60c..108a85438858 100644
--- a/drivers/clk/mmp/clk-of-pxa168.c
+++ b/drivers/clk/mmp/clk-of-pxa168.c
@@ -133,17 +133,17 @@ static void pxa168_pll_init(struct pxa168_clk_unit *pxa_unit)
 static DEFINE_SPINLOCK(uart0_lock);
 static DEFINE_SPINLOCK(uart1_lock);
 static DEFINE_SPINLOCK(uart2_lock);
-static const char *uart_parent_names[] = {"pll1_3_16", "uart_pll"};
+static const char * const uart_parent_names[] = {"pll1_3_16", "uart_pll"};
 
 static DEFINE_SPINLOCK(ssp0_lock);
 static DEFINE_SPINLOCK(ssp1_lock);
 static DEFINE_SPINLOCK(ssp2_lock);
 static DEFINE_SPINLOCK(ssp3_lock);
 static DEFINE_SPINLOCK(ssp4_lock);
-static const char *ssp_parent_names[] = {"pll1_96", "pll1_48", "pll1_24", "pll1_12"};
+static const char * const ssp_parent_names[] = {"pll1_96", "pll1_48", "pll1_24", "pll1_12"};
 
 static DEFINE_SPINLOCK(timer_lock);
-static const char *timer_parent_names[] = {"pll1_48", "clk32", "pll1_96", "pll1_192"};
+static const char * const timer_parent_names[] = {"pll1_48", "clk32", "pll1_96", "pll1_192"};
 
 static DEFINE_SPINLOCK(reset_lock);
 
@@ -195,16 +195,16 @@ static void pxa168_apb_periph_clk_init(struct pxa168_clk_unit *pxa_unit)
 
 static DEFINE_SPINLOCK(sdh0_lock);
 static DEFINE_SPINLOCK(sdh1_lock);
-static const char *sdh_parent_names[] = {"pll1_12", "pll1_13"};
+static const char * const sdh_parent_names[] = {"pll1_12", "pll1_13"};
 
 static DEFINE_SPINLOCK(usb_lock);
 
 static DEFINE_SPINLOCK(disp0_lock);
-static const char *disp_parent_names[] = {"pll1_2", "pll1_12"};
+static const char * const disp_parent_names[] = {"pll1_2", "pll1_12"};
 
 static DEFINE_SPINLOCK(ccic0_lock);
-static const char *ccic_parent_names[] = {"pll1_2", "pll1_12"};
-static const char *ccic_phy_parent_names[] = {"pll1_6", "pll1_12"};
+static const char * const ccic_parent_names[] = {"pll1_2", "pll1_12"};
+static const char * const ccic_phy_parent_names[] = {"pll1_6", "pll1_12"};
 
 static struct mmp_param_mux_clk apmu_mux_clks[] = {
 	{0, "sdh0_mux", sdh_parent_names, ARRAY_SIZE(sdh_parent_names), CLK_SET_RATE_PARENT, APMU_SDH0, 6, 1, 0, &sdh0_lock},
-- 
2.25.1


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

* [PATCH 06/12] clk: mmp: pxa168: fix incorrect parent clocks
  2022-06-12 19:29 [PATCH 00/12] PXA168 clock fixes Doug Brown
                   ` (4 preceding siblings ...)
  2022-06-12 19:29 ` [PATCH 05/12] clk: mmp: pxa168: fix const-correctness Doug Brown
@ 2022-06-12 19:29 ` Doug Brown
  2022-09-30 20:44   ` Stephen Boyd
  2022-06-12 19:29 ` [PATCH 07/12] clk: mmp: pxa168: add muxes for more peripherals Doug Brown
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Doug Brown @ 2022-06-12 19:29 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski
  Cc: linux-clk, devicetree, Doug Brown

The UART, SDHC, LCD, and CCIC peripherals' muxed parent clocks didn't
match the information provided by the PXA168 datasheet:

- The UART clocks can be 58.5 MHz or the UART PLL. Previously, the first
  mux option was being calculated as 117 MHz, confirmed on hardware to
  be incorrect.

- The SDHC clocks can be 48 MHz, 52 MHz, or 78 MHz. Previously, 48 MHz
  and 52 MHz were swapped. 78 MHz wasn't listed as an option.

- The LCD clock can be 624 MHz or 312 Mhz. Previously, it was being
  calculated as 312 MHz or 52 MHz.

- The CCIC clock can be 156 MHz or 78 MHz. Previously, it was being
  calculated as 312 MHz or 52 MHz.

Signed-off-by: Doug Brown <doug@schmorgal.com>
---
 drivers/clk/mmp/clk-of-pxa168.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/mmp/clk-of-pxa168.c b/drivers/clk/mmp/clk-of-pxa168.c
index 108a85438858..86e88519938e 100644
--- a/drivers/clk/mmp/clk-of-pxa168.c
+++ b/drivers/clk/mmp/clk-of-pxa168.c
@@ -133,7 +133,7 @@ static void pxa168_pll_init(struct pxa168_clk_unit *pxa_unit)
 static DEFINE_SPINLOCK(uart0_lock);
 static DEFINE_SPINLOCK(uart1_lock);
 static DEFINE_SPINLOCK(uart2_lock);
-static const char * const uart_parent_names[] = {"pll1_3_16", "uart_pll"};
+static const char * const uart_parent_names[] = {"pll1_2_3_16", "uart_pll"};
 
 static DEFINE_SPINLOCK(ssp0_lock);
 static DEFINE_SPINLOCK(ssp1_lock);
@@ -195,20 +195,20 @@ static void pxa168_apb_periph_clk_init(struct pxa168_clk_unit *pxa_unit)
 
 static DEFINE_SPINLOCK(sdh0_lock);
 static DEFINE_SPINLOCK(sdh1_lock);
-static const char * const sdh_parent_names[] = {"pll1_12", "pll1_13"};
+static const char * const sdh_parent_names[] = {"pll1_13", "pll1_12", "pll1_8"};
 
 static DEFINE_SPINLOCK(usb_lock);
 
 static DEFINE_SPINLOCK(disp0_lock);
-static const char * const disp_parent_names[] = {"pll1_2", "pll1_12"};
+static const char * const disp_parent_names[] = {"pll1", "pll1_2"};
 
 static DEFINE_SPINLOCK(ccic0_lock);
-static const char * const ccic_parent_names[] = {"pll1_2", "pll1_12"};
+static const char * const ccic_parent_names[] = {"pll1_4", "pll1_8"};
 static const char * const ccic_phy_parent_names[] = {"pll1_6", "pll1_12"};
 
 static struct mmp_param_mux_clk apmu_mux_clks[] = {
-	{0, "sdh0_mux", sdh_parent_names, ARRAY_SIZE(sdh_parent_names), CLK_SET_RATE_PARENT, APMU_SDH0, 6, 1, 0, &sdh0_lock},
-	{0, "sdh1_mux", sdh_parent_names, ARRAY_SIZE(sdh_parent_names), CLK_SET_RATE_PARENT, APMU_SDH1, 6, 1, 0, &sdh1_lock},
+	{0, "sdh0_mux", sdh_parent_names, ARRAY_SIZE(sdh_parent_names), CLK_SET_RATE_PARENT, APMU_SDH0, 6, 2, 0, &sdh0_lock},
+	{0, "sdh1_mux", sdh_parent_names, ARRAY_SIZE(sdh_parent_names), CLK_SET_RATE_PARENT, APMU_SDH1, 6, 2, 0, &sdh1_lock},
 	{0, "disp0_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP0, 6, 1, 0, &disp0_lock},
 	{0, "ccic0_mux", ccic_parent_names, ARRAY_SIZE(ccic_parent_names), CLK_SET_RATE_PARENT, APMU_CCIC0, 6, 1, 0, &ccic0_lock},
 	{0, "ccic0_phy_mux", ccic_phy_parent_names, ARRAY_SIZE(ccic_phy_parent_names), CLK_SET_RATE_PARENT, APMU_CCIC0, 7, 1, 0, &ccic0_lock},
-- 
2.25.1


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

* [PATCH 07/12] clk: mmp: pxa168: add muxes for more peripherals
  2022-06-12 19:29 [PATCH 00/12] PXA168 clock fixes Doug Brown
                   ` (5 preceding siblings ...)
  2022-06-12 19:29 ` [PATCH 06/12] clk: mmp: pxa168: fix incorrect parent clocks Doug Brown
@ 2022-06-12 19:29 ` Doug Brown
  2022-09-30 20:44   ` Stephen Boyd
  2022-06-12 19:29 ` [PATCH 08/12] clk: mmp: pxa168: fix GPIO clock enable bits Doug Brown
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Doug Brown @ 2022-06-12 19:29 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski
  Cc: linux-clk, devicetree, Doug Brown

The TWSI, KPC, PWM, and DFC peripherals didn't have their muxes modeled
in the code, but the PXA168 datasheet shows that they are indeed muxed:

- TWSI can be 31.2 MHz or 62.4 MHz
- KPC can be 32 kHz, 16 kHz, or 26 MHz
- PWM can be 13 MHz or 32 kHz
- DFC can be 156 MHz or 78 MHz

Signed-off-by: Doug Brown <doug@schmorgal.com>
---
 drivers/clk/mmp/clk-of-pxa168.c | 42 +++++++++++++++++++++++++--------
 1 file changed, 32 insertions(+), 10 deletions(-)

diff --git a/drivers/clk/mmp/clk-of-pxa168.c b/drivers/clk/mmp/clk-of-pxa168.c
index 86e88519938e..d779b3f89656 100644
--- a/drivers/clk/mmp/clk-of-pxa168.c
+++ b/drivers/clk/mmp/clk-of-pxa168.c
@@ -130,6 +130,19 @@ static void pxa168_pll_init(struct pxa168_clk_unit *pxa_unit)
 	mmp_clk_add(unit, PXA168_CLK_UART_PLL, clk);
 }
 
+static DEFINE_SPINLOCK(twsi0_lock);
+static DEFINE_SPINLOCK(twsi1_lock);
+static const char * const twsi_parent_names[] = {"pll1_2_1_10", "pll1_2_1_5"};
+
+static DEFINE_SPINLOCK(kpc_lock);
+static const char * const kpc_parent_names[] = {"clk32", "clk32_2", "pll1_24"};
+
+static DEFINE_SPINLOCK(pwm0_lock);
+static DEFINE_SPINLOCK(pwm1_lock);
+static DEFINE_SPINLOCK(pwm2_lock);
+static DEFINE_SPINLOCK(pwm3_lock);
+static const char * const pwm_parent_names[] = {"pll1_48", "clk32"};
+
 static DEFINE_SPINLOCK(uart0_lock);
 static DEFINE_SPINLOCK(uart1_lock);
 static DEFINE_SPINLOCK(uart2_lock);
@@ -148,6 +161,13 @@ static const char * const timer_parent_names[] = {"pll1_48", "clk32", "pll1_96",
 static DEFINE_SPINLOCK(reset_lock);
 
 static struct mmp_param_mux_clk apbc_mux_clks[] = {
+	{0, "twsi0_mux", twsi_parent_names, ARRAY_SIZE(twsi_parent_names), CLK_SET_RATE_PARENT, APBC_TWSI0, 4, 3, 0, &twsi0_lock},
+	{0, "twsi1_mux", twsi_parent_names, ARRAY_SIZE(twsi_parent_names), CLK_SET_RATE_PARENT, APBC_TWSI1, 4, 3, 0, &twsi1_lock},
+	{0, "kpc_mux", kpc_parent_names, ARRAY_SIZE(kpc_parent_names), CLK_SET_RATE_PARENT, APBC_KPC, 4, 3, 0, &kpc_lock},
+	{0, "pwm0_mux", pwm_parent_names, ARRAY_SIZE(pwm_parent_names), CLK_SET_RATE_PARENT, APBC_PWM0, 4, 3, 0, &pwm0_lock},
+	{0, "pwm1_mux", pwm_parent_names, ARRAY_SIZE(pwm_parent_names), CLK_SET_RATE_PARENT, APBC_PWM1, 4, 3, 0, &pwm1_lock},
+	{0, "pwm2_mux", pwm_parent_names, ARRAY_SIZE(pwm_parent_names), CLK_SET_RATE_PARENT, APBC_PWM2, 4, 3, 0, &pwm2_lock},
+	{0, "pwm3_mux", pwm_parent_names, ARRAY_SIZE(pwm_parent_names), CLK_SET_RATE_PARENT, APBC_PWM3, 4, 3, 0, &pwm3_lock},
 	{0, "uart0_mux", uart_parent_names, ARRAY_SIZE(uart_parent_names), CLK_SET_RATE_PARENT, APBC_UART0, 4, 3, 0, &uart0_lock},
 	{0, "uart1_mux", uart_parent_names, ARRAY_SIZE(uart_parent_names), CLK_SET_RATE_PARENT, APBC_UART1, 4, 3, 0, &uart1_lock},
 	{0, "uart2_mux", uart_parent_names, ARRAY_SIZE(uart_parent_names), CLK_SET_RATE_PARENT, APBC_UART2, 4, 3, 0, &uart2_lock},
@@ -160,16 +180,15 @@ static struct mmp_param_mux_clk apbc_mux_clks[] = {
 };
 
 static struct mmp_param_gate_clk apbc_gate_clks[] = {
-	{PXA168_CLK_TWSI0, "twsi0_clk", "pll1_13_1_5", CLK_SET_RATE_PARENT, APBC_TWSI0, 0x3, 0x3, 0x0, 0, &reset_lock},
-	{PXA168_CLK_TWSI1, "twsi1_clk", "pll1_13_1_5", CLK_SET_RATE_PARENT, APBC_TWSI1, 0x3, 0x3, 0x0, 0, &reset_lock},
+	{PXA168_CLK_TWSI0, "twsi0_clk", "twsi0_mux", CLK_SET_RATE_PARENT, APBC_TWSI0, 0x3, 0x3, 0x0, 0, &twsi0_lock},
+	{PXA168_CLK_TWSI1, "twsi1_clk", "twsi1_mux", CLK_SET_RATE_PARENT, APBC_TWSI1, 0x3, 0x3, 0x0, 0, &twsi1_lock},
 	{PXA168_CLK_GPIO, "gpio_clk", "vctcxo", CLK_SET_RATE_PARENT, APBC_GPIO, 0x3, 0x3, 0x0, 0, &reset_lock},
-	{PXA168_CLK_KPC, "kpc_clk", "clk32", CLK_SET_RATE_PARENT, APBC_KPC, 0x3, 0x3, 0x0, MMP_CLK_GATE_NEED_DELAY, NULL},
+	{PXA168_CLK_KPC, "kpc_clk", "kpc_mux", CLK_SET_RATE_PARENT, APBC_KPC, 0x3, 0x3, 0x0, MMP_CLK_GATE_NEED_DELAY, &kpc_lock},
 	{PXA168_CLK_RTC, "rtc_clk", "clk32", CLK_SET_RATE_PARENT, APBC_RTC, 0x83, 0x83, 0x0, MMP_CLK_GATE_NEED_DELAY, NULL},
-	{PXA168_CLK_PWM0, "pwm0_clk", "pll1_48", CLK_SET_RATE_PARENT, APBC_PWM0, 0x3, 0x3, 0x0, 0, &reset_lock},
-	{PXA168_CLK_PWM1, "pwm1_clk", "pll1_48", CLK_SET_RATE_PARENT, APBC_PWM1, 0x3, 0x3, 0x0, 0, &reset_lock},
-	{PXA168_CLK_PWM2, "pwm2_clk", "pll1_48", CLK_SET_RATE_PARENT, APBC_PWM2, 0x3, 0x3, 0x0, 0, &reset_lock},
-	{PXA168_CLK_PWM3, "pwm3_clk", "pll1_48", CLK_SET_RATE_PARENT, APBC_PWM3, 0x3, 0x3, 0x0, 0, &reset_lock},
-	/* The gate clocks has mux parent. */
+	{PXA168_CLK_PWM0, "pwm0_clk", "pwm0_mux", CLK_SET_RATE_PARENT, APBC_PWM0, 0x3, 0x3, 0x0, 0, &pwm0_lock},
+	{PXA168_CLK_PWM1, "pwm1_clk", "pwm1_mux", CLK_SET_RATE_PARENT, APBC_PWM1, 0x3, 0x3, 0x0, 0, &pwm1_lock},
+	{PXA168_CLK_PWM2, "pwm2_clk", "pwm2_mux", CLK_SET_RATE_PARENT, APBC_PWM2, 0x3, 0x3, 0x0, 0, &pwm2_lock},
+	{PXA168_CLK_PWM3, "pwm3_clk", "pwm3_mux", CLK_SET_RATE_PARENT, APBC_PWM3, 0x3, 0x3, 0x0, 0, &pwm3_lock},
 	{PXA168_CLK_UART0, "uart0_clk", "uart0_mux", CLK_SET_RATE_PARENT, APBC_UART0, 0x3, 0x3, 0x0, 0, &uart0_lock},
 	{PXA168_CLK_UART1, "uart1_clk", "uart1_mux", CLK_SET_RATE_PARENT, APBC_UART1, 0x3, 0x3, 0x0, 0, &uart1_lock},
 	{PXA168_CLK_UART2, "uart2_clk", "uart2_mux", CLK_SET_RATE_PARENT, APBC_UART2, 0x3, 0x3, 0x0, 0, &uart2_lock},
@@ -193,6 +212,9 @@ static void pxa168_apb_periph_clk_init(struct pxa168_clk_unit *pxa_unit)
 
 }
 
+static DEFINE_SPINLOCK(dfc_lock);
+static const char * const dfc_parent_names[] = {"pll1_4", "pll1_8"};
+
 static DEFINE_SPINLOCK(sdh0_lock);
 static DEFINE_SPINLOCK(sdh1_lock);
 static const char * const sdh_parent_names[] = {"pll1_13", "pll1_12", "pll1_8"};
@@ -207,6 +229,7 @@ static const char * const ccic_parent_names[] = {"pll1_4", "pll1_8"};
 static const char * const ccic_phy_parent_names[] = {"pll1_6", "pll1_12"};
 
 static struct mmp_param_mux_clk apmu_mux_clks[] = {
+	{0, "dfc_mux", dfc_parent_names, ARRAY_SIZE(dfc_parent_names), CLK_SET_RATE_PARENT, APMU_DFC, 6, 1, 0, &dfc_lock},
 	{0, "sdh0_mux", sdh_parent_names, ARRAY_SIZE(sdh_parent_names), CLK_SET_RATE_PARENT, APMU_SDH0, 6, 2, 0, &sdh0_lock},
 	{0, "sdh1_mux", sdh_parent_names, ARRAY_SIZE(sdh_parent_names), CLK_SET_RATE_PARENT, APMU_SDH1, 6, 2, 0, &sdh1_lock},
 	{0, "disp0_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP0, 6, 1, 0, &disp0_lock},
@@ -219,10 +242,9 @@ static struct mmp_param_div_clk apmu_div_clks[] = {
 };
 
 static struct mmp_param_gate_clk apmu_gate_clks[] = {
-	{PXA168_CLK_DFC, "dfc_clk", "pll1_4", CLK_SET_RATE_PARENT, APMU_DFC, 0x19b, 0x19b, 0x0, 0, NULL},
+	{PXA168_CLK_DFC, "dfc_clk", "dfc_mux", CLK_SET_RATE_PARENT, APMU_DFC, 0x19b, 0x19b, 0x0, 0, &dfc_lock},
 	{PXA168_CLK_USB, "usb_clk", "usb_pll", 0, APMU_USB, 0x9, 0x9, 0x0, 0, &usb_lock},
 	{PXA168_CLK_SPH, "sph_clk", "usb_pll", 0, APMU_USB, 0x12, 0x12, 0x0, 0, &usb_lock},
-	/* The gate clocks has mux parent. */
 	{PXA168_CLK_SDH0, "sdh0_clk", "sdh0_mux", CLK_SET_RATE_PARENT, APMU_SDH0, 0x1b, 0x1b, 0x0, 0, &sdh0_lock},
 	{PXA168_CLK_SDH1, "sdh1_clk", "sdh1_mux", CLK_SET_RATE_PARENT, APMU_SDH1, 0x1b, 0x1b, 0x0, 0, &sdh1_lock},
 	{PXA168_CLK_DISP0, "disp0_clk", "disp0_mux", CLK_SET_RATE_PARENT, APMU_DISP0, 0x1b, 0x1b, 0x0, 0, &disp0_lock},
-- 
2.25.1


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

* [PATCH 08/12] clk: mmp: pxa168: fix GPIO clock enable bits
  2022-06-12 19:29 [PATCH 00/12] PXA168 clock fixes Doug Brown
                   ` (6 preceding siblings ...)
  2022-06-12 19:29 ` [PATCH 07/12] clk: mmp: pxa168: add muxes for more peripherals Doug Brown
@ 2022-06-12 19:29 ` Doug Brown
  2022-09-30 20:44   ` Stephen Boyd
  2022-06-12 19:29 ` [PATCH 09/12] dt-bindings: marvell,pxa168: add clock id for SDH3 Doug Brown
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Doug Brown @ 2022-06-12 19:29 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski
  Cc: linux-clk, devicetree, Doug Brown

According to the datasheet, only bit 0 of APBC_GPIO should be controlled
for the clock enable. Bit 1 is marked as reserved (always write 0).

Signed-off-by: Doug Brown <doug@schmorgal.com>
---
 drivers/clk/mmp/clk-of-pxa168.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/mmp/clk-of-pxa168.c b/drivers/clk/mmp/clk-of-pxa168.c
index d779b3f89656..eb6a651d2366 100644
--- a/drivers/clk/mmp/clk-of-pxa168.c
+++ b/drivers/clk/mmp/clk-of-pxa168.c
@@ -182,7 +182,7 @@ static struct mmp_param_mux_clk apbc_mux_clks[] = {
 static struct mmp_param_gate_clk apbc_gate_clks[] = {
 	{PXA168_CLK_TWSI0, "twsi0_clk", "twsi0_mux", CLK_SET_RATE_PARENT, APBC_TWSI0, 0x3, 0x3, 0x0, 0, &twsi0_lock},
 	{PXA168_CLK_TWSI1, "twsi1_clk", "twsi1_mux", CLK_SET_RATE_PARENT, APBC_TWSI1, 0x3, 0x3, 0x0, 0, &twsi1_lock},
-	{PXA168_CLK_GPIO, "gpio_clk", "vctcxo", CLK_SET_RATE_PARENT, APBC_GPIO, 0x3, 0x3, 0x0, 0, &reset_lock},
+	{PXA168_CLK_GPIO, "gpio_clk", "vctcxo", CLK_SET_RATE_PARENT, APBC_GPIO, 0x1, 0x1, 0x0, 0, &reset_lock},
 	{PXA168_CLK_KPC, "kpc_clk", "kpc_mux", CLK_SET_RATE_PARENT, APBC_KPC, 0x3, 0x3, 0x0, MMP_CLK_GATE_NEED_DELAY, &kpc_lock},
 	{PXA168_CLK_RTC, "rtc_clk", "clk32", CLK_SET_RATE_PARENT, APBC_RTC, 0x83, 0x83, 0x0, MMP_CLK_GATE_NEED_DELAY, NULL},
 	{PXA168_CLK_PWM0, "pwm0_clk", "pwm0_mux", CLK_SET_RATE_PARENT, APBC_PWM0, 0x3, 0x3, 0x0, 0, &pwm0_lock},
-- 
2.25.1


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

* [PATCH 09/12] dt-bindings: marvell,pxa168: add clock id for SDH3
  2022-06-12 19:29 [PATCH 00/12] PXA168 clock fixes Doug Brown
                   ` (7 preceding siblings ...)
  2022-06-12 19:29 ` [PATCH 08/12] clk: mmp: pxa168: fix GPIO clock enable bits Doug Brown
@ 2022-06-12 19:29 ` Doug Brown
  2022-06-16 17:48   ` Rob Herring
  2022-09-30 20:44   ` Stephen Boyd
  2022-06-12 19:29 ` [PATCH 10/12] clk: mmp: pxa168: add clocks for SDH2 and SDH3 Doug Brown
                   ` (2 subsequent siblings)
  11 siblings, 2 replies; 28+ messages in thread
From: Doug Brown @ 2022-06-12 19:29 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski
  Cc: linux-clk, devicetree, Doug Brown

There are four SDHC peripherals on the PXA168, but only three of them
were present in the DT bindings. This commit adds the fourth.

Signed-off-by: Doug Brown <doug@schmorgal.com>
---
 include/dt-bindings/clock/marvell,pxa168.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/dt-bindings/clock/marvell,pxa168.h b/include/dt-bindings/clock/marvell,pxa168.h
index 8686bc7bf7b6..b1cd4f20d175 100644
--- a/include/dt-bindings/clock/marvell,pxa168.h
+++ b/include/dt-bindings/clock/marvell,pxa168.h
@@ -59,6 +59,7 @@
 #define PXA168_CLK_CCIC0		107
 #define PXA168_CLK_CCIC0_PHY		108
 #define PXA168_CLK_CCIC0_SPHY		109
+#define PXA168_CLK_SDH3			110
 
 #define PXA168_NR_CLKS			200
 #endif
-- 
2.25.1


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

* [PATCH 10/12] clk: mmp: pxa168: add clocks for SDH2 and SDH3
  2022-06-12 19:29 [PATCH 00/12] PXA168 clock fixes Doug Brown
                   ` (8 preceding siblings ...)
  2022-06-12 19:29 ` [PATCH 09/12] dt-bindings: marvell,pxa168: add clock id for SDH3 Doug Brown
@ 2022-06-12 19:29 ` Doug Brown
  2022-09-30 20:44   ` Stephen Boyd
  2022-06-12 19:29 ` [PATCH 11/12] dt-bindings: marvell,pxa168: add clock ids for SDH AXI clocks Doug Brown
  2022-06-12 19:29 ` [PATCH 12/12] clk: mmp: pxa168: control shared SDH bits with separate clock Doug Brown
  11 siblings, 1 reply; 28+ messages in thread
From: Doug Brown @ 2022-06-12 19:29 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski
  Cc: linux-clk, devicetree, Doug Brown

The PXA168 has four SDHC peripherals. This commit adds the last two.

Signed-off-by: Doug Brown <doug@schmorgal.com>
---
 drivers/clk/mmp/clk-of-pxa168.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/clk/mmp/clk-of-pxa168.c b/drivers/clk/mmp/clk-of-pxa168.c
index eb6a651d2366..98046019c5c2 100644
--- a/drivers/clk/mmp/clk-of-pxa168.c
+++ b/drivers/clk/mmp/clk-of-pxa168.c
@@ -217,6 +217,8 @@ static const char * const dfc_parent_names[] = {"pll1_4", "pll1_8"};
 
 static DEFINE_SPINLOCK(sdh0_lock);
 static DEFINE_SPINLOCK(sdh1_lock);
+static DEFINE_SPINLOCK(sdh2_lock);
+static DEFINE_SPINLOCK(sdh3_lock);
 static const char * const sdh_parent_names[] = {"pll1_13", "pll1_12", "pll1_8"};
 
 static DEFINE_SPINLOCK(usb_lock);
@@ -232,6 +234,8 @@ static struct mmp_param_mux_clk apmu_mux_clks[] = {
 	{0, "dfc_mux", dfc_parent_names, ARRAY_SIZE(dfc_parent_names), CLK_SET_RATE_PARENT, APMU_DFC, 6, 1, 0, &dfc_lock},
 	{0, "sdh0_mux", sdh_parent_names, ARRAY_SIZE(sdh_parent_names), CLK_SET_RATE_PARENT, APMU_SDH0, 6, 2, 0, &sdh0_lock},
 	{0, "sdh1_mux", sdh_parent_names, ARRAY_SIZE(sdh_parent_names), CLK_SET_RATE_PARENT, APMU_SDH1, 6, 2, 0, &sdh1_lock},
+	{0, "sdh2_mux", sdh_parent_names, ARRAY_SIZE(sdh_parent_names), CLK_SET_RATE_PARENT, APMU_SDH2, 6, 2, 0, &sdh2_lock},
+	{0, "sdh3_mux", sdh_parent_names, ARRAY_SIZE(sdh_parent_names), CLK_SET_RATE_PARENT, APMU_SDH3, 6, 2, 0, &sdh3_lock},
 	{0, "disp0_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP0, 6, 1, 0, &disp0_lock},
 	{0, "ccic0_mux", ccic_parent_names, ARRAY_SIZE(ccic_parent_names), CLK_SET_RATE_PARENT, APMU_CCIC0, 6, 1, 0, &ccic0_lock},
 	{0, "ccic0_phy_mux", ccic_phy_parent_names, ARRAY_SIZE(ccic_phy_parent_names), CLK_SET_RATE_PARENT, APMU_CCIC0, 7, 1, 0, &ccic0_lock},
@@ -247,6 +251,8 @@ static struct mmp_param_gate_clk apmu_gate_clks[] = {
 	{PXA168_CLK_SPH, "sph_clk", "usb_pll", 0, APMU_USB, 0x12, 0x12, 0x0, 0, &usb_lock},
 	{PXA168_CLK_SDH0, "sdh0_clk", "sdh0_mux", CLK_SET_RATE_PARENT, APMU_SDH0, 0x1b, 0x1b, 0x0, 0, &sdh0_lock},
 	{PXA168_CLK_SDH1, "sdh1_clk", "sdh1_mux", CLK_SET_RATE_PARENT, APMU_SDH1, 0x1b, 0x1b, 0x0, 0, &sdh1_lock},
+	{PXA168_CLK_SDH2, "sdh2_clk", "sdh2_mux", CLK_SET_RATE_PARENT, APMU_SDH2, 0x1b, 0x1b, 0x0, 0, &sdh2_lock},
+	{PXA168_CLK_SDH3, "sdh3_clk", "sdh3_mux", CLK_SET_RATE_PARENT, APMU_SDH3, 0x1b, 0x1b, 0x0, 0, &sdh3_lock},
 	{PXA168_CLK_DISP0, "disp0_clk", "disp0_mux", CLK_SET_RATE_PARENT, APMU_DISP0, 0x1b, 0x1b, 0x0, 0, &disp0_lock},
 	{PXA168_CLK_CCIC0, "ccic0_clk", "ccic0_mux", CLK_SET_RATE_PARENT, APMU_CCIC0, 0x1b, 0x1b, 0x0, 0, &ccic0_lock},
 	{PXA168_CLK_CCIC0_PHY, "ccic0_phy_clk", "ccic0_phy_mux", CLK_SET_RATE_PARENT, APMU_CCIC0, 0x24, 0x24, 0x0, 0, &ccic0_lock},
-- 
2.25.1


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

* [PATCH 11/12] dt-bindings: marvell,pxa168: add clock ids for SDH AXI clocks
  2022-06-12 19:29 [PATCH 00/12] PXA168 clock fixes Doug Brown
                   ` (9 preceding siblings ...)
  2022-06-12 19:29 ` [PATCH 10/12] clk: mmp: pxa168: add clocks for SDH2 and SDH3 Doug Brown
@ 2022-06-12 19:29 ` Doug Brown
  2022-06-16 17:49   ` Rob Herring
  2022-09-30 20:45   ` Stephen Boyd
  2022-06-12 19:29 ` [PATCH 12/12] clk: mmp: pxa168: control shared SDH bits with separate clock Doug Brown
  11 siblings, 2 replies; 28+ messages in thread
From: Doug Brown @ 2022-06-12 19:29 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski
  Cc: linux-clk, devicetree, Doug Brown

These are clocks shared by SDH0/1 and SDH2/3, respectively.

Signed-off-by: Doug Brown <doug@schmorgal.com>
---
 include/dt-bindings/clock/marvell,pxa168.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/dt-bindings/clock/marvell,pxa168.h b/include/dt-bindings/clock/marvell,pxa168.h
index b1cd4f20d175..c92d969ae941 100644
--- a/include/dt-bindings/clock/marvell,pxa168.h
+++ b/include/dt-bindings/clock/marvell,pxa168.h
@@ -60,6 +60,8 @@
 #define PXA168_CLK_CCIC0_PHY		108
 #define PXA168_CLK_CCIC0_SPHY		109
 #define PXA168_CLK_SDH3			110
+#define PXA168_CLK_SDH01_AXI		111
+#define PXA168_CLK_SDH23_AXI		112
 
 #define PXA168_NR_CLKS			200
 #endif
-- 
2.25.1


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

* [PATCH 12/12] clk: mmp: pxa168: control shared SDH bits with separate clock
  2022-06-12 19:29 [PATCH 00/12] PXA168 clock fixes Doug Brown
                   ` (10 preceding siblings ...)
  2022-06-12 19:29 ` [PATCH 11/12] dt-bindings: marvell,pxa168: add clock ids for SDH AXI clocks Doug Brown
@ 2022-06-12 19:29 ` Doug Brown
  2022-09-30 20:45   ` Stephen Boyd
  11 siblings, 1 reply; 28+ messages in thread
From: Doug Brown @ 2022-06-12 19:29 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski
  Cc: linux-clk, devicetree, Doug Brown

The PXA168 has a peculiar setup with the AXI clock enable control for
the SDHC controllers. The bits in the SDH0 register control the AXI
clock enable for both SDH0 and SDH1. Likewise, the bits in the SDH2
register control both SDH2 and SDH3. This is modeled with two new
parentless clocks that control the shared bits.

Previously, SDH0 had to be enabled in order for SDH1 to be used, and
when SDH1 was enabled, unused bits in the SDH1 register were being
controlled. This fixes those issues. A future commit will add support
for these new shared clocks to be enabled by the PXA168 SDHC driver.

Signed-off-by: Doug Brown <doug@schmorgal.com>
---
 drivers/clk/mmp/clk-of-pxa168.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/mmp/clk-of-pxa168.c b/drivers/clk/mmp/clk-of-pxa168.c
index 98046019c5c2..8d0ec06f25ee 100644
--- a/drivers/clk/mmp/clk-of-pxa168.c
+++ b/drivers/clk/mmp/clk-of-pxa168.c
@@ -249,10 +249,13 @@ static struct mmp_param_gate_clk apmu_gate_clks[] = {
 	{PXA168_CLK_DFC, "dfc_clk", "dfc_mux", CLK_SET_RATE_PARENT, APMU_DFC, 0x19b, 0x19b, 0x0, 0, &dfc_lock},
 	{PXA168_CLK_USB, "usb_clk", "usb_pll", 0, APMU_USB, 0x9, 0x9, 0x0, 0, &usb_lock},
 	{PXA168_CLK_SPH, "sph_clk", "usb_pll", 0, APMU_USB, 0x12, 0x12, 0x0, 0, &usb_lock},
-	{PXA168_CLK_SDH0, "sdh0_clk", "sdh0_mux", CLK_SET_RATE_PARENT, APMU_SDH0, 0x1b, 0x1b, 0x0, 0, &sdh0_lock},
-	{PXA168_CLK_SDH1, "sdh1_clk", "sdh1_mux", CLK_SET_RATE_PARENT, APMU_SDH1, 0x1b, 0x1b, 0x0, 0, &sdh1_lock},
-	{PXA168_CLK_SDH2, "sdh2_clk", "sdh2_mux", CLK_SET_RATE_PARENT, APMU_SDH2, 0x1b, 0x1b, 0x0, 0, &sdh2_lock},
-	{PXA168_CLK_SDH3, "sdh3_clk", "sdh3_mux", CLK_SET_RATE_PARENT, APMU_SDH3, 0x1b, 0x1b, 0x0, 0, &sdh3_lock},
+	{PXA168_CLK_SDH0, "sdh0_clk", "sdh0_mux", CLK_SET_RATE_PARENT, APMU_SDH0, 0x12, 0x12, 0x0, 0, &sdh0_lock},
+	{PXA168_CLK_SDH1, "sdh1_clk", "sdh1_mux", CLK_SET_RATE_PARENT, APMU_SDH1, 0x12, 0x12, 0x0, 0, &sdh1_lock},
+	{PXA168_CLK_SDH2, "sdh2_clk", "sdh2_mux", CLK_SET_RATE_PARENT, APMU_SDH2, 0x12, 0x12, 0x0, 0, &sdh2_lock},
+	{PXA168_CLK_SDH3, "sdh3_clk", "sdh3_mux", CLK_SET_RATE_PARENT, APMU_SDH3, 0x12, 0x12, 0x0, 0, &sdh3_lock},
+	/* SDH0/1 and 2/3 AXI clocks are also gated by common bits in SDH0 and SDH2 registers */
+	{PXA168_CLK_SDH01_AXI, "sdh01_axi_clk", NULL, CLK_SET_RATE_PARENT, APMU_SDH0, 0x9, 0x9, 0x0, 0, &sdh0_lock},
+	{PXA168_CLK_SDH23_AXI, "sdh23_axi_clk", NULL, CLK_SET_RATE_PARENT, APMU_SDH2, 0x9, 0x9, 0x0, 0, &sdh2_lock},
 	{PXA168_CLK_DISP0, "disp0_clk", "disp0_mux", CLK_SET_RATE_PARENT, APMU_DISP0, 0x1b, 0x1b, 0x0, 0, &disp0_lock},
 	{PXA168_CLK_CCIC0, "ccic0_clk", "ccic0_mux", CLK_SET_RATE_PARENT, APMU_CCIC0, 0x1b, 0x1b, 0x0, 0, &ccic0_lock},
 	{PXA168_CLK_CCIC0_PHY, "ccic0_phy_clk", "ccic0_phy_mux", CLK_SET_RATE_PARENT, APMU_CCIC0, 0x24, 0x24, 0x0, 0, &ccic0_lock},
-- 
2.25.1


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

* Re: [PATCH 03/12] dt-bindings: marvell,pxa168: add clock ids for additional dividers
  2022-06-12 19:29 ` [PATCH 03/12] dt-bindings: marvell,pxa168: add clock ids for additional dividers Doug Brown
@ 2022-06-16 17:48   ` Rob Herring
  2022-09-30 20:43   ` Stephen Boyd
  1 sibling, 0 replies; 28+ messages in thread
From: Rob Herring @ 2022-06-16 17:48 UTC (permalink / raw)
  To: Doug Brown
  Cc: Michael Turquette, Rob Herring, Stephen Boyd, devicetree,
	linux-clk, Krzysztof Kozlowski

On Sun, 12 Jun 2022 12:29:28 -0700, Doug Brown wrote:
> This adds a few new clocks divided from PLL1 and CLK32 that are
> potentially used by a few peripherals with muxed clocks.
> 
> Signed-off-by: Doug Brown <doug@schmorgal.com>
> ---
>  include/dt-bindings/clock/marvell,pxa168.h | 3 +++
>  1 file changed, 3 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH 09/12] dt-bindings: marvell,pxa168: add clock id for SDH3
  2022-06-12 19:29 ` [PATCH 09/12] dt-bindings: marvell,pxa168: add clock id for SDH3 Doug Brown
@ 2022-06-16 17:48   ` Rob Herring
  2022-09-30 20:44   ` Stephen Boyd
  1 sibling, 0 replies; 28+ messages in thread
From: Rob Herring @ 2022-06-16 17:48 UTC (permalink / raw)
  To: Doug Brown
  Cc: Michael Turquette, Stephen Boyd, linux-clk, Rob Herring,
	Krzysztof Kozlowski, devicetree

On Sun, 12 Jun 2022 12:29:34 -0700, Doug Brown wrote:
> There are four SDHC peripherals on the PXA168, but only three of them
> were present in the DT bindings. This commit adds the fourth.
> 
> Signed-off-by: Doug Brown <doug@schmorgal.com>
> ---
>  include/dt-bindings/clock/marvell,pxa168.h | 1 +
>  1 file changed, 1 insertion(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH 11/12] dt-bindings: marvell,pxa168: add clock ids for SDH AXI clocks
  2022-06-12 19:29 ` [PATCH 11/12] dt-bindings: marvell,pxa168: add clock ids for SDH AXI clocks Doug Brown
@ 2022-06-16 17:49   ` Rob Herring
  2022-09-30 20:45   ` Stephen Boyd
  1 sibling, 0 replies; 28+ messages in thread
From: Rob Herring @ 2022-06-16 17:49 UTC (permalink / raw)
  To: Doug Brown
  Cc: Krzysztof Kozlowski, Stephen Boyd, linux-clk, Michael Turquette,
	devicetree, Rob Herring

On Sun, 12 Jun 2022 12:29:36 -0700, Doug Brown wrote:
> These are clocks shared by SDH0/1 and SDH2/3, respectively.
> 
> Signed-off-by: Doug Brown <doug@schmorgal.com>
> ---
>  include/dt-bindings/clock/marvell,pxa168.h | 2 ++
>  1 file changed, 2 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH 01/12] clk: mmp: pxa168: add additional register defines
  2022-06-12 19:29 ` [PATCH 01/12] clk: mmp: pxa168: add additional register defines Doug Brown
@ 2022-09-30 20:43   ` Stephen Boyd
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2022-09-30 20:43 UTC (permalink / raw)
  To: Doug Brown, Krzysztof Kozlowski, Michael Turquette, Rob Herring
  Cc: linux-clk, devicetree, Doug Brown

Quoting Doug Brown (2022-06-12 12:29:26)
> In preparation for adding additional peripherals over time, this commit
> adds a bunch of extra APBC_* defines based on information from the
> datasheet. It also reorganizes the list of defines to be ordered
> sequentially by address (grouped by type).
> 
> Signed-off-by: Doug Brown <doug@schmorgal.com>
> ---

Applied to clk-next

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

* Re: [PATCH 02/12] clk: mmp: pxa168: fix incorrect dividers
  2022-06-12 19:29 ` [PATCH 02/12] clk: mmp: pxa168: fix incorrect dividers Doug Brown
@ 2022-09-30 20:43   ` Stephen Boyd
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2022-09-30 20:43 UTC (permalink / raw)
  To: Doug Brown, Krzysztof Kozlowski, Michael Turquette, Rob Herring
  Cc: linux-clk, devicetree, Doug Brown

Quoting Doug Brown (2022-06-12 12:29:27)
> These two clocks had multipliers and dividers that didn't match their
> names. A subsequent commit goes through all of the existing peripherals
> and ensure the correct clocks are being used everywhere.
> 
> Signed-off-by: Doug Brown <doug@schmorgal.com>
> ---

Applied to clk-next

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

* Re: [PATCH 03/12] dt-bindings: marvell,pxa168: add clock ids for additional dividers
  2022-06-12 19:29 ` [PATCH 03/12] dt-bindings: marvell,pxa168: add clock ids for additional dividers Doug Brown
  2022-06-16 17:48   ` Rob Herring
@ 2022-09-30 20:43   ` Stephen Boyd
  1 sibling, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2022-09-30 20:43 UTC (permalink / raw)
  To: Doug Brown, Krzysztof Kozlowski, Michael Turquette, Rob Herring
  Cc: linux-clk, devicetree, Doug Brown

Quoting Doug Brown (2022-06-12 12:29:28)
> This adds a few new clocks divided from PLL1 and CLK32 that are
> potentially used by a few peripherals with muxed clocks.
> 
> Signed-off-by: Doug Brown <doug@schmorgal.com>
> ---

Applied to clk-next

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

* Re: [PATCH 04/12] clk: mmp: pxa168: add new clocks for peripherals
  2022-06-12 19:29 ` [PATCH 04/12] clk: mmp: pxa168: add new clocks for peripherals Doug Brown
@ 2022-09-30 20:43   ` Stephen Boyd
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2022-09-30 20:43 UTC (permalink / raw)
  To: Doug Brown, Krzysztof Kozlowski, Michael Turquette, Rob Herring
  Cc: linux-clk, devicetree, Doug Brown

Quoting Doug Brown (2022-06-12 12:29:29)
> This commit adds three new clocks that previously didn't exist, but are
> needed in order to match the clock parenting as described in the PXA168
> datasheet.
> 
> Signed-off-by: Doug Brown <doug@schmorgal.com>
> ---

Applied to clk-next

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

* Re: [PATCH 05/12] clk: mmp: pxa168: fix const-correctness
  2022-06-12 19:29 ` [PATCH 05/12] clk: mmp: pxa168: fix const-correctness Doug Brown
@ 2022-09-30 20:44   ` Stephen Boyd
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2022-09-30 20:44 UTC (permalink / raw)
  To: Doug Brown, Krzysztof Kozlowski, Michael Turquette, Rob Herring
  Cc: linux-clk, devicetree, Doug Brown

Quoting Doug Brown (2022-06-12 12:29:30)
> While working on this series of patches, checkpatch recommended that
> an extra const should be added to the mux parent arrays.
> 
> Signed-off-by: Doug Brown <doug@schmorgal.com>
> ---

Applied to clk-next

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

* Re: [PATCH 06/12] clk: mmp: pxa168: fix incorrect parent clocks
  2022-06-12 19:29 ` [PATCH 06/12] clk: mmp: pxa168: fix incorrect parent clocks Doug Brown
@ 2022-09-30 20:44   ` Stephen Boyd
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2022-09-30 20:44 UTC (permalink / raw)
  To: Doug Brown, Krzysztof Kozlowski, Michael Turquette, Rob Herring
  Cc: linux-clk, devicetree, Doug Brown

Quoting Doug Brown (2022-06-12 12:29:31)
> The UART, SDHC, LCD, and CCIC peripherals' muxed parent clocks didn't
> match the information provided by the PXA168 datasheet:
> 
> - The UART clocks can be 58.5 MHz or the UART PLL. Previously, the first
>   mux option was being calculated as 117 MHz, confirmed on hardware to
>   be incorrect.
> 
> - The SDHC clocks can be 48 MHz, 52 MHz, or 78 MHz. Previously, 48 MHz
>   and 52 MHz were swapped. 78 MHz wasn't listed as an option.
> 
> - The LCD clock can be 624 MHz or 312 Mhz. Previously, it was being
>   calculated as 312 MHz or 52 MHz.
> 
> - The CCIC clock can be 156 MHz or 78 MHz. Previously, it was being
>   calculated as 312 MHz or 52 MHz.
> 
> Signed-off-by: Doug Brown <doug@schmorgal.com>
> ---

Applied to clk-next

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

* Re: [PATCH 07/12] clk: mmp: pxa168: add muxes for more peripherals
  2022-06-12 19:29 ` [PATCH 07/12] clk: mmp: pxa168: add muxes for more peripherals Doug Brown
@ 2022-09-30 20:44   ` Stephen Boyd
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2022-09-30 20:44 UTC (permalink / raw)
  To: Doug Brown, Krzysztof Kozlowski, Michael Turquette, Rob Herring
  Cc: linux-clk, devicetree, Doug Brown

Quoting Doug Brown (2022-06-12 12:29:32)
> The TWSI, KPC, PWM, and DFC peripherals didn't have their muxes modeled
> in the code, but the PXA168 datasheet shows that they are indeed muxed:
> 
> - TWSI can be 31.2 MHz or 62.4 MHz
> - KPC can be 32 kHz, 16 kHz, or 26 MHz
> - PWM can be 13 MHz or 32 kHz
> - DFC can be 156 MHz or 78 MHz
> 
> Signed-off-by: Doug Brown <doug@schmorgal.com>
> ---

Applied to clk-next

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

* Re: [PATCH 08/12] clk: mmp: pxa168: fix GPIO clock enable bits
  2022-06-12 19:29 ` [PATCH 08/12] clk: mmp: pxa168: fix GPIO clock enable bits Doug Brown
@ 2022-09-30 20:44   ` Stephen Boyd
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2022-09-30 20:44 UTC (permalink / raw)
  To: Doug Brown, Krzysztof Kozlowski, Michael Turquette, Rob Herring
  Cc: linux-clk, devicetree, Doug Brown

Quoting Doug Brown (2022-06-12 12:29:33)
> According to the datasheet, only bit 0 of APBC_GPIO should be controlled
> for the clock enable. Bit 1 is marked as reserved (always write 0).
> 
> Signed-off-by: Doug Brown <doug@schmorgal.com>
> ---

Applied to clk-next

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

* Re: [PATCH 09/12] dt-bindings: marvell,pxa168: add clock id for SDH3
  2022-06-12 19:29 ` [PATCH 09/12] dt-bindings: marvell,pxa168: add clock id for SDH3 Doug Brown
  2022-06-16 17:48   ` Rob Herring
@ 2022-09-30 20:44   ` Stephen Boyd
  1 sibling, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2022-09-30 20:44 UTC (permalink / raw)
  To: Doug Brown, Krzysztof Kozlowski, Michael Turquette, Rob Herring
  Cc: linux-clk, devicetree, Doug Brown

Quoting Doug Brown (2022-06-12 12:29:34)
> There are four SDHC peripherals on the PXA168, but only three of them
> were present in the DT bindings. This commit adds the fourth.
> 
> Signed-off-by: Doug Brown <doug@schmorgal.com>
> ---

Applied to clk-next

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

* Re: [PATCH 10/12] clk: mmp: pxa168: add clocks for SDH2 and SDH3
  2022-06-12 19:29 ` [PATCH 10/12] clk: mmp: pxa168: add clocks for SDH2 and SDH3 Doug Brown
@ 2022-09-30 20:44   ` Stephen Boyd
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2022-09-30 20:44 UTC (permalink / raw)
  To: Doug Brown, Krzysztof Kozlowski, Michael Turquette, Rob Herring
  Cc: linux-clk, devicetree, Doug Brown

Quoting Doug Brown (2022-06-12 12:29:35)
> The PXA168 has four SDHC peripherals. This commit adds the last two.
> 
> Signed-off-by: Doug Brown <doug@schmorgal.com>
> ---

Applied to clk-next

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

* Re: [PATCH 11/12] dt-bindings: marvell,pxa168: add clock ids for SDH AXI clocks
  2022-06-12 19:29 ` [PATCH 11/12] dt-bindings: marvell,pxa168: add clock ids for SDH AXI clocks Doug Brown
  2022-06-16 17:49   ` Rob Herring
@ 2022-09-30 20:45   ` Stephen Boyd
  1 sibling, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2022-09-30 20:45 UTC (permalink / raw)
  To: Doug Brown, Krzysztof Kozlowski, Michael Turquette, Rob Herring
  Cc: linux-clk, devicetree, Doug Brown

Quoting Doug Brown (2022-06-12 12:29:36)
> These are clocks shared by SDH0/1 and SDH2/3, respectively.
> 
> Signed-off-by: Doug Brown <doug@schmorgal.com>
> ---

Applied to clk-next

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

* Re: [PATCH 12/12] clk: mmp: pxa168: control shared SDH bits with separate clock
  2022-06-12 19:29 ` [PATCH 12/12] clk: mmp: pxa168: control shared SDH bits with separate clock Doug Brown
@ 2022-09-30 20:45   ` Stephen Boyd
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2022-09-30 20:45 UTC (permalink / raw)
  To: Doug Brown, Krzysztof Kozlowski, Michael Turquette, Rob Herring
  Cc: linux-clk, devicetree, Doug Brown

Quoting Doug Brown (2022-06-12 12:29:37)
> The PXA168 has a peculiar setup with the AXI clock enable control for
> the SDHC controllers. The bits in the SDH0 register control the AXI
> clock enable for both SDH0 and SDH1. Likewise, the bits in the SDH2
> register control both SDH2 and SDH3. This is modeled with two new
> parentless clocks that control the shared bits.
> 
> Previously, SDH0 had to be enabled in order for SDH1 to be used, and
> when SDH1 was enabled, unused bits in the SDH1 register were being
> controlled. This fixes those issues. A future commit will add support
> for these new shared clocks to be enabled by the PXA168 SDHC driver.
> 
> Signed-off-by: Doug Brown <doug@schmorgal.com>
> ---

Applied to clk-next

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

end of thread, other threads:[~2022-09-30 20:45 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-12 19:29 [PATCH 00/12] PXA168 clock fixes Doug Brown
2022-06-12 19:29 ` [PATCH 01/12] clk: mmp: pxa168: add additional register defines Doug Brown
2022-09-30 20:43   ` Stephen Boyd
2022-06-12 19:29 ` [PATCH 02/12] clk: mmp: pxa168: fix incorrect dividers Doug Brown
2022-09-30 20:43   ` Stephen Boyd
2022-06-12 19:29 ` [PATCH 03/12] dt-bindings: marvell,pxa168: add clock ids for additional dividers Doug Brown
2022-06-16 17:48   ` Rob Herring
2022-09-30 20:43   ` Stephen Boyd
2022-06-12 19:29 ` [PATCH 04/12] clk: mmp: pxa168: add new clocks for peripherals Doug Brown
2022-09-30 20:43   ` Stephen Boyd
2022-06-12 19:29 ` [PATCH 05/12] clk: mmp: pxa168: fix const-correctness Doug Brown
2022-09-30 20:44   ` Stephen Boyd
2022-06-12 19:29 ` [PATCH 06/12] clk: mmp: pxa168: fix incorrect parent clocks Doug Brown
2022-09-30 20:44   ` Stephen Boyd
2022-06-12 19:29 ` [PATCH 07/12] clk: mmp: pxa168: add muxes for more peripherals Doug Brown
2022-09-30 20:44   ` Stephen Boyd
2022-06-12 19:29 ` [PATCH 08/12] clk: mmp: pxa168: fix GPIO clock enable bits Doug Brown
2022-09-30 20:44   ` Stephen Boyd
2022-06-12 19:29 ` [PATCH 09/12] dt-bindings: marvell,pxa168: add clock id for SDH3 Doug Brown
2022-06-16 17:48   ` Rob Herring
2022-09-30 20:44   ` Stephen Boyd
2022-06-12 19:29 ` [PATCH 10/12] clk: mmp: pxa168: add clocks for SDH2 and SDH3 Doug Brown
2022-09-30 20:44   ` Stephen Boyd
2022-06-12 19:29 ` [PATCH 11/12] dt-bindings: marvell,pxa168: add clock ids for SDH AXI clocks Doug Brown
2022-06-16 17:49   ` Rob Herring
2022-09-30 20:45   ` Stephen Boyd
2022-06-12 19:29 ` [PATCH 12/12] clk: mmp: pxa168: control shared SDH bits with separate clock Doug Brown
2022-09-30 20:45   ` Stephen Boyd

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.