]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/mips/au1000/common/platform.c
[MIPS] Pb1200/DBAu1200: move platform code to its proper place
[linux-2.6-omap-h63xx.git] / arch / mips / au1000 / common / platform.c
index d51e18fb789b5bd2396617c2b9181cfe1912e019..31d2a2270878832354a02e4cd7f6b4b6eaf03516 100644 (file)
@@ -3,18 +3,65 @@
  *
  * Copyright 2004, Matt Porter <mporter@kernel.crashing.org>
  *
+ * (C) Copyright Embedded Alley Solutions, Inc 2005
+ * Author: Pantelis Antoniou <pantelis@embeddedalley.com>
+ *
  * This file is licensed under the terms of the GNU General Public
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-#include <linux/device.h>
+
 #include <linux/platform_device.h>
-#include <linux/kernel.h>
+#include <linux/serial_8250.h>
 #include <linux/init.h>
-#include <linux/resource.h>
 
 #include <asm/mach-au1x00/au1xxx.h>
 
+#define PORT(_base, _irq)                              \
+       {                                               \
+               .iobase         = _base,                \
+               .membase        = (void __iomem *)_base,\
+               .mapbase        = CPHYSADDR(_base),     \
+               .irq            = _irq,                 \
+               .regshift       = 2,                    \
+               .iotype         = UPIO_AU,              \
+               .flags          = UPF_SKIP_TEST         \
+       }
+
+static struct plat_serial8250_port au1x00_uart_data[] = {
+#if defined(CONFIG_SERIAL_8250_AU1X00)
+#if defined(CONFIG_SOC_AU1000)
+       PORT(UART0_ADDR, AU1000_UART0_INT),
+       PORT(UART1_ADDR, AU1000_UART1_INT),
+       PORT(UART2_ADDR, AU1000_UART2_INT),
+       PORT(UART3_ADDR, AU1000_UART3_INT),
+#elif defined(CONFIG_SOC_AU1500)
+       PORT(UART0_ADDR, AU1500_UART0_INT),
+       PORT(UART3_ADDR, AU1500_UART3_INT),
+#elif defined(CONFIG_SOC_AU1100)
+       PORT(UART0_ADDR, AU1100_UART0_INT),
+       PORT(UART1_ADDR, AU1100_UART1_INT),
+       PORT(UART3_ADDR, AU1100_UART3_INT),
+#elif defined(CONFIG_SOC_AU1550)
+       PORT(UART0_ADDR, AU1550_UART0_INT),
+       PORT(UART1_ADDR, AU1550_UART1_INT),
+       PORT(UART3_ADDR, AU1550_UART3_INT),
+#elif defined(CONFIG_SOC_AU1200)
+       PORT(UART0_ADDR, AU1200_UART0_INT),
+       PORT(UART1_ADDR, AU1200_UART1_INT),
+#endif
+#endif /* CONFIG_SERIAL_8250_AU1X00 */
+       { },
+};
+
+static struct platform_device au1xx0_uart_device = {
+       .name                   = "serial8250",
+       .id                     = PLAT8250_DEV_AU1X00,
+       .dev                    = {
+               .platform_data  = au1x00_uart_data,
+       },
+};
+
 /* OHCI (USB full speed host controller) */
 static struct resource au1xxx_usb_ohci_resources[] = {
        [0] = {
@@ -186,19 +233,6 @@ static struct resource au1200_lcd_resources[] = {
        }
 };
 
-static struct resource au1200_ide0_resources[] = {
-       [0] = {
-               .start          = AU1XXX_ATA_PHYS_ADDR,
-               .end            = AU1XXX_ATA_PHYS_ADDR + AU1XXX_ATA_PHYS_LEN,
-               .flags          = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start          = AU1XXX_ATA_INT,
-               .end            = AU1XXX_ATA_INT,
-               .flags          = IORESOURCE_IRQ,
-       }
-};
-
 static u64 au1200_lcd_dmamask = ~(u32)0;
 
 static struct platform_device au1200_lcd_device = {
@@ -212,20 +246,6 @@ static struct platform_device au1200_lcd_device = {
        .resource       = au1200_lcd_resources,
 };
 
-
-static u64 ide0_dmamask = ~(u32)0;
-
-static struct platform_device au1200_ide0_device = {
-       .name           = "au1200-ide",
-       .id             = 0,
-       .dev = {
-               .dma_mask               = &ide0_dmamask,
-               .coherent_dma_mask      = 0xffffffff,
-       },
-       .num_resources = ARRAY_SIZE(au1200_ide0_resources),
-       .resource       = au1200_ide0_resources,
-};
-
 static u64 au1xxx_mmc_dmamask =  ~(u32)0;
 
 static struct platform_device au1xxx_mmc_device = {
@@ -245,32 +265,26 @@ static struct platform_device au1x00_pcmcia_device = {
        .id             = 0,
 };
 
-#ifdef CONFIG_MIPS_DB1200
-
-static struct resource smc91x_resources[] = {
-       [0] = {
-               .name   = "smc91x-regs",
-               .start  = AU1XXX_SMC91111_PHYS_ADDR,
-               .end    = AU1XXX_SMC91111_PHYS_ADDR + 0xfffff,
+/* All Alchemy demoboards with I2C have this #define in their headers */
+#ifdef SMBUS_PSC_BASE
+static struct resource pbdb_smbus_resources[] = {
+       {
+               .start  = SMBUS_PSC_BASE,
+               .end    = SMBUS_PSC_BASE + 0x24 - 1,
                .flags  = IORESOURCE_MEM,
        },
-       [1] = {
-               .start  = AU1XXX_SMC91111_IRQ,
-               .end    = AU1XXX_SMC91111_IRQ,
-               .flags  = IORESOURCE_IRQ,
-       },
 };
 
-static struct platform_device smc91x_device = {
-       .name           = "smc91x",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(smc91x_resources),
-       .resource       = smc91x_resources,
+static struct platform_device pbdb_smbus_device = {
+       .name           = "au1xpsc_smbus",
+       .id             = 0,    /* bus number */
+       .num_resources  = ARRAY_SIZE(pbdb_smbus_resources),
+       .resource       = pbdb_smbus_resources,
 };
-
 #endif
 
 static struct platform_device *au1xxx_platform_devices[] __initdata = {
+       &au1xx0_uart_device,
        &au1xxx_usb_ohci_device,
        &au1x00_pcmcia_device,
 #ifdef CONFIG_FB_AU1100
@@ -281,16 +295,22 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = {
        &au1xxx_usb_gdt_device,
        &au1xxx_usb_otg_device,
        &au1200_lcd_device,
-       &au1200_ide0_device,
        &au1xxx_mmc_device,
 #endif
-#ifdef CONFIG_MIPS_DB1200
-       &smc91x_device,
+#ifdef SMBUS_PSC_BASE
+       &pbdb_smbus_device,
 #endif
 };
 
 int __init au1xxx_platform_init(void)
 {
+       unsigned int uartclk = get_au1x00_uart_baud_base() * 16;
+       int i;
+
+       /* Fill up uartclk. */
+       for (i = 0; au1x00_uart_data[i].flags ; i++)
+               au1x00_uart_data[i].uartclk = uartclk;
+
        return platform_add_devices(au1xxx_platform_devices, ARRAY_SIZE(au1xxx_platform_devices));
 }