aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-kirkwood/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-kirkwood/common.c')
-rw-r--r--arch/arm/mach-kirkwood/common.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 6072eaa5e66a..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,
@@ -402,7 +407,7 @@ void __init kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data)
402 u32 dev, rev; 407 u32 dev, rev;
403 408
404 kirkwood_pcie_id(&dev, &rev); 409 kirkwood_pcie_id(&dev, &rev);
405 if (rev == 0) /* catch all Kirkwood Z0's */ 410 if (rev == 0 && dev != MV88F6282_DEV_ID) /* catch all Kirkwood Z0's */
406 mvsdio_data->clock = 100000000; 411 mvsdio_data->clock = 100000000;
407 else 412 else
408 mvsdio_data->clock = 200000000; 413 mvsdio_data->clock = 200000000;
@@ -847,8 +852,10 @@ int __init kirkwood_find_tclk(void)
847 u32 dev, rev; 852 u32 dev, rev;
848 853
849 kirkwood_pcie_id(&dev, &rev); 854 kirkwood_pcie_id(&dev, &rev);
850 if (dev == MV88F6281_DEV_ID && (rev == MV88F6281_REV_A0 || 855
851 rev == MV88F6281_REV_A1)) 856 if ((dev == MV88F6281_DEV_ID && (rev == MV88F6281_REV_A0 ||
857 rev == MV88F6281_REV_A1)) ||
858 (dev == MV88F6282_DEV_ID))
852 return 200000000; 859 return 200000000;
853 860
854 return 166666667; 861 return 166666667;
@@ -891,13 +898,22 @@ static char * __init kirkwood_id(void)
891 return "MV88F6192-Z0"; 898 return "MV88F6192-Z0";
892 else if (rev == MV88F6192_REV_A0) 899 else if (rev == MV88F6192_REV_A0)
893 return "MV88F6192-A0"; 900 return "MV88F6192-A0";
901 else if (rev == MV88F6192_REV_A1)
902 return "MV88F6192-A1";
894 else 903 else
895 return "MV88F6192-Rev-Unsupported"; 904 return "MV88F6192-Rev-Unsupported";
896 } else if (dev == MV88F6180_DEV_ID) { 905 } else if (dev == MV88F6180_DEV_ID) {
897 if (rev == MV88F6180_REV_A0) 906 if (rev == MV88F6180_REV_A0)
898 return "MV88F6180-Rev-A0"; 907 return "MV88F6180-Rev-A0";
908 else if (rev == MV88F6180_REV_A1)
909 return "MV88F6180-Rev-A1";
899 else 910 else
900 return "MV88F6180-Rev-Unsupported"; 911 return "MV88F6180-Rev-Unsupported";
912 } else if (dev == MV88F6282_DEV_ID) {
913 if (rev == MV88F6282_REV_A0)
914 return "MV88F6282-Rev-A0";
915 else
916 return "MV88F6282-Rev-Unsupported";
901 } else { 917 } else {
902 return "Device-Unknown"; 918 return "Device-Unknown";
903 } 919 }
@@ -949,12 +965,14 @@ void __init kirkwood_init(void)
949static int __init kirkwood_clock_gate(void) 965static int __init kirkwood_clock_gate(void)
950{ 966{
951 unsigned int curr = readl(CLOCK_GATING_CTRL); 967 unsigned int curr = readl(CLOCK_GATING_CTRL);
968 u32 dev, rev;
952 969
970 kirkwood_pcie_id(&dev, &rev);
953 printk(KERN_DEBUG "Gating clock of unused units\n"); 971 printk(KERN_DEBUG "Gating clock of unused units\n");
954 printk(KERN_DEBUG "before: 0x%08x\n", curr); 972 printk(KERN_DEBUG "before: 0x%08x\n", curr);
955 973
956 /* Make sure those units are accessible */ 974 /* Make sure those units are accessible */
957 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);
958 976
959 /* For SATA: first shutdown the phy */ 977 /* For SATA: first shutdown the phy */
960 if (!(kirkwood_clk_ctrl & CGC_SATA0)) { 978 if (!(kirkwood_clk_ctrl & CGC_SATA0)) {
@@ -979,6 +997,18 @@ static int __init kirkwood_clock_gate(void)
979 writel(readl(PCIE_LINK_CTRL) & ~0x10, PCIE_LINK_CTRL); 997 writel(readl(PCIE_LINK_CTRL) & ~0x10, PCIE_LINK_CTRL);
980 } 998 }
981 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
982 /* Now gate clock the required units */ 1012 /* Now gate clock the required units */
983 writel(kirkwood_clk_ctrl, CLOCK_GATING_CTRL); 1013 writel(kirkwood_clk_ctrl, CLOCK_GATING_CTRL);
984 printk(KERN_DEBUG " after: 0x%08x\n", readl(CLOCK_GATING_CTRL)); 1014 printk(KERN_DEBUG " after: 0x%08x\n", readl(CLOCK_GATING_CTRL));