Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[pandora-kernel.git] / arch / blackfin / mach-bf533 / boards / cm_bf533.c
index edd31ce..1c5a86a 100644 (file)
 #include <linux/spi/spi.h>
 #include <linux/spi/flash.h>
 #include <linux/usb_isp1362.h>
-#include <asm/irq.h>
+#include <linux/pata_platform.h>
+#include <linux/irq.h>
+#include <asm/dma.h>
 #include <asm/bfin5xx_spi.h>
 
 /*
  * Name the Board for the /proc/cpuinfo
  */
-char *bfin_board_name = "Bluetechnix CM BF533";
+const char bfin_board_name[] = "Bluetechnix CM BF533";
 
 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
 /* all SPI peripherals info goes here */
@@ -51,11 +53,11 @@ static struct mtd_partition bfin_spi_flash_partitions[] = {
                .size = 0x00020000,
                .offset = 0,
                .mask_flags = MTD_CAP_ROM
-       },{
+       }, {
                .name = "kernel",
                .size = 0xe0000,
                .offset = 0x20000
-       },{
+       }, {
                .name = "file system",
                .size = 0x700000,
                .offset = 0x00100000,
@@ -93,15 +95,15 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
                /* the modalias must be the same as spi device driver name */
                .modalias = "m25p80",       /* Name of spi_driver for this device */
                .max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
-               .bus_num = 1,               /* Framework bus number */
+               .bus_num = 0,               /* Framework bus number */
                .chip_select = 1,           /* Framework chip select. On STAMP537 it is SPISSEL1*/
                .platform_data = &bfin_spi_flash_data,
                .controller_data = &spi_flash_chip_info,
                .mode = SPI_MODE_3,
-       },{
+       }, {
                .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
                .max_speed_hz = 6250000,     /* max spi clock (SCK) speed in HZ */
-               .bus_num = 1,               /* Framework bus number */
+               .bus_num = 0,               /* Framework bus number */
                .chip_select = 2,           /* Framework chip select. */
                .platform_data = NULL,      /* No spi_driver specific config */
                .controller_data = &spi_adc_chip_info,
@@ -110,24 +112,40 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
        {
                .modalias = "ad1836-spi",
                .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
-               .bus_num = 1,
+               .bus_num = 0,
                .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
                .controller_data = &ad1836_spi_chip_info,
        },
 #endif
 };
 
+/* SPI (0) */
+static struct resource bfin_spi0_resource[] = {
+       [0] = {
+               .start = SPI0_REGBASE,
+               .end   = SPI0_REGBASE + 0xFF,
+               .flags = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start = CH_SPI,
+               .end   = CH_SPI,
+               .flags = IORESOURCE_IRQ,
+       }
+};
+
 /* SPI controller data */
-static struct bfin5xx_spi_master spi_bfin_master_info = {
+static struct bfin5xx_spi_master bfin_spi0_info = {
        .num_chipselect = 8,
        .enable_dma = 1,  /* master has the ability to do dma transfer */
 };
 
-static struct platform_device spi_bfin_master_device = {
-       .name = "bfin-spi-master",
-       .id = 1, /* Bus number */
+static struct platform_device bfin_spi0_device = {
+       .name = "bfin-spi",
+       .id = 0, /* Bus number */
+       .num_resources = ARRAY_SIZE(bfin_spi0_resource),
+       .resource = bfin_spi0_resource,
        .dev = {
-               .platform_data = &spi_bfin_master_info, /* Passed to driver */
+               .platform_data = &bfin_spi0_info, /* Passed to driver */
        },
 };
 #endif  /* spi master and devices */
@@ -145,7 +163,7 @@ static struct resource smc91x_resources[] = {
                .start = 0x20200300,
                .end = 0x20200300 + 16,
                .flags = IORESOURCE_MEM,
-       },{
+       }, {
                .start = IRQ_PF0,
                .end = IRQ_PF0,
                .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
@@ -194,11 +212,11 @@ static struct resource isp1362_hcd_resources[] = {
                .start = 0x20308000,
                .end = 0x20308000,
                .flags = IORESOURCE_MEM,
-       },{
+       }, {
                .start = 0x20308004,
                .end = 0x20308004,
                .flags = IORESOURCE_MEM,
-       },{
+       }, {
                .start = IRQ_PF4,
                .end = IRQ_PF4,
                .flags = IORESOURCE_IRQ,
@@ -227,6 +245,43 @@ static struct platform_device isp1362_hcd_device = {
 };
 #endif
 
+#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
+#define PATA_INT       38
+
+static struct pata_platform_info bfin_pata_platform_data = {
+       .ioport_shift = 2,
+       .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
+};
+
+static struct resource bfin_pata_resources[] = {
+       {
+               .start = 0x2030C000,
+               .end = 0x2030C01F,
+               .flags = IORESOURCE_MEM,
+       },
+       {
+               .start = 0x2030D018,
+               .end = 0x2030D01B,
+               .flags = IORESOURCE_MEM,
+       },
+       {
+               .start = PATA_INT,
+               .end = PATA_INT,
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device bfin_pata_device = {
+       .name = "pata_platform",
+       .id = -1,
+       .num_resources = ARRAY_SIZE(bfin_pata_resources),
+       .resource = bfin_pata_resources,
+       .dev = {
+               .platform_data = &bfin_pata_platform_data,
+       }
+};
+#endif
+
 static struct platform_device *cm_bf533_devices[] __initdata = {
 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
        &bfin_uart_device,
@@ -250,7 +305,11 @@ static struct platform_device *cm_bf533_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
-       &spi_bfin_master_device,
+       &bfin_spi0_device,
+#endif
+
+#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
+       &bfin_pata_device,
 #endif
 };
 
@@ -261,6 +320,10 @@ static int __init cm_bf533_init(void)
 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
        spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
 #endif
+
+#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
+       irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
+#endif
        return 0;
 }