@@ -20,3 +20,4 @@ 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);
void sunxi_usb_phy_clear_SIDDP(void *base);
+void sunxi_usb_phy_passby(int index, bool enable);
@@ -201,8 +201,9 @@ void sunxi_usb_phy_clear_SIDDP(void *base)
}
#endif
-static void sunxi_usb_phy_passby(struct sunxi_usb_phy *phy, int enable)
+void sunxi_usb_phy_passby(int index, bool enable)
{
+ struct sunxi_usb_phy *phy = &sunxi_usb_phy[index];
unsigned long bits = 0;
void *addr;
@@ -250,9 +251,6 @@ void sunxi_usb_phy_init(int index)
sunxi_usb_phy_config(phy);
- if (phy->id != 0)
- sunxi_usb_phy_passby(phy, SUNXI_USB_PASSBY_EN);
-
#ifdef CONFIG_MACH_SUN8I_A83T
if (phy->id == 0) {
setbits_le32(SUNXI_USB0_BASE + SUNXI_USB_CSR,
@@ -272,9 +270,6 @@ void sunxi_usb_phy_exit(int index)
if (phy->init_count != 0)
return;
- if (phy->id != 0)
- sunxi_usb_phy_passby(phy, !SUNXI_USB_PASSBY_EN);
-
#ifdef CONFIG_MACH_SUN8I_A83T
if (phy->id == 0) {
setbits_le32(SUNXI_USB0_BASE + SUNXI_USB_CSR,
@@ -69,6 +69,7 @@ static int ehci_usb_probe(struct udevice *dev)
*/
sunxi_usb_phy_clear_SIDDP((void *)hccr + 0x400);
#endif
+ sunxi_usb_phy_passby(priv->phy_index, true);
sunxi_usb_phy_power_on(priv->phy_index);
hcor = (struct ehci_hcor *)((uintptr_t)hccr +
@@ -87,6 +88,7 @@ static int ehci_usb_remove(struct udevice *dev)
if (ret)
return ret;
+ sunxi_usb_phy_passby(priv->phy_index, false);
sunxi_usb_phy_exit(priv->phy_index);
#ifdef CONFIG_SUNXI_GEN_SUN6I
@@ -74,6 +74,7 @@ static int ohci_usb_probe(struct udevice *dev)
*/
sunxi_usb_phy_clear_SIDDP(regs);
#endif
+ sunxi_usb_phy_passby(priv->phy_index, true);
sunxi_usb_phy_power_on(priv->phy_index);
return ohci_register(dev, regs);
@@ -89,6 +90,7 @@ static int ohci_usb_remove(struct udevice *dev)
if (ret)
return ret;
+ sunxi_usb_phy_passby(priv->phy_index, false);
sunxi_usb_phy_exit(priv->phy_index);
#ifdef CONFIG_SUNXI_GEN_SUN6I