Commit 48f6b099 authored by Sascha Hauer's avatar Sascha Hauer

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: default avatarSascha Hauer <s.hauer@pengutronix.de>
parent 94573e66
...@@ -209,7 +209,6 @@ static struct platform_device serial_device = { ...@@ -209,7 +209,6 @@ static struct platform_device serial_device = {
}; };
#endif #endif
#if defined(CONFIG_USB_ULPI)
static int eukrea_cpuimx27_otg_init(struct platform_device *pdev) static int eukrea_cpuimx27_otg_init(struct platform_device *pdev)
{ {
return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI); 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,7 +228,6 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
.init = eukrea_cpuimx27_usbh2_init, .init = eukrea_cpuimx27_usbh2_init,
.portsc = MXC_EHCI_MODE_ULPI, .portsc = MXC_EHCI_MODE_ULPI,
}; };
#endif
static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
.operating_mode = FSL_USB2_DR_DEVICE, .operating_mode = FSL_USB2_DR_DEVICE,
...@@ -283,21 +281,19 @@ static void __init eukrea_cpuimx27_init(void) ...@@ -283,21 +281,19 @@ static void __init eukrea_cpuimx27_init(void)
platform_device_register(&serial_device); platform_device_register(&serial_device);
#endif #endif
#if defined(CONFIG_USB_ULPI)
if (otg_mode_host) { if (otg_mode_host) {
otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); ULPI_OTG_DRVVBUS_EXT);
if (otg_pdata.otg)
imx27_add_mxc_ehci_otg(&otg_pdata); imx27_add_mxc_ehci_otg(&otg_pdata);
} else {
imx27_add_fsl_usb2_udc(&otg_device_pdata);
} }
usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); ULPI_OTG_DRVVBUS_EXT);
if (usbh2_pdata.otg)
imx27_add_mxc_ehci_hs(2, &usbh2_pdata); imx27_add_mxc_ehci_hs(2, &usbh2_pdata);
#endif
if (!otg_mode_host)
imx27_add_fsl_usb2_udc(&otg_device_pdata);
#ifdef CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD #ifdef CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD
eukrea_mbimx27_baseboard_init(); eukrea_mbimx27_baseboard_init();
......
...@@ -162,7 +162,6 @@ static int otg_phy_init(void) ...@@ -162,7 +162,6 @@ static int otg_phy_init(void)
return 0; return 0;
} }
#if defined(CONFIG_USB_ULPI)
static int mx27_3ds_otg_init(struct platform_device *pdev) static int mx27_3ds_otg_init(struct platform_device *pdev)
{ {
return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI); 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,7 +171,6 @@ static struct mxc_usbh_platform_data otg_pdata __initdata = {
.init = mx27_3ds_otg_init, .init = mx27_3ds_otg_init,
.portsc = MXC_EHCI_MODE_ULPI, .portsc = MXC_EHCI_MODE_ULPI,
}; };
#endif
static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
.operating_mode = FSL_USB2_DR_DEVICE, .operating_mode = FSL_USB2_DR_DEVICE,
...@@ -275,14 +273,15 @@ static void __init mx27pdk_init(void) ...@@ -275,14 +273,15 @@ static void __init mx27pdk_init(void)
imx27_add_mxc_mmc(0, &sdhc1_pdata); imx27_add_mxc_mmc(0, &sdhc1_pdata);
imx27_add_imx2_wdt(NULL); imx27_add_imx2_wdt(NULL);
otg_phy_init(); otg_phy_init();
#if defined(CONFIG_USB_ULPI)
if (otg_mode_host) { if (otg_mode_host) {
otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); ULPI_OTG_DRVVBUS_EXT);
if (otg_pdata.otg)
imx27_add_mxc_ehci_otg(&otg_pdata); imx27_add_mxc_ehci_otg(&otg_pdata);
} }
#endif
if (!otg_mode_host) if (!otg_mode_host)
imx27_add_fsl_usb2_udc(&otg_device_pdata); imx27_add_fsl_usb2_udc(&otg_device_pdata);
......
...@@ -267,7 +267,6 @@ static const struct imxmmc_platform_data sdhc_pdata __initconst = { ...@@ -267,7 +267,6 @@ static const struct imxmmc_platform_data sdhc_pdata __initconst = {
.exit = pca100_sdhc2_exit, .exit = pca100_sdhc2_exit,
}; };
#if defined(CONFIG_USB_ULPI)
static int otg_phy_init(struct platform_device *pdev) static int otg_phy_init(struct platform_device *pdev)
{ {
gpio_set_value(OTG_PHY_CS_GPIO, 0); gpio_set_value(OTG_PHY_CS_GPIO, 0);
...@@ -295,7 +294,6 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = { ...@@ -295,7 +294,6 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
.init = usbh2_phy_init, .init = usbh2_phy_init,
.portsc = MXC_EHCI_MODE_ULPI, .portsc = MXC_EHCI_MODE_ULPI,
}; };
#endif
static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
.operating_mode = FSL_USB2_DR_DEVICE, .operating_mode = FSL_USB2_DR_DEVICE,
...@@ -402,23 +400,22 @@ static void __init pca100_init(void) ...@@ -402,23 +400,22 @@ static void __init pca100_init(void)
gpio_request(USBH2_PHY_CS_GPIO, "usb-host2-cs"); gpio_request(USBH2_PHY_CS_GPIO, "usb-host2-cs");
gpio_direction_output(USBH2_PHY_CS_GPIO, 1); gpio_direction_output(USBH2_PHY_CS_GPIO, 1);
#if defined(CONFIG_USB_ULPI)
if (otg_mode_host) { if (otg_mode_host) {
otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); ULPI_OTG_DRVVBUS_EXT);
if (otg_pdata.otg)
imx27_add_mxc_ehci_otg(&otg_pdata); imx27_add_mxc_ehci_otg(&otg_pdata);
} else {
gpio_set_value(OTG_PHY_CS_GPIO, 0);
imx27_add_fsl_usb2_udc(&otg_device_pdata);
} }
usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
if (usbh2_pdata.otg)
imx27_add_mxc_ehci_hs(2, &usbh2_pdata); imx27_add_mxc_ehci_hs(2, &usbh2_pdata);
#endif
if (!otg_mode_host) {
gpio_set_value(OTG_PHY_CS_GPIO, 0);
imx27_add_fsl_usb2_udc(&otg_device_pdata);
}
imx27_add_imx_fb(&pca100_fb_data); imx27_add_imx_fb(&pca100_fb_data);
......
...@@ -133,7 +133,6 @@ static int armadillo5x0_pins[] = { ...@@ -133,7 +133,6 @@ static int armadillo5x0_pins[] = {
}; };
/* USB */ /* USB */
#if defined(CONFIG_USB_ULPI)
#define OTG_RESET IOMUX_TO_GPIO(MX31_PIN_STXD4) #define OTG_RESET IOMUX_TO_GPIO(MX31_PIN_STXD4)
#define USBH2_RESET IOMUX_TO_GPIO(MX31_PIN_SCK6) #define USBH2_RESET IOMUX_TO_GPIO(MX31_PIN_SCK6)
...@@ -256,7 +255,6 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = { ...@@ -256,7 +255,6 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
.init = usbh2_init, .init = usbh2_init,
.portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT, .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
}; };
#endif /* CONFIG_USB_ULPI */
/* RTC over I2C*/ /* RTC over I2C*/
#define ARMADILLO5X0_RTC_GPIO IOMUX_TO_GPIO(MX31_PIN_SRXD4) #define ARMADILLO5X0_RTC_GPIO IOMUX_TO_GPIO(MX31_PIN_SRXD4)
...@@ -549,15 +547,15 @@ static void __init armadillo5x0_init(void) ...@@ -549,15 +547,15 @@ static void __init armadillo5x0_init(void)
i2c_register_board_info(1, &armadillo5x0_i2c_rtc, 1); i2c_register_board_info(1, &armadillo5x0_i2c_rtc, 1);
/* USB */ /* USB */
#if defined(CONFIG_USB_ULPI)
usbotg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
usbotg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
ULPI_OTG_DRVVBUS_EXT);
if (usbotg_pdata.otg)
imx31_add_mxc_ehci_otg(&usbotg_pdata); imx31_add_mxc_ehci_otg(&usbotg_pdata);
usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
ULPI_OTG_DRVVBUS_EXT);
if (usbh2_pdata.otg)
imx31_add_mxc_ehci_hs(2, &usbh2_pdata); imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
#endif
} }
static void __init armadillo5x0_timer_init(void) static void __init armadillo5x0_timer_init(void)
......
...@@ -244,7 +244,6 @@ static int mx31_3ds_usbotg_init(void) ...@@ -244,7 +244,6 @@ static int mx31_3ds_usbotg_init(void)
return err; return err;
} }
#if defined(CONFIG_USB_ULPI)
static int mx31_3ds_otg_init(struct platform_device *pdev) static int mx31_3ds_otg_init(struct platform_device *pdev)
{ {
return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED); return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED);
...@@ -300,7 +299,6 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = { ...@@ -300,7 +299,6 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
.init = mx31_3ds_host2_init, .init = mx31_3ds_host2_init,
.portsc = MXC_EHCI_MODE_ULPI, .portsc = MXC_EHCI_MODE_ULPI,
}; };
#endif
static const struct fsl_usb2_platform_data usbotg_pdata __initconst = { static const struct fsl_usb2_platform_data usbotg_pdata __initconst = {
.operating_mode = FSL_USB2_DR_DEVICE, .operating_mode = FSL_USB2_DR_DEVICE,
...@@ -345,17 +343,17 @@ static void __init mx31_3ds_init(void) ...@@ -345,17 +343,17 @@ static void __init mx31_3ds_init(void)
imx31_add_imx_keypad(&mx31_3ds_keymap_data); imx31_add_imx_keypad(&mx31_3ds_keymap_data);
mx31_3ds_usbotg_init(); mx31_3ds_usbotg_init();
#if defined(CONFIG_USB_ULPI)
if (otg_mode_host) { if (otg_mode_host) {
otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); ULPI_OTG_DRVVBUS_EXT);
if (otg_pdata.otg)
imx31_add_mxc_ehci_otg(&otg_pdata); imx31_add_mxc_ehci_otg(&otg_pdata);
} }
usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); ULPI_OTG_DRVVBUS_EXT);
if (usbh2_pdata.otg)
imx31_add_mxc_ehci_hs(2, &usbh2_pdata); imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
#endif
if (!otg_mode_host) if (!otg_mode_host)
imx31_add_fsl_usb2_udc(&usbotg_pdata); imx31_add_fsl_usb2_udc(&usbotg_pdata);
......
...@@ -111,8 +111,6 @@ static struct platform_device physmap_flash_device = { ...@@ -111,8 +111,6 @@ static struct platform_device physmap_flash_device = {
/* USB */ /* USB */
#if defined(CONFIG_USB_ULPI)
#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \ #define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU) PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
...@@ -197,17 +195,14 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = { ...@@ -197,17 +195,14 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
static void lilly1131_usb_init(void) static void lilly1131_usb_init(void)
{ {
usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
imx31_add_mxc_ehci_hs(1, &usbh1_pdata); imx31_add_mxc_ehci_hs(1, &usbh1_pdata);
usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
ULPI_OTG_DRVVBUS_EXT);
if (usbh2_pdata.otg)
imx31_add_mxc_ehci_hs(2, &usbh2_pdata); imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
} }
#else
static inline void lilly1131_usb_init(void) {}
#endif /* CONFIG_USB_ULPI */
/* SPI */ /* SPI */
static int spi_internal_chipselect[] = { static int spi_internal_chipselect[] = {
......
...@@ -130,7 +130,6 @@ static struct spi_board_info mc13783_spi_dev __initdata = { ...@@ -130,7 +130,6 @@ static struct spi_board_info mc13783_spi_dev __initdata = {
* USB * USB
*/ */
#if defined(CONFIG_USB_ULPI)
#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \ #define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU) PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
...@@ -177,7 +176,6 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = { ...@@ -177,7 +176,6 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
.init = usbh2_init, .init = usbh2_init,
.portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT, .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
}; };
#endif
/* /*
* NOR flash * NOR flash
...@@ -254,13 +252,11 @@ static void __init mx31lite_init(void) ...@@ -254,13 +252,11 @@ static void __init mx31lite_init(void)
imx31_add_spi_imx1(&spi1_pdata); imx31_add_spi_imx1(&spi1_pdata);
spi_register_board_info(&mc13783_spi_dev, 1); spi_register_board_info(&mc13783_spi_dev, 1);
#if defined(CONFIG_USB_ULPI)
/* USB */ /* USB */
usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); ULPI_OTG_DRVVBUS_EXT);
if (usbh2_pdata.otg)
imx31_add_mxc_ehci_hs(2, &usbh2_pdata); imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
#endif
/* SMSC9117 IRQ pin */ /* SMSC9117 IRQ pin */
ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq"); ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq");
......
...@@ -400,7 +400,6 @@ static void usb_xcvr_reset(void) ...@@ -400,7 +400,6 @@ static void usb_xcvr_reset(void)
mdelay(1); mdelay(1);
} }
#if defined(CONFIG_USB_ULPI)
static int moboard_usbh2_init_hw(struct platform_device *pdev) static int moboard_usbh2_init_hw(struct platform_device *pdev)
{ {
return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED); return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED);
...@@ -415,8 +414,10 @@ static int __init moboard_usbh2_init(void) ...@@ -415,8 +414,10 @@ static int __init moboard_usbh2_init(void)
{ {
struct platform_device *pdev; struct platform_device *pdev;
usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); ULPI_OTG_DRVVBUS_EXT);
if (!usbh2_pdata.otg)
return -ENODEV;
pdev = imx31_add_mxc_ehci_hs(2, &usbh2_pdata); pdev = imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
if (IS_ERR(pdev)) if (IS_ERR(pdev))
...@@ -424,10 +425,6 @@ static int __init moboard_usbh2_init(void) ...@@ -424,10 +425,6 @@ static int __init moboard_usbh2_init(void)
return 0; return 0;
} }
#else
static inline int moboard_usbh2_init(void) { return 0; }
#endif
static struct gpio_led mx31moboard_leds[] = { static struct gpio_led mx31moboard_leds[] = {
{ {
......
...@@ -533,7 +533,6 @@ static struct platform_device pcm970_sja1000 = { ...@@ -533,7 +533,6 @@ static struct platform_device pcm970_sja1000 = {
.num_resources = ARRAY_SIZE(pcm970_sja1000_resources), .num_resources = ARRAY_SIZE(pcm970_sja1000_resources),
}; };
#if defined(CONFIG_USB_ULPI)
static int pcm037_otg_init(struct platform_device *pdev) static int pcm037_otg_init(struct platform_device *pdev)
{ {
return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI); return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);
...@@ -553,7 +552,6 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = { ...@@ -553,7 +552,6 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
.init = pcm037_usbh2_init, .init = pcm037_usbh2_init,
.portsc = MXC_EHCI_MODE_ULPI, .portsc = MXC_EHCI_MODE_ULPI,
}; };
#endif
static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
.operating_mode = FSL_USB2_DR_DEVICE, .operating_mode = FSL_USB2_DR_DEVICE,
...@@ -656,19 +654,18 @@ static void __init pcm037_init(void) ...@@ -656,19 +654,18 @@ static void __init pcm037_init(void)
platform_device_register(&pcm970_sja1000); platform_device_register(&pcm970_sja1000);
#if defined(CONFIG_USB_ULPI)
if (otg_mode_host) { if (otg_mode_host) {
otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); ULPI_OTG_DRVVBUS_EXT);
if (otg_pdata.otg)
imx31_add_mxc_ehci_otg(&otg_pdata); imx31_add_mxc_ehci_otg(&otg_pdata);
} }
usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); ULPI_OTG_DRVVBUS_EXT);
if (usbh2_pdata.otg)
imx31_add_mxc_ehci_hs(2, &usbh2_pdata); imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
#endif
if (!otg_mode_host) if (!otg_mode_host)
imx31_add_fsl_usb2_udc(&otg_device_pdata); imx31_add_fsl_usb2_udc(&otg_device_pdata);
......
...@@ -305,7 +305,6 @@ pcm037_nand_board_info __initconst = { ...@@ -305,7 +305,6 @@ pcm037_nand_board_info __initconst = {
.hw_ecc = 1, .hw_ecc = 1,
}; };
#if defined(CONFIG_USB_ULPI)
static int pcm043_otg_init(struct platform_device *pdev) static int pcm043_otg_init(struct platform_device *pdev)
{ {
return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI); return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);
...@@ -315,7 +314,6 @@ static struct mxc_usbh_platform_data otg_pdata __initdata = { ...@@ -315,7 +314,6 @@ static struct mxc_usbh_platform_data otg_pdata __initdata = {
.init = pcm043_otg_init, .init = pcm043_otg_init,
.portsc = MXC_EHCI_MODE_UTMI, .portsc = MXC_EHCI_MODE_UTMI,
}; };
#endif
static int pcm043_usbh1_init(struct platform_device *pdev) static int pcm043_usbh1_init(struct platform_device *pdev)
{ {
...@@ -385,14 +383,12 @@ static void __init pcm043_init(void) ...@@ -385,14 +383,12 @@ static void __init pcm043_init(void)
mxc_register_device(&mx3_ipu, &mx3_ipu_data); mxc_register_device(&mx3_ipu, &mx3_ipu_data);
mxc_register_device(&mx3_fb, &mx3fb_pdata); mxc_register_device(&mx3_fb, &mx3fb_pdata);
#if defined(CONFIG_USB_ULPI)
if (otg_mode_host) { if (otg_mode_host) {
otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); ULPI_OTG_DRVVBUS_EXT);
if (otg_pdata.otg)
imx35_add_mxc_ehci_otg(&otg_pdata); imx35_add_mxc_ehci_otg(&otg_pdata);
} }
#endif
imx35_add_mxc_ehci_hs(&usbh1_pdata); imx35_add_mxc_ehci_hs(&usbh1_pdata);
if (!otg_mode_host) if (!otg_mode_host)
......
...@@ -137,8 +137,10 @@ static int __init smartbot_otg_host_init(void) ...@@ -137,8 +137,10 @@ static int __init smartbot_otg_host_init(void)
{ {
struct platform_device *pdev; struct platform_device *pdev;
otg_host_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, otg_host_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); ULPI_OTG_DRVVBUS_EXT);
if (!otg_host_pdata.otg)
return -ENODEV;
pdev = imx31_add_mxc_ehci_otg(&otg_host_pdata); pdev = imx31_add_mxc_ehci_otg(&otg_host_pdata);
if (IS_ERR(pdev)) if (IS_ERR(pdev))
......
...@@ -129,9 +129,9 @@ static struct mxc_usbh_platform_data usbh2_config = { ...@@ -129,9 +129,9 @@ static struct mxc_usbh_platform_data usbh2_config = {
static void __init mx51_efikasb_usb(void) static void __init mx51_efikasb_usb(void)
{ {
usbh2_config.otg = otg_ulpi_create(&mxc_ulpi_access_ops, usbh2_config.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT | ULPI_OTG_DRVVBUS_EXT | ULPI_OTG_EXTVBUSIND);
ULPI_OTG_EXTVBUSIND); if (usbh2_config.otg)
mxc_register_device(&mxc_usbh2_device, &usbh2_config); mxc_register_device(&mxc_usbh2_device, &usbh2_config);
} }
......
...@@ -218,11 +218,11 @@ static void __init mx51_efika_usb(void) ...@@ -218,11 +218,11 @@ static void __init mx51_efika_usb(void)
msleep(1); msleep(1);
gpio_set_value(EFIKA_USB_PHY_RESET, 1); gpio_set_value(EFIKA_USB_PHY_RESET, 1);
usbh1_config.otg = otg_ulpi_create(&mxc_ulpi_access_ops, usbh1_config.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT | ULPI_OTG_DRVVBUS_EXT | ULPI_OTG_EXTVBUSIND);
ULPI_OTG_EXTVBUSIND);
mxc_register_device(&mxc_usbdr_host_device, &dr_utmi_config); mxc_register_device(&mxc_usbdr_host_device, &dr_utmi_config);
if (usbh1_config.otg)
mxc_register_device(&mxc_usbh1_device, &usbh1_config); mxc_register_device(&mxc_usbh1_device, &usbh1_config);
} }
......
#ifndef __MACH_ULPI_H #ifndef __MACH_ULPI_H
#define __MACH_ULPI_H #define __MACH_ULPI_H
#ifdef CONFIG_USB_ULPI
struct otg_transceiver *imx_otg_ulpi_create(unsigned int flags);
#else
static inline struct otg_transceiver *imx_otg_ulpi_create(unsigned int flags)
{
return NULL;
}
#endif
extern struct otg_io_access_ops mxc_ulpi_access_ops; extern struct otg_io_access_ops mxc_ulpi_access_ops;
#endif /* __MACH_ULPI_H */ #endif /* __MACH_ULPI_H */
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/usb/otg.h> #include <linux/usb/otg.h>
#include <linux/usb/ulpi.h>
#include <mach/ulpi.h> #include <mach/ulpi.h>
...@@ -111,3 +112,7 @@ struct otg_io_access_ops mxc_ulpi_access_ops = { ...@@ -111,3 +112,7 @@ struct otg_io_access_ops mxc_ulpi_access_ops = {
}; };
EXPORT_SYMBOL_GPL(mxc_ulpi_access_ops); EXPORT_SYMBOL_GPL(mxc_ulpi_access_ops);
struct otg_transceiver *imx_otg_ulpi_create(unsigned int flags)
{
return otg_ulpi_create(&mxc_ulpi_access_ops, flags);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment