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
11 #include "../hardware.h"
12 #include "devices-common.h"
13
14 #define imx_mxc_ehci_data_entry_single(soc, _id, hs) \
15 { \
16 .id = _id, \
17 .iobase = soc ## _USB_ ## hs ## _BASE_ADDR, \
18 .irq = soc ## _INT_USB_ ## hs, \
19 }
20
21 #ifdef CONFIG_SOC_IMX25
22 const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst =
23 imx_mxc_ehci_data_entry_single(MX25, 0, OTG);
24 const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst =
25 imx_mxc_ehci_data_entry_single(MX25, 1, HS);
26 #endif /* ifdef CONFIG_SOC_IMX25 */
27
28 #ifdef CONFIG_SOC_IMX27
29 const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst =
30 imx_mxc_ehci_data_entry_single(MX27, 0, OTG);
31 const struct imx_mxc_ehci_data imx27_mxc_ehci_hs_data[] __initconst = {
32 imx_mxc_ehci_data_entry_single(MX27, 1, HS1),
33 imx_mxc_ehci_data_entry_single(MX27, 2, HS2),
34 };
35 #endif /* ifdef CONFIG_SOC_IMX27 */
36
37 #ifdef CONFIG_SOC_IMX31
38 const struct imx_mxc_ehci_data imx31_mxc_ehci_otg_data __initconst =
39 imx_mxc_ehci_data_entry_single(MX31, 0, OTG);
40 const struct imx_mxc_ehci_data imx31_mxc_ehci_hs_data[] __initconst = {
41 imx_mxc_ehci_data_entry_single(MX31, 1, HS1),
42 imx_mxc_ehci_data_entry_single(MX31, 2, HS2),
43 };
44 #endif /* ifdef CONFIG_SOC_IMX31 */
45
46 #ifdef CONFIG_SOC_IMX35
47 const struct imx_mxc_ehci_data imx35_mxc_ehci_otg_data __initconst =
48 imx_mxc_ehci_data_entry_single(MX35, 0, OTG);
49 const struct imx_mxc_ehci_data imx35_mxc_ehci_hs_data __initconst =
50 imx_mxc_ehci_data_entry_single(MX35, 1, HS);
51 #endif /* ifdef CONFIG_SOC_IMX35 */
52
53 #ifdef CONFIG_SOC_IMX51
54 const struct imx_mxc_ehci_data imx51_mxc_ehci_otg_data __initconst =
55 imx_mxc_ehci_data_entry_single(MX51, 0, OTG);
56 const struct imx_mxc_ehci_data imx51_mxc_ehci_hs_data[] __initconst = {
57 imx_mxc_ehci_data_entry_single(MX51, 1, HS1),
58 imx_mxc_ehci_data_entry_single(MX51, 2, HS2),
59 };
60 #endif /* ifdef CONFIG_SOC_IMX51 */
61
imx_add_mxc_ehci(const struct imx_mxc_ehci_data * data,const struct mxc_usbh_platform_data * pdata)62 struct platform_device *__init imx_add_mxc_ehci(
63 const struct imx_mxc_ehci_data *data,
64 const struct mxc_usbh_platform_data *pdata)
65 {
66 struct resource res[] = {
67 {
68 .start = data->iobase,
69 .end = data->iobase + SZ_512 - 1,
70 .flags = IORESOURCE_MEM,
71 }, {
72 .start = data->irq,
73 .end = data->irq,
74 .flags = IORESOURCE_IRQ,
75 },
76 };
77 return imx_add_platform_device_dmamask("mxc-ehci", data->id,
78 res, ARRAY_SIZE(res),
79 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
80 }
81