Skip to contentSkip to conversation

clk: Add driver and bindings for Fixed MMIO clock

PATCH Applied Jan Kotas 2 participants 6 messages Dec 13, 2018 – Jan 9, 2019

Subsystems (2)
lore
Share & tools
lore

Jan Kotas

author
#0 lore raw

v2 cover clk: Add driver and bindings for Fixed MMIO clock

This patchset adds a driver support for Fixed Memory Mapped IO clock.

The driver reads a clock frequency value from a single 32-bit memory mapped register and registers it as a fixed rate clock.

It can be useful for prototyping Linux on various hardware platforms. It is not intended to be used on finished, complete SoCs.

Changes since V1:
Added platform driver support.
Removed unnecessary messages.

Jan Kotas (2):
dt-bindings: clk: Add bindings for Fixed MMIO clock
clk: Add Fixed MMIO clock driver

 .../devicetree/bindings/clock/fixed-mmio-clock.txt |  24 +++++
 drivers/clk/Kconfig                                |   6 ++
 drivers/clk/Makefile                               |   1 +
 drivers/clk/clk-fixed-mmio.c                       | 109 +++++++++++++++++++++
 4 files changed, 140 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/fixed-mmio-clock.txt
 create mode 100644 drivers/clk/clk-fixed-mmio.c
Signature · 1 line
2.15.0
author
#1 lore raw

PATCH v2 1/2 dt-bindings: clk: Add bindings for Fixed MMIO clock

This patch adds a DT binding documentation for Fixed Memory Mapped IO clocks.

---
 .../devicetree/bindings/clock/fixed-mmio-clock.txt | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/fixed-mmio-clock.txt
Documentation/devicetree/bindings/clock/fixed-mmio-clock.txt new file +24 -0
new file mode 100644
index 000000000..c359367fd
@@ -0,0 +1,24 @@
+Binding for simple memory mapped io fixed-rate clock sources.
+The driver reads a clock frequency value from a single 32-bit memory mapped
+I/O register and registers it as a fixed rate clock.
+
+It was designed for test systems, like FPGA, not for complete, finished SoCs.
+
+This binding uses the common clock binding[1].
+
+[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+Required properties:
+- compatible : shall be "fixed-mmio-clock".
+- #clock-cells : from common clock binding; shall be set to 0.
+- reg : Address and length of the clock value register set.
+
+Optional properties:
+- clock-output-names : From common clock binding.
+
+Example:
+sysclock: sysclock@fd020004 {
+	#clock-cells = <0>;
+	compatible = "fixed-mmio-clock";
+	reg = <0xfd020004 0x4>;
+};
Signature · 1 line
2.15.0
maintainer Applied
#2 lore raw

Re: [PATCH v2 1/2] dt-bindings: clk: Add bindings for Fixed MMIO clock

Quoting Jan Kotas (2018-12-13 04:49:28)

Quoted 5 lines

This patch adds a DT binding documentation for Fixed Memory Mapped IO clocks.

---

Applied to clk-next

author
#3 lore raw

PATCH v2 2/2 clk: Add Fixed MMIO clock driver

In reply to Jan Kotas

This patch adds a driver for Fixed MMIO clock.
The driver reads a clock frequency value from a single 32-bit memory mapped register and registers it as a fixed rate clock.

It can be enabled with COMMON_CLK_FIXED_MMIO Kconfig option.

---
 drivers/clk/Kconfig          |   6 +++
 drivers/clk/Makefile         |   1 +
 drivers/clk/clk-fixed-mmio.c | 109 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 116 insertions(+)
 create mode 100644 drivers/clk/clk-fixed-mmio.c
drivers/clk/Kconfig +6 -0
index 81cdb4eac..69c7fb859 100644
@@ -283,6 +283,12 @@ config COMMON_CLK_STM32H7
 	---help---
 	  Support for stm32h7 SoC family clocks
 
+config COMMON_CLK_FIXED_MMIO
+	bool "Clock driver for Memory Mapped Fixed values"
+	depends on COMMON_CLK && OF
+	help
+	  Support for Memory Mapped IO Fixed clocks
+
 source "drivers/clk/actions/Kconfig"
 source "drivers/clk/bcm/Kconfig"
 source "drivers/clk/hisilicon/Kconfig"
drivers/clk/Makefile +1 -0
index 72be7a38c..4e61961dc 100644
@@ -26,6 +26,7 @@ obj-$(CONFIG_COMMON_CLK_CDCE925)	+= clk-cdce925.o
 obj-$(CONFIG_ARCH_CLPS711X)		+= clk-clps711x.o
 obj-$(CONFIG_COMMON_CLK_CS2000_CP)	+= clk-cs2000-cp.o
 obj-$(CONFIG_ARCH_EFM32)		+= clk-efm32gg.o
+obj-$(CONFIG_COMMON_CLK_FIXED_MMIO)	+= clk-fixed-mmio.o
 obj-$(CONFIG_COMMON_CLK_GEMINI)		+= clk-gemini.o
 obj-$(CONFIG_COMMON_CLK_ASPEED)		+= clk-aspeed.o
 obj-$(CONFIG_ARCH_HIGHBANK)		+= clk-highbank.o
drivers/clk/clk-fixed-mmio.c new file +109 -0

109 lines not on this page · raw message

Signature · 1 line
2.15.0
maintainer
#4 lore raw

Re: [PATCH v2 2/2] clk: Add Fixed MMIO clock driver

Quoting Jan Kotas (2018-12-13 04:49:29)

Quoted 7 lines

This patch adds a driver for Fixed MMIO clock.
The driver reads a clock frequency value from a single 32-bit memory mapped register and registers it as a fixed rate clock.

It can be enabled with COMMON_CLK_FIXED_MMIO Kconfig option.

This needed to use the clk_hw based APIs and add a static. I made the changes myself. Let me know if you have any problems with what's in clk-next and it can be fixed.

maintainer Applied
#5 lore raw

Re: [PATCH v2 2/2] clk: Add Fixed MMIO clock driver

In reply to Jan Kotas

Quoting Jan Kotas (2018-12-13 04:49:29)

Quoted 8 lines

This patch adds a driver for Fixed MMIO clock.
The driver reads a clock frequency value from a single 32-bit memory mapped register and registers it as a fixed rate clock.

It can be enabled with COMMON_CLK_FIXED_MMIO Kconfig option.

---

Applied to clk-next