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 | |
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')
-rw-r--r-- | arch/arm/mach-mx23/gpio.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-mx23/mx23evk_pins.c | 19 | ||||
-rw-r--r-- | arch/arm/mach-mx23/usb_dr.c | 30 | ||||
-rw-r--r-- | arch/arm/mach-mx28/gpio.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-mx28/mx28evk_pins.c | 11 | ||||
-rw-r--r-- | arch/arm/plat-mxs/include/mach/pinctrl.h | 2 |
6 files changed, 36 insertions, 30 deletions
diff --git a/arch/arm/mach-mx23/gpio.c b/arch/arm/mach-mx23/gpio.c index 9774664cc900..fca4534cbb2b 100644 --- a/arch/arm/mach-mx23/gpio.c +++ b/arch/arm/mach-mx23/gpio.c @@ -125,8 +125,6 @@ static void mx23_gpio_ack_irq(struct mxs_gpio_port *port, int pin) unsigned int mask; void __iomem *base = PINCTRL_BASE_ADDR + 0x10 * port->id; mask = 1 << pin; - mask &= __raw_readl(base + HW_PINCTRL_IRQSTAT0); - mask &= __raw_readl(base + HW_PINCTRL_IRQEN0); if (mask) __raw_writel(mask, base + HW_PINCTRL_IRQSTAT0_CLR); } diff --git a/arch/arm/mach-mx23/mx23evk_pins.c b/arch/arm/mach-mx23/mx23evk_pins.c index 06c005c249e1..459c6df833e1 100644 --- a/arch/arm/mach-mx23/mx23evk_pins.c +++ b/arch/arm/mach-mx23/mx23evk_pins.c @@ -487,6 +487,17 @@ static struct pin_desc mx23evk_fixed_pins[] = { .drive = 1, }, #endif +#if defined(CONFIG_USB_OTG) + { + .name = "USB_OTG_ID", + .id = PINID_ROTARYA, + .fun = PIN_GPIO, + .pull = 1, + .pullup = 1, + .voltage = PAD_3_3V, + }, +#endif + }; #if defined(CONFIG_FEC) || defined(CONFIG_FEC_MODULE) @@ -527,11 +538,11 @@ void __init mx23evk_pins_init(void) if (pin->pull) mxs_set_pullup(pin->id, pin->pullup, pin->name); if (pin->fun == PIN_GPIO) { - if (pin->input) - gpio_direction_input(MXS_PIN_TO_GPIO(pin->id)); - else + if (pin->output) gpio_direction_output(MXS_PIN_TO_GPIO(pin->id), - pin->data); + pin->data); + else + gpio_direction_input(MXS_PIN_TO_GPIO(pin->id)); } } } 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); diff --git a/arch/arm/mach-mx28/gpio.c b/arch/arm/mach-mx28/gpio.c index d936df89326b..4f7d42422c78 100644 --- a/arch/arm/mach-mx28/gpio.c +++ b/arch/arm/mach-mx28/gpio.c @@ -125,8 +125,6 @@ static void mx28_gpio_ack_irq(struct mxs_gpio_port *port, int pin) unsigned int mask; void __iomem *base = PINCTRL_BASE_ADDR + 0x10 * port->id; mask = 1 << pin; - mask &= __raw_readl(base + HW_PINCTRL_IRQSTAT0); - mask &= __raw_readl(base + HW_PINCTRL_IRQEN0); if (mask) __raw_writel(mask, base + HW_PINCTRL_IRQSTAT0_CLR); } diff --git a/arch/arm/mach-mx28/mx28evk_pins.c b/arch/arm/mach-mx28/mx28evk_pins.c index 3fbb6c51af3c..5ac477753265 100644 --- a/arch/arm/mach-mx28/mx28evk_pins.c +++ b/arch/arm/mach-mx28/mx28evk_pins.c @@ -86,12 +86,14 @@ static struct pin_desc mx28evk_fixed_pins[] = { .id = PINID_AUART2_TX, .fun = PIN_GPIO, .data = 1, + .output = 1, }, { .name = "usb1", .id = PINID_AUART2_RX, .fun = PIN_GPIO, .data = 1, + .output = 1, }, #if defined(CONFIG_USB_OTG) @@ -156,6 +158,7 @@ static struct pin_desc mx28evk_fixed_pins[] = { .drive = 1, .pull = 0, .data = 0, + .output = 1, }, #endif @@ -1044,11 +1047,11 @@ void __init mx28evk_init_pin_group(struct pin_desc *pins, unsigned count) if (pin->pull) mxs_set_pullup(pin->id, pin->pullup, pin->name); if (pin->fun == PIN_GPIO) { - if (pin->input) - gpio_direction_input(MXS_PIN_TO_GPIO(pin->id)); - else + if (pin->output) gpio_direction_output(MXS_PIN_TO_GPIO(pin->id), - pin->data); + pin->data); + else + gpio_direction_input(MXS_PIN_TO_GPIO(pin->id)); } } } diff --git a/arch/arm/plat-mxs/include/mach/pinctrl.h b/arch/arm/plat-mxs/include/mach/pinctrl.h index 2933bb111452..6e02149f5ca6 100644 --- a/arch/arm/plat-mxs/include/mach/pinctrl.h +++ b/arch/arm/plat-mxs/include/mach/pinctrl.h @@ -111,7 +111,7 @@ struct pin_desc { unsigned pullup:1; unsigned drive:1; unsigned pull:1; - unsigned input:1; + unsigned output:1; unsigned data:1; }; |