[U-Boot] [PATCH 07/16] usb: sunxi: set up usb_phy_passby only for HCI
Jagan Teki
jagan at amarulasolutions.com
Tue Dec 12 06:58:22 UTC 2017
From: Philipp Tomsich <philipp.tomsich at theobroma-systems.com>
sunxi_usb_phy_passby will deal PHY's other than 0 and it not
require to use it for MUSB so use directly for HCI.
Also update the function proto type for with index and bool enable
for better usability.
Signed-off-by: Philipp Tomsich <philipp.tomsich at theobroma-systems.com>
[jagan: reowrked on entire patch]
Signed-off-by: Jagan Teki <jagan at amarulasolutions.com>
---
arch/arm/include/asm/arch-sunxi/usb_phy.h | 1 +
arch/arm/mach-sunxi/usb_phy.c | 9 ++-------
drivers/usb/host/ehci-sunxi.c | 2 ++
drivers/usb/host/ohci-sunxi.c | 2 ++
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/arch/arm/include/asm/arch-sunxi/usb_phy.h b/arch/arm/include/asm/arch-sunxi/usb_phy.h
index f97d415..83ada78 100644
--- a/arch/arm/include/asm/arch-sunxi/usb_phy.h
+++ b/arch/arm/include/asm/arch-sunxi/usb_phy.h
@@ -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);
diff --git a/arch/arm/mach-sunxi/usb_phy.c b/arch/arm/mach-sunxi/usb_phy.c
index 1bfee40..4bc47a1 100644
--- a/arch/arm/mach-sunxi/usb_phy.c
+++ b/arch/arm/mach-sunxi/usb_phy.c
@@ -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,
diff --git a/drivers/usb/host/ehci-sunxi.c b/drivers/usb/host/ehci-sunxi.c
index c3432aa..4eef739 100644
--- a/drivers/usb/host/ehci-sunxi.c
+++ b/drivers/usb/host/ehci-sunxi.c
@@ -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
diff --git a/drivers/usb/host/ohci-sunxi.c b/drivers/usb/host/ohci-sunxi.c
index e9eeb56..cb052d4 100644
--- a/drivers/usb/host/ohci-sunxi.c
+++ b/drivers/usb/host/ohci-sunxi.c
@@ -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
--
2.7.4
More information about the U-Boot
mailing list