clk: Add axi-clkgen driver
Subsystems (2)
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
@@ -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
@@ -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
@@ -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
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:
Thanks,
Mike
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_initmethod? See:
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