CREG clk driver for NXP LPC18xx family
Subsystems (3)
v3 cover CREG clk driver for NXP LPC18xx family
This patch set adds a clk driver for the low power clocks found in the CREG block on lpc18xx. CREG is a collection of miscellaneous configuration registers that can be accessed through a syscon regmap interface. The clk driver makes it possible to setup and enabled these two clocks.
This need to support peripherals like the internal RTC on the lpc18xx platform.
The driver has one early init using CLK_OF_DECLARE and a standard platform driver. The early init is used to register the 32KHZ clk which may be needed early on. The other clock (1KHZ) is registered when the platform driver probe runs.
This version splits clk array into clk_creg_early and clk_creg. I think this will work as long as clk_creg_early is _not_ used after the clk_creg is registered.
You can find a diff of changes between v2 and v3 here:
https://github.com/manabian/linux-lpc/commit/32e1e5da9bf30be3631c4ee93dbe4550d366431b
This seems to work, but I currently don't have a setup that requires the 32khz clock early so that part isn't really tested.
The probe deferral seems to work for the RTC:
[ 3.386861] lpc24xx-rtc 40046000.rtc: error getting rtc clock [ 6.737615] lpc24xx-rtc 40046000.rtc: rtc core: registered lpc24xx-rtc as rtc0
Changes since v2:
- Use two clk arrays for registration.
- Couple of minor cleanups.
Changes since v1:
- Split driver with one early init and one platform driver probe.
- Rebase on v4.5-rc1.
Joachim Eastwood (2):
clk: add lpc18xx creg clk driver
doc: dt: add documentation for lpc1850-creg-clk driver
.../devicetree/bindings/clock/lpc1850-creg-clk.txt | 52 +++++ drivers/clk/nxp/Makefile | 1 + drivers/clk/nxp/clk-lpc18xx-creg.c | 210 +++++++++++++++++++++ 3 files changed, 263 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/lpc1850-creg-clk.txt create mode 100644 drivers/clk/nxp/clk-lpc18xx-creg.c
Signature · 1 line
1.8.0
PATCH v3 1/2 clk: add lpc18xx creg clk driver
The CREG block on lpc18xx contains configuration register for two low power clocks. Support enabling of these two clocks with a clk driver that access CREG trough the syscon regmap interface.
These clocks are needed to support peripherals like the internal RTC on lpc18xx.
--- drivers/clk/nxp/Makefile | 1 + drivers/clk/nxp/clk-lpc18xx-creg.c | 210 +++++++++++++++++++++++++++++++++++++ 2 files changed, 211 insertions(+) create mode 100644 drivers/clk/nxp/clk-lpc18xx-creg.c
drivers/clk/nxp/Makefile +1 -0
@@ -1,3 +1,4 @@ obj-$(CONFIG_ARCH_LPC18XX) += clk-lpc18xx-cgu.o obj-$(CONFIG_ARCH_LPC18XX) += clk-lpc18xx-ccu.o +obj-$(CONFIG_ARCH_LPC18XX) += clk-lpc18xx-creg.o obj-$(CONFIG_ARCH_LPC32XX) += clk-lpc32xx.o
drivers/clk/nxp/clk-lpc18xx-creg.c new file +210 -0
210 lines not on this page · raw message
Signature · 1 line
1.8.0
PATCH v3 2/2 doc: dt: add documentation for lpc1850-creg-clk driver
In reply to Joachim EastwoodAdd DT binding documentation for lpc1850-creg-clk driver.
--- .../devicetree/bindings/clock/lpc1850-creg-clk.txt | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/lpc1850-creg-clk.txt
Documentation/devicetree/bindings/clock/lpc1850-creg-clk.txt new file +52 -0
@@ -0,0 +1,52 @@ +* NXP LPC1850 CREG clocks + +The NXP LPC18xx/43xx CREG (Configuration Registers) block contains +control registers for two low speed clocks. One of the clocks is a +32 kHz oscillator driver with power up/down and clock gating. Next +is a fixed divider that creates a 1 kHz clock from the 32 kHz osc. + +These clocks are used by the RTC and the Event Router peripherials. +The 32 kHz can also be routed to other peripherials to enable low +power modes. + +This binding uses the common clock binding: + Documentation/devicetree/bindings/clock/clock-bindings.txt + +Required properties: +- compatible: + Should be "nxp,lpc1850-creg-clk" +- #clock-cells: + Shall have value <1>. +- clocks: + Shall contain a phandle to the fix 32 kHz crystall. + +The creg-clk node must be a child of the creg syscon node. + +The following clocks are available from the clock node. + +Clock ID Name + 0 1 kHz clock + 1 32 kHz Oscillator + +Example: +soc { + creg: syscon@40043000 { + compatible = "nxp,lpc1850-creg", "syscon", "simple-mfd"; + reg = <0x40043000 0x1000>; + + creg_clk: clock-controller@004 { + compatible = "nxp,lpc1850-creg-clk"; + clocks = <&xtal32>; + #clock-cells = <1>; + }; + + ... + }; + + rtc: rtc@40046000 { + ... + clocks = <&creg_clk 0>, <&ccu1 CLK_CPU_BUS>; + clock-names = "rtc", "reg"; + ... + }; +};
Signature · 1 line
1.8.0