diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-10 15:27:55 -0500 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-17 04:01:36 -0500 |
commit | 2c20b9f19add2248dc867f1f78dcef1eb0944543 (patch) | |
tree | c7b6861e16bc9fb9d4d25cb4c5730e4509af5033 /arch/arm | |
parent | e9f0bafb4f3d32d0bc0ea7e946d667a68bae59ce (diff) |
ARM: mx25: dynamically allocate mxc-ehci devices
According to the reference manual of the i.MX25 the host controller uses an
offset of 0x200 not 0x400 as was specified in the resources for mxc_usbh2.
Needs-Testing: yes
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-mx25/Kconfig | 6 | ||||
-rw-r--r-- | arch/arm/mach-mx25/devices-imx25.h | 7 | ||||
-rw-r--r-- | arch/arm/mach-mx25/devices.c | 44 | ||||
-rw-r--r-- | arch/arm/mach-mx25/devices.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-mx25/mach-cpuimx25.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-mx25/mach-mx25_3ds.c | 2 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/platform-mxc-ehci.c | 7 | ||||
-rw-r--r-- | arch/arm/plat-mxc/ehci.c | 4 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/mx25.h | 6 |
9 files changed, 34 insertions, 53 deletions
diff --git a/arch/arm/mach-mx25/Kconfig b/arch/arm/mach-mx25/Kconfig index 38ca09a5df9d..b55585bf93fd 100644 --- a/arch/arm/mach-mx25/Kconfig +++ b/arch/arm/mach-mx25/Kconfig | |||
@@ -5,16 +5,18 @@ comment "MX25 platforms:" | |||
5 | config MACH_MX25_3DS | 5 | config MACH_MX25_3DS |
6 | bool "Support MX25PDK (3DS) Platform" | 6 | bool "Support MX25PDK (3DS) Platform" |
7 | select IMX_HAVE_PLATFORM_IMX_UART | 7 | select IMX_HAVE_PLATFORM_IMX_UART |
8 | select IMX_HAVE_PLATFORM_MXC_EHCI | ||
8 | select IMX_HAVE_PLATFORM_MXC_NAND | 9 | select IMX_HAVE_PLATFORM_MXC_NAND |
9 | select IMX_HAVE_PLATFORM_ESDHC | 10 | select IMX_HAVE_PLATFORM_ESDHC |
10 | 11 | ||
11 | config MACH_EUKREA_CPUIMX25 | 12 | config MACH_EUKREA_CPUIMX25 |
12 | bool "Support Eukrea CPUIMX25 Platform" | 13 | bool "Support Eukrea CPUIMX25 Platform" |
14 | select IMX_HAVE_PLATFORM_ESDHC | ||
15 | select IMX_HAVE_PLATFORM_FLEXCAN | ||
13 | select IMX_HAVE_PLATFORM_IMX_I2C | 16 | select IMX_HAVE_PLATFORM_IMX_I2C |
14 | select IMX_HAVE_PLATFORM_IMX_UART | 17 | select IMX_HAVE_PLATFORM_IMX_UART |
18 | select IMX_HAVE_PLATFORM_MXC_EHCI | ||
15 | select IMX_HAVE_PLATFORM_MXC_NAND | 19 | select IMX_HAVE_PLATFORM_MXC_NAND |
16 | select IMX_HAVE_PLATFORM_FLEXCAN | ||
17 | select IMX_HAVE_PLATFORM_ESDHC | ||
18 | select MXC_ULPI if USB_ULPI | 20 | select MXC_ULPI if USB_ULPI |
19 | 21 | ||
20 | choice | 22 | choice |
diff --git a/arch/arm/mach-mx25/devices-imx25.h b/arch/arm/mach-mx25/devices-imx25.h index f62ce93ccbcd..ac343ae7fe43 100644 --- a/arch/arm/mach-mx25/devices-imx25.h +++ b/arch/arm/mach-mx25/devices-imx25.h | |||
@@ -39,6 +39,13 @@ extern const struct imx_imx_uart_1irq_data imx25_imx_uart_data[] __initconst; | |||
39 | #define imx25_add_imx_uart3(pdata) imx25_add_imx_uart(3, pdata) | 39 | #define imx25_add_imx_uart3(pdata) imx25_add_imx_uart(3, pdata) |
40 | #define imx25_add_imx_uart4(pdata) imx25_add_imx_uart(4, pdata) | 40 | #define imx25_add_imx_uart4(pdata) imx25_add_imx_uart(4, pdata) |
41 | 41 | ||
42 | extern const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst; | ||
43 | #define imx25_add_mxc_ehci_otg(pdata) \ | ||
44 | imx_add_mxc_ehci(&imx25_mxc_ehci_otg_data, pdata) | ||
45 | extern const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst; | ||
46 | #define imx25_add_mxc_ehci_hs(pdata) \ | ||
47 | imx_add_mxc_ehci(&imx25_mxc_ehci_hs_data, pdata) | ||
48 | |||
42 | extern const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst; | 49 | extern const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst; |
43 | #define imx25_add_mxc_nand(pdata) \ | 50 | #define imx25_add_mxc_nand(pdata) \ |
44 | imx_add_mxc_nand(&imx25_mxc_nand_data, pdata) | 51 | imx_add_mxc_nand(&imx25_mxc_nand_data, pdata) |
diff --git a/arch/arm/mach-mx25/devices.c b/arch/arm/mach-mx25/devices.c index 92eb1a90b52c..4611c763ff17 100644 --- a/arch/arm/mach-mx25/devices.c +++ b/arch/arm/mach-mx25/devices.c | |||
@@ -26,27 +26,16 @@ static u64 otg_dmamask = DMA_BIT_MASK(32); | |||
26 | 26 | ||
27 | static struct resource mxc_otg_resources[] = { | 27 | static struct resource mxc_otg_resources[] = { |
28 | { | 28 | { |
29 | .start = MX25_OTG_BASE_ADDR, | 29 | .start = MX25_USB_OTG_BASE_ADDR, |
30 | .end = MX25_OTG_BASE_ADDR + 0x1ff, | 30 | .end = MX25_USB_OTG_BASE_ADDR + 0x1ff, |
31 | .flags = IORESOURCE_MEM, | 31 | .flags = IORESOURCE_MEM, |
32 | }, { | 32 | }, { |
33 | .start = 37, | 33 | .start = MX25_INT_USB_OTG, |
34 | .end = 37, | 34 | .end = MX25_INT_USB_OTG, |
35 | .flags = IORESOURCE_IRQ, | 35 | .flags = IORESOURCE_IRQ, |
36 | }, | 36 | }, |
37 | }; | 37 | }; |
38 | 38 | ||
39 | struct platform_device mxc_otg = { | ||
40 | .name = "mxc-ehci", | ||
41 | .id = 0, | ||
42 | .dev = { | ||
43 | .coherent_dma_mask = 0xffffffff, | ||
44 | .dma_mask = &otg_dmamask, | ||
45 | }, | ||
46 | .resource = mxc_otg_resources, | ||
47 | .num_resources = ARRAY_SIZE(mxc_otg_resources), | ||
48 | }; | ||
49 | |||
50 | /* OTG gadget device */ | 39 | /* OTG gadget device */ |
51 | struct platform_device otg_udc_device = { | 40 | struct platform_device otg_udc_device = { |
52 | .name = "fsl-usb2-udc", | 41 | .name = "fsl-usb2-udc", |
@@ -59,31 +48,6 @@ struct platform_device otg_udc_device = { | |||
59 | .num_resources = ARRAY_SIZE(mxc_otg_resources), | 48 | .num_resources = ARRAY_SIZE(mxc_otg_resources), |
60 | }; | 49 | }; |
61 | 50 | ||
62 | static u64 usbh2_dmamask = DMA_BIT_MASK(32); | ||
63 | |||
64 | static struct resource mxc_usbh2_resources[] = { | ||
65 | { | ||
66 | .start = MX25_OTG_BASE_ADDR + 0x400, | ||
67 | .end = MX25_OTG_BASE_ADDR + 0x5ff, | ||
68 | .flags = IORESOURCE_MEM, | ||
69 | }, { | ||
70 | .start = 35, | ||
71 | .end = 35, | ||
72 | .flags = IORESOURCE_IRQ, | ||
73 | }, | ||
74 | }; | ||
75 | |||
76 | struct platform_device mxc_usbh2 = { | ||
77 | .name = "mxc-ehci", | ||
78 | .id = 1, | ||
79 | .dev = { | ||
80 | .coherent_dma_mask = 0xffffffff, | ||
81 | .dma_mask = &usbh2_dmamask, | ||
82 | }, | ||
83 | .resource = mxc_usbh2_resources, | ||
84 | .num_resources = ARRAY_SIZE(mxc_usbh2_resources), | ||
85 | }; | ||
86 | |||
87 | static struct resource mxc_pwm_resources0[] = { | 51 | static struct resource mxc_pwm_resources0[] = { |
88 | { | 52 | { |
89 | .start = 0x53fe0000, | 53 | .start = 0x53fe0000, |
diff --git a/arch/arm/mach-mx25/devices.h b/arch/arm/mach-mx25/devices.h index 7b70a43c3a4b..e6ad64061963 100644 --- a/arch/arm/mach-mx25/devices.h +++ b/arch/arm/mach-mx25/devices.h | |||
@@ -1,6 +1,4 @@ | |||
1 | extern struct platform_device mxc_otg; | ||
2 | extern struct platform_device otg_udc_device; | 1 | extern struct platform_device otg_udc_device; |
3 | extern struct platform_device mxc_usbh2; | ||
4 | extern struct platform_device mxc_pwm_device0; | 2 | extern struct platform_device mxc_pwm_device0; |
5 | extern struct platform_device mxc_pwm_device1; | 3 | extern struct platform_device mxc_pwm_device1; |
6 | extern struct platform_device mxc_pwm_device2; | 4 | extern struct platform_device mxc_pwm_device2; |
diff --git a/arch/arm/mach-mx25/mach-cpuimx25.c b/arch/arm/mach-mx25/mach-cpuimx25.c index f6f9ad60c25e..0ee0fe73952d 100644 --- a/arch/arm/mach-mx25/mach-cpuimx25.c +++ b/arch/arm/mach-mx25/mach-cpuimx25.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include <mach/mx25.h> | 39 | #include <mach/mx25.h> |
40 | #include <mach/mxc_nand.h> | 40 | #include <mach/mxc_nand.h> |
41 | #include <mach/imxfb.h> | 41 | #include <mach/imxfb.h> |
42 | #include <mach/mxc_ehci.h> | ||
43 | #include <mach/iomux-mx25.h> | 42 | #include <mach/iomux-mx25.h> |
44 | 43 | ||
45 | #include "devices-imx25.h" | 44 | #include "devices-imx25.h" |
@@ -87,12 +86,12 @@ static struct i2c_board_info eukrea_cpuimx25_i2c_devices[] = { | |||
87 | }, | 86 | }, |
88 | }; | 87 | }; |
89 | 88 | ||
90 | static struct mxc_usbh_platform_data otg_pdata = { | 89 | static const struct mxc_usbh_platform_data otg_pdata __initconst = { |
91 | .portsc = MXC_EHCI_MODE_UTMI, | 90 | .portsc = MXC_EHCI_MODE_UTMI, |
92 | .flags = MXC_EHCI_INTERFACE_DIFF_UNI, | 91 | .flags = MXC_EHCI_INTERFACE_DIFF_UNI, |
93 | }; | 92 | }; |
94 | 93 | ||
95 | static struct mxc_usbh_platform_data usbh2_pdata = { | 94 | static const struct mxc_usbh_platform_data usbh2_pdata __initconst = { |
96 | .portsc = MXC_EHCI_MODE_SERIAL, | 95 | .portsc = MXC_EHCI_MODE_SERIAL, |
97 | .flags = MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY | | 96 | .flags = MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY | |
98 | MXC_EHCI_IPPUE_DOWN, | 97 | MXC_EHCI_IPPUE_DOWN, |
@@ -134,11 +133,11 @@ static void __init eukrea_cpuimx25_init(void) | |||
134 | imx25_add_imx_i2c0(&eukrea_cpuimx25_i2c0_data); | 133 | imx25_add_imx_i2c0(&eukrea_cpuimx25_i2c0_data); |
135 | 134 | ||
136 | if (otg_mode_host) | 135 | if (otg_mode_host) |
137 | mxc_register_device(&mxc_otg, &otg_pdata); | 136 | imx25_add_mxc_ehci_otg(&otg_pdata); |
138 | else | 137 | else |
139 | mxc_register_device(&otg_udc_device, &otg_device_pdata); | 138 | mxc_register_device(&otg_udc_device, &otg_device_pdata); |
140 | 139 | ||
141 | mxc_register_device(&mxc_usbh2, &usbh2_pdata); | 140 | imx25_add_mxc_ehci_hs(&usbh2_pdata); |
142 | 141 | ||
143 | #ifdef CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD | 142 | #ifdef CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD |
144 | eukrea_mbimxsd25_baseboard_init(); | 143 | eukrea_mbimxsd25_baseboard_init(); |
diff --git a/arch/arm/mach-mx25/mach-mx25_3ds.c b/arch/arm/mach-mx25/mach-mx25_3ds.c index f8be1eb0c062..574c41f510df 100644 --- a/arch/arm/mach-mx25/mach-mx25_3ds.c +++ b/arch/arm/mach-mx25/mach-mx25_3ds.c | |||
@@ -192,7 +192,7 @@ static void __init mx25pdk_init(void) | |||
192 | ARRAY_SIZE(mx25pdk_pads)); | 192 | ARRAY_SIZE(mx25pdk_pads)); |
193 | 193 | ||
194 | imx25_add_imx_uart0(&uart_pdata); | 194 | imx25_add_imx_uart0(&uart_pdata); |
195 | mxc_register_device(&mxc_usbh2, NULL); | 195 | imx25_add_mxc_ehci_hs(NULL); |
196 | imx25_add_mxc_nand(&mx25pdk_nand_board_info); | 196 | imx25_add_mxc_nand(&mx25pdk_nand_board_info); |
197 | mxc_register_device(&mx25_rtc_device, NULL); | 197 | mxc_register_device(&mx25_rtc_device, NULL); |
198 | mxc_register_device(&mx25_fb_device, &mx25pdk_fb_pdata); | 198 | mxc_register_device(&mx25_fb_device, &mx25pdk_fb_pdata); |
diff --git a/arch/arm/plat-mxc/devices/platform-mxc-ehci.c b/arch/arm/plat-mxc/devices/platform-mxc-ehci.c index 0cb67bb6e5b1..825a048cab1d 100644 --- a/arch/arm/plat-mxc/devices/platform-mxc-ehci.c +++ b/arch/arm/plat-mxc/devices/platform-mxc-ehci.c | |||
@@ -16,6 +16,13 @@ | |||
16 | .irq = soc ## _INT_USB_ ## hs, \ | 16 | .irq = soc ## _INT_USB_ ## hs, \ |
17 | } | 17 | } |
18 | 18 | ||
19 | #ifdef CONFIG_ARCH_MX25 | ||
20 | const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst = | ||
21 | imx_mxc_ehci_data_entry_single(MX25, 0, OTG); | ||
22 | const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst = | ||
23 | imx_mxc_ehci_data_entry_single(MX25, 1, HS); | ||
24 | #endif /* ifdef CONFIG_ARCH_MX25 */ | ||
25 | |||
19 | #ifdef CONFIG_SOC_IMX27 | 26 | #ifdef CONFIG_SOC_IMX27 |
20 | const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst = | 27 | const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst = |
21 | imx_mxc_ehci_data_entry_single(MX27, 0, OTG); | 28 | imx_mxc_ehci_data_entry_single(MX27, 0, OTG); |
diff --git a/arch/arm/plat-mxc/ehci.c b/arch/arm/plat-mxc/ehci.c index 9915607683de..f699235fdf5d 100644 --- a/arch/arm/plat-mxc/ehci.c +++ b/arch/arm/plat-mxc/ehci.c | |||
@@ -71,7 +71,7 @@ int mxc_initialize_usb_hw(int port, unsigned int flags) | |||
71 | unsigned int v; | 71 | unsigned int v; |
72 | #if defined(CONFIG_ARCH_MX25) | 72 | #if defined(CONFIG_ARCH_MX25) |
73 | if (cpu_is_mx25()) { | 73 | if (cpu_is_mx25()) { |
74 | v = readl(MX25_IO_ADDRESS(MX25_OTG_BASE_ADDR + | 74 | v = readl(MX25_IO_ADDRESS(MX25_USB_BASE_ADDR + |
75 | USBCTRL_OTGBASE_OFFSET)); | 75 | USBCTRL_OTGBASE_OFFSET)); |
76 | 76 | ||
77 | switch (port) { | 77 | switch (port) { |
@@ -108,7 +108,7 @@ int mxc_initialize_usb_hw(int port, unsigned int flags) | |||
108 | return -EINVAL; | 108 | return -EINVAL; |
109 | } | 109 | } |
110 | 110 | ||
111 | writel(v, MX25_IO_ADDRESS(MX25_OTG_BASE_ADDR + | 111 | writel(v, MX25_IO_ADDRESS(MX25_USB_BASE_ADDR + |
112 | USBCTRL_OTGBASE_OFFSET)); | 112 | USBCTRL_OTGBASE_OFFSET)); |
113 | return 0; | 113 | return 0; |
114 | } | 114 | } |
diff --git a/arch/arm/plat-mxc/include/mach/mx25.h b/arch/arm/plat-mxc/include/mach/mx25.h index a2404b0d9808..0d31f828d218 100644 --- a/arch/arm/plat-mxc/include/mach/mx25.h +++ b/arch/arm/plat-mxc/include/mach/mx25.h | |||
@@ -43,7 +43,9 @@ | |||
43 | #define MX25_LCDC_BASE_ADDR 0x53fbc000 | 43 | #define MX25_LCDC_BASE_ADDR 0x53fbc000 |
44 | #define MX25_KPP_BASE_ADDR 0x43fa8000 | 44 | #define MX25_KPP_BASE_ADDR 0x43fa8000 |
45 | #define MX25_SDMA_BASE_ADDR 0x53fd4000 | 45 | #define MX25_SDMA_BASE_ADDR 0x53fd4000 |
46 | #define MX25_OTG_BASE_ADDR 0x53ff4000 | 46 | #define MX25_USB_BASE_ADDR 0x53ff4000 |
47 | #define MX25_USB_OTG_BASE_ADDR (MX25_USB_BASE_ADDR + 0x0000) | ||
48 | #define MX25_USB_HS_BASE_ADDR (MX25_USB_BASE_ADDR + 0x0200) | ||
47 | #define MX25_CSI_BASE_ADDR 0x53ff8000 | 49 | #define MX25_CSI_BASE_ADDR 0x53ff8000 |
48 | 50 | ||
49 | #define MX25_IO_P2V(x) IMX_IO_P2V(x) | 51 | #define MX25_IO_P2V(x) IMX_IO_P2V(x) |
@@ -67,6 +69,8 @@ | |||
67 | #define MX25_INT_UART2 32 | 69 | #define MX25_INT_UART2 32 |
68 | #define MX25_INT_NFC 33 | 70 | #define MX25_INT_NFC 33 |
69 | #define MX25_INT_SDMA 34 | 71 | #define MX25_INT_SDMA 34 |
72 | #define MX25_INT_USB_HS 35 | ||
73 | #define MX25_INT_USB_OTG 37 | ||
70 | #define MX25_INT_LCDC 39 | 74 | #define MX25_INT_LCDC 39 |
71 | #define MX25_INT_UART5 40 | 75 | #define MX25_INT_UART5 40 |
72 | #define MX25_INT_CAN1 43 | 76 | #define MX25_INT_CAN1 43 |