clk: sunxi-ng: sun6i-a31: Register offset and clk flag fixes
Subsystems (2)
cover clk: sunxi-ng: sun6i-a31: Register offset and clk flag fixes
Hi,
Here are 3 fixes for the new sunxi-ng clk driver for sun6i-a31 recently introduced for 4.9. The issues were noticed while working on the display pipeline for the A31/A31s. The second patch follows what Maxime has done for the A33 CCU driver. The third issue was noticed while doing the first patch.
I hope we can get this into 4.9 as well, either right in -rc1, or in a later -rc.
Thanks!
Regards
ChenYu
Chen-Yu Tsai (3):
clk: sunxi-ng: sun6i-a31: Set CLK_SET_RATE_PARENT for display output
clocks
clk: sunxi-ng: sun6i-a31: set CLK_SET_RATE_UNGATE for all PLLs
clk: sunxi-ng: sun6i-a31: Fix register offset for mipi-csi clk
drivers/clk/sunxi-ng/ccu-sun6i-a31.c | 44 ++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 20 deletions(-)
Signature · 1 line
2.9.3
PATCH 1/3 clk: sunxi-ng: sun6i-a31: Set CLK_SET_RATE_PARENT for display output clocks
The LCD controller and HDMI controller use the LCDx-CHy and HDMI clocks to generate their dot clocks. To be able to generate a full range of possible clock rates, the parent PLL clock rates should also be changed.
--- drivers/clk/sunxi-ng/ccu-sun6i-a31.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/clk/sunxi-ng/ccu-sun6i-a31.c +13 -9
@@ -543,17 +543,19 @@ static const char * const lcd_ch0_parents[] = { "pll-video0", "pll-video1","pll-video0-2x" , "pll-video1-2x", "pll-mipi" }; static SUNXI_CCU_MUX_WITH_GATE(lcd0_ch0_clk, "lcd0-ch0", lcd_ch0_parents, - 0x118, 24, 2, BIT(31), 0); + 0x118, 24, 2, BIT(31), CLK_SET_RATE_PARENT); static SUNXI_CCU_MUX_WITH_GATE(lcd1_ch0_clk, "lcd1-ch0", lcd_ch0_parents, - 0x11c, 24, 2, BIT(31), 0); + 0x11c, 24, 2, BIT(31), CLK_SET_RATE_PARENT);static const char *const lcd_ch1_parents[] = {"pll-video0" ,"pll-video1" ,"pll-video0-2x" ,"pll-video1-2x" }; static SUNXI_CCU_M_WITH_MUX_GATE(lcd0_ch1_clk, "lcd0-ch1", lcd_ch1_parents, - 0x12c, 0, 4, 24, 3, BIT(31), 0); +0x12c ,0 ,4 ,24 ,3 ,BIT (31 ), + CLK_SET_RATE_PARENT); static SUNXI_CCU_M_WITH_MUX_GATE(lcd1_ch1_clk, "lcd1-ch1", lcd_ch1_parents, - 0x12c, 0, 4, 24, 3, BIT(31), 0); +0x12c ,0 ,4 ,24 ,3 ,BIT (31 ), + CLK_SET_RATE_PARENT);static const char *const csi_sclk_parents[] = {"pll-video0" ,"pll-video1" , "pll9", "pll10", "pll-mipi",
@@ -601,7 +603,8 @@ static SUNXI_CCU_GATE(digital_mic_clk, "digital-mic", "pll-audio", 0x148, BIT(31), CLK_SET_RATE_PARENT); static SUNXI_CCU_M_WITH_MUX_GATE(hdmi_clk, "hdmi", lcd_ch1_parents, - 0x150, 0, 4, 24, 2, BIT(31), 0); +0x150 ,0 ,4 ,24 ,2 ,BIT (31 ), + CLK_SET_RATE_PARENT); static SUNXI_CCU_GATE(hdmi_ddc_clk, "hdmi-ddc", "osc24M", 0x150, BIT(31), 0);
@@ -624,10 +627,11 @@ static SUNXI_CCU_MP_WITH_MUX_GATE(mbus1_clk, "mbus1", mbus_parents, 0x160, CLK_IS_CRITICAL); static SUNXI_CCU_M_WITH_MUX_GATE(mipi_dsi_clk, "mipi-dsi", lcd_ch1_parents, - 0x168, 16, 3, 24, 2, BIT(31), 0); +0x168 ,16 ,3 ,24 ,2 ,BIT (31 ), + CLK_SET_RATE_PARENT); static SUNXI_CCU_M_WITH_MUX_GATE(mipi_dsi_dphy_clk, "mipi-dsi-dphy", lcd_ch1_parents,0x168 ,0 ,3 ,8 ,2 , - BIT(15), 0); + BIT(15), CLK_SET_RATE_PARENT); static SUNXI_CCU_M_WITH_MUX_GATE(mipi_csi_dphy_clk, "mipi-csi-dphy", lcd_ch1_parents,0x168 ,0 ,3 ,8 ,2 , BIT(15), 0);
@@ -956,9 +960,9 @@ static CLK_FIXED_FACTOR(pll_audio_8x_clk, "pll-audio-8x", static CLK_FIXED_FACTOR(pll_periph_2x_clk, "pll-periph-2x", "pll-periph", 1, 2, 0); static CLK_FIXED_FACTOR(pll_video0_2x_clk, "pll-video0-2x", - "pll-video0", 1, 2, 0); + "pll-video0", 1, 2, CLK_SET_RATE_PARENT); static CLK_FIXED_FACTOR(pll_video1_2x_clk, "pll-video1-2x", - "pll-video1", 1, 2, 0); + "pll-video1", 1, 2, CLK_SET_RATE_PARENT);static struct clk_hw_onecell_data sun6i_a31_hw_clks = { .hws = {
Signature · 1 line
2.9.3
Stephen Boyd
AppliedPATCH 1/3 clk: sunxi-ng: sun6i-a31: Set CLK_SET_RATE_PARENT for display output clocks
Quoted 7 lines · Chen-Yu Tsai
The LCD controller and HDMI controller use the LCDx-CHy and HDMI clocks to generate their dot clocks. To be able to generate a full range of possible clock rates, the parent PLL clock rates should also be changed.
Fixes c6e6c96d8fa6 ("clk: sunxi-ng: Add A31/A31s clocks")Signed-off-by Chen-Yu Tsai <[email protected]>---
Applied to clk-next
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH 2/3 clk: sunxi-ng: sun6i-a31: set CLK_SET_RATE_UNGATE for all PLLs
In reply to Chen-Yu TsaiThe PLLs have a "lock" bit in their configuration registers which indicate if the PLL has locked on to the requested clock rate. We check this bit in the .set_rate op. The PLL cannot lock on if it's not running, which might be a false positive (warning).
Set the CLK_SET_RATE_UNGATE flag for all PLLs so whenever clk_set_rate is called on them, they get enabled and the "lock" check is really checking the PLL.
--- drivers/clk/sunxi-ng/ccu-sun6i-a31.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/clk/sunxi-ng/ccu-sun6i-a31.c +10 -10
@@ -59,7 +59,7 @@ static SUNXI_CCU_NM_WITH_GATE_LOCK(pll_audio_base_clk, "pll-audio-base",0 ,5 ,/* M */ BIT (31 ),/* gate */ BIT (28 ),/* lock */ - 0); + CLK_SET_RATE_UNGATE); static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_video0_clk, "pll-video0", "osc24M", 0x010,
@@ -71,7 +71,7 @@ static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_video0_clk, "pll-video0",297000000 ,/* frac rate 1 */ BIT (31 ),/* gate */ BIT (28 ),/* lock */ - 0); + CLK_SET_RATE_UNGATE); static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_ve_clk, "pll-ve", "osc24M", 0x018,
@@ -83,7 +83,7 @@ static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_ve_clk, "pll-ve",297000000 ,/* frac rate 1 */ BIT (31 ),/* gate */ BIT (28 ),/* lock */ - 0); + CLK_SET_RATE_UNGATE); static SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_ddr_clk, "pll-ddr", "osc24M", 0x020,
@@ -92,7 +92,7 @@ static SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_ddr_clk, "pll-ddr",0 ,2 ,/* M */ BIT (31 ),/* gate */ BIT (28 ),/* lock */ - 0); + CLK_SET_RATE_UNGATE); static SUNXI_CCU_NK_WITH_GATE_LOCK_POSTDIV(pll_periph_clk, "pll-periph", "osc24M", 0x028,
@@ -101,7 +101,7 @@ static SUNXI_CCU_NK_WITH_GATE_LOCK_POSTDIV(pll_periph_clk, "pll-periph",BIT (31 ),/* gate */ BIT (28 ),/* lock */ 2 ,/* post-div */ - 0); + CLK_SET_RATE_UNGATE); static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_video1_clk, "pll-video1", "osc24M", 0x030,
@@ -113,7 +113,7 @@ static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_video1_clk, "pll-video1",297000000 ,/* frac rate 1 */ BIT (31 ),/* gate */ BIT (28 ),/* lock */ - 0); + CLK_SET_RATE_UNGATE); static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_gpu_clk, "pll-gpu", "osc24M", 0x038,
@@ -125,7 +125,7 @@ static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_gpu_clk, "pll-gpu",297000000 ,/* frac rate 1 */ BIT (31 ),/* gate */ BIT (28 ),/* lock */ - 0); + CLK_SET_RATE_UNGATE);/* * The MIPI PLL has 2 modes: "MIPI" and "HDMI".
@@ -145,7 +145,7 @@ static SUNXI_CCU_NKM_WITH_MUX_GATE_LOCK(pll_mipi_clk, "pll-mipi",21 ,0 ,/* mux */ BIT (31 ),/* gate */ BIT (28 ),/* lock */ - 0); + CLK_SET_RATE_UNGATE); static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll9_clk, "pll9", "osc24M", 0x044,
@@ -157,7 +157,7 @@ static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll9_clk, "pll9",297000000 ,/* frac rate 1 */ BIT (31 ),/* gate */ BIT (28 ),/* lock */ - 0); + CLK_SET_RATE_UNGATE); static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll10_clk, "pll10", "osc24M", 0x048,
@@ -169,7 +169,7 @@ static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll10_clk, "pll10",297000000 ,/* frac rate 1 */ BIT (31 ),/* gate */ BIT (28 ),/* lock */ - 0); + CLK_SET_RATE_UNGATE);static const char *const cpux_parents[] = {"osc32k" ,"osc24M" ,"pll-cpu" ,"pll-cpu" };
Signature · 1 line
2.9.3
PATCH 3/3 clk: sunxi-ng: sun6i-a31: Fix register offset for mipi-csi clk
In reply to Chen-Yu TsaiThe register offset for the mipi-csi clk is off by 4, a copy paste error from the mipi-dsi clk.
--- drivers/clk/sunxi-ng/ccu-sun6i-a31.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/sunxi-ng/ccu-sun6i-a31.c +1 -1
@@ -633,7 +633,7 @@ static SUNXI_CCU_M_WITH_MUX_GATE(mipi_dsi_dphy_clk, "mipi-dsi-dphy", lcd_ch1_parents,0x168 ,0 ,3 ,8 ,2 , BIT(15), CLK_SET_RATE_PARENT); static SUNXI_CCU_M_WITH_MUX_GATE(mipi_csi_dphy_clk, "mipi-csi-dphy", - lcd_ch1_parents,0x168 ,0 ,3 ,8 ,2 , + lcd_ch1_parents,0x16c ,0 ,3 ,8 ,2 , BIT(15), 0); static SUNXI_CCU_M_WITH_MUX_GATE(iep_drc0_clk, "iep-drc0", de_parents,
Signature · 1 line
2.9.3
Stephen Boyd
AppliedPATCH 3/3 clk: sunxi-ng: sun6i-a31: Fix register offset for mipi-csi clk
Quoted 6 lines · Chen-Yu Tsai
The register offset for the mipi-csi clk is off by 4, a copy paste error from the mipi-dsi clk.
Fixes c6e6c96d8fa6 ("clk: sunxi-ng: Add A31/A31s clocks")Signed-off-by Chen-Yu Tsai <[email protected]>---
Applied to clk-next
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
cover clk: sunxi-ng: sun6i-a31: Register offset and clk flag fixes
In reply to Chen-Yu TsaiHi,
Quoted 10 lines · Chen-Yu Tsai
Hi,
Here are 3 fixes for the new sunxi-ng clk driver for sun6i-a31 recently introduced for 4.9. The issues were noticed while working on the display pipeline for the A31/A31s. The second patch follows what Maxime has done for the A33 CCU driver. The third issue was noticed while doing the first patch.
I hope we can get this into 4.9 as well, either right in -rc1, or in a later -rc.
Stephen, could you apply those patches directly on top of my previous PR, or do you want me to send another one?
Thanks,
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160915/9197698c/attachment.sig>
cover clk: sunxi-ng: sun6i-a31: Register offset and clk flag fixes
Quoted 11 lines · Maxime Ripard
Hi,
Quoted 8 lines · Chen-Yu Tsai
Hi,
Here are 3 fixes for the new sunxi-ng clk driver for sun6i-a31 recently introduced for 4.9. The issues were noticed while working on the display pipeline for the A31/A31s. The second patch follows what Maxime has done for the A33 CCU driver. The third issue was noticed while doing the first patch.
Quoted 7 lines
Quoted 2 lines
I hope we can get this into 4.9 as well, either right in -rc1, or in a later -rc.
Acked-by Maxime Ripard <[email protected]>Stephen, could you apply those patches directly on top of my previous PR, or do you want me to send another one?
I can apply directly to clk-next.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
cover clk: sunxi-ng: sun6i-a31: Register offset and clk flag fixes
Quoted 14 lines · Stephen Boyd
Quoted 13 lines · Maxime Ripard
Hi,
Quoted 10 lines · Chen-Yu Tsai
Hi,
Here are 3 fixes for the new sunxi-ng clk driver for sun6i-a31 recently introduced for 4.9. The issues were noticed while working on the display pipeline for the A31/A31s. The second patch follows what Maxime has done for the A33 CCU driver. The third issue was noticed while doing the first patch.
I hope we can get this into 4.9 as well, either right in -rc1, or in a later -rc.
Quoted 7 lines
Quoted 5 lines
Acked-by Maxime Ripard <[email protected]>Stephen, could you apply those patches directly on top of my previous PR, or do you want me to send another one?
I can apply directly to clk-next.
Awesome, thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160918/1e59ebf6/attachment-0001.sig>