Alternative clk gate ctrl for Kirkwood variants
Subsystems (5)
RFC PATCH 1/1 Alternative clk gate ctrl for Kirkwood variants
This series introduces a clk gate ctrl for the kirkwood variants embedded in the Prestera SoCs.
This would allow to get rid of the workaround for the km_kirkwood board support file that was added previously because of the lack of DT clk gate support.
Valentin Longchamp (3):
clk: mvebu: add gate ctrl for Prestera kirkwood variants
ARM: kirkwood: look for alternative gate ctrl of node
ARM: kirkwood: remove clock gating disabling for km_kirkwood
.../devicetree/bindings/clock/mvebu-gated-clock.txt | 17 +++++++++++++++++ arch/arm/boot/dts/kirkwood-98dx4122.dtsi | 7 +++++++ arch/arm/mach-kirkwood/board-dt.c | 4 ++++ arch/arm/mach-kirkwood/board-km_kirkwood.c | 15 --------------- drivers/clk/mvebu/clk-gating-ctrl.c | 19 +++++++++++++++++++ 5 files changed, 47 insertions(+), 15 deletions(-)
Signature · 1 line
1.8.0.1
PATCH 1/3 clk: mvebu: add gate ctrl for Prestera kirkwood variants
The kirkwood device found in the Prestera SoCs does not have all the peripherals of its the usual kirkwood SoCs. There are hence missing clocks in the SoCs.
This patch registers another gate controller for the kirkwood that registers only the available clocks of this kirkwood variant.
--- .../devicetree/bindings/clock/mvebu-gated-clock.txt | 17 +++++++++++++++++ drivers/clk/mvebu/clk-gating-ctrl.c | 19 +++++++++++++++++++ 2 files changed, 36 insertions(+)
Documentation/devicetree/bindings/clock/mvebu-gated-clock.txt +17 -0
@@ -92,10 +92,27 @@ ID Clock Peripheral 19 ge1 Gigabit Ethernet 1 20 tdm Time Division Mplx +The following is a list of provided IDs for Kirkwood Prestera variant: +ID Clock Peripheral +----------------------------------- +0 ge0 Gigabit Ethernet 0 +2 pex0 PCIe Cntrl 0 +3 usb0 USB Host 0 +4 sdio SDIO Cntrl +5 tsu Transp. Stream Unit +6 dunit SDRAM Cntrl +7 runit Runit +8 xor0 XOR DMA 0 +16 xor1 XOR DMA 1 +17 crypto CESA engine +19 ge1 Gigabit Ethernet 1 + + Required properties: - compatible : shall be one of the following: "marvell,dove-gating-clock" - for Dove SoC clock gating "marvell,kirkwood-gating-clock" - for Kirkwood SoC clock gating + "marvell,prestera-kw-gating-clock" - for Preseta SoC clock gating - reg : shall be the register address of the Clock Gating Control register - #clock-cells : from common clock binding; shall be set to 1
drivers/clk/mvebu/clk-gating-ctrl.c +19 -0
@@ -203,6 +203,21 @@ static const struct mvebu_soc_descr __initconst kirkwood_gating_descr[] = { { "tdm", NULL, 20 }, { } }; + +static const struct mvebu_soc_descr __initconst prestera_kw_gating_descr[] = { + { "ge0", NULL, 0 }, + { "pex0", NULL, 2 }, + { "usb0", NULL, 3 }, + { "sdio", NULL, 4 }, + { "tsu", NULL, 5 }, + { "runit", NULL, 7 }, + { "xor0", NULL, 8 }, + { "powersave", "cpuclk", 11 }, + { "xor1", NULL, 16 }, + { "crypto", NULL, 17 }, + { "ge1", NULL, 19 }, + { } +}; #endif static const __initdata struct of_device_id clk_gating_match[] = {
@@ -232,6 +247,10 @@ static const __initdata struct of_device_id clk_gating_match[] = { .compatible = "marvell,kirkwood-gating-clock", .data = kirkwood_gating_descr, }, + { + .compatible = "marvell,prestera-kw-gating-clock", + .data = prestera_kw_gating_descr, + },#endif { }
Signature · 1 line
1.8.0.1
PATCH 1/3 clk: mvebu: add gate ctrl for Prestera kirkwood variants
Quoted 6 lines · Valentin Longchamp
The kirkwood device found in the Prestera SoCs does not have all the peripherals of its the usual kirkwood SoCs. There are hence missing clocks in the SoCs.
This patch registers another gate controller for the kirkwood that registers only the available clocks of this kirkwood variant.
Hi Valentin,
Overall the patch set looks OK, however I don't understand why you need to declare a new gate controller. The list you delcared seemed to be just a subset of the Kirkwood one, why can't you use this one?
Note that I am not an expert for the kirkwood hardware, so maybe I missed something.
Regards,
Quoted 77 lines
Signed-off-by Valentin Longchamp <[email protected]>--- .../devicetree/bindings/clock/mvebu-gated-clock.txt | 17 +++++++++++++++++ drivers/clk/mvebu/clk-gating-ctrl.c | 19 +++++++++++++++++++ 2 files changed, 36 insertions(+)Documentation/devicetree/bindings/clock/mvebu-gated-clock.txt +17
-0@@ -92,10 +92,27 @@ ID Clock Peripheral 19 ge1 Gigabit Ethernet 1 20 tdm Time Division Mplx +The following is a list of provided IDs for Kirkwood Prestera variant: +ID Clock Peripheral +----------------------------------- +0 ge0 Gigabit Ethernet 0 +2 pex0 PCIe Cntrl 0 +3 usb0 USB Host 0 +4 sdio SDIO Cntrl +5 tsu Transp. Stream Unit +6 dunit SDRAM Cntrl +7 runit Runit +8 xor0 XOR DMA 0 +16 xor1 XOR DMA 1 +17 crypto CESA engine +19 ge1 Gigabit Ethernet 1 + + Required properties: - compatible : shall be one of the following: "marvell,dove-gating-clock" - for Dove SoC clock gating "marvell,kirkwood-gating-clock" - for Kirkwood SoC clock gating + "marvell,prestera-kw-gating-clock" - for Preseta SoC clock gating - reg : shall be the register address of the Clock Gating Control register - #clock-cells : from common clock binding; shall be set to 1drivers/clk/mvebu/clk-gating-ctrl.c +19
-0@@ -203,6 +203,21 @@ static const struct mvebu_soc_descr __initconst kirkwood_gating_descr[] = { { "tdm", NULL, 20 }, { } }; + +static const struct mvebu_soc_descr __initconst prestera_kw_gating_descr[] = { + { "ge0", NULL, 0 }, + { "pex0", NULL, 2 }, + { "usb0", NULL, 3 }, + { "sdio", NULL, 4 }, + { "tsu", NULL, 5 }, + { "runit", NULL, 7 }, + { "xor0", NULL, 8 }, + { "powersave", "cpuclk", 11 }, + { "xor1", NULL, 16 }, + { "crypto", NULL, 17 }, + { "ge1", NULL, 19 }, + { } +}; #endif static const __initdata struct of_device_id clk_gating_match[] = {@@ -232,6 +247,10 @@ static const __initdata struct of_device_id clk_gating_match[] = { .compatible = "marvell,kirkwood-gating-clock", .data = kirkwood_gating_descr, }, + { + .compatible = "marvell,prestera-kw-gating-clock", + .data = prestera_kw_gating_descr, + },#endif { }
Signature · 4 lines
Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Andrew Lunn
maintainerPATCH 1/3 clk: mvebu: add gate ctrl for Prestera kirkwood variants
Quoted 5 lines · Gregory CLEMENT
Quoted 4 lines · Valentin Longchamp
The kirkwood device found in the Prestera SoCs does not have all the peripherals of its the usual kirkwood SoCs. There are hence missing clocks in the SoCs.
Quoted 8 lines
Quoted 2 lines
This patch registers another gate controller for the kirkwood that registers only the available clocks of this kirkwood variant.
Hi Valentin,
Overall the patch set looks OK, however I don't understand why you need to declare a new gate controller. The list you delcared seemed to be just a subset of the Kirkwood one, why can't you use this one?
Hi Gregory
Take a look at the code which gets deleted in patch 3/3.
/*
* Our variant of kirkwood (integrated in the Bobcat) hangs on accessing
* SATA bits (14-15) of the Clock Gating Control Register. Since these
* devices are also not present in this variant, their clocks get
* disabled because unused when clk_disable_unused() gets called.
* That's why we change the flags to these clocks to CLK_IGNORE_UNUSED */
By not defining these clocks in the first place, they never get turned off...
Andrew
Sebastian Hesselbarth
maintainerPATCH 1/3 clk: mvebu: add gate ctrl for Prestera kirkwood variants
In reply to Gregory CLEMENTQuoted 8 lines · Gregory CLEMENT
Quoted 6 lines · Valentin Longchamp
The kirkwood device found in the Prestera SoCs does not have all the peripherals of its the usual kirkwood SoCs. There are hence missing clocks in the SoCs.
This patch registers another gate controller for the kirkwood that registers only the available clocks of this kirkwood variant.
Quoted 8 lines
Hi Valentin,
Overall the patch set looks OK, however I don't understand why you need to declare a new gate controller. The list you delcared seemed to be just a subset of the Kirkwood one, why can't you use this one?
Note that I am not an expert for the kirkwood hardware, so maybe I missed something.
I just checked my mails from late 2012 and there Valentin and I agreed, that not the missing bits in clock gating control registers was the root cause of km_kirkwood to hang. It was rather the phy gates (that do not/ not yet exist on DT) that caused it to hang, i.e. when accessing SATA PHY registers.
Valentin, I am not against an extra clock-gating-ctrl for Prestera but maybe having an kirkwood.dtsi fork without SATA and other peripherals will also help?
And: Does DT-enabled km_kirkwood ever hang without the hack in it's board setup? There should be no PHY gates on DT boards..
Sebastian
PATCH 1/3 clk: mvebu: add gate ctrl for Prestera kirkwood variants
Quoted 15 lines · Sebastian Hesselbarth
Quoted 14 lines · Gregory CLEMENT
Quoted 6 lines · Valentin Longchamp
The kirkwood device found in the Prestera SoCs does not have all the peripherals of its the usual kirkwood SoCs. There are hence missing clocks in the SoCs.
This patch registers another gate controller for the kirkwood that registers only the available clocks of this kirkwood variant.
Hi Valentin,
Overall the patch set looks OK, however I don't understand why you need to declare a new gate controller. The list you delcared seemed to be just a subset of the Kirkwood one, why can't you use this one?
Quoted 8 lines
Quoted 2 lines
Note that I am not an expert for the kirkwood hardware, so maybe I missed something.
I just checked my mails from late 2012 and there Valentin and I agreed, that not the missing bits in clock gating control registers was the root cause of
km_kirkwoodto hang. It was rather the phy gates (that do not/ not yet exist on DT) that caused it to hang, i.e. when accessing SATA PHY registers.
Yeah you are right, I had forgotten about this test. I just had a look at the board-km_kirkwood.c and I tried to figure out a way to make sure the clock gates bits never get read/written, so never get initialized. But as you say, that's not the real cause of the hang but
Quoted 4 lines
Valentin, I am not against an extra clock-gating-ctrl for Prestera but maybe having an
kirkwood.dtsifork without SATA and other peripherals will also help?
Since it's not the real problem having the extra clock-gating-ctrl would me more consistent with the real Prestera HW, but maybe it's better to keep only one that works for both as it's already the case, it's less code to maintain.
A better approach would be to work on the kirkwood.dtsi as you mention it. The SATA node in kirkwood.dtsi is by default disabled, is this enough or should it be moved to kirkwood-6281.dtsi for instance ?
Quoted 4 lines
And: Does DT-enabled
km_kirkwoodever hang without the hack in it's board setup? There should be no PHY gates on DT boards..
I have just tested it and it does not hang, so I will submit and patch that simply removes this workaround since the PHY gates are not accessed anymore (thanks to DT clock gates and that km_kirkwood does not enable the sata of node).
Valentin
Sebastian Hesselbarth
maintainerPATCH 1/3 clk: mvebu: add gate ctrl for Prestera kirkwood variants
Quoted 16 lines · Valentin Longchamp
Quoted 5 lines · Sebastian Hesselbarth
I just checked my mails from late 2012 and there Valentin and I agreed, that not the missing bits in clock gating control registers was the root cause of
km_kirkwoodto hang. It was rather the phy gates (that do not/ not yet exist on DT) that caused it to hang, i.e. when accessing SATA PHY registers.Yeah you are right, I had forgotten about this test. I just had a look at the
board-km_kirkwood.cand I tried to figure out a way to make sure the clock gates bits never get read/written, so never get initialized. But as you say, that's not the real cause of the hang butQuoted 3 lines
Valentin, I am not against an extra clock-gating-ctrl for Prestera but maybe having an
kirkwood.dtsifork without SATA and other peripherals will also help?
Quoted 7 lines
Since it's not the real problem having the extra clock-gating-ctrl would me more consistent with the real Prestera HW, but maybe it's better to keep only one that works for both as it's already the case, it's less code to maintain.
A better approach would be to work on the
kirkwood.dtsias you mention it. The SATA node inkirkwood.dtsiis by default disabled, is this enough or should it be moved tokirkwood-6281.dtsifor instance ?
Valentin,
I guess for the long run, we will re-introduce phy gates either by abusing clk gates or some other way. But they will depend on existing OF nodes.
Considering this, it would be best to fork kirkwood.dtsi for Prestera and leave out all OF nodes that are not implemented there. We could have
kirkwood.dtsi -+-> kirkwood-kirkwood.dtsi -+-> kirkwood-6281.dtsi
+-> kirkwood-prestera.dtsi +-> kirkwood-6282.dtsi
or any other naming scheme. Maybe Andrew or Jason can comment on this.
Quoted 6 lines
Quoted 2 lines
And: Does DT-enabled
km_kirkwoodever hang without the hack in it's board setup? There should be no PHY gates on DT boards..I have just tested it and it does not hang, so I will submit and patch that simply removes this workaround since the PHY gates are not accessed anymore (thanks to DT clock gates and that
km_kirkwooddoes not enable the sata of node).
Great! I suggest to also submit the dtsi changes above within the same patch set.
Sebastian
PATCH 1/3 clk: mvebu: add gate ctrl for Prestera kirkwood variants
Quoted 31 lines · Sebastian Hesselbarth
Quoted 16 lines · Valentin Longchamp
Quoted 5 lines · Sebastian Hesselbarth
I just checked my mails from late 2012 and there Valentin and I agreed, that not the missing bits in clock gating control registers was the root cause of
km_kirkwoodto hang. It was rather the phy gates (that do not/ not yet exist on DT) that caused it to hang, i.e. when accessing SATA PHY registers.Yeah you are right, I had forgotten about this test. I just had a look at the
board-km_kirkwood.cand I tried to figure out a way to make sure the clock gates bits never get read/written, so never get initialized. But as you say, that's not the real cause of the hang butQuoted 3 lines
Valentin, I am not against an extra clock-gating-ctrl for Prestera but maybe having an
kirkwood.dtsifork without SATA and other peripherals will also help?Quoted 7 lines
Since it's not the real problem having the extra clock-gating-ctrl would me more consistent with the real Prestera HW, but maybe it's better to keep only one that works for both as it's already the case, it's less code to maintain.
A better approach would be to work on the
kirkwood.dtsias you mention it. The SATA node inkirkwood.dtsiis by default disabled, is this enough or should it be moved tokirkwood-6281.dtsifor instance ?Valentin,
I guess for the long run, we will re-introduce phy gates either by abusing clk gates or some other way. But they will depend on existing OF nodes.
Quoted 6 lines
Considering this, it would be best to fork
kirkwood.dtsifor Prestera and leave out all OF nodes that are not implemented there. We could have
kirkwood.dtsi-+->kirkwood-kirkwood.dtsi-+->kirkwood-6281.dtsi+-> kirkwood-prestera.dtsi +-> kirkwood-6282.dtsi
or,
kirkwood.dtsiprestera.dtsi
-pinctrl-kirkwood-98dx4122.dtsi (should rename to prestera-, but seems churn-ish) kirkwood-6281.dtsikirkwood-6282.dtsi
-dts-kirkwood-km_kirkwood.dts (rename/churn prestera-?)
|-prestera.dtsi
\-kirkwood-98dx4122.dtsi
or, honestly, how many boards are going to be based on prestera? If it's just the one, why not combine all the nodes into kirkwood-km_kirkwood.dts?
thx,
Jason.
PATCH 2/3 ARM: kirkwood: look for alternative gate ctrl of node
In reply to Valentin LongchampThe search for the gate ctrl of node must now also look for the introduced compatible node.
--- arch/arm/mach-kirkwood/board-dt.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/mach-kirkwood/board-dt.c +4 -0
@@ -44,6 +44,10 @@ static void __init kirkwood_legacy_clk_init(void)struct of_phandle_args clkspec;struct clk *clk; +if (np ==NULL ) + np =of_find_compatible_node (NULL ,NULL , +"marvell,prestera-kw-gating-clock" ); + clkspec.np = np; clkspec.args_count =1 ;
Signature · 1 line
1.8.0.1
PATCH 3/3 ARM: kirkwood: remove clock gating disabling for km_kirkwood
In reply to Valentin LongchampA new clock gating controller is available for the prestera-kw kirkwood variant. This controller does not enable the unavailable clk gates.
This patch removes the fixes from the board-km_kirkwood file and enables the correct clk gating controller for kirkwood-98dx4122.dtsi.
--- arch/arm/boot/dts/kirkwood-98dx4122.dtsi | 7 +++++++ arch/arm/mach-kirkwood/board-km_kirkwood.c | 15 --------------- 2 files changed, 7 insertions(+), 15 deletions(-)
arch/arm/boot/dts/kirkwood-98dx4122.dtsi +7 -0
@@ -27,5 +27,12 @@ marvell,function = "uart1"; }; }; + + gate_clk: clock-gating-control at 2011c { + compatible = "marvell,prestera-kw-gating-clock"; + reg = <0x2011c 0x4>; + clocks = <&core_clk 0>; + #clock-cells = <1>; + }; }; };
arch/arm/mach-kirkwood/board-km_kirkwood.c +0 -15
@@ -25,20 +25,5 @@ static struct mv643xx_eth_platform_data km_kirkwood_ge00_data = {void __init km_kirkwood_init (void ) { -struct clk *sata_clk; -/* -* Our variant of kirkwood (integrated in the Bobcat) hangs on accessing -* SATA bits (14-15) of the Clock Gating Control Register. Since these -* devices are also not present in this variant, their clocks get -* disabled because unused when clk_disable_unused() gets called. -* That's why we change the flags to these clocks to CLK_IGNORE_UNUSED -*/ - sata_clk =clk_get_sys ("sata_mv.0" ,"0" ); -if (!IS_ERR (sata_clk)) - sata_clk->flags |=CLK_IGNORE_UNUSED ; - sata_clk =clk_get_sys ("sata_mv.0" ,"1" ); -if (!IS_ERR (sata_clk)) - sata_clk->flags |=CLK_IGNORE_UNUSED ; -kirkwood_ge00_init (&km_kirkwood_ge00_data); }
Signature · 1 line
1.8.0.1
PATCH 3/3 ARM: kirkwood: remove clock gating disabling for km_kirkwood
Valentin,
Nice series! I thought once the mv643xx_eth DT bindings take hold that this was going to be one of the holdovers with a custom board init file. Looks like that won't be the case ;-)
Quoted 19 lines · Valentin Longchamp
A new clock gating controller is available for the prestera-kw kirkwood variant. This controller does not enable the unavailable clk gates.
This patch removes the fixes from the board-km_kirkwood file and enables the correct clk gating controller for
kirkwood-98dx4122.dtsi.Signed-off-by Valentin Longchamp <[email protected]>--- arch/arm/boot/dts/kirkwood-98dx4122.dtsi | 7 +++++++ arch/arm/mach-kirkwood/board-km_kirkwood.c | 15 --------------- 2 files changed, 7 insertions(+), 15 deletions(-)arch/arm/boot/dts/kirkwood-98dx4122.dtsi +0
-0@@ -27,5 +27,12 @@ marvell,function = "uart1"; };
arch/arm/boot/dts/kirkwood-98dx4122.dtsi line 38
Quoted 10 lines
arch/arm/boot/dts/kirkwood-98dx4122.dtsi +7
-0}; + + gate_clk: clock-gating-control at 2011c { + compatible = "marvell,prestera-kw-gating-clock"; + reg = <0x2011c 0x4>; + clocks = <&core_clk 0>; + #clock-cells = <1>; + }; }; };
--->8----
Please split this into two patches, one for the dtsi, and one for code removal. It'll prevent merge conflicts and branch dependencies for us.
thx,
Jason.
Quoted 28 lines
arch/arm/mach-kirkwood/board-km_kirkwood.c +0
-15@@ -25,20 +25,5 @@ static struct mv643xx_eth_platform_data km_kirkwood_ge00_data = {void __init km_kirkwood_init (void ) { -struct clk *sata_clk; -/* -* Our variant of kirkwood (integrated in the Bobcat) hangs on accessing -* SATA bits (14-15) of the Clock Gating Control Register. Since these -* devices are also not present in this variant, their clocks get -* disabled because unused when clk_disable_unused() gets called. -* That's why we change the flags to these clocks to CLK_IGNORE_UNUSED -*/ - sata_clk =clk_get_sys ("sata_mv.0" ,"0" ); -if (!IS_ERR (sata_clk)) - sata_clk->flags |=CLK_IGNORE_UNUSED ; - sata_clk =clk_get_sys ("sata_mv.0" ,"1" ); -if (!IS_ERR (sata_clk)) - sata_clk->flags |=CLK_IGNORE_UNUSED ; -kirkwood_ge00_init (&km_kirkwood_ge00_data); }Signature · 1 line
1.8.0.1