aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-shmobile/board-lager.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index 30ebd0805a34..6a7041f9afa6 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -408,13 +408,30 @@ static int usbhs_hardware_init(struct platform_device *pdev)
408{ 408{
409 struct usbhs_private *priv = usbhs_get_priv(pdev); 409 struct usbhs_private *priv = usbhs_get_priv(pdev);
410 struct usb_phy *phy; 410 struct usb_phy *phy;
411 int ret;
412
413 /* USB0 Function - use PWEN as GPIO input to detect DIP Switch SW5
414 * setting to avoid VBUS short circuit due to wrong cable.
415 * PWEN should be pulled up high if USB Function is selected by SW5
416 */
417 gpio_request_one(RCAR_GP_PIN(5, 18), GPIOF_IN, NULL); /* USB0_PWEN */
418 if (!gpio_get_value(RCAR_GP_PIN(5, 18))) {
419 pr_warn("Error: USB Function not selected - check SW5 + SW6\n");
420 ret = -ENOTSUPP;
421 goto error;
422 }
411 423
412 phy = usb_get_phy_dev(&pdev->dev, 0); 424 phy = usb_get_phy_dev(&pdev->dev, 0);
413 if (IS_ERR(phy)) 425 if (IS_ERR(phy)) {
414 return PTR_ERR(phy); 426 ret = PTR_ERR(phy);
427 goto error;
428 }
415 429
416 priv->phy = phy; 430 priv->phy = phy;
417 return 0; 431 return 0;
432 error:
433 gpio_free(RCAR_GP_PIN(5, 18));
434 return ret;
418} 435}
419 436
420static int usbhs_hardware_exit(struct platform_device *pdev) 437static int usbhs_hardware_exit(struct platform_device *pdev)
@@ -426,6 +443,8 @@ static int usbhs_hardware_exit(struct platform_device *pdev)
426 443
427 usb_put_phy(priv->phy); 444 usb_put_phy(priv->phy);
428 priv->phy = NULL; 445 priv->phy = NULL;
446
447 gpio_free(RCAR_GP_PIN(5, 18));
429 return 0; 448 return 0;
430} 449}
431 450
@@ -536,7 +555,7 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
536 "vin1_clk", "vin1"), 555 "vin1_clk", "vin1"),
537 /* USB0 */ 556 /* USB0 */
538 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-r8a7790", 557 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-r8a7790",
539 "usb0", "usb0"), 558 "usb0_ovc_vbus", "usb0"),
540}; 559};
541 560
542static void __init lager_add_standard_devices(void) 561static void __init lager_add_standard_devices(void)