]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - arch/arm/mach-realview/realview_pb11mp.c
ARM: 5774/1: Fix Realview ARM1176PB board reboot
[linux-2.6.git] / arch / arm / mach-realview / realview_pb11mp.c
index 7d1fa1fad5e4bbf349cd98fcbef46a010e191967..070d284ce96e49602ed0e5c72a34be2bad280410 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/sysdev.h>
 #include <linux/amba/bus.h>
+#include <linux/amba/pl061.h>
+#include <linux/amba/mmci.h>
+#include <linux/io.h>
 
-#include <asm/hardware.h>
-#include <asm/io.h>
+#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/leds.h>
 #include <asm/mach-types.h>
 #include <asm/hardware/gic.h>
 #include <asm/hardware/icst307.h>
 #include <asm/hardware/cache-l2x0.h>
+#include <asm/localtimer.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 #include <asm/mach/map.h>
-#include <asm/mach/mmc.h>
 #include <asm/mach/time.h>
 
-#include <asm/arch/board-pb11mp.h>
-#include <asm/arch/irqs.h>
+#include <mach/board-pb11mp.h>
+#include <mach/irqs.h>
 
 #include "core.h"
 #include "clock.h"
@@ -107,6 +109,21 @@ static void __init realview_pb11mp_map_io(void)
        iotable_init(realview_pb11mp_io_desc, ARRAY_SIZE(realview_pb11mp_io_desc));
 }
 
+static struct pl061_platform_data gpio0_plat_data = {
+       .gpio_base      = 0,
+       .irq_base       = -1,
+};
+
+static struct pl061_platform_data gpio1_plat_data = {
+       .gpio_base      = 8,
+       .irq_base       = -1,
+};
+
+static struct pl061_platform_data gpio2_plat_data = {
+       .gpio_base      = 16,
+       .irq_base       = -1,
+};
+
 /*
  * RealView PB11MPCore AMBA devices
  */
@@ -155,29 +172,29 @@ static void __init realview_pb11mp_map_io(void)
 #define PB11MP_SSP_DMA         { 9, 8 }
 
 /* FPGA Primecells */
-AMBA_DEVICE(aaci,      "fpga:04",      AACI,           NULL);
-AMBA_DEVICE(mmc0,      "fpga:05",      MMCI0,          &realview_mmc0_plat_data);
-AMBA_DEVICE(kmi0,      "fpga:06",      KMI0,           NULL);
-AMBA_DEVICE(kmi1,      "fpga:07",      KMI1,           NULL);
-AMBA_DEVICE(uart3,     "fpga:09",      PB11MP_UART3,   NULL);
+AMBA_DEVICE(aaci,      "fpga:aaci",    AACI,           NULL);
+AMBA_DEVICE(mmc0,      "fpga:mmc0",    MMCI0,          &realview_mmc0_plat_data);
+AMBA_DEVICE(kmi0,      "fpga:kmi0",    KMI0,           NULL);
+AMBA_DEVICE(kmi1,      "fpga:kmi1",    KMI1,           NULL);
+AMBA_DEVICE(uart3,     "fpga:uart3",   PB11MP_UART3,   NULL);
 
 /* DevChip Primecells */
-AMBA_DEVICE(smc,       "dev:00",       PB11MP_SMC,     NULL);
-AMBA_DEVICE(sctl,      "dev:e0",       SCTL,           NULL);
-AMBA_DEVICE(wdog,      "dev:e1",       PB11MP_WATCHDOG, NULL);
-AMBA_DEVICE(gpio0,     "dev:e4",       PB11MP_GPIO0,   NULL);
-AMBA_DEVICE(gpio1,     "dev:e5",       GPIO1,          NULL);
-AMBA_DEVICE(gpio2,     "dev:e6",       GPIO2,          NULL);
-AMBA_DEVICE(rtc,       "dev:e8",       PB11MP_RTC,     NULL);
-AMBA_DEVICE(sci0,      "dev:f0",       SCI,            NULL);
-AMBA_DEVICE(uart0,     "dev:f1",       PB11MP_UART0,   NULL);
-AMBA_DEVICE(uart1,     "dev:f2",       PB11MP_UART1,   NULL);
-AMBA_DEVICE(uart2,     "dev:f3",       PB11MP_UART2,   NULL);
-AMBA_DEVICE(ssp0,      "dev:f4",       PB11MP_SSP,     NULL);
+AMBA_DEVICE(smc,       "dev:smc",      PB11MP_SMC,     NULL);
+AMBA_DEVICE(sctl,      "dev:sctl",     SCTL,           NULL);
+AMBA_DEVICE(wdog,      "dev:wdog",     PB11MP_WATCHDOG, NULL);
+AMBA_DEVICE(gpio0,     "dev:gpio0",    PB11MP_GPIO0,   &gpio0_plat_data);
+AMBA_DEVICE(gpio1,     "dev:gpio1",    GPIO1,          &gpio1_plat_data);
+AMBA_DEVICE(gpio2,     "dev:gpio2",    GPIO2,          &gpio2_plat_data);
+AMBA_DEVICE(rtc,       "dev:rtc",      PB11MP_RTC,     NULL);
+AMBA_DEVICE(sci0,      "dev:sci0",     SCI,            NULL);
+AMBA_DEVICE(uart0,     "dev:uart0",    PB11MP_UART0,   NULL);
+AMBA_DEVICE(uart1,     "dev:uart1",    PB11MP_UART1,   NULL);
+AMBA_DEVICE(uart2,     "dev:uart2",    PB11MP_UART2,   NULL);
+AMBA_DEVICE(ssp0,      "dev:ssp0",     PB11MP_SSP,     NULL);
 
 /* Primecells on the NEC ISSP chip */
-AMBA_DEVICE(clcd,      "issp:20",      PB11MP_CLCD,    &clcd_plat_data);
-AMBA_DEVICE(dmac,      "issp:30",      DMAC,           NULL);
+AMBA_DEVICE(clcd,      "issp:clcd",    PB11MP_CLCD,    &clcd_plat_data);
+AMBA_DEVICE(dmac,      "issp:dmac",    DMAC,           NULL);
 
 static struct amba_device *amba_devs[] __initdata = {
        &dmac_device,
@@ -230,38 +247,19 @@ static struct resource realview_pb11mp_smsc911x_resources[] = {
        },
 };
 
-static struct platform_device realview_pb11mp_smsc911x_device = {
-       .name           = "smc911x",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(realview_pb11mp_smsc911x_resources),
-       .resource       = realview_pb11mp_smsc911x_resources,
-};
-
-struct resource realview_pb11mp_cf_resources[] = {
+static struct resource realview_pb11mp_isp1761_resources[] = {
        [0] = {
-               .start          = REALVIEW_PB11MP_CF_BASE,
-               .end            = REALVIEW_PB11MP_CF_BASE + SZ_4K - 1,
+               .start          = REALVIEW_PB11MP_USB_BASE,
+               .end            = REALVIEW_PB11MP_USB_BASE + SZ_128K - 1,
                .flags          = IORESOURCE_MEM,
        },
        [1] = {
-               .start          = REALVIEW_PB11MP_CF_MEM_BASE,
-               .end            = REALVIEW_PB11MP_CF_MEM_BASE + SZ_4K - 1,
-               .flags          = IORESOURCE_MEM,
-       },
-       [2] = {
-               .start          = -1,           /* FIXME: Find correct irq */
-               .end            = -1,
+               .start          = IRQ_TC11MP_USB,
+               .end            = IRQ_TC11MP_USB,
                .flags          = IORESOURCE_IRQ,
        },
 };
 
-struct platform_device realview_pb11mp_cf_device = {
-       .name           = "compactflash",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(realview_pb11mp_cf_resources),
-       .resource       = realview_pb11mp_cf_resources,
-};
-
 static void __init gic_init_irq(void)
 {
        unsigned int pldctrl;
@@ -292,8 +290,7 @@ static void __init realview_pb11mp_timer_init(void)
        timer3_va_base = __io_address(REALVIEW_PB11MP_TIMER2_3_BASE) + 0x20;
 
 #ifdef CONFIG_LOCAL_TIMERS
-       twd_base_addr = __io_address(REALVIEW_TC11MP_TWD_BASE);
-       twd_size = REALVIEW_TC11MP_TWD_SIZE;
+       twd_base = __io_address(REALVIEW_TC11MP_TWD_BASE);
 #endif
        realview_timer_init(IRQ_TC11MP_TIMER0_1);
 }
@@ -302,21 +299,37 @@ static struct sys_timer realview_pb11mp_timer = {
        .init           = realview_pb11mp_timer_init,
 };
 
+static void realview_pb11mp_reset(char mode)
+{
+       void __iomem *hdr_ctrl = __io_address(REALVIEW_SYS_BASE) +
+               REALVIEW_SYS_RESETCTL_OFFSET;
+       unsigned int val;
+
+       /*
+        * To reset, we hit the on-board reset register
+        * in the system FPGA
+        */
+       val = __raw_readl(hdr_ctrl);
+       val |= REALVIEW_PB11MP_SYS_CTRL_RESET_CONFIGCLR;
+       __raw_writel(val, hdr_ctrl);
+}
+
 static void __init realview_pb11mp_init(void)
 {
        int i;
 
+#ifdef CONFIG_CACHE_L2X0
        /* 1MB (128KB/way), 8-way associativity, evmon/parity/share enabled
         * Bits:  .... ...0 0111 1001 0000 .... .... .... */
        l2x0_init(__io_address(REALVIEW_TC11MP_L220_BASE), 0x00790000, 0xfe000fff);
-
-       clk_register(&realview_clcd_clk);
+#endif
 
        realview_flash_register(realview_pb11mp_flash_resource,
                                ARRAY_SIZE(realview_pb11mp_flash_resource));
-       platform_device_register(&realview_pb11mp_smsc911x_device);
+       realview_eth_register(NULL, realview_pb11mp_smsc911x_resources);
        platform_device_register(&realview_i2c_device);
-       platform_device_register(&realview_pb11mp_cf_device);
+       platform_device_register(&realview_cf_device);
+       realview_usb_register(realview_pb11mp_isp1761_resources);
 
        for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
                struct amba_device *d = amba_devs[i];
@@ -326,13 +339,14 @@ static void __init realview_pb11mp_init(void)
 #ifdef CONFIG_LEDS
        leds_event = realview_leds_event;
 #endif
+       realview_reset = realview_pb11mp_reset;
 }
 
 MACHINE_START(REALVIEW_PB11MP, "ARM-RealView PB11MPCore")
        /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
        .phys_io        = REALVIEW_PB11MP_UART0_BASE,
        .io_pg_offst    = (IO_ADDRESS(REALVIEW_PB11MP_UART0_BASE) >> 18) & 0xfffc,
-       .boot_params    = 0x00000100,
+       .boot_params    = PHYS_OFFSET + 0x00000100,
        .map_io         = realview_pb11mp_map_io,
        .init_irq       = gic_init_irq,
        .timer          = &realview_pb11mp_timer,