Uwe Kleine-König | e083000 | 2010-11-02 10:03:51 +0100 | [diff] [blame] | 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 | */ |
Shawn Guo | 50f2de6 | 2012-09-14 14:14:45 +0800 | [diff] [blame] | 9 | #include "../hardware.h" |
Shawn Guo | e0557c0 | 2012-09-13 15:51:15 +0800 | [diff] [blame] | 10 | #include "devices-common.h" |
Uwe Kleine-König | e083000 | 2010-11-02 10:03:51 +0100 | [diff] [blame] | 11 | |
| 12 | #define imx_imx_udc_data_entry_single(soc, _size) \ |
| 13 | { \ |
| 14 | .iobase = soc ## _USBD_BASE_ADDR, \ |
| 15 | .iosize = _size, \ |
| 16 | .irq0 = soc ## _INT_USBD0, \ |
| 17 | .irq1 = soc ## _INT_USBD1, \ |
| 18 | .irq2 = soc ## _INT_USBD2, \ |
| 19 | .irq3 = soc ## _INT_USBD3, \ |
| 20 | .irq4 = soc ## _INT_USBD4, \ |
| 21 | .irq5 = soc ## _INT_USBD5, \ |
| 22 | .irq6 = soc ## _INT_USBD6, \ |
| 23 | } |
| 24 | |
| 25 | #define imx_imx_udc_data_entry(soc, _size) \ |
| 26 | [_id] = imx_imx_udc_data_entry_single(soc, _size) |
| 27 | |
| 28 | #ifdef CONFIG_SOC_IMX1 |
| 29 | const struct imx_imx_udc_data imx1_imx_udc_data __initconst = |
| 30 | imx_imx_udc_data_entry_single(MX1, SZ_4K); |
| 31 | #endif /* ifdef CONFIG_SOC_IMX1 */ |
| 32 | |
| 33 | struct platform_device *__init imx_add_imx_udc( |
| 34 | const struct imx_imx_udc_data *data, |
| 35 | const struct imxusb_platform_data *pdata) |
| 36 | { |
| 37 | struct resource res[] = { |
| 38 | { |
| 39 | .start = data->iobase, |
| 40 | .end = data->iobase + data->iosize - 1, |
| 41 | .flags = IORESOURCE_MEM, |
| 42 | }, { |
| 43 | .start = data->irq0, |
| 44 | .end = data->irq0, |
| 45 | .flags = IORESOURCE_IRQ, |
| 46 | }, { |
| 47 | .start = data->irq1, |
| 48 | .end = data->irq1, |
| 49 | .flags = IORESOURCE_IRQ, |
| 50 | }, { |
| 51 | .start = data->irq2, |
| 52 | .end = data->irq2, |
| 53 | .flags = IORESOURCE_IRQ, |
| 54 | }, { |
| 55 | .start = data->irq3, |
| 56 | .end = data->irq3, |
| 57 | .flags = IORESOURCE_IRQ, |
| 58 | }, { |
| 59 | .start = data->irq4, |
| 60 | .end = data->irq4, |
| 61 | .flags = IORESOURCE_IRQ, |
| 62 | }, { |
| 63 | .start = data->irq5, |
| 64 | .end = data->irq5, |
| 65 | .flags = IORESOURCE_IRQ, |
| 66 | }, { |
| 67 | .start = data->irq6, |
| 68 | .end = data->irq6, |
| 69 | .flags = IORESOURCE_IRQ, |
| 70 | }, |
| 71 | }; |
| 72 | |
| 73 | return imx_add_platform_device("imx_udc", 0, |
| 74 | res, ARRAY_SIZE(res), pdata, sizeof(*pdata)); |
| 75 | } |