blob: 0d01e367b062cdf464821336fce410036bdd0914 [file] [log] [blame]
Sascha Hauerde41fdd2009-10-02 09:14:18 +02001/*
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
Uwe Kleine-Königc10ea4d2010-03-04 16:43:31 +010019/*
20 * This machine is known as:
21 * - i.MX25 3-Stack Development System
22 * - i.MX25 Platform Development Kit (i.MX25 PDK)
23 */
24
Sascha Hauer635baf62009-06-04 11:32:46 +020025#include <linux/types.h>
26#include <linux/init.h>
Baruch Siache71fbaf2009-12-21 13:44:32 +020027#include <linux/delay.h>
Sascha Hauer635baf62009-06-04 11:32:46 +020028#include <linux/clk.h>
29#include <linux/irq.h>
30#include <linux/gpio.h>
Sascha Hauer635baf62009-06-04 11:32:46 +020031#include <linux/platform_device.h>
Fabio Estevam460d30a2010-12-22 12:25:32 -020032#include <linux/usb/otg.h>
Sascha Hauer635baf62009-06-04 11:32:46 +020033
Sascha Hauer635baf62009-06-04 11:32:46 +020034#include <asm/mach-types.h>
35#include <asm/mach/arch.h>
36#include <asm/mach/time.h>
37#include <asm/memory.h>
38#include <asm/mach/map.h>
Sascha Hauer635baf62009-06-04 11:32:46 +020039
Shawn Guoe3372472012-09-13 21:01:00 +080040#include "common.h"
Uwe Kleine-Königb0c48452010-06-16 12:34:56 +020041#include "devices-imx25.h"
Shawn Guo641dfe82014-05-19 20:41:52 +080042#include "ehci.h"
Shawn Guo50f2de62012-09-14 14:14:45 +080043#include "hardware.h"
Shawn Guo267dd342012-09-13 13:26:00 +080044#include "iomux-mx25.h"
Shawn Guo50f2de62012-09-14 14:14:45 +080045#include "mx25.h"
Uwe Kleine-Königb0c48452010-06-16 12:34:56 +020046
Fabio Estevam91dcc7f2011-07-08 14:59:50 -030047#define MX25PDK_CAN_PWDN IMX_GPIO_NR(4, 6)
48
Uwe Kleine-König7cc3c842010-06-24 15:20:44 +020049static const struct imxuart_platform_data uart_pdata __initconst = {
Sascha Hauer635baf62009-06-04 11:32:46 +020050 .flags = IMXUART_HAVE_RTSCTS,
51};
52
Lothar Waßmann8f5260c2010-10-26 14:28:31 +020053static iomux_v3_cfg_t mx25pdk_pads[] = {
Baruch Siache71fbaf2009-12-21 13:44:32 +020054 MX25_PAD_FEC_MDC__FEC_MDC,
55 MX25_PAD_FEC_MDIO__FEC_MDIO,
56 MX25_PAD_FEC_TDATA0__FEC_TDATA0,
57 MX25_PAD_FEC_TDATA1__FEC_TDATA1,
58 MX25_PAD_FEC_TX_EN__FEC_TX_EN,
59 MX25_PAD_FEC_RDATA0__FEC_RDATA0,
60 MX25_PAD_FEC_RDATA1__FEC_RDATA1,
61 MX25_PAD_FEC_RX_DV__FEC_RX_DV,
62 MX25_PAD_FEC_TX_CLK__FEC_TX_CLK,
63 MX25_PAD_A17__GPIO_2_3, /* FEC_EN, GPIO 35 */
64 MX25_PAD_D12__GPIO_4_8, /* FEC_RESET_B, GPIO 104 */
Baruch Siach0f547dc2010-02-17 12:33:25 +020065
66 /* LCD */
67 MX25_PAD_LD0__LD0,
68 MX25_PAD_LD1__LD1,
69 MX25_PAD_LD2__LD2,
70 MX25_PAD_LD3__LD3,
71 MX25_PAD_LD4__LD4,
72 MX25_PAD_LD5__LD5,
73 MX25_PAD_LD6__LD6,
74 MX25_PAD_LD7__LD7,
75 MX25_PAD_LD8__LD8,
76 MX25_PAD_LD9__LD9,
77 MX25_PAD_LD10__LD10,
78 MX25_PAD_LD11__LD11,
79 MX25_PAD_LD12__LD12,
80 MX25_PAD_LD13__LD13,
81 MX25_PAD_LD14__LD14,
82 MX25_PAD_LD15__LD15,
83 MX25_PAD_GPIO_E__LD16,
84 MX25_PAD_GPIO_F__LD17,
85 MX25_PAD_HSYNC__HSYNC,
86 MX25_PAD_VSYNC__VSYNC,
87 MX25_PAD_LSCLK__LSCLK,
88 MX25_PAD_OE_ACD__OE_ACD,
89 MX25_PAD_CONTRAST__CONTRAST,
Baruch Siachc45dd812010-05-26 15:12:11 +030090
91 /* Keypad */
92 MX25_PAD_KPP_ROW0__KPP_ROW0,
93 MX25_PAD_KPP_ROW1__KPP_ROW1,
94 MX25_PAD_KPP_ROW2__KPP_ROW2,
95 MX25_PAD_KPP_ROW3__KPP_ROW3,
96 MX25_PAD_KPP_COL0__KPP_COL0,
97 MX25_PAD_KPP_COL1__KPP_COL1,
98 MX25_PAD_KPP_COL2__KPP_COL2,
99 MX25_PAD_KPP_COL3__KPP_COL3,
Shawn Guo71e28892010-10-22 00:23:45 +0800100
101 /* SD1 */
102 MX25_PAD_SD1_CMD__SD1_CMD,
103 MX25_PAD_SD1_CLK__SD1_CLK,
104 MX25_PAD_SD1_DATA0__SD1_DATA0,
105 MX25_PAD_SD1_DATA1__SD1_DATA1,
106 MX25_PAD_SD1_DATA2__SD1_DATA2,
107 MX25_PAD_SD1_DATA3__SD1_DATA3,
Shawn Guo9c97f662011-02-26 23:19:04 +0800108 MX25_PAD_A14__GPIO_2_0, /* WriteProtect */
109 MX25_PAD_A15__GPIO_2_1, /* CardDetect */
Fabio Estevamff864522011-03-01 16:59:47 -0300110
111 /* I2C1 */
112 MX25_PAD_I2C1_CLK__I2C1_CLK,
113 MX25_PAD_I2C1_DAT__I2C1_DAT,
Fabio Estevam91dcc7f2011-07-08 14:59:50 -0300114
115 /* CAN1 */
116 MX25_PAD_GPIO_A__CAN1_TX,
117 MX25_PAD_GPIO_B__CAN1_RX,
118 MX25_PAD_D14__GPIO_4_6, /* CAN_PWDN */
Baruch Siache71fbaf2009-12-21 13:44:32 +0200119};
120
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +0200121static const struct fec_platform_data mx25_fec_pdata __initconst = {
Uwe Kleine-Könige48ab1c2010-11-11 18:06:17 +0100122 .phy = PHY_INTERFACE_MODE_RMII,
Baruch Siache71fbaf2009-12-21 13:44:32 +0200123};
124
Fabio Estevamddb95fd2011-02-22 20:24:13 -0300125#define FEC_ENABLE_GPIO IMX_GPIO_NR(2, 3)
126#define FEC_RESET_B_GPIO IMX_GPIO_NR(4, 8)
Baruch Siache71fbaf2009-12-21 13:44:32 +0200127
128static void __init mx25pdk_fec_reset(void)
129{
130 gpio_request(FEC_ENABLE_GPIO, "FEC PHY enable");
131 gpio_request(FEC_RESET_B_GPIO, "FEC PHY reset");
132
133 gpio_direction_output(FEC_ENABLE_GPIO, 0); /* drop PHY power */
134 gpio_direction_output(FEC_RESET_B_GPIO, 0); /* assert reset */
135 udelay(2);
136
137 /* turn on PHY power and lift reset */
138 gpio_set_value(FEC_ENABLE_GPIO, 1);
139 gpio_set_value(FEC_RESET_B_GPIO, 1);
140}
141
Uwe Kleine-Königb0c48452010-06-16 12:34:56 +0200142static const struct mxc_nand_platform_data
143mx25pdk_nand_board_info __initconst = {
Baruch Siachb97235d2010-01-14 11:24:15 +0200144 .width = 1,
145 .hw_ecc = 1,
146 .flash_bbt = 1,
147};
148
Baruch Siach0f547dc2010-02-17 12:33:25 +0200149static struct imx_fb_videomode mx25pdk_modes[] = {
150 {
151 .mode = {
152 .name = "CRT-VGA",
153 .refresh = 60,
154 .xres = 640,
155 .yres = 480,
156 .pixclock = 39683,
157 .left_margin = 45,
158 .right_margin = 114,
159 .upper_margin = 33,
160 .lower_margin = 11,
161 .hsync_len = 1,
162 .vsync_len = 1,
163 },
164 .bpp = 16,
165 .pcr = 0xFA208B80,
166 },
167};
168
Uwe Kleine-König194ee8e2010-11-11 15:32:21 +0100169static const struct imx_fb_platform_data mx25pdk_fb_pdata __initconst = {
Baruch Siach0f547dc2010-02-17 12:33:25 +0200170 .mode = mx25pdk_modes,
171 .num_modes = ARRAY_SIZE(mx25pdk_modes),
172 .pwmr = 0x00A903FF,
173 .lscr1 = 0x00120300,
174 .dmacr = 0x00020010,
175};
176
Baruch Siachc45dd812010-05-26 15:12:11 +0300177static const uint32_t mx25pdk_keymap[] = {
178 KEY(0, 0, KEY_UP),
179 KEY(0, 1, KEY_DOWN),
180 KEY(0, 2, KEY_VOLUMEDOWN),
181 KEY(0, 3, KEY_HOME),
182 KEY(1, 0, KEY_RIGHT),
183 KEY(1, 1, KEY_LEFT),
184 KEY(1, 2, KEY_ENTER),
185 KEY(1, 3, KEY_VOLUMEUP),
186 KEY(2, 0, KEY_F6),
187 KEY(2, 1, KEY_F8),
188 KEY(2, 2, KEY_F9),
189 KEY(2, 3, KEY_F10),
190 KEY(3, 0, KEY_F1),
191 KEY(3, 1, KEY_F2),
192 KEY(3, 2, KEY_F3),
193 KEY(3, 3, KEY_POWER),
194};
195
Fabio Estevam5f804df2011-01-22 16:18:56 -0200196static const struct matrix_keymap_data mx25pdk_keymap_data __initconst = {
Baruch Siachc45dd812010-05-26 15:12:11 +0300197 .keymap = mx25pdk_keymap,
198 .keymap_size = ARRAY_SIZE(mx25pdk_keymap),
199};
200
Sascha Hauer4bd597b2011-01-03 11:30:28 +0100201static int mx25pdk_usbh2_init(struct platform_device *pdev)
202{
203 return mx25_initialize_usb_hw(pdev->id, MXC_EHCI_INTERNAL_PHY);
204}
205
Fabio Estevam460d30a2010-12-22 12:25:32 -0200206static const struct mxc_usbh_platform_data usbh2_pdata __initconst = {
Sascha Hauer4bd597b2011-01-03 11:30:28 +0100207 .init = mx25pdk_usbh2_init,
Fabio Estevam460d30a2010-12-22 12:25:32 -0200208 .portsc = MXC_EHCI_MODE_SERIAL,
Fabio Estevam460d30a2010-12-22 12:25:32 -0200209};
210
211static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
212 .operating_mode = FSL_USB2_DR_DEVICE,
213 .phy_mode = FSL_USB2_PHY_UTMI,
214};
215
Fabio Estevamff864522011-03-01 16:59:47 -0300216static const struct imxi2c_platform_data mx25_3ds_i2c0_data __initconst = {
217 .bitrate = 100000,
218};
219
Shawn Guo9c97f662011-02-26 23:19:04 +0800220#define SD1_GPIO_WP IMX_GPIO_NR(2, 0)
221#define SD1_GPIO_CD IMX_GPIO_NR(2, 1)
222
223static const struct esdhc_platform_data mx25pdk_esdhc_pdata __initconst = {
224 .wp_gpio = SD1_GPIO_WP,
225 .cd_gpio = SD1_GPIO_CD,
Shawn Guo913413c2011-06-21 22:41:51 +0800226 .wp_type = ESDHC_WP_GPIO,
227 .cd_type = ESDHC_CD_GPIO,
Shawn Guo9c97f662011-02-26 23:19:04 +0800228};
229
Sascha Hauer635baf62009-06-04 11:32:46 +0200230static void __init mx25pdk_init(void)
231{
Shawn Guob78d8e52011-06-06 00:07:55 +0800232 imx25_soc_init();
233
Baruch Siache71fbaf2009-12-21 13:44:32 +0200234 mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads,
235 ARRAY_SIZE(mx25pdk_pads));
236
Uwe Kleine-König7cc3c842010-06-24 15:20:44 +0200237 imx25_add_imx_uart0(&uart_pdata);
Fabio Estevam460d30a2010-12-22 12:25:32 -0200238 imx25_add_fsl_usb2_udc(&otg_device_pdata);
239 imx25_add_mxc_ehci_hs(&usbh2_pdata);
Uwe Kleine-Königb0c48452010-06-16 12:34:56 +0200240 imx25_add_mxc_nand(&mx25pdk_nand_board_info);
Benoît Thébaudeaubec31a82012-07-04 16:35:54 +0200241 imx25_add_imxdi_rtc();
Uwe Kleine-König194ee8e2010-11-11 15:32:21 +0100242 imx25_add_imx_fb(&mx25pdk_fb_pdata);
Benoît Thébaudeaubec31a82012-07-04 16:35:54 +0200243 imx25_add_imx2_wdt();
Baruch Siache71fbaf2009-12-21 13:44:32 +0200244
245 mx25pdk_fec_reset();
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +0200246 imx25_add_fec(&mx25_fec_pdata);
Uwe Kleine-Königab9cee4b2010-11-11 11:35:33 +0100247 imx25_add_imx_keypad(&mx25pdk_keymap_data);
Shawn Guo71e28892010-10-22 00:23:45 +0800248
Shawn Guo9c97f662011-02-26 23:19:04 +0800249 imx25_add_sdhci_esdhc_imx(0, &mx25pdk_esdhc_pdata);
Fabio Estevamff864522011-03-01 16:59:47 -0300250 imx25_add_imx_i2c0(&mx25_3ds_i2c0_data);
Fabio Estevam91dcc7f2011-07-08 14:59:50 -0300251
252 gpio_request_one(MX25PDK_CAN_PWDN, GPIOF_OUT_INIT_LOW, "can-pwdn");
Marc Kleine-Budde30caa4b2013-06-10 23:12:56 -0300253 imx25_add_flexcan0();
Sascha Hauer635baf62009-06-04 11:32:46 +0200254}
255
Sascha Hauer635baf62009-06-04 11:32:46 +0200256static void __init mx25pdk_timer_init(void)
257{
Baruch Siachfadc0952010-01-25 12:58:19 +0200258 mx25_clocks_init();
Sascha Hauer635baf62009-06-04 11:32:46 +0200259}
260
Sascha Hauer635baf62009-06-04 11:32:46 +0200261MACHINE_START(MX25_3DS, "Freescale MX25PDK (3DS)")
262 /* Maintainer: Freescale Semiconductor, Inc. */
Nicolas Pitredc8f1902011-07-05 22:38:12 -0400263 .atag_offset = 0x100,
Uwe Kleine-König3dac2192011-02-07 16:35:19 +0100264 .map_io = mx25_map_io,
265 .init_early = imx25_init_early,
266 .init_irq = mx25_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700267 .init_time = mx25pdk_timer_init,
Uwe Kleine-König3dac2192011-02-07 16:35:19 +0100268 .init_machine = mx25pdk_init,
Russell King65ea7882011-11-06 17:12:08 +0000269 .restart = mxc_restart,
Sascha Hauer635baf62009-06-04 11:32:46 +0200270MACHINE_END