Jonathan Cameron | b6795fa | 2008-12-12 20:43:09 +0000 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-pxa/imote2.c |
| 3 | * |
| 4 | * Author: Ed C. Epp |
| 5 | * Created: Nov 05, 2002 |
| 6 | * Copyright: Intel Corp. |
| 7 | * |
| 8 | * Modified 2008: Jonathan Cameron |
| 9 | * |
| 10 | * The Imote2 is a wireless sensor node platform sold |
| 11 | * by Crossbow (www.xbow.com). |
| 12 | */ |
| 13 | |
| 14 | #include <linux/init.h> |
| 15 | #include <linux/device.h> |
| 16 | #include <linux/mtd/mtd.h> |
| 17 | #include <linux/mtd/partitions.h> |
| 18 | #include <linux/platform_device.h> |
| 19 | #include <linux/regulator/machine.h> |
| 20 | #include <linux/gpio.h> |
| 21 | #include <linux/leds.h> |
| 22 | #include <linux/spi/spi.h> |
| 23 | #include <linux/i2c.h> |
| 24 | #include <linux/mfd/da903x.h> |
Jonathan Cameron | a252084 | 2009-05-25 16:50:12 +0000 | [diff] [blame] | 25 | #include <linux/sht15.h> |
Jonathan Cameron | b6795fa | 2008-12-12 20:43:09 +0000 | [diff] [blame] | 26 | |
| 27 | #include <asm/mach-types.h> |
| 28 | #include <asm/mach/arch.h> |
| 29 | #include <asm/mach/map.h> |
| 30 | #include <asm/mach/flash.h> |
| 31 | |
Eric Miao | 51c6298 | 2009-01-02 23:17:22 +0800 | [diff] [blame] | 32 | #include <mach/pxa27x.h> |
Eric Miao | f0a8370 | 2009-04-13 15:03:11 +0800 | [diff] [blame] | 33 | #include <plat/i2c.h> |
Jonathan Cameron | b6795fa | 2008-12-12 20:43:09 +0000 | [diff] [blame] | 34 | #include <mach/udc.h> |
| 35 | #include <mach/mmc.h> |
| 36 | #include <mach/pxa2xx_spi.h> |
| 37 | #include <mach/pxa27x-udc.h> |
| 38 | |
| 39 | #include "devices.h" |
| 40 | #include "generic.h" |
| 41 | |
| 42 | static unsigned long imote2_pin_config[] __initdata = { |
| 43 | |
| 44 | /* Device Identification for wakeup*/ |
| 45 | GPIO102_GPIO, |
| 46 | |
| 47 | /* Button */ |
| 48 | GPIO91_GPIO, |
| 49 | |
| 50 | /* DA9030 */ |
| 51 | GPIO1_GPIO, |
| 52 | |
| 53 | /* MMC */ |
| 54 | GPIO32_MMC_CLK, |
| 55 | GPIO112_MMC_CMD, |
| 56 | GPIO92_MMC_DAT_0, |
| 57 | GPIO109_MMC_DAT_1, |
| 58 | GPIO110_MMC_DAT_2, |
| 59 | GPIO111_MMC_DAT_3, |
| 60 | |
| 61 | /* 802.15.4 radio - driver out of mainline */ |
| 62 | GPIO22_GPIO, /* CC_RSTN */ |
| 63 | GPIO114_GPIO, /* CC_FIFO */ |
| 64 | GPIO116_GPIO, /* CC_CCA */ |
| 65 | GPIO0_GPIO, /* CC_FIFOP */ |
| 66 | GPIO16_GPIO, /* CCSFD */ |
| 67 | GPIO39_GPIO, /* CSn */ |
| 68 | GPIO115_GPIO, /* Power enable */ |
| 69 | |
| 70 | /* I2C */ |
| 71 | GPIO117_I2C_SCL, |
| 72 | GPIO118_I2C_SDA, |
| 73 | |
| 74 | /* SSP 3 - 802.15.4 radio */ |
| 75 | GPIO39_GPIO, /* Chip Select */ |
| 76 | GPIO34_SSP3_SCLK, |
| 77 | GPIO35_SSP3_TXD, |
| 78 | GPIO41_SSP3_RXD, |
| 79 | |
| 80 | /* SSP 2 - to daughter boards */ |
| 81 | GPIO37_GPIO, /* Chip Select */ |
| 82 | GPIO36_SSP2_SCLK, |
| 83 | GPIO38_SSP2_TXD, |
| 84 | GPIO11_SSP2_RXD, |
| 85 | |
| 86 | /* SSP 1 - to daughter boards */ |
| 87 | GPIO24_GPIO, /* Chip Select */ |
| 88 | GPIO23_SSP1_SCLK, |
| 89 | GPIO25_SSP1_TXD, |
| 90 | GPIO26_SSP1_RXD, |
| 91 | |
| 92 | /* BTUART Basic Connector*/ |
| 93 | GPIO42_BTUART_RXD, |
| 94 | GPIO43_BTUART_TXD, |
| 95 | GPIO44_BTUART_CTS, |
| 96 | GPIO45_BTUART_RTS, |
| 97 | |
| 98 | /* STUART Serial console via debug board*/ |
| 99 | GPIO46_STUART_RXD, |
| 100 | GPIO47_STUART_TXD, |
| 101 | |
| 102 | /* Basic sensor board */ |
| 103 | GPIO96_GPIO, /* accelerometer interrupt */ |
| 104 | GPIO99_GPIO, /* ADC interrupt */ |
| 105 | |
Jonathan Cameron | a252084 | 2009-05-25 16:50:12 +0000 | [diff] [blame] | 106 | /* SHT15 */ |
| 107 | GPIO100_GPIO, |
| 108 | GPIO98_GPIO, |
| 109 | |
Jonathan Cameron | b6795fa | 2008-12-12 20:43:09 +0000 | [diff] [blame] | 110 | /* Connector pins specified as gpios */ |
| 111 | GPIO94_GPIO, /* large basic connector pin 14 */ |
| 112 | GPIO10_GPIO, /* large basic connector pin 23 */ |
| 113 | |
| 114 | /* LEDS */ |
| 115 | GPIO103_GPIO, /* red led */ |
| 116 | GPIO104_GPIO, /* green led */ |
| 117 | GPIO105_GPIO, /* blue led */ |
| 118 | }; |
| 119 | |
Jonathan Cameron | a252084 | 2009-05-25 16:50:12 +0000 | [diff] [blame] | 120 | static struct sht15_platform_data platform_data_sht15 = { |
| 121 | .gpio_data = 100, |
| 122 | .gpio_sck = 98, |
| 123 | }; |
| 124 | |
| 125 | static struct platform_device sht15 = { |
| 126 | .name = "sht15", |
| 127 | .id = -1, |
| 128 | .dev = { |
| 129 | .platform_data = &platform_data_sht15, |
| 130 | }, |
| 131 | }; |
| 132 | |
| 133 | static struct regulator_consumer_supply imote2_sensor_3_con[] = { |
| 134 | { |
| 135 | .dev = &sht15.dev, |
| 136 | .supply = "vcc", |
| 137 | }, |
| 138 | }; |
| 139 | |
Jonathan Cameron | b6795fa | 2008-12-12 20:43:09 +0000 | [diff] [blame] | 140 | static struct gpio_led imote2_led_pins[] = { |
| 141 | { |
| 142 | .name = "imote2:red", |
| 143 | .gpio = 103, |
| 144 | .active_low = 1, |
| 145 | }, { |
| 146 | .name = "imote2:green", |
| 147 | .gpio = 104, |
| 148 | .active_low = 1, |
| 149 | }, { |
| 150 | .name = "imote2:blue", |
| 151 | .gpio = 105, |
| 152 | .active_low = 1, |
| 153 | }, |
| 154 | }; |
| 155 | |
| 156 | static struct gpio_led_platform_data imote2_led_data = { |
| 157 | .num_leds = ARRAY_SIZE(imote2_led_pins), |
| 158 | .leds = imote2_led_pins, |
| 159 | }; |
| 160 | |
| 161 | static struct platform_device imote2_leds = { |
| 162 | .name = "leds-gpio", |
| 163 | .id = -1, |
| 164 | .dev = { |
| 165 | .platform_data = &imote2_led_data, |
| 166 | }, |
| 167 | }; |
| 168 | |
| 169 | /* Reverse engineered partly from Platformx drivers */ |
| 170 | enum imote2_ldos{ |
| 171 | vcc_vref, |
| 172 | vcc_cc2420, |
| 173 | vcc_mica, |
| 174 | vcc_bt, |
| 175 | /* The two voltages available to sensor boards */ |
| 176 | vcc_sensor_1_8, |
| 177 | vcc_sensor_3, |
| 178 | |
| 179 | vcc_sram_ext, /* directly connected to the pxa271 */ |
| 180 | vcc_pxa_pll, |
| 181 | vcc_pxa_usim, /* Reference voltage for certain gpios */ |
| 182 | vcc_pxa_mem, |
| 183 | vcc_pxa_flash, |
| 184 | vcc_pxa_core, /*Dc-Dc buck not yet supported */ |
| 185 | vcc_lcd, |
| 186 | vcc_bb, |
| 187 | vcc_bbio, |
| 188 | vcc_io, /* cc2420 802.15.4 radio and pxa vcc_io ?*/ |
| 189 | }; |
| 190 | |
| 191 | /* The values of the various regulator constraints are obviously dependent |
| 192 | * on exactly what is wired to each ldo. Unfortunately this information is |
| 193 | * not generally available. More information has been requested from Xbow |
| 194 | * but as of yet they haven't been forthcoming. |
| 195 | * |
| 196 | * Some of these are clearly Stargate 2 related (no way of plugging |
| 197 | * in an lcd on the IM2 for example!). |
| 198 | */ |
| 199 | static struct regulator_init_data imote2_ldo_init_data[] = { |
| 200 | [vcc_bbio] = { |
| 201 | .constraints = { /* board default 1.8V */ |
| 202 | .name = "vcc_bbio", |
| 203 | .min_uV = 1800000, |
| 204 | .max_uV = 1800000, |
| 205 | }, |
| 206 | }, |
| 207 | [vcc_bb] = { |
| 208 | .constraints = { /* board default 2.8V */ |
| 209 | .name = "vcc_bb", |
| 210 | .min_uV = 2700000, |
| 211 | .max_uV = 3000000, |
| 212 | }, |
| 213 | }, |
| 214 | [vcc_pxa_flash] = { |
| 215 | .constraints = {/* default is 1.8V */ |
| 216 | .name = "vcc_pxa_flash", |
| 217 | .min_uV = 1800000, |
| 218 | .max_uV = 1800000, |
| 219 | }, |
| 220 | }, |
| 221 | [vcc_cc2420] = { /* also vcc_io */ |
| 222 | .constraints = { |
| 223 | /* board default is 2.8V */ |
| 224 | .name = "vcc_cc2420", |
| 225 | .min_uV = 2700000, |
| 226 | .max_uV = 3300000, |
| 227 | }, |
| 228 | }, |
| 229 | [vcc_vref] = { /* Reference for what? */ |
| 230 | .constraints = { /* default 1.8V */ |
| 231 | .name = "vcc_vref", |
| 232 | .min_uV = 1800000, |
| 233 | .max_uV = 1800000, |
| 234 | }, |
| 235 | }, |
| 236 | [vcc_sram_ext] = { |
| 237 | .constraints = { /* default 2.8V */ |
| 238 | .name = "vcc_sram_ext", |
| 239 | .min_uV = 2800000, |
| 240 | .max_uV = 2800000, |
| 241 | }, |
| 242 | }, |
| 243 | [vcc_mica] = { |
| 244 | .constraints = { /* default 2.8V */ |
| 245 | .name = "vcc_mica", |
| 246 | .min_uV = 2800000, |
| 247 | .max_uV = 2800000, |
| 248 | }, |
| 249 | }, |
| 250 | [vcc_bt] = { |
| 251 | .constraints = { /* default 2.8V */ |
| 252 | .name = "vcc_bt", |
| 253 | .min_uV = 2800000, |
| 254 | .max_uV = 2800000, |
| 255 | }, |
| 256 | }, |
| 257 | [vcc_lcd] = { |
| 258 | .constraints = { /* default 2.8V */ |
| 259 | .name = "vcc_lcd", |
| 260 | .min_uV = 2700000, |
| 261 | .max_uV = 3300000, |
| 262 | }, |
| 263 | }, |
| 264 | [vcc_io] = { /* Same or higher than everything |
| 265 | * bar vccbat and vccusb */ |
| 266 | .constraints = { /* default 2.8V */ |
| 267 | .name = "vcc_io", |
| 268 | .min_uV = 2692000, |
| 269 | .max_uV = 3300000, |
| 270 | }, |
| 271 | }, |
| 272 | [vcc_sensor_1_8] = { |
| 273 | .constraints = { /* default 1.8V */ |
| 274 | .name = "vcc_sensor_1_8", |
| 275 | .min_uV = 1800000, |
| 276 | .max_uV = 1800000, |
| 277 | }, |
| 278 | }, |
| 279 | [vcc_sensor_3] = { /* curiously default 2.8V */ |
| 280 | .constraints = { |
| 281 | .name = "vcc_sensor_3", |
| 282 | .min_uV = 2800000, |
| 283 | .max_uV = 3000000, |
| 284 | }, |
Jonathan Cameron | a252084 | 2009-05-25 16:50:12 +0000 | [diff] [blame] | 285 | .num_consumer_supplies = ARRAY_SIZE(imote2_sensor_3_con), |
| 286 | .consumer_supplies = imote2_sensor_3_con, |
Jonathan Cameron | b6795fa | 2008-12-12 20:43:09 +0000 | [diff] [blame] | 287 | }, |
| 288 | [vcc_pxa_pll] = { /* 1.17V - 1.43V, default 1.3V*/ |
| 289 | .constraints = { |
| 290 | .name = "vcc_pxa_pll", |
| 291 | .min_uV = 1170000, |
| 292 | .max_uV = 1430000, |
| 293 | }, |
| 294 | }, |
| 295 | [vcc_pxa_usim] = { |
| 296 | .constraints = { /* default 1.8V */ |
| 297 | .name = "vcc_pxa_usim", |
| 298 | .min_uV = 1710000, |
| 299 | .max_uV = 2160000, |
| 300 | }, |
| 301 | }, |
| 302 | [vcc_pxa_mem] = { |
| 303 | .constraints = { /* default 1.8V */ |
| 304 | .name = "vcc_pxa_mem", |
| 305 | .min_uV = 1800000, |
| 306 | .max_uV = 1800000, |
| 307 | }, |
| 308 | }, |
| 309 | }; |
| 310 | |
| 311 | static struct da903x_subdev_info imote2_da9030_subdevs[] = { |
| 312 | { |
| 313 | .name = "da903x-regulator", |
| 314 | .id = DA9030_ID_LDO2, |
| 315 | .platform_data = &imote2_ldo_init_data[vcc_bbio], |
| 316 | }, { |
| 317 | .name = "da903x-regulator", |
| 318 | .id = DA9030_ID_LDO3, |
| 319 | .platform_data = &imote2_ldo_init_data[vcc_bb], |
| 320 | }, { |
| 321 | .name = "da903x-regulator", |
| 322 | .id = DA9030_ID_LDO4, |
| 323 | .platform_data = &imote2_ldo_init_data[vcc_pxa_flash], |
| 324 | }, { |
| 325 | .name = "da903x-regulator", |
| 326 | .id = DA9030_ID_LDO5, |
| 327 | .platform_data = &imote2_ldo_init_data[vcc_cc2420], |
| 328 | }, { |
| 329 | .name = "da903x-regulator", |
| 330 | .id = DA9030_ID_LDO6, |
| 331 | .platform_data = &imote2_ldo_init_data[vcc_vref], |
| 332 | }, { |
| 333 | .name = "da903x-regulator", |
| 334 | .id = DA9030_ID_LDO7, |
| 335 | .platform_data = &imote2_ldo_init_data[vcc_sram_ext], |
| 336 | }, { |
| 337 | .name = "da903x-regulator", |
| 338 | .id = DA9030_ID_LDO8, |
| 339 | .platform_data = &imote2_ldo_init_data[vcc_mica], |
| 340 | }, { |
| 341 | .name = "da903x-regulator", |
| 342 | .id = DA9030_ID_LDO9, |
| 343 | .platform_data = &imote2_ldo_init_data[vcc_bt], |
| 344 | }, { |
| 345 | .name = "da903x-regulator", |
| 346 | .id = DA9030_ID_LDO10, |
| 347 | .platform_data = &imote2_ldo_init_data[vcc_sensor_1_8], |
| 348 | }, { |
| 349 | .name = "da903x-regulator", |
| 350 | .id = DA9030_ID_LDO11, |
| 351 | .platform_data = &imote2_ldo_init_data[vcc_sensor_3], |
| 352 | }, { |
| 353 | .name = "da903x-regulator", |
| 354 | .id = DA9030_ID_LDO12, |
| 355 | .platform_data = &imote2_ldo_init_data[vcc_lcd], |
| 356 | }, { |
| 357 | .name = "da903x-regulator", |
| 358 | .id = DA9030_ID_LDO15, |
| 359 | .platform_data = &imote2_ldo_init_data[vcc_pxa_pll], |
| 360 | }, { |
| 361 | .name = "da903x-regulator", |
| 362 | .id = DA9030_ID_LDO17, |
| 363 | .platform_data = &imote2_ldo_init_data[vcc_pxa_usim], |
| 364 | }, { |
| 365 | .name = "da903x-regulator", |
| 366 | .id = DA9030_ID_LDO18, |
| 367 | .platform_data = &imote2_ldo_init_data[vcc_io], |
| 368 | }, { |
| 369 | .name = "da903x-regulator", |
| 370 | .id = DA9030_ID_LDO19, |
| 371 | .platform_data = &imote2_ldo_init_data[vcc_pxa_mem], |
| 372 | }, |
| 373 | }; |
| 374 | |
| 375 | static struct da903x_platform_data imote2_da9030_pdata = { |
| 376 | .num_subdevs = ARRAY_SIZE(imote2_da9030_subdevs), |
| 377 | .subdevs = imote2_da9030_subdevs, |
| 378 | }; |
| 379 | |
| 380 | /* As the the imote2 doesn't currently have a conventional SD slot |
| 381 | * there is no option to hotplug cards, making all this rather simple |
| 382 | */ |
| 383 | static int imote2_mci_get_ro(struct device *dev) |
| 384 | { |
| 385 | return 0; |
| 386 | } |
| 387 | |
| 388 | /* Rather simple case as hotplugging not possible */ |
| 389 | static struct pxamci_platform_data imote2_mci_platform_data = { |
| 390 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* default anyway */ |
| 391 | .get_ro = imote2_mci_get_ro, |
Robert Jarzmik | 7a64825 | 2009-07-06 22:16:42 +0200 | [diff] [blame] | 392 | .gpio_card_detect = -1, |
| 393 | .gpio_card_ro = -1, |
| 394 | .gpio_power = -1, |
Jonathan Cameron | b6795fa | 2008-12-12 20:43:09 +0000 | [diff] [blame] | 395 | }; |
| 396 | |
| 397 | static struct mtd_partition imote2flash_partitions[] = { |
| 398 | { |
| 399 | .name = "Bootloader", |
| 400 | .size = 0x00040000, |
| 401 | .offset = 0, |
| 402 | .mask_flags = MTD_WRITEABLE, |
| 403 | }, { |
| 404 | .name = "Kernel", |
| 405 | .size = 0x00200000, |
| 406 | .offset = 0x00040000, |
| 407 | .mask_flags = 0, |
| 408 | }, { |
| 409 | .name = "Filesystem", |
| 410 | .size = 0x01DC0000, |
| 411 | .offset = 0x00240000, |
| 412 | .mask_flags = 0, |
| 413 | }, |
| 414 | }; |
| 415 | |
| 416 | static struct resource flash_resources = { |
| 417 | .start = PXA_CS0_PHYS, |
| 418 | .end = PXA_CS0_PHYS + SZ_32M - 1, |
| 419 | .flags = IORESOURCE_MEM, |
| 420 | }; |
| 421 | |
| 422 | static struct flash_platform_data imote2_flash_data = { |
| 423 | .map_name = "cfi_probe", |
| 424 | .parts = imote2flash_partitions, |
| 425 | .nr_parts = ARRAY_SIZE(imote2flash_partitions), |
| 426 | .name = "PXA27xOnChipROM", |
| 427 | .width = 2, |
| 428 | }; |
| 429 | |
| 430 | static struct platform_device imote2_flash_device = { |
| 431 | .name = "pxa2xx-flash", |
| 432 | .id = 0, |
| 433 | .dev = { |
| 434 | .platform_data = &imote2_flash_data, |
| 435 | }, |
| 436 | .resource = &flash_resources, |
| 437 | .num_resources = 1, |
| 438 | }; |
| 439 | |
| 440 | /* Some of the drivers here are out of kernel at the moment (parts of IIO) |
| 441 | * and it may be a while before they are in the mainline. |
| 442 | */ |
| 443 | static struct i2c_board_info __initdata imote2_i2c_board_info[] = { |
| 444 | { /* UCAM sensor board */ |
Jonathan Cameron | d81e77f | 2009-05-25 16:50:10 +0000 | [diff] [blame] | 445 | .type = "max1239", |
Jonathan Cameron | b6795fa | 2008-12-12 20:43:09 +0000 | [diff] [blame] | 446 | .addr = 0x35, |
| 447 | }, { /* ITS400 Sensor board only */ |
| 448 | .type = "max1363", |
| 449 | .addr = 0x34, |
| 450 | /* Through a nand gate - Also beware, on V2 sensor board the |
| 451 | * pull up resistors are missing. |
| 452 | */ |
| 453 | .irq = IRQ_GPIO(99), |
| 454 | }, { /* ITS400 Sensor board only */ |
| 455 | .type = "tsl2561", |
| 456 | .addr = 0x49, |
| 457 | /* Through a nand gate - Also beware, on V2 sensor board the |
| 458 | * pull up resistors are missing. |
| 459 | */ |
| 460 | .irq = IRQ_GPIO(99), |
| 461 | }, { /* ITS400 Sensor board only */ |
| 462 | .type = "tmp175", |
| 463 | .addr = 0x4A, |
| 464 | .irq = IRQ_GPIO(96), |
Jonathan Cameron | 0a0ca89 | 2009-05-25 16:50:14 +0000 | [diff] [blame] | 465 | }, { /* IMB400 Multimedia board */ |
| 466 | .type = "wm8940", |
| 467 | .addr = 0x1A, |
Jonathan Cameron | b6795fa | 2008-12-12 20:43:09 +0000 | [diff] [blame] | 468 | }, |
| 469 | }; |
| 470 | |
| 471 | static struct i2c_board_info __initdata imote2_pwr_i2c_board_info[] = { |
| 472 | { |
| 473 | .type = "da9030", |
| 474 | .addr = 0x49, |
| 475 | .platform_data = &imote2_da9030_pdata, |
| 476 | .irq = gpio_to_irq(1), |
| 477 | }, |
| 478 | }; |
| 479 | |
| 480 | static struct pxa2xx_spi_master pxa_ssp_master_0_info = { |
| 481 | .num_chipselect = 1, |
| 482 | }; |
| 483 | |
| 484 | static struct pxa2xx_spi_master pxa_ssp_master_1_info = { |
| 485 | .num_chipselect = 1, |
| 486 | }; |
| 487 | |
| 488 | static struct pxa2xx_spi_master pxa_ssp_master_2_info = { |
| 489 | .num_chipselect = 1, |
| 490 | }; |
| 491 | |
Jonathan Cameron | b6795fa | 2008-12-12 20:43:09 +0000 | [diff] [blame] | 492 | static struct pxa2xx_spi_chip staccel_chip_info = { |
| 493 | .tx_threshold = 8, |
| 494 | .rx_threshold = 8, |
| 495 | .dma_burst_size = 8, |
| 496 | .timeout = 235, |
Mike Rapoport | 46580c0 | 2009-04-14 08:33:49 +0300 | [diff] [blame] | 497 | .gpio_cs = 24, |
Jonathan Cameron | b6795fa | 2008-12-12 20:43:09 +0000 | [diff] [blame] | 498 | }; |
| 499 | |
| 500 | static struct pxa2xx_spi_chip cc2420_info = { |
| 501 | .tx_threshold = 8, |
| 502 | .rx_threshold = 8, |
| 503 | .dma_burst_size = 8, |
| 504 | .timeout = 235, |
Mike Rapoport | 46580c0 | 2009-04-14 08:33:49 +0300 | [diff] [blame] | 505 | .gpio_cs = 39, |
Jonathan Cameron | b6795fa | 2008-12-12 20:43:09 +0000 | [diff] [blame] | 506 | }; |
| 507 | |
| 508 | static struct spi_board_info spi_board_info[] __initdata = { |
| 509 | { /* Driver in IIO */ |
| 510 | .modalias = "lis3l02dq", |
| 511 | .max_speed_hz = 8000000,/* 8MHz max spi frequency at 3V */ |
| 512 | .bus_num = 1, |
| 513 | .chip_select = 0, |
| 514 | .controller_data = &staccel_chip_info, |
| 515 | .irq = IRQ_GPIO(96), |
| 516 | }, { /* Driver out of kernel as it needs considerable rewriting */ |
| 517 | .modalias = "cc2420", |
| 518 | .max_speed_hz = 6500000, |
| 519 | .bus_num = 3, |
| 520 | .chip_select = 0, |
| 521 | .controller_data = &cc2420_info, |
| 522 | }, |
| 523 | }; |
| 524 | |
| 525 | static void im2_udc_command(int cmd) |
| 526 | { |
| 527 | switch (cmd) { |
| 528 | case PXA2XX_UDC_CMD_CONNECT: |
| 529 | UP2OCR |= UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE; |
| 530 | break; |
| 531 | case PXA2XX_UDC_CMD_DISCONNECT: |
| 532 | UP2OCR &= ~(UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE); |
| 533 | break; |
| 534 | } |
| 535 | } |
| 536 | |
| 537 | static struct pxa2xx_udc_mach_info imote2_udc_info __initdata = { |
| 538 | .udc_command = im2_udc_command, |
| 539 | }; |
| 540 | |
| 541 | static struct platform_device *imote2_devices[] = { |
| 542 | &imote2_flash_device, |
| 543 | &imote2_leds, |
Jonathan Cameron | a252084 | 2009-05-25 16:50:12 +0000 | [diff] [blame] | 544 | &sht15, |
Jonathan Cameron | b6795fa | 2008-12-12 20:43:09 +0000 | [diff] [blame] | 545 | }; |
| 546 | |
| 547 | static struct i2c_pxa_platform_data i2c_pwr_pdata = { |
| 548 | .fast_mode = 1, |
| 549 | }; |
| 550 | |
| 551 | static struct i2c_pxa_platform_data i2c_pdata = { |
| 552 | .fast_mode = 1, |
| 553 | }; |
| 554 | |
| 555 | static void __init imote2_init(void) |
| 556 | { |
Jonathan Cameron | b6795fa | 2008-12-12 20:43:09 +0000 | [diff] [blame] | 557 | pxa2xx_mfp_config(ARRAY_AND_SIZE(imote2_pin_config)); |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 558 | |
| 559 | pxa_set_ffuart_info(NULL); |
| 560 | pxa_set_btuart_info(NULL); |
| 561 | pxa_set_stuart_info(NULL); |
| 562 | |
Jonathan Cameron | b6795fa | 2008-12-12 20:43:09 +0000 | [diff] [blame] | 563 | /* SPI chip select directions - all other directions should |
| 564 | * be handled by drivers.*/ |
| 565 | gpio_direction_output(37, 0); |
Jonathan Cameron | b6795fa | 2008-12-12 20:43:09 +0000 | [diff] [blame] | 566 | |
| 567 | platform_add_devices(imote2_devices, ARRAY_SIZE(imote2_devices)); |
| 568 | |
| 569 | pxa2xx_set_spi_info(1, &pxa_ssp_master_0_info); |
| 570 | pxa2xx_set_spi_info(2, &pxa_ssp_master_1_info); |
| 571 | pxa2xx_set_spi_info(3, &pxa_ssp_master_2_info); |
| 572 | |
| 573 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); |
| 574 | |
| 575 | i2c_register_board_info(0, imote2_i2c_board_info, |
| 576 | ARRAY_SIZE(imote2_i2c_board_info)); |
| 577 | i2c_register_board_info(1, imote2_pwr_i2c_board_info, |
| 578 | ARRAY_SIZE(imote2_pwr_i2c_board_info)); |
| 579 | |
| 580 | pxa27x_set_i2c_power_info(&i2c_pwr_pdata); |
| 581 | pxa_set_i2c_info(&i2c_pdata); |
| 582 | |
| 583 | pxa_set_mci_info(&imote2_mci_platform_data); |
| 584 | pxa_set_udc_info(&imote2_udc_info); |
| 585 | } |
| 586 | |
| 587 | MACHINE_START(INTELMOTE2, "IMOTE 2") |
| 588 | .phys_io = 0x40000000, |
| 589 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 590 | .map_io = pxa_map_io, |
| 591 | .init_irq = pxa27x_init_irq, |
| 592 | .timer = &pxa_timer, |
| 593 | .init_machine = imote2_init, |
| 594 | .boot_params = 0xA0000100, |
| 595 | MACHINE_END |