MIPS: BMIPS: add support for gated clock controller
Subsystems (4)
cover MIPS: BMIPS: add support for gated clock controller
This patchset adds support for the gated clock controller found on most MIPS based Broadcom BCM63XX SoCs.
The MIPS based BCM63XX SoCs have very little in common with the ARM based ones, so a separate driver is necessary.
It's a simple register based controller, with one bit per clock, active high.
Since BCM63XX/MIPS runs in big endian mode, the driver depends on the series "clk: make register endianness a run-time property", or more specifically on patch 3, "clk: gate: add explicit big endian support".
Based on the clk-next branch.
Jonas Gorski (3):
devicetree: document the BCM63XX gated clock bindings
clk: add BCM63XX gated clock controller driver
MIPS: BMIPS: add clock controller nodes
.../bindings/clock/brcm,bcm63xx-clocks.txt | 22 ++ arch/mips/boot/dts/brcm/bcm3368.dtsi | 12 +- arch/mips/boot/dts/brcm/bcm63268.dtsi | 12 +- arch/mips/boot/dts/brcm/bcm6328.dtsi | 6 + arch/mips/boot/dts/brcm/bcm6358.dtsi | 12 +- arch/mips/boot/dts/brcm/bcm6362.dtsi | 12 +- arch/mips/boot/dts/brcm/bcm6368.dtsi | 12 +- drivers/clk/bcm/Kconfig | 8 + drivers/clk/bcm/Makefile | 1 + drivers/clk/bcm/clk-bcm63xx-gate.c | 246 +++++++++++++++++++++ 10 files changed, 328 insertions(+), 15 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/brcm,bcm63xx-clocks.txt create mode 100644 drivers/clk/bcm/clk-bcm63xx-gate.c
Signature · 1 line
2.13.2
PATCH 1/3 devicetree: document the BCM63XX gated clock bindings
Add binding documentation for the gated clock controller found on MIPS based BCM63XX SoCs.
--- .../bindings/clock/brcm,bcm63xx-clocks.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/brcm,bcm63xx-clocks.txt
Documentation/devicetree/bindings/clock/brcm,bcm63xx-clocks.txt new file +22 -0
@@ -0,0 +1,22 @@ +Gated Clock Controller Bindings for MIPS based BCM63XX SoCs + +Required properties: +- compatible: must be one of: + "brcm,bcm3368-clocks" + "brcm,bcm6328-clocks" + "brcm,bcm6358-clocks" + "brcm,bcm6362-clocks" + "brcm,bcm6368-clocks" + "brcm,bcm63268-clocks" + +- reg: Address and length of the register set +- #clock-cells: must be <1> + + +Example: + +clkctl: clock-controller@10000004 { + compatible = "brcm,bcm6328-clocks"; + reg = <0x10000004 0x4>; + #clock-cells = <1>; +};
Signature · 1 line
2.13.2
Re: [PATCH 1/3] devicetree: document the BCM63XX gated clock bindings
Quoted 4 lines · Jonas Gorski
Add binding documentation for the gated clock controller found on MIPS based BCM63XX SoCs.
Signed-off-by Jonas Gorski <[email protected]>
Quoted 11 lines
--- .../bindings/clock/brcm,bcm63xx-clocks.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/brcm,bcm63xx-clocks.txtDocumentation/devicetree/bindings/clock/brcm,bcm63xx-clocks.txt new file +0
-0
Documentation/devicetree/bindings/clock/brcm,bcm63xx-clocks.txt line 10
Quoted 10 lines
Documentation/devicetree/bindings/clock/brcm,bcm63xx-clocks.txt new file +10
-0@@ -0,0 +1,22 @@ +Gated Clock Controller Bindings for MIPS based BCM63XX SoCs + +Required properties: +- compatible: must be one of: + "brcm,bcm3368-clocks" + "brcm,bcm6328-clocks" + "brcm,bcm6358-clocks" + "brcm,bcm6362-clocks" + "brcm,bcm6368-clocks" + "brcm,bcm63268-clocks"
We could always add 6348/6338 to that list later one.
Quoted 13 lines
Documentation/devicetree/bindings/clock/brcm,bcm63xx-clocks.txt new file +12
-0+ +- reg: Address and length of the register set +- #clock-cells: must be <1> + + +Example: + +clkctl: clock-controller@10000004 { + compatible = "brcm,bcm6328-clocks"; + reg = <0x10000004 0x4>; + #clock-cells = <1>; +};
Signature · 1 line
Florian
Re: [PATCH 1/3] devicetree: document the BCM63XX gated clock bindings
Quoted 10 lines · Florian Fainelli
Quoted 4 lines · Jonas Gorski
Add binding documentation for the gated clock controller found on MIPS based BCM63XX SoCs.
Signed-off-by Jonas Gorski <[email protected]>Reviewed-by Florian Fainelli <[email protected]>
Thanks!
Quoted 16 lines
Quoted 16 lines
--- .../bindings/clock/brcm,bcm63xx-clocks.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/brcm,bcm63xx-clocks.txtDocumentation/devicetree/bindings/clock/brcm,bcm63xx-clocks.txt new file +4
-0@@ -0,0 +1,22 @@ +Gated Clock Controller Bindings for MIPS based BCM63XX SoCs + +Required properties: +- compatible: must be one of:
Quoted 8 lines
Documentation/devicetree/bindings/clock/brcm,bcm63xx-clocks.txt line 10
Quoted 6 lines
Documentation/devicetree/bindings/clock/brcm,bcm63xx-clocks.txt new file +6
-0+ "brcm,bcm3368-clocks" + "brcm,bcm6328-clocks" + "brcm,bcm6358-clocks" + "brcm,bcm6362-clocks" + "brcm,bcm6368-clocks" + "brcm,bcm63268-clocks"We could always add 6348/6338 to that list later one.
That's the plan*. But currently neither one is supported by BMIPS_GENERIC, which was my starting point. And making BCM63XX use the driver is ... complicated, due to (important) consumers not being platform drivers (the MPI/PCIe controller codes). And they can't be just converted to platform drivers, as they should then be non-legacy PCI controller drivers, so a full rewrite is needed.
So let's stick with BMIPS_GENERIC first, else we never get anything done ;-). In the end BCM63XX should go away anyway, once BMIPS_GENERIC has reached feature parity.
Regards
Jonas
* if it even makes sense, as these are quite old, and systems will quite struggle running a modern kernel/OS.
Jonas
Re: [PATCH 1/3] devicetree: document the BCM63XX gated clock bindings
In reply to Jonas GorskiHi Jonas,
Quoted 2 lines · Jonas Gorski
Add binding documentation for the gated clock controller found on MIPS based BCM63XX SoCs.
I'd have ordered this patch after the #2 of this series, or eventually squashed both together. It is weird to document an unexistant feature then implement it, while the opposite looks more natural. (If you agree, maybe Paul can invert those when applying this series).
Anyway:
Quoted 36 lines
Signed-off-by Jonas Gorski <[email protected]>--- .../bindings/clock/brcm,bcm63xx-clocks.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/brcm,bcm63xx-clocks.txtDocumentation/devicetree/bindings/clock/brcm,bcm63xx-clocks.txt new file +22
-0@@ -0,0 +1,22 @@ +Gated Clock Controller Bindings for MIPS based BCM63XX SoCs + +Required properties: +- compatible: must be one of: + "brcm,bcm3368-clocks" + "brcm,bcm6328-clocks" + "brcm,bcm6358-clocks" + "brcm,bcm6362-clocks" + "brcm,bcm6368-clocks" + "brcm,bcm63268-clocks" + +- reg: Address and length of the register set +- #clock-cells: must be <1> + + +Example: + +clkctl: clock-controller@10000004 { + compatible = "brcm,bcm6328-clocks"; + reg = <0x10000004 0x4>; + #clock-cells = <1>; +};
Re: [PATCH 1/3] devicetree: document the BCM63XX gated clock bindings
Hi Philippe,
Quoted 7 lines · Philippe Mathieu-Daudé
Hi Jonas,
Quoted 2 lines · Jonas Gorski
Add binding documentation for the gated clock controller found on MIPS based BCM63XX SoCs.
Quoted 7 lines
I'd have ordered this patch after the #2 of this series, or eventually squashed both together. It is weird to document an unexistant feature then implement it, while the opposite looks more natural. (If you agree, maybe Paul can invert those when applying this series).
Anyway:
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
You are documenting hardware, not a driver/feature. :-)
The binding is supposed to be a separate patch [1]. The natural order is to first describe the hardware (with the binding documentation), then add the actual driver making use of the binding. Checkpatch.pl will also warn if you use a compatible that isn't documented, which happens (shortly) if you first add the driver.
Regards
Jonas
Re: [PATCH 1/3] devicetree: document the BCM63XX gated clock bindings
Quoted 18 lines · Jonas Gorski
Hi Philippe,
Quoted 7 lines · Philippe Mathieu-Daudé
Hi Jonas,
Quoted 2 lines · Jonas Gorski
Add binding documentation for the gated clock controller found on MIPS based BCM63XX SoCs.
Quoted 7 lines
I'd have ordered this patch after the #2 of this series, or eventually squashed both together. It is weird to document an unexistant feature then implement it, while the opposite looks more natural. (If you agree, maybe Paul can invert those when applying this series).
Anyway:
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Quoted 7 lines
You are documenting hardware, not a driver/feature. :-)
The binding is supposed to be a separate patch [1]. The natural order is to first describe the hardware (with the binding documentation), then add the actual driver making use of the binding. Checkpatch.pl will also warn if you use a compatible that isn't documented, which happens (shortly) if you first add the driver.
Oh, thanks for the pointer, this is my first DT review ;)
Quoted 5 lines
Regards
Jonas
Re: [PATCH 1/3] devicetree: document the BCM63XX gated clock bindings
In reply to Jonas GorskiQuoted 9 lines · Jonas Gorski
Add binding documentation for the gated clock controller found on MIPS based BCM63XX SoCs.
Signed-off-by Jonas Gorski <[email protected]>--- .../bindings/clock/brcm,bcm63xx-clocks.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/brcm,bcm63xx-clocks.txt
Re: [PATCH 1/3] devicetree: document the BCM63XX gated clock bindings
In reply to Jonas GorskiQuoting Jonas Gorski (2019-05-02 05:26:55)
Quoted 5 lines
Add binding documentation for the gated clock controller found on MIPS based BCM63XX SoCs.
Signed-off-by Jonas Gorski <[email protected]>---
Applied to clk-next
PATCH 2/3 clk: add BCM63XX gated clock controller driver
In reply to Jonas GorskiAdd a driver for the gated clock controller found on MIPS based BCM63XX SoCs.
--- drivers/clk/bcm/Kconfig | 8 ++ drivers/clk/bcm/Makefile | 1 + drivers/clk/bcm/clk-bcm63xx-gate.c | 246 +++++++++++++++++++++++++++++++++++++ 3 files changed, 255 insertions(+) create mode 100644 drivers/clk/bcm/clk-bcm63xx-gate.c
drivers/clk/bcm/Kconfig +8 -0
@@ -7,6 +7,14 @@ config CLK_BCM_63XX Enable common clock framework support for Broadcom BCM63xx DSL SoCs based on the ARM architecture +config CLK_BCM_63XX_GATE + bool "Broadcom BCM63xx gated clock support" + depends on BMIPS_GENERIC || COMPILE_TEST + default BMIPS_GENERIC + help + Enable common clock framework support for Broadcom BCM63xx DSL SoCs + based on the MIPS architecture + config CLK_BCM_KONA bool "Broadcom Kona CCU clock support" depends on ARCH_BCM_MOBILE || COMPILE_TEST
drivers/clk/bcm/Makefile +1 -0
@@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_CLK_BCM_63XX) += clk-bcm63xx.o +obj-$(CONFIG_CLK_BCM_63XX_GATE) += clk-bcm63xx-gate.o obj-$(CONFIG_CLK_BCM_KONA) += clk-kona.o obj-$(CONFIG_CLK_BCM_KONA) += clk-kona-setup.o obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o
drivers/clk/bcm/clk-bcm63xx-gate.c new file +246 -0
246 lines not on this page · raw message
Signature · 1 line
2.13.2
Re: [PATCH 2/3] clk: add BCM63XX gated clock controller driver
Quoted 4 lines · Jonas Gorski
Add a driver for the gated clock controller found on MIPS based BCM63XX SoCs.
Signed-off-by Jonas Gorski <[email protected]>
Signature · 1 line
Florian
Re: [PATCH 2/3] clk: add BCM63XX gated clock controller driver
In reply to Jonas GorskiQuoted 4 lines · Jonas Gorski
Add a driver for the gated clock controller found on MIPS based BCM63XX SoCs.
Signed-off-by Jonas Gorski <[email protected]>
Re: [PATCH 2/3] clk: add BCM63XX gated clock controller driver
In reply to Jonas GorskiQuoting Jonas Gorski (2019-05-02 05:26:56)
Quoted 5 lines
Add a driver for the gated clock controller found on MIPS based BCM63XX SoCs.
Signed-off-by Jonas Gorski <[email protected]>---
Applied to clk-next with some extra fixes
drivers/clk/bcm/clk-bcm63xx-gate.c +9 -17
@@ -1,8 +1,7 @@ -/* SPDX-License-Identifier: GPL-2.0 */ +// SPDX-License-Identifier: GPL-2.0 #include <linux/clk-provider.h> #include <linux/init.h> -#include <linux/module.h> #include <linux/of.h> #include <linux/of_device.h> #include <linux/platform_device.h>
@@ -20,7 +19,7 @@ struct clk_bcm63xx_hw {struct clk_hw_onecell_data data; }; -const struct clk_bcm63xx_table_entry bcm3368_clocks[] = { +static const struct clk_bcm63xx_table_entry bcm3368_clocks[] = { { .name ="mac" , .bit =3 , }, { .name ="tc" , .bit =5 , }, { .name ="us_top" , .bit =6 , },
@@ -41,7 +40,7 @@ const struct clk_bcm63xx_table_entry bcm3368_clocks[] = { { }, }; -const struct clk_bcm63xx_table_entry bcm6328_clocks[] = { +static const struct clk_bcm63xx_table_entry bcm6328_clocks[] = { { .name ="phy_mips" , .bit =0 , }, { .name ="adsl_qproc" , .bit =1 , }, { .name ="adsl_afe" , .bit =2 , },
@@ -57,7 +56,7 @@ const struct clk_bcm63xx_table_entry bcm6328_clocks[] = { { }, }; -const struct clk_bcm63xx_table_entry bcm6358_clocks[] = { +static const struct clk_bcm63xx_table_entry bcm6358_clocks[] = { { .name ="enet" , .bit =4 , }, { .name ="adslphy" , .bit =5 , }, { .name ="pcm" , .bit =8 , },
@@ -72,7 +71,7 @@ const struct clk_bcm63xx_table_entry bcm6358_clocks[] = { { }, }; -const struct clk_bcm63xx_table_entry bcm6362_clocks[] = { +static const struct clk_bcm63xx_table_entry bcm6362_clocks[] = { { .name ="adsl_qproc" , .bit =1 , }, { .name ="adsl_afe" , .bit =2 , }, { .name ="adsl" , .bit =3 , },
@@ -95,7 +94,7 @@ const struct clk_bcm63xx_table_entry bcm6362_clocks[] = { { }, }; -const struct clk_bcm63xx_table_entry bcm6368_clocks[] = { +static const struct clk_bcm63xx_table_entry bcm6368_clocks[] = { { .name ="vdsl_qproc" , .bit =2 , }, { .name ="vdsl_afe" , .bit =3 , }, { .name ="vdsl_bonding" , .bit =4 , },
@@ -116,7 +115,7 @@ const struct clk_bcm63xx_table_entry bcm6368_clocks[] = { { }, }; -const struct clk_bcm63xx_table_entry bcm63268_clocks[] = { +static const struct clk_bcm63xx_table_entry bcm63268_clocks[] = { { .name ="disable_gless" , .bit =0 , }, { .name ="vdsl_qproc" , .bit =1 , }, { .name ="vdsl_afe" , .bit =2 , },
@@ -225,22 +224,15 @@ static const struct of_device_id clk_bcm63xx_dt_ids[] = { { .compatible = "brcm,bcm6362-clocks", .data = &bcm6362_clocks, }, { .compatible = "brcm,bcm6368-clocks", .data = &bcm6368_clocks, }, { .compatible = "brcm,bcm63268-clocks", .data = &bcm63268_clocks, }, - { }, + { } }; -MODULE_DEVICE_TABLE(of, clk_bcm63xx_dt_ids); - static struct platform_driver clk_bcm63xx = { .probe = clk_bcm63xx_probe, .remove = clk_bcm63xx_remove, .driver = { .name = "bcm63xx-clock", - .of_match_table = of_match_ptr(clk_bcm63xx_dt_ids), + .of_match_table = clk_bcm63xx_dt_ids, }, }; - builtin_platform_driver(clk_bcm63xx); - -MODULE_AUTHOR("Jonas Gorski <[email protected]>"); -MODULE_DESCRIPTION("BCM63XX (MIPS) gated clock controller driver"); -MODULE_LICENSE("GPL");
PATCH 3/3 MIPS: BMIPS: add clock controller nodes
In reply to Jonas GorskiNow that we have a driver for the clock controller, add nodes to allow devices to make use of it.
--- arch/mips/boot/dts/brcm/bcm3368.dtsi | 12 +++++++++--- arch/mips/boot/dts/brcm/bcm63268.dtsi | 12 +++++++++--- arch/mips/boot/dts/brcm/bcm6328.dtsi | 6 ++++++ arch/mips/boot/dts/brcm/bcm6358.dtsi | 12 +++++++++--- arch/mips/boot/dts/brcm/bcm6362.dtsi | 12 +++++++++--- arch/mips/boot/dts/brcm/bcm6368.dtsi | 12 +++++++++--- 6 files changed, 51 insertions(+), 15 deletions(-)
arch/mips/boot/dts/brcm/bcm3368.dtsi +9 -3
@@ -51,16 +51,22 @@ compatible = "simple-bus"; ranges; - periph_cntl: syscon@fff8c000 { + clkctl: clock-controller@fff8c004 { + compatible = "brcm,bcm3368-clocks"; + reg = <0xfff8c004 0x4>; + #clock-cells = <1>; + }; + + periph_cntl: syscon@fff8c008 { compatible = "syscon"; - reg = <0xfff8c000 0xc>; + reg = <0xfff8c000 0x4>; native-endian; }; reboot: syscon-reboot@fff8c008 { compatible = "syscon-reboot"; regmap = <&periph_cntl>; - offset = <0x8>; + offset = <0x0>; mask = <0x1>; };
arch/mips/boot/dts/brcm/bcm63268.dtsi +9 -3
@@ -51,16 +51,22 @@ compatible = "simple-bus"; ranges; - periph_cntl: syscon@10000000 { + clkctl: clock-controller@10000004 { + compatible = "brcm,bcm63268-clocks"; + reg = <0x10000004 0x4>; + #clock-cells = <1>; + }; + + periph_cntl: syscon@10000008 { compatible = "syscon"; - reg = <0x10000000 0x14>; + reg = <0x10000000 0xc>; native-endian; }; reboot: syscon-reboot@10000008 { compatible = "syscon-reboot"; regmap = <&periph_cntl>; - offset = <0x8>; + offset = <0x0>; mask = <0x1>; };
arch/mips/boot/dts/brcm/bcm6328.dtsi +6 -0
@@ -51,6 +51,12 @@ compatible = "simple-bus"; ranges; + clkctl: clock-controller@10000004 { + compatible = "brcm,bcm6328-clocks"; + reg = <0x10000004 0x4>; + #clock-cells = <1>; + }; + periph_intc: interrupt-controller@10000020 { compatible = "brcm,bcm6345-l1-intc"; reg = <0x10000020 0x10>,
arch/mips/boot/dts/brcm/bcm6358.dtsi +9 -3
@@ -51,16 +51,22 @@ compatible = "simple-bus"; ranges; - periph_cntl: syscon@fffe0000 { + clkctl: clock-controller@fffe0004 { + compatible = "brcm,bcm6358-clocks"; + reg = <0xfffe0004 0x4>; + #clock-cells = <1>; + }; + + periph_cntl: syscon@fffe0008 { compatible = "syscon"; - reg = <0xfffe0000 0xc>; + reg = <0xfffe0000 0x4>; native-endian; }; reboot: syscon-reboot@fffe0008 { compatible = "syscon-reboot"; regmap = <&periph_cntl>; - offset = <0x8>; + offset = <0x0>; mask = <0x1>; };
arch/mips/boot/dts/brcm/bcm6362.dtsi +9 -3
@@ -51,16 +51,22 @@ compatible = "simple-bus"; ranges; - periph_cntl: syscon@10000000 { + clkctl: clock-controller@10000004 { + compatible = "brcm,bcm6362-clocks"; + reg = <0x10000004 0x4>; + #clock-cells = <1>; + }; + + periph_cntl: syscon@10000008 { compatible = "syscon"; - reg = <0x10000000 0x14>; + reg = <0x10000000 0xc>; native-endian; }; reboot: syscon-reboot@10000008 { compatible = "syscon-reboot"; regmap = <&periph_cntl>; - offset = <0x8>; + offset = <0x0>; mask = <0x1>; };
arch/mips/boot/dts/brcm/bcm6368.dtsi +9 -3
@@ -51,16 +51,22 @@ compatible = "simple-bus"; ranges; - periph_cntl: syscon@10000000 { + clkctl: clock-controller@10000004 { + compatible = "brcm,bcm6368-clocks"; + reg = <0x10000004 0x4>; + #clock-cells = <1>; + }; + + periph_cntl: syscon@100000008 { compatible = "syscon"; - reg = <0x10000000 0x14>; + reg = <0x10000000 0xc>; native-endian; }; reboot: syscon-reboot@10000008 { compatible = "syscon-reboot"; regmap = <&periph_cntl>; - offset = <0x8>; + offset = <0x0>; mask = <0x1>; };
Signature · 1 line
2.13.2
Re: [PATCH 3/3] MIPS: BMIPS: add clock controller nodes
Quoted 4 lines · Jonas Gorski
Now that we have a driver for the clock controller, add nodes to allow devices to make use of it.
Signed-off-by Jonas Gorski <[email protected]>
Signature · 1 line
Florian
Re: [PATCH 3/3] MIPS: BMIPS: add clock controller nodes
In reply to Jonas GorskiQuoted 4 lines · Jonas Gorski
Now that we have a driver for the clock controller, add nodes to allow devices to make use of it.
Signed-off-by Jonas Gorski <[email protected]>
Paul Burton
AppliedRe: [PATCH 3/3] MIPS: BMIPS: add clock controller nodes
In reply to Jonas GorskiHello,
Quoted 6 lines · Jonas Gorski
Now that we have a driver for the clock controller, add nodes to allow devices to make use of it.
Signed-off-by Jonas Gorski <[email protected]>Reviewed-by Florian Fainelli <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Applied to mips-next.
Thanks,
Paul
[ This message was auto-generated; if you believe anything is incorrect
then please email [email protected] to report it. ]