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>
33 struct platform_mmc_slot zylonite_mmc_slot
[MAX_SLOTS
];
41 static struct resource smc91x_resources
[] = {
43 .start
= ZYLONITE_ETH_PHYS
+ 0x300,
44 .end
= ZYLONITE_ETH_PHYS
+ 0xfffff,
45 .flags
= IORESOURCE_MEM
,
48 .start
= -1, /* for run-time assignment */
50 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE
,
54 static struct platform_device smc91x_device
= {
57 .num_resources
= ARRAY_SIZE(smc91x_resources
),
58 .resource
= smc91x_resources
,
61 #if defined(CONFIG_FB_PXA) || (CONFIG_FB_PXA_MODULES)
62 static void zylonite_backlight_power(int on
)
64 gpio_set_value(gpio_backlight
, on
);
67 static struct pxafb_mode_info toshiba_ltm035a776c_mode
= {
78 .sync
= FB_SYNC_VERT_HIGH_ACT
,
81 static struct pxafb_mode_info toshiba_ltm04c380k_mode
= {
92 .sync
= FB_SYNC_HOR_HIGH_ACT
|FB_SYNC_VERT_HIGH_ACT
,
95 static struct pxafb_mach_info zylonite_toshiba_lcd_info
= {
99 .pxafb_backlight_power
= zylonite_backlight_power
,
102 static struct pxafb_mode_info sharp_ls037_modes
[] = {
131 static struct pxafb_mach_info zylonite_sharp_lcd_info
= {
132 .modes
= sharp_ls037_modes
,
135 .lccr3
= LCCR3_PCP
| LCCR3_HSP
| LCCR3_VSP
,
136 .pxafb_backlight_power
= zylonite_backlight_power
,
139 static void __init
zylonite_init_lcd(void)
141 /* backlight GPIO: output, default on */
142 gpio_direction_output(gpio_backlight
, 1);
145 set_pxa_fb_info(&zylonite_sharp_lcd_info
);
149 /* legacy LCD panels, it would be handy here if LCD panel type can
150 * be decided at run-time
153 zylonite_toshiba_lcd_info
.modes
= &toshiba_ltm035a776c_mode
;
155 zylonite_toshiba_lcd_info
.modes
= &toshiba_ltm04c380k_mode
;
157 set_pxa_fb_info(&zylonite_toshiba_lcd_info
);
160 static inline void zylonite_init_lcd(void) {}
163 #if defined(CONFIG_MMC)
164 static int zylonite_mci_ro(struct device
*dev
)
166 struct platform_device
*pdev
= to_platform_device(dev
);
168 return gpio_get_value(zylonite_mmc_slot
[pdev
->id
].gpio_wp
);
171 static int zylonite_mci_init(struct device
*dev
,
172 irq_handler_t zylonite_detect_int
,
175 struct platform_device
*pdev
= to_platform_device(dev
);
176 int err
, cd_irq
, gpio_cd
, gpio_wp
;
178 cd_irq
= gpio_to_irq(zylonite_mmc_slot
[pdev
->id
].gpio_cd
);
179 gpio_cd
= zylonite_mmc_slot
[pdev
->id
].gpio_cd
;
180 gpio_wp
= zylonite_mmc_slot
[pdev
->id
].gpio_wp
;
183 * setup GPIO for Zylonite MMC controller
185 err
= gpio_request(gpio_cd
, "mmc card detect");
188 gpio_direction_input(gpio_cd
);
190 err
= gpio_request(gpio_wp
, "mmc write protect");
193 gpio_direction_input(gpio_wp
);
195 err
= request_irq(cd_irq
, zylonite_detect_int
,
196 IRQF_TRIGGER_RISING
| IRQF_TRIGGER_FALLING
,
197 "MMC card detect", data
);
199 printk(KERN_ERR
"%s: MMC/SD/SDIO: "
200 "can't request card detect IRQ\n", __func__
);
201 goto err_request_irq
;
214 static void zylonite_mci_exit(struct device
*dev
, void *data
)
216 struct platform_device
*pdev
= to_platform_device(dev
);
217 int cd_irq
, gpio_cd
, gpio_wp
;
219 cd_irq
= gpio_to_irq(zylonite_mmc_slot
[pdev
->id
].gpio_cd
);
220 gpio_cd
= zylonite_mmc_slot
[pdev
->id
].gpio_cd
;
221 gpio_wp
= zylonite_mmc_slot
[pdev
->id
].gpio_wp
;
223 free_irq(cd_irq
, data
);
228 static struct pxamci_platform_data zylonite_mci_platform_data
= {
230 .ocr_mask
= MMC_VDD_32_33
|MMC_VDD_33_34
,
231 .init
= zylonite_mci_init
,
232 .exit
= zylonite_mci_exit
,
233 .get_ro
= zylonite_mci_ro
,
236 static struct pxamci_platform_data zylonite_mci2_platform_data
= {
238 .ocr_mask
= MMC_VDD_32_33
|MMC_VDD_33_34
,
241 static void __init
zylonite_init_mmc(void)
243 pxa_set_mci_info(&zylonite_mci_platform_data
);
244 pxa3xx_set_mci2_info(&zylonite_mci2_platform_data
);
246 pxa3xx_set_mci3_info(&zylonite_mci_platform_data
);
249 static inline void zylonite_init_mmc(void) {}
252 static void __init
zylonite_init(void)
254 /* board-processor specific initialization */
255 zylonite_pxa300_init();
256 zylonite_pxa320_init();
259 * Note: We depend that the bootloader set
260 * the correct value to MSC register for SMC91x.
262 smc91x_resources
[1].start
= gpio_to_irq(gpio_eth_irq
);
263 smc91x_resources
[1].end
= gpio_to_irq(gpio_eth_irq
);
264 platform_device_register(&smc91x_device
);
270 MACHINE_START(ZYLONITE
, "PXA3xx Platform Development Kit (aka Zylonite)")
271 .phys_io
= 0x40000000,
272 .boot_params
= 0xa0000100,
273 .io_pg_offst
= (io_p2v(0x40000000) >> 18) & 0xfffc,
274 .map_io
= pxa_map_io
,
275 .init_irq
= pxa3xx_init_irq
,
277 .init_machine
= zylonite_init
,