diff options
Diffstat (limited to 'arch/arm/mach-kirkwood/common.c')
-rw-r--r-- | arch/arm/mach-kirkwood/common.c | 84 |
1 files changed, 65 insertions, 19 deletions
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index 189f16f3619d..85cad05d8c5b 100644 --- a/arch/arm/mach-kirkwood/common.c +++ b/arch/arm/mach-kirkwood/common.c | |||
@@ -98,7 +98,6 @@ void __init kirkwood_ehci_init(void) | |||
98 | * GE00 | 98 | * GE00 |
99 | ****************************************************************************/ | 99 | ****************************************************************************/ |
100 | struct mv643xx_eth_shared_platform_data kirkwood_ge00_shared_data = { | 100 | struct mv643xx_eth_shared_platform_data kirkwood_ge00_shared_data = { |
101 | .t_clk = KIRKWOOD_TCLK, | ||
102 | .dram = &kirkwood_mbus_dram_info, | 101 | .dram = &kirkwood_mbus_dram_info, |
103 | }; | 102 | }; |
104 | 103 | ||
@@ -108,6 +107,11 @@ static struct resource kirkwood_ge00_shared_resources[] = { | |||
108 | .start = GE00_PHYS_BASE + 0x2000, | 107 | .start = GE00_PHYS_BASE + 0x2000, |
109 | .end = GE00_PHYS_BASE + 0x3fff, | 108 | .end = GE00_PHYS_BASE + 0x3fff, |
110 | .flags = IORESOURCE_MEM, | 109 | .flags = IORESOURCE_MEM, |
110 | }, { | ||
111 | .name = "ge00 err irq", | ||
112 | .start = IRQ_KIRKWOOD_GE00_ERR, | ||
113 | .end = IRQ_KIRKWOOD_GE00_ERR, | ||
114 | .flags = IORESOURCE_IRQ, | ||
111 | }, | 115 | }, |
112 | }; | 116 | }; |
113 | 117 | ||
@@ -117,7 +121,7 @@ static struct platform_device kirkwood_ge00_shared = { | |||
117 | .dev = { | 121 | .dev = { |
118 | .platform_data = &kirkwood_ge00_shared_data, | 122 | .platform_data = &kirkwood_ge00_shared_data, |
119 | }, | 123 | }, |
120 | .num_resources = 1, | 124 | .num_resources = ARRAY_SIZE(kirkwood_ge00_shared_resources), |
121 | .resource = kirkwood_ge00_shared_resources, | 125 | .resource = kirkwood_ge00_shared_resources, |
122 | }; | 126 | }; |
123 | 127 | ||
@@ -201,7 +205,6 @@ void __init kirkwood_sata_init(struct mv_sata_platform_data *sata_data) | |||
201 | * SPI | 205 | * SPI |
202 | ****************************************************************************/ | 206 | ****************************************************************************/ |
203 | static struct orion_spi_info kirkwood_spi_plat_data = { | 207 | static struct orion_spi_info kirkwood_spi_plat_data = { |
204 | .tclk = KIRKWOOD_TCLK, | ||
205 | }; | 208 | }; |
206 | 209 | ||
207 | static struct resource kirkwood_spi_resources[] = { | 210 | static struct resource kirkwood_spi_resources[] = { |
@@ -239,7 +242,7 @@ static struct plat_serial8250_port kirkwood_uart0_data[] = { | |||
239 | .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF, | 242 | .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF, |
240 | .iotype = UPIO_MEM, | 243 | .iotype = UPIO_MEM, |
241 | .regshift = 2, | 244 | .regshift = 2, |
242 | .uartclk = KIRKWOOD_TCLK, | 245 | .uartclk = 0, |
243 | }, { | 246 | }, { |
244 | }, | 247 | }, |
245 | }; | 248 | }; |
@@ -283,7 +286,7 @@ static struct plat_serial8250_port kirkwood_uart1_data[] = { | |||
283 | .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF, | 286 | .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF, |
284 | .iotype = UPIO_MEM, | 287 | .iotype = UPIO_MEM, |
285 | .regshift = 2, | 288 | .regshift = 2, |
286 | .uartclk = KIRKWOOD_TCLK, | 289 | .uartclk = 0, |
287 | }, { | 290 | }, { |
288 | }, | 291 | }, |
289 | }; | 292 | }; |
@@ -525,9 +528,23 @@ void __init kirkwood_xor1_init(void) | |||
525 | /***************************************************************************** | 528 | /***************************************************************************** |
526 | * Time handling | 529 | * Time handling |
527 | ****************************************************************************/ | 530 | ****************************************************************************/ |
531 | int kirkwood_tclk; | ||
532 | |||
533 | int __init kirkwood_find_tclk(void) | ||
534 | { | ||
535 | u32 dev, rev; | ||
536 | |||
537 | kirkwood_pcie_id(&dev, &rev); | ||
538 | if (dev == MV88F6281_DEV_ID && rev == MV88F6281_REV_A0) | ||
539 | return 200000000; | ||
540 | |||
541 | return 166666667; | ||
542 | } | ||
543 | |||
528 | static void kirkwood_timer_init(void) | 544 | static void kirkwood_timer_init(void) |
529 | { | 545 | { |
530 | orion_time_init(IRQ_KIRKWOOD_BRIDGE, KIRKWOOD_TCLK); | 546 | kirkwood_tclk = kirkwood_find_tclk(); |
547 | orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); | ||
531 | } | 548 | } |
532 | 549 | ||
533 | struct sys_timer kirkwood_timer = { | 550 | struct sys_timer kirkwood_timer = { |
@@ -538,33 +555,62 @@ struct sys_timer kirkwood_timer = { | |||
538 | /***************************************************************************** | 555 | /***************************************************************************** |
539 | * General | 556 | * General |
540 | ****************************************************************************/ | 557 | ****************************************************************************/ |
558 | /* | ||
559 | * Identify device ID and revision. | ||
560 | */ | ||
541 | static char * __init kirkwood_id(void) | 561 | static char * __init kirkwood_id(void) |
542 | { | 562 | { |
543 | switch (readl(DEVICE_ID) & 0x3) { | 563 | u32 dev, rev; |
544 | case 0: | 564 | |
545 | return "88F6180"; | 565 | kirkwood_pcie_id(&dev, &rev); |
546 | case 1: | 566 | |
547 | return "88F6192"; | 567 | if (dev == MV88F6281_DEV_ID) { |
548 | case 2: | 568 | if (rev == MV88F6281_REV_Z0) |
549 | return "88F6281"; | 569 | return "MV88F6281-Z0"; |
570 | else if (rev == MV88F6281_REV_A0) | ||
571 | return "MV88F6281-A0"; | ||
572 | else | ||
573 | return "MV88F6281-Rev-Unsupported"; | ||
574 | } else if (dev == MV88F6192_DEV_ID) { | ||
575 | if (rev == MV88F6192_REV_Z0) | ||
576 | return "MV88F6192-Z0"; | ||
577 | else if (rev == MV88F6192_REV_A0) | ||
578 | return "MV88F6192-A0"; | ||
579 | else | ||
580 | return "MV88F6192-Rev-Unsupported"; | ||
581 | } else if (dev == MV88F6180_DEV_ID) { | ||
582 | if (rev == MV88F6180_REV_A0) | ||
583 | return "MV88F6180-Rev-A0"; | ||
584 | else | ||
585 | return "MV88F6180-Rev-Unsupported"; | ||
586 | } else { | ||
587 | return "Device-Unknown"; | ||
550 | } | 588 | } |
551 | |||
552 | return "unknown 88F6000 variant"; | ||
553 | } | 589 | } |
554 | 590 | ||
555 | static int __init is_l2_writethrough(void) | 591 | static void __init kirkwood_l2_init(void) |
556 | { | 592 | { |
557 | return !!(readl(L2_CONFIG_REG) & L2_WRITETHROUGH); | 593 | #ifdef CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH |
594 | writel(readl(L2_CONFIG_REG) | L2_WRITETHROUGH, L2_CONFIG_REG); | ||
595 | feroceon_l2_init(1); | ||
596 | #else | ||
597 | writel(readl(L2_CONFIG_REG) & ~L2_WRITETHROUGH, L2_CONFIG_REG); | ||
598 | feroceon_l2_init(0); | ||
599 | #endif | ||
558 | } | 600 | } |
559 | 601 | ||
560 | void __init kirkwood_init(void) | 602 | void __init kirkwood_init(void) |
561 | { | 603 | { |
562 | printk(KERN_INFO "Kirkwood: %s, TCLK=%d.\n", | 604 | printk(KERN_INFO "Kirkwood: %s, TCLK=%d.\n", |
563 | kirkwood_id(), KIRKWOOD_TCLK); | 605 | kirkwood_id(), kirkwood_tclk); |
606 | kirkwood_ge00_shared_data.t_clk = kirkwood_tclk; | ||
607 | kirkwood_spi_plat_data.tclk = kirkwood_tclk; | ||
608 | kirkwood_uart0_data[0].uartclk = kirkwood_tclk; | ||
609 | kirkwood_uart1_data[0].uartclk = kirkwood_tclk; | ||
564 | 610 | ||
565 | kirkwood_setup_cpu_mbus(); | 611 | kirkwood_setup_cpu_mbus(); |
566 | 612 | ||
567 | #ifdef CONFIG_CACHE_FEROCEON_L2 | 613 | #ifdef CONFIG_CACHE_FEROCEON_L2 |
568 | feroceon_l2_init(is_l2_writethrough()); | 614 | kirkwood_l2_init(); |
569 | #endif | 615 | #endif |
570 | } | 616 | } |