Skip to contentSkip to conversation

exynos: usb: Fix data abort on boards w/o vbus-gpio node in the DT

PATCH New andrey.konovalov at linaro.org 2 participants 2 messages Apr 22, 2014 – Apr 23, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 exynos: usb: Fix data abort on boards w/o vbus-gpio node in the DT

Commit 4a271cb1b4ff doesn't take into account that fdtdec_setup_gpio() returns success when the gpio passed to it is FDT_GPIO_NONE (no gpio node found in the fdtdec_decode_gpio() call). This results in calling gpio_direction_output() on invalid gpio. For this reason executing "usb start" command on Arndale causes data abort in the ehci-exynos driver.

Add the fdt_gpio_isvalid() check to fix that problem.

Cc Julius Werner <[email protected]>
Cc Simon Glass <[email protected]>
Cc Minkyu Kang <[email protected]>
Cc Marek Vasut <[email protected]>
---
 drivers/usb/host/ehci-exynos.c  |    3 ++-
 drivers/usb/host/xhci-exynos5.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-exynos.c +2 -1
index 9356878..edd91a8 100644
@@ -197,7 +197,8 @@ int ehci_hcd_init(int index, enum usb_init_type init,
 
 #ifdef CONFIG_OF_CONTROL
 	/* setup the Vbus gpio here */
-	if (!fdtdec_setup_gpio(&ctx->vbus_gpio))
+	if (fdt_gpio_isvalid(&ctx->vbus_gpio) &&
+	    !fdtdec_setup_gpio(&ctx->vbus_gpio))
 		gpio_direction_output(ctx->vbus_gpio.gpio, 1);
 #endif
 
drivers/usb/host/xhci-exynos5.c +2 -1
index 1146d10..b4946a3 100644
@@ -298,7 +298,8 @@ int xhci_hcd_init(int index, struct xhci_hccr **hccr, struct xhci_hcor **hcor)
 
 #ifdef CONFIG_OF_CONTROL
 	/* setup the Vbus gpio here */
-	if (!fdtdec_setup_gpio(&ctx->vbus_gpio))
+	if (fdt_gpio_isvalid(&ctx->vbus_gpio) &&
+	    !fdtdec_setup_gpio(&ctx->vbus_gpio))
 		gpio_direction_output(ctx->vbus_gpio.gpio, 1);
 #endif
 
Signature · 1 line
1.7.9.5
Applied
#1 lore raw

PATCH 1/1 exynos: usb: Fix data abort on boards w/o vbus-gpio node in the DT

Quoted 7 lines · andrey.konovalov at linaro.org

Commit 4a271cb1b4ff doesn't take into account that fdtdec_setup_gpio() returns success when the gpio passed to it is FDT_GPIO_NONE (no gpio node found in the fdtdec_decode_gpio() call). This results in calling gpio_direction_output() on invalid gpio. For this reason executing "usb start" command on Arndale causes data abort in the ehci-exynos driver.

Quoted 7 lines

Add the fdt_gpio_isvalid() check to fix that problem.

Cc Julius Werner <[email protected]>
Cc Simon Glass <[email protected]>
Cc Minkyu Kang <[email protected]>
Cc Marek Vasut <[email protected]>

Applied, thanks.

Best regards,
Marek Vasut