2 * Hardware definitions for Voipac PXA270
5 * Marek Vasut <marek.vasut@gmail.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
13 #include <linux/platform_device.h>
14 #include <linux/delay.h>
15 #include <linux/irq.h>
16 #include <linux/gpio_keys.h>
17 #include <linux/input.h>
18 #include <linux/gpio.h>
19 #include <linux/sysdev.h>
20 #include <linux/usb/gpio_vbus.h>
21 #include <linux/mtd/mtd.h>
22 #include <linux/mtd/partitions.h>
23 #include <linux/mtd/physmap.h>
24 #include <linux/dm9000.h>
25 #include <linux/ucb1400.h>
27 #include <asm/mach-types.h>
28 #include <asm/mach/arch.h>
30 #include <mach/pxa27x.h>
31 #include <mach/audio.h>
32 #include <mach/vpac270.h>
34 #include <mach/pxafb.h>
35 #include <mach/ohci.h>
36 #include <mach/pxa27x-udc.h>
42 /******************************************************************************
44 ******************************************************************************/
45 static unsigned long vpac270_pin_config
[] __initdata
= {
53 GPIO53_GPIO
, /* SD detect */
54 GPIO52_GPIO
, /* SD r/o switch */
57 GPIO1_GPIO
, /* USER BTN */
60 GPIO15_GPIO
, /* orange led */
107 GPIO84_GPIO
, /* PCMCIA CD */
108 GPIO35_GPIO
, /* PCMCIA RDY */
109 GPIO107_GPIO
, /* PCMCIA PPEN */
110 GPIO11_GPIO
, /* PCMCIA RESET */
111 GPIO17_GPIO
, /* CF CD */
112 GPIO12_GPIO
, /* CF RDY */
113 GPIO16_GPIO
, /* CF RESET */
125 GPIO114_GPIO
, /* IRQ */
129 GPIO29_AC97_SDATA_IN_0
,
130 GPIO30_AC97_SDATA_OUT
,
134 GPIO113_GPIO
, /* TS IRQ */
137 /******************************************************************************
139 ******************************************************************************/
140 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
141 static struct mtd_partition vpac270_partitions
[] = {
144 .offset
= 0x00000000,
145 .size
= MTDPART_SIZ_FULL
,
149 static struct physmap_flash_data vpac270_flash_data
[] = {
151 .width
= 2, /* bankwidth in bytes */
152 .parts
= vpac270_partitions
,
153 .nr_parts
= ARRAY_SIZE(vpac270_partitions
)
157 static struct resource vpac270_flash_resource
= {
158 .start
= PXA_CS0_PHYS
,
159 .end
= PXA_CS0_PHYS
+ SZ_64M
- 1,
160 .flags
= IORESOURCE_MEM
,
163 static struct platform_device vpac270_flash
= {
164 .name
= "physmap-flash",
166 .resource
= &vpac270_flash_resource
,
169 .platform_data
= vpac270_flash_data
,
172 static void __init
vpac270_nor_init(void)
174 platform_device_register(&vpac270_flash
);
177 static inline void vpac270_nor_init(void) {}
180 /******************************************************************************
181 * SD/MMC card controller
182 ******************************************************************************/
183 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
184 static struct pxamci_platform_data vpac270_mci_platform_data
= {
185 .ocr_mask
= MMC_VDD_32_33
| MMC_VDD_33_34
,
186 .gpio_card_detect
= GPIO53_VPAC270_SD_DETECT_N
,
187 .gpio_card_ro
= GPIO52_VPAC270_SD_READONLY
,
191 static void __init
vpac270_mmc_init(void)
193 pxa_set_mci_info(&vpac270_mci_platform_data
);
196 static inline void vpac270_mmc_init(void) {}
199 /******************************************************************************
201 ******************************************************************************/
202 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
203 static struct gpio_keys_button vpac270_pxa_buttons
[] = {
204 {KEY_POWER
, GPIO1_VPAC270_USER_BTN
, 0, "USER BTN"},
207 static struct gpio_keys_platform_data vpac270_pxa_keys_data
= {
208 .buttons
= vpac270_pxa_buttons
,
209 .nbuttons
= ARRAY_SIZE(vpac270_pxa_buttons
),
212 static struct platform_device vpac270_pxa_keys
= {
216 .platform_data
= &vpac270_pxa_keys_data
,
220 static void __init
vpac270_keys_init(void)
222 platform_device_register(&vpac270_pxa_keys
);
225 static inline void vpac270_keys_init(void) {}
228 /******************************************************************************
230 ******************************************************************************/
231 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
232 struct gpio_led vpac270_gpio_leds
[] = {
234 .name
= "vpac270:orange:user",
235 .default_trigger
= "none",
236 .gpio
= GPIO15_VPAC270_LED_ORANGE
,
241 static struct gpio_led_platform_data vpac270_gpio_led_info
= {
242 .leds
= vpac270_gpio_leds
,
243 .num_leds
= ARRAY_SIZE(vpac270_gpio_leds
),
246 static struct platform_device vpac270_leds
= {
250 .platform_data
= &vpac270_gpio_led_info
,
254 static void __init
vpac270_leds_init(void)
256 platform_device_register(&vpac270_leds
);
259 static inline void vpac270_leds_init(void) {}
262 /******************************************************************************
264 ******************************************************************************/
265 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
266 static int vpac270_ohci_init(struct device
*dev
)
268 UP2OCR
= UP2OCR_HXS
| UP2OCR_HXOE
| UP2OCR_DPPDE
| UP2OCR_DMPDE
;
272 static struct pxaohci_platform_data vpac270_ohci_info
= {
273 .port_mode
= PMM_PERPORT_MODE
,
274 .flags
= ENABLE_PORT1
| ENABLE_PORT2
|
275 POWER_CONTROL_LOW
| POWER_SENSE_LOW
,
276 .init
= vpac270_ohci_init
,
279 static void __init
vpac270_uhc_init(void)
281 pxa_set_ohci_info(&vpac270_ohci_info
);
284 static inline void vpac270_uhc_init(void) {}
287 /******************************************************************************
289 ******************************************************************************/
290 #if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODULE)
291 static struct gpio_vbus_mach_info vpac270_gpio_vbus_info
= {
292 .gpio_vbus
= GPIO41_VPAC270_UDC_DETECT
,
296 static struct platform_device vpac270_gpio_vbus
= {
300 .platform_data
= &vpac270_gpio_vbus_info
,
304 static void vpac270_udc_command(int cmd
)
306 if (cmd
== PXA2XX_UDC_CMD_CONNECT
)
307 UP2OCR
|= UP2OCR_HXOE
| UP2OCR_DPPUE
| UP2OCR_DPPUBE
;
308 else if (cmd
== PXA2XX_UDC_CMD_DISCONNECT
)
309 UP2OCR
&= ~(UP2OCR_HXOE
| UP2OCR_DPPUE
| UP2OCR_DPPUBE
);
312 static struct pxa2xx_udc_mach_info vpac270_udc_info __initdata
= {
313 .udc_command
= vpac270_udc_command
,
317 static void __init
vpac270_udc_init(void)
319 pxa_set_udc_info(&vpac270_udc_info
);
320 platform_device_register(&vpac270_gpio_vbus
);
323 static inline void vpac270_udc_init(void) {}
326 /******************************************************************************
328 ******************************************************************************/
329 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
330 static struct resource vpac270_dm9000_resources
[] = {
332 .start
= PXA_CS2_PHYS
+ 0x300,
333 .end
= PXA_CS2_PHYS
+ 0x303,
334 .flags
= IORESOURCE_MEM
,
337 .start
= PXA_CS2_PHYS
+ 0x304,
338 .end
= PXA_CS2_PHYS
+ 0x343,
339 .flags
= IORESOURCE_MEM
,
342 .start
= IRQ_GPIO(GPIO114_VPAC270_ETH_IRQ
),
343 .end
= IRQ_GPIO(GPIO114_VPAC270_ETH_IRQ
),
344 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE
,
348 static struct dm9000_plat_data vpac270_dm9000_platdata
= {
349 .flags
= DM9000_PLATF_32BITONLY
,
352 static struct platform_device vpac270_dm9000_device
= {
355 .num_resources
= ARRAY_SIZE(vpac270_dm9000_resources
),
356 .resource
= vpac270_dm9000_resources
,
358 .platform_data
= &vpac270_dm9000_platdata
,
362 static void __init
vpac270_eth_init(void)
364 platform_device_register(&vpac270_dm9000_device
);
367 static inline void vpac270_eth_init(void) {}
370 /******************************************************************************
371 * Audio and Touchscreen
372 ******************************************************************************/
373 #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \
374 defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
375 static pxa2xx_audio_ops_t vpac270_ac97_pdata
= {
379 static struct ucb1400_pdata vpac270_ucb1400_pdata
= {
380 .irq
= IRQ_GPIO(113),
383 static struct platform_device vpac270_ucb1400_device
= {
384 .name
= "ucb1400_core",
387 .platform_data
= &vpac270_ucb1400_pdata
,
391 static void __init
vpac270_ts_init(void)
393 pxa_set_ac97_info(&vpac270_ac97_pdata
);
394 platform_device_register(&vpac270_ucb1400_device
);
397 static inline void vpac270_ts_init(void) {}
400 /******************************************************************************
402 ******************************************************************************/
403 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
404 static struct pxafb_mode_info vpac270_lcd_modes
[] = {
420 .sync
= FB_SYNC_HOR_HIGH_ACT
| FB_SYNC_VERT_HIGH_ACT
,
424 static struct pxafb_mach_info vpac270_lcd_screen
= {
425 .modes
= vpac270_lcd_modes
,
426 .num_modes
= ARRAY_SIZE(vpac270_lcd_modes
),
427 .lcd_conn
= LCD_COLOR_TFT_18BPP
,
430 static void vpac270_lcd_power(int on
, struct fb_var_screeninfo
*info
)
432 gpio_set_value(GPIO81_VPAC270_BKL_ON
, on
);
435 static void __init
vpac270_lcd_init(void)
439 ret
= gpio_request(GPIO81_VPAC270_BKL_ON
, "BKL-ON");
441 pr_err("Requesting BKL-ON GPIO failed!\n");
445 ret
= gpio_direction_output(GPIO81_VPAC270_BKL_ON
, 1);
447 pr_err("Setting BKL-ON GPIO direction failed!\n");
451 vpac270_lcd_screen
.pxafb_lcd_power
= vpac270_lcd_power
;
452 set_pxa_fb_info(&vpac270_lcd_screen
);
456 gpio_free(GPIO81_VPAC270_BKL_ON
);
461 static inline void vpac270_lcd_init(void) {}
464 /******************************************************************************
466 ******************************************************************************/
467 static void __init
vpac270_init(void)
469 pxa2xx_mfp_config(ARRAY_AND_SIZE(vpac270_pin_config
));
471 pxa_set_ffuart_info(NULL
);
472 pxa_set_btuart_info(NULL
);
473 pxa_set_stuart_info(NULL
);
486 MACHINE_START(VPAC270
, "Voipac PXA270")
487 .phys_io
= 0x40000000,
488 .io_pg_offst
= (io_p2v(0x40000000) >> 18) & 0xfffc,
489 .boot_params
= 0xa0000100,
490 .map_io
= pxa_map_io
,
491 .init_irq
= pxa27x_init_irq
,
493 .init_machine
= vpac270_init