Commit | Line | Data |
---|---|---|
6f1fa706 EB |
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> | |
6f1fa706 EB |
26 | #include <linux/platform_device.h> |
27 | #include <linux/usb/otg.h> | |
28 | #include <linux/usb/ulpi.h> | |
6f1fa706 | 29 | |
95afd090 | 30 | #include <mach/eukrea-baseboards.h> |
6f1fa706 EB |
31 | #include <mach/hardware.h> |
32 | #include <asm/mach-types.h> | |
33 | #include <asm/mach/arch.h> | |
34 | #include <asm/mach/time.h> | |
35 | #include <asm/memory.h> | |
36 | #include <asm/mach/map.h> | |
37 | #include <mach/common.h> | |
6f1fa706 | 38 | #include <mach/mx25.h> |
2dcf78c0 | 39 | #include <mach/iomux-mx25.h> |
6f1fa706 | 40 | |
2dcf78c0 | 41 | #include "devices-imx25.h" |
6f1fa706 | 42 | |
2dcf78c0 | 43 | static const struct imxuart_platform_data uart_pdata __initconst = { |
6f1fa706 EB |
44 | .flags = IMXUART_HAVE_RTSCTS, |
45 | }; | |
46 | ||
8f5260c8 | 47 | static iomux_v3_cfg_t eukrea_cpuimx25_pads[] = { |
6f1fa706 EB |
48 | /* FEC - RMII */ |
49 | MX25_PAD_FEC_MDC__FEC_MDC, | |
50 | MX25_PAD_FEC_MDIO__FEC_MDIO, | |
51 | MX25_PAD_FEC_TDATA0__FEC_TDATA0, | |
52 | MX25_PAD_FEC_TDATA1__FEC_TDATA1, | |
53 | MX25_PAD_FEC_TX_EN__FEC_TX_EN, | |
54 | MX25_PAD_FEC_RDATA0__FEC_RDATA0, | |
55 | MX25_PAD_FEC_RDATA1__FEC_RDATA1, | |
56 | MX25_PAD_FEC_RX_DV__FEC_RX_DV, | |
57 | MX25_PAD_FEC_TX_CLK__FEC_TX_CLK, | |
58 | /* I2C1 */ | |
59 | MX25_PAD_I2C1_CLK__I2C1_CLK, | |
60 | MX25_PAD_I2C1_DAT__I2C1_DAT, | |
61 | }; | |
62 | ||
6bd96f3c | 63 | static const struct fec_platform_data mx25_fec_pdata __initconst = { |
6f1fa706 EB |
64 | .phy = PHY_INTERFACE_MODE_RMII, |
65 | }; | |
66 | ||
2dcf78c0 UKK |
67 | static const struct mxc_nand_platform_data |
68 | eukrea_cpuimx25_nand_board_info __initconst = { | |
6f1fa706 EB |
69 | .width = 1, |
70 | .hw_ecc = 1, | |
71 | .flash_bbt = 1, | |
72 | }; | |
73 | ||
2dcf78c0 UKK |
74 | static const struct imxi2c_platform_data |
75 | eukrea_cpuimx25_i2c0_data __initconst = { | |
6f1fa706 EB |
76 | .bitrate = 100000, |
77 | }; | |
78 | ||
79 | static struct i2c_board_info eukrea_cpuimx25_i2c_devices[] = { | |
80 | { | |
81 | I2C_BOARD_INFO("pcf8563", 0x51), | |
82 | }, | |
83 | }; | |
84 | ||
4bd597b6 SH |
85 | static int eukrea_cpuimx25_otg_init(struct platform_device *pdev) |
86 | { | |
87 | return mx25_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI); | |
88 | } | |
89 | ||
2c20b9f1 | 90 | static const struct mxc_usbh_platform_data otg_pdata __initconst = { |
4bd597b6 | 91 | .init = eukrea_cpuimx25_otg_init, |
6f1fa706 | 92 | .portsc = MXC_EHCI_MODE_UTMI, |
6f1fa706 EB |
93 | }; |
94 | ||
4bd597b6 SH |
95 | static int eukrea_cpuimx25_usbh2_init(struct platform_device *pdev) |
96 | { | |
97 | return mx25_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_SINGLE_UNI | | |
98 | MXC_EHCI_INTERNAL_PHY | MXC_EHCI_IPPUE_DOWN); | |
99 | } | |
100 | ||
2c20b9f1 | 101 | static const struct mxc_usbh_platform_data usbh2_pdata __initconst = { |
4bd597b6 | 102 | .init = eukrea_cpuimx25_usbh2_init, |
6f1fa706 | 103 | .portsc = MXC_EHCI_MODE_SERIAL, |
6f1fa706 EB |
104 | }; |
105 | ||
224b8c83 | 106 | static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { |
6f1fa706 EB |
107 | .operating_mode = FSL_USB2_DR_DEVICE, |
108 | .phy_mode = FSL_USB2_PHY_UTMI, | |
109 | }; | |
110 | ||
111 | static int otg_mode_host; | |
112 | ||
113 | static int __init eukrea_cpuimx25_otg_mode(char *options) | |
114 | { | |
115 | if (!strcmp(options, "host")) | |
116 | otg_mode_host = 1; | |
117 | else if (!strcmp(options, "device")) | |
118 | otg_mode_host = 0; | |
119 | else | |
120 | pr_info("otg_mode neither \"host\" nor \"device\". " | |
121 | "Defaulting to device\n"); | |
122 | return 0; | |
123 | } | |
124 | __setup("otg_mode=", eukrea_cpuimx25_otg_mode); | |
125 | ||
126 | static void __init eukrea_cpuimx25_init(void) | |
127 | { | |
b78d8e59 SG |
128 | imx25_soc_init(); |
129 | ||
6f1fa706 EB |
130 | if (mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads, |
131 | ARRAY_SIZE(eukrea_cpuimx25_pads))) | |
132 | printk(KERN_ERR "error setting cpuimx25 pads !\n"); | |
133 | ||
2dcf78c0 UKK |
134 | imx25_add_imx_uart0(&uart_pdata); |
135 | imx25_add_mxc_nand(&eukrea_cpuimx25_nand_board_info); | |
e7c74b34 | 136 | imx25_add_imxdi_rtc(NULL); |
6bd96f3c | 137 | imx25_add_fec(&mx25_fec_pdata); |
6f1fa706 EB |
138 | |
139 | i2c_register_board_info(0, eukrea_cpuimx25_i2c_devices, | |
140 | ARRAY_SIZE(eukrea_cpuimx25_i2c_devices)); | |
2dcf78c0 | 141 | imx25_add_imx_i2c0(&eukrea_cpuimx25_i2c0_data); |
6f1fa706 | 142 | |
52d084fc | 143 | if (otg_mode_host) |
2c20b9f1 | 144 | imx25_add_mxc_ehci_otg(&otg_pdata); |
52d084fc | 145 | else |
224b8c83 | 146 | imx25_add_fsl_usb2_udc(&otg_device_pdata); |
6f1fa706 | 147 | |
2c20b9f1 | 148 | imx25_add_mxc_ehci_hs(&usbh2_pdata); |
52d084fc | 149 | |
ec53fe3d EB |
150 | #ifdef CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD |
151 | eukrea_mbimxsd25_baseboard_init(); | |
6f1fa706 EB |
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 */ | |
dc8f1907 | 166 | .atag_offset = 0x100, |
3dac2196 UKK |
167 | .map_io = mx25_map_io, |
168 | .init_early = imx25_init_early, | |
169 | .init_irq = mx25_init_irq, | |
170 | .timer = &eukrea_cpuimx25_timer, | |
171 | .init_machine = eukrea_cpuimx25_init, | |
6f1fa706 | 172 | MACHINE_END |