Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-pxa/palmtc.c |
| 3 | * |
| 4 | * Support for the Palm Tungsten|C |
| 5 | * |
| 6 | * Author: Marek Vasut <marek.vasut@gmail.com> |
| 7 | * |
| 8 | * Based on work of: |
| 9 | * Petr Blaha <p3t3@centrum.cz> |
| 10 | * Chetan S. Kumar <shivakumar.chetan@gmail.com> |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License version 2 as |
| 14 | * published by the Free Software Foundation. |
| 15 | */ |
| 16 | |
| 17 | #include <linux/platform_device.h> |
| 18 | #include <linux/delay.h> |
| 19 | #include <linux/irq.h> |
| 20 | #include <linux/input.h> |
| 21 | #include <linux/pwm_backlight.h> |
| 22 | #include <linux/gpio.h> |
| 23 | #include <linux/input/matrix_keypad.h> |
| 24 | #include <linux/ucb1400.h> |
| 25 | #include <linux/power_supply.h> |
| 26 | #include <linux/gpio_keys.h> |
| 27 | #include <linux/mtd/physmap.h> |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 28 | #include <linux/usb/gpio_vbus.h> |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 29 | |
| 30 | #include <asm/mach-types.h> |
| 31 | #include <asm/mach/arch.h> |
| 32 | #include <asm/mach/map.h> |
| 33 | |
| 34 | #include <mach/audio.h> |
| 35 | #include <mach/palmtc.h> |
| 36 | #include <mach/mmc.h> |
| 37 | #include <mach/pxafb.h> |
| 38 | #include <mach/mfp-pxa25x.h> |
| 39 | #include <mach/irda.h> |
| 40 | #include <mach/udc.h> |
| 41 | #include <mach/pxa2xx-regs.h> |
| 42 | |
| 43 | #include "generic.h" |
| 44 | #include "devices.h" |
| 45 | |
| 46 | /****************************************************************************** |
| 47 | * Pin configuration |
| 48 | ******************************************************************************/ |
| 49 | static unsigned long palmtc_pin_config[] __initdata = { |
| 50 | /* MMC */ |
| 51 | GPIO6_MMC_CLK, |
| 52 | GPIO8_MMC_CS0, |
| 53 | GPIO12_GPIO, /* detect */ |
| 54 | GPIO32_GPIO, /* power */ |
| 55 | GPIO54_GPIO, /* r/o switch */ |
| 56 | |
| 57 | /* PCMCIA */ |
| 58 | GPIO52_nPCE_1, |
| 59 | GPIO53_nPCE_2, |
| 60 | GPIO50_nPIOR, |
| 61 | GPIO51_nPIOW, |
| 62 | GPIO49_nPWE, |
| 63 | GPIO48_nPOE, |
| 64 | GPIO52_nPCE_1, |
| 65 | GPIO53_nPCE_2, |
| 66 | GPIO57_nIOIS16, |
| 67 | GPIO56_nPWAIT, |
| 68 | |
| 69 | /* AC97 */ |
| 70 | GPIO28_AC97_BITCLK, |
| 71 | GPIO29_AC97_SDATA_IN_0, |
| 72 | GPIO30_AC97_SDATA_OUT, |
| 73 | GPIO31_AC97_SYNC, |
| 74 | |
| 75 | /* IrDA */ |
| 76 | GPIO45_GPIO, /* ir disable */ |
| 77 | GPIO46_FICP_RXD, |
| 78 | GPIO47_FICP_TXD, |
| 79 | |
| 80 | /* PWM */ |
| 81 | GPIO17_PWM1_OUT, |
| 82 | |
| 83 | /* USB */ |
| 84 | GPIO4_GPIO, /* detect */ |
| 85 | GPIO36_GPIO, /* pullup */ |
| 86 | |
| 87 | /* LCD */ |
Eric Miao | 07bae6c | 2010-01-04 11:25:10 +0800 | [diff] [blame] | 88 | GPIOxx_LCD_TFT_16BPP, |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 89 | |
| 90 | /* MATRIX KEYPAD */ |
| 91 | GPIO0_GPIO | WAKEUP_ON_EDGE_BOTH, /* in 0 */ |
| 92 | GPIO9_GPIO | WAKEUP_ON_EDGE_BOTH, /* in 1 */ |
| 93 | GPIO10_GPIO | WAKEUP_ON_EDGE_BOTH, /* in 2 */ |
| 94 | GPIO11_GPIO | WAKEUP_ON_EDGE_BOTH, /* in 3 */ |
| 95 | GPIO18_GPIO | MFP_LPM_DRIVE_LOW, /* out 0 */ |
| 96 | GPIO19_GPIO | MFP_LPM_DRIVE_LOW, /* out 1 */ |
| 97 | GPIO20_GPIO | MFP_LPM_DRIVE_LOW, /* out 2 */ |
| 98 | GPIO21_GPIO | MFP_LPM_DRIVE_LOW, /* out 3 */ |
| 99 | GPIO22_GPIO | MFP_LPM_DRIVE_LOW, /* out 4 */ |
| 100 | GPIO23_GPIO | MFP_LPM_DRIVE_LOW, /* out 5 */ |
| 101 | GPIO24_GPIO | MFP_LPM_DRIVE_LOW, /* out 6 */ |
| 102 | GPIO25_GPIO | MFP_LPM_DRIVE_LOW, /* out 7 */ |
| 103 | GPIO26_GPIO | MFP_LPM_DRIVE_LOW, /* out 8 */ |
| 104 | GPIO27_GPIO | MFP_LPM_DRIVE_LOW, /* out 9 */ |
| 105 | GPIO79_GPIO | MFP_LPM_DRIVE_LOW, /* out 10 */ |
| 106 | GPIO80_GPIO | MFP_LPM_DRIVE_LOW, /* out 11 */ |
| 107 | |
| 108 | /* PXA GPIO KEYS */ |
| 109 | GPIO7_GPIO | WAKEUP_ON_EDGE_BOTH, /* hotsync button on cradle */ |
| 110 | |
| 111 | /* MISC */ |
| 112 | GPIO1_RST, /* reset */ |
| 113 | GPIO2_GPIO, /* earphone detect */ |
| 114 | GPIO16_GPIO, /* backlight switch */ |
| 115 | }; |
| 116 | |
| 117 | /****************************************************************************** |
| 118 | * SD/MMC card controller |
| 119 | ******************************************************************************/ |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 120 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 121 | static struct pxamci_platform_data palmtc_mci_platform_data = { |
| 122 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
| 123 | .gpio_power = GPIO_NR_PALMTC_SD_POWER, |
| 124 | .gpio_card_ro = GPIO_NR_PALMTC_SD_READONLY, |
| 125 | .gpio_card_detect = GPIO_NR_PALMTC_SD_DETECT_N, |
Eric Miao | f97cab2 | 2010-04-14 07:00:42 +0800 | [diff] [blame] | 126 | .detect_delay_ms = 200, |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 127 | }; |
| 128 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 129 | static void __init palmtc_mmc_init(void) |
| 130 | { |
| 131 | pxa_set_mci_info(&palmtc_mci_platform_data); |
| 132 | } |
| 133 | #else |
| 134 | static inline void palmtc_mmc_init(void) {} |
| 135 | #endif |
| 136 | |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 137 | /****************************************************************************** |
| 138 | * GPIO keys |
| 139 | ******************************************************************************/ |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 140 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 141 | static struct gpio_keys_button palmtc_pxa_buttons[] = { |
| 142 | {KEY_F8, GPIO_NR_PALMTC_HOTSYNC_BUTTON, 1, "HotSync Button", EV_KEY, 1}, |
| 143 | }; |
| 144 | |
| 145 | static struct gpio_keys_platform_data palmtc_pxa_keys_data = { |
| 146 | .buttons = palmtc_pxa_buttons, |
| 147 | .nbuttons = ARRAY_SIZE(palmtc_pxa_buttons), |
| 148 | }; |
| 149 | |
| 150 | static struct platform_device palmtc_pxa_keys = { |
| 151 | .name = "gpio-keys", |
| 152 | .id = -1, |
| 153 | .dev = { |
| 154 | .platform_data = &palmtc_pxa_keys_data, |
| 155 | }, |
| 156 | }; |
| 157 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 158 | static void __init palmtc_keys_init(void) |
| 159 | { |
| 160 | platform_device_register(&palmtc_pxa_keys); |
| 161 | } |
| 162 | #else |
| 163 | static inline void palmtc_keys_init(void) {} |
| 164 | #endif |
| 165 | |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 166 | /****************************************************************************** |
| 167 | * Backlight |
| 168 | ******************************************************************************/ |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 169 | #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 170 | static int palmtc_backlight_init(struct device *dev) |
| 171 | { |
| 172 | int ret; |
| 173 | |
| 174 | ret = gpio_request(GPIO_NR_PALMTC_BL_POWER, "BL POWER"); |
| 175 | if (ret) |
| 176 | goto err; |
| 177 | ret = gpio_direction_output(GPIO_NR_PALMTC_BL_POWER, 1); |
| 178 | if (ret) |
| 179 | goto err2; |
| 180 | |
| 181 | return 0; |
| 182 | |
| 183 | err2: |
| 184 | gpio_free(GPIO_NR_PALMTC_BL_POWER); |
| 185 | err: |
| 186 | return ret; |
| 187 | } |
| 188 | |
Eric Miao | 2d51a52 | 2010-01-04 11:42:01 +0800 | [diff] [blame] | 189 | static int palmtc_backlight_notify(struct device *dev, int brightness) |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 190 | { |
| 191 | /* backlight is on when GPIO16 AF0 is high */ |
| 192 | gpio_set_value(GPIO_NR_PALMTC_BL_POWER, brightness); |
| 193 | return brightness; |
| 194 | } |
| 195 | |
| 196 | static void palmtc_backlight_exit(struct device *dev) |
| 197 | { |
| 198 | gpio_free(GPIO_NR_PALMTC_BL_POWER); |
| 199 | } |
| 200 | |
| 201 | static struct platform_pwm_backlight_data palmtc_backlight_data = { |
| 202 | .pwm_id = 1, |
| 203 | .max_brightness = PALMTC_MAX_INTENSITY, |
| 204 | .dft_brightness = PALMTC_MAX_INTENSITY, |
| 205 | .pwm_period_ns = PALMTC_PERIOD_NS, |
| 206 | .init = palmtc_backlight_init, |
| 207 | .notify = palmtc_backlight_notify, |
| 208 | .exit = palmtc_backlight_exit, |
| 209 | }; |
| 210 | |
| 211 | static struct platform_device palmtc_backlight = { |
| 212 | .name = "pwm-backlight", |
| 213 | .dev = { |
| 214 | .parent = &pxa25x_device_pwm1.dev, |
| 215 | .platform_data = &palmtc_backlight_data, |
| 216 | }, |
| 217 | }; |
| 218 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 219 | static void __init palmtc_pwm_init(void) |
| 220 | { |
| 221 | platform_device_register(&palmtc_backlight); |
| 222 | } |
| 223 | #else |
| 224 | static inline void palmtc_pwm_init(void) {} |
| 225 | #endif |
| 226 | |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 227 | /****************************************************************************** |
| 228 | * IrDA |
| 229 | ******************************************************************************/ |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 230 | #if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE) |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 231 | static struct pxaficp_platform_data palmtc_ficp_platform_data = { |
Marek Vasut | c4bd017 | 2009-07-17 12:50:43 +0200 | [diff] [blame] | 232 | .gpio_pwdown = GPIO_NR_PALMTC_IR_DISABLE, |
| 233 | .transceiver_cap = IR_SIRMODE | IR_OFF, |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 234 | }; |
| 235 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 236 | static void __init palmtc_irda_init(void) |
| 237 | { |
| 238 | pxa_set_ficp_info(&palmtc_ficp_platform_data); |
| 239 | } |
| 240 | #else |
| 241 | static inline void palmtc_irda_init(void) {} |
| 242 | #endif |
| 243 | |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 244 | /****************************************************************************** |
| 245 | * Keyboard |
| 246 | ******************************************************************************/ |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 247 | #if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE) |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 248 | static const uint32_t palmtc_matrix_keys[] = { |
| 249 | KEY(0, 0, KEY_F1), |
| 250 | KEY(0, 1, KEY_X), |
| 251 | KEY(0, 2, KEY_POWER), |
| 252 | KEY(0, 3, KEY_TAB), |
| 253 | KEY(0, 4, KEY_A), |
| 254 | KEY(0, 5, KEY_Q), |
| 255 | KEY(0, 6, KEY_LEFTSHIFT), |
| 256 | KEY(0, 7, KEY_Z), |
| 257 | KEY(0, 8, KEY_S), |
| 258 | KEY(0, 9, KEY_W), |
| 259 | KEY(0, 10, KEY_E), |
| 260 | KEY(0, 11, KEY_UP), |
| 261 | |
| 262 | KEY(1, 0, KEY_F2), |
| 263 | KEY(1, 1, KEY_DOWN), |
| 264 | KEY(1, 3, KEY_D), |
| 265 | KEY(1, 4, KEY_C), |
| 266 | KEY(1, 5, KEY_F), |
| 267 | KEY(1, 6, KEY_R), |
| 268 | KEY(1, 7, KEY_SPACE), |
| 269 | KEY(1, 8, KEY_V), |
| 270 | KEY(1, 9, KEY_G), |
| 271 | KEY(1, 10, KEY_T), |
| 272 | KEY(1, 11, KEY_LEFT), |
| 273 | |
| 274 | KEY(2, 0, KEY_F3), |
| 275 | KEY(2, 1, KEY_LEFTCTRL), |
| 276 | KEY(2, 3, KEY_H), |
| 277 | KEY(2, 4, KEY_Y), |
| 278 | KEY(2, 5, KEY_N), |
| 279 | KEY(2, 6, KEY_J), |
| 280 | KEY(2, 7, KEY_U), |
| 281 | KEY(2, 8, KEY_M), |
| 282 | KEY(2, 9, KEY_K), |
| 283 | KEY(2, 10, KEY_I), |
| 284 | KEY(2, 11, KEY_RIGHT), |
| 285 | |
| 286 | KEY(3, 0, KEY_F4), |
| 287 | KEY(3, 1, KEY_ENTER), |
| 288 | KEY(3, 3, KEY_DOT), |
| 289 | KEY(3, 4, KEY_L), |
| 290 | KEY(3, 5, KEY_O), |
| 291 | KEY(3, 6, KEY_LEFTALT), |
| 292 | KEY(3, 7, KEY_ENTER), |
| 293 | KEY(3, 8, KEY_BACKSPACE), |
| 294 | KEY(3, 9, KEY_P), |
| 295 | KEY(3, 10, KEY_B), |
| 296 | KEY(3, 11, KEY_FN), |
| 297 | }; |
| 298 | |
| 299 | const struct matrix_keymap_data palmtc_keymap_data = { |
| 300 | .keymap = palmtc_matrix_keys, |
| 301 | .keymap_size = ARRAY_SIZE(palmtc_matrix_keys), |
| 302 | }; |
| 303 | |
Tobias Klauser | 600ae40 | 2010-05-20 10:31:46 +0200 | [diff] [blame] | 304 | static const unsigned int palmtc_keypad_row_gpios[] = { |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 305 | 0, 9, 10, 11 |
| 306 | }; |
| 307 | |
Tobias Klauser | 600ae40 | 2010-05-20 10:31:46 +0200 | [diff] [blame] | 308 | static const unsigned int palmtc_keypad_col_gpios[] = { |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 309 | 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 79, 80 |
| 310 | }; |
| 311 | |
| 312 | static struct matrix_keypad_platform_data palmtc_keypad_platform_data = { |
| 313 | .keymap_data = &palmtc_keymap_data, |
Ondrej Zajicek | 902805d | 2009-10-26 23:59:30 +0100 | [diff] [blame] | 314 | .row_gpios = palmtc_keypad_row_gpios, |
| 315 | .num_row_gpios = ARRAY_SIZE(palmtc_keypad_row_gpios), |
| 316 | .col_gpios = palmtc_keypad_col_gpios, |
| 317 | .num_col_gpios = ARRAY_SIZE(palmtc_keypad_col_gpios), |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 318 | .active_low = 1, |
| 319 | |
| 320 | .debounce_ms = 20, |
| 321 | .col_scan_delay_us = 5, |
| 322 | }; |
| 323 | |
| 324 | static struct platform_device palmtc_keyboard = { |
| 325 | .name = "matrix-keypad", |
| 326 | .id = -1, |
| 327 | .dev = { |
| 328 | .platform_data = &palmtc_keypad_platform_data, |
| 329 | }, |
| 330 | }; |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 331 | static void __init palmtc_mkp_init(void) |
| 332 | { |
| 333 | platform_device_register(&palmtc_keyboard); |
| 334 | } |
| 335 | #else |
| 336 | static inline void palmtc_mkp_init(void) {} |
| 337 | #endif |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 338 | |
| 339 | /****************************************************************************** |
| 340 | * UDC |
| 341 | ******************************************************************************/ |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 342 | #if defined(CONFIG_USB_GADGET_PXA25X)||defined(CONFIG_USB_GADGET_PXA25X_MODULE) |
| 343 | static struct gpio_vbus_mach_info palmtc_udc_info = { |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 344 | .gpio_vbus = GPIO_NR_PALMTC_USB_DETECT_N, |
| 345 | .gpio_vbus_inverted = 1, |
| 346 | .gpio_pullup = GPIO_NR_PALMTC_USB_POWER, |
| 347 | }; |
| 348 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 349 | static struct platform_device palmtc_gpio_vbus = { |
| 350 | .name = "gpio-vbus", |
| 351 | .id = -1, |
| 352 | .dev = { |
| 353 | .platform_data = &palmtc_udc_info, |
| 354 | }, |
| 355 | }; |
| 356 | |
| 357 | static void __init palmtc_udc_init(void) |
| 358 | { |
| 359 | platform_device_register(&palmtc_gpio_vbus); |
| 360 | }; |
| 361 | #else |
| 362 | static inline void palmtc_udc_init(void) {} |
| 363 | #endif |
| 364 | |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 365 | /****************************************************************************** |
| 366 | * Touchscreen / Battery / GPIO-extender |
| 367 | ******************************************************************************/ |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 368 | #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \ |
| 369 | defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE) |
| 370 | static struct platform_device palmtc_ucb1400_device = { |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 371 | .name = "ucb1400_core", |
| 372 | .id = -1, |
| 373 | }; |
| 374 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 375 | static void __init palmtc_ts_init(void) |
| 376 | { |
| 377 | pxa_set_ac97_info(NULL); |
| 378 | platform_device_register(&palmtc_ucb1400_device); |
| 379 | } |
| 380 | #else |
| 381 | static inline void palmtc_ts_init(void) {} |
| 382 | #endif |
| 383 | |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 384 | /****************************************************************************** |
Marek Vasut | 5fe2acc | 2010-08-09 06:13:06 +0200 | [diff] [blame^] | 385 | * LEDs |
| 386 | ******************************************************************************/ |
| 387 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) |
| 388 | struct gpio_led palmtc_gpio_leds[] = { |
| 389 | { |
| 390 | .name = "palmtc:green:user", |
| 391 | .default_trigger = "none", |
| 392 | .gpio = GPIO_NR_PALMTC_LED_POWER, |
| 393 | .active_low = 1, |
| 394 | }, { |
| 395 | .name = "palmtc:vibra:vibra", |
| 396 | .default_trigger = "none", |
| 397 | .gpio = GPIO_NR_PALMTC_VIBRA_POWER, |
| 398 | .active_low = 1, |
| 399 | } |
| 400 | |
| 401 | }; |
| 402 | |
| 403 | static struct gpio_led_platform_data palmtc_gpio_led_info = { |
| 404 | .leds = palmtc_gpio_leds, |
| 405 | .num_leds = ARRAY_SIZE(palmtc_gpio_leds), |
| 406 | }; |
| 407 | |
| 408 | static struct platform_device palmtc_leds = { |
| 409 | .name = "leds-gpio", |
| 410 | .id = -1, |
| 411 | .dev = { |
| 412 | .platform_data = &palmtc_gpio_led_info, |
| 413 | } |
| 414 | }; |
| 415 | |
| 416 | static void __init palmtc_leds_init(void) |
| 417 | { |
| 418 | platform_device_register(&palmtc_leds); |
| 419 | } |
| 420 | #else |
| 421 | static inline void palmtc_leds_init(void) {} |
| 422 | #endif |
| 423 | |
| 424 | /****************************************************************************** |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 425 | * NOR Flash |
| 426 | ******************************************************************************/ |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 427 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 428 | static struct resource palmtc_flash_resource = { |
| 429 | .start = PXA_CS0_PHYS, |
| 430 | .end = PXA_CS0_PHYS + SZ_16M - 1, |
| 431 | .flags = IORESOURCE_MEM, |
| 432 | }; |
| 433 | |
| 434 | static struct mtd_partition palmtc_flash_parts[] = { |
| 435 | { |
| 436 | .name = "U-Boot Bootloader", |
| 437 | .offset = 0x0, |
| 438 | .size = 0x40000, |
| 439 | }, |
| 440 | { |
| 441 | .name = "Linux Kernel", |
| 442 | .offset = 0x40000, |
| 443 | .size = 0x2c0000, |
| 444 | }, |
| 445 | { |
| 446 | .name = "Filesystem", |
| 447 | .offset = 0x300000, |
| 448 | .size = 0xcc0000, |
| 449 | }, |
| 450 | { |
| 451 | .name = "U-Boot Environment", |
| 452 | .offset = 0xfc0000, |
| 453 | .size = MTDPART_SIZ_FULL, |
| 454 | }, |
| 455 | }; |
| 456 | |
| 457 | static struct physmap_flash_data palmtc_flash_data = { |
| 458 | .width = 4, |
| 459 | .parts = palmtc_flash_parts, |
| 460 | .nr_parts = ARRAY_SIZE(palmtc_flash_parts), |
| 461 | }; |
| 462 | |
| 463 | static struct platform_device palmtc_flash = { |
| 464 | .name = "physmap-flash", |
| 465 | .id = -1, |
| 466 | .resource = &palmtc_flash_resource, |
| 467 | .num_resources = 1, |
| 468 | .dev = { |
| 469 | .platform_data = &palmtc_flash_data, |
| 470 | }, |
| 471 | }; |
| 472 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 473 | static void __init palmtc_nor_init(void) |
| 474 | { |
| 475 | platform_device_register(&palmtc_flash); |
| 476 | } |
| 477 | #else |
| 478 | static inline void palmtc_nor_init(void) {} |
| 479 | #endif |
| 480 | |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 481 | /****************************************************************************** |
| 482 | * Framebuffer |
| 483 | ******************************************************************************/ |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 484 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 485 | static struct pxafb_mode_info palmtc_lcd_modes[] = { |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 486 | { |
| 487 | .pixclock = 115384, |
| 488 | .xres = 320, |
| 489 | .yres = 320, |
| 490 | .bpp = 16, |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 491 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 492 | .left_margin = 27, |
| 493 | .right_margin = 7, |
| 494 | .upper_margin = 7, |
| 495 | .lower_margin = 8, |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 496 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 497 | .hsync_len = 6, |
| 498 | .vsync_len = 1, |
| 499 | }, |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 500 | }; |
| 501 | |
| 502 | static struct pxafb_mach_info palmtc_lcd_screen = { |
| 503 | .modes = palmtc_lcd_modes, |
| 504 | .num_modes = ARRAY_SIZE(palmtc_lcd_modes), |
| 505 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, |
| 506 | }; |
| 507 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 508 | static void __init palmtc_lcd_init(void) |
| 509 | { |
| 510 | set_pxa_fb_info(&palmtc_lcd_screen); |
| 511 | } |
| 512 | #else |
| 513 | static inline void palmtc_lcd_init(void) {} |
| 514 | #endif |
| 515 | |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 516 | /****************************************************************************** |
| 517 | * Machine init |
| 518 | ******************************************************************************/ |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 519 | static void __init palmtc_init(void) |
| 520 | { |
| 521 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtc_pin_config)); |
| 522 | |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 523 | pxa_set_ffuart_info(NULL); |
| 524 | pxa_set_btuart_info(NULL); |
| 525 | pxa_set_stuart_info(NULL); |
| 526 | pxa_set_hwuart_info(NULL); |
| 527 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 528 | palmtc_mmc_init(); |
| 529 | palmtc_keys_init(); |
| 530 | palmtc_pwm_init(); |
| 531 | palmtc_irda_init(); |
| 532 | palmtc_mkp_init(); |
| 533 | palmtc_udc_init(); |
| 534 | palmtc_ts_init(); |
| 535 | palmtc_nor_init(); |
| 536 | palmtc_lcd_init(); |
Marek Vasut | 5fe2acc | 2010-08-09 06:13:06 +0200 | [diff] [blame^] | 537 | palmtc_leds_init(); |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 538 | }; |
| 539 | |
| 540 | MACHINE_START(PALMTC, "Palm Tungsten|C") |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 541 | .boot_params = 0xa0000100, |
Marek Vasut | 851982c | 2010-10-11 02:20:19 +0200 | [diff] [blame] | 542 | .map_io = pxa25x_map_io, |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 543 | .init_irq = pxa25x_init_irq, |
| 544 | .timer = &pxa_timer, |
| 545 | .init_machine = palmtc_init |
| 546 | MACHINE_END |