0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include <linux/platform_device.h>
0014 #include <linux/delay.h>
0015 #include <linux/irq.h>
0016 #include <linux/gpio_keys.h>
0017 #include <linux/input.h>
0018 #include <linux/pda_power.h>
0019 #include <linux/pwm_backlight.h>
0020 #include <linux/gpio.h>
0021 #include <linux/wm97xx.h>
0022 #include <linux/power_supply.h>
0023 #include <linux/mtd/mtd.h>
0024 #include <linux/mtd/partitions.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 "pxa27x.h"
0032 #include "palmld.h"
0033 #include <linux/platform_data/asoc-pxa.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 <linux/platform_data/keypad-pxa27x.h>
0038 #include <linux/platform_data/asoc-palm27x.h>
0039 #include "palm27x.h"
0040
0041 #include "generic.h"
0042 #include "devices.h"
0043
0044
0045
0046
0047 static unsigned long palmld_pin_config[] __initdata = {
0048
0049 GPIO32_MMC_CLK,
0050 GPIO92_MMC_DAT_0,
0051 GPIO109_MMC_DAT_1,
0052 GPIO110_MMC_DAT_2,
0053 GPIO111_MMC_DAT_3,
0054 GPIO112_MMC_CMD,
0055 GPIO14_GPIO,
0056 GPIO114_GPIO,
0057 GPIO116_GPIO,
0058
0059
0060 GPIO28_AC97_BITCLK,
0061 GPIO29_AC97_SDATA_IN_0,
0062 GPIO30_AC97_SDATA_OUT,
0063 GPIO31_AC97_SYNC,
0064 GPIO89_AC97_SYSCLK,
0065 GPIO95_AC97_nRESET,
0066
0067
0068 GPIO108_GPIO,
0069 GPIO46_FICP_RXD,
0070 GPIO47_FICP_TXD,
0071
0072
0073 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
0074 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
0075 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
0076 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
0077 GPIO103_KP_MKOUT_0,
0078 GPIO104_KP_MKOUT_1,
0079 GPIO105_KP_MKOUT_2,
0080
0081
0082 GPIOxx_LCD_TFT_16BPP,
0083
0084
0085 GPIO16_PWM0_OUT,
0086
0087
0088 GPIO10_GPIO,
0089 GPIO12_GPIO,
0090 GPIO15_GPIO,
0091
0092
0093 GPIO52_GPIO,
0094 GPIO94_GPIO,
0095
0096
0097 GPIO48_nPOE,
0098 GPIO49_nPWE,
0099 GPIO50_nPIOR,
0100 GPIO51_nPIOW,
0101 GPIO85_nPCE_1,
0102 GPIO54_nPCE_2,
0103 GPIO79_PSKTSEL,
0104 GPIO55_nPREG,
0105 GPIO56_nPWAIT,
0106 GPIO57_nIOIS16,
0107 GPIO36_GPIO,
0108 GPIO38_GPIO,
0109 GPIO81_GPIO,
0110
0111
0112 GPIO34_FFUART_RXD,
0113 GPIO39_FFUART_TXD,
0114
0115
0116 GPIO98_GPIO,
0117 GPIO115_GPIO,
0118
0119
0120 GPIO13_GPIO,
0121 };
0122
0123
0124
0125
0126 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
0127 static struct mtd_partition palmld_partitions[] = {
0128 {
0129 .name = "Flash",
0130 .offset = 0x00000000,
0131 .size = MTDPART_SIZ_FULL,
0132 .mask_flags = 0
0133 }
0134 };
0135
0136 static struct physmap_flash_data palmld_flash_data[] = {
0137 {
0138 .width = 2,
0139 .parts = palmld_partitions,
0140 .nr_parts = ARRAY_SIZE(palmld_partitions)
0141 }
0142 };
0143
0144 static struct resource palmld_flash_resource = {
0145 .start = PXA_CS0_PHYS,
0146 .end = PXA_CS0_PHYS + SZ_4M - 1,
0147 .flags = IORESOURCE_MEM,
0148 };
0149
0150 static struct platform_device palmld_flash = {
0151 .name = "physmap-flash",
0152 .id = 0,
0153 .resource = &palmld_flash_resource,
0154 .num_resources = 1,
0155 .dev = {
0156 .platform_data = palmld_flash_data,
0157 },
0158 };
0159
0160 static void __init palmld_nor_init(void)
0161 {
0162 platform_device_register(&palmld_flash);
0163 }
0164 #else
0165 static inline void palmld_nor_init(void) {}
0166 #endif
0167
0168
0169
0170
0171 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
0172 static const unsigned int palmld_matrix_keys[] = {
0173 KEY(0, 1, KEY_F2),
0174 KEY(0, 2, KEY_UP),
0175
0176 KEY(1, 0, KEY_F3),
0177 KEY(1, 1, KEY_F4),
0178 KEY(1, 2, KEY_RIGHT),
0179
0180 KEY(2, 0, KEY_F1),
0181 KEY(2, 1, KEY_F5),
0182 KEY(2, 2, KEY_DOWN),
0183
0184 KEY(3, 0, KEY_F6),
0185 KEY(3, 1, KEY_ENTER),
0186 KEY(3, 2, KEY_LEFT),
0187 };
0188
0189 static struct matrix_keymap_data palmld_matrix_keymap_data = {
0190 .keymap = palmld_matrix_keys,
0191 .keymap_size = ARRAY_SIZE(palmld_matrix_keys),
0192 };
0193
0194 static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = {
0195 .matrix_key_rows = 4,
0196 .matrix_key_cols = 3,
0197 .matrix_keymap_data = &palmld_matrix_keymap_data,
0198
0199 .debounce_interval = 30,
0200 };
0201
0202 static void __init palmld_kpc_init(void)
0203 {
0204 pxa_set_keypad_info(&palmld_keypad_platform_data);
0205 }
0206 #else
0207 static inline void palmld_kpc_init(void) {}
0208 #endif
0209
0210
0211
0212
0213 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
0214 static struct gpio_keys_button palmld_pxa_buttons[] = {
0215 {KEY_F8, GPIO_NR_PALMLD_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
0216 {KEY_F9, GPIO_NR_PALMLD_LOCK_SWITCH, 0, "Lock Switch" },
0217 {KEY_POWER, GPIO_NR_PALMLD_POWER_SWITCH, 0, "Power Switch" },
0218 };
0219
0220 static struct gpio_keys_platform_data palmld_pxa_keys_data = {
0221 .buttons = palmld_pxa_buttons,
0222 .nbuttons = ARRAY_SIZE(palmld_pxa_buttons),
0223 };
0224
0225 static struct platform_device palmld_pxa_keys = {
0226 .name = "gpio-keys",
0227 .id = -1,
0228 .dev = {
0229 .platform_data = &palmld_pxa_keys_data,
0230 },
0231 };
0232
0233 static void __init palmld_keys_init(void)
0234 {
0235 platform_device_register(&palmld_pxa_keys);
0236 }
0237 #else
0238 static inline void palmld_keys_init(void) {}
0239 #endif
0240
0241
0242
0243
0244 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
0245 struct gpio_led gpio_leds[] = {
0246 {
0247 .name = "palmld:green:led",
0248 .default_trigger = "none",
0249 .gpio = GPIO_NR_PALMLD_LED_GREEN,
0250 }, {
0251 .name = "palmld:amber:led",
0252 .default_trigger = "none",
0253 .gpio = GPIO_NR_PALMLD_LED_AMBER,
0254 },
0255 };
0256
0257 static struct gpio_led_platform_data gpio_led_info = {
0258 .leds = gpio_leds,
0259 .num_leds = ARRAY_SIZE(gpio_leds),
0260 };
0261
0262 static struct platform_device palmld_leds = {
0263 .name = "leds-gpio",
0264 .id = -1,
0265 .dev = {
0266 .platform_data = &gpio_led_info,
0267 }
0268 };
0269
0270 static void __init palmld_leds_init(void)
0271 {
0272 platform_device_register(&palmld_leds);
0273 }
0274 #else
0275 static inline void palmld_leds_init(void) {}
0276 #endif
0277
0278
0279
0280
0281 #if defined(CONFIG_PATA_PALMLD) || defined(CONFIG_PATA_PALMLD_MODULE)
0282 static struct resource palmld_ide_resources[] = {
0283 DEFINE_RES_MEM(PALMLD_IDE_PHYS, 0x1000),
0284 };
0285
0286 static struct platform_device palmld_ide_device = {
0287 .name = "pata_palmld",
0288 .id = -1,
0289 .resource = palmld_ide_resources,
0290 .num_resources = ARRAY_SIZE(palmld_ide_resources),
0291 };
0292
0293 static struct gpiod_lookup_table palmld_ide_gpio_table = {
0294 .dev_id = "pata_palmld",
0295 .table = {
0296 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_IDE_PWEN,
0297 "power", GPIO_ACTIVE_HIGH),
0298 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_IDE_RESET,
0299 "reset", GPIO_ACTIVE_LOW),
0300 { },
0301 },
0302 };
0303
0304 static void __init palmld_ide_init(void)
0305 {
0306 gpiod_add_lookup_table(&palmld_ide_gpio_table);
0307 platform_device_register(&palmld_ide_device);
0308 }
0309 #else
0310 static inline void palmld_ide_init(void) {}
0311 #endif
0312
0313
0314
0315
0316 static struct map_desc palmld_io_desc[] __initdata = {
0317 {
0318 .virtual = PALMLD_IDE_VIRT,
0319 .pfn = __phys_to_pfn(PALMLD_IDE_PHYS),
0320 .length = PALMLD_IDE_SIZE,
0321 .type = MT_DEVICE
0322 },
0323 {
0324 .virtual = PALMLD_USB_VIRT,
0325 .pfn = __phys_to_pfn(PALMLD_USB_PHYS),
0326 .length = PALMLD_USB_SIZE,
0327 .type = MT_DEVICE
0328 },
0329 };
0330
0331 static void __init palmld_map_io(void)
0332 {
0333 pxa27x_map_io();
0334 iotable_init(palmld_io_desc, ARRAY_SIZE(palmld_io_desc));
0335 }
0336
0337 static struct gpiod_lookup_table palmld_mci_gpio_table = {
0338 .dev_id = "pxa2xx-mci.0",
0339 .table = {
0340 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_SD_DETECT_N,
0341 "cd", GPIO_ACTIVE_LOW),
0342 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_SD_READONLY,
0343 "wp", GPIO_ACTIVE_LOW),
0344 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_SD_POWER,
0345 "power", GPIO_ACTIVE_HIGH),
0346 { },
0347 },
0348 };
0349
0350 static struct gpiod_lookup_table palmld_wm97xx_touch_gpio_table = {
0351 .dev_id = "wm97xx-touch",
0352 .table = {
0353 GPIO_LOOKUP("gpio-pxa", 27, "touch", GPIO_ACTIVE_HIGH),
0354 { },
0355 },
0356 };
0357
0358 static void __init palmld_init(void)
0359 {
0360 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config));
0361 pxa_set_ffuart_info(NULL);
0362 pxa_set_btuart_info(NULL);
0363 pxa_set_stuart_info(NULL);
0364
0365 palm27x_mmc_init(&palmld_mci_gpio_table);
0366 gpiod_add_lookup_table(&palmld_wm97xx_touch_gpio_table);
0367 palm27x_pm_init(PALMLD_STR_BASE);
0368 palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
0369 palm27x_irda_init(GPIO_NR_PALMLD_IR_DISABLE);
0370 palm27x_ac97_init(PALMLD_BAT_MIN_VOLTAGE, PALMLD_BAT_MAX_VOLTAGE,
0371 GPIO_NR_PALMLD_EARPHONE_DETECT, 95);
0372 palm27x_pwm_init(GPIO_NR_PALMLD_BL_POWER, GPIO_NR_PALMLD_LCD_POWER);
0373 palm27x_power_init(GPIO_NR_PALMLD_POWER_DETECT,
0374 GPIO_NR_PALMLD_USB_DETECT_N);
0375 palm27x_pmic_init();
0376 palmld_kpc_init();
0377 palmld_keys_init();
0378 palmld_nor_init();
0379 palmld_leds_init();
0380 palmld_ide_init();
0381 }
0382
0383 MACHINE_START(PALMLD, "Palm LifeDrive")
0384 .atag_offset = 0x100,
0385 .map_io = palmld_map_io,
0386 .nr_irqs = PXA_NR_IRQS,
0387 .init_irq = pxa27x_init_irq,
0388 .handle_irq = pxa27x_handle_irq,
0389 .init_time = pxa_timer_init,
0390 .init_machine = palmld_init,
0391 .restart = pxa_restart,
0392 MACHINE_END