blob: bf2d6e2ec0d6f1977c9de8c54855298c83ca3afb [file] [log] [blame]
Eric Bénard21744f12010-06-10 16:07:50 +02001/*
2 * Copyright (C) 2010 Eric Benard - eric@eukrea.com
3 * Copyright (C) 2009 Sascha Hauer, Pengutronix
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <linux/types.h>
21#include <linux/init.h>
22
23#include <linux/platform_device.h>
24#include <linux/mtd/physmap.h>
25#include <linux/memory.h>
26#include <linux/gpio.h>
27#include <linux/interrupt.h>
28#include <linux/delay.h>
29#include <linux/i2c.h>
30#include <linux/i2c/tsc2007.h>
31#include <linux/usb/otg.h>
32#include <linux/usb/ulpi.h>
33#include <linux/fsl_devices.h>
Eric Bénard54dc3f42010-10-02 17:15:26 +020034#include <linux/i2c-gpio.h>
Eric Bénard21744f12010-06-10 16:07:50 +020035
36#include <asm/mach-types.h>
37#include <asm/mach/arch.h>
38#include <asm/mach/time.h>
39#include <asm/mach/map.h>
40
Eric Bénard95afd092010-07-23 14:56:40 +020041#include <mach/eukrea-baseboards.h>
Eric Bénard21744f12010-06-10 16:07:50 +020042#include <mach/hardware.h>
43#include <mach/common.h>
Eric Bénard21744f12010-06-10 16:07:50 +020044#include <mach/iomux-mx35.h>
45#include <mach/mxc_nand.h>
46#include <mach/mxc_ehci.h>
Eric Bénard21744f12010-06-10 16:07:50 +020047
Uwe Kleine-König2dcf78c2010-06-30 12:16:24 +020048#include "devices-imx35.h"
Eric Bénard21744f12010-06-10 16:07:50 +020049#include "devices.h"
50
Uwe Kleine-König2dcf78c2010-06-30 12:16:24 +020051static const struct imxuart_platform_data uart_pdata __initconst = {
Eric Bénard21744f12010-06-10 16:07:50 +020052 .flags = IMXUART_HAVE_RTSCTS,
53};
54
Uwe Kleine-König2dcf78c2010-06-30 12:16:24 +020055static const struct imxi2c_platform_data
Eric Bénard54dc3f42010-10-02 17:15:26 +020056 eukrea_cpuimx35_i2c0_data __initconst = {
57 .bitrate = 100000,
Eric Bénard21744f12010-06-10 16:07:50 +020058};
59
Eric Bénard21744f12010-06-10 16:07:50 +020060static struct tsc2007_platform_data tsc2007_info = {
61 .model = 2007,
62 .x_plate_ohms = 180,
Eric Bénard21744f12010-06-10 16:07:50 +020063};
64
Eric Bénard54dc3f42010-10-02 17:15:26 +020065#define TSC2007_IRQGPIO (2 * 32 + 2)
Eric Bénard21744f12010-06-10 16:07:50 +020066static struct i2c_board_info eukrea_cpuimx35_i2c_devices[] = {
67 {
68 I2C_BOARD_INFO("pcf8563", 0x51),
69 }, {
70 I2C_BOARD_INFO("tsc2007", 0x48),
71 .type = "tsc2007",
72 .platform_data = &tsc2007_info,
73 .irq = gpio_to_irq(TSC2007_IRQGPIO),
74 },
75};
76
77static struct platform_device *devices[] __initdata = {
Eric Bénard21744f12010-06-10 16:07:50 +020078 &imx_wdt_device0,
79};
80
81static struct pad_desc eukrea_cpuimx35_pads[] = {
82 /* UART1 */
83 MX35_PAD_CTS1__UART1_CTS,
84 MX35_PAD_RTS1__UART1_RTS,
85 MX35_PAD_TXD1__UART1_TXD_MUX,
86 MX35_PAD_RXD1__UART1_RXD_MUX,
87 /* FEC */
88 MX35_PAD_FEC_TX_CLK__FEC_TX_CLK,
89 MX35_PAD_FEC_RX_CLK__FEC_RX_CLK,
90 MX35_PAD_FEC_RX_DV__FEC_RX_DV,
91 MX35_PAD_FEC_COL__FEC_COL,
92 MX35_PAD_FEC_RDATA0__FEC_RDATA_0,
93 MX35_PAD_FEC_TDATA0__FEC_TDATA_0,
94 MX35_PAD_FEC_TX_EN__FEC_TX_EN,
95 MX35_PAD_FEC_MDC__FEC_MDC,
96 MX35_PAD_FEC_MDIO__FEC_MDIO,
97 MX35_PAD_FEC_TX_ERR__FEC_TX_ERR,
98 MX35_PAD_FEC_RX_ERR__FEC_RX_ERR,
99 MX35_PAD_FEC_CRS__FEC_CRS,
100 MX35_PAD_FEC_RDATA1__FEC_RDATA_1,
101 MX35_PAD_FEC_TDATA1__FEC_TDATA_1,
102 MX35_PAD_FEC_RDATA2__FEC_RDATA_2,
103 MX35_PAD_FEC_TDATA2__FEC_TDATA_2,
104 MX35_PAD_FEC_RDATA3__FEC_RDATA_3,
105 MX35_PAD_FEC_TDATA3__FEC_TDATA_3,
106 /* I2C1 */
107 MX35_PAD_I2C1_CLK__I2C1_SCL,
108 MX35_PAD_I2C1_DAT__I2C1_SDA,
109 /* TSC2007 IRQ */
110 MX35_PAD_ATA_DA2__GPIO3_2,
111};
112
Uwe Kleine-König2dcf78c2010-06-30 12:16:24 +0200113static const struct mxc_nand_platform_data
Eric Bénard54dc3f42010-10-02 17:15:26 +0200114 eukrea_cpuimx35_nand_board_info __initconst = {
Eric Bénard21744f12010-06-10 16:07:50 +0200115 .width = 1,
116 .hw_ecc = 1,
117 .flash_bbt = 1,
118};
119
Uwe Kleine-König55fd2ef2010-10-06 12:00:19 +0200120static struct mxc_usbh_platform_data __maybe_unused otg_pdata = {
Eric Bénard21744f12010-06-10 16:07:50 +0200121 .portsc = MXC_EHCI_MODE_UTMI,
122 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
123};
124
Uwe Kleine-König55fd2ef2010-10-06 12:00:19 +0200125static struct mxc_usbh_platform_data __maybe_unused usbh1_pdata = {
Eric Bénard21744f12010-06-10 16:07:50 +0200126 .portsc = MXC_EHCI_MODE_SERIAL,
127 .flags = MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY |
128 MXC_EHCI_IPPUE_DOWN,
129};
130
131static struct fsl_usb2_platform_data otg_device_pdata = {
132 .operating_mode = FSL_USB2_DR_DEVICE,
133 .phy_mode = FSL_USB2_PHY_UTMI,
134};
135
136static int otg_mode_host;
137
138static int __init eukrea_cpuimx35_otg_mode(char *options)
139{
140 if (!strcmp(options, "host"))
141 otg_mode_host = 1;
142 else if (!strcmp(options, "device"))
143 otg_mode_host = 0;
144 else
145 pr_info("otg_mode neither \"host\" nor \"device\". "
146 "Defaulting to device\n");
147 return 0;
148}
149__setup("otg_mode=", eukrea_cpuimx35_otg_mode);
150
151/*
152 * Board specific initialization.
153 */
154static void __init mxc_board_init(void)
155{
156 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx35_pads,
157 ARRAY_SIZE(eukrea_cpuimx35_pads));
158
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +0200159 imx35_add_fec(NULL);
Eric Bénard21744f12010-06-10 16:07:50 +0200160 platform_add_devices(devices, ARRAY_SIZE(devices));
161
Uwe Kleine-König2dcf78c2010-06-30 12:16:24 +0200162 imx35_add_imx_uart0(&uart_pdata);
163 imx35_add_mxc_nand(&eukrea_cpuimx35_nand_board_info);
Eric Bénard21744f12010-06-10 16:07:50 +0200164
165 i2c_register_board_info(0, eukrea_cpuimx35_i2c_devices,
166 ARRAY_SIZE(eukrea_cpuimx35_i2c_devices));
Uwe Kleine-König2dcf78c2010-06-30 12:16:24 +0200167 imx35_add_imx_i2c0(&eukrea_cpuimx35_i2c0_data);
Eric Bénard21744f12010-06-10 16:07:50 +0200168
Eric Bénard52d084f2010-10-05 18:02:30 +0200169 if (otg_mode_host)
Eric Bénard21744f12010-06-10 16:07:50 +0200170 mxc_register_device(&mxc_otg_host, &otg_pdata);
Eric Bénard52d084f2010-10-05 18:02:30 +0200171 else
Eric Bénard21744f12010-06-10 16:07:50 +0200172 mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata);
173
Eric Bénard52d084f2010-10-05 18:02:30 +0200174 mxc_register_device(&mxc_usbh1, &usbh1_pdata);
175
Eric Bénardec53fe32010-07-30 22:58:40 +0200176#ifdef CONFIG_MACH_EUKREA_MBIMXSD35_BASEBOARD
177 eukrea_mbimxsd35_baseboard_init();
Eric Bénard21744f12010-06-10 16:07:50 +0200178#endif
179}
180
181static void __init eukrea_cpuimx35_timer_init(void)
182{
183 mx35_clocks_init();
184}
185
186struct sys_timer eukrea_cpuimx35_timer = {
187 .init = eukrea_cpuimx35_timer_init,
188};
189
190MACHINE_START(EUKREA_CPUIMX35, "Eukrea CPUIMX35")
191 /* Maintainer: Eukrea Electromatique */
192 .phys_io = MX35_AIPS1_BASE_ADDR,
193 .io_pg_offst = ((MX35_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
194 .boot_params = MX3x_PHYS_OFFSET + 0x100,
195 .map_io = mx35_map_io,
196 .init_irq = mx35_init_irq,
197 .init_machine = mxc_board_init,
198 .timer = &eukrea_cpuimx35_timer,
199MACHINE_END