Skip to contentSkip to conversation

clk: Add axi-clkgen driver

PATCH Superseded Lars-Peter Clausen 2 participants 3 messages Jan 23, 2013 – Feb 16, 2013

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 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 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..36df007 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 Device 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 ee90e87..a3617b2 100644
@@ -24,6 +24,7 @@ obj-$(CONFIG_ARCH_SUNXI)	+= clk-sunxi.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 v2 1/1 clk: Add axi-clkgen driver

Quoting Lars-Peter Clausen (2013-01-23 06:04:52)

drivers/clk/clk-axi-clkgen.c line 316

Quoted 5 lines
drivers/clk/clk-axi-clkgen.c new file +5 -0
+static const struct of_device_id axi_clkgen_ids[] = {
+       { .compatible = "adi,axi-clkgen-1.00.a" },
+       { },
+};
+MODULE_DEVICE_TABLE(of, axi_clkgen_ids);

This method is deprecated. Can you convert over to the newer of_clk_init method? See:

http://git.linaro.org/gitweb?p=people/mturquette/linux.git;a=commit;h=f2f6c2556dcc432e50003bc8fa4d62d95906f149

Thanks,
Mike

#2 lore raw
Quoted 11 lines · Mike Turquette

Quoting Lars-Peter Clausen (2013-01-23 06:04:52)

drivers/clk/clk-axi-clkgen.c line 316

Quoted 5 lines
drivers/clk/clk-axi-clkgen.c new file +5 -0
+static const struct of_device_id axi_clkgen_ids[] = {
+       { .compatible = "adi,axi-clkgen-1.00.a" },
+       { },
+};
+MODULE_DEVICE_TABLE(of, axi_clkgen_ids);

This method is deprecated. Can you convert over to the newer of_clk_init method? See:

http://git.linaro.org/gitweb?p=people/mturquette/linux.git;a=commit;h=f2f6c2556dcc432e50003bc8fa4d62d95906f149

Hi,

I'm not sure this makes sense here. That would mean completely bypassing the device driver model. And since this device is on a kind of external bus it may or may not be present at the time of_clk_init() runs.

- Lars