aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-kirkwood/pcie.c
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/arm/mach-kirkwood/pcie.c
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/arm/mach-kirkwood/pcie.c')
-rw-r--r--arch/arm/mach-kirkwood/pcie.c20
1 files changed, 20 insertions, 0 deletions
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: