Skip to contentSkip to conversation

clk: Add axi-clkgen driver

PATCH New Lars-Peter Clausen 2 participants 2 messages Mar 11, 2013 – Mar 19, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 clk: Add axi-clkgen driver

This driver adds support for the AXI clkgen pcore to the common clock framework. The AXI clkgen pcore is a AXI front-end to the MMCM_ADV frequency synthesizer commonly found in Xilinx FPGAs.

The AXI clkgen pcore is used in Analog Devices' reference designs targeting Xilinx FPGAs.

---
Changes since v2:
* Use devm_ioremap_resource() instead of devm_request_and_ioremap()

Changes since v1:
* Fix error in the filter coef lookup table
* Use unsigend long long arithmetic to avoid overflow when calculating the current clock frequency.
* Use readl/writel instead of ioread32/iowrite32

---
 .../devicetree/bindings/clock/axi-clkgen.txt       |  22 ++
 drivers/clk/Kconfig                                |   8 +
 drivers/clk/Makefile                               |   1 +
 drivers/clk/clk-axi-clkgen.c                       | 331 +++++++++++++++++++++
 4 files changed, 362 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/axi-clkgen.txt
 create mode 100644 drivers/clk/clk-axi-clkgen.c
Documentation/devicetree/bindings/clock/axi-clkgen.txt new file +22 -0
new file mode 100644
index 0000000..028b493
@@ -0,0 +1,22 @@
+Binding for the axi-clkgen clock generator
+
+This binding uses the common clock binding[1].
+
+[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+Required properties:
+- compatible : shall be "adi,axi-clkgen".
+- #clock-cells : from common clock binding; Should always be set to 0.
+- reg : Address and length of the axi-clkgen register set.
+- clocks : Phandle and clock specifier for the parent clock.
+
+Optional properties:
+- clock-output-names : From common clock binding.
+
+Example:
+	clock@0xff000000 {
+		compatible = "adi,axi-clkgen";
+		#clock-cells = <0>;
+		reg = <0xff000000 0x1000>;
+		clocks = <&osc 1>;
+	};
drivers/clk/Kconfig +8 -0
index a47e6ee..a64caef 100644
@@ -63,6 +63,14 @@ config CLK_TWL6040
 	  McPDM. McPDM module is using the external bit clock on the McPDM bus
 	  as functional clock.
 
+config COMMON_CLK_AXI_CLKGEN
+	tristate "AXI clkgen driver"
+	depends on ARCH_ZYNQ || MICROBLAZE
+	help
+	---help---
+	  Support for the Analog Devices axi-clkgen pcore clock generator for Xilinx
+	  FPGAs. It is commonly used in Analog Devices' reference designs.
+
 endmenu
 
 source "drivers/clk/mvebu/Kconfig"
drivers/clk/Makefile +1 -0
index 0ad642f..9ebbbe3 100644
@@ -28,6 +28,7 @@ obj-$(CONFIG_ARCH_VT8500)	+= clk-vt8500.o
 obj-$(CONFIG_ARCH_ZYNQ)		+= clk-zynq.o
 
 # Chip specific
+obj-$(CONFIG_COMMON_CLK_AXI_CLKGEN) += clk-axi-clkgen.o
 obj-$(CONFIG_COMMON_CLK_WM831X) += clk-wm831x.o
 obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o
 obj-$(CONFIG_CLK_TWL6040)	+= clk-twl6040.o
drivers/clk/clk-axi-clkgen.c new file +331 -0

331 lines not on this page · raw message

Signature · 1 line
1.8.0
#1 lore raw

PATCH v3 1/1 clk: Add axi-clkgen driver

Quoting Lars-Peter Clausen (2013-03-11 08:22:29)

Quoted 13 lines

This driver adds support for the AXI clkgen pcore to the common clock framework. The AXI clkgen pcore is a AXI front-end to the MMCM_ADV frequency synthesizer commonly found in Xilinx FPGAs.

The AXI clkgen pcore is used in Analog Devices' reference designs targeting Xilinx FPGAs.

---
Changes since v2:
* Use devm_ioremap_resource() instead of devm_request_and_ioremap()

Quoted 7 lines

Changes since v1:
* Fix error in the filter coef lookup table
* Use unsigend long long arithmetic to avoid overflow when calculating the current clock frequency.
* Use readl/writel instead of ioread32/iowrite32

Taken into clk-next.

Thanks,
Mike