diff options
-rw-r--r-- | Documentation/devicetree/bindings/clock/zynq-7000.txt | 4 | ||||
-rw-r--r-- | arch/arm/boot/dts/zynq-7000.dtsi | 42 | ||||
-rw-r--r-- | arch/arm/mach-zynq/common.c | 2 | ||||
-rw-r--r-- | drivers/clk/zynq/clkc.c | 89 | ||||
-rw-r--r-- | include/linux/clk/zynq.h | 2 |
5 files changed, 88 insertions, 51 deletions
diff --git a/Documentation/devicetree/bindings/clock/zynq-7000.txt b/Documentation/devicetree/bindings/clock/zynq-7000.txt index 17b4a94916d6..d93746cf2975 100644 --- a/Documentation/devicetree/bindings/clock/zynq-7000.txt +++ b/Documentation/devicetree/bindings/clock/zynq-7000.txt | |||
@@ -14,6 +14,7 @@ for all clock consumers of PS clocks. | |||
14 | Required properties: | 14 | Required properties: |
15 | - #clock-cells : Must be 1 | 15 | - #clock-cells : Must be 1 |
16 | - compatible : "xlnx,ps7-clkc" | 16 | - compatible : "xlnx,ps7-clkc" |
17 | - reg : SLCR offset and size taken via syscon < 0x100 0x100 > | ||
17 | - ps-clk-frequency : Frequency of the oscillator providing ps_clk in HZ | 18 | - ps-clk-frequency : Frequency of the oscillator providing ps_clk in HZ |
18 | (usually 33 MHz oscillators are used for Zynq platforms) | 19 | (usually 33 MHz oscillators are used for Zynq platforms) |
19 | - clock-output-names : List of strings used to name the clock outputs. Shall be | 20 | - clock-output-names : List of strings used to name the clock outputs. Shall be |
@@ -87,10 +88,11 @@ Clock outputs: | |||
87 | 47: dbg_apb | 88 | 47: dbg_apb |
88 | 89 | ||
89 | Example: | 90 | Example: |
90 | clkc: clkc { | 91 | clkc: clkc@100 { |
91 | #clock-cells = <1>; | 92 | #clock-cells = <1>; |
92 | compatible = "xlnx,ps7-clkc"; | 93 | compatible = "xlnx,ps7-clkc"; |
93 | ps-clk-frequency = <33333333>; | 94 | ps-clk-frequency = <33333333>; |
95 | reg = <0x100 0x100>; | ||
94 | clock-output-names = "armpll", "ddrpll", "iopll", "cpu_6or4x", | 96 | clock-output-names = "armpll", "ddrpll", "iopll", "cpu_6or4x", |
95 | "cpu_3or2x", "cpu_2x", "cpu_1x", "ddr2x", "ddr3x", | 97 | "cpu_3or2x", "cpu_2x", "cpu_1x", "ddr2x", "ddr3x", |
96 | "dci", "lqspi", "smc", "pcap", "gem0", "gem1", | 98 | "dci", "lqspi", "smc", "pcap", "gem0", "gem1", |
diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi index 81e5677f25a2..602e12eedb01 100644 --- a/arch/arm/boot/dts/zynq-7000.dtsi +++ b/arch/arm/boot/dts/zynq-7000.dtsi | |||
@@ -123,30 +123,28 @@ | |||
123 | } ; | 123 | } ; |
124 | 124 | ||
125 | slcr: slcr@f8000000 { | 125 | slcr: slcr@f8000000 { |
126 | #address-cells = <1>; | ||
127 | #size-cells = <1>; | ||
126 | compatible = "xlnx,zynq-slcr", "syscon"; | 128 | compatible = "xlnx,zynq-slcr", "syscon"; |
127 | reg = <0xF8000000 0x1000>; | 129 | reg = <0xF8000000 0x1000>; |
128 | 130 | ranges; | |
129 | clocks { | 131 | clkc: clkc@100 { |
130 | #address-cells = <1>; | 132 | #clock-cells = <1>; |
131 | #size-cells = <0>; | 133 | compatible = "xlnx,ps7-clkc"; |
132 | 134 | ps-clk-frequency = <33333333>; | |
133 | clkc: clkc { | 135 | fclk-enable = <0>; |
134 | #clock-cells = <1>; | 136 | clock-output-names = "armpll", "ddrpll", "iopll", "cpu_6or4x", |
135 | compatible = "xlnx,ps7-clkc"; | 137 | "cpu_3or2x", "cpu_2x", "cpu_1x", "ddr2x", "ddr3x", |
136 | ps-clk-frequency = <33333333>; | 138 | "dci", "lqspi", "smc", "pcap", "gem0", "gem1", |
137 | fclk-enable = <0>; | 139 | "fclk0", "fclk1", "fclk2", "fclk3", "can0", "can1", |
138 | clock-output-names = "armpll", "ddrpll", "iopll", "cpu_6or4x", | 140 | "sdio0", "sdio1", "uart0", "uart1", "spi0", "spi1", |
139 | "cpu_3or2x", "cpu_2x", "cpu_1x", "ddr2x", "ddr3x", | 141 | "dma", "usb0_aper", "usb1_aper", "gem0_aper", |
140 | "dci", "lqspi", "smc", "pcap", "gem0", "gem1", | 142 | "gem1_aper", "sdio0_aper", "sdio1_aper", |
141 | "fclk0", "fclk1", "fclk2", "fclk3", "can0", "can1", | 143 | "spi0_aper", "spi1_aper", "can0_aper", "can1_aper", |
142 | "sdio0", "sdio1", "uart0", "uart1", "spi0", "spi1", | 144 | "i2c0_aper", "i2c1_aper", "uart0_aper", "uart1_aper", |
143 | "dma", "usb0_aper", "usb1_aper", "gem0_aper", | 145 | "gpio_aper", "lqspi_aper", "smc_aper", "swdt", |
144 | "gem1_aper", "sdio0_aper", "sdio1_aper", | 146 | "dbg_trc", "dbg_apb"; |
145 | "spi0_aper", "spi1_aper", "can0_aper", "can1_aper", | 147 | reg = <0x100 0x100>; |
146 | "i2c0_aper", "i2c1_aper", "uart0_aper", "uart1_aper", | ||
147 | "gpio_aper", "lqspi_aper", "smc_aper", "swdt", | ||
148 | "dbg_trc", "dbg_apb"; | ||
149 | }; | ||
150 | }; | 148 | }; |
151 | }; | 149 | }; |
152 | 150 | ||
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index 38401cf78383..93ea19b13e6e 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c | |||
@@ -67,7 +67,7 @@ static void __init zynq_timer_init(void) | |||
67 | { | 67 | { |
68 | zynq_early_slcr_init(); | 68 | zynq_early_slcr_init(); |
69 | 69 | ||
70 | zynq_clock_init(zynq_slcr_base); | 70 | zynq_clock_init(); |
71 | clocksource_of_init(); | 71 | clocksource_of_init(); |
72 | } | 72 | } |
73 | 73 | ||
diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c index 09dd0173ea0a..03052d67b197 100644 --- a/drivers/clk/zynq/clkc.c +++ b/drivers/clk/zynq/clkc.c | |||
@@ -21,34 +21,35 @@ | |||
21 | #include <linux/clk/zynq.h> | 21 | #include <linux/clk/zynq.h> |
22 | #include <linux/clk-provider.h> | 22 | #include <linux/clk-provider.h> |
23 | #include <linux/of.h> | 23 | #include <linux/of.h> |
24 | #include <linux/of_address.h> | ||
24 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
25 | #include <linux/string.h> | 26 | #include <linux/string.h> |
26 | #include <linux/io.h> | 27 | #include <linux/io.h> |
27 | 28 | ||
28 | static void __iomem *zynq_slcr_base_priv; | 29 | static void __iomem *zynq_clkc_base; |
29 | 30 | ||
30 | #define SLCR_ARMPLL_CTRL (zynq_slcr_base_priv + 0x100) | 31 | #define SLCR_ARMPLL_CTRL (zynq_clkc_base + 0x00) |
31 | #define SLCR_DDRPLL_CTRL (zynq_slcr_base_priv + 0x104) | 32 | #define SLCR_DDRPLL_CTRL (zynq_clkc_base + 0x04) |
32 | #define SLCR_IOPLL_CTRL (zynq_slcr_base_priv + 0x108) | 33 | #define SLCR_IOPLL_CTRL (zynq_clkc_base + 0x08) |
33 | #define SLCR_PLL_STATUS (zynq_slcr_base_priv + 0x10c) | 34 | #define SLCR_PLL_STATUS (zynq_clkc_base + 0x0c) |
34 | #define SLCR_ARM_CLK_CTRL (zynq_slcr_base_priv + 0x120) | 35 | #define SLCR_ARM_CLK_CTRL (zynq_clkc_base + 0x20) |
35 | #define SLCR_DDR_CLK_CTRL (zynq_slcr_base_priv + 0x124) | 36 | #define SLCR_DDR_CLK_CTRL (zynq_clkc_base + 0x24) |
36 | #define SLCR_DCI_CLK_CTRL (zynq_slcr_base_priv + 0x128) | 37 | #define SLCR_DCI_CLK_CTRL (zynq_clkc_base + 0x28) |
37 | #define SLCR_APER_CLK_CTRL (zynq_slcr_base_priv + 0x12c) | 38 | #define SLCR_APER_CLK_CTRL (zynq_clkc_base + 0x2c) |
38 | #define SLCR_GEM0_CLK_CTRL (zynq_slcr_base_priv + 0x140) | 39 | #define SLCR_GEM0_CLK_CTRL (zynq_clkc_base + 0x40) |
39 | #define SLCR_GEM1_CLK_CTRL (zynq_slcr_base_priv + 0x144) | 40 | #define SLCR_GEM1_CLK_CTRL (zynq_clkc_base + 0x44) |
40 | #define SLCR_SMC_CLK_CTRL (zynq_slcr_base_priv + 0x148) | 41 | #define SLCR_SMC_CLK_CTRL (zynq_clkc_base + 0x48) |
41 | #define SLCR_LQSPI_CLK_CTRL (zynq_slcr_base_priv + 0x14c) | 42 | #define SLCR_LQSPI_CLK_CTRL (zynq_clkc_base + 0x4c) |
42 | #define SLCR_SDIO_CLK_CTRL (zynq_slcr_base_priv + 0x150) | 43 | #define SLCR_SDIO_CLK_CTRL (zynq_clkc_base + 0x50) |
43 | #define SLCR_UART_CLK_CTRL (zynq_slcr_base_priv + 0x154) | 44 | #define SLCR_UART_CLK_CTRL (zynq_clkc_base + 0x54) |
44 | #define SLCR_SPI_CLK_CTRL (zynq_slcr_base_priv + 0x158) | 45 | #define SLCR_SPI_CLK_CTRL (zynq_clkc_base + 0x58) |
45 | #define SLCR_CAN_CLK_CTRL (zynq_slcr_base_priv + 0x15c) | 46 | #define SLCR_CAN_CLK_CTRL (zynq_clkc_base + 0x5c) |
46 | #define SLCR_CAN_MIOCLK_CTRL (zynq_slcr_base_priv + 0x160) | 47 | #define SLCR_CAN_MIOCLK_CTRL (zynq_clkc_base + 0x60) |
47 | #define SLCR_DBG_CLK_CTRL (zynq_slcr_base_priv + 0x164) | 48 | #define SLCR_DBG_CLK_CTRL (zynq_clkc_base + 0x64) |
48 | #define SLCR_PCAP_CLK_CTRL (zynq_slcr_base_priv + 0x168) | 49 | #define SLCR_PCAP_CLK_CTRL (zynq_clkc_base + 0x68) |
49 | #define SLCR_FPGA0_CLK_CTRL (zynq_slcr_base_priv + 0x170) | 50 | #define SLCR_FPGA0_CLK_CTRL (zynq_clkc_base + 0x70) |
50 | #define SLCR_621_TRUE (zynq_slcr_base_priv + 0x1c4) | 51 | #define SLCR_621_TRUE (zynq_clkc_base + 0xc4) |
51 | #define SLCR_SWDT_CLK_SEL (zynq_slcr_base_priv + 0x304) | 52 | #define SLCR_SWDT_CLK_SEL (zynq_clkc_base + 0x204) |
52 | 53 | ||
53 | #define NUM_MIO_PINS 54 | 54 | #define NUM_MIO_PINS 54 |
54 | 55 | ||
@@ -569,8 +570,44 @@ static void __init zynq_clk_setup(struct device_node *np) | |||
569 | 570 | ||
570 | CLK_OF_DECLARE(zynq_clkc, "xlnx,ps7-clkc", zynq_clk_setup); | 571 | CLK_OF_DECLARE(zynq_clkc, "xlnx,ps7-clkc", zynq_clk_setup); |
571 | 572 | ||
572 | void __init zynq_clock_init(void __iomem *slcr_base) | 573 | void __init zynq_clock_init(void) |
573 | { | 574 | { |
574 | zynq_slcr_base_priv = slcr_base; | 575 | struct device_node *np; |
576 | struct device_node *slcr; | ||
577 | struct resource res; | ||
578 | |||
579 | np = of_find_compatible_node(NULL, NULL, "xlnx,ps7-clkc"); | ||
580 | if (!np) { | ||
581 | pr_err("%s: clkc node not found\n", __func__); | ||
582 | goto np_err; | ||
583 | } | ||
584 | |||
585 | if (of_address_to_resource(np, 0, &res)) { | ||
586 | pr_err("%s: failed to get resource\n", np->name); | ||
587 | goto np_err; | ||
588 | } | ||
589 | |||
590 | slcr = of_get_parent(np); | ||
591 | |||
592 | if (slcr->data) { | ||
593 | zynq_clkc_base = (__force void __iomem *)slcr->data + res.start; | ||
594 | } else { | ||
595 | pr_err("%s: Unable to get I/O memory\n", np->name); | ||
596 | of_node_put(slcr); | ||
597 | goto np_err; | ||
598 | } | ||
599 | |||
600 | pr_info("%s: clkc starts at %p\n", __func__, zynq_clkc_base); | ||
601 | |||
602 | of_node_put(slcr); | ||
603 | of_node_put(np); | ||
604 | |||
575 | of_clk_init(NULL); | 605 | of_clk_init(NULL); |
606 | |||
607 | return; | ||
608 | |||
609 | np_err: | ||
610 | of_node_put(np); | ||
611 | BUG(); | ||
612 | return; | ||
576 | } | 613 | } |
diff --git a/include/linux/clk/zynq.h b/include/linux/clk/zynq.h index e062d317ccce..7a5633b71533 100644 --- a/include/linux/clk/zynq.h +++ b/include/linux/clk/zynq.h | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
24 | 24 | ||
25 | void zynq_clock_init(void __iomem *slcr); | 25 | void zynq_clock_init(void); |
26 | 26 | ||
27 | struct clk *clk_register_zynq_pll(const char *name, const char *parent, | 27 | struct clk *clk_register_zynq_pll(const char *name, const char *parent, |
28 | void __iomem *pll_ctrl, void __iomem *pll_status, u8 lock_index, | 28 | void __iomem *pll_ctrl, void __iomem *pll_status, u8 lock_index, |