0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include <linux/platform_device.h>
0015 #include <linux/delay.h>
0016 #include <linux/irq.h>
0017 #include <linux/input.h>
0018 #include <linux/pwm.h>
0019 #include <linux/pwm_backlight.h>
0020 #include <linux/gpio/machine.h>
0021 #include <linux/input/matrix_keypad.h>
0022 #include <linux/ucb1400.h>
0023 #include <linux/power_supply.h>
0024 #include <linux/gpio_keys.h>
0025 #include <linux/mtd/physmap.h>
0026
0027 #include <asm/mach-types.h>
0028 #include <asm/mach/arch.h>
0029 #include <asm/mach/map.h>
0030
0031 #include "pxa25x.h"
0032 #include <linux/platform_data/asoc-pxa.h>
0033 #include "palmtc.h"
0034 #include <linux/platform_data/mmc-pxamci.h>
0035 #include <linux/platform_data/video-pxafb.h>
0036 #include <linux/platform_data/irda-pxaficp.h>
0037 #include "udc.h"
0038
0039 #include "generic.h"
0040 #include "devices.h"
0041
0042
0043
0044
0045 static unsigned long palmtc_pin_config[] __initdata = {
0046
0047 GPIO6_MMC_CLK,
0048 GPIO8_MMC_CS0,
0049 GPIO12_GPIO,
0050 GPIO32_GPIO,
0051 GPIO54_GPIO,
0052
0053
0054 GPIO52_nPCE_1,
0055 GPIO53_nPCE_2,
0056 GPIO50_nPIOR,
0057 GPIO51_nPIOW,
0058 GPIO49_nPWE,
0059 GPIO48_nPOE,
0060 GPIO52_nPCE_1,
0061 GPIO53_nPCE_2,
0062 GPIO57_nIOIS16,
0063 GPIO56_nPWAIT,
0064
0065
0066 GPIO28_AC97_BITCLK,
0067 GPIO29_AC97_SDATA_IN_0,
0068 GPIO30_AC97_SDATA_OUT,
0069 GPIO31_AC97_SYNC,
0070
0071
0072 GPIO45_GPIO,
0073 GPIO46_FICP_RXD,
0074 GPIO47_FICP_TXD,
0075
0076
0077 GPIO17_PWM1_OUT,
0078
0079
0080 GPIO4_GPIO,
0081 GPIO36_GPIO,
0082
0083
0084 GPIOxx_LCD_TFT_16BPP,
0085
0086
0087 GPIO0_GPIO | WAKEUP_ON_EDGE_BOTH,
0088 GPIO9_GPIO | WAKEUP_ON_EDGE_BOTH,
0089 GPIO10_GPIO | WAKEUP_ON_EDGE_BOTH,
0090 GPIO11_GPIO | WAKEUP_ON_EDGE_BOTH,
0091 GPIO18_GPIO | MFP_LPM_DRIVE_LOW,
0092 GPIO19_GPIO | MFP_LPM_DRIVE_LOW,
0093 GPIO20_GPIO | MFP_LPM_DRIVE_LOW,
0094 GPIO21_GPIO | MFP_LPM_DRIVE_LOW,
0095 GPIO22_GPIO | MFP_LPM_DRIVE_LOW,
0096 GPIO23_GPIO | MFP_LPM_DRIVE_LOW,
0097 GPIO24_GPIO | MFP_LPM_DRIVE_LOW,
0098 GPIO25_GPIO | MFP_LPM_DRIVE_LOW,
0099 GPIO26_GPIO | MFP_LPM_DRIVE_LOW,
0100 GPIO27_GPIO | MFP_LPM_DRIVE_LOW,
0101 GPIO79_GPIO | MFP_LPM_DRIVE_LOW,
0102 GPIO80_GPIO | MFP_LPM_DRIVE_LOW,
0103
0104
0105 GPIO7_GPIO | WAKEUP_ON_EDGE_BOTH,
0106
0107
0108 GPIO1_RST,
0109 GPIO2_GPIO,
0110 GPIO16_GPIO,
0111 };
0112
0113
0114
0115
0116 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
0117 static struct pxamci_platform_data palmtc_mci_platform_data = {
0118 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
0119 .detect_delay_ms = 200,
0120 };
0121
0122 static struct gpiod_lookup_table palmtc_mci_gpio_table = {
0123 .dev_id = "pxa2xx-mci.0",
0124 .table = {
0125 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_SD_DETECT_N,
0126 "cd", GPIO_ACTIVE_LOW),
0127 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_SD_READONLY,
0128 "wp", GPIO_ACTIVE_LOW),
0129 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_SD_POWER,
0130 "power", GPIO_ACTIVE_HIGH),
0131 { },
0132 },
0133 };
0134
0135 static void __init palmtc_mmc_init(void)
0136 {
0137 gpiod_add_lookup_table(&palmtc_mci_gpio_table);
0138 pxa_set_mci_info(&palmtc_mci_platform_data);
0139 }
0140 #else
0141 static inline void palmtc_mmc_init(void) {}
0142 #endif
0143
0144
0145
0146
0147 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
0148 static struct gpio_keys_button palmtc_pxa_buttons[] = {
0149 {KEY_F8, GPIO_NR_PALMTC_HOTSYNC_BUTTON, 1, "HotSync Button", EV_KEY, 1},
0150 };
0151
0152 static struct gpio_keys_platform_data palmtc_pxa_keys_data = {
0153 .buttons = palmtc_pxa_buttons,
0154 .nbuttons = ARRAY_SIZE(palmtc_pxa_buttons),
0155 };
0156
0157 static struct platform_device palmtc_pxa_keys = {
0158 .name = "gpio-keys",
0159 .id = -1,
0160 .dev = {
0161 .platform_data = &palmtc_pxa_keys_data,
0162 },
0163 };
0164
0165 static void __init palmtc_keys_init(void)
0166 {
0167 platform_device_register(&palmtc_pxa_keys);
0168 }
0169 #else
0170 static inline void palmtc_keys_init(void) {}
0171 #endif
0172
0173
0174
0175
0176 #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
0177
0178 static struct gpiod_lookup_table palmtc_pwm_bl_gpio_table = {
0179 .dev_id = "pwm-backlight.0",
0180 .table = {
0181 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_BL_POWER,
0182 "enable", GPIO_ACTIVE_HIGH),
0183 },
0184 };
0185
0186 static struct pwm_lookup palmtc_pwm_lookup[] = {
0187 PWM_LOOKUP("pxa25x-pwm.1", 0, "pwm-backlight.0", NULL, PALMTC_PERIOD_NS,
0188 PWM_POLARITY_NORMAL),
0189 };
0190
0191 static struct platform_pwm_backlight_data palmtc_backlight_data = {
0192 .max_brightness = PALMTC_MAX_INTENSITY,
0193 .dft_brightness = PALMTC_MAX_INTENSITY,
0194 };
0195
0196 static struct platform_device palmtc_backlight = {
0197 .name = "pwm-backlight",
0198 .dev = {
0199 .parent = &pxa25x_device_pwm1.dev,
0200 .platform_data = &palmtc_backlight_data,
0201 },
0202 };
0203
0204 static void __init palmtc_pwm_init(void)
0205 {
0206 gpiod_add_lookup_table(&palmtc_pwm_bl_gpio_table);
0207 pwm_add_table(palmtc_pwm_lookup, ARRAY_SIZE(palmtc_pwm_lookup));
0208 platform_device_register(&palmtc_backlight);
0209 }
0210 #else
0211 static inline void palmtc_pwm_init(void) {}
0212 #endif
0213
0214
0215
0216
0217 #if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE)
0218 static struct pxaficp_platform_data palmtc_ficp_platform_data = {
0219 .gpio_pwdown = GPIO_NR_PALMTC_IR_DISABLE,
0220 .transceiver_cap = IR_SIRMODE | IR_OFF,
0221 };
0222
0223 static void __init palmtc_irda_init(void)
0224 {
0225 pxa_set_ficp_info(&palmtc_ficp_platform_data);
0226 }
0227 #else
0228 static inline void palmtc_irda_init(void) {}
0229 #endif
0230
0231
0232
0233
0234 #if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE)
0235 static const uint32_t palmtc_matrix_keys[] = {
0236 KEY(0, 0, KEY_F1),
0237 KEY(0, 1, KEY_X),
0238 KEY(0, 2, KEY_POWER),
0239 KEY(0, 3, KEY_TAB),
0240 KEY(0, 4, KEY_A),
0241 KEY(0, 5, KEY_Q),
0242 KEY(0, 6, KEY_LEFTSHIFT),
0243 KEY(0, 7, KEY_Z),
0244 KEY(0, 8, KEY_S),
0245 KEY(0, 9, KEY_W),
0246 KEY(0, 10, KEY_E),
0247 KEY(0, 11, KEY_UP),
0248
0249 KEY(1, 0, KEY_F2),
0250 KEY(1, 1, KEY_DOWN),
0251 KEY(1, 3, KEY_D),
0252 KEY(1, 4, KEY_C),
0253 KEY(1, 5, KEY_F),
0254 KEY(1, 6, KEY_R),
0255 KEY(1, 7, KEY_SPACE),
0256 KEY(1, 8, KEY_V),
0257 KEY(1, 9, KEY_G),
0258 KEY(1, 10, KEY_T),
0259 KEY(1, 11, KEY_LEFT),
0260
0261 KEY(2, 0, KEY_F3),
0262 KEY(2, 1, KEY_LEFTCTRL),
0263 KEY(2, 3, KEY_H),
0264 KEY(2, 4, KEY_Y),
0265 KEY(2, 5, KEY_N),
0266 KEY(2, 6, KEY_J),
0267 KEY(2, 7, KEY_U),
0268 KEY(2, 8, KEY_M),
0269 KEY(2, 9, KEY_K),
0270 KEY(2, 10, KEY_I),
0271 KEY(2, 11, KEY_RIGHT),
0272
0273 KEY(3, 0, KEY_F4),
0274 KEY(3, 1, KEY_ENTER),
0275 KEY(3, 3, KEY_DOT),
0276 KEY(3, 4, KEY_L),
0277 KEY(3, 5, KEY_O),
0278 KEY(3, 6, KEY_LEFTALT),
0279 KEY(3, 7, KEY_ENTER),
0280 KEY(3, 8, KEY_BACKSPACE),
0281 KEY(3, 9, KEY_P),
0282 KEY(3, 10, KEY_B),
0283 KEY(3, 11, KEY_FN),
0284 };
0285
0286 const struct matrix_keymap_data palmtc_keymap_data = {
0287 .keymap = palmtc_matrix_keys,
0288 .keymap_size = ARRAY_SIZE(palmtc_matrix_keys),
0289 };
0290
0291 static const unsigned int palmtc_keypad_row_gpios[] = {
0292 0, 9, 10, 11
0293 };
0294
0295 static const unsigned int palmtc_keypad_col_gpios[] = {
0296 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 79, 80
0297 };
0298
0299 static struct matrix_keypad_platform_data palmtc_keypad_platform_data = {
0300 .keymap_data = &palmtc_keymap_data,
0301 .row_gpios = palmtc_keypad_row_gpios,
0302 .num_row_gpios = ARRAY_SIZE(palmtc_keypad_row_gpios),
0303 .col_gpios = palmtc_keypad_col_gpios,
0304 .num_col_gpios = ARRAY_SIZE(palmtc_keypad_col_gpios),
0305 .active_low = 1,
0306
0307 .debounce_ms = 20,
0308 .col_scan_delay_us = 5,
0309 };
0310
0311 static struct platform_device palmtc_keyboard = {
0312 .name = "matrix-keypad",
0313 .id = -1,
0314 .dev = {
0315 .platform_data = &palmtc_keypad_platform_data,
0316 },
0317 };
0318 static void __init palmtc_mkp_init(void)
0319 {
0320 platform_device_register(&palmtc_keyboard);
0321 }
0322 #else
0323 static inline void palmtc_mkp_init(void) {}
0324 #endif
0325
0326
0327
0328
0329 #if defined(CONFIG_USB_PXA25X)||defined(CONFIG_USB_PXA25X_MODULE)
0330 static struct gpiod_lookup_table palmtc_udc_gpiod_table = {
0331 .dev_id = "gpio-vbus",
0332 .table = {
0333 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_USB_DETECT_N,
0334 "vbus", GPIO_ACTIVE_LOW),
0335 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_USB_POWER,
0336 "pullup", GPIO_ACTIVE_HIGH),
0337 { },
0338 },
0339 };
0340
0341 static struct platform_device palmtc_gpio_vbus = {
0342 .name = "gpio-vbus",
0343 .id = -1,
0344 };
0345
0346 static void __init palmtc_udc_init(void)
0347 {
0348 gpiod_add_lookup_table(&palmtc_udc_gpiod_table);
0349 platform_device_register(&palmtc_gpio_vbus);
0350 };
0351 #else
0352 static inline void palmtc_udc_init(void) {}
0353 #endif
0354
0355
0356
0357
0358 #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \
0359 defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
0360 static struct platform_device palmtc_ucb1400_device = {
0361 .name = "ucb1400_core",
0362 .id = -1,
0363 };
0364
0365 static void __init palmtc_ts_init(void)
0366 {
0367 pxa_set_ac97_info(NULL);
0368 platform_device_register(&palmtc_ucb1400_device);
0369 }
0370 #else
0371 static inline void palmtc_ts_init(void) {}
0372 #endif
0373
0374
0375
0376
0377 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
0378 struct gpio_led palmtc_gpio_leds[] = {
0379 {
0380 .name = "palmtc:green:user",
0381 .default_trigger = "none",
0382 .gpio = GPIO_NR_PALMTC_LED_POWER,
0383 .active_low = 1,
0384 }, {
0385 .name = "palmtc:vibra:vibra",
0386 .default_trigger = "none",
0387 .gpio = GPIO_NR_PALMTC_VIBRA_POWER,
0388 .active_low = 1,
0389 }
0390
0391 };
0392
0393 static struct gpio_led_platform_data palmtc_gpio_led_info = {
0394 .leds = palmtc_gpio_leds,
0395 .num_leds = ARRAY_SIZE(palmtc_gpio_leds),
0396 };
0397
0398 static struct platform_device palmtc_leds = {
0399 .name = "leds-gpio",
0400 .id = -1,
0401 .dev = {
0402 .platform_data = &palmtc_gpio_led_info,
0403 }
0404 };
0405
0406 static void __init palmtc_leds_init(void)
0407 {
0408 platform_device_register(&palmtc_leds);
0409 }
0410 #else
0411 static inline void palmtc_leds_init(void) {}
0412 #endif
0413
0414
0415
0416
0417 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
0418 static struct resource palmtc_flash_resource = {
0419 .start = PXA_CS0_PHYS,
0420 .end = PXA_CS0_PHYS + SZ_16M - 1,
0421 .flags = IORESOURCE_MEM,
0422 };
0423
0424 static struct mtd_partition palmtc_flash_parts[] = {
0425 {
0426 .name = "U-Boot Bootloader",
0427 .offset = 0x0,
0428 .size = 0x40000,
0429 },
0430 {
0431 .name = "Linux Kernel",
0432 .offset = 0x40000,
0433 .size = 0x2c0000,
0434 },
0435 {
0436 .name = "Filesystem",
0437 .offset = 0x300000,
0438 .size = 0xcc0000,
0439 },
0440 {
0441 .name = "U-Boot Environment",
0442 .offset = 0xfc0000,
0443 .size = MTDPART_SIZ_FULL,
0444 },
0445 };
0446
0447 static struct physmap_flash_data palmtc_flash_data = {
0448 .width = 4,
0449 .parts = palmtc_flash_parts,
0450 .nr_parts = ARRAY_SIZE(palmtc_flash_parts),
0451 };
0452
0453 static struct platform_device palmtc_flash = {
0454 .name = "physmap-flash",
0455 .id = -1,
0456 .resource = &palmtc_flash_resource,
0457 .num_resources = 1,
0458 .dev = {
0459 .platform_data = &palmtc_flash_data,
0460 },
0461 };
0462
0463 static void __init palmtc_nor_init(void)
0464 {
0465 platform_device_register(&palmtc_flash);
0466 }
0467 #else
0468 static inline void palmtc_nor_init(void) {}
0469 #endif
0470
0471
0472
0473
0474 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
0475 static struct pxafb_mode_info palmtc_lcd_modes[] = {
0476 {
0477 .pixclock = 115384,
0478 .xres = 320,
0479 .yres = 320,
0480 .bpp = 16,
0481
0482 .left_margin = 27,
0483 .right_margin = 7,
0484 .upper_margin = 7,
0485 .lower_margin = 8,
0486
0487 .hsync_len = 6,
0488 .vsync_len = 1,
0489 },
0490 };
0491
0492 static struct pxafb_mach_info palmtc_lcd_screen = {
0493 .modes = palmtc_lcd_modes,
0494 .num_modes = ARRAY_SIZE(palmtc_lcd_modes),
0495 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
0496 };
0497
0498 static void __init palmtc_lcd_init(void)
0499 {
0500 pxa_set_fb_info(NULL, &palmtc_lcd_screen);
0501 }
0502 #else
0503 static inline void palmtc_lcd_init(void) {}
0504 #endif
0505
0506
0507
0508
0509 static void __init palmtc_init(void)
0510 {
0511 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtc_pin_config));
0512
0513 pxa_set_ffuart_info(NULL);
0514 pxa_set_btuart_info(NULL);
0515 pxa_set_stuart_info(NULL);
0516 pxa_set_hwuart_info(NULL);
0517
0518 palmtc_mmc_init();
0519 palmtc_keys_init();
0520 palmtc_pwm_init();
0521 palmtc_irda_init();
0522 palmtc_mkp_init();
0523 palmtc_udc_init();
0524 palmtc_ts_init();
0525 palmtc_nor_init();
0526 palmtc_lcd_init();
0527 palmtc_leds_init();
0528 };
0529
0530 MACHINE_START(PALMTC, "Palm Tungsten|C")
0531 .atag_offset = 0x100,
0532 .map_io = pxa25x_map_io,
0533 .nr_irqs = PXA_NR_IRQS,
0534 .init_irq = pxa25x_init_irq,
0535 .handle_irq = pxa25x_handle_irq,
0536 .init_time = pxa_timer_init,
0537 .init_machine = palmtc_init,
0538 .restart = pxa_restart,
0539 MACHINE_END