Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mach-cpuimx35.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 Eric Benard - [email protected]
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/i2c-gpio.h>
34 
35 #include <asm/mach-types.h>
36 #include <asm/mach/arch.h>
37 #include <asm/mach/time.h>
38 #include <asm/mach/map.h>
39 
40 #include <mach/eukrea-baseboards.h>
41 #include <mach/hardware.h>
42 #include <mach/common.h>
43 #include <mach/iomux-mx35.h>
44 
45 #include "devices-imx35.h"
46 
47 static const struct imxuart_platform_data uart_pdata __initconst = {
48  .flags = IMXUART_HAVE_RTSCTS,
49 };
50 
51 static const struct imxi2c_platform_data
52  eukrea_cpuimx35_i2c0_data __initconst = {
53  .bitrate = 100000,
54 };
55 
56 #define TSC2007_IRQGPIO IMX_GPIO_NR(3, 2)
57 static int tsc2007_get_pendown_state(void)
58 {
60 }
61 
62 static struct tsc2007_platform_data tsc2007_info = {
63  .model = 2007,
64  .x_plate_ohms = 180,
65  .get_pendown_state = tsc2007_get_pendown_state,
66 };
67 
68 static struct i2c_board_info eukrea_cpuimx35_i2c_devices[] = {
69  {
70  I2C_BOARD_INFO("pcf8563", 0x51),
71  }, {
72  I2C_BOARD_INFO("tsc2007", 0x48),
73  .platform_data = &tsc2007_info,
74  /* irq number is run-time assigned */
75  },
76 };
77 
78 static iomux_v3_cfg_t eukrea_cpuimx35_pads[] = {
79  /* UART1 */
84  /* FEC */
103  /* I2C1 */
106  /* TSC2007 IRQ */
108 };
109 
110 static const struct mxc_nand_platform_data
111  eukrea_cpuimx35_nand_board_info __initconst = {
112  .width = 1,
113  .hw_ecc = 1,
114  .flash_bbt = 1,
115 };
116 
117 static int eukrea_cpuimx35_otg_init(struct platform_device *pdev)
118 {
120 }
121 
122 static const struct mxc_usbh_platform_data otg_pdata __initconst = {
123  .init = eukrea_cpuimx35_otg_init,
124  .portsc = MXC_EHCI_MODE_UTMI,
125 };
126 
127 static int eukrea_cpuimx35_usbh1_init(struct platform_device *pdev)
128 {
131 }
132 
133 static const struct mxc_usbh_platform_data usbh1_pdata __initconst = {
134  .init = eukrea_cpuimx35_usbh1_init,
135  .portsc = MXC_EHCI_MODE_SERIAL,
136 };
137 
138 static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
139  .operating_mode = FSL_USB2_DR_DEVICE,
140  .phy_mode = FSL_USB2_PHY_UTMI,
141  .workaround = FLS_USB2_WORKAROUND_ENGCM09152,
142 };
143 
144 static bool otg_mode_host __initdata;
145 
146 static int __init eukrea_cpuimx35_otg_mode(char *options)
147 {
148  if (!strcmp(options, "host"))
149  otg_mode_host = true;
150  else if (!strcmp(options, "device"))
151  otg_mode_host = false;
152  else
153  pr_info("otg_mode neither \"host\" nor \"device\". "
154  "Defaulting to device\n");
155  return 1;
156 }
157 __setup("otg_mode=", eukrea_cpuimx35_otg_mode);
158 
159 /*
160  * Board specific initialization.
161  */
162 static void __init eukrea_cpuimx35_init(void)
163 {
164  imx35_soc_init();
165 
166  mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx35_pads,
167  ARRAY_SIZE(eukrea_cpuimx35_pads));
168 
171 
172  imx35_add_imx_uart0(&uart_pdata);
173  imx35_add_mxc_nand(&eukrea_cpuimx35_nand_board_info);
174 
175  eukrea_cpuimx35_i2c_devices[1].irq = gpio_to_irq(TSC2007_IRQGPIO);
176  i2c_register_board_info(0, eukrea_cpuimx35_i2c_devices,
177  ARRAY_SIZE(eukrea_cpuimx35_i2c_devices));
178  imx35_add_imx_i2c0(&eukrea_cpuimx35_i2c0_data);
179 
180  if (otg_mode_host)
181  imx35_add_mxc_ehci_otg(&otg_pdata);
182  else
183  imx35_add_fsl_usb2_udc(&otg_device_pdata);
184 
185  imx35_add_mxc_ehci_hs(&usbh1_pdata);
186 
187 #ifdef CONFIG_MACH_EUKREA_MBIMXSD35_BASEBOARD
189 #endif
190 }
191 
192 static void __init eukrea_cpuimx35_timer_init(void)
193 {
195 }
196 
197 static struct sys_timer eukrea_cpuimx35_timer = {
198  .init = eukrea_cpuimx35_timer_init,
199 };
200 
201 MACHINE_START(EUKREA_CPUIMX35SD, "Eukrea CPUIMX35")
202  /* Maintainer: Eukrea Electromatique */
203  .atag_offset = 0x100,
204  .map_io = mx35_map_io,
205  .init_early = imx35_init_early,
206  .init_irq = mx35_init_irq,
207  .handle_irq = imx35_handle_irq,
208  .timer = &eukrea_cpuimx35_timer,
209  .init_machine = eukrea_cpuimx35_init,
210  .restart = mxc_restart,