blob: 0ee0fe73952d4fbcf4aacb90829645f718bbbdd2 [file] [log] [blame]
Eric Bénard6f1fa702010-06-08 11:03:01 +02001/*
2 * Copyright 2009 Sascha Hauer, <kernel@pengutronix.de>
3 * Copyright 2010 Eric Bénard - Eukréa Electromatique, <eric@eukrea.com>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#include <linux/types.h>
21#include <linux/init.h>
22#include <linux/delay.h>
23#include <linux/clk.h>
24#include <linux/irq.h>
25#include <linux/gpio.h>
Eric Bénard6f1fa702010-06-08 11:03:01 +020026#include <linux/platform_device.h>
27#include <linux/usb/otg.h>
28#include <linux/usb/ulpi.h>
29#include <linux/fsl_devices.h>
30
Eric Bénard95afd092010-07-23 14:56:40 +020031#include <mach/eukrea-baseboards.h>
Eric Bénard6f1fa702010-06-08 11:03:01 +020032#include <mach/hardware.h>
33#include <asm/mach-types.h>
34#include <asm/mach/arch.h>
35#include <asm/mach/time.h>
36#include <asm/memory.h>
37#include <asm/mach/map.h>
38#include <mach/common.h>
Eric Bénard6f1fa702010-06-08 11:03:01 +020039#include <mach/mx25.h>
40#include <mach/mxc_nand.h>
41#include <mach/imxfb.h>
Eric Bénard6f1fa702010-06-08 11:03:01 +020042#include <mach/iomux-mx25.h>
43
Uwe Kleine-König2dcf78c2010-06-30 12:16:24 +020044#include "devices-imx25.h"
45#include "devices.h"
46
47static const struct imxuart_platform_data uart_pdata __initconst = {
Eric Bénard6f1fa702010-06-08 11:03:01 +020048 .flags = IMXUART_HAVE_RTSCTS,
49};
50
51static struct pad_desc eukrea_cpuimx25_pads[] = {
52 /* FEC - RMII */
53 MX25_PAD_FEC_MDC__FEC_MDC,
54 MX25_PAD_FEC_MDIO__FEC_MDIO,
55 MX25_PAD_FEC_TDATA0__FEC_TDATA0,
56 MX25_PAD_FEC_TDATA1__FEC_TDATA1,
57 MX25_PAD_FEC_TX_EN__FEC_TX_EN,
58 MX25_PAD_FEC_RDATA0__FEC_RDATA0,
59 MX25_PAD_FEC_RDATA1__FEC_RDATA1,
60 MX25_PAD_FEC_RX_DV__FEC_RX_DV,
61 MX25_PAD_FEC_TX_CLK__FEC_TX_CLK,
62 /* I2C1 */
63 MX25_PAD_I2C1_CLK__I2C1_CLK,
64 MX25_PAD_I2C1_DAT__I2C1_DAT,
65};
66
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020067static const struct fec_platform_data mx25_fec_pdata __initconst = {
Eric Bénard6f1fa702010-06-08 11:03:01 +020068 .phy = PHY_INTERFACE_MODE_RMII,
69};
70
Uwe Kleine-König2dcf78c2010-06-30 12:16:24 +020071static const struct mxc_nand_platform_data
72eukrea_cpuimx25_nand_board_info __initconst = {
Eric Bénard6f1fa702010-06-08 11:03:01 +020073 .width = 1,
74 .hw_ecc = 1,
75 .flash_bbt = 1,
76};
77
Uwe Kleine-König2dcf78c2010-06-30 12:16:24 +020078static const struct imxi2c_platform_data
79eukrea_cpuimx25_i2c0_data __initconst = {
Eric Bénard6f1fa702010-06-08 11:03:01 +020080 .bitrate = 100000,
81};
82
83static struct i2c_board_info eukrea_cpuimx25_i2c_devices[] = {
84 {
85 I2C_BOARD_INFO("pcf8563", 0x51),
86 },
87};
88
Uwe Kleine-König2c20b9f2010-11-10 21:27:55 +010089static const struct mxc_usbh_platform_data otg_pdata __initconst = {
Eric Bénard6f1fa702010-06-08 11:03:01 +020090 .portsc = MXC_EHCI_MODE_UTMI,
91 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
92};
93
Uwe Kleine-König2c20b9f2010-11-10 21:27:55 +010094static const struct mxc_usbh_platform_data usbh2_pdata __initconst = {
Eric Bénard6f1fa702010-06-08 11:03:01 +020095 .portsc = MXC_EHCI_MODE_SERIAL,
96 .flags = MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY |
97 MXC_EHCI_IPPUE_DOWN,
98};
99
100static struct fsl_usb2_platform_data otg_device_pdata = {
101 .operating_mode = FSL_USB2_DR_DEVICE,
102 .phy_mode = FSL_USB2_PHY_UTMI,
103};
104
105static int otg_mode_host;
106
107static int __init eukrea_cpuimx25_otg_mode(char *options)
108{
109 if (!strcmp(options, "host"))
110 otg_mode_host = 1;
111 else if (!strcmp(options, "device"))
112 otg_mode_host = 0;
113 else
114 pr_info("otg_mode neither \"host\" nor \"device\". "
115 "Defaulting to device\n");
116 return 0;
117}
118__setup("otg_mode=", eukrea_cpuimx25_otg_mode);
119
120static void __init eukrea_cpuimx25_init(void)
121{
122 if (mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads,
123 ARRAY_SIZE(eukrea_cpuimx25_pads)))
124 printk(KERN_ERR "error setting cpuimx25 pads !\n");
125
Uwe Kleine-König2dcf78c2010-06-30 12:16:24 +0200126 imx25_add_imx_uart0(&uart_pdata);
127 imx25_add_mxc_nand(&eukrea_cpuimx25_nand_board_info);
Eric Bénard6f1fa702010-06-08 11:03:01 +0200128 mxc_register_device(&mx25_rtc_device, NULL);
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +0200129 imx25_add_fec(&mx25_fec_pdata);
Eric Bénard6f1fa702010-06-08 11:03:01 +0200130
131 i2c_register_board_info(0, eukrea_cpuimx25_i2c_devices,
132 ARRAY_SIZE(eukrea_cpuimx25_i2c_devices));
Uwe Kleine-König2dcf78c2010-06-30 12:16:24 +0200133 imx25_add_imx_i2c0(&eukrea_cpuimx25_i2c0_data);
Eric Bénard6f1fa702010-06-08 11:03:01 +0200134
Eric Bénard52d084f2010-10-05 18:02:30 +0200135 if (otg_mode_host)
Uwe Kleine-König2c20b9f2010-11-10 21:27:55 +0100136 imx25_add_mxc_ehci_otg(&otg_pdata);
Eric Bénard52d084f2010-10-05 18:02:30 +0200137 else
Eric Bénard6f1fa702010-06-08 11:03:01 +0200138 mxc_register_device(&otg_udc_device, &otg_device_pdata);
139
Uwe Kleine-König2c20b9f2010-11-10 21:27:55 +0100140 imx25_add_mxc_ehci_hs(&usbh2_pdata);
Eric Bénard52d084f2010-10-05 18:02:30 +0200141
Eric Bénardec53fe32010-07-30 22:58:40 +0200142#ifdef CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD
143 eukrea_mbimxsd25_baseboard_init();
Eric Bénard6f1fa702010-06-08 11:03:01 +0200144#endif
145}
146
147static void __init eukrea_cpuimx25_timer_init(void)
148{
149 mx25_clocks_init();
150}
151
152static struct sys_timer eukrea_cpuimx25_timer = {
153 .init = eukrea_cpuimx25_timer_init,
154};
155
156MACHINE_START(EUKREA_CPUIMX25, "Eukrea CPUIMX25")
157 /* Maintainer: Eukrea Electromatique */
Eric Bénard6f1fa702010-06-08 11:03:01 +0200158 .boot_params = MX25_PHYS_OFFSET + 0x100,
159 .map_io = mx25_map_io,
160 .init_irq = mx25_init_irq,
161 .init_machine = eukrea_cpuimx25_init,
162 .timer = &eukrea_cpuimx25_timer,
163MACHINE_END