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.c112
1 files changed, 103 insertions, 9 deletions
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index b3404b7775b3..eeb00240d784 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -14,6 +14,7 @@
14#include <linux/serial_8250.h> 14#include <linux/serial_8250.h>
15#include <linux/mbus.h> 15#include <linux/mbus.h>
16#include <linux/mv643xx_eth.h> 16#include <linux/mv643xx_eth.h>
17#include <linux/mv643xx_i2c.h>
17#include <linux/ata_platform.h> 18#include <linux/ata_platform.h>
18#include <linux/spi/orion_spi.h> 19#include <linux/spi/orion_spi.h>
19#include <net/dsa.h> 20#include <net/dsa.h>
@@ -22,8 +23,10 @@
22#include <asm/mach/map.h> 23#include <asm/mach/map.h>
23#include <asm/mach/time.h> 24#include <asm/mach/time.h>
24#include <mach/kirkwood.h> 25#include <mach/kirkwood.h>
26#include <mach/bridge-regs.h>
25#include <plat/cache-feroceon-l2.h> 27#include <plat/cache-feroceon-l2.h>
26#include <plat/ehci-orion.h> 28#include <plat/ehci-orion.h>
29#include <plat/mvsdio.h>
27#include <plat/mv_xor.h> 30#include <plat/mv_xor.h>
28#include <plat/orion_nand.h> 31#include <plat/orion_nand.h>
29#include <plat/time.h> 32#include <plat/time.h>
@@ -231,14 +234,17 @@ static struct platform_device kirkwood_switch_device = {
231 234
232void __init kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq) 235void __init kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq)
233{ 236{
237 int i;
238
234 if (irq != NO_IRQ) { 239 if (irq != NO_IRQ) {
235 kirkwood_switch_resources[0].start = irq; 240 kirkwood_switch_resources[0].start = irq;
236 kirkwood_switch_resources[0].end = irq; 241 kirkwood_switch_resources[0].end = irq;
237 kirkwood_switch_device.num_resources = 1; 242 kirkwood_switch_device.num_resources = 1;
238 } 243 }
239 244
240 d->mii_bus = &kirkwood_ge00_shared.dev;
241 d->netdev = &kirkwood_ge00.dev; 245 d->netdev = &kirkwood_ge00.dev;
246 for (i = 0; i < d->nr_chips; i++)
247 d->chip[i].mii_bus = &kirkwood_ge00_shared.dev;
242 kirkwood_switch_device.dev.platform_data = d; 248 kirkwood_switch_device.dev.platform_data = d;
243 249
244 platform_device_register(&kirkwood_switch_device); 250 platform_device_register(&kirkwood_switch_device);
@@ -254,7 +260,7 @@ static struct resource kirkwood_rtc_resource = {
254 .flags = IORESOURCE_MEM, 260 .flags = IORESOURCE_MEM,
255}; 261};
256 262
257void __init kirkwood_rtc_init(void) 263static void __init kirkwood_rtc_init(void)
258{ 264{
259 platform_device_register_simple("rtc-mv", -1, &kirkwood_rtc_resource, 1); 265 platform_device_register_simple("rtc-mv", -1, &kirkwood_rtc_resource, 1);
260} 266}
@@ -296,6 +302,50 @@ void __init kirkwood_sata_init(struct mv_sata_platform_data *sata_data)
296 302
297 303
298/***************************************************************************** 304/*****************************************************************************
305 * SD/SDIO/MMC
306 ****************************************************************************/
307static struct resource mvsdio_resources[] = {
308 [0] = {
309 .start = SDIO_PHYS_BASE,
310 .end = SDIO_PHYS_BASE + SZ_1K - 1,
311 .flags = IORESOURCE_MEM,
312 },
313 [1] = {
314 .start = IRQ_KIRKWOOD_SDIO,
315 .end = IRQ_KIRKWOOD_SDIO,
316 .flags = IORESOURCE_IRQ,
317 },
318};
319
320static u64 mvsdio_dmamask = 0xffffffffUL;
321
322static struct platform_device kirkwood_sdio = {
323 .name = "mvsdio",
324 .id = -1,
325 .dev = {
326 .dma_mask = &mvsdio_dmamask,
327 .coherent_dma_mask = 0xffffffff,
328 },
329 .num_resources = ARRAY_SIZE(mvsdio_resources),
330 .resource = mvsdio_resources,
331};
332
333void __init kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data)
334{
335 u32 dev, rev;
336
337 kirkwood_pcie_id(&dev, &rev);
338 if (rev == 0) /* catch all Kirkwood Z0's */
339 mvsdio_data->clock = 100000000;
340 else
341 mvsdio_data->clock = 200000000;
342 mvsdio_data->dram = &kirkwood_mbus_dram_info;
343 kirkwood_sdio.dev.platform_data = mvsdio_data;
344 platform_device_register(&kirkwood_sdio);
345}
346
347
348/*****************************************************************************
299 * SPI 349 * SPI
300 ****************************************************************************/ 350 ****************************************************************************/
301static struct orion_spi_info kirkwood_spi_plat_data = { 351static struct orion_spi_info kirkwood_spi_plat_data = {
@@ -326,6 +376,45 @@ void __init kirkwood_spi_init()
326 376
327 377
328/***************************************************************************** 378/*****************************************************************************
379 * I2C
380 ****************************************************************************/
381static struct mv64xxx_i2c_pdata kirkwood_i2c_pdata = {
382 .freq_m = 8, /* assumes 166 MHz TCLK */
383 .freq_n = 3,
384 .timeout = 1000, /* Default timeout of 1 second */
385};
386
387static struct resource kirkwood_i2c_resources[] = {
388 {
389 .name = "i2c",
390 .start = I2C_PHYS_BASE,
391 .end = I2C_PHYS_BASE + 0x1f,
392 .flags = IORESOURCE_MEM,
393 }, {
394 .name = "i2c",
395 .start = IRQ_KIRKWOOD_TWSI,
396 .end = IRQ_KIRKWOOD_TWSI,
397 .flags = IORESOURCE_IRQ,
398 },
399};
400
401static struct platform_device kirkwood_i2c = {
402 .name = MV64XXX_I2C_CTLR_NAME,
403 .id = 0,
404 .num_resources = ARRAY_SIZE(kirkwood_i2c_resources),
405 .resource = kirkwood_i2c_resources,
406 .dev = {
407 .platform_data = &kirkwood_i2c_pdata,
408 },
409};
410
411void __init kirkwood_i2c_init(void)
412{
413 platform_device_register(&kirkwood_i2c);
414}
415
416
417/*****************************************************************************
329 * UART0 418 * UART0
330 ****************************************************************************/ 419 ****************************************************************************/
331static struct plat_serial8250_port kirkwood_uart0_data[] = { 420static struct plat_serial8250_port kirkwood_uart0_data[] = {
@@ -420,7 +509,7 @@ static struct mv_xor_platform_shared_data kirkwood_xor_shared_data = {
420 .dram = &kirkwood_mbus_dram_info, 509 .dram = &kirkwood_mbus_dram_info,
421}; 510};
422 511
423static u64 kirkwood_xor_dmamask = DMA_32BIT_MASK; 512static u64 kirkwood_xor_dmamask = DMA_BIT_MASK(32);
424 513
425 514
426/***************************************************************************** 515/*****************************************************************************
@@ -471,7 +560,7 @@ static struct platform_device kirkwood_xor00_channel = {
471 .resource = kirkwood_xor00_resources, 560 .resource = kirkwood_xor00_resources,
472 .dev = { 561 .dev = {
473 .dma_mask = &kirkwood_xor_dmamask, 562 .dma_mask = &kirkwood_xor_dmamask,
474 .coherent_dma_mask = DMA_64BIT_MASK, 563 .coherent_dma_mask = DMA_BIT_MASK(64),
475 .platform_data = (void *)&kirkwood_xor00_data, 564 .platform_data = (void *)&kirkwood_xor00_data,
476 }, 565 },
477}; 566};
@@ -497,12 +586,12 @@ static struct platform_device kirkwood_xor01_channel = {
497 .resource = kirkwood_xor01_resources, 586 .resource = kirkwood_xor01_resources,
498 .dev = { 587 .dev = {
499 .dma_mask = &kirkwood_xor_dmamask, 588 .dma_mask = &kirkwood_xor_dmamask,
500 .coherent_dma_mask = DMA_64BIT_MASK, 589 .coherent_dma_mask = DMA_BIT_MASK(64),
501 .platform_data = (void *)&kirkwood_xor01_data, 590 .platform_data = (void *)&kirkwood_xor01_data,
502 }, 591 },
503}; 592};
504 593
505void __init kirkwood_xor0_init(void) 594static void __init kirkwood_xor0_init(void)
506{ 595{
507 platform_device_register(&kirkwood_xor0_shared); 596 platform_device_register(&kirkwood_xor0_shared);
508 597
@@ -569,7 +658,7 @@ static struct platform_device kirkwood_xor10_channel = {
569 .resource = kirkwood_xor10_resources, 658 .resource = kirkwood_xor10_resources,
570 .dev = { 659 .dev = {
571 .dma_mask = &kirkwood_xor_dmamask, 660 .dma_mask = &kirkwood_xor_dmamask,
572 .coherent_dma_mask = DMA_64BIT_MASK, 661 .coherent_dma_mask = DMA_BIT_MASK(64),
573 .platform_data = (void *)&kirkwood_xor10_data, 662 .platform_data = (void *)&kirkwood_xor10_data,
574 }, 663 },
575}; 664};
@@ -595,12 +684,12 @@ static struct platform_device kirkwood_xor11_channel = {
595 .resource = kirkwood_xor11_resources, 684 .resource = kirkwood_xor11_resources,
596 .dev = { 685 .dev = {
597 .dma_mask = &kirkwood_xor_dmamask, 686 .dma_mask = &kirkwood_xor_dmamask,
598 .coherent_dma_mask = DMA_64BIT_MASK, 687 .coherent_dma_mask = DMA_BIT_MASK(64),
599 .platform_data = (void *)&kirkwood_xor11_data, 688 .platform_data = (void *)&kirkwood_xor11_data,
600 }, 689 },
601}; 690};
602 691
603void __init kirkwood_xor1_init(void) 692static void __init kirkwood_xor1_init(void)
604{ 693{
605 platform_device_register(&kirkwood_xor1_shared); 694 platform_device_register(&kirkwood_xor1_shared);
606 695
@@ -708,4 +797,9 @@ void __init kirkwood_init(void)
708#ifdef CONFIG_CACHE_FEROCEON_L2 797#ifdef CONFIG_CACHE_FEROCEON_L2
709 kirkwood_l2_init(); 798 kirkwood_l2_init();
710#endif 799#endif
800
801 /* internal devices that every board has */
802 kirkwood_rtc_init();
803 kirkwood_xor0_init();
804 kirkwood_xor1_init();
711} 805}