aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-kirkwood/common.c
diff options
context:
space:
mode:
authorSaeed Bishara <saeed@marvell.com>2010-06-08 07:21:34 -0400
committerNicolas Pitre <nico@fluxnic.net>2010-07-16 22:01:59 -0400
commitffd58bd2e45168de21d257d26ee32843b286d3b3 (patch)
tree6015a09c82add039c532a6cc41502c5eae31ccd4 /arch/arm/mach-kirkwood/common.c
parent35fe2fc44ac4202261317ccce2ef69991bc01c57 (diff)
[ARM] Kirkwood: add support for PCIe1
This patch extends the kirkwood's PCIe support up to 2 controllers as in the 6282 devices. Signed-off-by: Saeed Bishara <saeed@marvell.com> Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Diffstat (limited to 'arch/arm/mach-kirkwood/common.c')
-rw-r--r--arch/arm/mach-kirkwood/common.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 4ccfdf97aa25..9dd67c7b4459 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -44,6 +44,11 @@ static struct map_desc kirkwood_io_desc[] __initdata = {
44 .length = KIRKWOOD_PCIE_IO_SIZE, 44 .length = KIRKWOOD_PCIE_IO_SIZE,
45 .type = MT_DEVICE, 45 .type = MT_DEVICE,
46 }, { 46 }, {
47 .virtual = KIRKWOOD_PCIE1_IO_VIRT_BASE,
48 .pfn = __phys_to_pfn(KIRKWOOD_PCIE1_IO_PHYS_BASE),
49 .length = KIRKWOOD_PCIE1_IO_SIZE,
50 .type = MT_DEVICE,
51 }, {
47 .virtual = KIRKWOOD_REGS_VIRT_BASE, 52 .virtual = KIRKWOOD_REGS_VIRT_BASE,
48 .pfn = __phys_to_pfn(KIRKWOOD_REGS_PHYS_BASE), 53 .pfn = __phys_to_pfn(KIRKWOOD_REGS_PHYS_BASE),
49 .length = KIRKWOOD_REGS_SIZE, 54 .length = KIRKWOOD_REGS_SIZE,
@@ -960,12 +965,14 @@ void __init kirkwood_init(void)
960static int __init kirkwood_clock_gate(void) 965static int __init kirkwood_clock_gate(void)
961{ 966{
962 unsigned int curr = readl(CLOCK_GATING_CTRL); 967 unsigned int curr = readl(CLOCK_GATING_CTRL);
968 u32 dev, rev;
963 969
970 kirkwood_pcie_id(&dev, &rev);
964 printk(KERN_DEBUG "Gating clock of unused units\n"); 971 printk(KERN_DEBUG "Gating clock of unused units\n");
965 printk(KERN_DEBUG "before: 0x%08x\n", curr); 972 printk(KERN_DEBUG "before: 0x%08x\n", curr);
966 973
967 /* Make sure those units are accessible */ 974 /* Make sure those units are accessible */
968 writel(curr | CGC_SATA0 | CGC_SATA1 | CGC_PEX0, CLOCK_GATING_CTRL); 975 writel(curr | CGC_SATA0 | CGC_SATA1 | CGC_PEX0 | CGC_PEX1, CLOCK_GATING_CTRL);
969 976
970 /* For SATA: first shutdown the phy */ 977 /* For SATA: first shutdown the phy */
971 if (!(kirkwood_clk_ctrl & CGC_SATA0)) { 978 if (!(kirkwood_clk_ctrl & CGC_SATA0)) {
@@ -990,6 +997,18 @@ static int __init kirkwood_clock_gate(void)
990 writel(readl(PCIE_LINK_CTRL) & ~0x10, PCIE_LINK_CTRL); 997 writel(readl(PCIE_LINK_CTRL) & ~0x10, PCIE_LINK_CTRL);
991 } 998 }
992 999
1000 /* For PCIe 1: first shutdown the phy */
1001 if (dev == MV88F6282_DEV_ID) {
1002 if (!(kirkwood_clk_ctrl & CGC_PEX1)) {
1003 writel(readl(PCIE1_LINK_CTRL) | 0x10, PCIE1_LINK_CTRL);
1004 while (1)
1005 if (readl(PCIE1_STATUS) & 0x1)
1006 break;
1007 writel(readl(PCIE1_LINK_CTRL) & ~0x10, PCIE1_LINK_CTRL);
1008 }
1009 } else /* keep this bit set for devices that don't have PCIe1 */
1010 kirkwood_clk_ctrl |= CGC_PEX1;
1011
993 /* Now gate clock the required units */ 1012 /* Now gate clock the required units */
994 writel(kirkwood_clk_ctrl, CLOCK_GATING_CTRL); 1013 writel(kirkwood_clk_ctrl, CLOCK_GATING_CTRL);
995 printk(KERN_DEBUG " after: 0x%08x\n", readl(CLOCK_GATING_CTRL)); 1014 printk(KERN_DEBUG " after: 0x%08x\n", readl(CLOCK_GATING_CTRL));