Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[pandora-kernel.git] / arch / arm / plat-mxc / devices / platform-mxc-ehci.c
1 /*
2  * Copyright (C) 2010 Pengutronix
3  * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 2 as published by the
7  * Free Software Foundation.
8  */
9 #include <linux/dma-mapping.h>
10 #include <mach/hardware.h>
11 #include <mach/devices-common.h>
12
13 #define imx_mxc_ehci_data_entry_single(soc, _id, hs)                    \
14         {                                                               \
15                 .id = _id,                                              \
16                 .iobase = soc ## _USB_ ## hs ## _BASE_ADDR,             \
17                 .irq = soc ## _INT_USB_ ## hs,                          \
18         }
19
20 #ifdef CONFIG_SOC_IMX25
21 const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst =
22         imx_mxc_ehci_data_entry_single(MX25, 0, OTG);
23 const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst =
24         imx_mxc_ehci_data_entry_single(MX25, 1, HS);
25 #endif /* ifdef CONFIG_SOC_IMX25 */
26
27 #ifdef CONFIG_SOC_IMX27
28 const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst =
29         imx_mxc_ehci_data_entry_single(MX27, 0, OTG);
30 const struct imx_mxc_ehci_data imx27_mxc_ehci_hs_data[] __initconst = {
31         imx_mxc_ehci_data_entry_single(MX27, 1, HS1),
32         imx_mxc_ehci_data_entry_single(MX27, 2, HS2),
33 };
34 #endif /* ifdef CONFIG_SOC_IMX27 */
35
36 #ifdef CONFIG_SOC_IMX31
37 const struct imx_mxc_ehci_data imx31_mxc_ehci_otg_data __initconst =
38         imx_mxc_ehci_data_entry_single(MX31, 0, OTG);
39 const struct imx_mxc_ehci_data imx31_mxc_ehci_hs_data[] __initconst = {
40         imx_mxc_ehci_data_entry_single(MX31, 1, HS1),
41         imx_mxc_ehci_data_entry_single(MX31, 2, HS2),
42 };
43 #endif /* ifdef CONFIG_SOC_IMX31 */
44
45 #ifdef CONFIG_SOC_IMX35
46 const struct imx_mxc_ehci_data imx35_mxc_ehci_otg_data __initconst =
47         imx_mxc_ehci_data_entry_single(MX35, 0, OTG);
48 const struct imx_mxc_ehci_data imx35_mxc_ehci_hs_data __initconst =
49         imx_mxc_ehci_data_entry_single(MX35, 1, HS);
50 #endif /* ifdef CONFIG_SOC_IMX35 */
51
52 struct platform_device *__init imx_add_mxc_ehci(
53                 const struct imx_mxc_ehci_data *data,
54                 const struct mxc_usbh_platform_data *pdata)
55 {
56         struct resource res[] = {
57                 {
58                         .start = data->iobase,
59                         .end = data->iobase + SZ_512 - 1,
60                         .flags = IORESOURCE_MEM,
61                 }, {
62                         .start = data->irq,
63                         .end = data->irq,
64                         .flags = IORESOURCE_IRQ,
65                 },
66         };
67         return imx_add_platform_device_dmamask("mxc-ehci", data->id,
68                         res, ARRAY_SIZE(res),
69                         pdata, sizeof(*pdata), DMA_BIT_MASK(32));
70 }