PXA168 clock fixes
Subsystems (2)
cover PXA168 clock fixes
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
PATCH 1/12 clk: mmp: pxa168: add additional register defines
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).
--- drivers/clk/mmp/clk-of-pxa168.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-)
drivers/clk/mmp/clk-of-pxa168.c +24 -7
@@ -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 0x14struct pxa168_clk_unit {
Signature · 1 line
2.25.1
Re: [PATCH 01/12] clk: mmp: pxa168: add additional register defines
Quoting Doug Brown (2022-06-12 12:29:26)
Quoted 7 lines
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 <[email protected]>---
Applied to clk-next
PATCH 2/12 clk: mmp: pxa168: fix incorrect dividers
In reply to Doug BrownThese 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.
--- drivers/clk/mmp/clk-of-pxa168.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/mmp/clk-of-pxa168.c +2 -2
@@ -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}, };
Signature · 1 line
2.25.1
Re: [PATCH 02/12] clk: mmp: pxa168: fix incorrect dividers
Quoting Doug Brown (2022-06-12 12:29:27)
Quoted 6 lines
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 <[email protected]>---
Applied to clk-next
PATCH 3/12 dt-bindings: marvell,pxa168: add clock ids for additional dividers
In reply to Doug BrownThis adds a few new clocks divided from PLL1 and CLK32 that are potentially used by a few peripherals with muxed clocks.
--- include/dt-bindings/clock/marvell,pxa168.h | 3 +++ 1 file changed, 3 insertions(+)
include/dt-bindings/clock/marvell,pxa168.h +3 -0
@@ -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
Signature · 1 line
2.25.1
Re: [PATCH 03/12] dt-bindings: marvell,pxa168: add clock ids for additional dividers
Quoted 8 lines · 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 <[email protected]>--- include/dt-bindings/clock/marvell,pxa168.h | 3 +++ 1 file changed, 3 insertions(+)
Re: [PATCH 03/12] dt-bindings: marvell,pxa168: add clock ids for additional dividers
In reply to Doug BrownQuoting Doug Brown (2022-06-12 12:29:28)
Quoted 5 lines
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 <[email protected]>---
Applied to clk-next
PATCH 4/12 clk: mmp: pxa168: add new clocks for peripherals
In reply to Doug BrownThis 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.
--- drivers/clk/mmp/clk-of-pxa168.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/clk/mmp/clk-of-pxa168.c +3 -0
@@ -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 = {
Signature · 1 line
2.25.1
Re: [PATCH 04/12] clk: mmp: pxa168: add new clocks for peripherals
Quoting Doug Brown (2022-06-12 12:29:29)
Quoted 6 lines
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 <[email protected]>---
Applied to clk-next
PATCH 5/12 clk: mmp: pxa168: fix const-correctness
In reply to Doug BrownWhile working on this series of patches, checkpatch recommended that an extra const should be added to the mux parent arrays.
--- drivers/clk/mmp/clk-of-pxa168.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/clk/mmp/clk-of-pxa168.c +7 -7
@@ -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},
Signature · 1 line
2.25.1
Re: [PATCH 05/12] clk: mmp: pxa168: fix const-correctness
Quoting Doug Brown (2022-06-12 12:29:30)
Quoted 5 lines
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 <[email protected]>---
Applied to clk-next
PATCH 6/12 clk: mmp: pxa168: fix incorrect parent clocks
In reply to Doug BrownThe 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.
--- drivers/clk/mmp/clk-of-pxa168.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/clk/mmp/clk-of-pxa168.c +6 -6
@@ -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},
Signature · 1 line
2.25.1
Re: [PATCH 06/12] clk: mmp: pxa168: fix incorrect parent clocks
Quoting Doug Brown (2022-06-12 12:29:31)
Quoted 10 lines
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.
Quoted 8 lines
- 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 <[email protected]>---
Applied to clk-next
PATCH 7/12 clk: mmp: pxa168: add muxes for more peripherals
In reply to Doug BrownThe 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
--- drivers/clk/mmp/clk-of-pxa168.c | 42 +++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 10 deletions(-)
drivers/clk/mmp/clk-of-pxa168.c +32 -10
@@ -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},
Signature · 1 line
2.25.1
Re: [PATCH 07/12] clk: mmp: pxa168: add muxes for more peripherals
Quoting Doug Brown (2022-06-12 12:29:32)
Quoted 10 lines
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 MHzSigned-off-by Doug Brown <[email protected]>---
Applied to clk-next
PATCH 8/12 clk: mmp: pxa168: fix GPIO clock enable bits
In reply to Doug BrownAccording 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).
--- drivers/clk/mmp/clk-of-pxa168.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/mmp/clk-of-pxa168.c +1 -1
@@ -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},
Signature · 1 line
2.25.1
Re: [PATCH 08/12] clk: mmp: pxa168: fix GPIO clock enable bits
Quoting Doug Brown (2022-06-12 12:29:33)
Quoted 5 lines
According to the datasheet, only bit 0 of
APBC_GPIOshould be controlled for the clock enable. Bit 1 is marked as reserved (always write 0).Signed-off-by Doug Brown <[email protected]>---
Applied to clk-next
PATCH 9/12 dt-bindings: marvell,pxa168: add clock id for SDH3
In reply to Doug BrownThere are four SDHC peripherals on the PXA168, but only three of them were present in the DT bindings. This commit adds the fourth.
--- include/dt-bindings/clock/marvell,pxa168.h | 1 + 1 file changed, 1 insertion(+)
include/dt-bindings/clock/marvell,pxa168.h +1 -0
@@ -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
Signature · 1 line
2.25.1
Re: [PATCH 09/12] dt-bindings: marvell,pxa168: add clock id for SDH3
Quoted 8 lines · 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 <[email protected]>--- include/dt-bindings/clock/marvell,pxa168.h | 1 + 1 file changed, 1 insertion(+)
Re: [PATCH 09/12] dt-bindings: marvell,pxa168: add clock id for SDH3
In reply to Doug BrownQuoting Doug Brown (2022-06-12 12:29:34)
Quoted 5 lines
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 <[email protected]>---
Applied to clk-next
PATCH 10/12 clk: mmp: pxa168: add clocks for SDH2 and SDH3
In reply to Doug BrownThe PXA168 has four SDHC peripherals. This commit adds the last two.
--- drivers/clk/mmp/clk-of-pxa168.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/clk/mmp/clk-of-pxa168.c +6 -0
@@ -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},
Signature · 1 line
2.25.1
Re: [PATCH 10/12] clk: mmp: pxa168: add clocks for SDH2 and SDH3
Quoting Doug Brown (2022-06-12 12:29:35)
Quoted 4 lines
The PXA168 has four SDHC peripherals. This commit adds the last two.
Signed-off-by Doug Brown <[email protected]>---
Applied to clk-next
PATCH 11/12 dt-bindings: marvell,pxa168: add clock ids for SDH AXI clocks
In reply to Doug BrownThese are clocks shared by SDH0/1 and SDH2/3, respectively.
--- include/dt-bindings/clock/marvell,pxa168.h | 2 ++ 1 file changed, 2 insertions(+)
include/dt-bindings/clock/marvell,pxa168.h +2 -0
@@ -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
Signature · 1 line
2.25.1
Re: [PATCH 11/12] dt-bindings: marvell,pxa168: add clock ids for SDH AXI clocks
Quoted 7 lines · Doug Brown
These are clocks shared by SDH0/1 and SDH2/3, respectively.
Signed-off-by Doug Brown <[email protected]>--- include/dt-bindings/clock/marvell,pxa168.h | 2 ++ 1 file changed, 2 insertions(+)
Re: [PATCH 11/12] dt-bindings: marvell,pxa168: add clock ids for SDH AXI clocks
In reply to Doug BrownQuoting Doug Brown (2022-06-12 12:29:36)
Quoted 4 lines
These are clocks shared by SDH0/1 and SDH2/3, respectively.
Signed-off-by Doug Brown <[email protected]>---
Applied to clk-next
PATCH 12/12 clk: mmp: pxa168: control shared SDH bits with separate clock
In reply to Doug BrownThe 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.
--- drivers/clk/mmp/clk-of-pxa168.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/clk/mmp/clk-of-pxa168.c +7 -4
@@ -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},
Signature · 1 line
2.25.1
Re: [PATCH 12/12] clk: mmp: pxa168: control shared SDH bits with separate clock
Quoting Doug Brown (2022-06-12 12:29:37)
Quoted 6 lines
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.
Quoted 7 lines
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 <[email protected]>---
Applied to clk-next