Marek Vasut | b637799 | 2010-02-28 12:41:23 +0100 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-pxa/z2.c |
| 3 | * |
| 4 | * Support for the Zipit Z2 Handheld device. |
| 5 | * |
Marek Vasut | 60adc11 | 2010-06-03 03:50:10 +0200 | [diff] [blame] | 6 | * Copyright (C) 2009-2010 Marek Vasut <marek.vasut@gmail.com> |
| 7 | * |
| 8 | * Based on research and code by: Ken McGuire |
Marek Vasut | b637799 | 2010-02-28 12:41:23 +0100 | [diff] [blame] | 9 | * Based on mainstone.c as modified for the Zipit Z2. |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License version 2 as |
| 13 | * published by the Free Software Foundation. |
| 14 | */ |
| 15 | |
| 16 | #include <linux/platform_device.h> |
| 17 | #include <linux/mtd/mtd.h> |
| 18 | #include <linux/mtd/partitions.h> |
| 19 | #include <linux/pwm_backlight.h> |
| 20 | #include <linux/dma-mapping.h> |
| 21 | #include <linux/spi/spi.h> |
| 22 | #include <linux/spi/libertas_spi.h> |
| 23 | #include <linux/spi/lms283gf05.h> |
| 24 | #include <linux/power_supply.h> |
| 25 | #include <linux/mtd/physmap.h> |
| 26 | #include <linux/gpio.h> |
| 27 | #include <linux/gpio_keys.h> |
| 28 | #include <linux/delay.h> |
| 29 | |
| 30 | #include <asm/mach-types.h> |
| 31 | #include <asm/mach/arch.h> |
| 32 | |
| 33 | #include <mach/pxa27x.h> |
| 34 | #include <mach/mfp-pxa27x.h> |
| 35 | #include <mach/z2.h> |
| 36 | #include <mach/pxafb.h> |
| 37 | #include <mach/mmc.h> |
| 38 | #include <mach/pxa27x_keypad.h> |
| 39 | #include <mach/pxa2xx_spi.h> |
| 40 | |
| 41 | #include <plat/i2c.h> |
| 42 | |
| 43 | #include "generic.h" |
| 44 | #include "devices.h" |
| 45 | |
| 46 | /****************************************************************************** |
| 47 | * Pin configuration |
| 48 | ******************************************************************************/ |
| 49 | static unsigned long z2_pin_config[] = { |
| 50 | |
| 51 | /* LCD - 16bpp Active TFT */ |
| 52 | GPIO58_LCD_LDD_0, |
| 53 | GPIO59_LCD_LDD_1, |
| 54 | GPIO60_LCD_LDD_2, |
| 55 | GPIO61_LCD_LDD_3, |
| 56 | GPIO62_LCD_LDD_4, |
| 57 | GPIO63_LCD_LDD_5, |
| 58 | GPIO64_LCD_LDD_6, |
| 59 | GPIO65_LCD_LDD_7, |
| 60 | GPIO66_LCD_LDD_8, |
| 61 | GPIO67_LCD_LDD_9, |
| 62 | GPIO68_LCD_LDD_10, |
| 63 | GPIO69_LCD_LDD_11, |
| 64 | GPIO70_LCD_LDD_12, |
| 65 | GPIO71_LCD_LDD_13, |
| 66 | GPIO72_LCD_LDD_14, |
| 67 | GPIO73_LCD_LDD_15, |
| 68 | GPIO74_LCD_FCLK, |
| 69 | GPIO75_LCD_LCLK, |
| 70 | GPIO76_LCD_PCLK, |
| 71 | GPIO77_LCD_BIAS, |
| 72 | GPIO19_GPIO, /* LCD reset */ |
| 73 | GPIO88_GPIO, /* LCD chipselect */ |
| 74 | |
| 75 | /* PWM */ |
| 76 | GPIO115_PWM1_OUT, /* Keypad Backlight */ |
| 77 | GPIO11_PWM2_OUT, /* LCD Backlight */ |
| 78 | |
| 79 | /* MMC */ |
| 80 | GPIO32_MMC_CLK, |
| 81 | GPIO112_MMC_CMD, |
| 82 | GPIO92_MMC_DAT_0, |
| 83 | GPIO109_MMC_DAT_1, |
| 84 | GPIO110_MMC_DAT_2, |
| 85 | GPIO111_MMC_DAT_3, |
| 86 | GPIO96_GPIO, /* SD detect */ |
| 87 | |
| 88 | /* STUART */ |
| 89 | GPIO46_STUART_RXD, |
| 90 | GPIO47_STUART_TXD, |
| 91 | |
| 92 | /* Keypad */ |
| 93 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, |
| 94 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, |
| 95 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, |
| 96 | GPIO34_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, |
| 97 | GPIO38_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH, |
| 98 | GPIO16_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH, |
| 99 | GPIO17_KP_MKIN_6 | WAKEUP_ON_LEVEL_HIGH, |
| 100 | GPIO103_KP_MKOUT_0, |
| 101 | GPIO104_KP_MKOUT_1, |
| 102 | GPIO105_KP_MKOUT_2, |
| 103 | GPIO106_KP_MKOUT_3, |
| 104 | GPIO107_KP_MKOUT_4, |
| 105 | GPIO108_KP_MKOUT_5, |
| 106 | GPIO35_KP_MKOUT_6, |
| 107 | GPIO41_KP_MKOUT_7, |
| 108 | |
| 109 | /* I2C */ |
| 110 | GPIO117_I2C_SCL, |
| 111 | GPIO118_I2C_SDA, |
| 112 | |
| 113 | /* SSP1 */ |
| 114 | GPIO23_SSP1_SCLK, /* SSP1_SCK */ |
| 115 | GPIO25_SSP1_TXD, /* SSP1_TXD */ |
| 116 | GPIO26_SSP1_RXD, /* SSP1_RXD */ |
| 117 | |
| 118 | /* SSP2 */ |
| 119 | GPIO22_SSP2_SCLK, /* SSP2_SCK */ |
| 120 | GPIO13_SSP2_TXD, /* SSP2_TXD */ |
| 121 | GPIO40_SSP2_RXD, /* SSP2_RXD */ |
| 122 | |
| 123 | /* LEDs */ |
| 124 | GPIO10_GPIO, /* WiFi LED */ |
| 125 | GPIO83_GPIO, /* Charging LED */ |
| 126 | GPIO85_GPIO, /* Charged LED */ |
| 127 | |
| 128 | /* I2S */ |
| 129 | GPIO28_I2S_BITCLK_OUT, |
| 130 | GPIO29_I2S_SDATA_IN, |
| 131 | GPIO30_I2S_SDATA_OUT, |
| 132 | GPIO31_I2S_SYNC, |
| 133 | GPIO113_I2S_SYSCLK, |
| 134 | |
| 135 | /* MISC */ |
| 136 | GPIO0_GPIO, /* AC power detect */ |
| 137 | GPIO1_GPIO, /* Power button */ |
| 138 | GPIO37_GPIO, /* Headphone detect */ |
| 139 | GPIO98_GPIO, /* Lid switch */ |
| 140 | GPIO14_GPIO, /* WiFi Reset */ |
| 141 | GPIO15_GPIO, /* WiFi Power */ |
| 142 | GPIO24_GPIO, /* WiFi CS */ |
| 143 | GPIO36_GPIO, /* WiFi IRQ */ |
| 144 | GPIO88_GPIO, /* LCD CS */ |
| 145 | }; |
| 146 | |
| 147 | /****************************************************************************** |
| 148 | * NOR Flash |
| 149 | ******************************************************************************/ |
| 150 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
| 151 | static struct resource z2_flash_resource = { |
| 152 | .start = PXA_CS0_PHYS, |
| 153 | .end = PXA_CS0_PHYS + SZ_8M - 1, |
| 154 | .flags = IORESOURCE_MEM, |
| 155 | }; |
| 156 | |
| 157 | static struct mtd_partition z2_flash_parts[] = { |
| 158 | { |
| 159 | .name = "U-Boot Bootloader", |
| 160 | .offset = 0x0, |
Marek Vasut | 60adc11 | 2010-06-03 03:50:10 +0200 | [diff] [blame] | 161 | .size = 0x40000, |
| 162 | }, { |
Marek Vasut | b637799 | 2010-02-28 12:41:23 +0100 | [diff] [blame] | 163 | .name = "U-Boot Environment", |
Marek Vasut | 60adc11 | 2010-06-03 03:50:10 +0200 | [diff] [blame] | 164 | .offset = 0x40000, |
| 165 | .size = 0x60000, |
| 166 | }, { |
| 167 | .name = "Flash", |
| 168 | .offset = 0x60000, |
Marek Vasut | b637799 | 2010-02-28 12:41:23 +0100 | [diff] [blame] | 169 | .size = MTDPART_SIZ_FULL, |
| 170 | }, |
| 171 | }; |
| 172 | |
| 173 | static struct physmap_flash_data z2_flash_data = { |
| 174 | .width = 2, |
| 175 | .parts = z2_flash_parts, |
| 176 | .nr_parts = ARRAY_SIZE(z2_flash_parts), |
| 177 | }; |
| 178 | |
| 179 | static struct platform_device z2_flash = { |
| 180 | .name = "physmap-flash", |
| 181 | .id = -1, |
| 182 | .resource = &z2_flash_resource, |
| 183 | .num_resources = 1, |
| 184 | .dev = { |
| 185 | .platform_data = &z2_flash_data, |
| 186 | }, |
| 187 | }; |
| 188 | |
| 189 | static void __init z2_nor_init(void) |
| 190 | { |
| 191 | platform_device_register(&z2_flash); |
| 192 | } |
| 193 | #else |
| 194 | static inline void z2_nor_init(void) {} |
| 195 | #endif |
| 196 | |
| 197 | /****************************************************************************** |
| 198 | * Backlight |
| 199 | ******************************************************************************/ |
| 200 | #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) |
| 201 | static struct platform_pwm_backlight_data z2_backlight_data[] = { |
| 202 | [0] = { |
| 203 | /* Keypad Backlight */ |
| 204 | .pwm_id = 1, |
| 205 | .max_brightness = 1023, |
| 206 | .dft_brightness = 512, |
| 207 | .pwm_period_ns = 1260320, |
| 208 | }, |
| 209 | [1] = { |
| 210 | /* LCD Backlight */ |
| 211 | .pwm_id = 2, |
| 212 | .max_brightness = 1023, |
| 213 | .dft_brightness = 512, |
| 214 | .pwm_period_ns = 1260320, |
| 215 | }, |
| 216 | }; |
| 217 | |
| 218 | static struct platform_device z2_backlight_devices[2] = { |
| 219 | { |
| 220 | .name = "pwm-backlight", |
| 221 | .id = 0, |
| 222 | .dev = { |
| 223 | .platform_data = &z2_backlight_data[1], |
| 224 | }, |
| 225 | }, |
| 226 | { |
| 227 | .name = "pwm-backlight", |
| 228 | .id = 1, |
| 229 | .dev = { |
| 230 | .platform_data = &z2_backlight_data[0], |
| 231 | }, |
| 232 | }, |
| 233 | }; |
| 234 | static void __init z2_pwm_init(void) |
| 235 | { |
| 236 | platform_device_register(&z2_backlight_devices[0]); |
| 237 | platform_device_register(&z2_backlight_devices[1]); |
| 238 | } |
| 239 | #else |
| 240 | static inline void z2_pwm_init(void) {} |
| 241 | #endif |
| 242 | |
| 243 | /****************************************************************************** |
| 244 | * Framebuffer |
| 245 | ******************************************************************************/ |
| 246 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) |
| 247 | static struct pxafb_mode_info z2_lcd_modes[] = { |
| 248 | { |
| 249 | .pixclock = 192000, |
| 250 | .xres = 240, |
| 251 | .yres = 320, |
| 252 | .bpp = 16, |
| 253 | |
| 254 | .left_margin = 4, |
| 255 | .right_margin = 8, |
| 256 | .upper_margin = 4, |
| 257 | .lower_margin = 8, |
| 258 | |
| 259 | .hsync_len = 4, |
| 260 | .vsync_len = 4, |
| 261 | }, |
| 262 | }; |
| 263 | |
| 264 | static struct pxafb_mach_info z2_lcd_screen = { |
| 265 | .modes = z2_lcd_modes, |
| 266 | .num_modes = ARRAY_SIZE(z2_lcd_modes), |
| 267 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_BIAS_ACTIVE_LOW | |
| 268 | LCD_ALTERNATE_MAPPING, |
| 269 | }; |
| 270 | |
| 271 | static void __init z2_lcd_init(void) |
| 272 | { |
| 273 | set_pxa_fb_info(&z2_lcd_screen); |
| 274 | } |
| 275 | #else |
| 276 | static inline void z2_lcd_init(void) {} |
| 277 | #endif |
| 278 | |
| 279 | /****************************************************************************** |
| 280 | * SD/MMC card controller |
| 281 | ******************************************************************************/ |
| 282 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) |
| 283 | static struct pxamci_platform_data z2_mci_platform_data = { |
| 284 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
| 285 | .gpio_card_detect = GPIO96_ZIPITZ2_SD_DETECT, |
| 286 | .gpio_power = -1, |
| 287 | .gpio_card_ro = -1, |
Eric Miao | f97cab2 | 2010-04-14 07:00:42 +0800 | [diff] [blame] | 288 | .detect_delay_ms = 200, |
Marek Vasut | b637799 | 2010-02-28 12:41:23 +0100 | [diff] [blame] | 289 | }; |
| 290 | |
| 291 | static void __init z2_mmc_init(void) |
| 292 | { |
| 293 | pxa_set_mci_info(&z2_mci_platform_data); |
| 294 | } |
| 295 | #else |
| 296 | static inline void z2_mmc_init(void) {} |
| 297 | #endif |
| 298 | |
| 299 | /****************************************************************************** |
| 300 | * LEDs |
| 301 | ******************************************************************************/ |
| 302 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) |
| 303 | struct gpio_led z2_gpio_leds[] = { |
| 304 | { |
| 305 | .name = "z2:green:wifi", |
| 306 | .default_trigger = "none", |
| 307 | .gpio = GPIO10_ZIPITZ2_LED_WIFI, |
| 308 | .active_low = 1, |
| 309 | }, { |
| 310 | .name = "z2:green:charged", |
| 311 | .default_trigger = "none", |
| 312 | .gpio = GPIO85_ZIPITZ2_LED_CHARGED, |
| 313 | .active_low = 1, |
| 314 | }, { |
| 315 | .name = "z2:amber:charging", |
| 316 | .default_trigger = "none", |
| 317 | .gpio = GPIO83_ZIPITZ2_LED_CHARGING, |
| 318 | .active_low = 1, |
| 319 | }, |
| 320 | }; |
| 321 | |
| 322 | static struct gpio_led_platform_data z2_gpio_led_info = { |
| 323 | .leds = z2_gpio_leds, |
| 324 | .num_leds = ARRAY_SIZE(z2_gpio_leds), |
| 325 | }; |
| 326 | |
| 327 | static struct platform_device z2_leds = { |
| 328 | .name = "leds-gpio", |
| 329 | .id = -1, |
| 330 | .dev = { |
| 331 | .platform_data = &z2_gpio_led_info, |
| 332 | } |
| 333 | }; |
| 334 | |
| 335 | static void __init z2_leds_init(void) |
| 336 | { |
| 337 | platform_device_register(&z2_leds); |
| 338 | } |
| 339 | #else |
| 340 | static inline void z2_leds_init(void) {} |
| 341 | #endif |
| 342 | |
| 343 | /****************************************************************************** |
| 344 | * GPIO keyboard |
| 345 | ******************************************************************************/ |
| 346 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) |
| 347 | static unsigned int z2_matrix_keys[] = { |
| 348 | KEY(0, 0, KEY_OPTION), |
| 349 | KEY(1, 0, KEY_UP), |
| 350 | KEY(2, 0, KEY_DOWN), |
| 351 | KEY(3, 0, KEY_LEFT), |
| 352 | KEY(4, 0, KEY_RIGHT), |
| 353 | KEY(5, 0, KEY_END), |
| 354 | KEY(6, 0, KEY_KPPLUS), |
| 355 | |
| 356 | KEY(0, 1, KEY_HOME), |
| 357 | KEY(1, 1, KEY_Q), |
| 358 | KEY(2, 1, KEY_I), |
| 359 | KEY(3, 1, KEY_G), |
| 360 | KEY(4, 1, KEY_X), |
| 361 | KEY(5, 1, KEY_ENTER), |
| 362 | KEY(6, 1, KEY_KPMINUS), |
| 363 | |
| 364 | KEY(0, 2, KEY_PAGEUP), |
| 365 | KEY(1, 2, KEY_W), |
| 366 | KEY(2, 2, KEY_O), |
| 367 | KEY(3, 2, KEY_H), |
| 368 | KEY(4, 2, KEY_C), |
| 369 | KEY(5, 2, KEY_LEFTALT), |
| 370 | |
| 371 | KEY(0, 3, KEY_PAGEDOWN), |
| 372 | KEY(1, 3, KEY_E), |
| 373 | KEY(2, 3, KEY_P), |
| 374 | KEY(3, 3, KEY_J), |
| 375 | KEY(4, 3, KEY_V), |
| 376 | KEY(5, 3, KEY_LEFTSHIFT), |
| 377 | |
| 378 | KEY(0, 4, KEY_ESC), |
| 379 | KEY(1, 4, KEY_R), |
| 380 | KEY(2, 4, KEY_A), |
| 381 | KEY(3, 4, KEY_K), |
| 382 | KEY(4, 4, KEY_B), |
| 383 | KEY(5, 4, KEY_LEFTCTRL), |
| 384 | |
| 385 | KEY(0, 5, KEY_TAB), |
| 386 | KEY(1, 5, KEY_T), |
| 387 | KEY(2, 5, KEY_S), |
| 388 | KEY(3, 5, KEY_L), |
| 389 | KEY(4, 5, KEY_N), |
| 390 | KEY(5, 5, KEY_SPACE), |
| 391 | |
| 392 | KEY(0, 6, KEY_STOPCD), |
| 393 | KEY(1, 6, KEY_Y), |
| 394 | KEY(2, 6, KEY_D), |
| 395 | KEY(3, 6, KEY_BACKSPACE), |
| 396 | KEY(4, 6, KEY_M), |
| 397 | KEY(5, 6, KEY_COMMA), |
| 398 | |
| 399 | KEY(0, 7, KEY_PLAYCD), |
| 400 | KEY(1, 7, KEY_U), |
| 401 | KEY(2, 7, KEY_F), |
| 402 | KEY(3, 7, KEY_Z), |
| 403 | KEY(4, 7, KEY_SEMICOLON), |
| 404 | KEY(5, 7, KEY_DOT), |
| 405 | }; |
| 406 | |
| 407 | static struct pxa27x_keypad_platform_data z2_keypad_platform_data = { |
| 408 | .matrix_key_rows = 7, |
| 409 | .matrix_key_cols = 8, |
| 410 | .matrix_key_map = z2_matrix_keys, |
| 411 | .matrix_key_map_size = ARRAY_SIZE(z2_matrix_keys), |
| 412 | |
| 413 | .debounce_interval = 30, |
| 414 | }; |
| 415 | |
| 416 | static void __init z2_mkp_init(void) |
| 417 | { |
| 418 | pxa_set_keypad_info(&z2_keypad_platform_data); |
| 419 | } |
| 420 | #else |
| 421 | static inline void z2_mkp_init(void) {} |
| 422 | #endif |
| 423 | |
| 424 | /****************************************************************************** |
| 425 | * GPIO keys |
| 426 | ******************************************************************************/ |
| 427 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 428 | static struct gpio_keys_button z2_pxa_buttons[] = { |
| 429 | {KEY_POWER, GPIO1_ZIPITZ2_POWER_BUTTON, 0, "Power Button" }, |
| 430 | {KEY_CLOSE, GPIO98_ZIPITZ2_LID_BUTTON, 0, "Lid Button" }, |
| 431 | }; |
| 432 | |
| 433 | static struct gpio_keys_platform_data z2_pxa_keys_data = { |
| 434 | .buttons = z2_pxa_buttons, |
| 435 | .nbuttons = ARRAY_SIZE(z2_pxa_buttons), |
| 436 | }; |
| 437 | |
| 438 | static struct platform_device z2_pxa_keys = { |
| 439 | .name = "gpio-keys", |
| 440 | .id = -1, |
| 441 | .dev = { |
| 442 | .platform_data = &z2_pxa_keys_data, |
| 443 | }, |
| 444 | }; |
| 445 | |
| 446 | static void __init z2_keys_init(void) |
| 447 | { |
| 448 | platform_device_register(&z2_pxa_keys); |
| 449 | } |
| 450 | #else |
| 451 | static inline void z2_keys_init(void) {} |
| 452 | #endif |
| 453 | |
| 454 | /****************************************************************************** |
| 455 | * SSP Devices - WiFi and LCD control |
| 456 | ******************************************************************************/ |
| 457 | #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE) |
| 458 | /* WiFi */ |
| 459 | static int z2_lbs_spi_setup(struct spi_device *spi) |
| 460 | { |
| 461 | int ret = 0; |
| 462 | |
| 463 | ret = gpio_request(GPIO15_ZIPITZ2_WIFI_POWER, "WiFi Power"); |
| 464 | if (ret) |
| 465 | goto err; |
| 466 | |
| 467 | ret = gpio_direction_output(GPIO15_ZIPITZ2_WIFI_POWER, 1); |
| 468 | if (ret) |
| 469 | goto err2; |
| 470 | |
| 471 | ret = gpio_request(GPIO14_ZIPITZ2_WIFI_RESET, "WiFi Reset"); |
| 472 | if (ret) |
| 473 | goto err2; |
| 474 | |
| 475 | ret = gpio_direction_output(GPIO14_ZIPITZ2_WIFI_RESET, 0); |
| 476 | if (ret) |
| 477 | goto err3; |
| 478 | |
| 479 | /* Reset the card */ |
| 480 | mdelay(180); |
| 481 | gpio_set_value(GPIO14_ZIPITZ2_WIFI_RESET, 1); |
| 482 | mdelay(20); |
| 483 | |
| 484 | spi->bits_per_word = 16; |
| 485 | spi->mode = SPI_MODE_2, |
| 486 | |
| 487 | spi_setup(spi); |
| 488 | |
| 489 | return 0; |
| 490 | |
| 491 | err3: |
| 492 | gpio_free(GPIO14_ZIPITZ2_WIFI_RESET); |
| 493 | err2: |
| 494 | gpio_free(GPIO15_ZIPITZ2_WIFI_POWER); |
| 495 | err: |
| 496 | return ret; |
| 497 | }; |
| 498 | |
| 499 | static int z2_lbs_spi_teardown(struct spi_device *spi) |
| 500 | { |
| 501 | gpio_set_value(GPIO14_ZIPITZ2_WIFI_RESET, 0); |
| 502 | gpio_set_value(GPIO15_ZIPITZ2_WIFI_POWER, 0); |
| 503 | gpio_free(GPIO14_ZIPITZ2_WIFI_RESET); |
| 504 | gpio_free(GPIO15_ZIPITZ2_WIFI_POWER); |
| 505 | return 0; |
| 506 | |
| 507 | }; |
| 508 | |
| 509 | static struct pxa2xx_spi_chip z2_lbs_chip_info = { |
| 510 | .rx_threshold = 8, |
| 511 | .tx_threshold = 8, |
| 512 | .timeout = 1000, |
| 513 | .gpio_cs = GPIO24_ZIPITZ2_WIFI_CS, |
| 514 | }; |
| 515 | |
| 516 | static struct libertas_spi_platform_data z2_lbs_pdata = { |
| 517 | .use_dummy_writes = 1, |
| 518 | .setup = z2_lbs_spi_setup, |
| 519 | .teardown = z2_lbs_spi_teardown, |
| 520 | }; |
| 521 | |
| 522 | /* LCD */ |
| 523 | static struct pxa2xx_spi_chip lms283_chip_info = { |
| 524 | .rx_threshold = 1, |
| 525 | .tx_threshold = 1, |
| 526 | .timeout = 64, |
| 527 | .gpio_cs = GPIO88_ZIPITZ2_LCD_CS, |
| 528 | }; |
| 529 | |
| 530 | static const struct lms283gf05_pdata lms283_pdata = { |
| 531 | .reset_gpio = GPIO19_ZIPITZ2_LCD_RESET, |
| 532 | }; |
| 533 | |
| 534 | static struct spi_board_info spi_board_info[] __initdata = { |
| 535 | { |
| 536 | .modalias = "libertas_spi", |
| 537 | .platform_data = &z2_lbs_pdata, |
| 538 | .controller_data = &z2_lbs_chip_info, |
| 539 | .irq = gpio_to_irq(GPIO36_ZIPITZ2_WIFI_IRQ), |
| 540 | .max_speed_hz = 13000000, |
| 541 | .bus_num = 1, |
| 542 | .chip_select = 0, |
| 543 | }, |
| 544 | { |
| 545 | .modalias = "lms283gf05", |
| 546 | .controller_data = &lms283_chip_info, |
| 547 | .platform_data = &lms283_pdata, |
| 548 | .max_speed_hz = 400000, |
| 549 | .bus_num = 2, |
| 550 | .chip_select = 0, |
| 551 | }, |
| 552 | }; |
| 553 | |
| 554 | static struct pxa2xx_spi_master pxa_ssp1_master_info = { |
| 555 | .clock_enable = CKEN_SSP, |
| 556 | .num_chipselect = 1, |
| 557 | .enable_dma = 1, |
| 558 | }; |
| 559 | |
| 560 | static struct pxa2xx_spi_master pxa_ssp2_master_info = { |
| 561 | .clock_enable = CKEN_SSP2, |
| 562 | .num_chipselect = 1, |
| 563 | }; |
| 564 | |
| 565 | static void __init z2_spi_init(void) |
| 566 | { |
| 567 | pxa2xx_set_spi_info(1, &pxa_ssp1_master_info); |
| 568 | pxa2xx_set_spi_info(2, &pxa_ssp2_master_info); |
| 569 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); |
| 570 | } |
| 571 | #else |
| 572 | static inline void z2_spi_init(void) {} |
| 573 | #endif |
| 574 | |
| 575 | /****************************************************************************** |
| 576 | * Machine init |
| 577 | ******************************************************************************/ |
| 578 | static void __init z2_init(void) |
| 579 | { |
| 580 | pxa2xx_mfp_config(ARRAY_AND_SIZE(z2_pin_config)); |
| 581 | |
| 582 | z2_lcd_init(); |
| 583 | z2_mmc_init(); |
| 584 | z2_mkp_init(); |
| 585 | |
| 586 | pxa_set_i2c_info(NULL); |
| 587 | |
| 588 | z2_spi_init(); |
| 589 | z2_nor_init(); |
| 590 | z2_pwm_init(); |
| 591 | z2_leds_init(); |
| 592 | z2_keys_init(); |
| 593 | } |
| 594 | |
| 595 | MACHINE_START(ZIPIT2, "Zipit Z2") |
| 596 | .phys_io = 0x40000000, |
| 597 | .boot_params = 0xa0000100, |
| 598 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 599 | .map_io = pxa_map_io, |
| 600 | .init_irq = pxa27x_init_irq, |
| 601 | .timer = &pxa_timer, |
| 602 | .init_machine = z2_init, |
| 603 | MACHINE_END |