i2c-au1550: Convert to platform driver
[cascardo/linux.git] / arch / mips / au1000 / common / platform.c
index 48d3f54..841904c 100644 (file)
@@ -7,7 +7,6 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-#include <linux/config.h>
 #include <linux/device.h>
 #include <linux/platform_device.h>
 #include <linux/kernel.h>
@@ -20,7 +19,7 @@
 static struct resource au1xxx_usb_ohci_resources[] = {
        [0] = {
                .start          = USB_OHCI_BASE,
-               .end            = USB_OHCI_BASE + USB_OHCI_LEN,
+               .end            = USB_OHCI_BASE + USB_OHCI_LEN - 1,
                .flags          = IORESOURCE_MEM,
        },
        [1] = {
@@ -264,13 +263,31 @@ static struct resource smc91x_resources[] = {
 
 static struct platform_device smc91x_device = {
        .name           = "smc91x",
-       .id             = -1,
+       .id             = -1,
        .num_resources  = ARRAY_SIZE(smc91x_resources),
        .resource       = smc91x_resources,
 };
 
 #endif
 
+/* 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,
+       },
+};
+
+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 = {
        &au1xxx_usb_ohci_device,
        &au1x00_pcmcia_device,
@@ -278,9 +295,7 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = {
        &au1100_lcd_device,
 #endif
 #ifdef CONFIG_SOC_AU1200
-#if 0  /* fixme */
        &au1xxx_usb_ehci_device,
-#endif
        &au1xxx_usb_gdt_device,
        &au1xxx_usb_otg_device,
        &au1200_lcd_device,
@@ -288,11 +303,14 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = {
        &au1xxx_mmc_device,
 #endif
 #ifdef CONFIG_MIPS_DB1200
-       &smc91x_device,
+       &smc91x_device,
+#endif
+#ifdef SMBUS_PSC_BASE
+       &pbdb_smbus_device,
 #endif
 };
 
-int au1xxx_platform_init(void)
+int __init au1xxx_platform_init(void)
 {
        return platform_add_devices(au1xxx_platform_devices, ARRAY_SIZE(au1xxx_platform_devices));
 }