0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include <linux/module.h>
0014 #include <linux/kernel.h>
0015 #include <linux/interrupt.h>
0016 #include <linux/leds.h>
0017 #include <linux/init.h>
0018 #include <linux/platform_device.h>
0019 #include <linux/gpio/machine.h>
0020 #include <linux/pwm.h>
0021 #include <linux/pwm_backlight.h>
0022 #include <linux/smc91x.h>
0023 #include <linux/soc/pxa/cpu.h>
0024
0025 #include <asm/mach-types.h>
0026 #include <asm/mach/arch.h>
0027 #include "pxa3xx.h"
0028 #include <linux/platform_data/asoc-pxa.h>
0029 #include <linux/platform_data/video-pxafb.h>
0030 #include "zylonite.h"
0031 #include <linux/platform_data/mmc-pxamci.h>
0032 #include <linux/platform_data/usb-ohci-pxa27x.h>
0033 #include <linux/platform_data/keypad-pxa27x.h>
0034 #include <linux/platform_data/mtd-nand-pxa3xx.h>
0035 #include "mfp.h"
0036
0037 #include "devices.h"
0038 #include "generic.h"
0039
0040 int gpio_eth_irq;
0041 int gpio_debug_led1;
0042 int gpio_debug_led2;
0043
0044 int wm9713_irq;
0045
0046 int lcd_id;
0047 int lcd_orientation;
0048
0049 static struct resource smc91x_resources[] = {
0050 [0] = {
0051 .start = ZYLONITE_ETH_PHYS + 0x300,
0052 .end = ZYLONITE_ETH_PHYS + 0xfffff,
0053 .flags = IORESOURCE_MEM,
0054 },
0055 [1] = {
0056 .start = -1,
0057 .end = -1,
0058 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
0059 }
0060 };
0061
0062 static struct smc91x_platdata zylonite_smc91x_info = {
0063 .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT |
0064 SMC91X_NOWAIT | SMC91X_USE_DMA,
0065 };
0066
0067 static struct platform_device smc91x_device = {
0068 .name = "smc91x",
0069 .id = 0,
0070 .num_resources = ARRAY_SIZE(smc91x_resources),
0071 .resource = smc91x_resources,
0072 .dev = {
0073 .platform_data = &zylonite_smc91x_info,
0074 },
0075 };
0076
0077 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
0078 static struct gpio_led zylonite_debug_leds[] = {
0079 [0] = {
0080 .name = "zylonite:yellow:1",
0081 .default_trigger = "heartbeat",
0082 },
0083 [1] = {
0084 .name = "zylonite:yellow:2",
0085 .default_trigger = "default-on",
0086 },
0087 };
0088
0089 static struct gpio_led_platform_data zylonite_debug_leds_info = {
0090 .leds = zylonite_debug_leds,
0091 .num_leds = ARRAY_SIZE(zylonite_debug_leds),
0092 };
0093
0094 static struct platform_device zylonite_device_leds = {
0095 .name = "leds-gpio",
0096 .id = -1,
0097 .dev = {
0098 .platform_data = &zylonite_debug_leds_info,
0099 }
0100 };
0101
0102 static void __init zylonite_init_leds(void)
0103 {
0104 zylonite_debug_leds[0].gpio = gpio_debug_led1;
0105 zylonite_debug_leds[1].gpio = gpio_debug_led2;
0106
0107 platform_device_register(&zylonite_device_leds);
0108 }
0109 #else
0110 static inline void zylonite_init_leds(void) {}
0111 #endif
0112
0113 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
0114 static struct pwm_lookup zylonite_pwm_lookup[] = {
0115 PWM_LOOKUP("pxa27x-pwm.1", 1, "pwm-backlight.0", NULL, 10000,
0116 PWM_POLARITY_NORMAL),
0117 };
0118
0119 static struct platform_pwm_backlight_data zylonite_backlight_data = {
0120 .max_brightness = 100,
0121 .dft_brightness = 100,
0122 };
0123
0124 static struct platform_device zylonite_backlight_device = {
0125 .name = "pwm-backlight",
0126 .dev = {
0127 .parent = &pxa27x_device_pwm1.dev,
0128 .platform_data = &zylonite_backlight_data,
0129 },
0130 };
0131
0132 static struct pxafb_mode_info toshiba_ltm035a776c_mode = {
0133 .pixclock = 110000,
0134 .xres = 240,
0135 .yres = 320,
0136 .bpp = 16,
0137 .hsync_len = 4,
0138 .left_margin = 6,
0139 .right_margin = 4,
0140 .vsync_len = 2,
0141 .upper_margin = 2,
0142 .lower_margin = 3,
0143 .sync = FB_SYNC_VERT_HIGH_ACT,
0144 };
0145
0146 static struct pxafb_mode_info toshiba_ltm04c380k_mode = {
0147 .pixclock = 50000,
0148 .xres = 640,
0149 .yres = 480,
0150 .bpp = 16,
0151 .hsync_len = 1,
0152 .left_margin = 0x9f,
0153 .right_margin = 1,
0154 .vsync_len = 44,
0155 .upper_margin = 0,
0156 .lower_margin = 0,
0157 .sync = FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT,
0158 };
0159
0160 static struct pxafb_mach_info zylonite_toshiba_lcd_info = {
0161 .num_modes = 1,
0162 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
0163 };
0164
0165 static struct pxafb_mode_info sharp_ls037_modes[] = {
0166 [0] = {
0167 .pixclock = 158000,
0168 .xres = 240,
0169 .yres = 320,
0170 .bpp = 16,
0171 .hsync_len = 4,
0172 .left_margin = 39,
0173 .right_margin = 39,
0174 .vsync_len = 1,
0175 .upper_margin = 2,
0176 .lower_margin = 3,
0177 .sync = 0,
0178 },
0179 [1] = {
0180 .pixclock = 39700,
0181 .xres = 480,
0182 .yres = 640,
0183 .bpp = 16,
0184 .hsync_len = 8,
0185 .left_margin = 81,
0186 .right_margin = 81,
0187 .vsync_len = 1,
0188 .upper_margin = 2,
0189 .lower_margin = 7,
0190 .sync = 0,
0191 },
0192 };
0193
0194 static struct pxafb_mach_info zylonite_sharp_lcd_info = {
0195 .modes = sharp_ls037_modes,
0196 .num_modes = 2,
0197 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
0198 };
0199
0200 static void __init zylonite_init_lcd(void)
0201 {
0202 pwm_add_table(zylonite_pwm_lookup, ARRAY_SIZE(zylonite_pwm_lookup));
0203 platform_device_register(&zylonite_backlight_device);
0204
0205 if (lcd_id & 0x20) {
0206 pxa_set_fb_info(NULL, &zylonite_sharp_lcd_info);
0207 return;
0208 }
0209
0210
0211
0212
0213 if (1)
0214 zylonite_toshiba_lcd_info.modes = &toshiba_ltm035a776c_mode;
0215 else
0216 zylonite_toshiba_lcd_info.modes = &toshiba_ltm04c380k_mode;
0217
0218 pxa_set_fb_info(NULL, &zylonite_toshiba_lcd_info);
0219 }
0220 #else
0221 static inline void zylonite_init_lcd(void) {}
0222 #endif
0223
0224 #if defined(CONFIG_MMC)
0225 static struct pxamci_platform_data zylonite_mci_platform_data = {
0226 .detect_delay_ms= 200,
0227 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
0228 };
0229
0230 #define PCA9539A_MCI_CD 0
0231 #define PCA9539A_MCI1_CD 1
0232 #define PCA9539A_MCI_WP 2
0233 #define PCA9539A_MCI1_WP 3
0234 #define PCA9539A_MCI3_CD 30
0235 #define PCA9539A_MCI3_WP 31
0236
0237 static struct gpiod_lookup_table zylonite_mci_gpio_table = {
0238 .dev_id = "pxa2xx-mci.0",
0239 .table = {
0240 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI_CD,
0241 "cd", GPIO_ACTIVE_LOW),
0242 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI_WP,
0243 "wp", GPIO_ACTIVE_LOW),
0244 { },
0245 },
0246 };
0247
0248 static struct pxamci_platform_data zylonite_mci2_platform_data = {
0249 .detect_delay_ms= 200,
0250 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
0251 };
0252
0253 static struct gpiod_lookup_table zylonite_mci2_gpio_table = {
0254 .dev_id = "pxa2xx-mci.1",
0255 .table = {
0256 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI1_CD,
0257 "cd", GPIO_ACTIVE_LOW),
0258 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI1_WP,
0259 "wp", GPIO_ACTIVE_LOW),
0260 { },
0261 },
0262 };
0263
0264 static struct pxamci_platform_data zylonite_mci3_platform_data = {
0265 .detect_delay_ms= 200,
0266 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
0267 };
0268
0269 static struct gpiod_lookup_table zylonite_mci3_gpio_table = {
0270 .dev_id = "pxa2xx-mci.2",
0271 .table = {
0272 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI3_CD,
0273 "cd", GPIO_ACTIVE_LOW),
0274 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI3_WP,
0275 "wp", GPIO_ACTIVE_LOW),
0276 { },
0277 },
0278 };
0279
0280 static void __init zylonite_init_mmc(void)
0281 {
0282 gpiod_add_lookup_table(&zylonite_mci_gpio_table);
0283 pxa_set_mci_info(&zylonite_mci_platform_data);
0284 gpiod_add_lookup_table(&zylonite_mci2_gpio_table);
0285 pxa3xx_set_mci2_info(&zylonite_mci2_platform_data);
0286 if (cpu_is_pxa310()) {
0287 gpiod_add_lookup_table(&zylonite_mci3_gpio_table);
0288 pxa3xx_set_mci3_info(&zylonite_mci3_platform_data);
0289 }
0290 }
0291 #else
0292 static inline void zylonite_init_mmc(void) {}
0293 #endif
0294
0295 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
0296 static const unsigned int zylonite_matrix_key_map[] = {
0297
0298 KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D),
0299 KEY(1, 0, KEY_E), KEY(1, 1, KEY_F), KEY(1, 2, KEY_G), KEY(1, 5, KEY_H),
0300 KEY(2, 0, KEY_I), KEY(2, 1, KEY_J), KEY(2, 2, KEY_K), KEY(2, 5, KEY_L),
0301 KEY(3, 0, KEY_M), KEY(3, 1, KEY_N), KEY(3, 2, KEY_O), KEY(3, 5, KEY_P),
0302 KEY(5, 0, KEY_Q), KEY(5, 1, KEY_R), KEY(5, 2, KEY_S), KEY(5, 5, KEY_T),
0303 KEY(6, 0, KEY_U), KEY(6, 1, KEY_V), KEY(6, 2, KEY_W), KEY(6, 5, KEY_X),
0304 KEY(7, 1, KEY_Y), KEY(7, 2, KEY_Z),
0305
0306 KEY(4, 4, KEY_0), KEY(1, 3, KEY_1), KEY(4, 1, KEY_2), KEY(1, 4, KEY_3),
0307 KEY(2, 3, KEY_4), KEY(4, 2, KEY_5), KEY(2, 4, KEY_6), KEY(3, 3, KEY_7),
0308 KEY(4, 3, KEY_8), KEY(3, 4, KEY_9),
0309
0310 KEY(4, 5, KEY_SPACE),
0311 KEY(5, 3, KEY_KPASTERISK),
0312 KEY(5, 4, KEY_KPDOT),
0313
0314 KEY(0, 7, KEY_UP),
0315 KEY(1, 7, KEY_DOWN),
0316 KEY(2, 7, KEY_LEFT),
0317 KEY(3, 7, KEY_RIGHT),
0318 KEY(2, 6, KEY_HOME),
0319 KEY(3, 6, KEY_END),
0320 KEY(6, 4, KEY_DELETE),
0321 KEY(6, 6, KEY_BACK),
0322 KEY(6, 3, KEY_CAPSLOCK),
0323
0324 KEY(4, 6, KEY_ENTER),
0325 KEY(5, 7, KEY_ENTER),
0326
0327 KEY(0, 4, KEY_EMAIL),
0328 KEY(5, 6, KEY_SEND),
0329 KEY(4, 0, KEY_CALENDAR),
0330 KEY(7, 6, KEY_RECORD),
0331 KEY(6, 7, KEY_VOLUMEUP),
0332 KEY(7, 7, KEY_VOLUMEDOWN),
0333
0334 KEY(0, 6, KEY_F22),
0335 KEY(1, 6, KEY_F23),
0336 KEY(0, 3, KEY_AUX),
0337 };
0338
0339 static struct matrix_keymap_data zylonite_matrix_keymap_data = {
0340 .keymap = zylonite_matrix_key_map,
0341 .keymap_size = ARRAY_SIZE(zylonite_matrix_key_map),
0342 };
0343
0344 static struct pxa27x_keypad_platform_data zylonite_keypad_info = {
0345 .matrix_key_rows = 8,
0346 .matrix_key_cols = 8,
0347 .matrix_keymap_data = &zylonite_matrix_keymap_data,
0348
0349 .enable_rotary0 = 1,
0350 .rotary0_up_key = KEY_UP,
0351 .rotary0_down_key = KEY_DOWN,
0352
0353 .debounce_interval = 30,
0354 };
0355
0356 static void __init zylonite_init_keypad(void)
0357 {
0358 pxa_set_keypad_info(&zylonite_keypad_info);
0359 }
0360 #else
0361 static inline void zylonite_init_keypad(void) {}
0362 #endif
0363
0364 #if IS_ENABLED(CONFIG_MTD_NAND_MARVELL)
0365 static struct mtd_partition zylonite_nand_partitions[] = {
0366 [0] = {
0367 .name = "Bootloader",
0368 .offset = 0,
0369 .size = 0x060000,
0370 .mask_flags = MTD_WRITEABLE,
0371 },
0372 [1] = {
0373 .name = "Kernel",
0374 .offset = 0x060000,
0375 .size = 0x200000,
0376 .mask_flags = MTD_WRITEABLE,
0377 },
0378 [2] = {
0379 .name = "Filesystem",
0380 .offset = 0x0260000,
0381 .size = 0x3000000,
0382 },
0383 [3] = {
0384 .name = "MassStorage",
0385 .offset = 0x3260000,
0386 .size = 0x3d40000,
0387 },
0388 [4] = {
0389 .name = "BBT",
0390 .offset = 0x6FA0000,
0391 .size = 0x80000,
0392 .mask_flags = MTD_WRITEABLE,
0393 },
0394
0395
0396
0397
0398
0399 };
0400
0401 static struct pxa3xx_nand_platform_data zylonite_nand_info = {
0402 .parts = zylonite_nand_partitions,
0403 .nr_parts = ARRAY_SIZE(zylonite_nand_partitions),
0404 };
0405
0406 static void __init zylonite_init_nand(void)
0407 {
0408 pxa3xx_set_nand_info(&zylonite_nand_info);
0409 }
0410 #else
0411 static inline void zylonite_init_nand(void) {}
0412 #endif
0413
0414 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
0415 static struct pxaohci_platform_data zylonite_ohci_info = {
0416 .port_mode = PMM_PERPORT_MODE,
0417 .flags = ENABLE_PORT1 | ENABLE_PORT2 |
0418 POWER_CONTROL_LOW | POWER_SENSE_LOW,
0419 };
0420
0421 static void __init zylonite_init_ohci(void)
0422 {
0423 pxa_set_ohci_info(&zylonite_ohci_info);
0424 }
0425 #else
0426 static inline void zylonite_init_ohci(void) {}
0427 #endif
0428
0429 static struct gpiod_lookup_table zylonite_wm97xx_touch_gpio15_table = {
0430 .dev_id = "wm97xx-touch.0",
0431 .table = {
0432 GPIO_LOOKUP("gpio-pxa", mfp_to_gpio(MFP_PIN_GPIO15),
0433 "touch", GPIO_ACTIVE_LOW),
0434 { },
0435 },
0436 };
0437
0438 static struct gpiod_lookup_table zylonite_wm97xx_touch_gpio26_table = {
0439 .dev_id = "wm97xx-touch.0",
0440 .table = {
0441 GPIO_LOOKUP("gpio-pxa", mfp_to_gpio(MFP_PIN_GPIO26),
0442 "touch", GPIO_ACTIVE_LOW),
0443 { },
0444 },
0445 };
0446
0447 static void __init zylonite_init_wm97xx_touch(void)
0448 {
0449 if (!IS_ENABLED(CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE))
0450 return;
0451
0452 if (cpu_is_pxa320())
0453 gpiod_add_lookup_table(&zylonite_wm97xx_touch_gpio15_table);
0454 else
0455 gpiod_add_lookup_table(&zylonite_wm97xx_touch_gpio26_table);
0456 }
0457
0458 static void __init zylonite_init(void)
0459 {
0460 pxa_set_ffuart_info(NULL);
0461 pxa_set_btuart_info(NULL);
0462 pxa_set_stuart_info(NULL);
0463
0464
0465 zylonite_pxa300_init();
0466 zylonite_pxa320_init();
0467
0468
0469
0470
0471
0472 smc91x_resources[1].start = PXA_GPIO_TO_IRQ(gpio_eth_irq);
0473 smc91x_resources[1].end = PXA_GPIO_TO_IRQ(gpio_eth_irq);
0474 platform_device_register(&smc91x_device);
0475
0476 pxa_set_ac97_info(NULL);
0477 zylonite_init_lcd();
0478 zylonite_init_mmc();
0479 zylonite_init_keypad();
0480 zylonite_init_nand();
0481 zylonite_init_leds();
0482 zylonite_init_ohci();
0483 zylonite_init_wm97xx_touch();
0484 }
0485
0486 MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)")
0487 .atag_offset = 0x100,
0488 .map_io = pxa3xx_map_io,
0489 .nr_irqs = ZYLONITE_NR_IRQS,
0490 .init_irq = pxa3xx_init_irq,
0491 .handle_irq = pxa3xx_handle_irq,
0492 .init_time = pxa_timer_init,
0493 .init_machine = zylonite_init,
0494 .restart = pxa_restart,
0495 MACHINE_END