Highbank clock support using DT
Subsystems (5)
v2 cover Highbank clock support using DT
From: Rob Herring <[email protected]>
This series adds clock support to highbank using common clock infrastructure and DT clock bindings. The DT clock bindings were previously posted here:
https://lkml.org/lkml/2012/4/9/322
Changes in this version:
- add Documentation for bindings
- rebase to clk-next
- add A9 periphclk divider handling instead of hardcoding
- a fix to the PLL relock sequence
Mike, It's getting a bit late, but I could not get back to this sooner. I intend to send this and the DT patches by the end of the week.
Rob
Rob Herring (2):
dt: add clock binding doc to primecell bindings
clk: add highbank clock support
.../devicetree/bindings/arm/primecell.txt | 6 + .../devicetree/bindings/clock/calxeda.txt | 17 + arch/arm/Kconfig | 1 + arch/arm/boot/dts/highbank.dts | 91 +++++- arch/arm/mach-highbank/Makefile | 2 +- arch/arm/mach-highbank/clock.c | 62 ---- arch/arm/mach-highbank/highbank.c | 7 + drivers/clk/Makefile | 4 +- drivers/clk/clk-highbank.c | 345 ++++++++++++++++++++ 9 files changed, 470 insertions(+), 65 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/calxeda.txt delete mode 100644 arch/arm/mach-highbank/clock.c create mode 100644 drivers/clk/clk-highbank.c
Signature · 1 line
1.7.9.5
PATCH v2 1/2 dt: add clock binding doc to primecell bindings
From: Rob Herring <[email protected]>
Add clock binding information for primecell peripherals. For most, a clock input name of "apb_pclk" is required. Any primecell peripherals which are different will need to be documented separately.
--- .../devicetree/bindings/arm/primecell.txt | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/arm/primecell.txt +6 -0
@@ -13,11 +13,17 @@ Required properties: Optional properties: - arm,primecell-periphid : Value to override the h/w value with +- clocks : From common clock binding. First clock is phandle to clock for apb + pclk. Additional clocks are optional and specific to those peripherals. +- clock-names : From common clock binding. Shall be "apb_pclk" for first clock. Example: serial at fff36000 { compatible = "arm,pl011", "arm,primecell"; arm,primecell-periphid = <0x00341011>; + clocks = <&pclk>; + clock-names = "apb_pclk"; + };
Signature · 1 line
1.7.9.5
PATCH v2 2/2 clk: add highbank clock support
In reply to Rob HerringFrom: Rob Herring <[email protected]>
This adds real clock support to Calxeda Highbank SOC using the common clock infrastructure.
--- .../devicetree/bindings/clock/calxeda.txt | 17 + arch/arm/Kconfig | 1 + arch/arm/boot/dts/highbank.dts | 91 +++++- arch/arm/mach-highbank/Makefile | 2 +- arch/arm/mach-highbank/clock.c | 62 ---- arch/arm/mach-highbank/highbank.c | 7 + drivers/clk/Makefile | 4 +- drivers/clk/clk-highbank.c | 345 ++++++++++++++++++++ 8 files changed, 464 insertions(+), 65 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/calxeda.txt delete mode 100644 arch/arm/mach-highbank/clock.c create mode 100644 drivers/clk/clk-highbank.c
Documentation/devicetree/bindings/clock/calxeda.txt new file +17 -0
@@ -0,0 +1,17 @@ +Device Tree Clock bindings for Calxeda highbank platform + +This binding uses the common clock binding[1]. + +[1] Documentation/devicetree/bindings/clock/clock-bindings.txt + +Required properties: +- compatible : shall be one of the following: + "calxeda,hb-pll-clock" - for a PLL clock + "calxeda,hb-a9periph-clock" - The A9 peripheral clock divided from the + A9 clock. + "calxeda,hb-a9bus-clock" - The A9 bus clock divided from the A9 clock. + "calxeda,hb-emmc-clock" - Divided clock for MMC/SD controller. +- reg : shall be the control register offset from SYSREGs base for the clock. +- clocks : shall be the input parent clock phandle for the clock. This is + either an oscillator or a pll output. +- #clock-cells : from common clock binding; shall be set to 0.
arch/arm/Kconfig +1 -0
@@ -363,6 +363,7 @@ config ARCH_HIGHBANK select ARM_TIMER_SP804 select CACHE_L2X0 select CLKDEV_LOOKUP + select COMMON_CLK select CPU_V7 select GENERIC_CLOCKEVENTS select HAVE_ARM_SCU
arch/arm/boot/dts/highbank.dts +90 -1
203 lines not on this page · raw message
arch/arm/mach-highbank/Makefile +1 -1
@@ -1,4 +1,4 @@ -obj-y := clock.o highbank.o system.o +obj-y := highbank.o system.o obj-$(CONFIG_DEBUG_HIGHBANK_UART) += lluart.o obj-$(CONFIG_SMP) += platsmp.o obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
arch/arm/mach-highbank/clock.c deleted +0 -62
62 lines not on this page · raw message
arch/arm/mach-highbank/highbank.c +7 -0
@@ -91,6 +91,11 @@ static void __init highbank_init_irq(void)l2x0_of_init (0 , ~0UL ); } +static struct clk_lookup lookup = { + .dev_id ="sp804" , + .con_id =NULL , +}; +static void __init highbank_timer_init (void ) {int irq;
@@ -108,6 +113,8 @@ static void __init highbank_timer_init(void) irq =irq_of_parse_and_map (np,0 );highbank_clocks_init (); + lookup.clk =of_clk_get (np,0 ); +clkdev_add (&lookup);sp804_clocksource_and_sched_clock_init (timer_base +0x20 ,"timer1" );sp804_clockevents_init (timer_base, irq,"timer0" );
drivers/clk/Makefile +3 -1
@@ -1,4 +1,6 @@ obj-$(CONFIG_CLKDEV_LOOKUP) += clkdev.o obj-$(CONFIG_COMMON_CLK) += clk.o clk-fixed-rate.o clk-gate.o \ - clk-mux.o clk-divider.o clk-fixed-factor.o + clk-mux.o clk-divider.o + +obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o
drivers/clk/clk-highbank.c new file +345 -0
345 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v2 2/2 clk: add highbank clock support
arch/arm/mach-highbank/Makefile
Quoted 226 lines · Rob Herring
From: Rob Herring<[email protected]>
This adds real clock support to Calxeda Highbank SOC using the common clock infrastructure.
Signed-off-by Rob Herring<[email protected]>arch/arm/boot/dts/highbank.dts +90
-1@@ -1,5 +1,5 @@ /* - * Copyright 2011 Calxeda, Inc. + * Copyright 2011-2012 Calxeda, Inc. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License,@@ -24,6 +24,7 @@ compatible = "calxeda,highbank"; #address-cells =<1>; #size-cells =<1>; + clock-ranges; cpus { #address-cells =<1>;@@ -33,24 +34,32 @@ compatible = "arm,cortex-a9"; reg =<0>; next-level-cache =<&L2>; + clocks =<&a9pll>; + clock-names = "cpu"; }; cpu at 1 { compatible = "arm,cortex-a9"; reg =<1>; next-level-cache =<&L2>; + clocks =<&a9pll>; + clock-names = "cpu"; }; cpu at 2 { compatible = "arm,cortex-a9"; reg =<2>; next-level-cache =<&L2>; + clocks =<&a9pll>; + clock-names = "cpu"; }; cpu at 3 { compatible = "arm,cortex-a9"; reg =<3>; next-level-cache =<&L2>; + clocks =<&a9pll>; + clock-names = "cpu"; }; };@@ -75,12 +84,14 @@ compatible = "arm,cortex-a9-twd-timer"; reg =<0xfff10600 0x20>; interrupts =<1 13 0xf01>; + clocks =<&a9periphclk>; }; watchdog at fff10620 { compatible = "arm,cortex-a9-twd-wdt"; reg =<0xfff10620 0x20>; interrupts =<1 14 0xf01>; + clocks =<&a9periphclk>; }; intc: interrupt-controller at fff11000 {@@ -116,12 +127,15 @@ compatible = "calxeda,hb-sdhci"; reg =<0xffe0e000 0x1000>; interrupts =<0 90 4>; + clocks =<&eclk>; }; ipc at fff20000 { compatible = "arm,pl320", "arm,primecell"; reg =<0xfff20000 0x1000>; interrupts =<0 7 4>; + clocks =<&pclk>; + clock-names = "apb_pclk"; }; gpioe: gpio at fff30000 {@@ -130,6 +144,8 @@ gpio-controller; reg =<0xfff30000 0x1000>; interrupts =<0 14 4>; + clocks =<&pclk>; + clock-names = "apb_pclk"; }; gpiof: gpio at fff31000 {@@ -138,6 +154,8 @@ gpio-controller; reg =<0xfff31000 0x1000>; interrupts =<0 15 4>; + clocks =<&pclk>; + clock-names = "apb_pclk"; }; gpiog: gpio at fff32000 {@@ -146,6 +164,8 @@ gpio-controller; reg =<0xfff32000 0x1000>; interrupts =<0 16 4>; + clocks =<&pclk>; + clock-names = "apb_pclk"; }; gpioh: gpio at fff33000 {@@ -154,24 +174,32 @@ gpio-controller; reg =<0xfff33000 0x1000>; interrupts =<0 17 4>; + clocks =<&pclk>; + clock-names = "apb_pclk"; }; timer { compatible = "arm,sp804", "arm,primecell"; reg =<0xfff34000 0x1000>; interrupts =<0 18 4>; + clocks =<&pclk>; + clock-names = "apb_pclk"; }; rtc at fff35000 { compatible = "arm,pl031", "arm,primecell"; reg =<0xfff35000 0x1000>; interrupts =<0 19 4>; + clocks =<&pclk>; + clock-names = "apb_pclk"; }; serial at fff36000 { compatible = "arm,pl011", "arm,primecell"; reg =<0xfff36000 0x1000>; interrupts =<0 20 4>; + clocks =<&pclk>; + clock-names = "apb_pclk"; }; smic at fff3a000 {@@ -186,12 +214,73 @@ sregs at fff3c000 { compatible = "calxeda,hb-sregs"; reg =<0xfff3c000 0x1000>; + + clocks { + #address-cells =<1>; + #size-cells =<0>; + + osc: oscillator { + #clock-cells =<0>; + compatible = "fixed-clock"; + clock-frequency =<33333000>; + }; + + ddrpll: ddrpll { + #clock-cells =<0>; + compatible = "calxeda,hb-pll-clock"; + clocks =<&osc>; + reg =<0x108>; + }; + + a9pll: a9pll { + #clock-cells =<0>; + compatible = "calxeda,hb-pll-clock"; + clocks =<&osc>; + reg =<0x100>; + }; + + a9periphclk: a9periphclk { + #clock-cells =<0>; + compatible = "calxeda,hb-a9periph-clock"; + clocks =<&a9pll>; + reg =<0x104>; + }; + + a9bclk: a9bclk { + #clock-cells =<0>; + compatible = "calxeda,hb-a9bus-clock"; + clocks =<&a9pll>; + reg =<0x104>; + }; + + emmcpll: emmcpll { + #clock-cells =<0>; + compatible = "calxeda,hb-pll-clock"; + clocks =<&osc>; + reg =<0x10C>; + }; + + eclk: eclk { + #clock-cells =<0>; + compatible = "calxeda,hb-emmc-clock"; + clocks =<&emmcpll>; + reg =<0x114>; + }; + + pclk: pclk { + #clock-cells =<0>; + compatible = "fixed-clock"; + clock-frequency =<150000000>; + }; + }; }; dma at fff3d000 { compatible = "arm,pl330", "arm,primecell"; reg =<0xfff3d000 0x1000>; interrupts =<0 92 4>; + clocks =<&pclk>; + clock-names = "apb_pclk"; }; ethernet at fff50000 {arch/arm/mach-highbank/Makefile +0
-0
I don't think the right solution is to push this stuff into the device-tree like this. It is only going to end up with this information being replicated through every machine with clock support.
Signature · 2 lines
Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius
PATCH v2 2/2 clk: add highbank clock support
Quoted 226 lines · Ben Dooks
Quoted 225 lines · Rob Herring
From: Rob Herring<[email protected]>
This adds real clock support to Calxeda Highbank SOC using the common clock infrastructure.
Signed-off-by Rob Herring<[email protected]>arch/arm/boot/dts/highbank.dts +1
-1@@ -1,5 +1,5 @@ /* - * Copyright 2011 Calxeda, Inc. + * Copyright 2011-2012 Calxeda, Inc. * * This program is free software; you can redistribute it and/ormodify it
* under the terms and conditions of the GNU General Public License,arch/arm/boot/dts/highbank.dts +89
-0@@ -24,6 +24,7 @@ compatible = "calxeda,highbank"; #address-cells =<1>; #size-cells =<1>; + clock-ranges; cpus { #address-cells =<1>;@@ -33,24 +34,32 @@ compatible = "arm,cortex-a9"; reg =<0>; next-level-cache =<&L2>; + clocks =<&a9pll>; + clock-names = "cpu"; }; cpu at 1 { compatible = "arm,cortex-a9"; reg =<1>; next-level-cache =<&L2>; + clocks =<&a9pll>; + clock-names = "cpu"; }; cpu at 2 { compatible = "arm,cortex-a9"; reg =<2>; next-level-cache =<&L2>; + clocks =<&a9pll>; + clock-names = "cpu"; }; cpu at 3 { compatible = "arm,cortex-a9"; reg =<3>; next-level-cache =<&L2>; + clocks =<&a9pll>; + clock-names = "cpu"; }; };@@ -75,12 +84,14 @@ compatible = "arm,cortex-a9-twd-timer"; reg =<0xfff10600 0x20>; interrupts =<1 13 0xf01>; + clocks =<&a9periphclk>; }; watchdog at fff10620 { compatible = "arm,cortex-a9-twd-wdt"; reg =<0xfff10620 0x20>; interrupts =<1 14 0xf01>; + clocks =<&a9periphclk>; }; intc: interrupt-controller at fff11000 {@@ -116,12 +127,15 @@ compatible = "calxeda,hb-sdhci"; reg =<0xffe0e000 0x1000>; interrupts =<0 90 4>; + clocks =<&eclk>; }; ipc at fff20000 { compatible = "arm,pl320", "arm,primecell"; reg =<0xfff20000 0x1000>; interrupts =<0 7 4>; + clocks =<&pclk>; + clock-names = "apb_pclk"; }; gpioe: gpio at fff30000 {@@ -130,6 +144,8 @@ gpio-controller; reg =<0xfff30000 0x1000>; interrupts =<0 14 4>; + clocks =<&pclk>; + clock-names = "apb_pclk"; }; gpiof: gpio at fff31000 {@@ -138,6 +154,8 @@ gpio-controller; reg =<0xfff31000 0x1000>; interrupts =<0 15 4>; + clocks =<&pclk>; + clock-names = "apb_pclk"; }; gpiog: gpio at fff32000 {@@ -146,6 +164,8 @@ gpio-controller; reg =<0xfff32000 0x1000>; interrupts =<0 16 4>; + clocks =<&pclk>; + clock-names = "apb_pclk"; }; gpioh: gpio at fff33000 {@@ -154,24 +174,32 @@ gpio-controller; reg =<0xfff33000 0x1000>; interrupts =<0 17 4>; + clocks =<&pclk>; + clock-names = "apb_pclk"; }; timer { compatible = "arm,sp804", "arm,primecell"; reg =<0xfff34000 0x1000>; interrupts =<0 18 4>; + clocks =<&pclk>; + clock-names = "apb_pclk"; }; rtc at fff35000 { compatible = "arm,pl031", "arm,primecell"; reg =<0xfff35000 0x1000>; interrupts =<0 19 4>; + clocks =<&pclk>; + clock-names = "apb_pclk"; }; serial at fff36000 { compatible = "arm,pl011", "arm,primecell"; reg =<0xfff36000 0x1000>; interrupts =<0 20 4>; + clocks =<&pclk>; + clock-names = "apb_pclk"; }; smic at fff3a000 {@@ -186,12 +214,73 @@ sregs at fff3c000 { compatible = "calxeda,hb-sregs"; reg =<0xfff3c000 0x1000>; + + clocks { + #address-cells =<1>; + #size-cells =<0>; + + osc: oscillator { + #clock-cells =<0>; + compatible = "fixed-clock"; + clock-frequency =<33333000>; + }; + + ddrpll: ddrpll { + #clock-cells =<0>; + compatible = "calxeda,hb-pll-clock"; + clocks =<&osc>; + reg =<0x108>; + }; + + a9pll: a9pll { + #clock-cells =<0>; + compatible = "calxeda,hb-pll-clock"; + clocks =<&osc>; + reg =<0x100>; + }; + + a9periphclk: a9periphclk { + #clock-cells =<0>; + compatible = "calxeda,hb-a9periph-clock"; + clocks =<&a9pll>; + reg =<0x104>; + }; + + a9bclk: a9bclk { + #clock-cells =<0>; + compatible = "calxeda,hb-a9bus-clock"; + clocks =<&a9pll>; + reg =<0x104>; + }; + + emmcpll: emmcpll { + #clock-cells =<0>; + compatible = "calxeda,hb-pll-clock"; + clocks =<&osc>; + reg =<0x10C>; + }; + + eclk: eclk { + #clock-cells =<0>; + compatible = "calxeda,hb-emmc-clock"; + clocks =<&emmcpll>; + reg =<0x114>; + }; + + pclk: pclk { + #clock-cells =<0>; + compatible = "fixed-clock"; + clock-frequency =<150000000>; + }; + }; }; dma at fff3d000 { compatible = "arm,pl330", "arm,primecell"; reg =<0xfff3d000 0x1000>; interrupts =<0 92 4>; + clocks =<&pclk>; + clock-names = "apb_pclk"; };
Quoted 9 lines
arch/arm/mach-highbank/Makefile
Quoted 4 lines
arch/arm/boot/dts/highbank.dts +0
-0ethernet at fff50000 {arch/arm/mach-highbank/Makefile +0
-0I don't think the right solution is to push this stuff into the device-tree like this. It is only going to end up with this information being replicated through every machine with clock support.
Most SOCs are splitting board specific and SOC specific parts of the DTS files so there should be little duplication.
For SOCs with hundreds of internal clocks, it probably does not make sense to put every single clock into the DT. In that case you would only define the oscillator inputs, a clock controller with lots of outputs, and the clock connections to each device.
Rob