Skip to contentSkip to conversation

sunxi: usb-phy: Never power off the usb ports

PATCH New Hans de Goede 3 participants 5 messages Jul 8, 2015

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

PATCH 1/1 sunxi: usb-phy: Never power off the usb ports

USB devices are not really designed to get the power bounced off and on at them. Esp. USB powered harddisks do not like this.

Currently we power off the USB ports both on a "usb reset" and when booting the kernel, causing the usb-power to bounce off and then back on again.

This patch removes the powering off calls, fixing the undesirable power bouncing.

---
 arch/arm/cpu/armv7/sunxi/usb_phy.c        | 17 -----------------
 arch/arm/include/asm/arch-sunxi/usb_phy.h |  1 -
 drivers/usb/host/ehci-sunxi.c             |  1 -
 drivers/usb/host/ohci-sunxi.c             |  1 -
 drivers/usb/musb-new/sunxi.c              |  3 ---
 5 files changed, 23 deletions(-)
arch/arm/cpu/armv7/sunxi/usb_phy.c +0 -17
index 4d63a74..74d251d 100644
@@ -47,7 +47,6 @@ static struct sunxi_usb_phy {
 	int gpio_id_det;
 	int id;
 	int init_count;
-	int power_on_count;
 } sunxi_usb_phy[] = {
 	{
 		.usb_rst_mask = CCM_USB_CTRL_PHY0_RST | CCM_USB_CTRL_PHY0_CLK,
@@ -212,26 +211,10 @@ void sunxi_usb_phy_power_on(int index)
 {
 	struct sunxi_usb_phy *phy = &sunxi_usb_phy[index];
 
-	phy->power_on_count++;
-	if (phy->power_on_count != 1)
-		return;
-
 	if (phy->gpio_vbus >= 0)
 		gpio_set_value(phy->gpio_vbus, 1);
 }
 
-void sunxi_usb_phy_power_off(int index)
-{
-	struct sunxi_usb_phy *phy = &sunxi_usb_phy[index];
-
-	phy->power_on_count--;
-	if (phy->power_on_count != 0)
-		return;
-
-	if (phy->gpio_vbus >= 0)
-		gpio_set_value(phy->gpio_vbus, 0);
-}
-
 int sunxi_usb_phy_vbus_detect(int index)
 {
 	struct sunxi_usb_phy *phy = &sunxi_usb_phy[index];
arch/arm/include/asm/arch-sunxi/usb_phy.h +0 -1
index 17d31b8..89a287c 100644
@@ -15,7 +15,6 @@ int sunxi_usb_phy_remove(void);
 void sunxi_usb_phy_init(int index);
 void sunxi_usb_phy_exit(int index);
 void sunxi_usb_phy_power_on(int index);
-void sunxi_usb_phy_power_off(int index);
 int sunxi_usb_phy_vbus_detect(int index);
 int sunxi_usb_phy_id_detect(int index);
 void sunxi_usb_phy_enable_squelch_detect(int index, int enable);
drivers/usb/host/ehci-sunxi.c +0 -1
index 34130f8..38d5f92 100644
@@ -67,7 +67,6 @@ static int ehci_usb_remove(struct udevice *dev)
 	if (ret)
 		return ret;
 
-	sunxi_usb_phy_power_off(priv->phy_index);
 	sunxi_usb_phy_exit(priv->phy_index);
 
 #ifdef CONFIG_SUNXI_GEN_SUN6I
drivers/usb/host/ohci-sunxi.c +0 -1
index e33a8f7..6079272 100644
@@ -69,7 +69,6 @@ static int ohci_usb_remove(struct udevice *dev)
 	if (ret)
 		return ret;
 
-	sunxi_usb_phy_power_off(priv->phy_index);
 	sunxi_usb_phy_exit(priv->phy_index);
 
 #ifdef CONFIG_SUNXI_GEN_SUN6I
drivers/usb/musb-new/sunxi.c +0 -3
index 3a29b18..702c592 100644
@@ -233,9 +233,6 @@ static void sunxi_musb_disable(struct musb *musb)
 	if (!enabled)
 		return;
 
-	if (is_host_enabled(musb))
-		sunxi_usb_phy_power_off(0); /* port power off */
-
 	USBC_ForceVbusValidToLow(musb->mregs);
 	mdelay(200); /* Wait for the current session to timeout */
 
Signature · 1 line
2.4.3
#1 lore raw

PATCH 1/1 sunxi: usb-phy: Never power off the usb ports

Quoted 11 lines · Hans de Goede

USB devices are not really designed to get the power bounced off and on at them. Esp. USB powered harddisks do not like this.

Currently we power off the USB ports both on a "usb reset" and when booting the kernel, causing the usb-power to bounce off and then back on again.

This patch removes the powering off calls, fixing the undesirable power bouncing.

Shall I pick this through u-boot-usb or would you like this to go through u-boot-sunxi ? Recently, I feel a bit left out :-) (but I'm not opposed if you pick this through sunxi, don't get me wrong).

Best regards,
Marek Vasut

#2 lore raw

PATCH 1/1 sunxi: usb-phy: Never power off the usb ports

Hi,

Quoted 8 lines · Marek Vasut
Quoted 7 lines · Hans de Goede

USB devices are not really designed to get the power bounced off and on at them. Esp. USB powered harddisks do not like this.

Currently we power off the USB ports both on a "usb reset" and when booting the kernel, causing the usb-power to bounce off and then back on again.

Quoted 7 lines
Quoted 4 lines

This patch removes the powering off calls, fixing the undesirable power bouncing.

Shall I pick this through u-boot-usb or would you like this to go through u-boot-sunxi ? Recently, I feel a bit left out :-)

Heh, sorry but we've a bunch of other sunxi/usb mixed patches already queued up, so I think it is best if I take this one through the sunxi tree to avoid conflicts.

Regards,

Hans

#3 lore raw

PATCH 1/1 sunxi: usb-phy: Never power off the usb ports

Quoted 1 line · Hans de Goede

Hi,

Hi!

Quoted 12 lines · Marek Vasut
Quoted 11 lines · Hans de Goede
Quoted 10 lines

USB devices are not really designed to get the power bounced off and on at them. Esp. USB powered harddisks do not like this.

Currently we power off the USB ports both on a "usb reset" and when booting the kernel, causing the usb-power to bounce off and then back on again.

This patch removes the powering off calls, fixing the undesirable power bouncing.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Shall I pick this through u-boot-usb or would you like this to go through u-boot-sunxi ? Recently, I feel a bit left out :-)

Heh, sorry but we've a bunch of other sunxi/usb mixed patches already queued up, so I think it is best if I take this one through the sunxi tree to avoid conflicts.

*SULK* !!

All righty. Also:

Best regards,
Marek Vasut

#4 lore raw

PATCH 1/1 sunxi: usb-phy: Never power off the usb ports

In reply to Hans de Goede
Quoted 11 lines · Hans de Goede

USB devices are not really designed to get the power bounced off and on at them. Esp. USB powered harddisks do not like this.

Currently we power off the USB ports both on a "usb reset" and when booting the kernel, causing the usb-power to bounce off and then back on again.

This patch removes the powering off calls, fixing the undesirable power bouncing.