Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
awilliam
GitHub Repository: awilliam/linux-vfio
Path: blob/master/arch/arm/mach-imx/mach-cpuimx35.c
10817 views
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
static struct tsc2007_platform_data tsc2007_info = {
57
.model = 2007,
58
.x_plate_ohms = 180,
59
};
60
61
#define TSC2007_IRQGPIO IMX_GPIO_NR(3, 2)
62
static struct i2c_board_info eukrea_cpuimx35_i2c_devices[] = {
63
{
64
I2C_BOARD_INFO("pcf8563", 0x51),
65
}, {
66
I2C_BOARD_INFO("tsc2007", 0x48),
67
.type = "tsc2007",
68
.platform_data = &tsc2007_info,
69
.irq = gpio_to_irq(TSC2007_IRQGPIO),
70
},
71
};
72
73
static iomux_v3_cfg_t eukrea_cpuimx35_pads[] = {
74
/* UART1 */
75
MX35_PAD_CTS1__UART1_CTS,
76
MX35_PAD_RTS1__UART1_RTS,
77
MX35_PAD_TXD1__UART1_TXD_MUX,
78
MX35_PAD_RXD1__UART1_RXD_MUX,
79
/* FEC */
80
MX35_PAD_FEC_TX_CLK__FEC_TX_CLK,
81
MX35_PAD_FEC_RX_CLK__FEC_RX_CLK,
82
MX35_PAD_FEC_RX_DV__FEC_RX_DV,
83
MX35_PAD_FEC_COL__FEC_COL,
84
MX35_PAD_FEC_RDATA0__FEC_RDATA_0,
85
MX35_PAD_FEC_TDATA0__FEC_TDATA_0,
86
MX35_PAD_FEC_TX_EN__FEC_TX_EN,
87
MX35_PAD_FEC_MDC__FEC_MDC,
88
MX35_PAD_FEC_MDIO__FEC_MDIO,
89
MX35_PAD_FEC_TX_ERR__FEC_TX_ERR,
90
MX35_PAD_FEC_RX_ERR__FEC_RX_ERR,
91
MX35_PAD_FEC_CRS__FEC_CRS,
92
MX35_PAD_FEC_RDATA1__FEC_RDATA_1,
93
MX35_PAD_FEC_TDATA1__FEC_TDATA_1,
94
MX35_PAD_FEC_RDATA2__FEC_RDATA_2,
95
MX35_PAD_FEC_TDATA2__FEC_TDATA_2,
96
MX35_PAD_FEC_RDATA3__FEC_RDATA_3,
97
MX35_PAD_FEC_TDATA3__FEC_TDATA_3,
98
/* I2C1 */
99
MX35_PAD_I2C1_CLK__I2C1_SCL,
100
MX35_PAD_I2C1_DAT__I2C1_SDA,
101
/* TSC2007 IRQ */
102
MX35_PAD_ATA_DA2__GPIO3_2,
103
};
104
105
static const struct mxc_nand_platform_data
106
eukrea_cpuimx35_nand_board_info __initconst = {
107
.width = 1,
108
.hw_ecc = 1,
109
.flash_bbt = 1,
110
};
111
112
static int eukrea_cpuimx35_otg_init(struct platform_device *pdev)
113
{
114
return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);
115
}
116
117
static const struct mxc_usbh_platform_data otg_pdata __initconst = {
118
.init = eukrea_cpuimx35_otg_init,
119
.portsc = MXC_EHCI_MODE_UTMI,
120
};
121
122
static int eukrea_cpuimx35_usbh1_init(struct platform_device *pdev)
123
{
124
return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_SINGLE_UNI |
125
MXC_EHCI_INTERNAL_PHY | MXC_EHCI_IPPUE_DOWN);
126
}
127
128
static const struct mxc_usbh_platform_data usbh1_pdata __initconst = {
129
.init = eukrea_cpuimx35_usbh1_init,
130
.portsc = MXC_EHCI_MODE_SERIAL,
131
};
132
133
static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
134
.operating_mode = FSL_USB2_DR_DEVICE,
135
.phy_mode = FSL_USB2_PHY_UTMI,
136
.workaround = FLS_USB2_WORKAROUND_ENGCM09152,
137
};
138
139
static int otg_mode_host;
140
141
static int __init eukrea_cpuimx35_otg_mode(char *options)
142
{
143
if (!strcmp(options, "host"))
144
otg_mode_host = 1;
145
else if (!strcmp(options, "device"))
146
otg_mode_host = 0;
147
else
148
pr_info("otg_mode neither \"host\" nor \"device\". "
149
"Defaulting to device\n");
150
return 0;
151
}
152
__setup("otg_mode=", eukrea_cpuimx35_otg_mode);
153
154
/*
155
* Board specific initialization.
156
*/
157
static void __init eukrea_cpuimx35_init(void)
158
{
159
mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx35_pads,
160
ARRAY_SIZE(eukrea_cpuimx35_pads));
161
162
imx35_add_fec(NULL);
163
imx35_add_imx2_wdt(NULL);
164
165
imx35_add_imx_uart0(&uart_pdata);
166
imx35_add_mxc_nand(&eukrea_cpuimx35_nand_board_info);
167
168
i2c_register_board_info(0, eukrea_cpuimx35_i2c_devices,
169
ARRAY_SIZE(eukrea_cpuimx35_i2c_devices));
170
imx35_add_imx_i2c0(&eukrea_cpuimx35_i2c0_data);
171
172
if (otg_mode_host)
173
imx35_add_mxc_ehci_otg(&otg_pdata);
174
else
175
imx35_add_fsl_usb2_udc(&otg_device_pdata);
176
177
imx35_add_mxc_ehci_hs(&usbh1_pdata);
178
179
#ifdef CONFIG_MACH_EUKREA_MBIMXSD35_BASEBOARD
180
eukrea_mbimxsd35_baseboard_init();
181
#endif
182
}
183
184
static void __init eukrea_cpuimx35_timer_init(void)
185
{
186
mx35_clocks_init();
187
}
188
189
struct sys_timer eukrea_cpuimx35_timer = {
190
.init = eukrea_cpuimx35_timer_init,
191
};
192
193
MACHINE_START(EUKREA_CPUIMX35, "Eukrea CPUIMX35")
194
/* Maintainer: Eukrea Electromatique */
195
.boot_params = MX3x_PHYS_OFFSET + 0x100,
196
.map_io = mx35_map_io,
197
.init_early = imx35_init_early,
198
.init_irq = mx35_init_irq,
199
.timer = &eukrea_cpuimx35_timer,
200
.init_machine = eukrea_cpuimx35_init,
201
MACHINE_END
202
203