clk: sunxi-ng: sun8i-de2: Multiple fixes
Subsystems (2)
v2 cover clk: sunxi-ng: sun8i-de2: Multiple fixes
In current sun8i-de2 clock driver, rotation core related clocks and reset weren't considered properly. All SoC which have that core don't have those definitions. Even worse, the only SoC which have rotation core related definitions doesn't have that core at all.
This series fixes this mess.
Please take a look.
Best regards,
Jernej
Changes from v1:
- fix "fixes" tags
- move sort patch at the end
- update several commit logs
Jernej Skrabec (7):
clk: sunxi-ng: sun8i-de2: Split out H5 definitions
clk: sunxi-ng: sun8i-de2: Add rotation core clocks and reset for A64
clk: sunxi-ng: sun8i-de2: H6 doesn't have rotate core
clk: sunxi-ng: sun8i-de2: Don't reuse A83T resets
clk: sunxi-ng: sun8i-de2: Add rotation core clocks and reset for A83T
clk: sunxi-ng: sun8i-de2: Add R40 specific quirks
clk: sunxi-ng: sun8i-de2: Sort structures
drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 127 +++++++++++++++++---------- 1 file changed, 80 insertions(+), 47 deletions(-)
Signature · 1 line
2.25.0
PATCH v2 1/7 clk: sunxi-ng: sun8i-de2: Split out H5 definitions
H5 has less clocks and resets than A64. Currently that's not obvious because A64 is missing rotation core related clocks and reset.
Split out H5 definition. A64 structures will be fixed in subsequent commit.
Note that this patch depends on commit 19368d99746e ("clk: sunxi-ng:
add support for Allwinner H3 DE2 CCU") for the H3 clock list.
--- drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/clk/sunxi-ng/ccu-sun8i-de2.c +17 -1
@@ -192,6 +192,12 @@ static struct ccu_reset_map sun50i_a64_de2_resets[] = { [RST_WB] = { 0x08, BIT(2) }, }; +static struct ccu_reset_map sun50i_h5_de2_resets[] = { + [RST_MIXER0 ] = {0x08 ,BIT (0 ) }, + [RST_MIXER1 ] = {0x08 ,BIT (1 ) }, + [RST_WB ] = {0x08 ,BIT (2 ) }, +}; +static struct ccu_reset_map sun50i_h6_de3_resets[] = { [RST_MIXER0 ] = {0x08 ,BIT (0 ) }, [RST_MIXER1 ] = {0x08 ,BIT (1 ) },
@@ -229,6 +235,16 @@ static const struct sunxi_ccu_desc sun50i_a64_de2_clk_desc = { .num_resets = ARRAY_SIZE(sun50i_a64_de2_resets), }; +static const struct sunxi_ccu_desc sun50i_h5_de2_clk_desc = { + .ccu_clks = sun8i_h3_de2_clks, + .num_ccu_clks =ARRAY_SIZE (sun8i_h3_de2_clks), + + .hw_clks = &sun8i_h3_de2_hw_clks, + + .resets = sun50i_h5_de2_resets, + .num_resets =ARRAY_SIZE (sun50i_h5_de2_resets), +}; +static const struct sunxi_ccu_desc sun50i_h6_de3_clk_desc = { .ccu_clks = sun50i_h6_de3_clks, .num_ccu_clks =ARRAY_SIZE (sun50i_h6_de3_clks),
@@ -347,7 +363,7 @@ static const struct of_device_id sunxi_de2_clk_ids[] = { }, { .compatible = "allwinner,sun50i-h5-de2-clk", - .data = &sun50i_a64_de2_clk_desc, + .data = &sun50i_h5_de2_clk_desc, }, { .compatible = "allwinner,sun50i-h6-de3-clk",
Signature · 1 line
2.25.0
PATCH v2 2/7 clk: sunxi-ng: sun8i-de2: Add rotation core clocks and reset for A64
In reply to Jernej SkrabecA64 has rotation core which needs clocks and reset. Because there is no appropriate structures available, make a separate, A64 specific structures.
--- drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 45 ++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-)
drivers/clk/sunxi-ng/ccu-sun8i-de2.c +42 -3
@@ -108,6 +108,24 @@ static struct ccu_common *sun8i_v3s_de2_clks[] = { &wb_div_clk.common, }; +static struct ccu_common *sun50i_a64_de2_clks[] = { + &mixer0_clk.common, + &mixer1_clk.common, + &wb_clk.common, + + &bus_mixer0_clk.common, + &bus_mixer1_clk.common, + &bus_wb_clk.common, + + &mixer0_div_clk.common, + &mixer1_div_clk.common, + &wb_div_clk.common, + + &bus_rot_clk.common, + &rot_clk.common, + &rot_div_clk.common, +}; +static struct clk_hw_onecell_data sun8i_a83t_de2_hw_clks = { .hws = { [CLK_MIXER0 ] = &mixer0_clk.common.hw,
@@ -156,6 +174,26 @@ static struct clk_hw_onecell_data sun8i_v3s_de2_hw_clks = { .num = CLK_NUMBER_WITHOUT_ROT, }; +static struct clk_hw_onecell_data sun50i_a64_de2_hw_clks = { + .hws = { + [CLK_MIXER0 ] = &mixer0_clk.common.hw, + [CLK_MIXER1 ] = &mixer1_clk.common.hw, + [CLK_WB ] = &wb_clk.common.hw, + [CLK_ROT ] = &rot_clk.common.hw, + + [CLK_BUS_MIXER0 ] = &bus_mixer0_clk.common.hw, + [CLK_BUS_MIXER1 ] = &bus_mixer1_clk.common.hw, + [CLK_BUS_WB ] = &bus_wb_clk.common.hw, + [CLK_BUS_ROT ] = &bus_rot_clk.common.hw, + + [CLK_MIXER0_DIV ] = &mixer0_div_clk.common.hw, + [CLK_MIXER1_DIV ] = &mixer1_div_clk.common.hw, + [CLK_WB_DIV ] = &wb_div_clk.common.hw, + [CLK_ROT_DIV ] = &rot_div_clk.common.hw, + }, + .num =CLK_NUMBER_WITH_ROT , +}; +static struct clk_hw_onecell_data sun50i_h6_de3_hw_clks = { .hws = { [CLK_MIXER0 ] = &mixer0_clk.common.hw,
@@ -190,6 +228,7 @@ static struct ccu_reset_map sun50i_a64_de2_resets[] = { [RST_MIXER0] = { 0x08, BIT(0) }, [RST_MIXER1] = { 0x08, BIT(1) }, [RST_WB] = { 0x08, BIT(2) }, + [RST_ROT] = { 0x08, BIT(3) }, };static struct ccu_reset_map sun50i_h5_de2_resets[] = {
@@ -226,10 +265,10 @@ static const struct sunxi_ccu_desc sun8i_h3_de2_clk_desc = { };static const struct sunxi_ccu_desc sun50i_a64_de2_clk_desc = { - .ccu_clks = sun8i_h3_de2_clks, - .num_ccu_clks =ARRAY_SIZE (sun8i_h3_de2_clks), + .ccu_clks = sun50i_a64_de2_clks, + .num_ccu_clks =ARRAY_SIZE (sun50i_a64_de2_clks), - .hw_clks = &sun8i_h3_de2_hw_clks, + .hw_clks = &sun50i_a64_de2_hw_clks, .resets = sun50i_a64_de2_resets, .num_resets =ARRAY_SIZE (sun50i_a64_de2_resets),
Signature · 1 line
2.25.0
PATCH v2 3/7 clk: sunxi-ng: sun8i-de2: H6 doesn't have rotate core
In reply to Jernej SkrabecDE3 documentation regarding presence of rotate core in H6 is a bit confusing. Register descriptions mention bits for enabling rotate core clocks and reset, but general overview doesn't list it as feature of H6 display engine, BSP kernel doesn't support it and there is no interrupt listed for it. Manual poking registers also didn't reveal presence of rotate core.
Let's assume there isn't any rotate core on H6 present and remove related clocks. With that done, structures are same as those for H5, so just reuse H5 structure.
--- drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 57 +--------------------------- 1 file changed, 1 insertion(+), 56 deletions(-)
drivers/clk/sunxi-ng/ccu-sun8i-de2.c +1 -56
@@ -51,24 +51,6 @@ static SUNXI_CCU_M(mixer1_div_a83_clk, "mixer1-div", "pll-de", 0x0c, 4, 4, static SUNXI_CCU_M(wb_div_a83_clk, "wb-div", "pll-de", 0x0c, 8, 4, CLK_SET_RATE_PARENT); -static struct ccu_common *sun50i_h6_de3_clks[] = { - &mixer0_clk.common, - &mixer1_clk.common, - &wb_clk.common, - - &bus_mixer0_clk.common, - &bus_mixer1_clk.common, - &bus_wb_clk.common, - - &mixer0_div_clk.common, - &mixer1_div_clk.common, - &wb_div_clk.common, - - &bus_rot_clk.common, - &rot_clk.common, - &rot_div_clk.common, -}; -static struct ccu_common *sun8i_a83t_de2_clks[] = { &mixer0_clk.common, &mixer1_clk.common,
@@ -194,26 +176,6 @@ static struct clk_hw_onecell_data sun50i_a64_de2_hw_clks = { .num = CLK_NUMBER_WITH_ROT, }; -static struct clk_hw_onecell_data sun50i_h6_de3_hw_clks = { - .hws = { - [CLK_MIXER0 ] = &mixer0_clk.common.hw, - [CLK_MIXER1 ] = &mixer1_clk.common.hw, - [CLK_WB ] = &wb_clk.common.hw, - [CLK_ROT ] = &rot_clk.common.hw, - - [CLK_BUS_MIXER0 ] = &bus_mixer0_clk.common.hw, - [CLK_BUS_MIXER1 ] = &bus_mixer1_clk.common.hw, - [CLK_BUS_WB ] = &bus_wb_clk.common.hw, - [CLK_BUS_ROT ] = &bus_rot_clk.common.hw, - - [CLK_MIXER0_DIV ] = &mixer0_div_clk.common.hw, - [CLK_MIXER1_DIV ] = &mixer1_div_clk.common.hw, - [CLK_WB_DIV ] = &wb_div_clk.common.hw, - [CLK_ROT_DIV ] = &rot_div_clk.common.hw, - }, - .num =CLK_NUMBER_WITH_ROT , -}; -static struct ccu_reset_map sun8i_a83t_de2_resets[] = { [RST_MIXER0 ] = {0x08 ,BIT (0 ) },/*
@@ -237,13 +199,6 @@ static struct ccu_reset_map sun50i_h5_de2_resets[] = { [RST_WB] = { 0x08, BIT(2) }, }; -static struct ccu_reset_map sun50i_h6_de3_resets[] = { - [RST_MIXER0 ] = {0x08 ,BIT (0 ) }, - [RST_MIXER1 ] = {0x08 ,BIT (1 ) }, - [RST_WB ] = {0x08 ,BIT (2 ) }, - [RST_ROT ] = {0x08 ,BIT (3 ) }, -}; -static const struct sunxi_ccu_desc sun8i_a83t_de2_clk_desc = { .ccu_clks = sun8i_a83t_de2_clks, .num_ccu_clks =ARRAY_SIZE (sun8i_a83t_de2_clks),
@@ -284,16 +239,6 @@ static const struct sunxi_ccu_desc sun50i_h5_de2_clk_desc = { .num_resets = ARRAY_SIZE(sun50i_h5_de2_resets), }; -static const struct sunxi_ccu_desc sun50i_h6_de3_clk_desc = { - .ccu_clks = sun50i_h6_de3_clks, - .num_ccu_clks =ARRAY_SIZE (sun50i_h6_de3_clks), - - .hw_clks = &sun50i_h6_de3_hw_clks, - - .resets = sun50i_h6_de3_resets, - .num_resets =ARRAY_SIZE (sun50i_h6_de3_resets), -}; -static const struct sunxi_ccu_desc sun8i_v3s_de2_clk_desc = { .ccu_clks = sun8i_v3s_de2_clks, .num_ccu_clks =ARRAY_SIZE (sun8i_v3s_de2_clks),
@@ -406,7 +351,7 @@ static const struct of_device_id sunxi_de2_clk_ids[] = { }, { .compatible = "allwinner,sun50i-h6-de3-clk", - .data = &sun50i_h6_de3_clk_desc, + .data = &sun50i_h5_de2_clk_desc, }, { } };
Signature · 1 line
2.25.0
PATCH v2 4/7 clk: sunxi-ng: sun8i-de2: Don't reuse A83T resets
In reply to Jernej SkrabecCurrently, V3s and H3 reuse A83T reset structure. However, A83T contains additional core for rotation, which is not present in V3s and H3.
Make new reset structure for H3 and let V3s reuse it. A83T reset structure will be amended in subsequent commit.
--- drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/clk/sunxi-ng/ccu-sun8i-de2.c +16 -7
@@ -179,9 +179,18 @@ static struct clk_hw_onecell_data sun50i_a64_de2_hw_clks = {static struct ccu_reset_map sun8i_a83t_de2_resets[] = { [RST_MIXER0 ] = {0x08 ,BIT (0 ) },/* -* For A83T, H3 and R40, mixer1 reset line is shared with wb, so -* only RST_WB is exported here. -* For V3s there's just no mixer1, so it also shares this struct. +* Mixer1 reset line is shared with wb, so only RST_WB is +* exported here. +*/ + [RST_WB ] = {0x08 ,BIT (2 ) }, +}; + +static struct ccu_reset_map sun8i_h3_de2_resets[] = { + [RST_MIXER0 ] = {0x08 ,BIT (0 ) }, +/* +* Mixer1 reset line is shared with wb, so only RST_WB is +* exported here. +* V3s doesn't have mixer1, so it also shares this struct. */ [RST_WB ] = {0x08 ,BIT (2 ) }, };
@@ -215,8 +224,8 @@ static const struct sunxi_ccu_desc sun8i_h3_de2_clk_desc = { .hw_clks = &sun8i_h3_de2_hw_clks, - .resets = sun8i_a83t_de2_resets, - .num_resets = ARRAY_SIZE(sun8i_a83t_de2_resets), + .resets = sun8i_h3_de2_resets, + .num_resets = ARRAY_SIZE(sun8i_h3_de2_resets), };static const struct sunxi_ccu_desc sun50i_a64_de2_clk_desc = {
@@ -245,8 +254,8 @@ static const struct sunxi_ccu_desc sun8i_v3s_de2_clk_desc = { .hw_clks = &sun8i_v3s_de2_hw_clks, - .resets = sun8i_a83t_de2_resets, - .num_resets = ARRAY_SIZE(sun8i_a83t_de2_resets), + .resets = sun8i_h3_de2_resets, + .num_resets = ARRAY_SIZE(sun8i_h3_de2_resets), };static int sunxi_de2_clk_probe (struct platform_device *pdev)
Signature · 1 line
2.25.0
PATCH v2 5/7 clk: sunxi-ng: sun8i-de2: Add rotation core clocks and reset for A83T
In reply to Jernej SkrabecA83T structures don't have clocks and reset for rotation core. Add them.
--- drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/clk/sunxi-ng/ccu-sun8i-de2.c +11 -1
@@ -50,6 +50,8 @@ static SUNXI_CCU_M(mixer1_div_a83_clk, "mixer1-div", "pll-de", 0x0c, 4, 4, CLK_SET_RATE_PARENT); static SUNXI_CCU_M(wb_div_a83_clk, "wb-div", "pll-de", 0x0c, 8, 4, CLK_SET_RATE_PARENT); +static SUNXI_CCU_M(rot_div_a83_clk, "rot-div", "pll-de", 0x0c, 0x0c, 4, + CLK_SET_RATE_PARENT);static struct ccu_common *sun8i_a83t_de2_clks[] = { &mixer0_clk.common,
@@ -63,6 +65,10 @@ static struct ccu_common *sun8i_a83t_de2_clks[] = { &mixer0_div_a83_clk.common, &mixer1_div_a83_clk.common, &wb_div_a83_clk.common, + + &bus_rot_clk.common, + &rot_clk.common, + &rot_div_a83_clk.common, }; static struct ccu_common *sun8i_h3_de2_clks[] = {
@@ -113,16 +119,19 @@ static struct clk_hw_onecell_data sun8i_a83t_de2_hw_clks = { [CLK_MIXER0] = &mixer0_clk.common.hw, [CLK_MIXER1] = &mixer1_clk.common.hw, [CLK_WB] = &wb_clk.common.hw, + [CLK_ROT] = &rot_clk.common.hw, [CLK_BUS_MIXER0] = &bus_mixer0_clk.common.hw, [CLK_BUS_MIXER1] = &bus_mixer1_clk.common.hw, [CLK_BUS_WB] = &bus_wb_clk.common.hw, + [CLK_BUS_ROT] = &bus_rot_clk.common.hw, [CLK_MIXER0_DIV] = &mixer0_div_a83_clk.common.hw, [CLK_MIXER1_DIV] = &mixer1_div_a83_clk.common.hw, [CLK_WB_DIV] = &wb_div_a83_clk.common.hw, + [CLK_ROT_DIV] = &rot_div_a83_clk.common.hw, }, - .num = CLK_NUMBER_WITHOUT_ROT, + .num = CLK_NUMBER_WITH_ROT, };static struct clk_hw_onecell_data sun8i_h3_de2_hw_clks = {
@@ -183,6 +192,7 @@ static struct ccu_reset_map sun8i_a83t_de2_resets[] = {* exported here. */ [RST_WB] = { 0x08, BIT(2) }, + [RST_ROT] = { 0x08, BIT(3) }, };static struct ccu_reset_map sun8i_h3_de2_resets[] = {
Signature · 1 line
2.25.0
PATCH v2 6/7 clk: sunxi-ng: sun8i-de2: Add R40 specific quirks
In reply to Jernej SkrabecR40 is actually very similar to A64, but it doesn't have mixer1 reset. This means it's clocks and resets combination is unique and R40 specific quirks are needed.
--- drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/clk/sunxi-ng/ccu-sun8i-de2.c +14 -0
@@ -238,6 +238,16 @@ static const struct sunxi_ccu_desc sun8i_h3_de2_clk_desc = { .num_resets = ARRAY_SIZE(sun8i_h3_de2_resets), }; +static const struct sunxi_ccu_desc sun8i_r40_de2_clk_desc = { + .ccu_clks = sun50i_a64_de2_clks, + .num_ccu_clks =ARRAY_SIZE (sun50i_a64_de2_clks), + + .hw_clks = &sun50i_a64_de2_hw_clks, + + .resets = sun8i_a83t_de2_resets, + .num_resets =ARRAY_SIZE (sun8i_a83t_de2_resets), +}; +static const struct sunxi_ccu_desc sun50i_a64_de2_clk_desc = { .ccu_clks = sun50i_a64_de2_clks, .num_ccu_clks =ARRAY_SIZE (sun50i_a64_de2_clks),
@@ -356,6 +366,10 @@ static const struct of_device_id sunxi_de2_clk_ids[] = { .compatible = "allwinner,sun8i-h3-de2-clk", .data = &sun8i_h3_de2_clk_desc, }, + { + .compatible = "allwinner,sun8i-r40-de2-clk", + .data = &sun8i_r40_de2_clk_desc, + }, { .compatible = "allwinner,sun8i-v3s-de2-clk", .data = &sun8i_v3s_de2_clk_desc,
Signature · 1 line
2.25.0
PATCH v2 7/7 clk: sunxi-ng: sun8i-de2: Sort structures
In reply to Jernej SkrabecV3s quirks are not in right place. Move it.
--- drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/clk/sunxi-ng/ccu-sun8i-de2.c +10 -10
@@ -248,6 +248,16 @@ static const struct sunxi_ccu_desc sun8i_r40_de2_clk_desc = { .num_resets = ARRAY_SIZE(sun8i_a83t_de2_resets), }; +static const struct sunxi_ccu_desc sun8i_v3s_de2_clk_desc = { + .ccu_clks = sun8i_v3s_de2_clks, + .num_ccu_clks =ARRAY_SIZE (sun8i_v3s_de2_clks), + + .hw_clks = &sun8i_v3s_de2_hw_clks, + + .resets = sun8i_a83t_de2_resets, + .num_resets =ARRAY_SIZE (sun8i_a83t_de2_resets), +}; +static const struct sunxi_ccu_desc sun50i_a64_de2_clk_desc = { .ccu_clks = sun50i_a64_de2_clks, .num_ccu_clks =ARRAY_SIZE (sun50i_a64_de2_clks),
@@ -268,16 +278,6 @@ static const struct sunxi_ccu_desc sun50i_h5_de2_clk_desc = { .num_resets = ARRAY_SIZE(sun50i_h5_de2_resets), }; -static const struct sunxi_ccu_desc sun8i_v3s_de2_clk_desc = { - .ccu_clks = sun8i_v3s_de2_clks, - .num_ccu_clks =ARRAY_SIZE (sun8i_v3s_de2_clks), - - .hw_clks = &sun8i_v3s_de2_hw_clks, - - .resets = sun8i_h3_de2_resets, - .num_resets =ARRAY_SIZE (sun8i_h3_de2_resets), -}; -static int sunxi_de2_clk_probe (struct platform_device *pdev) {struct resource *res;
Signature · 1 line
2.25.0
Maxime Ripard
AppliedQuoted 6 lines · Jernej Skrabec
In current sun8i-de2 clock driver, rotation core related clocks and reset weren't considered properly. All SoC which have that core don't have those definitions. Even worse, the only SoC which have rotation core related definitions doesn't have that core at all.
This series fixes this mess.
Applied all of them, thanks!
Maxime