aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/mach-mx27_3ds.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-imx/mach-mx27_3ds.c')
-rw-r--r--arch/arm/mach-imx/mach-mx27_3ds.c160
1 files changed, 153 insertions, 7 deletions
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c
index 84a5ba03f1ba..6fd0f8f6deb6 100644
--- a/arch/arm/mach-imx/mach-mx27_3ds.c
+++ b/arch/arm/mach-imx/mach-mx27_3ds.c
@@ -22,20 +22,27 @@
22 22
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/gpio.h> 24#include <linux/gpio.h>
25#include <linux/input/matrix_keypad.h>
26#include <linux/irq.h> 25#include <linux/irq.h>
26#include <linux/usb/otg.h>
27#include <linux/usb/ulpi.h>
28#include <linux/delay.h>
29#include <linux/mfd/mc13783.h>
30#include <linux/spi/spi.h>
31#include <linux/regulator/machine.h>
32
27#include <asm/mach-types.h> 33#include <asm/mach-types.h>
28#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
29#include <asm/mach/time.h> 35#include <asm/mach/time.h>
30#include <mach/hardware.h> 36#include <mach/hardware.h>
31#include <mach/common.h> 37#include <mach/common.h>
32#include <mach/iomux-mx27.h> 38#include <mach/iomux-mx27.h>
33#include <mach/mmc.h> 39#include <mach/ulpi.h>
34 40
35#include "devices-imx27.h" 41#include "devices-imx27.h"
36#include "devices.h"
37 42
38#define SD1_EN_GPIO (GPIO_PORTB + 25) 43#define SD1_EN_GPIO (GPIO_PORTB + 25)
44#define OTG_PHY_RESET_GPIO (GPIO_PORTB + 23)
45#define SPI2_SS0 (GPIO_PORTD + 21)
39 46
40static const int mx27pdk_pins[] __initconst = { 47static const int mx27pdk_pins[] __initconst = {
41 /* UART1 */ 48 /* UART1 */
@@ -70,6 +77,24 @@ static const int mx27pdk_pins[] __initconst = {
70 PE22_PF_SD1_CMD, 77 PE22_PF_SD1_CMD,
71 PE23_PF_SD1_CLK, 78 PE23_PF_SD1_CLK,
72 SD1_EN_GPIO | GPIO_GPIO | GPIO_OUT, 79 SD1_EN_GPIO | GPIO_GPIO | GPIO_OUT,
80 /* OTG */
81 OTG_PHY_RESET_GPIO | GPIO_GPIO | GPIO_OUT,
82 PC7_PF_USBOTG_DATA5,
83 PC8_PF_USBOTG_DATA6,
84 PC9_PF_USBOTG_DATA0,
85 PC10_PF_USBOTG_DATA2,
86 PC11_PF_USBOTG_DATA1,
87 PC12_PF_USBOTG_DATA4,
88 PC13_PF_USBOTG_DATA3,
89 PE0_PF_USBOTG_NXT,
90 PE1_PF_USBOTG_STP,
91 PE2_PF_USBOTG_DIR,
92 PE24_PF_USBOTG_CLK,
93 PE25_PF_USBOTG_DATA7,
94 /* CSPI2 */
95 PD22_PF_CSPI2_SCLK,
96 PD23_PF_CSPI2_MISO,
97 PD24_PF_CSPI2_MOSI,
73}; 98};
74 99
75static const struct imxuart_platform_data uart_pdata __initconst = { 100static const struct imxuart_platform_data uart_pdata __initconst = {
@@ -92,7 +117,7 @@ static const uint32_t mx27_3ds_keymap[] = {
92 KEY(2, 3, KEY_F10), 117 KEY(2, 3, KEY_F10),
93}; 118};
94 119
95static struct matrix_keymap_data mx27_3ds_keymap_data = { 120static const struct matrix_keymap_data mx27_3ds_keymap_data __initconst = {
96 .keymap = mx27_3ds_keymap, 121 .keymap = mx27_3ds_keymap,
97 .keymap_size = ARRAY_SIZE(mx27_3ds_keymap), 122 .keymap_size = ARRAY_SIZE(mx27_3ds_keymap),
98}; 123};
@@ -109,7 +134,7 @@ static void mx27_3ds_sdhc1_exit(struct device *dev, void *data)
109 free_irq(IRQ_GPIOB(26), data); 134 free_irq(IRQ_GPIOB(26), data);
110} 135}
111 136
112static struct imxmmc_platform_data sdhc1_pdata = { 137static const struct imxmmc_platform_data sdhc1_pdata __initconst = {
113 .init = mx27_3ds_sdhc1_init, 138 .init = mx27_3ds_sdhc1_init,
114 .exit = mx27_3ds_sdhc1_exit, 139 .exit = mx27_3ds_sdhc1_exit,
115}; 140};
@@ -121,6 +146,111 @@ static void mx27_3ds_sdhc1_enable_level_translator(void)
121 gpio_direction_output(SD1_EN_GPIO, 1); 146 gpio_direction_output(SD1_EN_GPIO, 1);
122} 147}
123 148
149
150static int otg_phy_init(void)
151{
152 gpio_request(OTG_PHY_RESET_GPIO, "usb-otg-reset");
153 gpio_direction_output(OTG_PHY_RESET_GPIO, 0);
154 mdelay(1);
155 gpio_set_value(OTG_PHY_RESET_GPIO, 1);
156 return 0;
157}
158
159#if defined(CONFIG_USB_ULPI)
160
161static struct mxc_usbh_platform_data otg_pdata __initdata = {
162 .portsc = MXC_EHCI_MODE_ULPI,
163 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
164};
165#endif
166
167static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
168 .operating_mode = FSL_USB2_DR_DEVICE,
169 .phy_mode = FSL_USB2_PHY_ULPI,
170};
171
172static int otg_mode_host;
173
174static int __init mx27_3ds_otg_mode(char *options)
175{
176 if (!strcmp(options, "host"))
177 otg_mode_host = 1;
178 else if (!strcmp(options, "device"))
179 otg_mode_host = 0;
180 else
181 pr_info("otg_mode neither \"host\" nor \"device\". "
182 "Defaulting to device\n");
183 return 0;
184}
185__setup("otg_mode=", mx27_3ds_otg_mode);
186
187/* Regulators */
188static struct regulator_consumer_supply vmmc1_consumers[] = {
189 REGULATOR_SUPPLY("lcd_2v8", NULL),
190};
191
192static struct regulator_init_data vmmc1_init = {
193 .constraints = {
194 .min_uV = 2800000,
195 .max_uV = 2800000,
196 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
197 },
198 .num_consumer_supplies = ARRAY_SIZE(vmmc1_consumers),
199 .consumer_supplies = vmmc1_consumers,
200};
201
202static struct regulator_consumer_supply vgen_consumers[] = {
203 REGULATOR_SUPPLY("vdd_lcdio", NULL),
204};
205
206static struct regulator_init_data vgen_init = {
207 .constraints = {
208 .min_uV = 1800000,
209 .max_uV = 1800000,
210 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
211 },
212 .num_consumer_supplies = ARRAY_SIZE(vgen_consumers),
213 .consumer_supplies = vgen_consumers,
214};
215
216static struct mc13783_regulator_init_data mx27_3ds_regulators[] = {
217 {
218 .id = MC13783_REGU_VMMC1,
219 .init_data = &vmmc1_init,
220 }, {
221 .id = MC13783_REGU_VGEN,
222 .init_data = &vgen_init,
223 },
224};
225
226/* MC13783 */
227static struct mc13783_platform_data mc13783_pdata __initdata = {
228 .regulators = mx27_3ds_regulators,
229 .num_regulators = ARRAY_SIZE(mx27_3ds_regulators),
230 .flags = MC13783_USE_REGULATOR,
231};
232
233/* SPI */
234static int spi2_internal_chipselect[] = {SPI2_SS0};
235
236static const struct spi_imx_master spi2_pdata __initconst = {
237 .chipselect = spi2_internal_chipselect,
238 .num_chipselect = ARRAY_SIZE(spi2_internal_chipselect),
239};
240
241static struct spi_board_info mx27_3ds_spi_devs[] __initdata = {
242 {
243 .modalias = "mc13783",
244 .max_speed_hz = 1000000,
245 .bus_num = 1,
246 .chip_select = 0, /* SS0 */
247 .platform_data = &mc13783_pdata,
248 .irq = IRQ_GPIOC(14),
249 .mode = SPI_CS_HIGH,
250 },
251};
252
253
124static void __init mx27pdk_init(void) 254static void __init mx27pdk_init(void)
125{ 255{
126 mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins), 256 mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins),
@@ -128,8 +258,24 @@ static void __init mx27pdk_init(void)
128 mx27_3ds_sdhc1_enable_level_translator(); 258 mx27_3ds_sdhc1_enable_level_translator();
129 imx27_add_imx_uart0(&uart_pdata); 259 imx27_add_imx_uart0(&uart_pdata);
130 imx27_add_fec(NULL); 260 imx27_add_fec(NULL);
131 mxc_register_device(&imx_kpp_device, &mx27_3ds_keymap_data); 261 imx27_add_imx_keypad(&mx27_3ds_keymap_data);
132 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata); 262 imx27_add_mxc_mmc(0, &sdhc1_pdata);
263 imx27_add_imx2_wdt(NULL);
264 otg_phy_init();
265#if defined(CONFIG_USB_ULPI)
266 if (otg_mode_host) {
267 otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
268 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
269
270 imx27_add_mxc_ehci_otg(&otg_pdata);
271 }
272#endif
273 if (!otg_mode_host)
274 imx27_add_fsl_usb2_udc(&otg_device_pdata);
275
276 imx27_add_spi_imx1(&spi2_pdata);
277 spi_register_board_info(mx27_3ds_spi_devs,
278 ARRAY_SIZE(mx27_3ds_spi_devs));
133} 279}
134 280
135static void __init mx27pdk_timer_init(void) 281static void __init mx27pdk_timer_init(void)