Blackfin: fix BF54x SPI CS resources
[safe/jmp/linux-2.6] / arch / blackfin / mach-bf548 / boards / ezkit.c
index 309c160..c66f380 100644 (file)
@@ -76,7 +76,6 @@ static struct resource bfin_isp1760_resources[] = {
 
 static struct isp1760_platform_data isp1760_priv = {
        .is_isp1761 = 0,
-       .port1_disable = 0,
        .bus_width_16 = 1,
        .port1_otg = 0,
        .analog_oc = 0,
@@ -100,8 +99,8 @@ static struct platform_device bfin_isp1760_device = {
 #include <mach/bf54x-lq043.h>
 
 static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
-       .width =        480,
-       .height =       272,
+       .width =        95,
+       .height =       54,
        .xres =         {480, 480, 480},
        .yres =         {272, 272, 272},
        .bpp =          {24, 24, 24},
@@ -208,6 +207,43 @@ static struct platform_device bfin_rotary_device = {
 };
 #endif
 
+#if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
+#include <linux/input.h>
+#include <linux/spi/adxl34x.h>
+static const struct adxl34x_platform_data adxl34x_info = {
+       .x_axis_offset = 0,
+       .y_axis_offset = 0,
+       .z_axis_offset = 0,
+       .tap_threshold = 0x31,
+       .tap_duration = 0x10,
+       .tap_latency = 0x60,
+       .tap_window = 0xF0,
+       .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
+       .act_axis_control = 0xFF,
+       .activity_threshold = 5,
+       .inactivity_threshold = 3,
+       .inactivity_time = 4,
+       .free_fall_threshold = 0x7,
+       .free_fall_time = 0x20,
+       .data_rate = 0x8,
+       .data_range = ADXL_FULL_RES,
+
+       .ev_type = EV_ABS,
+       .ev_code_x = ABS_X,             /* EV_REL */
+       .ev_code_y = ABS_Y,             /* EV_REL */
+       .ev_code_z = ABS_Z,             /* EV_REL */
+
+       .ev_code_tap_x = BTN_TOUCH,             /* EV_KEY */
+       .ev_code_tap_y = BTN_TOUCH,             /* EV_KEY */
+       .ev_code_tap_z = BTN_TOUCH,             /* EV_KEY */
+
+/*     .ev_code_ff = KEY_F,*/          /* EV_KEY */
+/*     .ev_code_act_inactivity = KEY_A,*/      /* EV_KEY */
+       .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
+       .fifo_mode = ADXL_FIFO_STREAM,
+};
+#endif
+
 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
 static struct platform_device rtc_device = {
        .name = "rtc-bfin",
@@ -359,6 +395,8 @@ static struct platform_device bfin_sir3_device = {
 #endif
 
 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
+#include <linux/smsc911x.h>
+
 static struct resource smsc911x_resources[] = {
        {
                .name = "smsc911x-memory",
@@ -372,11 +410,22 @@ static struct resource smsc911x_resources[] = {
                .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
        },
 };
+
+static struct smsc911x_platform_config smsc911x_config = {
+       .flags = SMSC911X_USE_32BIT,
+       .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
+       .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
+       .phy_interface = PHY_INTERFACE_MODE_MII,
+};
+
 static struct platform_device smsc911x_device = {
        .name = "smsc911x",
        .id = 0,
        .num_resources = ARRAY_SIZE(smsc911x_resources),
        .resource = smsc911x_resources,
+       .dev = {
+               .platform_data = &smsc911x_config,
+       },
 };
 #endif
 
@@ -628,6 +677,14 @@ static struct bfin5xx_spi_chip spidev_chip_info = {
 };
 #endif
 
+#if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
+static struct bfin5xx_spi_chip spi_adxl34x_chip_info = {
+       .enable_dma = 0,         /* use dma transfer with this chip*/
+       .bits_per_word = 8,
+       .cs_change_per_word = 0,
+};
+#endif
+
 static struct spi_board_info bfin_spi_board_info[] __initdata = {
 #if defined(CONFIG_MTD_M25P80) \
        || defined(CONFIG_MTD_M25P80_MODULE)
@@ -645,7 +702,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
        || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
        {
-               .modalias = "ad1836-spi",
+               .modalias = "ad1836",
                .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
                .bus_num = 1,
                .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
@@ -653,15 +710,15 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
        },
 #endif
 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
-{
-       .modalias               = "ad7877",
-       .platform_data          = &bfin_ad7877_ts_info,
-       .irq                    = IRQ_PB4,      /* old boards (<=Rev 1.3) use IRQ_PJ11 */
-       .max_speed_hz           = 12500000,     /* max spi clock (SCK) speed in HZ */
-       .bus_num                = 0,
-       .chip_select            = 2,
-       .controller_data = &spi_ad7877_chip_info,
-},
+       {
+               .modalias               = "ad7877",
+               .platform_data          = &bfin_ad7877_ts_info,
+               .irq                    = IRQ_PB4,      /* old boards (<=Rev 1.3) use IRQ_PJ11 */
+               .max_speed_hz           = 12500000,     /* max spi clock (SCK) speed in HZ */
+               .bus_num                = 0,
+               .chip_select            = 2,
+               .controller_data = &spi_ad7877_chip_info,
+       },
 #endif
 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
        {
@@ -672,8 +729,19 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
                .controller_data = &spidev_chip_info,
        },
 #endif
+#if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
+       {
+               .modalias               = "adxl34x",
+               .platform_data          = &adxl34x_info,
+               .irq                    = IRQ_PC5,
+               .max_speed_hz           = 5000000,     /* max spi clock (SCK) speed in HZ */
+               .bus_num                = 1,
+               .chip_select            = 2,
+               .controller_data = &spi_adxl34x_chip_info,
+               .mode = SPI_MODE_3,
+       },
+#endif
 };
-
 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
 /* SPI (0) */
 static struct resource bfin_spi0_resource[] = {
@@ -685,6 +753,11 @@ static struct resource bfin_spi0_resource[] = {
        [1] = {
                .start = CH_SPI0,
                .end   = CH_SPI0,
+               .flags = IORESOURCE_DMA,
+       },
+       [2] = {
+               .start = IRQ_SPI0,
+               .end   = IRQ_SPI0,
                .flags = IORESOURCE_IRQ,
        }
 };
@@ -699,13 +772,18 @@ static struct resource bfin_spi1_resource[] = {
        [1] = {
                .start = CH_SPI1,
                .end   = CH_SPI1,
+               .flags = IORESOURCE_DMA,
+       },
+       [2] = {
+               .start = IRQ_SPI1,
+               .end   = IRQ_SPI1,
                .flags = IORESOURCE_IRQ,
        }
 };
 
 /* SPI controller data */
 static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
-       .num_chipselect = 8,
+       .num_chipselect = 3,
        .enable_dma = 1,  /* master has the ability to do dma transfer */
        .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
 };
@@ -721,7 +799,7 @@ static struct platform_device bf54x_spi_master0 = {
 };
 
 static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
-       .num_chipselect = 8,
+       .num_chipselect = 3,
        .enable_dma = 1,  /* master has the ability to do dma transfer */
        .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
 };
@@ -781,25 +859,30 @@ static struct platform_device i2c_bfin_twi1_device = {
 #endif
 #endif
 
-#ifdef CONFIG_I2C_BOARDINFO
 static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
 };
 
 #if !defined(CONFIG_BF542)     /* The BF542 only has 1 TWI */
 static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
-#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
+#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
        {
                I2C_BOARD_INFO("pcf8574_lcd", 0x22),
        },
 #endif
-#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
+#if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
        {
                I2C_BOARD_INFO("pcf8574_keypad", 0x27),
                .irq = 212,
        },
 #endif
-};
+#if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
+       {
+               I2C_BOARD_INFO("adxl34x", 0x53),
+               .irq = IRQ_PC5,
+               .platform_data = (void *)&adxl34x_info,
+       },
 #endif
+};
 #endif
 
 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
@@ -956,14 +1039,12 @@ static int __init ezkit_init(void)
 {
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
 
-#ifdef CONFIG_I2C_BOARDINFO
        i2c_register_board_info(0, bfin_i2c_board_info0,
                                ARRAY_SIZE(bfin_i2c_board_info0));
 #if !defined(CONFIG_BF542)     /* The BF542 only has 1 TWI */
        i2c_register_board_info(1, bfin_i2c_board_info1,
                                ARRAY_SIZE(bfin_i2c_board_info1));
 #endif
-#endif
 
        platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));