blob: 7b31cbde8775409312da8d8b749c293c3ced850f [file] [log] [blame]
Amit Kucheriab996b582010-02-02 11:57:53 -08001/*
Yong Shen64f102b2010-10-21 21:18:59 +08002 * Copyright 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
Amit Kucheriab996b582010-02-02 11:57:53 -08003 * Copyright (C) 2009-2010 Amit Kucheria <amit.kucheria@canonical.com>
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13#include <linux/init.h>
14#include <linux/platform_device.h>
Dinh Nguyenf00b7712010-05-27 10:45:05 -050015#include <linux/i2c.h>
Dinh Nguyen231637f2010-04-30 15:48:25 -050016#include <linux/gpio.h>
17#include <linux/delay.h>
18#include <linux/io.h>
Dinh Nguyenf2d36ecb2010-10-23 09:12:47 -050019#include <linux/input.h>
Fabio Estevam374daa42010-11-10 07:00:02 -080020#include <linux/spi/flash.h>
21#include <linux/spi/spi.h>
Amit Kucheriab996b582010-02-02 11:57:53 -080022
23#include <mach/common.h>
24#include <mach/hardware.h>
Amit Kucheriab996b582010-02-02 11:57:53 -080025#include <mach/iomux-mx51.h>
26
Amit Kucheriab996b582010-02-02 11:57:53 -080027#include <asm/setup.h>
28#include <asm/mach-types.h>
29#include <asm/mach/arch.h>
30#include <asm/mach/time.h>
31
Uwe Kleine-König04b73b152010-08-11 22:23:06 +020032#include "devices-imx51.h"
Yong Shen64f102b2010-10-21 21:18:59 +080033#include "cpu_op-mx51.h"
Amit Kucheriab996b582010-02-02 11:57:53 -080034
Arnaud Patard (Rtp)96886c42010-11-26 15:20:52 +010035#define BABBAGE_USB_HUB_RESET IMX_GPIO_NR(1, 7)
36#define BABBAGE_USBH1_STP IMX_GPIO_NR(1, 27)
Fabio Estevam2e7b1bf2011-05-28 10:54:35 -030037#define BABBAGE_USB_PHY_RESET IMX_GPIO_NR(2, 5)
Arnaud Patard (Rtp)96886c42010-11-26 15:20:52 +010038#define BABBAGE_FEC_PHY_RESET IMX_GPIO_NR(2, 14)
39#define BABBAGE_POWER_KEY IMX_GPIO_NR(2, 21)
40#define BABBAGE_ECSPI1_CS0 IMX_GPIO_NR(4, 24)
41#define BABBAGE_ECSPI1_CS1 IMX_GPIO_NR(4, 25)
Andre Silva6ecdc112011-06-10 13:15:20 -030042#define BABBAGE_SD2_CD IMX_GPIO_NR(1, 6)
43#define BABBAGE_SD2_WP IMX_GPIO_NR(1, 5)
Dinh Nguyen231637f2010-04-30 15:48:25 -050044
45/* USB_CTRL_1 */
46#define MX51_USB_CTRL_1_OFFSET 0x10
47#define MX51_USB_CTRL_UH1_EXT_CLK_EN (1 << 25)
48
49#define MX51_USB_PLLDIV_12_MHZ 0x00
50#define MX51_USB_PLL_DIV_19_2_MHZ 0x01
51#define MX51_USB_PLL_DIV_24_MHZ 0x02
52
Dinh Nguyenf2d36ecb2010-10-23 09:12:47 -050053static struct gpio_keys_button babbage_buttons[] = {
54 {
55 .gpio = BABBAGE_POWER_KEY,
56 .code = BTN_0,
57 .desc = "PWR",
58 .active_low = 1,
59 .wakeup = 1,
60 },
61};
62
63static const struct gpio_keys_platform_data imx_button_data __initconst = {
64 .buttons = babbage_buttons,
65 .nbuttons = ARRAY_SIZE(babbage_buttons),
66};
67
Lothar Waßmann8f5260c2010-10-26 14:28:31 +020068static iomux_v3_cfg_t mx51babbage_pads[] = {
Amit Kucheriab996b582010-02-02 11:57:53 -080069 /* UART1 */
70 MX51_PAD_UART1_RXD__UART1_RXD,
71 MX51_PAD_UART1_TXD__UART1_TXD,
72 MX51_PAD_UART1_RTS__UART1_RTS,
73 MX51_PAD_UART1_CTS__UART1_CTS,
74
75 /* UART2 */
76 MX51_PAD_UART2_RXD__UART2_RXD,
77 MX51_PAD_UART2_TXD__UART2_TXD,
78
79 /* UART3 */
80 MX51_PAD_EIM_D25__UART3_RXD,
81 MX51_PAD_EIM_D26__UART3_TXD,
82 MX51_PAD_EIM_D27__UART3_RTS,
83 MX51_PAD_EIM_D24__UART3_CTS,
Dinh Nguyen231637f2010-04-30 15:48:25 -050084
Dinh Nguyenf00b7712010-05-27 10:45:05 -050085 /* I2C1 */
86 MX51_PAD_EIM_D16__I2C1_SDA,
87 MX51_PAD_EIM_D19__I2C1_SCL,
88
89 /* I2C2 */
90 MX51_PAD_KEY_COL4__I2C2_SCL,
91 MX51_PAD_KEY_COL5__I2C2_SDA,
92
93 /* HSI2C */
Sascha Haueree1ae4d2010-12-15 09:56:35 +010094 MX51_PAD_I2C1_CLK__I2C1_CLK,
95 MX51_PAD_I2C1_DAT__I2C1_DAT,
Dinh Nguyenf00b7712010-05-27 10:45:05 -050096
Dinh Nguyen231637f2010-04-30 15:48:25 -050097 /* USB HOST1 */
98 MX51_PAD_USBH1_CLK__USBH1_CLK,
99 MX51_PAD_USBH1_DIR__USBH1_DIR,
100 MX51_PAD_USBH1_NXT__USBH1_NXT,
101 MX51_PAD_USBH1_DATA0__USBH1_DATA0,
102 MX51_PAD_USBH1_DATA1__USBH1_DATA1,
103 MX51_PAD_USBH1_DATA2__USBH1_DATA2,
104 MX51_PAD_USBH1_DATA3__USBH1_DATA3,
105 MX51_PAD_USBH1_DATA4__USBH1_DATA4,
106 MX51_PAD_USBH1_DATA5__USBH1_DATA5,
107 MX51_PAD_USBH1_DATA6__USBH1_DATA6,
108 MX51_PAD_USBH1_DATA7__USBH1_DATA7,
109
110 /* USB HUB reset line*/
Sascha Haueree1ae4d2010-12-15 09:56:35 +0100111 MX51_PAD_GPIO1_7__GPIO1_7,
Fabio Estevam3efee472010-08-23 07:32:09 -0700112
Fabio Estevam2e7b1bf2011-05-28 10:54:35 -0300113 /* USB PHY reset line */
114 MX51_PAD_EIM_D21__GPIO2_5,
115
Fabio Estevam3efee472010-08-23 07:32:09 -0700116 /* FEC */
117 MX51_PAD_EIM_EB2__FEC_MDIO,
Sascha Haueree1ae4d2010-12-15 09:56:35 +0100118 MX51_PAD_EIM_EB3__FEC_RDATA1,
119 MX51_PAD_EIM_CS2__FEC_RDATA2,
120 MX51_PAD_EIM_CS3__FEC_RDATA3,
Fabio Estevam3efee472010-08-23 07:32:09 -0700121 MX51_PAD_EIM_CS4__FEC_RX_ER,
122 MX51_PAD_EIM_CS5__FEC_CRS,
123 MX51_PAD_NANDF_RB2__FEC_COL,
Sascha Haueree1ae4d2010-12-15 09:56:35 +0100124 MX51_PAD_NANDF_RB3__FEC_RX_CLK,
125 MX51_PAD_NANDF_D9__FEC_RDATA0,
126 MX51_PAD_NANDF_D8__FEC_TDATA0,
Fabio Estevam3efee472010-08-23 07:32:09 -0700127 MX51_PAD_NANDF_CS2__FEC_TX_ER,
128 MX51_PAD_NANDF_CS3__FEC_MDC,
Sascha Haueree1ae4d2010-12-15 09:56:35 +0100129 MX51_PAD_NANDF_CS4__FEC_TDATA1,
130 MX51_PAD_NANDF_CS5__FEC_TDATA2,
131 MX51_PAD_NANDF_CS6__FEC_TDATA3,
Fabio Estevam3efee472010-08-23 07:32:09 -0700132 MX51_PAD_NANDF_CS7__FEC_TX_EN,
133 MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK,
134
135 /* FEC PHY reset line */
Sascha Haueree1ae4d2010-12-15 09:56:35 +0100136 MX51_PAD_EIM_A20__GPIO2_14,
Shawn Guo72230662010-10-22 00:55:20 +0800137
138 /* SD 1 */
139 MX51_PAD_SD1_CMD__SD1_CMD,
140 MX51_PAD_SD1_CLK__SD1_CLK,
141 MX51_PAD_SD1_DATA0__SD1_DATA0,
142 MX51_PAD_SD1_DATA1__SD1_DATA1,
143 MX51_PAD_SD1_DATA2__SD1_DATA2,
144 MX51_PAD_SD1_DATA3__SD1_DATA3,
Shawn Guo913413c2011-06-21 22:41:51 +0800145 /* CD/WP from controller */
146 MX51_PAD_GPIO1_0__SD1_CD,
147 MX51_PAD_GPIO1_1__SD1_WP,
Shawn Guo72230662010-10-22 00:55:20 +0800148
149 /* SD 2 */
150 MX51_PAD_SD2_CMD__SD2_CMD,
151 MX51_PAD_SD2_CLK__SD2_CLK,
152 MX51_PAD_SD2_DATA0__SD2_DATA0,
153 MX51_PAD_SD2_DATA1__SD2_DATA1,
154 MX51_PAD_SD2_DATA2__SD2_DATA2,
155 MX51_PAD_SD2_DATA3__SD2_DATA3,
Shawn Guo913413c2011-06-21 22:41:51 +0800156 /* CD/WP gpio */
Andre Silva6ecdc112011-06-10 13:15:20 -0300157 MX51_PAD_GPIO1_6__GPIO1_6,
158 MX51_PAD_GPIO1_5__GPIO1_5,
Fabio Estevam374daa42010-11-10 07:00:02 -0800159
160 /* eCSPI1 */
161 MX51_PAD_CSPI1_MISO__ECSPI1_MISO,
162 MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI,
163 MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK,
Sascha Haueree1ae4d2010-12-15 09:56:35 +0100164 MX51_PAD_CSPI1_SS0__GPIO4_24,
165 MX51_PAD_CSPI1_SS1__GPIO4_25,
Shawn Guobf22e532012-05-11 13:05:43 +0800166
167 /* Audio */
168 MX51_PAD_AUD3_BB_TXD__AUD3_TXD,
169 MX51_PAD_AUD3_BB_RXD__AUD3_RXD,
170 MX51_PAD_AUD3_BB_CK__AUD3_TXC,
171 MX51_PAD_AUD3_BB_FS__AUD3_TXFS,
Amit Kucheriab996b582010-02-02 11:57:53 -0800172};
173
174/* Serial ports */
Uwe Kleine-König04b73b152010-08-11 22:23:06 +0200175static const struct imxuart_platform_data uart_pdata __initconst = {
Amit Kucheriab996b582010-02-02 11:57:53 -0800176 .flags = IMXUART_HAVE_RTSCTS,
177};
178
Uwe Kleine-König44505c02010-09-30 16:44:53 +0200179static const struct imxi2c_platform_data babbage_i2c_data __initconst = {
Dinh Nguyenf00b7712010-05-27 10:45:05 -0500180 .bitrate = 100000,
181};
182
Uwe Kleine-Königf2688852011-08-01 09:07:54 +0200183static const struct imxi2c_platform_data babbage_hsi2c_data __initconst = {
Dinh Nguyenf00b7712010-05-27 10:45:05 -0500184 .bitrate = 400000,
185};
186
Fabio Estevam72370a52011-05-28 10:54:36 -0300187static struct gpio mx51_babbage_usbh1_gpios[] = {
188 { BABBAGE_USBH1_STP, GPIOF_OUT_INIT_LOW, "usbh1_stp" },
189 { BABBAGE_USB_PHY_RESET, GPIOF_OUT_INIT_LOW, "usbh1_phy_reset" },
190};
191
Dinh Nguyen231637f2010-04-30 15:48:25 -0500192static int gpio_usbh1_active(void)
193{
Sascha Haueree1ae4d2010-12-15 09:56:35 +0100194 iomux_v3_cfg_t usbh1stp_gpio = MX51_PAD_USBH1_STP__GPIO1_27;
Dinh Nguyen231637f2010-04-30 15:48:25 -0500195 int ret;
196
197 /* Set USBH1_STP to GPIO and toggle it */
Lothar Waßmann96f3e252010-11-22 09:39:51 +0100198 mxc_iomux_v3_setup_pad(usbh1stp_gpio);
Fabio Estevam72370a52011-05-28 10:54:36 -0300199 ret = gpio_request_array(mx51_babbage_usbh1_gpios,
200 ARRAY_SIZE(mx51_babbage_usbh1_gpios));
Dinh Nguyen231637f2010-04-30 15:48:25 -0500201
202 if (ret) {
Fabio Estevam72370a52011-05-28 10:54:36 -0300203 pr_debug("failed to get USBH1 pins: %d\n", ret);
Dinh Nguyen231637f2010-04-30 15:48:25 -0500204 return ret;
205 }
Fabio Estevam72370a52011-05-28 10:54:36 -0300206
Dinh Nguyen231637f2010-04-30 15:48:25 -0500207 msleep(100);
Fabio Estevam72370a52011-05-28 10:54:36 -0300208 gpio_set_value(BABBAGE_USBH1_STP, 1);
209 gpio_set_value(BABBAGE_USB_PHY_RESET, 1);
210 gpio_free_array(mx51_babbage_usbh1_gpios,
211 ARRAY_SIZE(mx51_babbage_usbh1_gpios));
Dinh Nguyen231637f2010-04-30 15:48:25 -0500212 return 0;
213}
214
215static inline void babbage_usbhub_reset(void)
216{
217 int ret;
218
Fabio Estevam6f9ec442011-03-17 12:55:57 -0300219 /* Reset USB hub */
220 ret = gpio_request_one(BABBAGE_USB_HUB_RESET,
221 GPIOF_OUT_INIT_LOW, "GPIO1_7");
Dinh Nguyen231637f2010-04-30 15:48:25 -0500222 if (ret) {
223 printk(KERN_ERR"failed to get GPIO_USB_HUB_RESET: %d\n", ret);
224 return;
225 }
Dinh Nguyen231637f2010-04-30 15:48:25 -0500226
Fabio Estevam6f9ec442011-03-17 12:55:57 -0300227 msleep(2);
228 /* Deassert reset */
Dinh Nguyen231637f2010-04-30 15:48:25 -0500229 gpio_set_value(BABBAGE_USB_HUB_RESET, 1);
230}
231
Fabio Estevam3efee472010-08-23 07:32:09 -0700232static inline void babbage_fec_reset(void)
233{
234 int ret;
235
236 /* reset FEC PHY */
Fabio Estevamce191e42011-03-16 22:52:31 -0300237 ret = gpio_request_one(BABBAGE_FEC_PHY_RESET,
238 GPIOF_OUT_INIT_LOW, "fec-phy-reset");
Fabio Estevam3efee472010-08-23 07:32:09 -0700239 if (ret) {
240 printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret);
241 return;
242 }
Fabio Estevam3efee472010-08-23 07:32:09 -0700243 msleep(1);
244 gpio_set_value(BABBAGE_FEC_PHY_RESET, 1);
245}
246
Dinh Nguyen231637f2010-04-30 15:48:25 -0500247/* This function is board specific as the bit mask for the plldiv will also
248be different for other Freescale SoCs, thus a common bitmask is not
249possible and cannot get place in /plat-mxc/ehci.c.*/
250static int initialize_otg_port(struct platform_device *pdev)
251{
252 u32 v;
253 void __iomem *usb_base;
Sascha Hauere7a895b2010-08-19 11:37:31 +0200254 void __iomem *usbother_base;
Dinh Nguyen231637f2010-04-30 15:48:25 -0500255
Uwe Kleine-König7d92e8e2011-07-30 23:41:49 +0200256 usb_base = ioremap(MX51_USB_OTG_BASE_ADDR, SZ_4K);
Fabio Estevam28a4f902010-12-13 10:47:05 -0200257 if (!usb_base)
258 return -ENOMEM;
Dinh Nguyen231637f2010-04-30 15:48:25 -0500259 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
260
261 /* Set the PHY clock to 19.2MHz */
262 v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
263 v &= ~MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK;
264 v |= MX51_USB_PLL_DIV_19_2_MHZ;
265 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
266 iounmap(usb_base);
Sascha Hauer4bd597b2011-01-03 11:30:28 +0100267
268 mdelay(10);
269
270 return mx51_initialize_usb_hw(0, MXC_EHCI_INTERNAL_PHY);
Dinh Nguyen231637f2010-04-30 15:48:25 -0500271}
272
273static int initialize_usbh1_port(struct platform_device *pdev)
274{
275 u32 v;
276 void __iomem *usb_base;
Sascha Hauere7a895b2010-08-19 11:37:31 +0200277 void __iomem *usbother_base;
Dinh Nguyen231637f2010-04-30 15:48:25 -0500278
Uwe Kleine-König7d92e8e2011-07-30 23:41:49 +0200279 usb_base = ioremap(MX51_USB_OTG_BASE_ADDR, SZ_4K);
Fabio Estevam28a4f902010-12-13 10:47:05 -0200280 if (!usb_base)
281 return -ENOMEM;
Dinh Nguyen231637f2010-04-30 15:48:25 -0500282 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
283
284 /* The clock for the USBH1 ULPI port will come externally from the PHY. */
285 v = __raw_readl(usbother_base + MX51_USB_CTRL_1_OFFSET);
286 __raw_writel(v | MX51_USB_CTRL_UH1_EXT_CLK_EN, usbother_base + MX51_USB_CTRL_1_OFFSET);
287 iounmap(usb_base);
Sascha Hauer4bd597b2011-01-03 11:30:28 +0100288
289 mdelay(10);
290
291 return mx51_initialize_usb_hw(1, MXC_EHCI_POWER_PINS_ENABLED |
292 MXC_EHCI_ITC_NO_THRESHOLD);
Dinh Nguyen231637f2010-04-30 15:48:25 -0500293}
294
Uwe Kleine-König7d92e8e2011-07-30 23:41:49 +0200295static const struct mxc_usbh_platform_data dr_utmi_config __initconst = {
Dinh Nguyen231637f2010-04-30 15:48:25 -0500296 .init = initialize_otg_port,
297 .portsc = MXC_EHCI_UTMI_16BIT,
Dinh Nguyen231637f2010-04-30 15:48:25 -0500298};
299
Uwe Kleine-König6cafe482011-07-30 23:57:25 +0200300static const struct fsl_usb2_platform_data usb_pdata __initconst = {
Dinh Nguyen2ba5a2c2010-05-10 13:45:59 -0500301 .operating_mode = FSL_USB2_DR_DEVICE,
302 .phy_mode = FSL_USB2_PHY_UTMI_WIDE,
303};
304
Uwe Kleine-König7d92e8e2011-07-30 23:41:49 +0200305static const struct mxc_usbh_platform_data usbh1_config __initconst = {
Dinh Nguyen231637f2010-04-30 15:48:25 -0500306 .init = initialize_usbh1_port,
307 .portsc = MXC_EHCI_MODE_ULPI,
Dinh Nguyen231637f2010-04-30 15:48:25 -0500308};
309
Benoît Thébaudeau33a264d2012-06-12 19:46:43 +0200310static bool otg_mode_host __initdata;
Dinh Nguyen2ba5a2c2010-05-10 13:45:59 -0500311
312static int __init babbage_otg_mode(char *options)
313{
314 if (!strcmp(options, "host"))
Benoît Thébaudeau33a264d2012-06-12 19:46:43 +0200315 otg_mode_host = true;
Dinh Nguyen2ba5a2c2010-05-10 13:45:59 -0500316 else if (!strcmp(options, "device"))
Benoît Thébaudeau33a264d2012-06-12 19:46:43 +0200317 otg_mode_host = false;
Dinh Nguyen2ba5a2c2010-05-10 13:45:59 -0500318 else
319 pr_info("otg_mode neither \"host\" nor \"device\". "
320 "Defaulting to device\n");
Benoît Thébaudeau33a264d2012-06-12 19:46:43 +0200321 return 1;
Dinh Nguyen2ba5a2c2010-05-10 13:45:59 -0500322}
323__setup("otg_mode=", babbage_otg_mode);
324
Fabio Estevam374daa42010-11-10 07:00:02 -0800325static struct spi_board_info mx51_babbage_spi_board_info[] __initdata = {
326 {
327 .modalias = "mtd_dataflash",
328 .max_speed_hz = 25000000,
329 .bus_num = 0,
330 .chip_select = 1,
331 .mode = SPI_MODE_0,
332 .platform_data = NULL,
333 },
334};
335
336static int mx51_babbage_spi_cs[] = {
337 BABBAGE_ECSPI1_CS0,
338 BABBAGE_ECSPI1_CS1,
339};
340
341static const struct spi_imx_master mx51_babbage_spi_pdata __initconst = {
342 .chipselect = mx51_babbage_spi_cs,
343 .num_chipselect = ARRAY_SIZE(mx51_babbage_spi_cs),
344};
345
Andre Silva6ecdc112011-06-10 13:15:20 -0300346static const struct esdhc_platform_data mx51_babbage_sd1_data __initconst = {
Shawn Guo913413c2011-06-21 22:41:51 +0800347 .cd_type = ESDHC_CD_CONTROLLER,
348 .wp_type = ESDHC_WP_CONTROLLER,
Andre Silva6ecdc112011-06-10 13:15:20 -0300349};
350
351static const struct esdhc_platform_data mx51_babbage_sd2_data __initconst = {
352 .cd_gpio = BABBAGE_SD2_CD,
353 .wp_gpio = BABBAGE_SD2_WP,
Shawn Guo913413c2011-06-21 22:41:51 +0800354 .cd_type = ESDHC_CD_GPIO,
355 .wp_type = ESDHC_WP_GPIO,
Andre Silva6ecdc112011-06-10 13:15:20 -0300356};
357
Shawn Guo9daaf312011-10-17 08:42:17 +0800358void __init imx51_babbage_common_init(void)
359{
360 mxc_iomux_v3_setup_multiple_pads(mx51babbage_pads,
361 ARRAY_SIZE(mx51babbage_pads));
362}
363
Amit Kucheriab996b582010-02-02 11:57:53 -0800364/*
365 * Board specific initialization.
366 */
Uwe Kleine-Könige134fb22011-02-11 10:23:19 +0100367static void __init mx51_babbage_init(void)
Amit Kucheriab996b582010-02-02 11:57:53 -0800368{
Lothar Waßmann8f5260c2010-10-26 14:28:31 +0200369 iomux_v3_cfg_t usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP;
Troy Kisky7242e242011-08-13 12:51:41 -0700370 iomux_v3_cfg_t power_key = NEW_PAD_CTRL(MX51_PAD_EIM_A27__GPIO2_21,
Shawn Guo847a2ee2011-12-05 10:28:11 +0800371 PAD_CTL_SRE_FAST | PAD_CTL_DSE_HIGH);
Dinh Nguyen231637f2010-04-30 15:48:25 -0500372
Shawn Guob78d8e52011-06-06 00:07:55 +0800373 imx51_soc_init();
374
Yong Shen64f102b2010-10-21 21:18:59 +0800375#if defined(CONFIG_CPU_FREQ_IMX)
376 get_cpu_op = mx51_get_cpu_op;
377#endif
Shawn Guo9daaf312011-10-17 08:42:17 +0800378 imx51_babbage_common_init();
Sascha Hauer27d2d622011-01-14 11:30:33 +0100379
380 imx51_add_imx_uart(0, &uart_pdata);
Fabio Estevam1c4b45d2011-07-25 17:46:31 -0300381 imx51_add_imx_uart(1, NULL);
Sascha Hauer27d2d622011-01-14 11:30:33 +0100382 imx51_add_imx_uart(2, &uart_pdata);
383
Fabio Estevam3efee472010-08-23 07:32:09 -0700384 babbage_fec_reset();
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +0200385 imx51_add_fec(NULL);
Dinh Nguyen231637f2010-04-30 15:48:25 -0500386
Dinh Nguyenf2d36ecb2010-10-23 09:12:47 -0500387 /* Set the PAD settings for the pwr key. */
Lothar Waßmann96f3e252010-11-22 09:39:51 +0100388 mxc_iomux_v3_setup_pad(power_key);
Fabio Estevamba8a6c02011-04-06 13:05:26 -0300389 imx_add_gpio_keys(&imx_button_data);
Dinh Nguyenf2d36ecb2010-10-23 09:12:47 -0500390
Uwe Kleine-König44505c02010-09-30 16:44:53 +0200391 imx51_add_imx_i2c(0, &babbage_i2c_data);
392 imx51_add_imx_i2c(1, &babbage_i2c_data);
Uwe Kleine-Königf2688852011-08-01 09:07:54 +0200393 imx51_add_hsi2c(&babbage_hsi2c_data);
Dinh Nguyenf00b7712010-05-27 10:45:05 -0500394
Dinh Nguyen2ba5a2c2010-05-10 13:45:59 -0500395 if (otg_mode_host)
Uwe Kleine-König7d92e8e2011-07-30 23:41:49 +0200396 imx51_add_mxc_ehci_otg(&dr_utmi_config);
Dinh Nguyen2ba5a2c2010-05-10 13:45:59 -0500397 else {
398 initialize_otg_port(NULL);
Uwe Kleine-König6cafe482011-07-30 23:57:25 +0200399 imx51_add_fsl_usb2_udc(&usb_pdata);
Dinh Nguyen2ba5a2c2010-05-10 13:45:59 -0500400 }
Dinh Nguyen231637f2010-04-30 15:48:25 -0500401
402 gpio_usbh1_active();
Uwe Kleine-König7d92e8e2011-07-30 23:41:49 +0200403 imx51_add_mxc_ehci_hs(1, &usbh1_config);
Dinh Nguyen231637f2010-04-30 15:48:25 -0500404 /* setback USBH1_STP to be function */
Lothar Waßmann96f3e252010-11-22 09:39:51 +0100405 mxc_iomux_v3_setup_pad(usbh1stp);
Dinh Nguyen231637f2010-04-30 15:48:25 -0500406 babbage_usbhub_reset();
Shawn Guo72230662010-10-22 00:55:20 +0800407
Andre Silva6ecdc112011-06-10 13:15:20 -0300408 imx51_add_sdhci_esdhc_imx(0, &mx51_babbage_sd1_data);
409 imx51_add_sdhci_esdhc_imx(1, &mx51_babbage_sd2_data);
Fabio Estevam374daa42010-11-10 07:00:02 -0800410
411 spi_register_board_info(mx51_babbage_spi_board_info,
412 ARRAY_SIZE(mx51_babbage_spi_board_info));
413 imx51_add_ecspi(0, &mx51_babbage_spi_pdata);
Benoît Thébaudeaubec31a82012-07-04 16:35:54 +0200414 imx51_add_imx2_wdt(0);
Amit Kucheriab996b582010-02-02 11:57:53 -0800415}
416
417static void __init mx51_babbage_timer_init(void)
418{
Fabio Estevam82d52a12010-02-17 12:02:56 -0800419 mx51_clocks_init(32768, 24000000, 22579200, 0);
Amit Kucheriab996b582010-02-02 11:57:53 -0800420}
421
Uwe Kleine-Könige134fb22011-02-11 10:23:19 +0100422static struct sys_timer mx51_babbage_timer = {
423 .init = mx51_babbage_timer_init,
Amit Kucheriab996b582010-02-02 11:57:53 -0800424};
425
426MACHINE_START(MX51_BABBAGE, "Freescale MX51 Babbage Board")
427 /* Maintainer: Amit Kucheria <amit.kucheria@canonical.com> */
Nicolas Pitre61929352011-07-05 22:38:14 -0400428 .atag_offset = 0x100,
Amit Kucheriab996b582010-02-02 11:57:53 -0800429 .map_io = mx51_map_io,
Uwe Kleine-Königab1304212011-02-07 16:35:21 +0100430 .init_early = imx51_init_early,
Amit Kucheriab996b582010-02-02 11:57:53 -0800431 .init_irq = mx51_init_irq,
Sascha Hauerffa2ea32011-09-20 14:31:24 +0200432 .handle_irq = imx51_handle_irq,
Uwe Kleine-Könige134fb22011-02-11 10:23:19 +0100433 .timer = &mx51_babbage_timer,
434 .init_machine = mx51_babbage_init,
Shawn Guo8321b752012-04-26 11:42:34 +0800435 .init_late = imx51_init_late,
Russell King65ea7882011-11-06 17:12:08 +0000436 .restart = mxc_restart,
Amit Kucheriab996b582010-02-02 11:57:53 -0800437MACHINE_END