blob: 5d4bbbfde641360d31815917c2a4c1e88d7fe64d [file] [log] [blame]
Uwe Kleine-König2eb42d52010-11-05 18:52:09 +01001/*
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 */
Alexey Dobriyanb7f080c2011-06-16 11:01:34 +00009#include <linux/dma-mapping.h>
Shawn Guo50f2de62012-09-14 14:14:45 +080010
11#include "../hardware.h"
Shawn Guoe0557c02012-09-13 15:51:15 +080012#include "devices-common.h"
Uwe Kleine-König2eb42d52010-11-05 18:52:09 +010013
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
Uwe Kleine-König972cc482010-11-11 18:35:01 +010021#ifdef CONFIG_SOC_IMX25
Uwe Kleine-König2c20b9f2010-11-10 21:27:55 +010022const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst =
23 imx_mxc_ehci_data_entry_single(MX25, 0, OTG);
24const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst =
25 imx_mxc_ehci_data_entry_single(MX25, 1, HS);
Uwe Kleine-König972cc482010-11-11 18:35:01 +010026#endif /* ifdef CONFIG_SOC_IMX25 */
Uwe Kleine-König2c20b9f2010-11-10 21:27:55 +010027
Uwe Kleine-König2eb42d52010-11-05 18:52:09 +010028#ifdef CONFIG_SOC_IMX27
29const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst =
30 imx_mxc_ehci_data_entry_single(MX27, 0, OTG);
31const 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
Uwe Kleine-König2d58de22010-11-15 11:57:49 +010037#ifdef CONFIG_SOC_IMX31
38const struct imx_mxc_ehci_data imx31_mxc_ehci_otg_data __initconst =
39 imx_mxc_ehci_data_entry_single(MX31, 0, OTG);
40const 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
47const struct imx_mxc_ehci_data imx35_mxc_ehci_otg_data __initconst =
48 imx_mxc_ehci_data_entry_single(MX35, 0, OTG);
49const 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
Uwe Kleine-König7d92e8e2011-07-30 23:41:49 +020053#ifdef CONFIG_SOC_IMX51
54const struct imx_mxc_ehci_data imx51_mxc_ehci_otg_data __initconst =
55 imx_mxc_ehci_data_entry_single(MX51, 0, OTG);
56const 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
Uwe Kleine-König2eb42d52010-11-05 18:52:09 +010062struct 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}