2 * linux/arch/arm/mach-pxa/zylonite.c
4 * Support for the PXA3xx Development Platform (aka Zylonite)
6 * Copyright (C) 2006 Marvell International Ltd.
8 * 2007-09-04: eric miao <eric.miao@marvell.com>
9 * rewrite to align with latest kernel
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.
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>
22 #include <asm/mach-types.h>
23 #include <asm/mach/arch.h>
24 #include <asm/hardware.h>
25 #include <asm/arch/gpio.h>
26 #include <asm/arch/pxafb.h>
27 #include <asm/arch/zylonite.h>
28 #include <asm/arch/mmc.h>
29 #include <asm/arch/pxa27x_keypad.h>
34 struct platform_mmc_slot zylonite_mmc_slot
[MAX_SLOTS
];
44 static struct resource smc91x_resources
[] = {
46 .start
= ZYLONITE_ETH_PHYS
+ 0x300,
47 .end
= ZYLONITE_ETH_PHYS
+ 0xfffff,
48 .flags
= IORESOURCE_MEM
,
51 .start
= -1, /* for run-time assignment */
53 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE
,
57 static struct platform_device smc91x_device
= {
60 .num_resources
= ARRAY_SIZE(smc91x_resources
),
61 .resource
= smc91x_resources
,
64 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
65 static void zylonite_backlight_power(int on
)
67 gpio_set_value(gpio_backlight
, on
);
70 static struct pxafb_mode_info toshiba_ltm035a776c_mode
= {
81 .sync
= FB_SYNC_VERT_HIGH_ACT
,
84 static struct pxafb_mode_info toshiba_ltm04c380k_mode
= {
95 .sync
= FB_SYNC_HOR_HIGH_ACT
|FB_SYNC_VERT_HIGH_ACT
,
98 static struct pxafb_mach_info zylonite_toshiba_lcd_info
= {
102 .pxafb_backlight_power
= zylonite_backlight_power
,
105 static struct pxafb_mode_info sharp_ls037_modes
[] = {
134 static struct pxafb_mach_info zylonite_sharp_lcd_info
= {
135 .modes
= sharp_ls037_modes
,
138 .lccr3
= LCCR3_PCP
| LCCR3_HSP
| LCCR3_VSP
,
139 .pxafb_backlight_power
= zylonite_backlight_power
,
142 static void __init
zylonite_init_lcd(void)
144 /* backlight GPIO: output, default on */
145 gpio_direction_output(gpio_backlight
, 1);
148 set_pxa_fb_info(&zylonite_sharp_lcd_info
);
152 /* legacy LCD panels, it would be handy here if LCD panel type can
153 * be decided at run-time
156 zylonite_toshiba_lcd_info
.modes
= &toshiba_ltm035a776c_mode
;
158 zylonite_toshiba_lcd_info
.modes
= &toshiba_ltm04c380k_mode
;
160 set_pxa_fb_info(&zylonite_toshiba_lcd_info
);
163 static inline void zylonite_init_lcd(void) {}
166 #if defined(CONFIG_MMC)
167 static int zylonite_mci_ro(struct device
*dev
)
169 struct platform_device
*pdev
= to_platform_device(dev
);
171 return gpio_get_value(zylonite_mmc_slot
[pdev
->id
].gpio_wp
);
174 static int zylonite_mci_init(struct device
*dev
,
175 irq_handler_t zylonite_detect_int
,
178 struct platform_device
*pdev
= to_platform_device(dev
);
179 int err
, cd_irq
, gpio_cd
, gpio_wp
;
181 cd_irq
= gpio_to_irq(zylonite_mmc_slot
[pdev
->id
].gpio_cd
);
182 gpio_cd
= zylonite_mmc_slot
[pdev
->id
].gpio_cd
;
183 gpio_wp
= zylonite_mmc_slot
[pdev
->id
].gpio_wp
;
186 * setup GPIO for Zylonite MMC controller
188 err
= gpio_request(gpio_cd
, "mmc card detect");
191 gpio_direction_input(gpio_cd
);
193 err
= gpio_request(gpio_wp
, "mmc write protect");
196 gpio_direction_input(gpio_wp
);
198 err
= request_irq(cd_irq
, zylonite_detect_int
,
199 IRQF_TRIGGER_RISING
| IRQF_TRIGGER_FALLING
,
200 "MMC card detect", data
);
202 printk(KERN_ERR
"%s: MMC/SD/SDIO: "
203 "can't request card detect IRQ\n", __func__
);
204 goto err_request_irq
;
217 static void zylonite_mci_exit(struct device
*dev
, void *data
)
219 struct platform_device
*pdev
= to_platform_device(dev
);
220 int cd_irq
, gpio_cd
, gpio_wp
;
222 cd_irq
= gpio_to_irq(zylonite_mmc_slot
[pdev
->id
].gpio_cd
);
223 gpio_cd
= zylonite_mmc_slot
[pdev
->id
].gpio_cd
;
224 gpio_wp
= zylonite_mmc_slot
[pdev
->id
].gpio_wp
;
226 free_irq(cd_irq
, data
);
231 static struct pxamci_platform_data zylonite_mci_platform_data
= {
233 .ocr_mask
= MMC_VDD_32_33
|MMC_VDD_33_34
,
234 .init
= zylonite_mci_init
,
235 .exit
= zylonite_mci_exit
,
236 .get_ro
= zylonite_mci_ro
,
239 static struct pxamci_platform_data zylonite_mci2_platform_data
= {
241 .ocr_mask
= MMC_VDD_32_33
|MMC_VDD_33_34
,
244 static void __init
zylonite_init_mmc(void)
246 pxa_set_mci_info(&zylonite_mci_platform_data
);
247 pxa3xx_set_mci2_info(&zylonite_mci2_platform_data
);
249 pxa3xx_set_mci3_info(&zylonite_mci_platform_data
);
252 static inline void zylonite_init_mmc(void) {}
255 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULES)
256 static unsigned int zylonite_matrix_key_map
[] = {
257 /* KEY(row, col, key_code) */
258 KEY(0, 0, KEY_A
), KEY(0, 1, KEY_B
), KEY(0, 2, KEY_C
), KEY(0, 5, KEY_D
),
259 KEY(1, 0, KEY_E
), KEY(1, 1, KEY_F
), KEY(1, 2, KEY_G
), KEY(1, 5, KEY_H
),
260 KEY(2, 0, KEY_I
), KEY(2, 1, KEY_J
), KEY(2, 2, KEY_K
), KEY(2, 5, KEY_L
),
261 KEY(3, 0, KEY_M
), KEY(3, 1, KEY_N
), KEY(3, 2, KEY_O
), KEY(3, 5, KEY_P
),
262 KEY(5, 0, KEY_Q
), KEY(5, 1, KEY_R
), KEY(5, 2, KEY_S
), KEY(5, 5, KEY_T
),
263 KEY(6, 0, KEY_U
), KEY(6, 1, KEY_V
), KEY(6, 2, KEY_W
), KEY(6, 5, KEY_X
),
264 KEY(7, 1, KEY_Y
), KEY(7, 2, KEY_Z
),
266 KEY(4, 4, KEY_0
), KEY(1, 3, KEY_1
), KEY(4, 1, KEY_2
), KEY(1, 4, KEY_3
),
267 KEY(2, 3, KEY_4
), KEY(4, 2, KEY_5
), KEY(2, 4, KEY_6
), KEY(3, 3, KEY_7
),
268 KEY(4, 3, KEY_8
), KEY(3, 4, KEY_9
),
270 KEY(4, 5, KEY_SPACE
),
271 KEY(5, 3, KEY_KPASTERISK
), /* * */
272 KEY(5, 4, KEY_KPDOT
), /* #" */
277 KEY(3, 7, KEY_RIGHT
),
280 KEY(6, 4, KEY_DELETE
),
282 KEY(6, 3, KEY_CAPSLOCK
), /* KEY_LEFTSHIFT), */
284 KEY(4, 6, KEY_ENTER
), /* scroll push */
285 KEY(5, 7, KEY_ENTER
), /* keypad action */
287 KEY(0, 4, KEY_EMAIL
),
289 KEY(4, 0, KEY_CALENDAR
),
290 KEY(7, 6, KEY_RECORD
),
291 KEY(6, 7, KEY_VOLUMEUP
),
292 KEY(7, 7, KEY_VOLUMEDOWN
),
294 KEY(0, 6, KEY_F22
), /* soft1 */
295 KEY(1, 6, KEY_F23
), /* soft2 */
296 KEY(0, 3, KEY_AUX
), /* contact */
299 static struct pxa27x_keypad_platform_data zylonite_keypad_info
= {
300 .matrix_key_rows
= 8,
301 .matrix_key_cols
= 8,
302 .matrix_key_map
= zylonite_matrix_key_map
,
303 .matrix_key_map_size
= ARRAY_SIZE(zylonite_matrix_key_map
),
306 .rotary0_up_key
= KEY_UP
,
307 .rotary0_down_key
= KEY_DOWN
,
309 .debounce_interval
= 30,
312 static void __init
zylonite_init_keypad(void)
314 pxa_set_keypad_info(&zylonite_keypad_info
);
317 static inline void zylonite_init_keypad(void) {}
320 static void __init
zylonite_init(void)
322 /* board-processor specific initialization */
323 zylonite_pxa300_init();
324 zylonite_pxa320_init();
327 * Note: We depend that the bootloader set
328 * the correct value to MSC register for SMC91x.
330 smc91x_resources
[1].start
= gpio_to_irq(gpio_eth_irq
);
331 smc91x_resources
[1].end
= gpio_to_irq(gpio_eth_irq
);
332 platform_device_register(&smc91x_device
);
336 zylonite_init_keypad();
339 MACHINE_START(ZYLONITE
, "PXA3xx Platform Development Kit (aka Zylonite)")
340 .phys_io
= 0x40000000,
341 .boot_params
= 0xa0000100,
342 .io_pg_offst
= (io_p2v(0x40000000) >> 18) & 0xfffc,
343 .map_io
= pxa_map_io
,
344 .init_irq
= pxa3xx_init_irq
,
346 .init_machine
= zylonite_init
,