]> git.ipfire.org Git - thirdparty/kernel/stable.git/blob - arch/arm/mach-pxa/colibri-evalboard.c
2ccdef5de138770e70ebcdf156c68486d603a29f
[thirdparty/kernel/stable.git] / arch / arm / mach-pxa / colibri-evalboard.c
1 /*
2 * linux/arch/arm/mach-pxa/colibri-evalboard.c
3 *
4 * Support for Toradex 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/interrupt.h>
17 #include <linux/gpio/machine.h>
18 #include <asm/mach-types.h>
19 #include <mach/hardware.h>
20 #include <asm/mach/arch.h>
21 #include <linux/i2c.h>
22 #include <linux/platform_data/i2c-pxa.h>
23 #include <asm/io.h>
24
25 #include "pxa27x.h"
26 #include "colibri.h"
27 #include <linux/platform_data/mmc-pxamci.h>
28 #include <linux/platform_data/usb-ohci-pxa27x.h>
29 #include "pxa27x-udc.h"
30
31 #include "generic.h"
32 #include "devices.h"
33
34 /******************************************************************************
35 * SD/MMC card controller
36 ******************************************************************************/
37 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
38 static struct pxamci_platform_data colibri_mci_platform_data = {
39 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
40 .detect_delay_ms = 200,
41 };
42
43 static struct gpiod_lookup_table colibri_pxa270_mci_gpio_table = {
44 .dev_id = "pxa2xx-mci.0",
45 .table = {
46 GPIO_LOOKUP("gpio-pxa", GPIO0_COLIBRI_PXA270_SD_DETECT,
47 "cd", GPIO_ACTIVE_LOW),
48 { },
49 },
50 };
51
52 static struct gpiod_lookup_table colibri_pxa300_mci_gpio_table = {
53 .dev_id = "pxa2xx-mci.0",
54 .table = {
55 GPIO_LOOKUP("gpio-pxa", GPIO13_COLIBRI_PXA300_SD_DETECT,
56 "cd", GPIO_ACTIVE_LOW),
57 { },
58 },
59 };
60
61 static struct gpiod_lookup_table colibri_pxa320_mci_gpio_table = {
62 .dev_id = "pxa2xx-mci.0",
63 .table = {
64 GPIO_LOOKUP("gpio-pxa", GPIO28_COLIBRI_PXA320_SD_DETECT,
65 "cd", GPIO_ACTIVE_LOW),
66 { },
67 },
68 };
69
70 static void __init colibri_mmc_init(void)
71 {
72 if (machine_is_colibri()) /* PXA270 Colibri */
73 gpiod_add_lookup_table(&colibri_pxa270_mci_gpio_table);
74 if (machine_is_colibri300()) /* PXA300 Colibri */
75 gpiod_add_lookup_table(&colibri_pxa300_mci_gpio_table);
76 else /* PXA320 Colibri */
77 gpiod_add_lookup_table(&colibri_pxa320_mci_gpio_table);
78
79 pxa_set_mci_info(&colibri_mci_platform_data);
80 }
81 #else
82 static inline void colibri_mmc_init(void) {}
83 #endif
84
85 /******************************************************************************
86 * USB Host
87 ******************************************************************************/
88 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
89 static int colibri_ohci_init(struct device *dev)
90 {
91 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
92 return 0;
93 }
94
95 static struct pxaohci_platform_data colibri_ohci_info = {
96 .port_mode = PMM_PERPORT_MODE,
97 .flags = ENABLE_PORT1 |
98 POWER_CONTROL_LOW | POWER_SENSE_LOW,
99 .init = colibri_ohci_init,
100 };
101
102 static void __init colibri_uhc_init(void)
103 {
104 /* Colibri PXA270 has two usb ports, TBA for 320 */
105 if (machine_is_colibri())
106 colibri_ohci_info.flags |= ENABLE_PORT2;
107
108 pxa_set_ohci_info(&colibri_ohci_info);
109 }
110 #else
111 static inline void colibri_uhc_init(void) {}
112 #endif
113
114 /******************************************************************************
115 * I2C RTC
116 ******************************************************************************/
117 #if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
118 static struct i2c_board_info __initdata colibri_i2c_devs[] = {
119 {
120 I2C_BOARD_INFO("m41t00", 0x68),
121 },
122 };
123
124 static void __init colibri_rtc_init(void)
125 {
126 pxa_set_i2c_info(NULL);
127 i2c_register_board_info(0, ARRAY_AND_SIZE(colibri_i2c_devs));
128 }
129 #else
130 static inline void colibri_rtc_init(void) {}
131 #endif
132
133 void __init colibri_evalboard_init(void)
134 {
135 pxa_set_ffuart_info(NULL);
136 pxa_set_btuart_info(NULL);
137 pxa_set_stuart_info(NULL);
138
139 colibri_mmc_init();
140 colibri_uhc_init();
141 colibri_rtc_init();
142 }