blob: d1a04bafb432830bff27441a2decb734acfd48bd [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>
Eric Bénard6f1fa702010-06-08 11:03:01 +020029
Eric Bénard95afd092010-07-23 14:56:40 +020030#include <mach/eukrea-baseboards.h>
Eric Bénard6f1fa702010-06-08 11:03:01 +020031#include <mach/hardware.h>
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <asm/mach/time.h>
35#include <asm/memory.h>
36#include <asm/mach/map.h>
37#include <mach/common.h>
Eric Bénard6f1fa702010-06-08 11:03:01 +020038#include <mach/mx25.h>
39#include <mach/mxc_nand.h>
40#include <mach/imxfb.h>
Eric Bénard6f1fa702010-06-08 11:03:01 +020041#include <mach/iomux-mx25.h>
42
Uwe Kleine-König2dcf78c2010-06-30 12:16:24 +020043#include "devices-imx25.h"
44#include "devices.h"
45
46static const struct imxuart_platform_data uart_pdata __initconst = {
Eric Bénard6f1fa702010-06-08 11:03:01 +020047 .flags = IMXUART_HAVE_RTSCTS,
48};
49
50static struct pad_desc eukrea_cpuimx25_pads[] = {
51 /* FEC - RMII */
52 MX25_PAD_FEC_MDC__FEC_MDC,
53 MX25_PAD_FEC_MDIO__FEC_MDIO,
54 MX25_PAD_FEC_TDATA0__FEC_TDATA0,
55 MX25_PAD_FEC_TDATA1__FEC_TDATA1,
56 MX25_PAD_FEC_TX_EN__FEC_TX_EN,
57 MX25_PAD_FEC_RDATA0__FEC_RDATA0,
58 MX25_PAD_FEC_RDATA1__FEC_RDATA1,
59 MX25_PAD_FEC_RX_DV__FEC_RX_DV,
60 MX25_PAD_FEC_TX_CLK__FEC_TX_CLK,
61 /* I2C1 */
62 MX25_PAD_I2C1_CLK__I2C1_CLK,
63 MX25_PAD_I2C1_DAT__I2C1_DAT,
64};
65
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020066static const struct fec_platform_data mx25_fec_pdata __initconst = {
Eric Bénard6f1fa702010-06-08 11:03:01 +020067 .phy = PHY_INTERFACE_MODE_RMII,
68};
69
Uwe Kleine-König2dcf78c2010-06-30 12:16:24 +020070static const struct mxc_nand_platform_data
71eukrea_cpuimx25_nand_board_info __initconst = {
Eric Bénard6f1fa702010-06-08 11:03:01 +020072 .width = 1,
73 .hw_ecc = 1,
74 .flash_bbt = 1,
75};
76
Uwe Kleine-König2dcf78c2010-06-30 12:16:24 +020077static const struct imxi2c_platform_data
78eukrea_cpuimx25_i2c0_data __initconst = {
Eric Bénard6f1fa702010-06-08 11:03:01 +020079 .bitrate = 100000,
80};
81
82static struct i2c_board_info eukrea_cpuimx25_i2c_devices[] = {
83 {
84 I2C_BOARD_INFO("pcf8563", 0x51),
85 },
86};
87
Uwe Kleine-König2c20b9f2010-11-10 21:27:55 +010088static const struct mxc_usbh_platform_data otg_pdata __initconst = {
Eric Bénard6f1fa702010-06-08 11:03:01 +020089 .portsc = MXC_EHCI_MODE_UTMI,
90 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
91};
92
Uwe Kleine-König2c20b9f2010-11-10 21:27:55 +010093static const struct mxc_usbh_platform_data usbh2_pdata __initconst = {
Eric Bénard6f1fa702010-06-08 11:03:01 +020094 .portsc = MXC_EHCI_MODE_SERIAL,
95 .flags = MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY |
96 MXC_EHCI_IPPUE_DOWN,
97};
98
Uwe Kleine-König224b8c82010-11-10 21:50:07 +010099static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
Eric Bénard6f1fa702010-06-08 11:03:01 +0200100 .operating_mode = FSL_USB2_DR_DEVICE,
101 .phy_mode = FSL_USB2_PHY_UTMI,
102};
103
104static int otg_mode_host;
105
106static int __init eukrea_cpuimx25_otg_mode(char *options)
107{
108 if (!strcmp(options, "host"))
109 otg_mode_host = 1;
110 else if (!strcmp(options, "device"))
111 otg_mode_host = 0;
112 else
113 pr_info("otg_mode neither \"host\" nor \"device\". "
114 "Defaulting to device\n");
115 return 0;
116}
117__setup("otg_mode=", eukrea_cpuimx25_otg_mode);
118
119static void __init eukrea_cpuimx25_init(void)
120{
121 if (mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads,
122 ARRAY_SIZE(eukrea_cpuimx25_pads)))
123 printk(KERN_ERR "error setting cpuimx25 pads !\n");
124
Uwe Kleine-König2dcf78c2010-06-30 12:16:24 +0200125 imx25_add_imx_uart0(&uart_pdata);
126 imx25_add_mxc_nand(&eukrea_cpuimx25_nand_board_info);
Uwe Kleine-Könige7c74b32010-11-11 11:57:21 +0100127 imx25_add_imxdi_rtc(NULL);
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +0200128 imx25_add_fec(&mx25_fec_pdata);
Eric Bénard6f1fa702010-06-08 11:03:01 +0200129
130 i2c_register_board_info(0, eukrea_cpuimx25_i2c_devices,
131 ARRAY_SIZE(eukrea_cpuimx25_i2c_devices));
Uwe Kleine-König2dcf78c2010-06-30 12:16:24 +0200132 imx25_add_imx_i2c0(&eukrea_cpuimx25_i2c0_data);
Eric Bénard6f1fa702010-06-08 11:03:01 +0200133
Eric Bénard52d084f2010-10-05 18:02:30 +0200134 if (otg_mode_host)
Uwe Kleine-König2c20b9f2010-11-10 21:27:55 +0100135 imx25_add_mxc_ehci_otg(&otg_pdata);
Eric Bénard52d084f2010-10-05 18:02:30 +0200136 else
Uwe Kleine-König224b8c82010-11-10 21:50:07 +0100137 imx25_add_fsl_usb2_udc(&otg_device_pdata);
Eric Bénard6f1fa702010-06-08 11:03:01 +0200138
Uwe Kleine-König2c20b9f2010-11-10 21:27:55 +0100139 imx25_add_mxc_ehci_hs(&usbh2_pdata);
Eric Bénard52d084f2010-10-05 18:02:30 +0200140
Eric Bénardec53fe32010-07-30 22:58:40 +0200141#ifdef CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD
142 eukrea_mbimxsd25_baseboard_init();
Eric Bénard6f1fa702010-06-08 11:03:01 +0200143#endif
144}
145
146static void __init eukrea_cpuimx25_timer_init(void)
147{
148 mx25_clocks_init();
149}
150
151static struct sys_timer eukrea_cpuimx25_timer = {
152 .init = eukrea_cpuimx25_timer_init,
153};
154
155MACHINE_START(EUKREA_CPUIMX25, "Eukrea CPUIMX25")
156 /* Maintainer: Eukrea Electromatique */
Eric Bénard6f1fa702010-06-08 11:03:01 +0200157 .boot_params = MX25_PHYS_OFFSET + 0x100,
158 .map_io = mx25_map_io,
159 .init_irq = mx25_init_irq,
160 .init_machine = eukrea_cpuimx25_init,
161 .timer = &eukrea_cpuimx25_timer,
162MACHINE_END