blob: 37e44398197b4703b7130734d166963f9e894e01 [file] [log] [blame]
Uwe Kleine-Königbd455ed2010-11-09 17:52:14 +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önigbd455ed2010-11-09 17:52:14 +010013
14#define imx_fsl_usb2_udc_data_entry_single(soc) \
15 { \
16 .iobase = soc ## _USB_OTG_BASE_ADDR, \
17 .irq = soc ## _INT_USB_OTG, \
18 }
19
Uwe Kleine-König972cc482010-11-11 18:35:01 +010020#ifdef CONFIG_SOC_IMX25
Uwe Kleine-König224b8c82010-11-10 21:50:07 +010021const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data __initconst =
22 imx_fsl_usb2_udc_data_entry_single(MX25);
Uwe Kleine-König972cc482010-11-11 18:35:01 +010023#endif /* ifdef CONFIG_SOC_IMX25 */
Uwe Kleine-König224b8c82010-11-10 21:50:07 +010024
Uwe Kleine-Königbd455ed2010-11-09 17:52:14 +010025#ifdef CONFIG_SOC_IMX27
26const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst =
27 imx_fsl_usb2_udc_data_entry_single(MX27);
28#endif /* ifdef CONFIG_SOC_IMX27 */
29
Uwe Kleine-König9e1dde32010-11-12 16:40:06 +010030#ifdef CONFIG_SOC_IMX31
31const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst =
32 imx_fsl_usb2_udc_data_entry_single(MX31);
33#endif /* ifdef CONFIG_SOC_IMX31 */
34
35#ifdef CONFIG_SOC_IMX35
36const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst =
37 imx_fsl_usb2_udc_data_entry_single(MX35);
38#endif /* ifdef CONFIG_SOC_IMX35 */
39
Uwe Kleine-König6cafe482011-07-30 23:57:25 +020040#ifdef CONFIG_SOC_IMX51
41const struct imx_fsl_usb2_udc_data imx51_fsl_usb2_udc_data __initconst =
42 imx_fsl_usb2_udc_data_entry_single(MX51);
43#endif
44
Uwe Kleine-Königbd455ed2010-11-09 17:52:14 +010045struct platform_device *__init imx_add_fsl_usb2_udc(
46 const struct imx_fsl_usb2_udc_data *data,
47 const struct fsl_usb2_platform_data *pdata)
48{
49 struct resource res[] = {
50 {
51 .start = data->iobase,
52 .end = data->iobase + SZ_512 - 1,
53 .flags = IORESOURCE_MEM,
54 }, {
55 .start = data->irq,
56 .end = data->irq,
57 .flags = IORESOURCE_IRQ,
58 },
59 };
60 return imx_add_platform_device_dmamask("fsl-usb2-udc", -1,
61 res, ARRAY_SIZE(res),
62 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
63}