Commit | Line | Data |
---|---|---|
21744f19 EB |
1 | /* |
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> | |
54dc3f46 | 33 | #include <linux/i2c-gpio.h> |
21744f19 EB |
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 | ||
95afd090 | 40 | #include <mach/eukrea-baseboards.h> |
21744f19 EB |
41 | #include <mach/hardware.h> |
42 | #include <mach/common.h> | |
21744f19 EB |
43 | #include <mach/iomux-mx35.h> |
44 | #include <mach/mxc_nand.h> | |
21744f19 | 45 | |
2dcf78c0 | 46 | #include "devices-imx35.h" |
21744f19 EB |
47 | #include "devices.h" |
48 | ||
2dcf78c0 | 49 | static const struct imxuart_platform_data uart_pdata __initconst = { |
21744f19 EB |
50 | .flags = IMXUART_HAVE_RTSCTS, |
51 | }; | |
52 | ||
2dcf78c0 | 53 | static const struct imxi2c_platform_data |
54dc3f46 EB |
54 | eukrea_cpuimx35_i2c0_data __initconst = { |
55 | .bitrate = 100000, | |
21744f19 EB |
56 | }; |
57 | ||
21744f19 EB |
58 | static struct tsc2007_platform_data tsc2007_info = { |
59 | .model = 2007, | |
60 | .x_plate_ohms = 180, | |
21744f19 EB |
61 | }; |
62 | ||
54dc3f46 | 63 | #define TSC2007_IRQGPIO (2 * 32 + 2) |
21744f19 EB |
64 | static struct i2c_board_info eukrea_cpuimx35_i2c_devices[] = { |
65 | { | |
66 | I2C_BOARD_INFO("pcf8563", 0x51), | |
67 | }, { | |
68 | I2C_BOARD_INFO("tsc2007", 0x48), | |
69 | .type = "tsc2007", | |
70 | .platform_data = &tsc2007_info, | |
71 | .irq = gpio_to_irq(TSC2007_IRQGPIO), | |
72 | }, | |
73 | }; | |
74 | ||
8f5260c8 | 75 | static iomux_v3_cfg_t eukrea_cpuimx35_pads[] = { |
21744f19 EB |
76 | /* UART1 */ |
77 | MX35_PAD_CTS1__UART1_CTS, | |
78 | MX35_PAD_RTS1__UART1_RTS, | |
79 | MX35_PAD_TXD1__UART1_TXD_MUX, | |
80 | MX35_PAD_RXD1__UART1_RXD_MUX, | |
81 | /* FEC */ | |
82 | MX35_PAD_FEC_TX_CLK__FEC_TX_CLK, | |
83 | MX35_PAD_FEC_RX_CLK__FEC_RX_CLK, | |
84 | MX35_PAD_FEC_RX_DV__FEC_RX_DV, | |
85 | MX35_PAD_FEC_COL__FEC_COL, | |
86 | MX35_PAD_FEC_RDATA0__FEC_RDATA_0, | |
87 | MX35_PAD_FEC_TDATA0__FEC_TDATA_0, | |
88 | MX35_PAD_FEC_TX_EN__FEC_TX_EN, | |
89 | MX35_PAD_FEC_MDC__FEC_MDC, | |
90 | MX35_PAD_FEC_MDIO__FEC_MDIO, | |
91 | MX35_PAD_FEC_TX_ERR__FEC_TX_ERR, | |
92 | MX35_PAD_FEC_RX_ERR__FEC_RX_ERR, | |
93 | MX35_PAD_FEC_CRS__FEC_CRS, | |
94 | MX35_PAD_FEC_RDATA1__FEC_RDATA_1, | |
95 | MX35_PAD_FEC_TDATA1__FEC_TDATA_1, | |
96 | MX35_PAD_FEC_RDATA2__FEC_RDATA_2, | |
97 | MX35_PAD_FEC_TDATA2__FEC_TDATA_2, | |
98 | MX35_PAD_FEC_RDATA3__FEC_RDATA_3, | |
99 | MX35_PAD_FEC_TDATA3__FEC_TDATA_3, | |
100 | /* I2C1 */ | |
101 | MX35_PAD_I2C1_CLK__I2C1_SCL, | |
102 | MX35_PAD_I2C1_DAT__I2C1_SDA, | |
103 | /* TSC2007 IRQ */ | |
104 | MX35_PAD_ATA_DA2__GPIO3_2, | |
105 | }; | |
106 | ||
2dcf78c0 | 107 | static const struct mxc_nand_platform_data |
54dc3f46 | 108 | eukrea_cpuimx35_nand_board_info __initconst = { |
21744f19 EB |
109 | .width = 1, |
110 | .hw_ecc = 1, | |
111 | .flash_bbt = 1, | |
112 | }; | |
113 | ||
2d58de28 | 114 | static const struct mxc_usbh_platform_data otg_pdata __initconst = { |
21744f19 EB |
115 | .portsc = MXC_EHCI_MODE_UTMI, |
116 | .flags = MXC_EHCI_INTERFACE_DIFF_UNI, | |
117 | }; | |
118 | ||
2d58de28 | 119 | static const struct mxc_usbh_platform_data usbh1_pdata __initconst = { |
21744f19 EB |
120 | .portsc = MXC_EHCI_MODE_SERIAL, |
121 | .flags = MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY | | |
122 | MXC_EHCI_IPPUE_DOWN, | |
123 | }; | |
124 | ||
9e1dde33 | 125 | static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { |
21744f19 EB |
126 | .operating_mode = FSL_USB2_DR_DEVICE, |
127 | .phy_mode = FSL_USB2_PHY_UTMI, | |
69cb1ec4 | 128 | .workaround = FLS_USB2_WORKAROUND_ENGCM09152, |
21744f19 EB |
129 | }; |
130 | ||
131 | static int otg_mode_host; | |
132 | ||
133 | static int __init eukrea_cpuimx35_otg_mode(char *options) | |
134 | { | |
135 | if (!strcmp(options, "host")) | |
136 | otg_mode_host = 1; | |
137 | else if (!strcmp(options, "device")) | |
138 | otg_mode_host = 0; | |
139 | else | |
140 | pr_info("otg_mode neither \"host\" nor \"device\". " | |
141 | "Defaulting to device\n"); | |
142 | return 0; | |
143 | } | |
144 | __setup("otg_mode=", eukrea_cpuimx35_otg_mode); | |
145 | ||
146 | /* | |
147 | * Board specific initialization. | |
148 | */ | |
149 | static void __init mxc_board_init(void) | |
150 | { | |
151 | mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx35_pads, | |
152 | ARRAY_SIZE(eukrea_cpuimx35_pads)); | |
153 | ||
6bd96f3c | 154 | imx35_add_fec(NULL); |
742269e2 | 155 | imx35_add_imx2_wdt(NULL); |
21744f19 | 156 | |
2dcf78c0 UKK |
157 | imx35_add_imx_uart0(&uart_pdata); |
158 | imx35_add_mxc_nand(&eukrea_cpuimx35_nand_board_info); | |
21744f19 EB |
159 | |
160 | i2c_register_board_info(0, eukrea_cpuimx35_i2c_devices, | |
161 | ARRAY_SIZE(eukrea_cpuimx35_i2c_devices)); | |
2dcf78c0 | 162 | imx35_add_imx_i2c0(&eukrea_cpuimx35_i2c0_data); |
21744f19 | 163 | |
52d084fc | 164 | if (otg_mode_host) |
2d58de28 | 165 | imx35_add_mxc_ehci_otg(&otg_pdata); |
52d084fc | 166 | else |
9e1dde33 | 167 | imx35_add_fsl_usb2_udc(&otg_device_pdata); |
21744f19 | 168 | |
2d58de28 | 169 | imx35_add_mxc_ehci_hs(&usbh1_pdata); |
52d084fc | 170 | |
ec53fe3d EB |
171 | #ifdef CONFIG_MACH_EUKREA_MBIMXSD35_BASEBOARD |
172 | eukrea_mbimxsd35_baseboard_init(); | |
21744f19 EB |
173 | #endif |
174 | } | |
175 | ||
176 | static void __init eukrea_cpuimx35_timer_init(void) | |
177 | { | |
178 | mx35_clocks_init(); | |
179 | } | |
180 | ||
181 | struct sys_timer eukrea_cpuimx35_timer = { | |
182 | .init = eukrea_cpuimx35_timer_init, | |
183 | }; | |
184 | ||
185 | MACHINE_START(EUKREA_CPUIMX35, "Eukrea CPUIMX35") | |
186 | /* Maintainer: Eukrea Electromatique */ | |
21744f19 EB |
187 | .boot_params = MX3x_PHYS_OFFSET + 0x100, |
188 | .map_io = mx35_map_io, | |
189 | .init_irq = mx35_init_irq, | |
190 | .init_machine = mxc_board_init, | |
191 | .timer = &eukrea_cpuimx35_timer, | |
192 | MACHINE_END |