2 * Copyright (C) 2011 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/clk.h>
23 #include <linux/delay.h>
24 #include <linux/gpio.h>
26 #include <mach/common.h>
27 #include <mach/hardware.h>
28 #include <mach/iomux-mx53.h>
30 #include <asm/mach-types.h>
31 #include <asm/mach/arch.h>
32 #include <asm/mach/time.h>
35 #include "devices-imx53.h"
37 #define MX53_LOCO_POWER IMX_GPIO_NR(1, 8)
38 #define MX53_LOCO_UI1 IMX_GPIO_NR(2, 14)
39 #define MX53_LOCO_UI2 IMX_GPIO_NR(2, 15)
40 #define LOCO_FEC_PHY_RST IMX_GPIO_NR(7, 6)
42 static iomux_v3_cfg_t mx53_loco_pads
[] = {
44 MX53_PAD_FEC_MDC__FEC_MDC
,
45 MX53_PAD_FEC_MDIO__FEC_MDIO
,
46 MX53_PAD_FEC_REF_CLK__FEC_TX_CLK
,
47 MX53_PAD_FEC_RX_ER__FEC_RX_ER
,
48 MX53_PAD_FEC_CRS_DV__FEC_RX_DV
,
49 MX53_PAD_FEC_RXD1__FEC_RDATA_1
,
50 MX53_PAD_FEC_RXD0__FEC_RDATA_0
,
51 MX53_PAD_FEC_TX_EN__FEC_TX_EN
,
52 MX53_PAD_FEC_TXD1__FEC_TDATA_1
,
53 MX53_PAD_FEC_TXD0__FEC_TDATA_0
,
55 MX53_PAD_PATA_DA_0__GPIO7_6
,
57 MX53_PAD_PATA_DATA4__GPIO2_4
,
59 MX53_PAD_KEY_COL0__AUDMUX_AUD5_TXC
,
60 MX53_PAD_KEY_ROW0__AUDMUX_AUD5_TXD
,
61 MX53_PAD_KEY_COL1__AUDMUX_AUD5_TXFS
,
62 MX53_PAD_KEY_ROW1__AUDMUX_AUD5_RXD
,
64 MX53_PAD_KEY_COL3__I2C2_SCL
,
65 MX53_PAD_KEY_ROW3__I2C2_SDA
,
67 MX53_PAD_SD1_CMD__ESDHC1_CMD
,
68 MX53_PAD_SD1_CLK__ESDHC1_CLK
,
69 MX53_PAD_SD1_DATA0__ESDHC1_DAT0
,
70 MX53_PAD_SD1_DATA1__ESDHC1_DAT1
,
71 MX53_PAD_SD1_DATA2__ESDHC1_DAT2
,
72 MX53_PAD_SD1_DATA3__ESDHC1_DAT3
,
74 MX53_PAD_PATA_DATA8__ESDHC3_DAT0
,
75 MX53_PAD_PATA_DATA9__ESDHC3_DAT1
,
76 MX53_PAD_PATA_DATA10__ESDHC3_DAT2
,
77 MX53_PAD_PATA_DATA11__ESDHC3_DAT3
,
78 MX53_PAD_PATA_DATA0__ESDHC3_DAT4
,
79 MX53_PAD_PATA_DATA1__ESDHC3_DAT5
,
80 MX53_PAD_PATA_DATA2__ESDHC3_DAT6
,
81 MX53_PAD_PATA_DATA3__ESDHC3_DAT7
,
82 MX53_PAD_PATA_IORDY__ESDHC3_CLK
,
83 MX53_PAD_PATA_RESET_B__ESDHC3_CMD
,
85 MX53_PAD_EIM_DA11__GPIO3_11
,
87 MX53_PAD_EIM_DA12__GPIO3_12
,
89 MX53_PAD_EIM_OE__IPU_DI1_PIN7
,
90 MX53_PAD_EIM_RW__IPU_DI1_PIN8
,
92 MX53_PAD_EIM_D20__IPU_SER_DISP0_CS
,
93 MX53_PAD_EIM_D21__IPU_DISPB0_SER_CLK
,
94 MX53_PAD_EIM_D22__IPU_DISPB0_SER_DIN
,
95 MX53_PAD_EIM_D23__IPU_DI0_D0_CS
,
97 MX53_PAD_EIM_D24__GPIO3_24
,
99 MX53_PAD_EIM_D31__GPIO3_31
,
101 MX53_PAD_LVDS0_TX3_P__LDB_LVDS0_TX3
,
102 MX53_PAD_LVDS0_CLK_P__LDB_LVDS0_CLK
,
103 MX53_PAD_LVDS0_TX2_P__LDB_LVDS0_TX2
,
104 MX53_PAD_LVDS0_TX1_P__LDB_LVDS0_TX1
,
105 MX53_PAD_LVDS0_TX0_P__LDB_LVDS0_TX0
,
106 MX53_PAD_LVDS1_TX3_P__LDB_LVDS1_TX3
,
107 MX53_PAD_LVDS1_TX2_P__LDB_LVDS1_TX2
,
108 MX53_PAD_LVDS1_CLK_P__LDB_LVDS1_CLK
,
109 MX53_PAD_LVDS1_TX1_P__LDB_LVDS1_TX1
,
110 MX53_PAD_LVDS1_TX0_P__LDB_LVDS1_TX0
,
112 MX53_PAD_CSI0_DAT8__I2C1_SDA
,
113 MX53_PAD_CSI0_DAT9__I2C1_SCL
,
115 MX53_PAD_CSI0_DAT10__UART1_TXD_MUX
,
116 MX53_PAD_CSI0_DAT11__UART1_RXD_MUX
,
118 MX53_PAD_CSI0_DAT12__IPU_CSI0_D_12
,
119 MX53_PAD_CSI0_DAT13__IPU_CSI0_D_13
,
120 MX53_PAD_CSI0_DAT14__IPU_CSI0_D_14
,
121 MX53_PAD_CSI0_DAT15__IPU_CSI0_D_15
,
122 MX53_PAD_CSI0_DAT16__IPU_CSI0_D_16
,
123 MX53_PAD_CSI0_DAT17__IPU_CSI0_D_17
,
124 MX53_PAD_CSI0_DAT18__IPU_CSI0_D_18
,
125 MX53_PAD_CSI0_DAT19__IPU_CSI0_D_19
,
126 MX53_PAD_CSI0_VSYNC__IPU_CSI0_VSYNC
,
127 MX53_PAD_CSI0_MCLK__IPU_CSI0_HSYNC
,
128 MX53_PAD_CSI0_PIXCLK__IPU_CSI0_PIXCLK
,
130 MX53_PAD_DI0_DISP_CLK__IPU_DI0_DISP_CLK
,
131 MX53_PAD_DI0_PIN15__IPU_DI0_PIN15
,
132 MX53_PAD_DI0_PIN2__IPU_DI0_PIN2
,
133 MX53_PAD_DI0_PIN3__IPU_DI0_PIN3
,
134 MX53_PAD_DISP0_DAT0__IPU_DISP0_DAT_0
,
135 MX53_PAD_DISP0_DAT1__IPU_DISP0_DAT_1
,
136 MX53_PAD_DISP0_DAT2__IPU_DISP0_DAT_2
,
137 MX53_PAD_DISP0_DAT3__IPU_DISP0_DAT_3
,
138 MX53_PAD_DISP0_DAT4__IPU_DISP0_DAT_4
,
139 MX53_PAD_DISP0_DAT5__IPU_DISP0_DAT_5
,
140 MX53_PAD_DISP0_DAT6__IPU_DISP0_DAT_6
,
141 MX53_PAD_DISP0_DAT7__IPU_DISP0_DAT_7
,
142 MX53_PAD_DISP0_DAT8__IPU_DISP0_DAT_8
,
143 MX53_PAD_DISP0_DAT9__IPU_DISP0_DAT_9
,
144 MX53_PAD_DISP0_DAT10__IPU_DISP0_DAT_10
,
145 MX53_PAD_DISP0_DAT11__IPU_DISP0_DAT_11
,
146 MX53_PAD_DISP0_DAT12__IPU_DISP0_DAT_12
,
147 MX53_PAD_DISP0_DAT13__IPU_DISP0_DAT_13
,
148 MX53_PAD_DISP0_DAT14__IPU_DISP0_DAT_14
,
149 MX53_PAD_DISP0_DAT15__IPU_DISP0_DAT_15
,
150 MX53_PAD_DISP0_DAT16__IPU_DISP0_DAT_16
,
151 MX53_PAD_DISP0_DAT17__IPU_DISP0_DAT_17
,
152 MX53_PAD_DISP0_DAT18__IPU_DISP0_DAT_18
,
153 MX53_PAD_DISP0_DAT19__IPU_DISP0_DAT_19
,
154 MX53_PAD_DISP0_DAT20__IPU_DISP0_DAT_20
,
155 MX53_PAD_DISP0_DAT21__IPU_DISP0_DAT_21
,
156 MX53_PAD_DISP0_DAT22__IPU_DISP0_DAT_22
,
157 MX53_PAD_DISP0_DAT23__IPU_DISP0_DAT_23
,
159 MX53_PAD_GPIO_0__CCM_SSI_EXT1_CLK
,
161 MX53_PAD_GPIO_1__PWM2_PWMO
,
163 MX53_PAD_GPIO_7__SPDIF_PLOCK
,
164 MX53_PAD_GPIO_17__SPDIF_OUT1
,
166 MX53_PAD_PATA_DA_1__GPIO7_7
,
167 MX53_PAD_PATA_DA_2__GPIO7_8
,
168 MX53_PAD_PATA_DATA5__GPIO2_5
,
169 MX53_PAD_PATA_DATA6__GPIO2_6
,
170 MX53_PAD_PATA_DATA14__GPIO2_14
,
171 MX53_PAD_PATA_DATA15__GPIO2_15
,
172 MX53_PAD_PATA_INTRQ__GPIO7_2
,
173 MX53_PAD_EIM_WAIT__GPIO5_0
,
174 MX53_PAD_NANDF_WP_B__GPIO6_9
,
175 MX53_PAD_NANDF_RB0__GPIO6_10
,
176 MX53_PAD_NANDF_CS1__GPIO6_14
,
177 MX53_PAD_NANDF_CS2__GPIO6_15
,
178 MX53_PAD_NANDF_CS3__GPIO6_16
,
179 MX53_PAD_GPIO_5__GPIO1_5
,
180 MX53_PAD_GPIO_16__GPIO7_11
,
181 MX53_PAD_GPIO_8__GPIO1_8
,
184 #define GPIO_BUTTON(gpio_num, ev_code, act_low, descr, wake) \
189 .active_low = act_low, \
190 .desc = "btn " descr, \
194 static struct gpio_keys_button loco_buttons
[] = {
195 GPIO_BUTTON(MX53_LOCO_POWER
, KEY_POWER
, 1, "power", 0),
196 GPIO_BUTTON(MX53_LOCO_UI1
, KEY_VOLUMEUP
, 1, "volume-up", 0),
197 GPIO_BUTTON(MX53_LOCO_UI2
, KEY_VOLUMEDOWN
, 1, "volume-down", 0),
200 static const struct gpio_keys_platform_data loco_button_data __initconst
= {
201 .buttons
= loco_buttons
,
202 .nbuttons
= ARRAY_SIZE(loco_buttons
),
205 static inline void mx53_loco_fec_reset(void)
210 ret
= gpio_request(LOCO_FEC_PHY_RST
, "fec-phy-reset");
212 printk(KERN_ERR
"failed to get GPIO_FEC_PHY_RESET: %d\n", ret
);
215 gpio_direction_output(LOCO_FEC_PHY_RST
, 0);
217 gpio_set_value(LOCO_FEC_PHY_RST
, 1);
220 static struct fec_platform_data mx53_loco_fec_data
= {
221 .phy
= PHY_INTERFACE_MODE_RMII
,
224 static const struct imxi2c_platform_data mx53_loco_i2c_data __initconst
= {
228 static void __init
mx53_loco_board_init(void)
230 mxc_iomux_v3_setup_multiple_pads(mx53_loco_pads
,
231 ARRAY_SIZE(mx53_loco_pads
));
232 imx53_add_imx_uart(0, NULL
);
233 mx53_loco_fec_reset();
234 imx53_add_fec(&mx53_loco_fec_data
);
235 imx53_add_imx2_wdt(0, NULL
);
236 imx53_add_imx_i2c(0, &mx53_loco_i2c_data
);
237 imx53_add_imx_i2c(1, &mx53_loco_i2c_data
);
238 imx53_add_sdhci_esdhc_imx(0, NULL
);
239 imx53_add_sdhci_esdhc_imx(2, NULL
);
240 imx_add_gpio_keys(&loco_button_data
);
243 static void __init
mx53_loco_timer_init(void)
245 mx53_clocks_init(32768, 24000000, 0, 0);
248 static struct sys_timer mx53_loco_timer
= {
249 .init
= mx53_loco_timer_init
,
252 MACHINE_START(MX53_LOCO
, "Freescale MX53 LOCO Board")
253 .map_io
= mx53_map_io
,
254 .init_early
= imx53_init_early
,
255 .init_irq
= mx53_init_irq
,
256 .timer
= &mx53_loco_timer
,
257 .init_machine
= mx53_loco_board_init
,