[U-Boot] [PATCH] usb: dwc2_udc_otg: Add gotgctl customization

Patrice Chotard patrice.chotard at st.com
Fri Mar 16 12:27:59 UTC 2018


Allow passing in a custom configuration of the gotgctl
register via platform data.
This allows for example to override the A/B session valid signals
by setting AvalidOvEn / AvalidOvVal and BvalidOvEn / BvalidOvVal
bits in GOTGCTL reg.

Signed-off-by: Patrice Chotard <patrice.chotard at st.com>
---

 drivers/usb/gadget/dwc2_udc_otg.c | 3 +++
 include/usb/dwc2_udc.h            | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c
index 088811c19136..c6c2edf7affa 100644
--- a/drivers/usb/gadget/dwc2_udc_otg.c
+++ b/drivers/usb/gadget/dwc2_udc_otg.c
@@ -426,6 +426,9 @@ static void reconfig_usbd(struct dwc2_udc *dev)
 
 	writel(dflt_gusbcfg, &reg->gusbcfg);
 
+	if (dev->pdata->usb_gotgctl)
+		writel(dev->pdata->usb_gotgctl, &reg->gotgctl);
+
 	/* 3. Put the OTG device core in the disconnected state.*/
 	uTemp = readl(&reg->dctl);
 	uTemp |= SOFT_DISCONNECT;
diff --git a/include/usb/dwc2_udc.h b/include/usb/dwc2_udc.h
index 1a370e0e86b5..36ab78dfb7e8 100644
--- a/include/usb/dwc2_udc.h
+++ b/include/usb/dwc2_udc.h
@@ -20,6 +20,7 @@ struct dwc2_plat_otg_data {
 	unsigned int    usb_phy_ctrl;
 	unsigned int    usb_flags;
 	unsigned int	usb_gusbcfg;
+	unsigned int	usb_gotgctl;
 	unsigned int	rx_fifo_sz;
 	unsigned int	np_tx_fifo_sz;
 	unsigned int	tx_fifo_sz;
-- 
1.9.1



More information about the U-Boot mailing list