Merge git://git.infradead.org/mtd-2.6
[pandora-kernel.git] / arch / arm / mach-pxa / colibri-pxa270-evalboard.c
1 /*
2  *  linux/arch/arm/mach-pxa/colibri-pxa270-evalboard.c
3  *
4  *  Support for Toradex PXA270 based Colibri Evaluation Carrier Board
5  *  Daniel Mack <daniel@caiaq.de>
6  *  Marek Vasut <marek.vasut@gmail.com>
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License version 2 as
10  *  published by the Free Software Foundation.
11  */
12
13 #include <linux/init.h>
14 #include <linux/kernel.h>
15 #include <linux/platform_device.h>
16 #include <linux/sysdev.h>
17 #include <linux/interrupt.h>
18 #include <linux/gpio.h>
19 #include <asm/mach-types.h>
20 #include <mach/hardware.h>
21 #include <asm/mach/arch.h>
22
23 #include <mach/pxa27x.h>
24 #include <mach/colibri.h>
25 #include <mach/mmc.h>
26 #include <mach/ohci.h>
27 #include <mach/pxa27x-udc.h>
28
29 #include "generic.h"
30 #include "devices.h"
31
32 /******************************************************************************
33  * Pin configuration
34  ******************************************************************************/
35 static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {
36         /* MMC */
37         GPIO32_MMC_CLK,
38         GPIO92_MMC_DAT_0,
39         GPIO109_MMC_DAT_1,
40         GPIO110_MMC_DAT_2,
41         GPIO111_MMC_DAT_3,
42         GPIO112_MMC_CMD,
43         GPIO0_GPIO,     /* SD detect */
44
45         /* FFUART */
46         GPIO39_FFUART_TXD,
47         GPIO34_FFUART_RXD,
48
49         /* UHC */
50         GPIO88_USBH1_PWR,
51         GPIO89_USBH1_PEN,
52         GPIO119_USBH2_PWR,
53         GPIO120_USBH2_PEN,
54 };
55
56 /******************************************************************************
57  * SD/MMC card controller
58  ******************************************************************************/
59 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
60 static struct pxamci_platform_data colibri_pxa270_mci_platform_data = {
61         .ocr_mask               = MMC_VDD_32_33 | MMC_VDD_33_34,
62         .gpio_power             = -1,
63         .gpio_card_detect       = GPIO0_COLIBRI_PXA270_SD_DETECT,
64         .gpio_card_ro           = -1,
65         .detect_delay_ms        = 200,
66 };
67
68 static void __init colibri_pxa270_mmc_init(void)
69 {
70         pxa_set_mci_info(&colibri_pxa270_mci_platform_data);
71 }
72 #else
73 static inline void colibri_pxa270_mmc_init(void) {}
74 #endif
75
76 /******************************************************************************
77  * USB Host
78  ******************************************************************************/
79 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
80 static int colibri_pxa270_ohci_init(struct device *dev)
81 {
82         UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
83         return 0;
84 }
85
86 static struct pxaohci_platform_data colibri_pxa270_ohci_info = {
87         .port_mode      = PMM_PERPORT_MODE,
88         .flags          = ENABLE_PORT1 | ENABLE_PORT2 |
89                           POWER_CONTROL_LOW | POWER_SENSE_LOW,
90         .init           = colibri_pxa270_ohci_init,
91 };
92
93 static void __init colibri_pxa270_uhc_init(void)
94 {
95         pxa_set_ohci_info(&colibri_pxa270_ohci_info);
96 }
97 #else
98 static inline void colibri_pxa270_uhc_init(void) {}
99 #endif
100
101 void __init colibri_pxa270_evalboard_init(void)
102 {
103         pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_evalboard_pin_config));
104         pxa_set_ffuart_info(NULL);
105         pxa_set_btuart_info(NULL);
106         pxa_set_stuart_info(NULL);
107
108         colibri_pxa270_mmc_init();
109         colibri_pxa270_uhc_init();
110 }
111