diff options
author | Arnd Bergmann <arnd@arndb.de> | 2014-03-26 21:10:57 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2014-03-26 21:19:41 -0400 |
commit | 32adc19d4b2f2d9a26fbbd0c1744d5b313106d6a (patch) | |
tree | 5e034ff3b39b6495a4d1d2cc3839b985b2e711d0 /drivers/clk | |
parent | 22673b71689a65a89335d0f3e42ce952efb3e7e1 (diff) | |
parent | 1a259251f3638b04c1dbe07220958af9572c95bb (diff) |
Merge tag 'zynq-cleanup-for-3.15-v2' of git://git.xilinx.com/linux-xlnx into next/cleanup2
Merge "arm: Xilinx Zynq cleanup patches for v3.15" from Michal Simek:
- Redesign SLCR initialization to enable
driver developing which targets SLCR space
* tag 'zynq-cleanup-for-3.15-v2' of git://git.xilinx.com/linux-xlnx:
ARM: zynq: Add waituart implementation
ARM: zynq: Move of_clk_init from clock driver
ARM: zynq: Introduce zynq_slcr_unlock()
ARM: zynq: Add and use zynq_slcr_read/write() helper functions
ARM: zynq: Make zynq_slcr_base static
ARM: zynq: Map I/O memory on clkc init
ARM: zynq: Hang iomapped slcr address on device_node
ARM: zynq: Split slcr in two parts
ARM: zynq: Move clock_init from slcr to common
arm: dt: zynq: Add fclk-enable property to clkc node
[Arnd: remove SOC_BUS support from pull request]
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/clk')
-rw-r--r-- | drivers/clk/zynq/clkc.c | 89 |
1 files changed, 62 insertions, 27 deletions
diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c index 09dd0173ea0a..c812b93a52b2 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,42 @@ 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; |
575 | of_clk_init(NULL); | 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 | |||
605 | return; | ||
606 | |||
607 | np_err: | ||
608 | of_node_put(np); | ||
609 | BUG(); | ||
610 | return; | ||
576 | } | 611 | } |