2 * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
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.
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.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include <linux/init.h>
22 #include <linux/platform_device.h>
23 #include <linux/gpio.h>
24 #include <linux/delay.h>
28 #include <asm/setup.h>
29 #include <asm/mach-types.h>
30 #include <asm/mach/arch.h>
31 #include <asm/mach/time.h>
34 #include "devices-imx50.h"
36 #include "iomux-mx50.h"
38 #define FEC_EN IMX_GPIO_NR(6, 23)
39 #define FEC_RESET_B IMX_GPIO_NR(4, 12)
41 static iomux_v3_cfg_t mx50_rdp_pads
[] __initdata
= {
43 MX50_PAD_ECSPI2_SS0__GPIO_4_19
,
44 MX50_PAD_EIM_CRE__GPIO_1_27
,
45 MX50_PAD_SD1_CMD__SD1_CMD
,
47 MX50_PAD_SD1_CLK__SD1_CLK
,
48 MX50_PAD_SD1_D0__SD1_D0
,
49 MX50_PAD_SD1_D1__SD1_D1
,
50 MX50_PAD_SD1_D2__SD1_D2
,
51 MX50_PAD_SD1_D3__SD1_D3
,
54 MX50_PAD_SD2_CD__GPIO_5_17
,
55 MX50_PAD_SD2_WP__GPIO_5_16
,
56 MX50_PAD_SD2_CMD__SD2_CMD
,
57 MX50_PAD_SD2_CLK__SD2_CLK
,
58 MX50_PAD_SD2_D0__SD2_D0
,
59 MX50_PAD_SD2_D1__SD2_D1
,
60 MX50_PAD_SD2_D2__SD2_D2
,
61 MX50_PAD_SD2_D3__SD2_D3
,
62 MX50_PAD_SD2_D4__SD2_D4
,
63 MX50_PAD_SD2_D5__SD2_D5
,
64 MX50_PAD_SD2_D6__SD2_D6
,
65 MX50_PAD_SD2_D7__SD2_D7
,
68 MX50_PAD_SD3_CMD__SD3_CMD
,
69 MX50_PAD_SD3_CLK__SD3_CLK
,
70 MX50_PAD_SD3_D0__SD3_D0
,
71 MX50_PAD_SD3_D1__SD3_D1
,
72 MX50_PAD_SD3_D2__SD3_D2
,
73 MX50_PAD_SD3_D3__SD3_D3
,
74 MX50_PAD_SD3_D4__SD3_D4
,
75 MX50_PAD_SD3_D5__SD3_D5
,
76 MX50_PAD_SD3_D6__SD3_D6
,
77 MX50_PAD_SD3_D7__SD3_D7
,
80 MX50_PAD_ECSPI2_MISO__GPIO_4_18
,
82 /* UART pad setting */
83 MX50_PAD_UART1_TXD__UART1_TXD
,
84 MX50_PAD_UART1_RXD__UART1_RXD
,
85 MX50_PAD_UART1_RTS__UART1_RTS
,
86 MX50_PAD_UART2_TXD__UART2_TXD
,
87 MX50_PAD_UART2_RXD__UART2_RXD
,
88 MX50_PAD_UART2_CTS__UART2_CTS
,
89 MX50_PAD_UART2_RTS__UART2_RTS
,
91 MX50_PAD_I2C1_SCL__I2C1_SCL
,
92 MX50_PAD_I2C1_SDA__I2C1_SDA
,
93 MX50_PAD_I2C2_SCL__I2C2_SCL
,
94 MX50_PAD_I2C2_SDA__I2C2_SDA
,
96 MX50_PAD_EPITO__USBH1_PWR
,
97 /* Need to comment below line if
98 * one needs to debug owire.
100 MX50_PAD_OWIRE__USBH1_OC
,
101 /* using gpio to control otg pwr */
102 MX50_PAD_PWM2__GPIO_6_25
,
103 MX50_PAD_I2C3_SCL__USBOTG_OC
,
105 MX50_PAD_SSI_RXC__FEC_MDIO
,
106 MX50_PAD_SSI_RXFS__FEC_MDC
,
107 MX50_PAD_DISP_D0__FEC_TXCLK
,
108 MX50_PAD_DISP_D1__FEC_RX_ER
,
109 MX50_PAD_DISP_D2__FEC_RX_DV
,
110 MX50_PAD_DISP_D3__FEC_RXD1
,
111 MX50_PAD_DISP_D4__FEC_RXD0
,
112 MX50_PAD_DISP_D5__FEC_TX_EN
,
113 MX50_PAD_DISP_D6__FEC_TXD1
,
114 MX50_PAD_DISP_D7__FEC_TXD0
,
115 MX50_PAD_I2C3_SDA__GPIO_6_23
,
116 MX50_PAD_ECSPI1_SCLK__GPIO_4_12
,
118 MX50_PAD_CSPI_SS0__CSPI_SS0
,
119 MX50_PAD_ECSPI1_MOSI__CSPI_SS1
,
120 MX50_PAD_CSPI_MOSI__CSPI_MOSI
,
121 MX50_PAD_CSPI_MISO__CSPI_MISO
,
124 MX50_PAD_UART1_CTS__GPIO_6_8
,
127 MX50_PAD_UART3_RXD__GPIO_6_15
,
130 MX50_PAD_KEY_COL0__KEY_COL0
,
131 MX50_PAD_KEY_ROW0__KEY_ROW0
,
132 MX50_PAD_KEY_COL1__KEY_COL1
,
133 MX50_PAD_KEY_ROW1__KEY_ROW1
,
134 MX50_PAD_KEY_COL2__KEY_COL2
,
135 MX50_PAD_KEY_ROW2__KEY_ROW2
,
136 MX50_PAD_KEY_COL3__KEY_COL3
,
137 MX50_PAD_KEY_ROW3__KEY_ROW3
,
138 MX50_PAD_EIM_DA0__KEY_COL4
,
139 MX50_PAD_EIM_DA1__KEY_ROW4
,
140 MX50_PAD_EIM_DA2__KEY_COL5
,
141 MX50_PAD_EIM_DA3__KEY_ROW5
,
142 MX50_PAD_EIM_DA4__KEY_COL6
,
143 MX50_PAD_EIM_DA5__KEY_ROW6
,
144 MX50_PAD_EIM_DA6__KEY_COL7
,
145 MX50_PAD_EIM_DA7__KEY_ROW7
,
147 MX50_PAD_EIM_DA8__GPIO_1_8
,
148 MX50_PAD_EIM_DA9__GPIO_1_9
,
149 MX50_PAD_EIM_DA10__GPIO_1_10
,
150 MX50_PAD_EIM_DA11__GPIO_1_11
,
151 MX50_PAD_EIM_DA12__GPIO_1_12
,
152 MX50_PAD_EIM_DA13__GPIO_1_13
,
153 MX50_PAD_EIM_DA14__GPIO_1_14
,
154 MX50_PAD_EIM_DA15__GPIO_1_15
,
155 MX50_PAD_EIM_CS2__GPIO_1_16
,
156 MX50_PAD_EIM_CS1__GPIO_1_17
,
157 MX50_PAD_EIM_CS0__GPIO_1_18
,
158 MX50_PAD_EIM_EB0__GPIO_1_19
,
159 MX50_PAD_EIM_EB1__GPIO_1_20
,
160 MX50_PAD_EIM_WAIT__GPIO_1_21
,
161 MX50_PAD_EIM_BCLK__GPIO_1_22
,
162 MX50_PAD_EIM_RDY__GPIO_1_23
,
163 MX50_PAD_EIM_OE__GPIO_1_24
,
167 static const struct imxuart_platform_data uart_pdata __initconst
= {
168 .flags
= IMXUART_HAVE_RTSCTS
,
171 static const struct fec_platform_data fec_data __initconst
= {
172 .phy
= PHY_INTERFACE_MODE_RMII
,
175 static inline void mx50_rdp_fec_reset(void)
177 gpio_request(FEC_EN
, "fec-en");
178 gpio_direction_output(FEC_EN
, 0);
179 gpio_request(FEC_RESET_B
, "fec-reset_b");
180 gpio_direction_output(FEC_RESET_B
, 0);
182 gpio_set_value(FEC_RESET_B
, 1);
185 static const struct imxi2c_platform_data i2c_data __initconst
= {
190 * Board specific initialization.
192 static void __init
mx50_rdp_board_init(void)
196 mxc_iomux_v3_setup_multiple_pads(mx50_rdp_pads
,
197 ARRAY_SIZE(mx50_rdp_pads
));
199 imx50_add_imx_uart(0, &uart_pdata
);
200 imx50_add_imx_uart(1, &uart_pdata
);
201 mx50_rdp_fec_reset();
202 imx50_add_fec(&fec_data
);
203 imx50_add_imx_i2c(0, &i2c_data
);
204 imx50_add_imx_i2c(1, &i2c_data
);
205 imx50_add_imx_i2c(2, &i2c_data
);
208 static void __init
mx50_rdp_timer_init(void)
210 mx50_clocks_init(32768, 24000000, 22579200);
213 static struct sys_timer mx50_rdp_timer
= {
214 .init
= mx50_rdp_timer_init
,
217 MACHINE_START(MX50_RDP
, "Freescale MX50 Reference Design Platform")
218 .map_io
= mx50_map_io
,
219 .init_early
= imx50_init_early
,
220 .init_irq
= mx50_init_irq
,
221 .handle_irq
= imx50_handle_irq
,
222 .timer
= &mx50_rdp_timer
,
223 .init_machine
= mx50_rdp_board_init
,
224 .restart
= mxc_restart
,