Linux-libre 5.3.12-gnu
[librecmc/linux-libre.git] / arch / arm / mach-imx / devices / platform-imx21-hcd.c
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright (C) 2010 Pengutronix
4  * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
5  */
6 #include "../hardware.h"
7 #include "devices-common.h"
8
9 #define imx_imx21_hcd_data_entry_single(soc)                            \
10         {                                                               \
11                 .iobase = soc ## _USBOTG_BASE_ADDR,                     \
12                 .irq = soc ## _INT_USBHOST,                             \
13         }
14
15 #ifdef CONFIG_SOC_IMX21
16 const struct imx_imx21_hcd_data imx21_imx21_hcd_data __initconst =
17         imx_imx21_hcd_data_entry_single(MX21);
18 #endif /* ifdef CONFIG_SOC_IMX21 */
19
20 struct platform_device *__init imx_add_imx21_hcd(
21                 const struct imx_imx21_hcd_data *data,
22                 const struct mx21_usbh_platform_data *pdata)
23 {
24         struct resource res[] = {
25                 {
26                         .start = data->iobase,
27                         .end = data->iobase + SZ_8K - 1,
28                         .flags = IORESOURCE_MEM,
29                 }, {
30                         .start = data->irq,
31                         .end = data->irq,
32                         .flags = IORESOURCE_IRQ,
33                 },
34         };
35         return imx_add_platform_device_dmamask("imx21-hcd", 0,
36                         res, ARRAY_SIZE(res),
37                         pdata, sizeof(*pdata), DMA_BIT_MASK(32));
38 }