diff options
Diffstat (limited to 'arch/arm/mach-mx25/mach-cpuimx25.c')
-rw-r--r-- | arch/arm/mach-mx25/mach-cpuimx25.c | 173 |
1 files changed, 173 insertions, 0 deletions
diff --git a/arch/arm/mach-mx25/mach-cpuimx25.c b/arch/arm/mach-mx25/mach-cpuimx25.c new file mode 100644 index 00000000000..56b2e26d23b --- /dev/null +++ b/arch/arm/mach-mx25/mach-cpuimx25.c | |||
@@ -0,0 +1,173 @@ | |||
1 | /* | ||
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> | ||
26 | #include <linux/fec.h> | ||
27 | #include <linux/platform_device.h> | ||
28 | #include <linux/usb/otg.h> | ||
29 | #include <linux/usb/ulpi.h> | ||
30 | #include <linux/fsl_devices.h> | ||
31 | |||
32 | #include <mach/eukrea-baseboards.h> | ||
33 | #include <mach/hardware.h> | ||
34 | #include <asm/mach-types.h> | ||
35 | #include <asm/mach/arch.h> | ||
36 | #include <asm/mach/time.h> | ||
37 | #include <asm/memory.h> | ||
38 | #include <asm/mach/map.h> | ||
39 | #include <mach/common.h> | ||
40 | #include <mach/mx25.h> | ||
41 | #include <mach/mxc_nand.h> | ||
42 | #include <mach/imxfb.h> | ||
43 | #include <mach/mxc_ehci.h> | ||
44 | #include <mach/ulpi.h> | ||
45 | #include <mach/iomux-mx25.h> | ||
46 | |||
47 | #include "devices-imx25.h" | ||
48 | #include "devices.h" | ||
49 | |||
50 | static const struct imxuart_platform_data uart_pdata __initconst = { | ||
51 | .flags = IMXUART_HAVE_RTSCTS, | ||
52 | }; | ||
53 | |||
54 | static struct pad_desc eukrea_cpuimx25_pads[] = { | ||
55 | /* FEC - RMII */ | ||
56 | MX25_PAD_FEC_MDC__FEC_MDC, | ||
57 | MX25_PAD_FEC_MDIO__FEC_MDIO, | ||
58 | MX25_PAD_FEC_TDATA0__FEC_TDATA0, | ||
59 | MX25_PAD_FEC_TDATA1__FEC_TDATA1, | ||
60 | MX25_PAD_FEC_TX_EN__FEC_TX_EN, | ||
61 | MX25_PAD_FEC_RDATA0__FEC_RDATA0, | ||
62 | MX25_PAD_FEC_RDATA1__FEC_RDATA1, | ||
63 | MX25_PAD_FEC_RX_DV__FEC_RX_DV, | ||
64 | MX25_PAD_FEC_TX_CLK__FEC_TX_CLK, | ||
65 | /* I2C1 */ | ||
66 | MX25_PAD_I2C1_CLK__I2C1_CLK, | ||
67 | MX25_PAD_I2C1_DAT__I2C1_DAT, | ||
68 | }; | ||
69 | |||
70 | static struct fec_platform_data mx25_fec_pdata = { | ||
71 | .phy = PHY_INTERFACE_MODE_RMII, | ||
72 | }; | ||
73 | |||
74 | static const struct mxc_nand_platform_data | ||
75 | eukrea_cpuimx25_nand_board_info __initconst = { | ||
76 | .width = 1, | ||
77 | .hw_ecc = 1, | ||
78 | .flash_bbt = 1, | ||
79 | }; | ||
80 | |||
81 | static const struct imxi2c_platform_data | ||
82 | eukrea_cpuimx25_i2c0_data __initconst = { | ||
83 | .bitrate = 100000, | ||
84 | }; | ||
85 | |||
86 | static struct i2c_board_info eukrea_cpuimx25_i2c_devices[] = { | ||
87 | { | ||
88 | I2C_BOARD_INFO("pcf8563", 0x51), | ||
89 | }, | ||
90 | }; | ||
91 | |||
92 | static struct mxc_usbh_platform_data otg_pdata = { | ||
93 | .portsc = MXC_EHCI_MODE_UTMI, | ||
94 | .flags = MXC_EHCI_INTERFACE_DIFF_UNI, | ||
95 | }; | ||
96 | |||
97 | static struct mxc_usbh_platform_data usbh2_pdata = { | ||
98 | .portsc = MXC_EHCI_MODE_SERIAL, | ||
99 | .flags = MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY | | ||
100 | MXC_EHCI_IPPUE_DOWN, | ||
101 | }; | ||
102 | |||
103 | static struct fsl_usb2_platform_data otg_device_pdata = { | ||
104 | .operating_mode = FSL_USB2_DR_DEVICE, | ||
105 | .phy_mode = FSL_USB2_PHY_UTMI, | ||
106 | }; | ||
107 | |||
108 | static int otg_mode_host; | ||
109 | |||
110 | static int __init eukrea_cpuimx25_otg_mode(char *options) | ||
111 | { | ||
112 | if (!strcmp(options, "host")) | ||
113 | otg_mode_host = 1; | ||
114 | else if (!strcmp(options, "device")) | ||
115 | otg_mode_host = 0; | ||
116 | else | ||
117 | pr_info("otg_mode neither \"host\" nor \"device\". " | ||
118 | "Defaulting to device\n"); | ||
119 | return 0; | ||
120 | } | ||
121 | __setup("otg_mode=", eukrea_cpuimx25_otg_mode); | ||
122 | |||
123 | static void __init eukrea_cpuimx25_init(void) | ||
124 | { | ||
125 | if (mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads, | ||
126 | ARRAY_SIZE(eukrea_cpuimx25_pads))) | ||
127 | printk(KERN_ERR "error setting cpuimx25 pads !\n"); | ||
128 | |||
129 | imx25_add_imx_uart0(&uart_pdata); | ||
130 | imx25_add_mxc_nand(&eukrea_cpuimx25_nand_board_info); | ||
131 | mxc_register_device(&mx25_rtc_device, NULL); | ||
132 | mxc_register_device(&mx25_fec_device, &mx25_fec_pdata); | ||
133 | |||
134 | i2c_register_board_info(0, eukrea_cpuimx25_i2c_devices, | ||
135 | ARRAY_SIZE(eukrea_cpuimx25_i2c_devices)); | ||
136 | imx25_add_imx_i2c0(&eukrea_cpuimx25_i2c0_data); | ||
137 | |||
138 | #if defined(CONFIG_USB_ULPI) | ||
139 | if (otg_mode_host) { | ||
140 | otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, | ||
141 | USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT); | ||
142 | |||
143 | mxc_register_device(&mxc_otg, &otg_pdata); | ||
144 | } | ||
145 | mxc_register_device(&mxc_usbh2, &usbh2_pdata); | ||
146 | #endif | ||
147 | if (!otg_mode_host) | ||
148 | mxc_register_device(&otg_udc_device, &otg_device_pdata); | ||
149 | |||
150 | #ifdef CONFIG_MACH_EUKREA_MBIMXSD_BASEBOARD | ||
151 | eukrea_mbimxsd_baseboard_init(); | ||
152 | #endif | ||
153 | } | ||
154 | |||
155 | static void __init eukrea_cpuimx25_timer_init(void) | ||
156 | { | ||
157 | mx25_clocks_init(); | ||
158 | } | ||
159 | |||
160 | static struct sys_timer eukrea_cpuimx25_timer = { | ||
161 | .init = eukrea_cpuimx25_timer_init, | ||
162 | }; | ||
163 | |||
164 | MACHINE_START(EUKREA_CPUIMX25, "Eukrea CPUIMX25") | ||
165 | /* Maintainer: Eukrea Electromatique */ | ||
166 | .phys_io = MX25_AIPS1_BASE_ADDR, | ||
167 | .io_pg_offst = ((MX25_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc, | ||
168 | .boot_params = MX25_PHYS_OFFSET + 0x100, | ||
169 | .map_io = mx25_map_io, | ||
170 | .init_irq = mx25_init_irq, | ||
171 | .init_machine = eukrea_cpuimx25_init, | ||
172 | .timer = &eukrea_cpuimx25_timer, | ||
173 | MACHINE_END | ||