Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-dove/common.c |
| 3 | * |
| 4 | * Core functions for Marvell Dove 88AP510 System On Chip |
| 5 | * |
| 6 | * This file is licensed under the terms of the GNU General Public |
| 7 | * License version 2. This program is licensed "as is" without any |
| 8 | * warranty of any kind, whether express or implied. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/kernel.h> |
| 12 | #include <linux/delay.h> |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/pci.h> |
| 16 | #include <linux/serial_8250.h> |
| 17 | #include <linux/clk.h> |
| 18 | #include <linux/mbus.h> |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 19 | #include <linux/ata_platform.h> |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame] | 20 | #include <linux/serial_8250.h> |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 21 | #include <linux/spi/orion_spi.h> |
| 22 | #include <linux/gpio.h> |
| 23 | #include <asm/page.h> |
| 24 | #include <asm/setup.h> |
| 25 | #include <asm/timex.h> |
Lennert Buytenhek | 573a652 | 2009-11-24 19:33:52 +0200 | [diff] [blame] | 26 | #include <asm/hardware/cache-tauros2.h> |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 27 | #include <asm/mach/map.h> |
| 28 | #include <asm/mach/time.h> |
| 29 | #include <asm/mach/pci.h> |
| 30 | #include <mach/dove.h> |
| 31 | #include <mach/bridge-regs.h> |
| 32 | #include <asm/mach/arch.h> |
| 33 | #include <linux/irq.h> |
| 34 | #include <plat/mv_xor.h> |
| 35 | #include <plat/ehci-orion.h> |
| 36 | #include <plat/time.h> |
Andrew Lunn | 28a2b45 | 2011-05-15 13:32:41 +0200 | [diff] [blame] | 37 | #include <plat/common.h> |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 38 | #include "common.h" |
| 39 | |
Andrew Lunn | 28a2b45 | 2011-05-15 13:32:41 +0200 | [diff] [blame] | 40 | static int get_tclk(void); |
| 41 | |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 42 | /***************************************************************************** |
| 43 | * I/O Address Mapping |
| 44 | ****************************************************************************/ |
| 45 | static struct map_desc dove_io_desc[] __initdata = { |
| 46 | { |
| 47 | .virtual = DOVE_SB_REGS_VIRT_BASE, |
| 48 | .pfn = __phys_to_pfn(DOVE_SB_REGS_PHYS_BASE), |
| 49 | .length = DOVE_SB_REGS_SIZE, |
| 50 | .type = MT_DEVICE, |
| 51 | }, { |
| 52 | .virtual = DOVE_NB_REGS_VIRT_BASE, |
| 53 | .pfn = __phys_to_pfn(DOVE_NB_REGS_PHYS_BASE), |
| 54 | .length = DOVE_NB_REGS_SIZE, |
| 55 | .type = MT_DEVICE, |
| 56 | }, { |
| 57 | .virtual = DOVE_PCIE0_IO_VIRT_BASE, |
| 58 | .pfn = __phys_to_pfn(DOVE_PCIE0_IO_PHYS_BASE), |
| 59 | .length = DOVE_PCIE0_IO_SIZE, |
| 60 | .type = MT_DEVICE, |
| 61 | }, { |
| 62 | .virtual = DOVE_PCIE1_IO_VIRT_BASE, |
| 63 | .pfn = __phys_to_pfn(DOVE_PCIE1_IO_PHYS_BASE), |
| 64 | .length = DOVE_PCIE1_IO_SIZE, |
| 65 | .type = MT_DEVICE, |
| 66 | }, |
| 67 | }; |
| 68 | |
| 69 | void __init dove_map_io(void) |
| 70 | { |
| 71 | iotable_init(dove_io_desc, ARRAY_SIZE(dove_io_desc)); |
| 72 | } |
| 73 | |
| 74 | /***************************************************************************** |
| 75 | * EHCI |
| 76 | ****************************************************************************/ |
| 77 | static struct orion_ehci_data dove_ehci_data = { |
| 78 | .dram = &dove_mbus_dram_info, |
| 79 | .phy_version = EHCI_PHY_NA, |
| 80 | }; |
| 81 | |
| 82 | static u64 ehci_dmamask = DMA_BIT_MASK(32); |
| 83 | |
| 84 | /***************************************************************************** |
| 85 | * EHCI0 |
| 86 | ****************************************************************************/ |
| 87 | static struct resource dove_ehci0_resources[] = { |
| 88 | { |
| 89 | .start = DOVE_USB0_PHYS_BASE, |
| 90 | .end = DOVE_USB0_PHYS_BASE + SZ_4K - 1, |
| 91 | .flags = IORESOURCE_MEM, |
| 92 | }, { |
| 93 | .start = IRQ_DOVE_USB0, |
| 94 | .end = IRQ_DOVE_USB0, |
| 95 | .flags = IORESOURCE_IRQ, |
| 96 | }, |
| 97 | }; |
| 98 | |
| 99 | static struct platform_device dove_ehci0 = { |
| 100 | .name = "orion-ehci", |
| 101 | .id = 0, |
| 102 | .dev = { |
| 103 | .dma_mask = &ehci_dmamask, |
| 104 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 105 | .platform_data = &dove_ehci_data, |
| 106 | }, |
| 107 | .resource = dove_ehci0_resources, |
| 108 | .num_resources = ARRAY_SIZE(dove_ehci0_resources), |
| 109 | }; |
| 110 | |
| 111 | void __init dove_ehci0_init(void) |
| 112 | { |
| 113 | platform_device_register(&dove_ehci0); |
| 114 | } |
| 115 | |
| 116 | /***************************************************************************** |
| 117 | * EHCI1 |
| 118 | ****************************************************************************/ |
| 119 | static struct resource dove_ehci1_resources[] = { |
| 120 | { |
| 121 | .start = DOVE_USB1_PHYS_BASE, |
| 122 | .end = DOVE_USB1_PHYS_BASE + SZ_4K - 1, |
| 123 | .flags = IORESOURCE_MEM, |
| 124 | }, { |
| 125 | .start = IRQ_DOVE_USB1, |
| 126 | .end = IRQ_DOVE_USB1, |
| 127 | .flags = IORESOURCE_IRQ, |
| 128 | }, |
| 129 | }; |
| 130 | |
| 131 | static struct platform_device dove_ehci1 = { |
| 132 | .name = "orion-ehci", |
| 133 | .id = 1, |
| 134 | .dev = { |
| 135 | .dma_mask = &ehci_dmamask, |
| 136 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 137 | .platform_data = &dove_ehci_data, |
| 138 | }, |
| 139 | .resource = dove_ehci1_resources, |
| 140 | .num_resources = ARRAY_SIZE(dove_ehci1_resources), |
| 141 | }; |
| 142 | |
| 143 | void __init dove_ehci1_init(void) |
| 144 | { |
| 145 | platform_device_register(&dove_ehci1); |
| 146 | } |
| 147 | |
| 148 | /***************************************************************************** |
| 149 | * GE00 |
| 150 | ****************************************************************************/ |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 151 | void __init dove_ge00_init(struct mv643xx_eth_platform_data *eth_data) |
| 152 | { |
Andrew Lunn | 7e3819d | 2011-05-15 13:32:44 +0200 | [diff] [blame] | 153 | orion_ge00_init(eth_data, &dove_mbus_dram_info, |
| 154 | DOVE_GE00_PHYS_BASE, IRQ_DOVE_GE00_SUM, |
| 155 | 0, get_tclk()); |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 156 | } |
| 157 | |
| 158 | /***************************************************************************** |
| 159 | * SoC RTC |
| 160 | ****************************************************************************/ |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 161 | void __init dove_rtc_init(void) |
| 162 | { |
Andrew Lunn | f6eaccb | 2011-05-15 13:32:42 +0200 | [diff] [blame] | 163 | orion_rtc_init(DOVE_RTC_PHYS_BASE, IRQ_DOVE_RTC); |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | /***************************************************************************** |
| 167 | * SATA |
| 168 | ****************************************************************************/ |
| 169 | static struct resource dove_sata_resources[] = { |
| 170 | { |
| 171 | .name = "sata base", |
| 172 | .start = DOVE_SATA_PHYS_BASE, |
| 173 | .end = DOVE_SATA_PHYS_BASE + 0x5000 - 1, |
| 174 | .flags = IORESOURCE_MEM, |
| 175 | }, { |
| 176 | .name = "sata irq", |
| 177 | .start = IRQ_DOVE_SATA, |
| 178 | .end = IRQ_DOVE_SATA, |
| 179 | .flags = IORESOURCE_IRQ, |
| 180 | }, |
| 181 | }; |
| 182 | |
| 183 | static struct platform_device dove_sata = { |
| 184 | .name = "sata_mv", |
| 185 | .id = 0, |
| 186 | .dev = { |
| 187 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 188 | }, |
| 189 | .num_resources = ARRAY_SIZE(dove_sata_resources), |
| 190 | .resource = dove_sata_resources, |
| 191 | }; |
| 192 | |
| 193 | void __init dove_sata_init(struct mv_sata_platform_data *sata_data) |
| 194 | { |
| 195 | sata_data->dram = &dove_mbus_dram_info; |
| 196 | dove_sata.dev.platform_data = sata_data; |
| 197 | platform_device_register(&dove_sata); |
| 198 | } |
| 199 | |
| 200 | /***************************************************************************** |
| 201 | * UART0 |
| 202 | ****************************************************************************/ |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 203 | void __init dove_uart0_init(void) |
| 204 | { |
Andrew Lunn | 28a2b45 | 2011-05-15 13:32:41 +0200 | [diff] [blame] | 205 | orion_uart0_init(DOVE_UART0_VIRT_BASE, DOVE_UART0_PHYS_BASE, |
| 206 | IRQ_DOVE_UART_0, get_tclk()); |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 207 | } |
| 208 | |
| 209 | /***************************************************************************** |
| 210 | * UART1 |
| 211 | ****************************************************************************/ |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 212 | void __init dove_uart1_init(void) |
| 213 | { |
Andrew Lunn | 28a2b45 | 2011-05-15 13:32:41 +0200 | [diff] [blame] | 214 | orion_uart1_init(DOVE_UART1_VIRT_BASE, DOVE_UART1_PHYS_BASE, |
| 215 | IRQ_DOVE_UART_1, get_tclk()); |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 216 | } |
| 217 | |
| 218 | /***************************************************************************** |
| 219 | * UART2 |
| 220 | ****************************************************************************/ |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 221 | void __init dove_uart2_init(void) |
| 222 | { |
Andrew Lunn | 28a2b45 | 2011-05-15 13:32:41 +0200 | [diff] [blame] | 223 | orion_uart2_init(DOVE_UART2_VIRT_BASE, DOVE_UART2_PHYS_BASE, |
| 224 | IRQ_DOVE_UART_2, get_tclk()); |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 225 | } |
| 226 | |
| 227 | /***************************************************************************** |
| 228 | * UART3 |
| 229 | ****************************************************************************/ |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 230 | void __init dove_uart3_init(void) |
| 231 | { |
Andrew Lunn | 28a2b45 | 2011-05-15 13:32:41 +0200 | [diff] [blame] | 232 | orion_uart3_init(DOVE_UART3_VIRT_BASE, DOVE_UART3_PHYS_BASE, |
| 233 | IRQ_DOVE_UART_3, get_tclk()); |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 234 | } |
| 235 | |
| 236 | /***************************************************************************** |
| 237 | * SPI0 |
| 238 | ****************************************************************************/ |
| 239 | static struct orion_spi_info dove_spi0_data = { |
| 240 | .tclk = 0, |
| 241 | }; |
| 242 | |
| 243 | static struct resource dove_spi0_resources[] = { |
| 244 | { |
| 245 | .start = DOVE_SPI0_PHYS_BASE, |
| 246 | .end = DOVE_SPI0_PHYS_BASE + SZ_512 - 1, |
| 247 | .flags = IORESOURCE_MEM, |
| 248 | }, { |
| 249 | .start = IRQ_DOVE_SPI0, |
| 250 | .end = IRQ_DOVE_SPI0, |
| 251 | .flags = IORESOURCE_IRQ, |
| 252 | }, |
| 253 | }; |
| 254 | |
| 255 | static struct platform_device dove_spi0 = { |
| 256 | .name = "orion_spi", |
| 257 | .id = 0, |
| 258 | .resource = dove_spi0_resources, |
| 259 | .dev = { |
| 260 | .platform_data = &dove_spi0_data, |
| 261 | }, |
| 262 | .num_resources = ARRAY_SIZE(dove_spi0_resources), |
| 263 | }; |
| 264 | |
| 265 | void __init dove_spi0_init(void) |
| 266 | { |
| 267 | platform_device_register(&dove_spi0); |
| 268 | } |
| 269 | |
| 270 | /***************************************************************************** |
| 271 | * SPI1 |
| 272 | ****************************************************************************/ |
| 273 | static struct orion_spi_info dove_spi1_data = { |
| 274 | .tclk = 0, |
| 275 | }; |
| 276 | |
| 277 | static struct resource dove_spi1_resources[] = { |
| 278 | { |
| 279 | .start = DOVE_SPI1_PHYS_BASE, |
| 280 | .end = DOVE_SPI1_PHYS_BASE + SZ_512 - 1, |
| 281 | .flags = IORESOURCE_MEM, |
| 282 | }, { |
| 283 | .start = IRQ_DOVE_SPI1, |
| 284 | .end = IRQ_DOVE_SPI1, |
| 285 | .flags = IORESOURCE_IRQ, |
| 286 | }, |
| 287 | }; |
| 288 | |
| 289 | static struct platform_device dove_spi1 = { |
| 290 | .name = "orion_spi", |
| 291 | .id = 1, |
| 292 | .resource = dove_spi1_resources, |
| 293 | .dev = { |
| 294 | .platform_data = &dove_spi1_data, |
| 295 | }, |
| 296 | .num_resources = ARRAY_SIZE(dove_spi1_resources), |
| 297 | }; |
| 298 | |
| 299 | void __init dove_spi1_init(void) |
| 300 | { |
| 301 | platform_device_register(&dove_spi1); |
| 302 | } |
| 303 | |
| 304 | /***************************************************************************** |
| 305 | * I2C |
| 306 | ****************************************************************************/ |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 307 | void __init dove_i2c_init(void) |
| 308 | { |
Andrew Lunn | aac7ffa | 2011-05-15 13:32:45 +0200 | [diff] [blame^] | 309 | orion_i2c_init(DOVE_I2C_PHYS_BASE, IRQ_DOVE_I2C, 10); |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 310 | } |
| 311 | |
| 312 | /***************************************************************************** |
| 313 | * Time handling |
| 314 | ****************************************************************************/ |
Lennert Buytenhek | 4ee1f6b | 2010-10-15 16:50:26 +0200 | [diff] [blame] | 315 | void __init dove_init_early(void) |
| 316 | { |
| 317 | orion_time_set_base(TIMER_VIRT_BASE); |
| 318 | } |
| 319 | |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 320 | static int get_tclk(void) |
| 321 | { |
| 322 | /* use DOVE_RESET_SAMPLE_HI/LO to detect tclk */ |
| 323 | return 166666667; |
| 324 | } |
| 325 | |
| 326 | static void dove_timer_init(void) |
| 327 | { |
Lennert Buytenhek | 4ee1f6b | 2010-10-15 16:50:26 +0200 | [diff] [blame] | 328 | orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR, |
| 329 | IRQ_DOVE_BRIDGE, get_tclk()); |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 330 | } |
| 331 | |
| 332 | struct sys_timer dove_timer = { |
| 333 | .init = dove_timer_init, |
| 334 | }; |
| 335 | |
| 336 | /***************************************************************************** |
| 337 | * XOR |
| 338 | ****************************************************************************/ |
| 339 | static struct mv_xor_platform_shared_data dove_xor_shared_data = { |
| 340 | .dram = &dove_mbus_dram_info, |
| 341 | }; |
| 342 | |
| 343 | /***************************************************************************** |
| 344 | * XOR 0 |
| 345 | ****************************************************************************/ |
| 346 | static u64 dove_xor0_dmamask = DMA_BIT_MASK(32); |
| 347 | |
| 348 | static struct resource dove_xor0_shared_resources[] = { |
| 349 | { |
| 350 | .name = "xor 0 low", |
| 351 | .start = DOVE_XOR0_PHYS_BASE, |
| 352 | .end = DOVE_XOR0_PHYS_BASE + 0xff, |
| 353 | .flags = IORESOURCE_MEM, |
| 354 | }, { |
| 355 | .name = "xor 0 high", |
| 356 | .start = DOVE_XOR0_HIGH_PHYS_BASE, |
| 357 | .end = DOVE_XOR0_HIGH_PHYS_BASE + 0xff, |
| 358 | .flags = IORESOURCE_MEM, |
| 359 | }, |
| 360 | }; |
| 361 | |
| 362 | static struct platform_device dove_xor0_shared = { |
| 363 | .name = MV_XOR_SHARED_NAME, |
| 364 | .id = 0, |
| 365 | .dev = { |
| 366 | .platform_data = &dove_xor_shared_data, |
| 367 | }, |
| 368 | .num_resources = ARRAY_SIZE(dove_xor0_shared_resources), |
| 369 | .resource = dove_xor0_shared_resources, |
| 370 | }; |
| 371 | |
| 372 | static struct resource dove_xor00_resources[] = { |
| 373 | [0] = { |
| 374 | .start = IRQ_DOVE_XOR_00, |
| 375 | .end = IRQ_DOVE_XOR_00, |
| 376 | .flags = IORESOURCE_IRQ, |
| 377 | }, |
| 378 | }; |
| 379 | |
| 380 | static struct mv_xor_platform_data dove_xor00_data = { |
| 381 | .shared = &dove_xor0_shared, |
| 382 | .hw_id = 0, |
| 383 | .pool_size = PAGE_SIZE, |
| 384 | }; |
| 385 | |
| 386 | static struct platform_device dove_xor00_channel = { |
| 387 | .name = MV_XOR_NAME, |
| 388 | .id = 0, |
| 389 | .num_resources = ARRAY_SIZE(dove_xor00_resources), |
| 390 | .resource = dove_xor00_resources, |
| 391 | .dev = { |
| 392 | .dma_mask = &dove_xor0_dmamask, |
| 393 | .coherent_dma_mask = DMA_BIT_MASK(64), |
H Hartley Sweeten | 639b9be | 2010-01-29 15:30:53 -0700 | [diff] [blame] | 394 | .platform_data = &dove_xor00_data, |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 395 | }, |
| 396 | }; |
| 397 | |
| 398 | static struct resource dove_xor01_resources[] = { |
| 399 | [0] = { |
| 400 | .start = IRQ_DOVE_XOR_01, |
| 401 | .end = IRQ_DOVE_XOR_01, |
| 402 | .flags = IORESOURCE_IRQ, |
| 403 | }, |
| 404 | }; |
| 405 | |
| 406 | static struct mv_xor_platform_data dove_xor01_data = { |
| 407 | .shared = &dove_xor0_shared, |
| 408 | .hw_id = 1, |
| 409 | .pool_size = PAGE_SIZE, |
| 410 | }; |
| 411 | |
| 412 | static struct platform_device dove_xor01_channel = { |
| 413 | .name = MV_XOR_NAME, |
| 414 | .id = 1, |
| 415 | .num_resources = ARRAY_SIZE(dove_xor01_resources), |
| 416 | .resource = dove_xor01_resources, |
| 417 | .dev = { |
| 418 | .dma_mask = &dove_xor0_dmamask, |
| 419 | .coherent_dma_mask = DMA_BIT_MASK(64), |
H Hartley Sweeten | 639b9be | 2010-01-29 15:30:53 -0700 | [diff] [blame] | 420 | .platform_data = &dove_xor01_data, |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 421 | }, |
| 422 | }; |
| 423 | |
| 424 | void __init dove_xor0_init(void) |
| 425 | { |
| 426 | platform_device_register(&dove_xor0_shared); |
| 427 | |
| 428 | /* |
| 429 | * two engines can't do memset simultaneously, this limitation |
| 430 | * satisfied by removing memset support from one of the engines. |
| 431 | */ |
| 432 | dma_cap_set(DMA_MEMCPY, dove_xor00_data.cap_mask); |
| 433 | dma_cap_set(DMA_XOR, dove_xor00_data.cap_mask); |
| 434 | platform_device_register(&dove_xor00_channel); |
| 435 | |
| 436 | dma_cap_set(DMA_MEMCPY, dove_xor01_data.cap_mask); |
| 437 | dma_cap_set(DMA_MEMSET, dove_xor01_data.cap_mask); |
| 438 | dma_cap_set(DMA_XOR, dove_xor01_data.cap_mask); |
| 439 | platform_device_register(&dove_xor01_channel); |
| 440 | } |
| 441 | |
| 442 | /***************************************************************************** |
| 443 | * XOR 1 |
| 444 | ****************************************************************************/ |
| 445 | static u64 dove_xor1_dmamask = DMA_BIT_MASK(32); |
| 446 | |
| 447 | static struct resource dove_xor1_shared_resources[] = { |
| 448 | { |
| 449 | .name = "xor 0 low", |
| 450 | .start = DOVE_XOR1_PHYS_BASE, |
| 451 | .end = DOVE_XOR1_PHYS_BASE + 0xff, |
| 452 | .flags = IORESOURCE_MEM, |
| 453 | }, { |
| 454 | .name = "xor 0 high", |
| 455 | .start = DOVE_XOR1_HIGH_PHYS_BASE, |
| 456 | .end = DOVE_XOR1_HIGH_PHYS_BASE + 0xff, |
| 457 | .flags = IORESOURCE_MEM, |
| 458 | }, |
| 459 | }; |
| 460 | |
| 461 | static struct platform_device dove_xor1_shared = { |
| 462 | .name = MV_XOR_SHARED_NAME, |
| 463 | .id = 1, |
| 464 | .dev = { |
| 465 | .platform_data = &dove_xor_shared_data, |
| 466 | }, |
| 467 | .num_resources = ARRAY_SIZE(dove_xor1_shared_resources), |
| 468 | .resource = dove_xor1_shared_resources, |
| 469 | }; |
| 470 | |
| 471 | static struct resource dove_xor10_resources[] = { |
| 472 | [0] = { |
| 473 | .start = IRQ_DOVE_XOR_10, |
| 474 | .end = IRQ_DOVE_XOR_10, |
| 475 | .flags = IORESOURCE_IRQ, |
| 476 | }, |
| 477 | }; |
| 478 | |
| 479 | static struct mv_xor_platform_data dove_xor10_data = { |
| 480 | .shared = &dove_xor1_shared, |
| 481 | .hw_id = 0, |
| 482 | .pool_size = PAGE_SIZE, |
| 483 | }; |
| 484 | |
| 485 | static struct platform_device dove_xor10_channel = { |
| 486 | .name = MV_XOR_NAME, |
| 487 | .id = 2, |
| 488 | .num_resources = ARRAY_SIZE(dove_xor10_resources), |
| 489 | .resource = dove_xor10_resources, |
| 490 | .dev = { |
| 491 | .dma_mask = &dove_xor1_dmamask, |
| 492 | .coherent_dma_mask = DMA_BIT_MASK(64), |
H Hartley Sweeten | 639b9be | 2010-01-29 15:30:53 -0700 | [diff] [blame] | 493 | .platform_data = &dove_xor10_data, |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 494 | }, |
| 495 | }; |
| 496 | |
| 497 | static struct resource dove_xor11_resources[] = { |
| 498 | [0] = { |
| 499 | .start = IRQ_DOVE_XOR_11, |
| 500 | .end = IRQ_DOVE_XOR_11, |
| 501 | .flags = IORESOURCE_IRQ, |
| 502 | }, |
| 503 | }; |
| 504 | |
| 505 | static struct mv_xor_platform_data dove_xor11_data = { |
| 506 | .shared = &dove_xor1_shared, |
| 507 | .hw_id = 1, |
| 508 | .pool_size = PAGE_SIZE, |
| 509 | }; |
| 510 | |
| 511 | static struct platform_device dove_xor11_channel = { |
| 512 | .name = MV_XOR_NAME, |
| 513 | .id = 3, |
| 514 | .num_resources = ARRAY_SIZE(dove_xor11_resources), |
| 515 | .resource = dove_xor11_resources, |
| 516 | .dev = { |
| 517 | .dma_mask = &dove_xor1_dmamask, |
| 518 | .coherent_dma_mask = DMA_BIT_MASK(64), |
H Hartley Sweeten | 639b9be | 2010-01-29 15:30:53 -0700 | [diff] [blame] | 519 | .platform_data = &dove_xor11_data, |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 520 | }, |
| 521 | }; |
| 522 | |
| 523 | void __init dove_xor1_init(void) |
| 524 | { |
| 525 | platform_device_register(&dove_xor1_shared); |
| 526 | |
| 527 | /* |
| 528 | * two engines can't do memset simultaneously, this limitation |
| 529 | * satisfied by removing memset support from one of the engines. |
| 530 | */ |
| 531 | dma_cap_set(DMA_MEMCPY, dove_xor10_data.cap_mask); |
| 532 | dma_cap_set(DMA_XOR, dove_xor10_data.cap_mask); |
| 533 | platform_device_register(&dove_xor10_channel); |
| 534 | |
| 535 | dma_cap_set(DMA_MEMCPY, dove_xor11_data.cap_mask); |
| 536 | dma_cap_set(DMA_MEMSET, dove_xor11_data.cap_mask); |
| 537 | dma_cap_set(DMA_XOR, dove_xor11_data.cap_mask); |
| 538 | platform_device_register(&dove_xor11_channel); |
| 539 | } |
| 540 | |
Saeed Bishara | 16bc90a | 2010-05-06 16:12:06 +0300 | [diff] [blame] | 541 | /***************************************************************************** |
| 542 | * SDIO |
| 543 | ****************************************************************************/ |
| 544 | static u64 sdio_dmamask = DMA_BIT_MASK(32); |
| 545 | |
| 546 | static struct resource dove_sdio0_resources[] = { |
| 547 | { |
| 548 | .start = DOVE_SDIO0_PHYS_BASE, |
| 549 | .end = DOVE_SDIO0_PHYS_BASE + 0xff, |
| 550 | .flags = IORESOURCE_MEM, |
| 551 | }, { |
| 552 | .start = IRQ_DOVE_SDIO0, |
| 553 | .end = IRQ_DOVE_SDIO0, |
| 554 | .flags = IORESOURCE_IRQ, |
| 555 | }, |
| 556 | }; |
| 557 | |
| 558 | static struct platform_device dove_sdio0 = { |
Mike Rapoport | 930e2fe | 2010-10-28 21:23:53 +0200 | [diff] [blame] | 559 | .name = "sdhci-dove", |
Saeed Bishara | 16bc90a | 2010-05-06 16:12:06 +0300 | [diff] [blame] | 560 | .id = 0, |
| 561 | .dev = { |
| 562 | .dma_mask = &sdio_dmamask, |
| 563 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 564 | }, |
| 565 | .resource = dove_sdio0_resources, |
| 566 | .num_resources = ARRAY_SIZE(dove_sdio0_resources), |
| 567 | }; |
| 568 | |
| 569 | void __init dove_sdio0_init(void) |
| 570 | { |
| 571 | platform_device_register(&dove_sdio0); |
| 572 | } |
| 573 | |
| 574 | static struct resource dove_sdio1_resources[] = { |
| 575 | { |
| 576 | .start = DOVE_SDIO1_PHYS_BASE, |
| 577 | .end = DOVE_SDIO1_PHYS_BASE + 0xff, |
| 578 | .flags = IORESOURCE_MEM, |
| 579 | }, { |
| 580 | .start = IRQ_DOVE_SDIO1, |
| 581 | .end = IRQ_DOVE_SDIO1, |
| 582 | .flags = IORESOURCE_IRQ, |
| 583 | }, |
| 584 | }; |
| 585 | |
| 586 | static struct platform_device dove_sdio1 = { |
Mike Rapoport | 930e2fe | 2010-10-28 21:23:53 +0200 | [diff] [blame] | 587 | .name = "sdhci-dove", |
Saeed Bishara | 16bc90a | 2010-05-06 16:12:06 +0300 | [diff] [blame] | 588 | .id = 1, |
| 589 | .dev = { |
| 590 | .dma_mask = &sdio_dmamask, |
| 591 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 592 | }, |
| 593 | .resource = dove_sdio1_resources, |
| 594 | .num_resources = ARRAY_SIZE(dove_sdio1_resources), |
| 595 | }; |
| 596 | |
| 597 | void __init dove_sdio1_init(void) |
| 598 | { |
| 599 | platform_device_register(&dove_sdio1); |
| 600 | } |
| 601 | |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 602 | void __init dove_init(void) |
| 603 | { |
| 604 | int tclk; |
| 605 | |
| 606 | tclk = get_tclk(); |
| 607 | |
| 608 | printk(KERN_INFO "Dove 88AP510 SoC, "); |
| 609 | printk(KERN_INFO "TCLK = %dMHz\n", (tclk + 499999) / 1000000); |
| 610 | |
Lennert Buytenhek | 573a652 | 2009-11-24 19:33:52 +0200 | [diff] [blame] | 611 | #ifdef CONFIG_CACHE_TAUROS2 |
| 612 | tauros2_init(); |
| 613 | #endif |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 614 | dove_setup_cpu_mbus(); |
| 615 | |
Saeed Bishara | edabd38 | 2009-08-06 15:12:43 +0300 | [diff] [blame] | 616 | dove_spi0_data.tclk = tclk; |
| 617 | dove_spi1_data.tclk = tclk; |
| 618 | |
| 619 | /* internal devices that every board has */ |
| 620 | dove_rtc_init(); |
| 621 | dove_xor0_init(); |
| 622 | dove_xor1_init(); |
| 623 | } |