The DWC2 core in S5L87xx needs a specific GUSBCFG.

Signed-off-by: Vencislav Atanasov <[email protected]>
---
 drivers/usb/gadget/dwc2_udc_otg.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/usb/gadget/dwc2_udc_otg.c 
b/drivers/usb/gadget/dwc2_udc_otg.c
index 4dc049d64b1..ac36e5e2d87 100644
--- a/drivers/usb/gadget/dwc2_udc_otg.c
+++ b/drivers/usb/gadget/dwc2_udc_otg.c
@@ -1042,6 +1042,17 @@ static void dwc2_set_stm32mp1_hsotg_params(struct 
dwc2_plat_otg_data *p)
                p->usb_gusbcfg |= 1 << 30; /* FDMOD: Force device mode */
 }
 
+static void dwc2_set_s5l87xx_hsotg_params(struct dwc2_plat_otg_data *p)
+{
+       p->usb_gusbcfg =
+               0 << 15         /* PHY Low Power Clock sel*/
+               | 0x5 << 10     /* USB Turnaround time (5) */
+               | 1 << 9        /* [1:HNP enable]*/
+               | 1 << 8        /* [1:SRP enable]*/
+               | 0 << 6        /* 0: high speed utmi+, 1: full speed serial*/
+               | 1 << 3;       /* phy i/f  0:8bit, 1:16bit*/
+}
+
 static int dwc2_udc_otg_reset_init(struct udevice *dev,
                                   struct reset_ctl_bulk *resets)
 {
@@ -1205,6 +1216,8 @@ static const struct udevice_id dwc2_udc_otg_ids[] = {
        { .compatible = "brcm,bcm2835-usb" },
        { .compatible = "st,stm32mp15-hsotg",
          .data = (ulong)dwc2_set_stm32mp1_hsotg_params },
+       { .compatible = "apple,s5l87xx-usb",
+         .data = (ulong)dwc2_set_s5l87xx_hsotg_params },
        {},
 };
 

-- 
Git-157)

Reply via email to