Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-orion5x/common.c |
| 3 | * |
| 4 | * Core functions for Marvell Orion 5x SoCs |
| 5 | * |
| 6 | * Maintainer: Tzachi Perelstein <tzachi@marvell.com> |
| 7 | * |
| 8 | * This file is licensed under the terms of the GNU General Public |
| 9 | * License version 2. This program is licensed "as is" without any |
| 10 | * warranty of any kind, whether express or implied. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/init.h> |
| 15 | #include <linux/platform_device.h> |
| 16 | #include <linux/serial_8250.h> |
| 17 | #include <linux/mbus.h> |
| 18 | #include <linux/mv643xx_eth.h> |
| 19 | #include <linux/mv643xx_i2c.h> |
| 20 | #include <linux/ata_platform.h> |
Lennert Buytenhek | d323ade | 2008-08-29 06:55:06 +0200 | [diff] [blame] | 21 | #include <linux/spi/orion_spi.h> |
Lennert Buytenhek | dcf1cec | 2008-09-25 16:23:48 +0200 | [diff] [blame] | 22 | #include <net/dsa.h> |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 23 | #include <asm/page.h> |
| 24 | #include <asm/setup.h> |
| 25 | #include <asm/timex.h> |
| 26 | #include <asm/mach/arch.h> |
| 27 | #include <asm/mach/map.h> |
| 28 | #include <asm/mach/time.h> |
Lennert Buytenhek | 4ee1f6b | 2010-10-15 16:50:26 +0200 | [diff] [blame] | 29 | #include <mach/bridge-regs.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 30 | #include <mach/hardware.h> |
| 31 | #include <mach/orion5x.h> |
Lennert Buytenhek | 6f088f1 | 2008-08-09 13:44:58 +0200 | [diff] [blame] | 32 | #include <plat/ehci-orion.h> |
Saeed Bishara | 1d5a1a6 | 2008-06-16 23:25:12 -1100 | [diff] [blame] | 33 | #include <plat/mv_xor.h> |
Lennert Buytenhek | 6f088f1 | 2008-08-09 13:44:58 +0200 | [diff] [blame] | 34 | #include <plat/orion_nand.h> |
Nicolas Pitre | 3b937a7 | 2009-06-01 13:56:02 -0400 | [diff] [blame] | 35 | #include <plat/orion_wdt.h> |
Lennert Buytenhek | 6f088f1 | 2008-08-09 13:44:58 +0200 | [diff] [blame] | 36 | #include <plat/time.h> |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 37 | #include "common.h" |
| 38 | |
| 39 | /***************************************************************************** |
| 40 | * I/O Address Mapping |
| 41 | ****************************************************************************/ |
| 42 | static struct map_desc orion5x_io_desc[] __initdata = { |
| 43 | { |
| 44 | .virtual = ORION5X_REGS_VIRT_BASE, |
| 45 | .pfn = __phys_to_pfn(ORION5X_REGS_PHYS_BASE), |
| 46 | .length = ORION5X_REGS_SIZE, |
Lennert Buytenhek | e7068ad | 2008-05-10 16:30:01 +0200 | [diff] [blame] | 47 | .type = MT_DEVICE, |
| 48 | }, { |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 49 | .virtual = ORION5X_PCIE_IO_VIRT_BASE, |
| 50 | .pfn = __phys_to_pfn(ORION5X_PCIE_IO_PHYS_BASE), |
| 51 | .length = ORION5X_PCIE_IO_SIZE, |
Lennert Buytenhek | e7068ad | 2008-05-10 16:30:01 +0200 | [diff] [blame] | 52 | .type = MT_DEVICE, |
| 53 | }, { |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 54 | .virtual = ORION5X_PCI_IO_VIRT_BASE, |
| 55 | .pfn = __phys_to_pfn(ORION5X_PCI_IO_PHYS_BASE), |
| 56 | .length = ORION5X_PCI_IO_SIZE, |
Lennert Buytenhek | e7068ad | 2008-05-10 16:30:01 +0200 | [diff] [blame] | 57 | .type = MT_DEVICE, |
| 58 | }, { |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 59 | .virtual = ORION5X_PCIE_WA_VIRT_BASE, |
| 60 | .pfn = __phys_to_pfn(ORION5X_PCIE_WA_PHYS_BASE), |
| 61 | .length = ORION5X_PCIE_WA_SIZE, |
Lennert Buytenhek | e7068ad | 2008-05-10 16:30:01 +0200 | [diff] [blame] | 62 | .type = MT_DEVICE, |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 63 | }, |
| 64 | }; |
| 65 | |
| 66 | void __init orion5x_map_io(void) |
| 67 | { |
| 68 | iotable_init(orion5x_io_desc, ARRAY_SIZE(orion5x_io_desc)); |
| 69 | } |
| 70 | |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 71 | |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 72 | /***************************************************************************** |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 73 | * EHCI |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 74 | ****************************************************************************/ |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 75 | static struct orion_ehci_data orion5x_ehci_data = { |
| 76 | .dram = &orion5x_mbus_dram_info, |
Ronen Shitrit | fb6f552 | 2008-09-17 10:08:05 +0300 | [diff] [blame] | 77 | .phy_version = EHCI_PHY_ORION, |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 78 | }; |
| 79 | |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame^] | 80 | static u64 ehci_dmamask = DMA_BIT_MASK(32); |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 81 | |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 82 | |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 83 | /***************************************************************************** |
| 84 | * EHCI0 |
| 85 | ****************************************************************************/ |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 86 | static struct resource orion5x_ehci0_resources[] = { |
| 87 | { |
| 88 | .start = ORION5X_USB0_PHYS_BASE, |
Lennert Buytenhek | 994cab8 | 2008-04-25 16:30:21 -0400 | [diff] [blame] | 89 | .end = ORION5X_USB0_PHYS_BASE + SZ_4K - 1, |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 90 | .flags = IORESOURCE_MEM, |
Lennert Buytenhek | e7068ad | 2008-05-10 16:30:01 +0200 | [diff] [blame] | 91 | }, { |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 92 | .start = IRQ_ORION5X_USB0_CTRL, |
| 93 | .end = IRQ_ORION5X_USB0_CTRL, |
| 94 | .flags = IORESOURCE_IRQ, |
| 95 | }, |
| 96 | }; |
| 97 | |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 98 | static struct platform_device orion5x_ehci0 = { |
| 99 | .name = "orion-ehci", |
| 100 | .id = 0, |
| 101 | .dev = { |
| 102 | .dma_mask = &ehci_dmamask, |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame^] | 103 | .coherent_dma_mask = DMA_BIT_MASK(32), |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 104 | .platform_data = &orion5x_ehci_data, |
| 105 | }, |
| 106 | .resource = orion5x_ehci0_resources, |
| 107 | .num_resources = ARRAY_SIZE(orion5x_ehci0_resources), |
| 108 | }; |
| 109 | |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 110 | void __init orion5x_ehci0_init(void) |
| 111 | { |
| 112 | platform_device_register(&orion5x_ehci0); |
| 113 | } |
| 114 | |
| 115 | |
| 116 | /***************************************************************************** |
| 117 | * EHCI1 |
| 118 | ****************************************************************************/ |
| 119 | static struct resource orion5x_ehci1_resources[] = { |
| 120 | { |
| 121 | .start = ORION5X_USB1_PHYS_BASE, |
| 122 | .end = ORION5X_USB1_PHYS_BASE + SZ_4K - 1, |
| 123 | .flags = IORESOURCE_MEM, |
| 124 | }, { |
| 125 | .start = IRQ_ORION5X_USB1_CTRL, |
| 126 | .end = IRQ_ORION5X_USB1_CTRL, |
| 127 | .flags = IORESOURCE_IRQ, |
| 128 | }, |
| 129 | }; |
| 130 | |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 131 | static struct platform_device orion5x_ehci1 = { |
| 132 | .name = "orion-ehci", |
| 133 | .id = 1, |
| 134 | .dev = { |
| 135 | .dma_mask = &ehci_dmamask, |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame^] | 136 | .coherent_dma_mask = DMA_BIT_MASK(32), |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 137 | .platform_data = &orion5x_ehci_data, |
| 138 | }, |
| 139 | .resource = orion5x_ehci1_resources, |
| 140 | .num_resources = ARRAY_SIZE(orion5x_ehci1_resources), |
| 141 | }; |
| 142 | |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 143 | void __init orion5x_ehci1_init(void) |
| 144 | { |
| 145 | platform_device_register(&orion5x_ehci1); |
| 146 | } |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 147 | |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 148 | |
| 149 | /***************************************************************************** |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame^] | 150 | * GE00 |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 151 | ****************************************************************************/ |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame^] | 152 | struct mv643xx_eth_shared_platform_data orion5x_ge00_shared_data = { |
Lennert Buytenhek | d236f5a | 2008-04-26 14:48:11 -0400 | [diff] [blame] | 153 | .dram = &orion5x_mbus_dram_info, |
| 154 | }; |
| 155 | |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame^] | 156 | static struct resource orion5x_ge00_shared_resources[] = { |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 157 | { |
| 158 | .start = ORION5X_ETH_PHYS_BASE + 0x2000, |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame^] | 159 | .end = ORION5X_ETH_PHYS_BASE + SZ_16K - 1, |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 160 | .flags = IORESOURCE_MEM, |
Lennert Buytenhek | eeff6d8 | 2008-08-26 16:01:21 +0200 | [diff] [blame] | 161 | }, { |
| 162 | .start = IRQ_ORION5X_ETH_ERR, |
| 163 | .end = IRQ_ORION5X_ETH_ERR, |
| 164 | .flags = IORESOURCE_IRQ, |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 165 | }, |
| 166 | }; |
| 167 | |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame^] | 168 | static struct platform_device orion5x_ge00_shared = { |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 169 | .name = MV643XX_ETH_SHARED_NAME, |
| 170 | .id = 0, |
Lennert Buytenhek | d236f5a | 2008-04-26 14:48:11 -0400 | [diff] [blame] | 171 | .dev = { |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame^] | 172 | .platform_data = &orion5x_ge00_shared_data, |
Lennert Buytenhek | d236f5a | 2008-04-26 14:48:11 -0400 | [diff] [blame] | 173 | }, |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame^] | 174 | .num_resources = ARRAY_SIZE(orion5x_ge00_shared_resources), |
| 175 | .resource = orion5x_ge00_shared_resources, |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 176 | }; |
| 177 | |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame^] | 178 | static struct resource orion5x_ge00_resources[] = { |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 179 | { |
| 180 | .name = "eth irq", |
| 181 | .start = IRQ_ORION5X_ETH_SUM, |
| 182 | .end = IRQ_ORION5X_ETH_SUM, |
| 183 | .flags = IORESOURCE_IRQ, |
Lennert Buytenhek | e7068ad | 2008-05-10 16:30:01 +0200 | [diff] [blame] | 184 | }, |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 185 | }; |
| 186 | |
| 187 | static struct platform_device orion5x_eth = { |
| 188 | .name = MV643XX_ETH_NAME, |
| 189 | .id = 0, |
| 190 | .num_resources = 1, |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame^] | 191 | .resource = orion5x_ge00_resources, |
Nicolas Pitre | a49a018 | 2009-05-22 16:53:40 -0400 | [diff] [blame] | 192 | .dev = { |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame^] | 193 | .coherent_dma_mask = DMA_BIT_MASK(32), |
Nicolas Pitre | a49a018 | 2009-05-22 16:53:40 -0400 | [diff] [blame] | 194 | }, |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 195 | }; |
| 196 | |
| 197 | void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data) |
| 198 | { |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame^] | 199 | eth_data->shared = &orion5x_ge00_shared; |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 200 | orion5x_eth.dev.platform_data = eth_data; |
Lennert Buytenhek | fa3959f | 2008-04-24 01:27:02 +0200 | [diff] [blame] | 201 | |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame^] | 202 | platform_device_register(&orion5x_ge00_shared); |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 203 | platform_device_register(&orion5x_eth); |
| 204 | } |
| 205 | |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 206 | |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 207 | /***************************************************************************** |
Lennert Buytenhek | dcf1cec | 2008-09-25 16:23:48 +0200 | [diff] [blame] | 208 | * Ethernet switch |
| 209 | ****************************************************************************/ |
| 210 | static struct resource orion5x_switch_resources[] = { |
| 211 | { |
| 212 | .start = 0, |
| 213 | .end = 0, |
| 214 | .flags = IORESOURCE_IRQ, |
| 215 | }, |
| 216 | }; |
| 217 | |
| 218 | static struct platform_device orion5x_switch_device = { |
| 219 | .name = "dsa", |
| 220 | .id = 0, |
| 221 | .num_resources = 0, |
| 222 | .resource = orion5x_switch_resources, |
| 223 | }; |
| 224 | |
| 225 | void __init orion5x_eth_switch_init(struct dsa_platform_data *d, int irq) |
| 226 | { |
Lennert Buytenhek | e84665c | 2009-03-20 09:52:09 +0000 | [diff] [blame] | 227 | int i; |
| 228 | |
Lennert Buytenhek | dcf1cec | 2008-09-25 16:23:48 +0200 | [diff] [blame] | 229 | if (irq != NO_IRQ) { |
| 230 | orion5x_switch_resources[0].start = irq; |
| 231 | orion5x_switch_resources[0].end = irq; |
| 232 | orion5x_switch_device.num_resources = 1; |
| 233 | } |
| 234 | |
Lennert Buytenhek | dcf1cec | 2008-09-25 16:23:48 +0200 | [diff] [blame] | 235 | d->netdev = &orion5x_eth.dev; |
Lennert Buytenhek | e84665c | 2009-03-20 09:52:09 +0000 | [diff] [blame] | 236 | for (i = 0; i < d->nr_chips; i++) |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame^] | 237 | d->chip[i].mii_bus = &orion5x_ge00_shared.dev; |
Lennert Buytenhek | dcf1cec | 2008-09-25 16:23:48 +0200 | [diff] [blame] | 238 | orion5x_switch_device.dev.platform_data = d; |
| 239 | |
| 240 | platform_device_register(&orion5x_switch_device); |
| 241 | } |
| 242 | |
| 243 | |
| 244 | /***************************************************************************** |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 245 | * I2C |
| 246 | ****************************************************************************/ |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 247 | static struct mv64xxx_i2c_pdata orion5x_i2c_pdata = { |
| 248 | .freq_m = 8, /* assumes 166 MHz TCLK */ |
| 249 | .freq_n = 3, |
| 250 | .timeout = 1000, /* Default timeout of 1 second */ |
| 251 | }; |
| 252 | |
| 253 | static struct resource orion5x_i2c_resources[] = { |
| 254 | { |
Lennert Buytenhek | e7068ad | 2008-05-10 16:30:01 +0200 | [diff] [blame] | 255 | .start = I2C_PHYS_BASE, |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 256 | .end = I2C_PHYS_BASE + 0x1f, |
Lennert Buytenhek | e7068ad | 2008-05-10 16:30:01 +0200 | [diff] [blame] | 257 | .flags = IORESOURCE_MEM, |
| 258 | }, { |
Lennert Buytenhek | e7068ad | 2008-05-10 16:30:01 +0200 | [diff] [blame] | 259 | .start = IRQ_ORION5X_I2C, |
| 260 | .end = IRQ_ORION5X_I2C, |
| 261 | .flags = IORESOURCE_IRQ, |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 262 | }, |
| 263 | }; |
| 264 | |
| 265 | static struct platform_device orion5x_i2c = { |
| 266 | .name = MV64XXX_I2C_CTLR_NAME, |
| 267 | .id = 0, |
| 268 | .num_resources = ARRAY_SIZE(orion5x_i2c_resources), |
| 269 | .resource = orion5x_i2c_resources, |
| 270 | .dev = { |
Lennert Buytenhek | e7068ad | 2008-05-10 16:30:01 +0200 | [diff] [blame] | 271 | .platform_data = &orion5x_i2c_pdata, |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 272 | }, |
| 273 | }; |
| 274 | |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 275 | void __init orion5x_i2c_init(void) |
| 276 | { |
| 277 | platform_device_register(&orion5x_i2c); |
| 278 | } |
| 279 | |
| 280 | |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 281 | /***************************************************************************** |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 282 | * SATA |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 283 | ****************************************************************************/ |
| 284 | static struct resource orion5x_sata_resources[] = { |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 285 | { |
Lennert Buytenhek | e7068ad | 2008-05-10 16:30:01 +0200 | [diff] [blame] | 286 | .name = "sata base", |
| 287 | .start = ORION5X_SATA_PHYS_BASE, |
| 288 | .end = ORION5X_SATA_PHYS_BASE + 0x5000 - 1, |
| 289 | .flags = IORESOURCE_MEM, |
| 290 | }, { |
| 291 | .name = "sata irq", |
| 292 | .start = IRQ_ORION5X_SATA, |
| 293 | .end = IRQ_ORION5X_SATA, |
| 294 | .flags = IORESOURCE_IRQ, |
| 295 | }, |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 296 | }; |
| 297 | |
| 298 | static struct platform_device orion5x_sata = { |
Lennert Buytenhek | e7068ad | 2008-05-10 16:30:01 +0200 | [diff] [blame] | 299 | .name = "sata_mv", |
| 300 | .id = 0, |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 301 | .dev = { |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame^] | 302 | .coherent_dma_mask = DMA_BIT_MASK(32), |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 303 | }, |
Lennert Buytenhek | e7068ad | 2008-05-10 16:30:01 +0200 | [diff] [blame] | 304 | .num_resources = ARRAY_SIZE(orion5x_sata_resources), |
| 305 | .resource = orion5x_sata_resources, |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 306 | }; |
| 307 | |
| 308 | void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data) |
| 309 | { |
| 310 | sata_data->dram = &orion5x_mbus_dram_info; |
| 311 | orion5x_sata.dev.platform_data = sata_data; |
| 312 | platform_device_register(&orion5x_sata); |
| 313 | } |
| 314 | |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 315 | |
| 316 | /***************************************************************************** |
Lennert Buytenhek | d323ade | 2008-08-29 06:55:06 +0200 | [diff] [blame] | 317 | * SPI |
| 318 | ****************************************************************************/ |
| 319 | static struct orion_spi_info orion5x_spi_plat_data = { |
Nicolas Pitre | c0e1936 | 2008-10-19 14:18:25 -0400 | [diff] [blame] | 320 | .tclk = 0, |
| 321 | .enable_clock_fix = 1, |
Lennert Buytenhek | d323ade | 2008-08-29 06:55:06 +0200 | [diff] [blame] | 322 | }; |
| 323 | |
| 324 | static struct resource orion5x_spi_resources[] = { |
| 325 | { |
| 326 | .name = "spi base", |
| 327 | .start = SPI_PHYS_BASE, |
| 328 | .end = SPI_PHYS_BASE + 0x1f, |
| 329 | .flags = IORESOURCE_MEM, |
| 330 | }, |
| 331 | }; |
| 332 | |
| 333 | static struct platform_device orion5x_spi = { |
| 334 | .name = "orion_spi", |
| 335 | .id = 0, |
| 336 | .dev = { |
| 337 | .platform_data = &orion5x_spi_plat_data, |
| 338 | }, |
| 339 | .num_resources = ARRAY_SIZE(orion5x_spi_resources), |
| 340 | .resource = orion5x_spi_resources, |
| 341 | }; |
| 342 | |
| 343 | void __init orion5x_spi_init() |
| 344 | { |
| 345 | platform_device_register(&orion5x_spi); |
| 346 | } |
| 347 | |
| 348 | |
| 349 | /***************************************************************************** |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 350 | * UART0 |
| 351 | ****************************************************************************/ |
| 352 | static struct plat_serial8250_port orion5x_uart0_data[] = { |
| 353 | { |
| 354 | .mapbase = UART0_PHYS_BASE, |
| 355 | .membase = (char *)UART0_VIRT_BASE, |
| 356 | .irq = IRQ_ORION5X_UART0, |
| 357 | .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF, |
| 358 | .iotype = UPIO_MEM, |
| 359 | .regshift = 2, |
Lennert Buytenhek | ebe35af | 2008-08-29 05:55:51 +0200 | [diff] [blame] | 360 | .uartclk = 0, |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 361 | }, { |
| 362 | }, |
| 363 | }; |
| 364 | |
| 365 | static struct resource orion5x_uart0_resources[] = { |
| 366 | { |
| 367 | .start = UART0_PHYS_BASE, |
| 368 | .end = UART0_PHYS_BASE + 0xff, |
| 369 | .flags = IORESOURCE_MEM, |
| 370 | }, { |
| 371 | .start = IRQ_ORION5X_UART0, |
| 372 | .end = IRQ_ORION5X_UART0, |
| 373 | .flags = IORESOURCE_IRQ, |
| 374 | }, |
| 375 | }; |
| 376 | |
| 377 | static struct platform_device orion5x_uart0 = { |
| 378 | .name = "serial8250", |
| 379 | .id = PLAT8250_DEV_PLATFORM, |
| 380 | .dev = { |
| 381 | .platform_data = orion5x_uart0_data, |
| 382 | }, |
| 383 | .resource = orion5x_uart0_resources, |
| 384 | .num_resources = ARRAY_SIZE(orion5x_uart0_resources), |
| 385 | }; |
| 386 | |
| 387 | void __init orion5x_uart0_init(void) |
| 388 | { |
| 389 | platform_device_register(&orion5x_uart0); |
| 390 | } |
| 391 | |
| 392 | |
| 393 | /***************************************************************************** |
| 394 | * UART1 |
| 395 | ****************************************************************************/ |
| 396 | static struct plat_serial8250_port orion5x_uart1_data[] = { |
| 397 | { |
| 398 | .mapbase = UART1_PHYS_BASE, |
| 399 | .membase = (char *)UART1_VIRT_BASE, |
| 400 | .irq = IRQ_ORION5X_UART1, |
| 401 | .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF, |
| 402 | .iotype = UPIO_MEM, |
| 403 | .regshift = 2, |
Lennert Buytenhek | ebe35af | 2008-08-29 05:55:51 +0200 | [diff] [blame] | 404 | .uartclk = 0, |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 405 | }, { |
| 406 | }, |
| 407 | }; |
| 408 | |
| 409 | static struct resource orion5x_uart1_resources[] = { |
| 410 | { |
| 411 | .start = UART1_PHYS_BASE, |
| 412 | .end = UART1_PHYS_BASE + 0xff, |
| 413 | .flags = IORESOURCE_MEM, |
| 414 | }, { |
| 415 | .start = IRQ_ORION5X_UART1, |
| 416 | .end = IRQ_ORION5X_UART1, |
| 417 | .flags = IORESOURCE_IRQ, |
| 418 | }, |
| 419 | }; |
| 420 | |
| 421 | static struct platform_device orion5x_uart1 = { |
| 422 | .name = "serial8250", |
| 423 | .id = PLAT8250_DEV_PLATFORM1, |
| 424 | .dev = { |
| 425 | .platform_data = orion5x_uart1_data, |
| 426 | }, |
| 427 | .resource = orion5x_uart1_resources, |
| 428 | .num_resources = ARRAY_SIZE(orion5x_uart1_resources), |
| 429 | }; |
| 430 | |
| 431 | void __init orion5x_uart1_init(void) |
| 432 | { |
| 433 | platform_device_register(&orion5x_uart1); |
| 434 | } |
| 435 | |
| 436 | |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 437 | /***************************************************************************** |
Saeed Bishara | 1d5a1a6 | 2008-06-16 23:25:12 -1100 | [diff] [blame] | 438 | * XOR engine |
| 439 | ****************************************************************************/ |
Saeed Bishara | f45964e | 2009-03-02 17:30:36 +0200 | [diff] [blame] | 440 | struct mv_xor_platform_shared_data orion5x_xor_shared_data = { |
| 441 | .dram = &orion5x_mbus_dram_info, |
| 442 | }; |
| 443 | |
Saeed Bishara | 1d5a1a6 | 2008-06-16 23:25:12 -1100 | [diff] [blame] | 444 | static struct resource orion5x_xor_shared_resources[] = { |
| 445 | { |
| 446 | .name = "xor low", |
| 447 | .start = ORION5X_XOR_PHYS_BASE, |
| 448 | .end = ORION5X_XOR_PHYS_BASE + 0xff, |
| 449 | .flags = IORESOURCE_MEM, |
| 450 | }, { |
| 451 | .name = "xor high", |
| 452 | .start = ORION5X_XOR_PHYS_BASE + 0x200, |
| 453 | .end = ORION5X_XOR_PHYS_BASE + 0x2ff, |
| 454 | .flags = IORESOURCE_MEM, |
| 455 | }, |
| 456 | }; |
| 457 | |
| 458 | static struct platform_device orion5x_xor_shared = { |
| 459 | .name = MV_XOR_SHARED_NAME, |
| 460 | .id = 0, |
Saeed Bishara | f45964e | 2009-03-02 17:30:36 +0200 | [diff] [blame] | 461 | .dev = { |
| 462 | .platform_data = &orion5x_xor_shared_data, |
| 463 | }, |
Saeed Bishara | 1d5a1a6 | 2008-06-16 23:25:12 -1100 | [diff] [blame] | 464 | .num_resources = ARRAY_SIZE(orion5x_xor_shared_resources), |
| 465 | .resource = orion5x_xor_shared_resources, |
| 466 | }; |
| 467 | |
Yang Hongyang | 284901a | 2009-04-06 19:01:15 -0700 | [diff] [blame] | 468 | static u64 orion5x_xor_dmamask = DMA_BIT_MASK(32); |
Saeed Bishara | 1d5a1a6 | 2008-06-16 23:25:12 -1100 | [diff] [blame] | 469 | |
| 470 | static struct resource orion5x_xor0_resources[] = { |
| 471 | [0] = { |
| 472 | .start = IRQ_ORION5X_XOR0, |
| 473 | .end = IRQ_ORION5X_XOR0, |
| 474 | .flags = IORESOURCE_IRQ, |
| 475 | }, |
| 476 | }; |
| 477 | |
| 478 | static struct mv_xor_platform_data orion5x_xor0_data = { |
| 479 | .shared = &orion5x_xor_shared, |
| 480 | .hw_id = 0, |
| 481 | .pool_size = PAGE_SIZE, |
| 482 | }; |
| 483 | |
| 484 | static struct platform_device orion5x_xor0_channel = { |
| 485 | .name = MV_XOR_NAME, |
| 486 | .id = 0, |
| 487 | .num_resources = ARRAY_SIZE(orion5x_xor0_resources), |
| 488 | .resource = orion5x_xor0_resources, |
| 489 | .dev = { |
| 490 | .dma_mask = &orion5x_xor_dmamask, |
Yang Hongyang | 6a35528 | 2009-04-06 19:01:13 -0700 | [diff] [blame] | 491 | .coherent_dma_mask = DMA_BIT_MASK(64), |
H Hartley Sweeten | ef4a677 | 2010-01-29 14:56:58 -0800 | [diff] [blame] | 492 | .platform_data = &orion5x_xor0_data, |
Saeed Bishara | 1d5a1a6 | 2008-06-16 23:25:12 -1100 | [diff] [blame] | 493 | }, |
| 494 | }; |
| 495 | |
| 496 | static struct resource orion5x_xor1_resources[] = { |
| 497 | [0] = { |
| 498 | .start = IRQ_ORION5X_XOR1, |
| 499 | .end = IRQ_ORION5X_XOR1, |
| 500 | .flags = IORESOURCE_IRQ, |
| 501 | }, |
| 502 | }; |
| 503 | |
| 504 | static struct mv_xor_platform_data orion5x_xor1_data = { |
| 505 | .shared = &orion5x_xor_shared, |
| 506 | .hw_id = 1, |
| 507 | .pool_size = PAGE_SIZE, |
| 508 | }; |
| 509 | |
| 510 | static struct platform_device orion5x_xor1_channel = { |
| 511 | .name = MV_XOR_NAME, |
| 512 | .id = 1, |
| 513 | .num_resources = ARRAY_SIZE(orion5x_xor1_resources), |
| 514 | .resource = orion5x_xor1_resources, |
| 515 | .dev = { |
| 516 | .dma_mask = &orion5x_xor_dmamask, |
Yang Hongyang | 6a35528 | 2009-04-06 19:01:13 -0700 | [diff] [blame] | 517 | .coherent_dma_mask = DMA_BIT_MASK(64), |
H Hartley Sweeten | ef4a677 | 2010-01-29 14:56:58 -0800 | [diff] [blame] | 518 | .platform_data = &orion5x_xor1_data, |
Saeed Bishara | 1d5a1a6 | 2008-06-16 23:25:12 -1100 | [diff] [blame] | 519 | }, |
| 520 | }; |
| 521 | |
| 522 | void __init orion5x_xor_init(void) |
| 523 | { |
| 524 | platform_device_register(&orion5x_xor_shared); |
| 525 | |
| 526 | /* |
| 527 | * two engines can't do memset simultaneously, this limitation |
| 528 | * satisfied by removing memset support from one of the engines. |
| 529 | */ |
| 530 | dma_cap_set(DMA_MEMCPY, orion5x_xor0_data.cap_mask); |
| 531 | dma_cap_set(DMA_XOR, orion5x_xor0_data.cap_mask); |
| 532 | platform_device_register(&orion5x_xor0_channel); |
| 533 | |
| 534 | dma_cap_set(DMA_MEMCPY, orion5x_xor1_data.cap_mask); |
| 535 | dma_cap_set(DMA_MEMSET, orion5x_xor1_data.cap_mask); |
| 536 | dma_cap_set(DMA_XOR, orion5x_xor1_data.cap_mask); |
| 537 | platform_device_register(&orion5x_xor1_channel); |
| 538 | } |
| 539 | |
Sebastian Andrzej Siewior | 3a8f744 | 2009-05-07 22:59:24 +0200 | [diff] [blame] | 540 | static struct resource orion5x_crypto_res[] = { |
| 541 | { |
| 542 | .name = "regs", |
| 543 | .start = ORION5X_CRYPTO_PHYS_BASE, |
| 544 | .end = ORION5X_CRYPTO_PHYS_BASE + 0xffff, |
| 545 | .flags = IORESOURCE_MEM, |
| 546 | }, { |
| 547 | .name = "sram", |
| 548 | .start = ORION5X_SRAM_PHYS_BASE, |
| 549 | .end = ORION5X_SRAM_PHYS_BASE + SZ_8K - 1, |
| 550 | .flags = IORESOURCE_MEM, |
| 551 | }, { |
| 552 | .name = "crypto interrupt", |
| 553 | .start = IRQ_ORION5X_CESA, |
| 554 | .end = IRQ_ORION5X_CESA, |
| 555 | .flags = IORESOURCE_IRQ, |
| 556 | }, |
| 557 | }; |
| 558 | |
| 559 | static struct platform_device orion5x_crypto_device = { |
| 560 | .name = "mv_crypto", |
| 561 | .id = -1, |
| 562 | .num_resources = ARRAY_SIZE(orion5x_crypto_res), |
| 563 | .resource = orion5x_crypto_res, |
| 564 | }; |
| 565 | |
Nicolas Pitre | 3fade49 | 2009-06-11 22:27:20 +0200 | [diff] [blame] | 566 | static int __init orion5x_crypto_init(void) |
Sebastian Andrzej Siewior | 3a8f744 | 2009-05-07 22:59:24 +0200 | [diff] [blame] | 567 | { |
| 568 | int ret; |
| 569 | |
| 570 | ret = orion5x_setup_sram_win(); |
| 571 | if (ret) |
| 572 | return ret; |
| 573 | |
| 574 | return platform_device_register(&orion5x_crypto_device); |
| 575 | } |
Saeed Bishara | 1d5a1a6 | 2008-06-16 23:25:12 -1100 | [diff] [blame] | 576 | |
| 577 | /***************************************************************************** |
Thomas Reitmayr | 9e058d4 | 2009-02-24 14:59:22 -0800 | [diff] [blame] | 578 | * Watchdog |
| 579 | ****************************************************************************/ |
Nicolas Pitre | 3b937a7 | 2009-06-01 13:56:02 -0400 | [diff] [blame] | 580 | static struct orion_wdt_platform_data orion5x_wdt_data = { |
Thomas Reitmayr | 9e058d4 | 2009-02-24 14:59:22 -0800 | [diff] [blame] | 581 | .tclk = 0, |
| 582 | }; |
| 583 | |
| 584 | static struct platform_device orion5x_wdt_device = { |
Nicolas Pitre | 3b937a7 | 2009-06-01 13:56:02 -0400 | [diff] [blame] | 585 | .name = "orion_wdt", |
Thomas Reitmayr | 9e058d4 | 2009-02-24 14:59:22 -0800 | [diff] [blame] | 586 | .id = -1, |
| 587 | .dev = { |
| 588 | .platform_data = &orion5x_wdt_data, |
| 589 | }, |
| 590 | .num_resources = 0, |
| 591 | }; |
| 592 | |
| 593 | void __init orion5x_wdt_init(void) |
| 594 | { |
| 595 | orion5x_wdt_data.tclk = orion5x_tclk; |
| 596 | platform_device_register(&orion5x_wdt_device); |
| 597 | } |
| 598 | |
| 599 | |
| 600 | /***************************************************************************** |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 601 | * Time handling |
| 602 | ****************************************************************************/ |
Lennert Buytenhek | 4ee1f6b | 2010-10-15 16:50:26 +0200 | [diff] [blame] | 603 | void __init orion5x_init_early(void) |
| 604 | { |
| 605 | orion_time_set_base(TIMER_VIRT_BASE); |
| 606 | } |
| 607 | |
Lennert Buytenhek | ebe35af | 2008-08-29 05:55:51 +0200 | [diff] [blame] | 608 | int orion5x_tclk; |
| 609 | |
| 610 | int __init orion5x_find_tclk(void) |
| 611 | { |
Lennert Buytenhek | d323ade | 2008-08-29 06:55:06 +0200 | [diff] [blame] | 612 | u32 dev, rev; |
| 613 | |
| 614 | orion5x_pcie_id(&dev, &rev); |
| 615 | if (dev == MV88F6183_DEV_ID && |
| 616 | (readl(MPP_RESET_SAMPLE) & 0x00000200) == 0) |
| 617 | return 133333333; |
| 618 | |
Lennert Buytenhek | ebe35af | 2008-08-29 05:55:51 +0200 | [diff] [blame] | 619 | return 166666667; |
| 620 | } |
| 621 | |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 622 | static void orion5x_timer_init(void) |
| 623 | { |
Lennert Buytenhek | ebe35af | 2008-08-29 05:55:51 +0200 | [diff] [blame] | 624 | orion5x_tclk = orion5x_find_tclk(); |
Lennert Buytenhek | 4ee1f6b | 2010-10-15 16:50:26 +0200 | [diff] [blame] | 625 | |
| 626 | orion_time_init(ORION5X_BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR, |
| 627 | IRQ_ORION5X_BRIDGE, orion5x_tclk); |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 628 | } |
| 629 | |
| 630 | struct sys_timer orion5x_timer = { |
Lennert Buytenhek | e7068ad | 2008-05-10 16:30:01 +0200 | [diff] [blame] | 631 | .init = orion5x_timer_init, |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 632 | }; |
| 633 | |
Lennert Buytenhek | 044f6c7 | 2008-04-22 05:37:12 +0200 | [diff] [blame] | 634 | |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 635 | /***************************************************************************** |
| 636 | * General |
| 637 | ****************************************************************************/ |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 638 | /* |
Lennert Buytenhek | b46926b | 2008-04-25 16:31:32 -0400 | [diff] [blame] | 639 | * Identify device ID and rev from PCIe configuration header space '0'. |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 640 | */ |
| 641 | static void __init orion5x_id(u32 *dev, u32 *rev, char **dev_name) |
| 642 | { |
| 643 | orion5x_pcie_id(dev, rev); |
| 644 | |
| 645 | if (*dev == MV88F5281_DEV_ID) { |
| 646 | if (*rev == MV88F5281_REV_D2) { |
| 647 | *dev_name = "MV88F5281-D2"; |
| 648 | } else if (*rev == MV88F5281_REV_D1) { |
| 649 | *dev_name = "MV88F5281-D1"; |
Lennert Buytenhek | ce72e36e | 2008-08-09 15:17:27 +0200 | [diff] [blame] | 650 | } else if (*rev == MV88F5281_REV_D0) { |
| 651 | *dev_name = "MV88F5281-D0"; |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 652 | } else { |
| 653 | *dev_name = "MV88F5281-Rev-Unsupported"; |
| 654 | } |
| 655 | } else if (*dev == MV88F5182_DEV_ID) { |
| 656 | if (*rev == MV88F5182_REV_A2) { |
| 657 | *dev_name = "MV88F5182-A2"; |
| 658 | } else { |
| 659 | *dev_name = "MV88F5182-Rev-Unsupported"; |
| 660 | } |
| 661 | } else if (*dev == MV88F5181_DEV_ID) { |
| 662 | if (*rev == MV88F5181_REV_B1) { |
| 663 | *dev_name = "MV88F5181-Rev-B1"; |
Lennert Buytenhek | d2b2a6b | 2008-05-31 08:30:40 +0200 | [diff] [blame] | 664 | } else if (*rev == MV88F5181L_REV_A1) { |
| 665 | *dev_name = "MV88F5181L-Rev-A1"; |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 666 | } else { |
Lennert Buytenhek | d2b2a6b | 2008-05-31 08:30:40 +0200 | [diff] [blame] | 667 | *dev_name = "MV88F5181(L)-Rev-Unsupported"; |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 668 | } |
Lennert Buytenhek | d323ade | 2008-08-29 06:55:06 +0200 | [diff] [blame] | 669 | } else if (*dev == MV88F6183_DEV_ID) { |
| 670 | if (*rev == MV88F6183_REV_B0) { |
| 671 | *dev_name = "MV88F6183-Rev-B0"; |
| 672 | } else { |
| 673 | *dev_name = "MV88F6183-Rev-Unsupported"; |
| 674 | } |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 675 | } else { |
| 676 | *dev_name = "Device-Unknown"; |
| 677 | } |
| 678 | } |
| 679 | |
| 680 | void __init orion5x_init(void) |
| 681 | { |
| 682 | char *dev_name; |
| 683 | u32 dev, rev; |
| 684 | |
| 685 | orion5x_id(&dev, &rev, &dev_name); |
Lennert Buytenhek | ebe35af | 2008-08-29 05:55:51 +0200 | [diff] [blame] | 686 | printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, orion5x_tclk); |
| 687 | |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame^] | 688 | orion5x_ge00_shared_data.t_clk = orion5x_tclk; |
Lennert Buytenhek | d323ade | 2008-08-29 06:55:06 +0200 | [diff] [blame] | 689 | orion5x_spi_plat_data.tclk = orion5x_tclk; |
Lennert Buytenhek | ebe35af | 2008-08-29 05:55:51 +0200 | [diff] [blame] | 690 | orion5x_uart0_data[0].uartclk = orion5x_tclk; |
| 691 | orion5x_uart1_data[0].uartclk = orion5x_tclk; |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 692 | |
| 693 | /* |
| 694 | * Setup Orion address map |
| 695 | */ |
| 696 | orion5x_setup_cpu_mbus_bridge(); |
Lennert Buytenhek | ce72e36e | 2008-08-09 15:17:27 +0200 | [diff] [blame] | 697 | |
| 698 | /* |
| 699 | * Don't issue "Wait for Interrupt" instruction if we are |
| 700 | * running on D0 5281 silicon. |
| 701 | */ |
| 702 | if (dev == MV88F5281_DEV_ID && rev == MV88F5281_REV_D0) { |
| 703 | printk(KERN_INFO "Orion: Applying 5281 D0 WFI workaround.\n"); |
| 704 | disable_hlt(); |
| 705 | } |
Thomas Reitmayr | 9e058d4 | 2009-02-24 14:59:22 -0800 | [diff] [blame] | 706 | |
| 707 | /* |
Nicolas Pitre | 3fade49 | 2009-06-11 22:27:20 +0200 | [diff] [blame] | 708 | * The 5082/5181l/5182/6082/6082l/6183 have crypto |
| 709 | * while 5180n/5181/5281 don't have crypto. |
| 710 | */ |
| 711 | if ((dev == MV88F5181_DEV_ID && rev >= MV88F5181L_REV_A0) || |
| 712 | dev == MV88F5182_DEV_ID || dev == MV88F6183_DEV_ID) |
| 713 | orion5x_crypto_init(); |
| 714 | |
| 715 | /* |
Thomas Reitmayr | 9e058d4 | 2009-02-24 14:59:22 -0800 | [diff] [blame] | 716 | * Register watchdog driver |
| 717 | */ |
| 718 | orion5x_wdt_init(); |
Lennert Buytenhek | 9dd0b19 | 2008-03-27 14:51:41 -0400 | [diff] [blame] | 719 | } |
| 720 | |
| 721 | /* |
| 722 | * Many orion-based systems have buggy bootloader implementations. |
| 723 | * This is a common fixup for bogus memory tags. |
| 724 | */ |
| 725 | void __init tag_fixup_mem32(struct machine_desc *mdesc, struct tag *t, |
| 726 | char **from, struct meminfo *meminfo) |
| 727 | { |
| 728 | for (; t->hdr.size; t = tag_next(t)) |
| 729 | if (t->hdr.tag == ATAG_MEM && |
| 730 | (!t->u.mem.size || t->u.mem.size & ~PAGE_MASK || |
| 731 | t->u.mem.start & ~PAGE_MASK)) { |
| 732 | printk(KERN_WARNING |
| 733 | "Clearing invalid memory bank %dKB@0x%08x\n", |
| 734 | t->u.mem.size / 1024, t->u.mem.start); |
| 735 | t->hdr.tag = 0; |
| 736 | } |
| 737 | } |