aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-03-02 03:27:42 -0500
committerSascha Hauer <s.hauer@pengutronix.de>2011-03-07 13:29:41 -0500
commit48f6b0999673cce33e4a54d89c78460cc28e5156 (patch)
tree1ada2b337a7af540246968a9150b0c0a8ebabc3c /arch/arm/mach-imx
parent94573e6623cf9159f036adc670a3d4b29e6d86fe (diff)
ARM i.MX: introduce imx_otg_ulpi_create to create ULPI transceivers
The boards are currently using otg_ulpi_create and mxc_ulpi_access_ops, both are only present if CONFIG_USB_ULPI is set. To remove the need of ifdefs in the board code introduce a imx_otg_ulpi_create functions which expands to a static inline function if compiled without ulpi. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r--arch/arm/mach-imx/mach-cpuimx27.c24
-rw-r--r--arch/arm/mach-imx/mach-mx27_3ds.c13
-rw-r--r--arch/arm/mach-imx/mach-pca100.c21
3 files changed, 25 insertions, 33 deletions
diff --git a/arch/arm/mach-imx/mach-cpuimx27.c b/arch/arm/mach-imx/mach-cpuimx27.c
index 6b724c2ed0a7..759299bb035b 100644
--- a/arch/arm/mach-imx/mach-cpuimx27.c
+++ b/arch/arm/mach-imx/mach-cpuimx27.c
@@ -209,7 +209,6 @@ static struct platform_device serial_device = {
209}; 209};
210#endif 210#endif
211 211
212#if defined(CONFIG_USB_ULPI)
213static int eukrea_cpuimx27_otg_init(struct platform_device *pdev) 212static int eukrea_cpuimx27_otg_init(struct platform_device *pdev)
214{ 213{
215 return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI); 214 return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);
@@ -229,7 +228,6 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
229 .init = eukrea_cpuimx27_usbh2_init, 228 .init = eukrea_cpuimx27_usbh2_init,
230 .portsc = MXC_EHCI_MODE_ULPI, 229 .portsc = MXC_EHCI_MODE_ULPI,
231}; 230};
232#endif
233 231
234static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { 232static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
235 .operating_mode = FSL_USB2_DR_DEVICE, 233 .operating_mode = FSL_USB2_DR_DEVICE,
@@ -283,21 +281,19 @@ static void __init eukrea_cpuimx27_init(void)
283 platform_device_register(&serial_device); 281 platform_device_register(&serial_device);
284#endif 282#endif
285 283
286#if defined(CONFIG_USB_ULPI)
287 if (otg_mode_host) { 284 if (otg_mode_host) {
288 otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, 285 otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
289 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); 286 ULPI_OTG_DRVVBUS_EXT);
290 287 if (otg_pdata.otg)
291 imx27_add_mxc_ehci_otg(&otg_pdata); 288 imx27_add_mxc_ehci_otg(&otg_pdata);
289 } else {
290 imx27_add_fsl_usb2_udc(&otg_device_pdata);
292 } 291 }
293 292
294 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, 293 usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
295 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); 294 ULPI_OTG_DRVVBUS_EXT);
296 295 if (usbh2_pdata.otg)
297 imx27_add_mxc_ehci_hs(2, &usbh2_pdata); 296 imx27_add_mxc_ehci_hs(2, &usbh2_pdata);
298#endif
299 if (!otg_mode_host)
300 imx27_add_fsl_usb2_udc(&otg_device_pdata);
301 297
302#ifdef CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD 298#ifdef CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD
303 eukrea_mbimx27_baseboard_init(); 299 eukrea_mbimx27_baseboard_init();
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c
index f4f2725b6945..614b3c00c4a0 100644
--- a/arch/arm/mach-imx/mach-mx27_3ds.c
+++ b/arch/arm/mach-imx/mach-mx27_3ds.c
@@ -162,7 +162,6 @@ static int otg_phy_init(void)
162 return 0; 162 return 0;
163} 163}
164 164
165#if defined(CONFIG_USB_ULPI)
166static int mx27_3ds_otg_init(struct platform_device *pdev) 165static int mx27_3ds_otg_init(struct platform_device *pdev)
167{ 166{
168 return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI); 167 return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);
@@ -172,7 +171,6 @@ static struct mxc_usbh_platform_data otg_pdata __initdata = {
172 .init = mx27_3ds_otg_init, 171 .init = mx27_3ds_otg_init,
173 .portsc = MXC_EHCI_MODE_ULPI, 172 .portsc = MXC_EHCI_MODE_ULPI,
174}; 173};
175#endif
176 174
177static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { 175static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
178 .operating_mode = FSL_USB2_DR_DEVICE, 176 .operating_mode = FSL_USB2_DR_DEVICE,
@@ -275,14 +273,15 @@ static void __init mx27pdk_init(void)
275 imx27_add_mxc_mmc(0, &sdhc1_pdata); 273 imx27_add_mxc_mmc(0, &sdhc1_pdata);
276 imx27_add_imx2_wdt(NULL); 274 imx27_add_imx2_wdt(NULL);
277 otg_phy_init(); 275 otg_phy_init();
278#if defined(CONFIG_USB_ULPI) 276
279 if (otg_mode_host) { 277 if (otg_mode_host) {
280 otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, 278 otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
281 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); 279 ULPI_OTG_DRVVBUS_EXT);
282 280
283 imx27_add_mxc_ehci_otg(&otg_pdata); 281 if (otg_pdata.otg)
282 imx27_add_mxc_ehci_otg(&otg_pdata);
284 } 283 }
285#endif 284
286 if (!otg_mode_host) 285 if (!otg_mode_host)
287 imx27_add_fsl_usb2_udc(&otg_device_pdata); 286 imx27_add_fsl_usb2_udc(&otg_device_pdata);
288 287
diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
index f754bab040b6..63e182556778 100644
--- a/arch/arm/mach-imx/mach-pca100.c
+++ b/arch/arm/mach-imx/mach-pca100.c
@@ -267,7 +267,6 @@ static const struct imxmmc_platform_data sdhc_pdata __initconst = {
267 .exit = pca100_sdhc2_exit, 267 .exit = pca100_sdhc2_exit,
268}; 268};
269 269
270#if defined(CONFIG_USB_ULPI)
271static int otg_phy_init(struct platform_device *pdev) 270static int otg_phy_init(struct platform_device *pdev)
272{ 271{
273 gpio_set_value(OTG_PHY_CS_GPIO, 0); 272 gpio_set_value(OTG_PHY_CS_GPIO, 0);
@@ -295,7 +294,6 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
295 .init = usbh2_phy_init, 294 .init = usbh2_phy_init,
296 .portsc = MXC_EHCI_MODE_ULPI, 295 .portsc = MXC_EHCI_MODE_ULPI,
297}; 296};
298#endif
299 297
300static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { 298static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
301 .operating_mode = FSL_USB2_DR_DEVICE, 299 .operating_mode = FSL_USB2_DR_DEVICE,
@@ -402,23 +400,22 @@ static void __init pca100_init(void)
402 gpio_request(USBH2_PHY_CS_GPIO, "usb-host2-cs"); 400 gpio_request(USBH2_PHY_CS_GPIO, "usb-host2-cs");
403 gpio_direction_output(USBH2_PHY_CS_GPIO, 1); 401 gpio_direction_output(USBH2_PHY_CS_GPIO, 1);
404 402
405#if defined(CONFIG_USB_ULPI)
406 if (otg_mode_host) { 403 if (otg_mode_host) {
407 otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, 404 otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
408 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); 405 ULPI_OTG_DRVVBUS_EXT);
409 406
410 imx27_add_mxc_ehci_otg(&otg_pdata); 407 if (otg_pdata.otg)
408 imx27_add_mxc_ehci_otg(&otg_pdata);
409 } else {
410 gpio_set_value(OTG_PHY_CS_GPIO, 0);
411 imx27_add_fsl_usb2_udc(&otg_device_pdata);
411 } 412 }
412 413
413 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, 414 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
414 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); 415 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
415 416
416 imx27_add_mxc_ehci_hs(2, &usbh2_pdata); 417 if (usbh2_pdata.otg)
417#endif 418 imx27_add_mxc_ehci_hs(2, &usbh2_pdata);
418 if (!otg_mode_host) {
419 gpio_set_value(OTG_PHY_CS_GPIO, 0);
420 imx27_add_fsl_usb2_udc(&otg_device_pdata);
421 }
422 419
423 imx27_add_imx_fb(&pca100_fb_data); 420 imx27_add_imx_fb(&pca100_fb_data);
424 421