Linux Audio

Check our new training course

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