Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mach-mx25_3ds.c
Go to the documentation of this file.
1 /*
2  * Copyright 2009 Sascha Hauer, <[email protected]>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  * Boston, MA 02110-1301, USA.
17  */
18 
19 /*
20  * This machine is known as:
21  * - i.MX25 3-Stack Development System
22  * - i.MX25 Platform Development Kit (i.MX25 PDK)
23  */
24 
25 #include <linux/types.h>
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/clk.h>
29 #include <linux/irq.h>
30 #include <linux/gpio.h>
31 #include <linux/platform_device.h>
32 #include <linux/usb/otg.h>
33 
34 #include <mach/hardware.h>
35 #include <asm/mach-types.h>
36 #include <asm/mach/arch.h>
37 #include <asm/mach/time.h>
38 #include <asm/memory.h>
39 #include <asm/mach/map.h>
40 #include <mach/common.h>
41 #include <mach/mx25.h>
42 #include <mach/iomux-mx25.h>
43 
44 #include "devices-imx25.h"
45 
46 #define MX25PDK_CAN_PWDN IMX_GPIO_NR(4, 6)
47 
48 static const struct imxuart_platform_data uart_pdata __initconst = {
49  .flags = IMXUART_HAVE_RTSCTS,
50 };
51 
52 static iomux_v3_cfg_t mx25pdk_pads[] = {
62  MX25_PAD_A17__GPIO_2_3, /* FEC_EN, GPIO 35 */
63  MX25_PAD_D12__GPIO_4_8, /* FEC_RESET_B, GPIO 104 */
64 
65  /* LCD */
89 
90  /* Keypad */
99 
100  /* SD1 */
107  MX25_PAD_A14__GPIO_2_0, /* WriteProtect */
108  MX25_PAD_A15__GPIO_2_1, /* CardDetect */
109 
110  /* I2C1 */
113 
114  /* CAN1 */
117  MX25_PAD_D14__GPIO_4_6, /* CAN_PWDN */
118 };
119 
120 static const struct fec_platform_data mx25_fec_pdata __initconst = {
122 };
123 
124 #define FEC_ENABLE_GPIO IMX_GPIO_NR(2, 3)
125 #define FEC_RESET_B_GPIO IMX_GPIO_NR(4, 8)
126 
127 static void __init mx25pdk_fec_reset(void)
128 {
129  gpio_request(FEC_ENABLE_GPIO, "FEC PHY enable");
130  gpio_request(FEC_RESET_B_GPIO, "FEC PHY reset");
131 
132  gpio_direction_output(FEC_ENABLE_GPIO, 0); /* drop PHY power */
133  gpio_direction_output(FEC_RESET_B_GPIO, 0); /* assert reset */
134  udelay(2);
135 
136  /* turn on PHY power and lift reset */
139 }
140 
141 static const struct mxc_nand_platform_data
142 mx25pdk_nand_board_info __initconst = {
143  .width = 1,
144  .hw_ecc = 1,
145  .flash_bbt = 1,
146 };
147 
148 static struct imx_fb_videomode mx25pdk_modes[] = {
149  {
150  .mode = {
151  .name = "CRT-VGA",
152  .refresh = 60,
153  .xres = 640,
154  .yres = 480,
155  .pixclock = 39683,
156  .left_margin = 45,
157  .right_margin = 114,
158  .upper_margin = 33,
159  .lower_margin = 11,
160  .hsync_len = 1,
161  .vsync_len = 1,
162  },
163  .bpp = 16,
164  .pcr = 0xFA208B80,
165  },
166 };
167 
168 static const struct imx_fb_platform_data mx25pdk_fb_pdata __initconst = {
169  .mode = mx25pdk_modes,
170  .num_modes = ARRAY_SIZE(mx25pdk_modes),
171  .pwmr = 0x00A903FF,
172  .lscr1 = 0x00120300,
173  .dmacr = 0x00020010,
174 };
175 
176 static const uint32_t mx25pdk_keymap[] = {
177  KEY(0, 0, KEY_UP),
178  KEY(0, 1, KEY_DOWN),
179  KEY(0, 2, KEY_VOLUMEDOWN),
180  KEY(0, 3, KEY_HOME),
181  KEY(1, 0, KEY_RIGHT),
182  KEY(1, 1, KEY_LEFT),
183  KEY(1, 2, KEY_ENTER),
184  KEY(1, 3, KEY_VOLUMEUP),
185  KEY(2, 0, KEY_F6),
186  KEY(2, 1, KEY_F8),
187  KEY(2, 2, KEY_F9),
188  KEY(2, 3, KEY_F10),
189  KEY(3, 0, KEY_F1),
190  KEY(3, 1, KEY_F2),
191  KEY(3, 2, KEY_F3),
192  KEY(3, 3, KEY_POWER),
193 };
194 
195 static const struct matrix_keymap_data mx25pdk_keymap_data __initconst = {
196  .keymap = mx25pdk_keymap,
197  .keymap_size = ARRAY_SIZE(mx25pdk_keymap),
198 };
199 
200 static int mx25pdk_usbh2_init(struct platform_device *pdev)
201 {
203 }
204 
205 static const struct mxc_usbh_platform_data usbh2_pdata __initconst = {
206  .init = mx25pdk_usbh2_init,
207  .portsc = MXC_EHCI_MODE_SERIAL,
208 };
209 
210 static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
211  .operating_mode = FSL_USB2_DR_DEVICE,
212  .phy_mode = FSL_USB2_PHY_UTMI,
213 };
214 
215 static const struct imxi2c_platform_data mx25_3ds_i2c0_data __initconst = {
216  .bitrate = 100000,
217 };
218 
219 #define SD1_GPIO_WP IMX_GPIO_NR(2, 0)
220 #define SD1_GPIO_CD IMX_GPIO_NR(2, 1)
221 
222 static const struct esdhc_platform_data mx25pdk_esdhc_pdata __initconst = {
223  .wp_gpio = SD1_GPIO_WP,
224  .cd_gpio = SD1_GPIO_CD,
225  .wp_type = ESDHC_WP_GPIO,
226  .cd_type = ESDHC_CD_GPIO,
227 };
228 
229 static void __init mx25pdk_init(void)
230 {
231  imx25_soc_init();
232 
234  ARRAY_SIZE(mx25pdk_pads));
235 
236  imx25_add_imx_uart0(&uart_pdata);
237  imx25_add_fsl_usb2_udc(&otg_device_pdata);
238  imx25_add_mxc_ehci_hs(&usbh2_pdata);
239  imx25_add_mxc_nand(&mx25pdk_nand_board_info);
241  imx25_add_imx_fb(&mx25pdk_fb_pdata);
243 
244  mx25pdk_fec_reset();
245  imx25_add_fec(&mx25_fec_pdata);
246  imx25_add_imx_keypad(&mx25pdk_keymap_data);
247 
248  imx25_add_sdhci_esdhc_imx(0, &mx25pdk_esdhc_pdata);
249  imx25_add_imx_i2c0(&mx25_3ds_i2c0_data);
250 
253 }
254 
255 static void __init mx25pdk_timer_init(void)
256 {
258 }
259 
260 static struct sys_timer mx25pdk_timer = {
261  .init = mx25pdk_timer_init,
262 };
263 
264 MACHINE_START(MX25_3DS, "Freescale MX25PDK (3DS)")
265  /* Maintainer: Freescale Semiconductor, Inc. */
266  .atag_offset = 0x100,
267  .map_io = mx25_map_io,
268  .init_early = imx25_init_early,
269  .init_irq = mx25_init_irq,
270  .handle_irq = imx25_handle_irq,
271  .timer = &mx25pdk_timer,
272  .init_machine = mx25pdk_init,
273  .restart = mxc_restart,