Merge tag 'armsoc-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[linux-2.6-block.git] / arch / arm / mach-imx / devices / platform-mxc-ehci.c
CommitLineData
2eb42d5c
UKK
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 */
b7f080cf 9#include <linux/dma-mapping.h>
50f2de61
SG
10
11#include "../hardware.h"
e0557c0d 12#include "devices-common.h"
2eb42d5c
UKK
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_IMX27
22const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst =
23 imx_mxc_ehci_data_entry_single(MX27, 0, OTG);
24const struct imx_mxc_ehci_data imx27_mxc_ehci_hs_data[] __initconst = {
25 imx_mxc_ehci_data_entry_single(MX27, 1, HS1),
26 imx_mxc_ehci_data_entry_single(MX27, 2, HS2),
27};
28#endif /* ifdef CONFIG_SOC_IMX27 */
29
2d58de28
UKK
30#ifdef CONFIG_SOC_IMX31
31const struct imx_mxc_ehci_data imx31_mxc_ehci_otg_data __initconst =
32 imx_mxc_ehci_data_entry_single(MX31, 0, OTG);
33const struct imx_mxc_ehci_data imx31_mxc_ehci_hs_data[] __initconst = {
34 imx_mxc_ehci_data_entry_single(MX31, 1, HS1),
35 imx_mxc_ehci_data_entry_single(MX31, 2, HS2),
36};
37#endif /* ifdef CONFIG_SOC_IMX31 */
38
39#ifdef CONFIG_SOC_IMX35
40const struct imx_mxc_ehci_data imx35_mxc_ehci_otg_data __initconst =
41 imx_mxc_ehci_data_entry_single(MX35, 0, OTG);
42const struct imx_mxc_ehci_data imx35_mxc_ehci_hs_data __initconst =
43 imx_mxc_ehci_data_entry_single(MX35, 1, HS);
44#endif /* ifdef CONFIG_SOC_IMX35 */
45
2eb42d5c
UKK
46struct platform_device *__init imx_add_mxc_ehci(
47 const struct imx_mxc_ehci_data *data,
48 const struct mxc_usbh_platform_data *pdata)
49{
50 struct resource res[] = {
51 {
52 .start = data->iobase,
53 .end = data->iobase + SZ_512 - 1,
54 .flags = IORESOURCE_MEM,
55 }, {
56 .start = data->irq,
57 .end = data->irq,
58 .flags = IORESOURCE_IRQ,
59 },
60 };
61 return imx_add_platform_device_dmamask("mxc-ehci", data->id,
62 res, ARRAY_SIZE(res),
63 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
64}