Merge branch 'xen/dev-evtchn' into upstream/evtchn
[deliverable/linux.git] / arch / arm / mach-imx / mach-mx27_3ds.c
1 /*
2 * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * Author: Fabio Estevam <fabio.estevam@freescale.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17 /*
18 * This machine is known as:
19 * - i.MX27 3-Stack Development System
20 * - i.MX27 Platform Development Kit (i.MX27 PDK)
21 */
22
23 #include <linux/platform_device.h>
24 #include <linux/gpio.h>
25 #include <linux/input/matrix_keypad.h>
26 #include <linux/irq.h>
27 #include <asm/mach-types.h>
28 #include <asm/mach/arch.h>
29 #include <asm/mach/time.h>
30 #include <mach/hardware.h>
31 #include <mach/common.h>
32 #include <mach/iomux-mx27.h>
33 #include <mach/mmc.h>
34
35 #include "devices-imx27.h"
36 #include "devices.h"
37
38 #define SD1_EN_GPIO (GPIO_PORTB + 25)
39
40 static const int mx27pdk_pins[] __initconst = {
41 /* UART1 */
42 PE12_PF_UART1_TXD,
43 PE13_PF_UART1_RXD,
44 PE14_PF_UART1_CTS,
45 PE15_PF_UART1_RTS,
46 /* FEC */
47 PD0_AIN_FEC_TXD0,
48 PD1_AIN_FEC_TXD1,
49 PD2_AIN_FEC_TXD2,
50 PD3_AIN_FEC_TXD3,
51 PD4_AOUT_FEC_RX_ER,
52 PD5_AOUT_FEC_RXD1,
53 PD6_AOUT_FEC_RXD2,
54 PD7_AOUT_FEC_RXD3,
55 PD8_AF_FEC_MDIO,
56 PD9_AIN_FEC_MDC,
57 PD10_AOUT_FEC_CRS,
58 PD11_AOUT_FEC_TX_CLK,
59 PD12_AOUT_FEC_RXD0,
60 PD13_AOUT_FEC_RX_DV,
61 PD14_AOUT_FEC_RX_CLK,
62 PD15_AOUT_FEC_COL,
63 PD16_AIN_FEC_TX_ER,
64 PF23_AIN_FEC_TX_EN,
65 /* SDHC1 */
66 PE18_PF_SD1_D0,
67 PE19_PF_SD1_D1,
68 PE20_PF_SD1_D2,
69 PE21_PF_SD1_D3,
70 PE22_PF_SD1_CMD,
71 PE23_PF_SD1_CLK,
72 SD1_EN_GPIO | GPIO_GPIO | GPIO_OUT,
73 };
74
75 static const struct imxuart_platform_data uart_pdata __initconst = {
76 .flags = IMXUART_HAVE_RTSCTS,
77 };
78
79 /*
80 * Matrix keyboard
81 */
82
83 static const uint32_t mx27_3ds_keymap[] = {
84 KEY(0, 0, KEY_UP),
85 KEY(0, 1, KEY_DOWN),
86 KEY(1, 0, KEY_RIGHT),
87 KEY(1, 1, KEY_LEFT),
88 KEY(1, 2, KEY_ENTER),
89 KEY(2, 0, KEY_F6),
90 KEY(2, 1, KEY_F8),
91 KEY(2, 2, KEY_F9),
92 KEY(2, 3, KEY_F10),
93 };
94
95 static struct matrix_keymap_data mx27_3ds_keymap_data = {
96 .keymap = mx27_3ds_keymap,
97 .keymap_size = ARRAY_SIZE(mx27_3ds_keymap),
98 };
99
100 static int mx27_3ds_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
101 void *data)
102 {
103 return request_irq(IRQ_GPIOB(26), detect_irq, IRQF_TRIGGER_FALLING |
104 IRQF_TRIGGER_RISING, "sdhc1-card-detect", data);
105 }
106
107 static void mx27_3ds_sdhc1_exit(struct device *dev, void *data)
108 {
109 free_irq(IRQ_GPIOB(26), data);
110 }
111
112 static struct imxmmc_platform_data sdhc1_pdata = {
113 .init = mx27_3ds_sdhc1_init,
114 .exit = mx27_3ds_sdhc1_exit,
115 };
116
117 static void mx27_3ds_sdhc1_enable_level_translator(void)
118 {
119 /* Turn on TXB0108 OE pin */
120 gpio_request(SD1_EN_GPIO, "sd1_enable");
121 gpio_direction_output(SD1_EN_GPIO, 1);
122 }
123
124 static void __init mx27pdk_init(void)
125 {
126 mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins),
127 "mx27pdk");
128 mx27_3ds_sdhc1_enable_level_translator();
129 imx27_add_imx_uart0(&uart_pdata);
130 imx27_add_fec(NULL);
131 mxc_register_device(&imx_kpp_device, &mx27_3ds_keymap_data);
132 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata);
133 }
134
135 static void __init mx27pdk_timer_init(void)
136 {
137 mx27_clocks_init(26000000);
138 }
139
140 static struct sys_timer mx27pdk_timer = {
141 .init = mx27pdk_timer_init,
142 };
143
144 MACHINE_START(MX27_3DS, "Freescale MX27PDK")
145 /* maintainer: Freescale Semiconductor, Inc. */
146 .boot_params = MX27_PHYS_OFFSET + 0x100,
147 .map_io = mx27_map_io,
148 .init_irq = mx27_init_irq,
149 .init_machine = mx27pdk_init,
150 .timer = &mx27pdk_timer,
151 MACHINE_END
This page took 0.041287 seconds and 6 git commands to generate.