• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <linux/dma-mapping.h>
7 
8 #include "../hardware.h"
9 #include "devices-common.h"
10 
11 #define imx_fsl_usb2_udc_data_entry_single(soc, _devid)			\
12 	{								\
13 		.devid = _devid,					\
14 		.iobase = soc ## _USB_OTG_BASE_ADDR,			\
15 		.irq = soc ## _INT_USB_OTG,				\
16 	}
17 
18 #ifdef CONFIG_SOC_IMX27
19 const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst =
20 	imx_fsl_usb2_udc_data_entry_single(MX27, "imx-udc-mx27");
21 #endif /* ifdef CONFIG_SOC_IMX27 */
22 
23 #ifdef CONFIG_SOC_IMX31
24 const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst =
25 	imx_fsl_usb2_udc_data_entry_single(MX31, "imx-udc-mx27");
26 #endif /* ifdef CONFIG_SOC_IMX31 */
27 
28 #ifdef CONFIG_SOC_IMX35
29 const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst =
30 	imx_fsl_usb2_udc_data_entry_single(MX35, "imx-udc-mx27");
31 #endif /* ifdef CONFIG_SOC_IMX35 */
32 
imx_add_fsl_usb2_udc(const struct imx_fsl_usb2_udc_data * data,const struct fsl_usb2_platform_data * pdata)33 struct platform_device *__init imx_add_fsl_usb2_udc(
34 		const struct imx_fsl_usb2_udc_data *data,
35 		const struct fsl_usb2_platform_data *pdata)
36 {
37 	struct resource res[] = {
38 		{
39 			.start = data->iobase,
40 			.end = data->iobase + SZ_512 - 1,
41 			.flags = IORESOURCE_MEM,
42 		}, {
43 			.start = data->irq,
44 			.end = data->irq,
45 			.flags = IORESOURCE_IRQ,
46 		},
47 	};
48 	return imx_add_platform_device_dmamask(data->devid, -1,
49 			res, ARRAY_SIZE(res),
50 			pdata, sizeof(*pdata), DMA_BIT_MASK(32));
51 }
52