Uwe Kleine-König | 2eb42d5 | 2010-11-05 18:52:09 +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 | */ |
Alexey Dobriyan | b7f080c | 2011-06-16 11:01:34 +0000 | [diff] [blame] | 9 | #include <linux/dma-mapping.h> |
Shawn Guo | 50f2de6 | 2012-09-14 14:14:45 +0800 | [diff] [blame] | 10 | |
| 11 | #include "../hardware.h" |
Shawn Guo | e0557c0 | 2012-09-13 15:51:15 +0800 | [diff] [blame] | 12 | #include "devices-common.h" |
Uwe Kleine-König | 2eb42d5 | 2010-11-05 18:52:09 +0100 | [diff] [blame] | 13 | |
| 14 | #define imx_mxc_ehci_data_entry_single(soc, _id, hs) \ |
| 15 | { \ |
| 16 | .id = _id, \ |
| 17 | .iobase = soc ## _USB_ ## hs ## _BASE_ADDR, \ |
| 18 | .irq = soc ## _INT_USB_ ## hs, \ |
| 19 | } |
| 20 | |
Uwe Kleine-König | 972cc48 | 2010-11-11 18:35:01 +0100 | [diff] [blame] | 21 | #ifdef CONFIG_SOC_IMX25 |
Uwe Kleine-König | 2c20b9f | 2010-11-10 21:27:55 +0100 | [diff] [blame] | 22 | const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst = |
| 23 | imx_mxc_ehci_data_entry_single(MX25, 0, OTG); |
| 24 | const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst = |
| 25 | imx_mxc_ehci_data_entry_single(MX25, 1, HS); |
Uwe Kleine-König | 972cc48 | 2010-11-11 18:35:01 +0100 | [diff] [blame] | 26 | #endif /* ifdef CONFIG_SOC_IMX25 */ |
Uwe Kleine-König | 2c20b9f | 2010-11-10 21:27:55 +0100 | [diff] [blame] | 27 | |
Uwe Kleine-König | 2eb42d5 | 2010-11-05 18:52:09 +0100 | [diff] [blame] | 28 | #ifdef CONFIG_SOC_IMX27 |
| 29 | const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst = |
| 30 | imx_mxc_ehci_data_entry_single(MX27, 0, OTG); |
| 31 | const struct imx_mxc_ehci_data imx27_mxc_ehci_hs_data[] __initconst = { |
| 32 | imx_mxc_ehci_data_entry_single(MX27, 1, HS1), |
| 33 | imx_mxc_ehci_data_entry_single(MX27, 2, HS2), |
| 34 | }; |
| 35 | #endif /* ifdef CONFIG_SOC_IMX27 */ |
| 36 | |
Uwe Kleine-König | 2d58de2 | 2010-11-15 11:57:49 +0100 | [diff] [blame] | 37 | #ifdef CONFIG_SOC_IMX31 |
| 38 | const struct imx_mxc_ehci_data imx31_mxc_ehci_otg_data __initconst = |
| 39 | imx_mxc_ehci_data_entry_single(MX31, 0, OTG); |
| 40 | const struct imx_mxc_ehci_data imx31_mxc_ehci_hs_data[] __initconst = { |
| 41 | imx_mxc_ehci_data_entry_single(MX31, 1, HS1), |
| 42 | imx_mxc_ehci_data_entry_single(MX31, 2, HS2), |
| 43 | }; |
| 44 | #endif /* ifdef CONFIG_SOC_IMX31 */ |
| 45 | |
| 46 | #ifdef CONFIG_SOC_IMX35 |
| 47 | const struct imx_mxc_ehci_data imx35_mxc_ehci_otg_data __initconst = |
| 48 | imx_mxc_ehci_data_entry_single(MX35, 0, OTG); |
| 49 | const struct imx_mxc_ehci_data imx35_mxc_ehci_hs_data __initconst = |
| 50 | imx_mxc_ehci_data_entry_single(MX35, 1, HS); |
| 51 | #endif /* ifdef CONFIG_SOC_IMX35 */ |
| 52 | |
Uwe Kleine-König | 7d92e8e | 2011-07-30 23:41:49 +0200 | [diff] [blame] | 53 | #ifdef CONFIG_SOC_IMX51 |
| 54 | const struct imx_mxc_ehci_data imx51_mxc_ehci_otg_data __initconst = |
| 55 | imx_mxc_ehci_data_entry_single(MX51, 0, OTG); |
| 56 | const struct imx_mxc_ehci_data imx51_mxc_ehci_hs_data[] __initconst = { |
| 57 | imx_mxc_ehci_data_entry_single(MX51, 1, HS1), |
| 58 | imx_mxc_ehci_data_entry_single(MX51, 2, HS2), |
| 59 | }; |
| 60 | #endif /* ifdef CONFIG_SOC_IMX51 */ |
| 61 | |
Uwe Kleine-König | 2eb42d5 | 2010-11-05 18:52:09 +0100 | [diff] [blame] | 62 | struct platform_device *__init imx_add_mxc_ehci( |
| 63 | const struct imx_mxc_ehci_data *data, |
| 64 | const struct mxc_usbh_platform_data *pdata) |
| 65 | { |
| 66 | struct resource res[] = { |
| 67 | { |
| 68 | .start = data->iobase, |
| 69 | .end = data->iobase + SZ_512 - 1, |
| 70 | .flags = IORESOURCE_MEM, |
| 71 | }, { |
| 72 | .start = data->irq, |
| 73 | .end = data->irq, |
| 74 | .flags = IORESOURCE_IRQ, |
| 75 | }, |
| 76 | }; |
| 77 | return imx_add_platform_device_dmamask("mxc-ehci", data->id, |
| 78 | res, ARRAY_SIZE(res), |
| 79 | pdata, sizeof(*pdata), DMA_BIT_MASK(32)); |
| 80 | } |