]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/blackfin/mach-bf537/boards/stamp.c
Blackfin arch: fix bug when enable uart1 with uart0 disabled => no initial console
[linux-2.6-omap-h63xx.git] / arch / blackfin / mach-bf537 / boards / stamp.c
index 9c43d775651088f219f948c80f0f9f9432014232..07b0dc273d2f0b13ba87a3ec089b52f54af356be 100644 (file)
 #include <linux/spi/spi.h>
 #include <linux/spi/flash.h>
 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
-#include <linux/usb_isp1362.h>
+#include <linux/usb/isp1362.h>
 #endif
+#include <linux/pata_platform.h>
 #include <linux/irq.h>
 #include <linux/interrupt.h>
-#include <linux/usb_sl811.h>
+#include <linux/usb/sl811.h>
+#include <asm/dma.h>
 #include <asm/bfin5xx_spi.h>
+#include <asm/reboot.h>
+#include <asm/portmux.h>
 #include <linux/spi/ad7877.h>
 
 /*
  * Name the Board for the /proc/cpuinfo
  */
-char *bfin_board_name = "ADDS-BF537-STAMP";
+const char bfin_board_name[] = "ADDS-BF537-STAMP";
 
 /*
  *  Driver needs to know address, irq and flag pin.
@@ -179,6 +183,28 @@ static struct platform_device dm9000_device = {
 };
 #endif
 
+#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
+static struct resource ax88180_resources[] = {
+       [0] = {
+               .start  = 0x20300000,
+               .end    = 0x20300000 + 0x8000,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = IRQ_PF7,
+               .end    = IRQ_PF7,
+               .flags  = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
+       },
+};
+
+static struct platform_device ax88180_device = {
+       .name           = "ax88180",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(ax88180_resources),
+       .resource       = ax88180_resources,
+};
+#endif
+
 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
 static struct resource sl811_hcd_resources[] = {
        {
@@ -199,15 +225,13 @@ static struct resource sl811_hcd_resources[] = {
 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
 void sl811_port_power(struct device *dev, int is_on)
 {
-       unsigned short mask = (1 << CONFIG_USB_SL811_BFIN_GPIO_VBUS);
-
-       bfin_write_PORT_FER(bfin_read_PORT_FER() & ~mask);
-       bfin_write_FIO_DIR(bfin_read_FIO_DIR() | mask);
+       gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
+       gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS);
 
        if (is_on)
-               bfin_write_FIO_FLAG_S(mask);
+               gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS, 1);
        else
-               bfin_write_FIO_FLAG_C(mask);
+               gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS, 0);
 }
 #endif
 
@@ -407,7 +431,7 @@ 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,
@@ -420,7 +444,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
        {
                .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 = 1, /* Framework chip select. */
                .platform_data = NULL, /* No spi_driver specific config */
                .controller_data = &spi_adc_chip_info,
@@ -432,7 +456,7 @@ 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,
        },
@@ -441,7 +465,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
        {
                .modalias = "ad9960-spi",
                .max_speed_hz = 10000000,     /* max spi clock (SCK) speed in HZ */
-               .bus_num = 1,
+               .bus_num = 0,
                .chip_select = 1,
                .controller_data = &ad9960_spi_chip_info,
        },
@@ -449,8 +473,8 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
        {
                .modalias = "spi_mmc_dummy",
-               .max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
-               .bus_num = 1,
+               .max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */
+               .bus_num = 0,
                .chip_select = 0,
                .platform_data = NULL,
                .controller_data = &spi_mmc_chip_info,
@@ -458,8 +482,8 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
        },
        {
                .modalias = "spi_mmc",
-               .max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
-               .bus_num = 1,
+               .max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */
+               .bus_num = 0,
                .chip_select = CONFIG_SPI_MMC_CS_CHAN,
                .platform_data = NULL,
                .controller_data = &spi_mmc_chip_info,
@@ -470,16 +494,16 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
        {
                .modalias = "fxs-spi",
                .max_speed_hz = 12500000,     /* max spi clock (SCK) speed in HZ */
-               .bus_num = 1,
-               .chip_select = 3,
+               .bus_num = 0,
+               .chip_select = 8 - CONFIG_J11_JUMPER,
                .controller_data = &spi_si3xxx_chip_info,
                .mode = SPI_MODE_3,
        },
        {
                .modalias = "fxo-spi",
                .max_speed_hz = 12500000,     /* max spi clock (SCK) speed in HZ */
-               .bus_num = 1,
-               .chip_select = 2,
+               .bus_num = 0,
+               .chip_select = 8 - CONFIG_J19_JUMPER,
                .controller_data = &spi_si3xxx_chip_info,
                .mode = SPI_MODE_3,
        },
@@ -488,7 +512,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
        {
                .modalias = "ad5304_spi",
                .max_speed_hz = 1250000,     /* max spi clock (SCK) speed in HZ */
-               .bus_num = 1,
+               .bus_num = 0,
                .chip_select = 2,
                .platform_data = NULL,
                .controller_data = &ad5304_chip_info,
@@ -501,7 +525,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
                .platform_data          = &bfin_ad7877_ts_info,
                .irq                    = IRQ_PF6,
                .max_speed_hz   = 12500000,     /* max spi clock (SCK) speed in HZ */
-               .bus_num        = 1,
+               .bus_num        = 0,
                .chip_select  = 1,
                .controller_data = &spi_ad7877_chip_info,
        },
@@ -509,37 +533,65 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
 };
 
 /* 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 */
+       .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
 };
 
-static struct platform_device spi_bfin_master_device = {
-       .name = "bfin-spi-master",
-       .id = 1, /* Bus number */
+/* 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,
+       },
+};
+
+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 */
 
 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
 static struct platform_device bfin_fb_device = {
-       .name = "bf537-fb",
+       .name = "bf537-lq035",
+};
+#endif
+
+#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
+static struct platform_device bfin_fb_adv7393_device = {
+       .name = "bfin-adv7393",
 };
 #endif
 
 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
 static struct resource bfin_uart_resources[] = {
+#ifdef CONFIG_SERIAL_BFIN_UART0
        {
                .start = 0xFFC00400,
                .end = 0xFFC004FF,
                .flags = IORESOURCE_MEM,
-       }, {
+       },
+#endif
+#ifdef CONFIG_SERIAL_BFIN_UART1
+       {
                .start = 0xFFC02000,
                .end = 0xFFC020FF,
                .flags = IORESOURCE_MEM,
        },
+#endif
 };
 
 static struct platform_device bfin_uart_device = {
@@ -551,9 +603,24 @@ static struct platform_device bfin_uart_device = {
 #endif
 
 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
+static struct resource bfin_twi0_resource[] = {
+       [0] = {
+               .start = TWI0_REGBASE,
+               .end   = TWI0_REGBASE,
+               .flags = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start = IRQ_TWI,
+               .end   = IRQ_TWI,
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
 static struct platform_device i2c_bfin_twi_device = {
        .name = "i2c-bfin-twi",
        .id = 0,
+       .num_resources = ARRAY_SIZE(bfin_twi0_resource),
+       .resource = bfin_twi0_resource,
 };
 #endif
 
@@ -569,6 +636,43 @@ static struct platform_device bfin_sport1_uart_device = {
 };
 #endif
 
+#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
+#define PATA_INT       55
+
+static struct pata_platform_info bfin_pata_platform_data = {
+       .ioport_shift = 1,
+       .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
+};
+
+static struct resource bfin_pata_resources[] = {
+       {
+               .start = 0x20314020,
+               .end = 0x2031403F,
+               .flags = IORESOURCE_MEM,
+       },
+       {
+               .start = 0x2031401C,
+               .end = 0x2031401F,
+               .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 *stamp_devices[] __initdata = {
 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
        &bfin_pcmcia_cf_device,
@@ -594,6 +698,10 @@ static struct platform_device *stamp_devices[] __initdata = {
        &dm9000_device,
 #endif
 
+#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
+       &ax88180_device,
+#endif
+
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
        &bfin_mac_device,
 #endif
@@ -603,13 +711,17 @@ static struct platform_device *stamp_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
-       &spi_bfin_master_device,
+       &bfin_spi0_device,
 #endif
 
 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
        &bfin_fb_device,
 #endif
 
+#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
+       &bfin_fb_adv7393_device,
+#endif
+
 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
        &bfin_uart_device,
 #endif
@@ -622,6 +734,10 @@ static struct platform_device *stamp_devices[] __initdata = {
        &bfin_sport0_uart_device,
        &bfin_sport1_uart_device,
 #endif
+
+#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
+       &bfin_pata_device,
+#endif
 };
 
 static int __init stamp_init(void)
@@ -632,7 +748,29 @@ static int __init stamp_init(void)
        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;
 }
 
 arch_initcall(stamp_init);
+
+void native_machine_restart(char *cmd)
+{
+       /* workaround reboot hang when booting from SPI */
+       if ((bfin_read_SYSCR() & 0x7) == 0x3)
+               bfin_gpio_reset_spi0_ssel1();
+}
+
+/*
+ * Currently the MAC address is saved in Flash by U-Boot
+ */
+#define FLASH_MAC      0x203f0000
+void bfin_get_ether_addr(char *addr)
+{
+       *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
+       *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
+}
+EXPORT_SYMBOL(bfin_get_ether_addr);