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