Loading...
1/*
2 * linux/arch/arm/mach-pxa/zylonite.c
3 *
4 * Support for the PXA3xx Development Platform (aka Zylonite)
5 *
6 * Copyright (C) 2006 Marvell International Ltd.
7 *
8 * 2007-09-04: eric miao <eric.miao@marvell.com>
9 * rewrite to align with latest kernel
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/module.h>
17#include <linux/kernel.h>
18#include <linux/interrupt.h>
19#include <linux/init.h>
20#include <linux/platform_device.h>
21#include <linux/gpio.h>
22#include <linux/pwm_backlight.h>
23#include <linux/smc91x.h>
24
25#include <asm/mach-types.h>
26#include <asm/mach/arch.h>
27#include <mach/pxa3xx.h>
28#include <mach/audio.h>
29#include <linux/platform_data/video-pxafb.h>
30#include <mach/zylonite.h>
31#include <linux/platform_data/mmc-pxamci.h>
32#include <linux/platform_data/usb-ohci-pxa27x.h>
33#include <linux/platform_data/keypad-pxa27x.h>
34#include <linux/platform_data/mtd-nand-pxa3xx.h>
35
36#include "devices.h"
37#include "generic.h"
38
39int gpio_eth_irq;
40int gpio_debug_led1;
41int gpio_debug_led2;
42
43int wm9713_irq;
44
45int lcd_id;
46int lcd_orientation;
47
48struct platform_device pxa_device_wm9713_audio = {
49 .name = "wm9713-codec",
50 .id = -1,
51};
52
53static void __init zylonite_init_wm9713_audio(void)
54{
55 platform_device_register(&pxa_device_wm9713_audio);
56}
57
58static struct resource smc91x_resources[] = {
59 [0] = {
60 .start = ZYLONITE_ETH_PHYS + 0x300,
61 .end = ZYLONITE_ETH_PHYS + 0xfffff,
62 .flags = IORESOURCE_MEM,
63 },
64 [1] = {
65 .start = -1, /* for run-time assignment */
66 .end = -1,
67 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
68 }
69};
70
71static struct smc91x_platdata zylonite_smc91x_info = {
72 .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT |
73 SMC91X_NOWAIT | SMC91X_USE_DMA,
74};
75
76static struct platform_device smc91x_device = {
77 .name = "smc91x",
78 .id = 0,
79 .num_resources = ARRAY_SIZE(smc91x_resources),
80 .resource = smc91x_resources,
81 .dev = {
82 .platform_data = &zylonite_smc91x_info,
83 },
84};
85
86#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
87static struct gpio_led zylonite_debug_leds[] = {
88 [0] = {
89 .name = "zylonite:yellow:1",
90 .default_trigger = "heartbeat",
91 },
92 [1] = {
93 .name = "zylonite:yellow:2",
94 .default_trigger = "default-on",
95 },
96};
97
98static struct gpio_led_platform_data zylonite_debug_leds_info = {
99 .leds = zylonite_debug_leds,
100 .num_leds = ARRAY_SIZE(zylonite_debug_leds),
101};
102
103static struct platform_device zylonite_device_leds = {
104 .name = "leds-gpio",
105 .id = -1,
106 .dev = {
107 .platform_data = &zylonite_debug_leds_info,
108 }
109};
110
111static void __init zylonite_init_leds(void)
112{
113 zylonite_debug_leds[0].gpio = gpio_debug_led1;
114 zylonite_debug_leds[1].gpio = gpio_debug_led2;
115
116 platform_device_register(&zylonite_device_leds);
117}
118#else
119static inline void zylonite_init_leds(void) {}
120#endif
121
122#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
123static struct platform_pwm_backlight_data zylonite_backlight_data = {
124 .pwm_id = 3,
125 .max_brightness = 100,
126 .dft_brightness = 100,
127 .pwm_period_ns = 10000,
128 .enable_gpio = -1,
129};
130
131static struct platform_device zylonite_backlight_device = {
132 .name = "pwm-backlight",
133 .dev = {
134 .parent = &pxa27x_device_pwm1.dev,
135 .platform_data = &zylonite_backlight_data,
136 },
137};
138
139static struct pxafb_mode_info toshiba_ltm035a776c_mode = {
140 .pixclock = 110000,
141 .xres = 240,
142 .yres = 320,
143 .bpp = 16,
144 .hsync_len = 4,
145 .left_margin = 6,
146 .right_margin = 4,
147 .vsync_len = 2,
148 .upper_margin = 2,
149 .lower_margin = 3,
150 .sync = FB_SYNC_VERT_HIGH_ACT,
151};
152
153static struct pxafb_mode_info toshiba_ltm04c380k_mode = {
154 .pixclock = 50000,
155 .xres = 640,
156 .yres = 480,
157 .bpp = 16,
158 .hsync_len = 1,
159 .left_margin = 0x9f,
160 .right_margin = 1,
161 .vsync_len = 44,
162 .upper_margin = 0,
163 .lower_margin = 0,
164 .sync = FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT,
165};
166
167static struct pxafb_mach_info zylonite_toshiba_lcd_info = {
168 .num_modes = 1,
169 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
170};
171
172static struct pxafb_mode_info sharp_ls037_modes[] = {
173 [0] = {
174 .pixclock = 158000,
175 .xres = 240,
176 .yres = 320,
177 .bpp = 16,
178 .hsync_len = 4,
179 .left_margin = 39,
180 .right_margin = 39,
181 .vsync_len = 1,
182 .upper_margin = 2,
183 .lower_margin = 3,
184 .sync = 0,
185 },
186 [1] = {
187 .pixclock = 39700,
188 .xres = 480,
189 .yres = 640,
190 .bpp = 16,
191 .hsync_len = 8,
192 .left_margin = 81,
193 .right_margin = 81,
194 .vsync_len = 1,
195 .upper_margin = 2,
196 .lower_margin = 7,
197 .sync = 0,
198 },
199};
200
201static struct pxafb_mach_info zylonite_sharp_lcd_info = {
202 .modes = sharp_ls037_modes,
203 .num_modes = 2,
204 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
205};
206
207static void __init zylonite_init_lcd(void)
208{
209 platform_device_register(&zylonite_backlight_device);
210
211 if (lcd_id & 0x20) {
212 pxa_set_fb_info(NULL, &zylonite_sharp_lcd_info);
213 return;
214 }
215
216 /* legacy LCD panels, it would be handy here if LCD panel type can
217 * be decided at run-time
218 */
219 if (1)
220 zylonite_toshiba_lcd_info.modes = &toshiba_ltm035a776c_mode;
221 else
222 zylonite_toshiba_lcd_info.modes = &toshiba_ltm04c380k_mode;
223
224 pxa_set_fb_info(NULL, &zylonite_toshiba_lcd_info);
225}
226#else
227static inline void zylonite_init_lcd(void) {}
228#endif
229
230#if defined(CONFIG_MMC)
231static struct pxamci_platform_data zylonite_mci_platform_data = {
232 .detect_delay_ms= 200,
233 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
234 .gpio_card_detect = EXT_GPIO(0),
235 .gpio_card_ro = EXT_GPIO(2),
236 .gpio_power = -1,
237};
238
239static struct pxamci_platform_data zylonite_mci2_platform_data = {
240 .detect_delay_ms= 200,
241 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
242 .gpio_card_detect = EXT_GPIO(1),
243 .gpio_card_ro = EXT_GPIO(3),
244 .gpio_power = -1,
245};
246
247static struct pxamci_platform_data zylonite_mci3_platform_data = {
248 .detect_delay_ms= 200,
249 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
250 .gpio_card_detect = EXT_GPIO(30),
251 .gpio_card_ro = EXT_GPIO(31),
252 .gpio_power = -1,
253};
254
255static void __init zylonite_init_mmc(void)
256{
257 pxa_set_mci_info(&zylonite_mci_platform_data);
258 pxa3xx_set_mci2_info(&zylonite_mci2_platform_data);
259 if (cpu_is_pxa310())
260 pxa3xx_set_mci3_info(&zylonite_mci3_platform_data);
261}
262#else
263static inline void zylonite_init_mmc(void) {}
264#endif
265
266#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
267static const unsigned int zylonite_matrix_key_map[] = {
268 /* KEY(row, col, key_code) */
269 KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D),
270 KEY(1, 0, KEY_E), KEY(1, 1, KEY_F), KEY(1, 2, KEY_G), KEY(1, 5, KEY_H),
271 KEY(2, 0, KEY_I), KEY(2, 1, KEY_J), KEY(2, 2, KEY_K), KEY(2, 5, KEY_L),
272 KEY(3, 0, KEY_M), KEY(3, 1, KEY_N), KEY(3, 2, KEY_O), KEY(3, 5, KEY_P),
273 KEY(5, 0, KEY_Q), KEY(5, 1, KEY_R), KEY(5, 2, KEY_S), KEY(5, 5, KEY_T),
274 KEY(6, 0, KEY_U), KEY(6, 1, KEY_V), KEY(6, 2, KEY_W), KEY(6, 5, KEY_X),
275 KEY(7, 1, KEY_Y), KEY(7, 2, KEY_Z),
276
277 KEY(4, 4, KEY_0), KEY(1, 3, KEY_1), KEY(4, 1, KEY_2), KEY(1, 4, KEY_3),
278 KEY(2, 3, KEY_4), KEY(4, 2, KEY_5), KEY(2, 4, KEY_6), KEY(3, 3, KEY_7),
279 KEY(4, 3, KEY_8), KEY(3, 4, KEY_9),
280
281 KEY(4, 5, KEY_SPACE),
282 KEY(5, 3, KEY_KPASTERISK), /* * */
283 KEY(5, 4, KEY_KPDOT), /* #" */
284
285 KEY(0, 7, KEY_UP),
286 KEY(1, 7, KEY_DOWN),
287 KEY(2, 7, KEY_LEFT),
288 KEY(3, 7, KEY_RIGHT),
289 KEY(2, 6, KEY_HOME),
290 KEY(3, 6, KEY_END),
291 KEY(6, 4, KEY_DELETE),
292 KEY(6, 6, KEY_BACK),
293 KEY(6, 3, KEY_CAPSLOCK), /* KEY_LEFTSHIFT), */
294
295 KEY(4, 6, KEY_ENTER), /* scroll push */
296 KEY(5, 7, KEY_ENTER), /* keypad action */
297
298 KEY(0, 4, KEY_EMAIL),
299 KEY(5, 6, KEY_SEND),
300 KEY(4, 0, KEY_CALENDAR),
301 KEY(7, 6, KEY_RECORD),
302 KEY(6, 7, KEY_VOLUMEUP),
303 KEY(7, 7, KEY_VOLUMEDOWN),
304
305 KEY(0, 6, KEY_F22), /* soft1 */
306 KEY(1, 6, KEY_F23), /* soft2 */
307 KEY(0, 3, KEY_AUX), /* contact */
308};
309
310static struct matrix_keymap_data zylonite_matrix_keymap_data = {
311 .keymap = zylonite_matrix_key_map,
312 .keymap_size = ARRAY_SIZE(zylonite_matrix_key_map),
313};
314
315static struct pxa27x_keypad_platform_data zylonite_keypad_info = {
316 .matrix_key_rows = 8,
317 .matrix_key_cols = 8,
318 .matrix_keymap_data = &zylonite_matrix_keymap_data,
319
320 .enable_rotary0 = 1,
321 .rotary0_up_key = KEY_UP,
322 .rotary0_down_key = KEY_DOWN,
323
324 .debounce_interval = 30,
325};
326
327static void __init zylonite_init_keypad(void)
328{
329 pxa_set_keypad_info(&zylonite_keypad_info);
330}
331#else
332static inline void zylonite_init_keypad(void) {}
333#endif
334
335#if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
336static struct mtd_partition zylonite_nand_partitions[] = {
337 [0] = {
338 .name = "Bootloader",
339 .offset = 0,
340 .size = 0x060000,
341 .mask_flags = MTD_WRITEABLE, /* force read-only */
342 },
343 [1] = {
344 .name = "Kernel",
345 .offset = 0x060000,
346 .size = 0x200000,
347 .mask_flags = MTD_WRITEABLE, /* force read-only */
348 },
349 [2] = {
350 .name = "Filesystem",
351 .offset = 0x0260000,
352 .size = 0x3000000, /* 48M - rootfs */
353 },
354 [3] = {
355 .name = "MassStorage",
356 .offset = 0x3260000,
357 .size = 0x3d40000,
358 },
359 [4] = {
360 .name = "BBT",
361 .offset = 0x6FA0000,
362 .size = 0x80000,
363 .mask_flags = MTD_WRITEABLE, /* force read-only */
364 },
365 /* NOTE: we reserve some blocks at the end of the NAND flash for
366 * bad block management, and the max number of relocation blocks
367 * differs on different platforms. Please take care with it when
368 * defining the partition table.
369 */
370};
371
372static struct pxa3xx_nand_platform_data zylonite_nand_info = {
373 .enable_arbiter = 1,
374 .num_cs = 1,
375 .parts[0] = zylonite_nand_partitions,
376 .nr_parts[0] = ARRAY_SIZE(zylonite_nand_partitions),
377};
378
379static void __init zylonite_init_nand(void)
380{
381 pxa3xx_set_nand_info(&zylonite_nand_info);
382}
383#else
384static inline void zylonite_init_nand(void) {}
385#endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */
386
387#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
388static struct pxaohci_platform_data zylonite_ohci_info = {
389 .port_mode = PMM_PERPORT_MODE,
390 .flags = ENABLE_PORT1 | ENABLE_PORT2 |
391 POWER_CONTROL_LOW | POWER_SENSE_LOW,
392};
393
394static void __init zylonite_init_ohci(void)
395{
396 pxa_set_ohci_info(&zylonite_ohci_info);
397}
398#else
399static inline void zylonite_init_ohci(void) {}
400#endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
401
402static void __init zylonite_init(void)
403{
404 pxa_set_ffuart_info(NULL);
405 pxa_set_btuart_info(NULL);
406 pxa_set_stuart_info(NULL);
407
408 /* board-processor specific initialization */
409 zylonite_pxa300_init();
410 zylonite_pxa320_init();
411
412 /*
413 * Note: We depend that the bootloader set
414 * the correct value to MSC register for SMC91x.
415 */
416 smc91x_resources[1].start = PXA_GPIO_TO_IRQ(gpio_eth_irq);
417 smc91x_resources[1].end = PXA_GPIO_TO_IRQ(gpio_eth_irq);
418 platform_device_register(&smc91x_device);
419
420 pxa_set_ac97_info(NULL);
421 zylonite_init_lcd();
422 zylonite_init_mmc();
423 zylonite_init_keypad();
424 zylonite_init_nand();
425 zylonite_init_leds();
426 zylonite_init_ohci();
427 zylonite_init_wm9713_audio();
428}
429
430MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)")
431 .atag_offset = 0x100,
432 .map_io = pxa3xx_map_io,
433 .nr_irqs = ZYLONITE_NR_IRQS,
434 .init_irq = pxa3xx_init_irq,
435 .handle_irq = pxa3xx_handle_irq,
436 .init_time = pxa_timer_init,
437 .init_machine = zylonite_init,
438 .restart = pxa_restart,
439MACHINE_END
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * linux/arch/arm/mach-pxa/zylonite.c
4 *
5 * Support for the PXA3xx Development Platform (aka Zylonite)
6 *
7 * Copyright (C) 2006 Marvell International Ltd.
8 *
9 * 2007-09-04: eric miao <eric.miao@marvell.com>
10 * rewrite to align with latest kernel
11 */
12
13#include <linux/module.h>
14#include <linux/kernel.h>
15#include <linux/interrupt.h>
16#include <linux/leds.h>
17#include <linux/init.h>
18#include <linux/platform_device.h>
19#include <linux/gpio/machine.h>
20#include <linux/pwm.h>
21#include <linux/pwm_backlight.h>
22#include <linux/smc91x.h>
23#include <linux/soc/pxa/cpu.h>
24
25#include <asm/mach-types.h>
26#include <asm/mach/arch.h>
27#include "pxa3xx.h"
28#include <linux/platform_data/asoc-pxa.h>
29#include <linux/platform_data/video-pxafb.h>
30#include "zylonite.h"
31#include <linux/platform_data/mmc-pxamci.h>
32#include <linux/platform_data/usb-ohci-pxa27x.h>
33#include <linux/platform_data/keypad-pxa27x.h>
34#include <linux/platform_data/mtd-nand-pxa3xx.h>
35#include "mfp.h"
36
37#include "devices.h"
38#include "generic.h"
39
40int gpio_eth_irq;
41int gpio_debug_led1;
42int gpio_debug_led2;
43
44int wm9713_irq;
45
46int lcd_id;
47int lcd_orientation;
48
49static struct resource smc91x_resources[] = {
50 [0] = {
51 .start = ZYLONITE_ETH_PHYS + 0x300,
52 .end = ZYLONITE_ETH_PHYS + 0xfffff,
53 .flags = IORESOURCE_MEM,
54 },
55 [1] = {
56 .start = -1, /* for run-time assignment */
57 .end = -1,
58 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
59 }
60};
61
62static struct smc91x_platdata zylonite_smc91x_info = {
63 .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT |
64 SMC91X_NOWAIT | SMC91X_USE_DMA,
65};
66
67static struct platform_device smc91x_device = {
68 .name = "smc91x",
69 .id = 0,
70 .num_resources = ARRAY_SIZE(smc91x_resources),
71 .resource = smc91x_resources,
72 .dev = {
73 .platform_data = &zylonite_smc91x_info,
74 },
75};
76
77#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
78static struct gpio_led zylonite_debug_leds[] = {
79 [0] = {
80 .name = "zylonite:yellow:1",
81 .default_trigger = "heartbeat",
82 },
83 [1] = {
84 .name = "zylonite:yellow:2",
85 .default_trigger = "default-on",
86 },
87};
88
89static struct gpio_led_platform_data zylonite_debug_leds_info = {
90 .leds = zylonite_debug_leds,
91 .num_leds = ARRAY_SIZE(zylonite_debug_leds),
92};
93
94static struct platform_device zylonite_device_leds = {
95 .name = "leds-gpio",
96 .id = -1,
97 .dev = {
98 .platform_data = &zylonite_debug_leds_info,
99 }
100};
101
102static void __init zylonite_init_leds(void)
103{
104 zylonite_debug_leds[0].gpio = gpio_debug_led1;
105 zylonite_debug_leds[1].gpio = gpio_debug_led2;
106
107 platform_device_register(&zylonite_device_leds);
108}
109#else
110static inline void zylonite_init_leds(void) {}
111#endif
112
113#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
114static struct pwm_lookup zylonite_pwm_lookup[] = {
115 PWM_LOOKUP("pxa27x-pwm.1", 1, "pwm-backlight.0", NULL, 10000,
116 PWM_POLARITY_NORMAL),
117};
118
119static struct platform_pwm_backlight_data zylonite_backlight_data = {
120 .max_brightness = 100,
121 .dft_brightness = 100,
122};
123
124static struct platform_device zylonite_backlight_device = {
125 .name = "pwm-backlight",
126 .dev = {
127 .parent = &pxa27x_device_pwm1.dev,
128 .platform_data = &zylonite_backlight_data,
129 },
130};
131
132static struct pxafb_mode_info toshiba_ltm035a776c_mode = {
133 .pixclock = 110000,
134 .xres = 240,
135 .yres = 320,
136 .bpp = 16,
137 .hsync_len = 4,
138 .left_margin = 6,
139 .right_margin = 4,
140 .vsync_len = 2,
141 .upper_margin = 2,
142 .lower_margin = 3,
143 .sync = FB_SYNC_VERT_HIGH_ACT,
144};
145
146static struct pxafb_mode_info toshiba_ltm04c380k_mode = {
147 .pixclock = 50000,
148 .xres = 640,
149 .yres = 480,
150 .bpp = 16,
151 .hsync_len = 1,
152 .left_margin = 0x9f,
153 .right_margin = 1,
154 .vsync_len = 44,
155 .upper_margin = 0,
156 .lower_margin = 0,
157 .sync = FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT,
158};
159
160static struct pxafb_mach_info zylonite_toshiba_lcd_info = {
161 .num_modes = 1,
162 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
163};
164
165static struct pxafb_mode_info sharp_ls037_modes[] = {
166 [0] = {
167 .pixclock = 158000,
168 .xres = 240,
169 .yres = 320,
170 .bpp = 16,
171 .hsync_len = 4,
172 .left_margin = 39,
173 .right_margin = 39,
174 .vsync_len = 1,
175 .upper_margin = 2,
176 .lower_margin = 3,
177 .sync = 0,
178 },
179 [1] = {
180 .pixclock = 39700,
181 .xres = 480,
182 .yres = 640,
183 .bpp = 16,
184 .hsync_len = 8,
185 .left_margin = 81,
186 .right_margin = 81,
187 .vsync_len = 1,
188 .upper_margin = 2,
189 .lower_margin = 7,
190 .sync = 0,
191 },
192};
193
194static struct pxafb_mach_info zylonite_sharp_lcd_info = {
195 .modes = sharp_ls037_modes,
196 .num_modes = 2,
197 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
198};
199
200static void __init zylonite_init_lcd(void)
201{
202 pwm_add_table(zylonite_pwm_lookup, ARRAY_SIZE(zylonite_pwm_lookup));
203 platform_device_register(&zylonite_backlight_device);
204
205 if (lcd_id & 0x20) {
206 pxa_set_fb_info(NULL, &zylonite_sharp_lcd_info);
207 return;
208 }
209
210 /* legacy LCD panels, it would be handy here if LCD panel type can
211 * be decided at run-time
212 */
213 if (1)
214 zylonite_toshiba_lcd_info.modes = &toshiba_ltm035a776c_mode;
215 else
216 zylonite_toshiba_lcd_info.modes = &toshiba_ltm04c380k_mode;
217
218 pxa_set_fb_info(NULL, &zylonite_toshiba_lcd_info);
219}
220#else
221static inline void zylonite_init_lcd(void) {}
222#endif
223
224#if defined(CONFIG_MMC)
225static struct pxamci_platform_data zylonite_mci_platform_data = {
226 .detect_delay_ms= 200,
227 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
228};
229
230#define PCA9539A_MCI_CD 0
231#define PCA9539A_MCI1_CD 1
232#define PCA9539A_MCI_WP 2
233#define PCA9539A_MCI1_WP 3
234#define PCA9539A_MCI3_CD 30
235#define PCA9539A_MCI3_WP 31
236
237static struct gpiod_lookup_table zylonite_mci_gpio_table = {
238 .dev_id = "pxa2xx-mci.0",
239 .table = {
240 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI_CD,
241 "cd", GPIO_ACTIVE_LOW),
242 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI_WP,
243 "wp", GPIO_ACTIVE_LOW),
244 { },
245 },
246};
247
248static struct pxamci_platform_data zylonite_mci2_platform_data = {
249 .detect_delay_ms= 200,
250 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
251};
252
253static struct gpiod_lookup_table zylonite_mci2_gpio_table = {
254 .dev_id = "pxa2xx-mci.1",
255 .table = {
256 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI1_CD,
257 "cd", GPIO_ACTIVE_LOW),
258 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI1_WP,
259 "wp", GPIO_ACTIVE_LOW),
260 { },
261 },
262};
263
264static struct pxamci_platform_data zylonite_mci3_platform_data = {
265 .detect_delay_ms= 200,
266 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
267};
268
269static struct gpiod_lookup_table zylonite_mci3_gpio_table = {
270 .dev_id = "pxa2xx-mci.2",
271 .table = {
272 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI3_CD,
273 "cd", GPIO_ACTIVE_LOW),
274 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI3_WP,
275 "wp", GPIO_ACTIVE_LOW),
276 { },
277 },
278};
279
280static void __init zylonite_init_mmc(void)
281{
282 gpiod_add_lookup_table(&zylonite_mci_gpio_table);
283 pxa_set_mci_info(&zylonite_mci_platform_data);
284 gpiod_add_lookup_table(&zylonite_mci2_gpio_table);
285 pxa3xx_set_mci2_info(&zylonite_mci2_platform_data);
286 if (cpu_is_pxa310()) {
287 gpiod_add_lookup_table(&zylonite_mci3_gpio_table);
288 pxa3xx_set_mci3_info(&zylonite_mci3_platform_data);
289 }
290}
291#else
292static inline void zylonite_init_mmc(void) {}
293#endif
294
295#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
296static const unsigned int zylonite_matrix_key_map[] = {
297 /* KEY(row, col, key_code) */
298 KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D),
299 KEY(1, 0, KEY_E), KEY(1, 1, KEY_F), KEY(1, 2, KEY_G), KEY(1, 5, KEY_H),
300 KEY(2, 0, KEY_I), KEY(2, 1, KEY_J), KEY(2, 2, KEY_K), KEY(2, 5, KEY_L),
301 KEY(3, 0, KEY_M), KEY(3, 1, KEY_N), KEY(3, 2, KEY_O), KEY(3, 5, KEY_P),
302 KEY(5, 0, KEY_Q), KEY(5, 1, KEY_R), KEY(5, 2, KEY_S), KEY(5, 5, KEY_T),
303 KEY(6, 0, KEY_U), KEY(6, 1, KEY_V), KEY(6, 2, KEY_W), KEY(6, 5, KEY_X),
304 KEY(7, 1, KEY_Y), KEY(7, 2, KEY_Z),
305
306 KEY(4, 4, KEY_0), KEY(1, 3, KEY_1), KEY(4, 1, KEY_2), KEY(1, 4, KEY_3),
307 KEY(2, 3, KEY_4), KEY(4, 2, KEY_5), KEY(2, 4, KEY_6), KEY(3, 3, KEY_7),
308 KEY(4, 3, KEY_8), KEY(3, 4, KEY_9),
309
310 KEY(4, 5, KEY_SPACE),
311 KEY(5, 3, KEY_KPASTERISK), /* * */
312 KEY(5, 4, KEY_KPDOT), /* #" */
313
314 KEY(0, 7, KEY_UP),
315 KEY(1, 7, KEY_DOWN),
316 KEY(2, 7, KEY_LEFT),
317 KEY(3, 7, KEY_RIGHT),
318 KEY(2, 6, KEY_HOME),
319 KEY(3, 6, KEY_END),
320 KEY(6, 4, KEY_DELETE),
321 KEY(6, 6, KEY_BACK),
322 KEY(6, 3, KEY_CAPSLOCK), /* KEY_LEFTSHIFT), */
323
324 KEY(4, 6, KEY_ENTER), /* scroll push */
325 KEY(5, 7, KEY_ENTER), /* keypad action */
326
327 KEY(0, 4, KEY_EMAIL),
328 KEY(5, 6, KEY_SEND),
329 KEY(4, 0, KEY_CALENDAR),
330 KEY(7, 6, KEY_RECORD),
331 KEY(6, 7, KEY_VOLUMEUP),
332 KEY(7, 7, KEY_VOLUMEDOWN),
333
334 KEY(0, 6, KEY_F22), /* soft1 */
335 KEY(1, 6, KEY_F23), /* soft2 */
336 KEY(0, 3, KEY_AUX), /* contact */
337};
338
339static struct matrix_keymap_data zylonite_matrix_keymap_data = {
340 .keymap = zylonite_matrix_key_map,
341 .keymap_size = ARRAY_SIZE(zylonite_matrix_key_map),
342};
343
344static struct pxa27x_keypad_platform_data zylonite_keypad_info = {
345 .matrix_key_rows = 8,
346 .matrix_key_cols = 8,
347 .matrix_keymap_data = &zylonite_matrix_keymap_data,
348
349 .enable_rotary0 = 1,
350 .rotary0_up_key = KEY_UP,
351 .rotary0_down_key = KEY_DOWN,
352
353 .debounce_interval = 30,
354};
355
356static void __init zylonite_init_keypad(void)
357{
358 pxa_set_keypad_info(&zylonite_keypad_info);
359}
360#else
361static inline void zylonite_init_keypad(void) {}
362#endif
363
364#if IS_ENABLED(CONFIG_MTD_NAND_MARVELL)
365static struct mtd_partition zylonite_nand_partitions[] = {
366 [0] = {
367 .name = "Bootloader",
368 .offset = 0,
369 .size = 0x060000,
370 .mask_flags = MTD_WRITEABLE, /* force read-only */
371 },
372 [1] = {
373 .name = "Kernel",
374 .offset = 0x060000,
375 .size = 0x200000,
376 .mask_flags = MTD_WRITEABLE, /* force read-only */
377 },
378 [2] = {
379 .name = "Filesystem",
380 .offset = 0x0260000,
381 .size = 0x3000000, /* 48M - rootfs */
382 },
383 [3] = {
384 .name = "MassStorage",
385 .offset = 0x3260000,
386 .size = 0x3d40000,
387 },
388 [4] = {
389 .name = "BBT",
390 .offset = 0x6FA0000,
391 .size = 0x80000,
392 .mask_flags = MTD_WRITEABLE, /* force read-only */
393 },
394 /* NOTE: we reserve some blocks at the end of the NAND flash for
395 * bad block management, and the max number of relocation blocks
396 * differs on different platforms. Please take care with it when
397 * defining the partition table.
398 */
399};
400
401static struct pxa3xx_nand_platform_data zylonite_nand_info = {
402 .parts = zylonite_nand_partitions,
403 .nr_parts = ARRAY_SIZE(zylonite_nand_partitions),
404};
405
406static void __init zylonite_init_nand(void)
407{
408 pxa3xx_set_nand_info(&zylonite_nand_info);
409}
410#else
411static inline void zylonite_init_nand(void) {}
412#endif /* IS_ENABLED(CONFIG_MTD_NAND_MARVELL) */
413
414#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
415static struct pxaohci_platform_data zylonite_ohci_info = {
416 .port_mode = PMM_PERPORT_MODE,
417 .flags = ENABLE_PORT1 | ENABLE_PORT2 |
418 POWER_CONTROL_LOW | POWER_SENSE_LOW,
419};
420
421static void __init zylonite_init_ohci(void)
422{
423 pxa_set_ohci_info(&zylonite_ohci_info);
424}
425#else
426static inline void zylonite_init_ohci(void) {}
427#endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
428
429static struct gpiod_lookup_table zylonite_wm97xx_touch_gpio15_table = {
430 .dev_id = "wm97xx-touch.0",
431 .table = {
432 GPIO_LOOKUP("gpio-pxa", mfp_to_gpio(MFP_PIN_GPIO15),
433 "touch", GPIO_ACTIVE_LOW),
434 { },
435 },
436};
437
438static struct gpiod_lookup_table zylonite_wm97xx_touch_gpio26_table = {
439 .dev_id = "wm97xx-touch.0",
440 .table = {
441 GPIO_LOOKUP("gpio-pxa", mfp_to_gpio(MFP_PIN_GPIO26),
442 "touch", GPIO_ACTIVE_LOW),
443 { },
444 },
445};
446
447static void __init zylonite_init_wm97xx_touch(void)
448{
449 if (!IS_ENABLED(CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE))
450 return;
451
452 if (cpu_is_pxa320())
453 gpiod_add_lookup_table(&zylonite_wm97xx_touch_gpio15_table);
454 else
455 gpiod_add_lookup_table(&zylonite_wm97xx_touch_gpio26_table);
456}
457
458static void __init zylonite_init(void)
459{
460 pxa_set_ffuart_info(NULL);
461 pxa_set_btuart_info(NULL);
462 pxa_set_stuart_info(NULL);
463
464 /* board-processor specific initialization */
465 zylonite_pxa300_init();
466 zylonite_pxa320_init();
467
468 /*
469 * Note: We depend that the bootloader set
470 * the correct value to MSC register for SMC91x.
471 */
472 smc91x_resources[1].start = PXA_GPIO_TO_IRQ(gpio_eth_irq);
473 smc91x_resources[1].end = PXA_GPIO_TO_IRQ(gpio_eth_irq);
474 platform_device_register(&smc91x_device);
475
476 pxa_set_ac97_info(NULL);
477 zylonite_init_lcd();
478 zylonite_init_mmc();
479 zylonite_init_keypad();
480 zylonite_init_nand();
481 zylonite_init_leds();
482 zylonite_init_ohci();
483 zylonite_init_wm97xx_touch();
484}
485
486MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)")
487 .atag_offset = 0x100,
488 .map_io = pxa3xx_map_io,
489 .nr_irqs = ZYLONITE_NR_IRQS,
490 .init_irq = pxa3xx_init_irq,
491 .handle_irq = pxa3xx_handle_irq,
492 .init_time = pxa_timer_init,
493 .init_machine = zylonite_init,
494 .restart = pxa_restart,
495MACHINE_END