clk: keystone: Add common clock drivers
v3 cover clk: keystone: Add common clock drivers
Mike,
Here is the updated version of the series as aligned on the list. Patchset is also available on my git tree [1]
v3:
Removed the dependency with common clock dt bindings for mux and divider considering they are still under discussion. Only first patch has changed from last version.
v2:
- Aligned the bindings as per the list discussion. Removed the additional parameters by usage of reg-names and additional compatible fields.
- Addressed all the comments from v1 on drivers.
- Split the series into clock drivers($subject series) and platform, dt updates. Will post that one separately.
Special thanks to Mike and Mark for the detailed review on v1.
Series is an attempt to add the clock drivers for Keystone SOCs based on common clock framework. A PLL drivers taking care of SOC PLLs and a gate control driver taking clock management for the IPs. The current Keystone based SOCs don' support dynamic power management usecases like DVFS, SOC ilde etc and hence most of the usage is limited to enabling clocks and finding the current clock rate etc.
Tested on Keystone2 EVM.
Santosh Shilimkar (3):
clk: keystone: add Keystone PLL clock driver
clk: keystone: Add gate control clock driver
clk: keystone: Build Keystone clock drivers
.../devicetree/bindings/clock/keystone-gate.txt | 29 ++ .../devicetree/bindings/clock/keystone-pll.txt | 84 ++++++ drivers/clk/Kconfig | 7 + drivers/clk/Makefile | 1 + drivers/clk/keystone/Makefile | 1 + drivers/clk/keystone/gate.c | 264 +++++++++++++++++ drivers/clk/keystone/pll.c | 305 ++++++++++++++++++++ 7 files changed, 691 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/keystone-gate.txt create mode 100644 Documentation/devicetree/bindings/clock/keystone-pll.txt create mode 100644 drivers/clk/keystone/Makefile create mode 100644 drivers/clk/keystone/gate.c create mode 100644 drivers/clk/keystone/pll.c
Regards,
Santosh
[1] git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone.git
for_3.13/keystone/clock
Signature · 1 line
1.7.9.5
PATCH v3 1/3 clk: keystone: add Keystone PLL clock driver
Add the driver for the PLL IPs found on Keystone 2 devices. The PLL IP typically has a multiplier, a divider and a post-divider. The PLL IPs like ARMPLL, DDRPLL and PAPLL are controlled by the memory mapped register where as the Main PLL is controlled by a PLL controller and memory map registers.
--- .../devicetree/bindings/clock/keystone-pll.txt | 84 ++++++ drivers/clk/keystone/pll.c | 305 ++++++++++++++++++++ 2 files changed, 389 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/keystone-pll.txt create mode 100644 drivers/clk/keystone/pll.c
Documentation/devicetree/bindings/clock/keystone-pll.txt new file +84 -0
@@ -0,0 +1,84 @@ +Status: Unstable - ABI compatibility may be broken in the future + +Binding for keystone PLLs. The main PLL IP typically has a multiplier, +a divider and a post divider. The additional PLL IPs like ARMPLL, DDRPLL +and PAPLL are controlled by the memory mapped register where as the Main +PLL is controlled by a PLL controller registers along with memory mapped +registers. + +This binding uses the common clock binding[1]. + +[1] Documentation/devicetree/bindings/clock/clock-bindings.txt + +Required properties: +- #clock-cells : from common clock binding; shall be set to 0. +- compatible : shall be "ti,keystone,main-pll-clock" or "ti,keystone,pll-clock" +- clocks : parent clock phandle +- reg - pll control0 and pll multipler registers +- reg-names : control and multiplier. The multiplier is applicable only for + main pll clock +- fixed-postdiv : fixed post divider value + +Example: + mainpllclk: mainpllclk at 2310110 { + #clock-cells = <0>; + compatible = "ti,keystone,main-pll-clock"; + clocks = <&refclkmain>; + reg = <0x02620350 4>, <0x02310110 4>; + reg-names = "control", "multiplier"; + fixed-postdiv = <2>; + }; + + papllclk: papllclk at 2620358 { + #clock-cells = <0>; + compatible = "ti,keystone,pll-clock"; + clocks = <&refclkmain>; + clock-output-names = "pa-pll-clk"; + reg = <0x02620358 4>; + reg-names = "control"; + fixed-postdiv = <6>; + }; + +Required properties: +- #clock-cells : from common clock binding; shall be set to 0. +- compatible : shall be "ti,keystone,pll-mux-clock" +- clocks : link phandles of parent clocks +- reg - pll mux register +- bit-shift : number of bits to shift the bit-mask +- bit-mask : arbitrary bitmask for programming the mux + +Optional properties: +- clock-output-names : From common clock binding. + +Example: + mainmuxclk: mainmuxclk at 2310108 { + #clock-cells = <0>; + compatible = "ti,keystone,pll-mux-clock"; + clocks = <&mainpllclk>, <&refclkmain>; + reg = <0x02310108 4>; + bit-shift = <23>; + bit-mask = <1>; + clock-output-names = "mainmuxclk"; + }; + +Required properties: +- #clock-cells : from common clock binding; shall be set to 0. +- compatible : shall be "ti,keystone,pll-divider-clock" +- clocks : parent clock phandle +- reg - pll mux register +- bit-shift : number of bits to shift the bit-mask +- bit-mask : arbitrary bitmask for programming the divider + +Optional properties: +- clock-output-names : From common clock binding. + +Example: + gemtraceclk: gemtraceclk at 2310120 { + #clock-cells = <0>; + compatible = "ti,keystone,pll-divider-clock"; + clocks = <&mainmuxclk>; + reg = <0x02310120 4>; + bit-shift = <0>; + bit-mask = <8>; + clock-output-names = "gemtraceclk"; + };
drivers/clk/keystone/pll.c new file +305 -0
305 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v3 2/3 clk: keystone: Add gate control clock driver
In reply to Santosh ShilimkarAdd the driver for the clock gate control which uses PSC (Power Sleep Controller) IP on Keystone 2 based SOCs. It is responsible for enabling and disabling of the clocks for different IPs present in the SoC.
--- .../devicetree/bindings/clock/keystone-gate.txt | 29 +++ drivers/clk/keystone/gate.c | 264 ++++++++++++++++++++ 2 files changed, 293 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/keystone-gate.txt create mode 100644 drivers/clk/keystone/gate.c
Documentation/devicetree/bindings/clock/keystone-gate.txt new file +29 -0
@@ -0,0 +1,29 @@ +Status: Unstable - ABI compatibility may be broken in the future + +Binding for Keystone gate control driver which uses PSC controller IP. + +This binding uses the common clock binding[1]. + +[1] Documentation/devicetree/bindings/clock/clock-bindings.txt + +Required properties: +- compatible : shall be "ti,keystone,psc-clock". +- #clock-cells : from common clock binding; shall be set to 0. +- clocks : parent clock phandle +- reg : psc control and domain address address space +- reg-names : psc control and domain registers +- domain-id : psc domain id needed to check the transition state register + +Optional properties: +- clock-output-names : From common clock binding to override the + default output clock name +Example: + clkusb: clkusb { + #clock-cells = <0>; + compatible = "ti,keystone,psc-clock"; + clocks = <&chipclk16>; + clock-output-names = "usb"; + reg = <0x02350008 0xb00>, <0x02350000 0x400>; + reg-names = "control", "domain"; + domain-id = <0>; + };
drivers/clk/keystone/gate.c new file +264 -0
264 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v3 3/3 clk: keystone: Build Keystone clock drivers
In reply to Santosh ShilimkarNow build the keystone common clock drivers. The build is made conditional based on COMMON_CLK_KEYSTONE
--- drivers/clk/Kconfig | 7 +++++++ drivers/clk/Makefile | 1 + drivers/clk/keystone/Makefile | 1 + 3 files changed, 9 insertions(+) create mode 100644 drivers/clk/keystone/Makefile
drivers/clk/Kconfig +7 -0
@@ -93,6 +93,13 @@ config CLK_PPC_CORENET This adds the clock driver support for Freescale PowerPC corenet platforms using common clock framework. +config COMMON_CLK_KEYSTONE + tristate "Clock drivers for Keystone based SOCs" + depends on ARCH_KEYSTONE && OF + ---help--- + Supports clock drivers for Keystone based SOCs. These SOCs have local + a power sleep control module that gate the clock to the IPs and PLLs. + endmenu source "drivers/clk/mvebu/Kconfig"
drivers/clk/Makefile +1 -0
@@ -32,6 +32,7 @@ obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o obj-$(CONFIG_ARCH_ZYNQ) += zynq/ obj-$(CONFIG_ARCH_TEGRA) += tegra/ obj-$(CONFIG_PLAT_SAMSUNG) += samsung/ +obj-$(CONFIG_COMMON_CLK_KEYSTONE) += keystone/ obj-$(CONFIG_X86) += x86/
drivers/clk/keystone/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-y += pll.o gate.o
Signature · 1 line
1.7.9.5
PATCH v3 3/3 clk: keystone: Build Keystone clock drivers
Quoting Santosh Shilimkar (2013-09-25 18:18:15)
Quoted 36 lines
Now build the keystone common clock drivers. The build is made conditional based on
COMMON_CLK_KEYSTONECc Mike Turquette <[email protected]>Signed-off-by Santosh Shilimkar <[email protected]>--- drivers/clk/Kconfig | 7 +++++++ drivers/clk/Makefile | 1 + drivers/clk/keystone/Makefile | 1 + 3 files changed, 9 insertions(+) create mode 100644 drivers/clk/keystone/Makefiledrivers/clk/Kconfig +7
-0@@ -93,6 +93,13 @@ config CLK_PPC_CORENET This adds the clock driver support for Freescale PowerPC corenet platforms using common clock framework. +config COMMON_CLK_KEYSTONE + tristate "Clock drivers for Keystone based SOCs" + depends on ARCH_KEYSTONE && OF + ---help--- + Supports clock drivers for Keystone based SOCs. These SOCs have local + a power sleep control module that gate the clock to the IPs and PLLs. + endmenu source "drivers/clk/mvebu/Kconfig"drivers/clk/Makefile +0
-0
drivers/clk/Makefile obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o · line 35
Quoted 4 lines
drivers/clk/Makefile +1
-0@@ -32,6 +32,7 @@ obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o obj-$(CONFIG_ARCH_ZYNQ) += zynq/ obj-$(CONFIG_ARCH_TEGRA) += tegra/ obj-$(CONFIG_PLAT_SAMSUNG) += samsung/ +obj-$(CONFIG_COMMON_CLK_KEYSTONE) += keystone/
Thanks for respinning these patches Santosh. They look good and I've taken them into clk-next for 3.13.
My only question: why CONFIG_COMMON_CLK_KEYSTONE and not just CONFIG_ARCH_KEYSTONE above? This is not a blocking issue and can be revisited later.
Regards,
Mike
Quoted 12 lines
drivers/clk/Makefile +0
-0obj-$(CONFIG_X86) += x86/drivers/clk/keystone/Makefile new file +1
-0@@ -0,0 +1 @@ +obj-y += pll.o gate.oSignature · 1 line
1.7.9.5
PATCH v3 3/3 clk: keystone: Build Keystone clock drivers
Quoted 31 lines · Mike Turquette
Quoting Santosh Shilimkar (2013-09-25 18:18:15)
Quoted 30 lines
Now build the keystone common clock drivers. The build is made conditional based on
COMMON_CLK_KEYSTONECc Mike Turquette <[email protected]>Signed-off-by Santosh Shilimkar <[email protected]>--- drivers/clk/Kconfig | 7 +++++++ drivers/clk/Makefile | 1 + drivers/clk/keystone/Makefile | 1 + 3 files changed, 9 insertions(+) create mode 100644 drivers/clk/keystone/Makefiledrivers/clk/Kconfig +7
-0@@ -93,6 +93,13 @@ config CLK_PPC_CORENET This adds the clock driver support for Freescale PowerPC corenet platforms using common clock framework. +config COMMON_CLK_KEYSTONE + tristate "Clock drivers for Keystone based SOCs" + depends on ARCH_KEYSTONE && OF + ---help--- + Supports clock drivers for Keystone based SOCs. These SOCs have local + a power sleep control module that gate the clock to the IPs and PLLs. + endmenu
Quoted 14 lines
drivers/clk/Makefile obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o · line 35
Quoted 10 lines
drivers/clk/Kconfig +0
-0source "drivers/clk/mvebu/Kconfig"drivers/clk/Makefile +1
-0@@ -32,6 +32,7 @@ obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o obj-$(CONFIG_ARCH_ZYNQ) += zynq/ obj-$(CONFIG_ARCH_TEGRA) += tegra/ obj-$(CONFIG_PLAT_SAMSUNG) += samsung/ +obj-$(CONFIG_COMMON_CLK_KEYSTONE) += keystone/Thanks for respinning these patches Santosh. They look good and I've taken them into clk-next for 3.13.
Great.
Quoted 4 lines
My only question: why
CONFIG_COMMON_CLK_KEYSTONEand not justCONFIG_ARCH_KEYSTONEabove? This is not a blocking issue and can be revisited later.
The clock Kconfig had few arch using directly ARCH defines as few creating arch CCF. I gone ahead with CCF bunch. Probably we can just make that consistent for all other arch in future as you said.
Thanks a lot Mike.
Regards,
Santosh