[PATCH v2 3/3] usb: ohci-at91: Add USB PHY functionality
Sergiu Moga
sergiu.moga at microchip.com
Tue Jan 3 15:30:41 CET 2023
Add the ability to enable/disable whatever USB PHY's are
passed to the AT91 OHCI driver through DT.
Signed-off-by: Sergiu Moga <sergiu.moga at microchip.com>
Tested-by: Mihai Sain <mihai.sain at microchip.com>
---
v1 -> v2:
- use *_bulk API's
drivers/usb/host/ohci-at91.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 9de67df335..fece921d39 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -74,6 +74,10 @@ int usb_cpu_init_fail(void)
#include <usb.h>
#include "ohci.h"
+#if CONFIG_IS_ENABLED(PHY_MICROCHIP_SAMA7_USB)
+#include <generic-phy.h>
+#endif
+
#define AT91_MAX_USBH_PORTS 3
#define at91_for_each_port(index, ports) \
@@ -90,15 +94,35 @@ struct at91_usbh_data {
struct ohci_at91_priv {
ohci_t ohci;
struct clk_bulk clks;
+
+#if CONFIG_IS_ENABLED(PHY_MICROCHIP_SAMA7_USB)
+ struct phy_bulk phys;
+#endif
};
static int at91_start_clock(struct ohci_at91_priv *ohci_at91)
{
+#if CONFIG_IS_ENABLED(PHY_MICROCHIP_SAMA7_USB)
+ int ret;
+
+ ret = generic_phy_power_on_bulk(&ohci_at91->phys);
+ if (ret)
+ return ret;
+#endif
+
return clk_enable_bulk(&ohci_at91->clks);
}
static int at91_stop_clock(struct ohci_at91_priv *ohci_at91)
{
+#if CONFIG_IS_ENABLED(PHY_MICROCHIP_SAMA7_USB)
+ int ret;
+
+ ret = generic_phy_power_off_bulk(&ohci_at91->phys);
+ if (ret)
+ return ret;
+#endif
+
return clk_disable_bulk(&ohci_at91->clks);
}
@@ -179,6 +203,16 @@ static int ohci_atmel_probe(struct udevice *dev)
if (ret)
goto fail;
+#if CONFIG_IS_ENABLED(PHY_MICROCHIP_SAMA7_USB)
+ ret = generic_phy_get_bulk(dev, &ohci_at91->phys);
+ if (ret)
+ goto fail;
+
+ ret = generic_phy_init_bulk(&ohci_at91->phys);
+ if (ret)
+ goto fail;
+#endif
+
ret = at91_start_hc(dev);
if (ret)
goto fail;
@@ -195,6 +229,7 @@ fail:
static const struct udevice_id ohci_usb_ids[] = {
{ .compatible = "atmel,at91rm9200-ohci", },
+ { .compatible = "microchip,sama7g5-ohci", },
{ }
};
--
2.34.1
More information about the U-Boot
mailing list