diff options
author | Frank Li <Frank.Li@freescale.com> | 2010-03-24 17:58:45 +0800 |
---|---|---|
committer | Alejandro Gonzalez <alex.gonzalez@digi.com> | 2010-05-25 11:20:19 +0200 |
commit | 15bb489fa5d7c5822df1e5dea760ecd9e875aa76 (patch) | |
tree | d1f10f40be315329274b9cfdd3f13a2452a08db1 /arch/arm/mach-mx23/usb_dr.c | |
parent | 1a62b28fe79e53da45263dff1602ab122f9dbe11 (diff) |
ENGR00122124 iMX23 enable USB otg pin detect
iMX23 evk RevC using gpio as usb id.
usb_id pin is conflict with mmcsd detection pin
Signed-off-by: Frank Li <Frank.Li@freescale.com>
Signed-off-by: Alejandro Gonzalez <alex.gonzalez@digi.com>
Diffstat (limited to 'arch/arm/mach-mx23/usb_dr.c')
-rw-r--r-- | arch/arm/mach-mx23/usb_dr.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/arch/arm/mach-mx23/usb_dr.c b/arch/arm/mach-mx23/usb_dr.c index 385c25aa2016..1a196e70458a 100644 --- a/arch/arm/mach-mx23/usb_dr.c +++ b/arch/arm/mach-mx23/usb_dr.c @@ -28,6 +28,7 @@ #include "mx23_pins.h" #define USB_POWER_ENABLE MXS_PIN_TO_GPIO(PINID_GMPI_CE2N) +#define USB_ID_PIN MXS_PIN_TO_GPIO(PINID_ROTARYA) static void usb_host_phy_resume(struct fsl_usb2_platform_data *plat) { @@ -59,6 +60,7 @@ static struct fsl_usb2_platform_data __maybe_unused dr_utmi_config = { .platform_resume = usb_host_phy_resume, .transceiver = "utmi", .phy_regs = USBPHY_PHYS_ADDR, + .id_gpio = USB_ID_PIN, }; /* @@ -79,7 +81,7 @@ static struct resource otg_resources[] = { [2] = { .start = IRQ_USB_WAKEUP, .flags = IORESOURCE_IRQ, - } + }, }; static u64 dr_udc_dmamask = ~(u32) 0; @@ -133,24 +135,13 @@ static int __init usb_dr_init(void) return 0; } -static unsigned int g_usb_power_enable_pin; +/* utmi_init will be call by otg, host and perperial tree time*/ void fsl_phy_usb_utmi_init(struct fsl_xcvr_ops *this) { - int ret; - g_usb_power_enable_pin = 0; - ret = gpio_request(USB_POWER_ENABLE, "usb_power"); - if (ret) { - pr_err("request usb power enable fail\n"); - } else { - g_usb_power_enable_pin = USB_POWER_ENABLE; - gpio_direction_output(g_usb_power_enable_pin, 0); - } } void fsl_phy_usb_utmi_uninit(struct fsl_xcvr_ops *this) { - if (g_usb_power_enable_pin) - gpio_free(g_usb_power_enable_pin); } /*! @@ -162,10 +153,15 @@ void fsl_phy_usb_utmi_uninit(struct fsl_xcvr_ops *this) void fsl_phy_set_power(struct fsl_xcvr_ops *this, struct fsl_usb2_platform_data *pdata, int on) { - if (g_usb_power_enable_pin) - gpio_set_value(g_usb_power_enable_pin, on); - else - pr_err("not usb power control pin set\n"); + int ret; + ret = gpio_request(USB_POWER_ENABLE, "usb_power"); + if (ret) { + pr_err("fail request usb power control pin\n"); + return; + } + gpio_direction_output(USB_POWER_ENABLE, on); + gpio_set_value(USB_POWER_ENABLE, on); + gpio_free(USB_POWER_ENABLE); } module_init(usb_dr_init); |