Commit | Line | Data |
---|---|---|
de41fddd SH |
1 | /* |
2 | * Copyright 2009 Sascha Hauer, <kernel@pengutronix.de> | |
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 | ||
c10ea4d6 UKK |
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 | ||
635baf6b SH |
25 | #include <linux/types.h> |
26 | #include <linux/init.h> | |
e71fbaf7 | 27 | #include <linux/delay.h> |
635baf6b SH |
28 | #include <linux/clk.h> |
29 | #include <linux/irq.h> | |
30 | #include <linux/gpio.h> | |
635baf6b | 31 | #include <linux/platform_device.h> |
460d30a3 | 32 | #include <linux/usb/otg.h> |
635baf6b SH |
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> | |
635baf6b | 41 | #include <mach/mx25.h> |
261f6f68 | 42 | #include <mach/iomux-mx25.h> |
635baf6b | 43 | |
b0c4845c | 44 | #include "devices-imx25.h" |
b0c4845c | 45 | |
7cc3c846 | 46 | static const struct imxuart_platform_data uart_pdata __initconst = { |
635baf6b SH |
47 | .flags = IMXUART_HAVE_RTSCTS, |
48 | }; | |
49 | ||
8f5260c8 | 50 | static iomux_v3_cfg_t mx25pdk_pads[] = { |
e71fbaf7 BS |
51 | MX25_PAD_FEC_MDC__FEC_MDC, |
52 | MX25_PAD_FEC_MDIO__FEC_MDIO, | |
53 | MX25_PAD_FEC_TDATA0__FEC_TDATA0, | |
54 | MX25_PAD_FEC_TDATA1__FEC_TDATA1, | |
55 | MX25_PAD_FEC_TX_EN__FEC_TX_EN, | |
56 | MX25_PAD_FEC_RDATA0__FEC_RDATA0, | |
57 | MX25_PAD_FEC_RDATA1__FEC_RDATA1, | |
58 | MX25_PAD_FEC_RX_DV__FEC_RX_DV, | |
59 | MX25_PAD_FEC_TX_CLK__FEC_TX_CLK, | |
60 | MX25_PAD_A17__GPIO_2_3, /* FEC_EN, GPIO 35 */ | |
61 | MX25_PAD_D12__GPIO_4_8, /* FEC_RESET_B, GPIO 104 */ | |
0f547dc1 BS |
62 | |
63 | /* LCD */ | |
64 | MX25_PAD_LD0__LD0, | |
65 | MX25_PAD_LD1__LD1, | |
66 | MX25_PAD_LD2__LD2, | |
67 | MX25_PAD_LD3__LD3, | |
68 | MX25_PAD_LD4__LD4, | |
69 | MX25_PAD_LD5__LD5, | |
70 | MX25_PAD_LD6__LD6, | |
71 | MX25_PAD_LD7__LD7, | |
72 | MX25_PAD_LD8__LD8, | |
73 | MX25_PAD_LD9__LD9, | |
74 | MX25_PAD_LD10__LD10, | |
75 | MX25_PAD_LD11__LD11, | |
76 | MX25_PAD_LD12__LD12, | |
77 | MX25_PAD_LD13__LD13, | |
78 | MX25_PAD_LD14__LD14, | |
79 | MX25_PAD_LD15__LD15, | |
80 | MX25_PAD_GPIO_E__LD16, | |
81 | MX25_PAD_GPIO_F__LD17, | |
82 | MX25_PAD_HSYNC__HSYNC, | |
83 | MX25_PAD_VSYNC__VSYNC, | |
84 | MX25_PAD_LSCLK__LSCLK, | |
85 | MX25_PAD_OE_ACD__OE_ACD, | |
86 | MX25_PAD_CONTRAST__CONTRAST, | |
c45dd814 BS |
87 | |
88 | /* Keypad */ | |
89 | MX25_PAD_KPP_ROW0__KPP_ROW0, | |
90 | MX25_PAD_KPP_ROW1__KPP_ROW1, | |
91 | MX25_PAD_KPP_ROW2__KPP_ROW2, | |
92 | MX25_PAD_KPP_ROW3__KPP_ROW3, | |
93 | MX25_PAD_KPP_COL0__KPP_COL0, | |
94 | MX25_PAD_KPP_COL1__KPP_COL1, | |
95 | MX25_PAD_KPP_COL2__KPP_COL2, | |
96 | MX25_PAD_KPP_COL3__KPP_COL3, | |
71e2889d SG |
97 | |
98 | /* SD1 */ | |
99 | MX25_PAD_SD1_CMD__SD1_CMD, | |
100 | MX25_PAD_SD1_CLK__SD1_CLK, | |
101 | MX25_PAD_SD1_DATA0__SD1_DATA0, | |
102 | MX25_PAD_SD1_DATA1__SD1_DATA1, | |
103 | MX25_PAD_SD1_DATA2__SD1_DATA2, | |
104 | MX25_PAD_SD1_DATA3__SD1_DATA3, | |
9c97f662 SG |
105 | MX25_PAD_A14__GPIO_2_0, /* WriteProtect */ |
106 | MX25_PAD_A15__GPIO_2_1, /* CardDetect */ | |
ff864521 FE |
107 | |
108 | /* I2C1 */ | |
109 | MX25_PAD_I2C1_CLK__I2C1_CLK, | |
110 | MX25_PAD_I2C1_DAT__I2C1_DAT, | |
e71fbaf7 BS |
111 | }; |
112 | ||
6bd96f3c | 113 | static const struct fec_platform_data mx25_fec_pdata __initconst = { |
e48ab1c1 | 114 | .phy = PHY_INTERFACE_MODE_RMII, |
e71fbaf7 BS |
115 | }; |
116 | ||
ddb95fdd FE |
117 | #define FEC_ENABLE_GPIO IMX_GPIO_NR(2, 3) |
118 | #define FEC_RESET_B_GPIO IMX_GPIO_NR(4, 8) | |
e71fbaf7 BS |
119 | |
120 | static void __init mx25pdk_fec_reset(void) | |
121 | { | |
122 | gpio_request(FEC_ENABLE_GPIO, "FEC PHY enable"); | |
123 | gpio_request(FEC_RESET_B_GPIO, "FEC PHY reset"); | |
124 | ||
125 | gpio_direction_output(FEC_ENABLE_GPIO, 0); /* drop PHY power */ | |
126 | gpio_direction_output(FEC_RESET_B_GPIO, 0); /* assert reset */ | |
127 | udelay(2); | |
128 | ||
129 | /* turn on PHY power and lift reset */ | |
130 | gpio_set_value(FEC_ENABLE_GPIO, 1); | |
131 | gpio_set_value(FEC_RESET_B_GPIO, 1); | |
132 | } | |
133 | ||
b0c4845c UKK |
134 | static const struct mxc_nand_platform_data |
135 | mx25pdk_nand_board_info __initconst = { | |
b97235df BS |
136 | .width = 1, |
137 | .hw_ecc = 1, | |
138 | .flash_bbt = 1, | |
139 | }; | |
140 | ||
0f547dc1 BS |
141 | static struct imx_fb_videomode mx25pdk_modes[] = { |
142 | { | |
143 | .mode = { | |
144 | .name = "CRT-VGA", | |
145 | .refresh = 60, | |
146 | .xres = 640, | |
147 | .yres = 480, | |
148 | .pixclock = 39683, | |
149 | .left_margin = 45, | |
150 | .right_margin = 114, | |
151 | .upper_margin = 33, | |
152 | .lower_margin = 11, | |
153 | .hsync_len = 1, | |
154 | .vsync_len = 1, | |
155 | }, | |
156 | .bpp = 16, | |
157 | .pcr = 0xFA208B80, | |
158 | }, | |
159 | }; | |
160 | ||
194ee8e8 | 161 | static const struct imx_fb_platform_data mx25pdk_fb_pdata __initconst = { |
0f547dc1 BS |
162 | .mode = mx25pdk_modes, |
163 | .num_modes = ARRAY_SIZE(mx25pdk_modes), | |
164 | .pwmr = 0x00A903FF, | |
165 | .lscr1 = 0x00120300, | |
166 | .dmacr = 0x00020010, | |
167 | }; | |
168 | ||
c45dd814 BS |
169 | static const uint32_t mx25pdk_keymap[] = { |
170 | KEY(0, 0, KEY_UP), | |
171 | KEY(0, 1, KEY_DOWN), | |
172 | KEY(0, 2, KEY_VOLUMEDOWN), | |
173 | KEY(0, 3, KEY_HOME), | |
174 | KEY(1, 0, KEY_RIGHT), | |
175 | KEY(1, 1, KEY_LEFT), | |
176 | KEY(1, 2, KEY_ENTER), | |
177 | KEY(1, 3, KEY_VOLUMEUP), | |
178 | KEY(2, 0, KEY_F6), | |
179 | KEY(2, 1, KEY_F8), | |
180 | KEY(2, 2, KEY_F9), | |
181 | KEY(2, 3, KEY_F10), | |
182 | KEY(3, 0, KEY_F1), | |
183 | KEY(3, 1, KEY_F2), | |
184 | KEY(3, 2, KEY_F3), | |
185 | KEY(3, 3, KEY_POWER), | |
186 | }; | |
187 | ||
5f804df3 | 188 | static const struct matrix_keymap_data mx25pdk_keymap_data __initconst = { |
c45dd814 BS |
189 | .keymap = mx25pdk_keymap, |
190 | .keymap_size = ARRAY_SIZE(mx25pdk_keymap), | |
191 | }; | |
192 | ||
4bd597b6 SH |
193 | static int mx25pdk_usbh2_init(struct platform_device *pdev) |
194 | { | |
195 | return mx25_initialize_usb_hw(pdev->id, MXC_EHCI_INTERNAL_PHY); | |
196 | } | |
197 | ||
460d30a3 | 198 | static const struct mxc_usbh_platform_data usbh2_pdata __initconst = { |
4bd597b6 | 199 | .init = mx25pdk_usbh2_init, |
460d30a3 | 200 | .portsc = MXC_EHCI_MODE_SERIAL, |
460d30a3 FE |
201 | }; |
202 | ||
203 | static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { | |
204 | .operating_mode = FSL_USB2_DR_DEVICE, | |
205 | .phy_mode = FSL_USB2_PHY_UTMI, | |
206 | }; | |
207 | ||
ff864521 FE |
208 | static const struct imxi2c_platform_data mx25_3ds_i2c0_data __initconst = { |
209 | .bitrate = 100000, | |
210 | }; | |
211 | ||
9c97f662 SG |
212 | #define SD1_GPIO_WP IMX_GPIO_NR(2, 0) |
213 | #define SD1_GPIO_CD IMX_GPIO_NR(2, 1) | |
214 | ||
215 | static const struct esdhc_platform_data mx25pdk_esdhc_pdata __initconst = { | |
216 | .wp_gpio = SD1_GPIO_WP, | |
217 | .cd_gpio = SD1_GPIO_CD, | |
913413c3 SG |
218 | .wp_type = ESDHC_WP_GPIO, |
219 | .cd_type = ESDHC_CD_GPIO, | |
9c97f662 SG |
220 | }; |
221 | ||
635baf6b SH |
222 | static void __init mx25pdk_init(void) |
223 | { | |
b78d8e59 SG |
224 | imx25_soc_init(); |
225 | ||
e71fbaf7 BS |
226 | mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads, |
227 | ARRAY_SIZE(mx25pdk_pads)); | |
228 | ||
7cc3c846 | 229 | imx25_add_imx_uart0(&uart_pdata); |
460d30a3 FE |
230 | imx25_add_fsl_usb2_udc(&otg_device_pdata); |
231 | imx25_add_mxc_ehci_hs(&usbh2_pdata); | |
b0c4845c | 232 | imx25_add_mxc_nand(&mx25pdk_nand_board_info); |
e7c74b34 | 233 | imx25_add_imxdi_rtc(NULL); |
194ee8e8 | 234 | imx25_add_imx_fb(&mx25pdk_fb_pdata); |
00871505 | 235 | imx25_add_imx2_wdt(NULL); |
e71fbaf7 BS |
236 | |
237 | mx25pdk_fec_reset(); | |
6bd96f3c | 238 | imx25_add_fec(&mx25_fec_pdata); |
ab9cee4b | 239 | imx25_add_imx_keypad(&mx25pdk_keymap_data); |
71e2889d | 240 | |
9c97f662 | 241 | imx25_add_sdhci_esdhc_imx(0, &mx25pdk_esdhc_pdata); |
ff864521 | 242 | imx25_add_imx_i2c0(&mx25_3ds_i2c0_data); |
635baf6b SH |
243 | } |
244 | ||
635baf6b SH |
245 | static void __init mx25pdk_timer_init(void) |
246 | { | |
fadc0956 | 247 | mx25_clocks_init(); |
635baf6b SH |
248 | } |
249 | ||
250 | static struct sys_timer mx25pdk_timer = { | |
251 | .init = mx25pdk_timer_init, | |
252 | }; | |
253 | ||
254 | MACHINE_START(MX25_3DS, "Freescale MX25PDK (3DS)") | |
255 | /* Maintainer: Freescale Semiconductor, Inc. */ | |
3dac2196 UKK |
256 | .boot_params = MX25_PHYS_OFFSET + 0x100, |
257 | .map_io = mx25_map_io, | |
258 | .init_early = imx25_init_early, | |
259 | .init_irq = mx25_init_irq, | |
ffa2ea3f | 260 | .handle_irq = imx25_handle_irq, |
3dac2196 UKK |
261 | .timer = &mx25pdk_timer, |
262 | .init_machine = mx25pdk_init, | |
635baf6b | 263 | MACHINE_END |