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