blob: 23b0061347cba81f5fd8c63add9d8d57b7585d82 [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
Peter Chenf0ea8832013-01-17 18:03:15 +080014#define imx_fsl_usb2_udc_data_entry_single(soc, _devid) \
Uwe Kleine-Königbd455ed2010-11-09 17:52:14 +010015 { \
Peter Chenf0ea8832013-01-17 18:03:15 +080016 .devid = _devid, \
Uwe Kleine-Königbd455ed2010-11-09 17:52:14 +010017 .iobase = soc ## _USB_OTG_BASE_ADDR, \
18 .irq = soc ## _INT_USB_OTG, \
19 }
20
Uwe Kleine-König972cc482010-11-11 18:35:01 +010021#ifdef CONFIG_SOC_IMX25
Uwe Kleine-König224b8c82010-11-10 21:50:07 +010022const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data __initconst =
Peter Chenf0ea8832013-01-17 18:03:15 +080023 imx_fsl_usb2_udc_data_entry_single(MX25, "imx-udc-mx27");
Uwe Kleine-König972cc482010-11-11 18:35:01 +010024#endif /* ifdef CONFIG_SOC_IMX25 */
Uwe Kleine-König224b8c82010-11-10 21:50:07 +010025
Uwe Kleine-Königbd455ed2010-11-09 17:52:14 +010026#ifdef CONFIG_SOC_IMX27
27const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst =
Peter Chenf0ea8832013-01-17 18:03:15 +080028 imx_fsl_usb2_udc_data_entry_single(MX27, "imx-udc-mx27");
Uwe Kleine-Königbd455ed2010-11-09 17:52:14 +010029#endif /* ifdef CONFIG_SOC_IMX27 */
30
Uwe Kleine-König9e1dde32010-11-12 16:40:06 +010031#ifdef CONFIG_SOC_IMX31
32const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst =
Peter Chenf0ea8832013-01-17 18:03:15 +080033 imx_fsl_usb2_udc_data_entry_single(MX31, "imx-udc-mx27");
Uwe Kleine-König9e1dde32010-11-12 16:40:06 +010034#endif /* ifdef CONFIG_SOC_IMX31 */
35
36#ifdef CONFIG_SOC_IMX35
37const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst =
Peter Chenf0ea8832013-01-17 18:03:15 +080038 imx_fsl_usb2_udc_data_entry_single(MX35, "imx-udc-mx27");
Uwe Kleine-König9e1dde32010-11-12 16:40:06 +010039#endif /* ifdef CONFIG_SOC_IMX35 */
40
Uwe Kleine-Königbd455ed2010-11-09 17:52:14 +010041struct platform_device *__init imx_add_fsl_usb2_udc(
42 const struct imx_fsl_usb2_udc_data *data,
43 const struct fsl_usb2_platform_data *pdata)
44{
45 struct resource res[] = {
46 {
47 .start = data->iobase,
48 .end = data->iobase + SZ_512 - 1,
49 .flags = IORESOURCE_MEM,
50 }, {
51 .start = data->irq,
52 .end = data->irq,
53 .flags = IORESOURCE_IRQ,
54 },
55 };
Peter Chenf0ea8832013-01-17 18:03:15 +080056 return imx_add_platform_device_dmamask(data->devid, -1,
Uwe Kleine-Königbd455ed2010-11-09 17:52:14 +010057 res, ARRAY_SIZE(res),
58 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
59}