aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2012-03-08 15:45:59 -0500
committerMike Turquette <mturquette@linaro.org>2012-05-08 19:34:02 -0400
commit27e53cfbce493bb062212263aa24bbbc5a1077f4 (patch)
treea017e6bcfa6f5ebeb152475c8b3b19fefd73b902 /arch
parentc510182b1c68e2f2bf61e69f6c65bcf61a188809 (diff)
ARM: Orion: PCIE: Add support for clk
Prepare and enable the clocks when the board indicates the pcie buses will be used. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Jamie Lentin <jm@lentin.co.uk> Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-kirkwood/common.c8
-rw-r--r--arch/arm/mach-kirkwood/pcie.c20
2 files changed, 25 insertions, 3 deletions
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index ab27d06ac4a5..aa36e1bce874 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -87,7 +87,7 @@ static struct clk __init *kirkwood_register_gate(const char *name, u8 bit_idx)
87void __init kirkwood_clk_init(void) 87void __init kirkwood_clk_init(void)
88{ 88{
89 struct clk *runit, *ge0, *ge1, *sata0, *sata1, *usb0, *sdio; 89 struct clk *runit, *ge0, *ge1, *sata0, *sata1, *usb0, *sdio;
90 struct clk *crypto, *xor0, *xor1; 90 struct clk *crypto, *xor0, *xor1, *pex0, *pex1;
91 91
92 tclk = clk_register_fixed_rate(NULL, "tclk", NULL, 92 tclk = clk_register_fixed_rate(NULL, "tclk", NULL,
93 CLK_IS_ROOT, kirkwood_tclk); 93 CLK_IS_ROOT, kirkwood_tclk);
@@ -102,8 +102,8 @@ void __init kirkwood_clk_init(void)
102 crypto = kirkwood_register_gate("crypto", CGC_BIT_CRYPTO); 102 crypto = kirkwood_register_gate("crypto", CGC_BIT_CRYPTO);
103 xor0 = kirkwood_register_gate("xor0", CGC_BIT_XOR0); 103 xor0 = kirkwood_register_gate("xor0", CGC_BIT_XOR0);
104 xor1 = kirkwood_register_gate("xor1", CGC_BIT_XOR1); 104 xor1 = kirkwood_register_gate("xor1", CGC_BIT_XOR1);
105 kirkwood_register_gate("pex0", CGC_BIT_PEX0); 105 pex0 = kirkwood_register_gate("pex0", CGC_BIT_PEX0);
106 kirkwood_register_gate("pex1", CGC_BIT_PEX1); 106 pex1 = kirkwood_register_gate("pex1", CGC_BIT_PEX1);
107 kirkwood_register_gate("audio", CGC_BIT_AUDIO); 107 kirkwood_register_gate("audio", CGC_BIT_AUDIO);
108 kirkwood_register_gate("tdm", CGC_BIT_TDM); 108 kirkwood_register_gate("tdm", CGC_BIT_TDM);
109 kirkwood_register_gate("tsu", CGC_BIT_TSU); 109 kirkwood_register_gate("tsu", CGC_BIT_TSU);
@@ -122,6 +122,8 @@ void __init kirkwood_clk_init(void)
122 orion_clkdev_add(NULL, "mv_crypto", crypto); 122 orion_clkdev_add(NULL, "mv_crypto", crypto);
123 orion_clkdev_add(NULL, MV_XOR_SHARED_NAME ".0", xor0); 123 orion_clkdev_add(NULL, MV_XOR_SHARED_NAME ".0", xor0);
124 orion_clkdev_add(NULL, MV_XOR_SHARED_NAME ".1", xor1); 124 orion_clkdev_add(NULL, MV_XOR_SHARED_NAME ".1", xor1);
125 orion_clkdev_add("0", "pcie", pex0);
126 orion_clkdev_add("1", "pcie", pex1);
125} 127}
126 128
127/***************************************************************************** 129/*****************************************************************************
diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c
index f56a0118c1bb..881933a0b5eb 100644
--- a/arch/arm/mach-kirkwood/pcie.c
+++ b/arch/arm/mach-kirkwood/pcie.c
@@ -11,6 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/clk.h>
14#include <video/vga.h> 15#include <video/vga.h>
15#include <asm/irq.h> 16#include <asm/irq.h>
16#include <asm/mach/pci.h> 17#include <asm/mach/pci.h>
@@ -19,6 +20,23 @@
19#include <plat/addr-map.h> 20#include <plat/addr-map.h>
20#include "common.h" 21#include "common.h"
21 22
23static void kirkwood_enable_pcie_clk(const char *port)
24{
25 struct clk *clk;
26
27 clk = clk_get_sys("pcie", port);
28 if (IS_ERR(clk)) {
29 printk(KERN_ERR "PCIE clock %s missing\n", port);
30 return;
31 }
32 clk_prepare_enable(clk);
33 clk_put(clk);
34}
35
36/* This function is called very early in the boot when probing the
37 hardware to determine what we actually are, and what rate tclk is
38 ticking at. Hence calling kirkwood_enable_pcie_clk() is not
39 possible since the clk tree has not been created yet. */
22void kirkwood_enable_pcie(void) 40void kirkwood_enable_pcie(void)
23{ 41{
24 u32 curr = readl(CLOCK_GATING_CTRL); 42 u32 curr = readl(CLOCK_GATING_CTRL);
@@ -183,10 +201,12 @@ static int __init kirkwood_pcie_setup(int nr, struct pci_sys_data *sys)
183 switch (index) { 201 switch (index) {
184 case 0: 202 case 0:
185 kirkwood_clk_ctrl |= CGC_PEX0; 203 kirkwood_clk_ctrl |= CGC_PEX0;
204 kirkwood_enable_pcie_clk("0");
186 pcie0_ioresources_init(pp); 205 pcie0_ioresources_init(pp);
187 break; 206 break;
188 case 1: 207 case 1:
189 kirkwood_clk_ctrl |= CGC_PEX1; 208 kirkwood_clk_ctrl |= CGC_PEX1;
209 kirkwood_enable_pcie_clk("1");
190 pcie1_ioresources_init(pp); 210 pcie1_ioresources_init(pp);
191 break; 211 break;
192 default: 212 default: