summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2019-03-29 15:42:24 +0100
committerMarek Vasut <marex@denx.de>2019-04-21 10:26:52 +0200
commit6fe7dd3327d552bacf4266d7f1ed074bf98ffb92 (patch)
treeb4ddd4665a26df7617120e110682954e532571d5 /drivers/usb
parentc31000c534c6d62dd3a3ae58f30eae3ed572d856 (diff)
stm32mp1: add stusb1600 support for DK1 and DK2 board
The DK1 and DK2 boards use the USB Type-C controller STUSB1600. This patch updates: - the device tree to add the I2C node in the DT - the board stm32mp1 to probe this I2C device and use this controller to check cable detection. - the DWC2 driver to support a new dt property "u-boot,force-b-session-valid" which forces B session and device mode; it is a workaround because the VBUS sensing and ID detection isn't available with stusb1600. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Lukasz Majewski <lukma@denx.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/dwc2_udc_otg.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c
index 3fdaa102ba..494ab533cc 100644
--- a/drivers/usb/gadget/dwc2_udc_otg.c
+++ b/drivers/usb/gadget/dwc2_udc_otg.c
@@ -1053,7 +1053,7 @@ static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev)
platdata->tx_fifo_sz = dev_read_u32_default(dev, "g-tx-fifo-size", 0);
platdata->force_b_session_valid =
- dev_read_bool(dev, "force-b-session-valid");
+ dev_read_bool(dev, "u-boot,force-b-session-valid");
/* force platdata according compatible */
drvdata = dev_get_driver_data(dev);
@@ -1075,6 +1075,9 @@ static void dwc2_set_stm32mp1_hsotg_params(struct dwc2_plat_otg_data *p)
| 0 << 8 /* [0:SRP disable 1:SRP enable]*/
| 0 << 6 /* 0: high speed utmi+, 1: full speed serial*/
| 0x7 << 0; /* FS timeout calibration**/
+
+ if (p->force_b_session_valid)
+ p->usb_gusbcfg |= 1 << 30; /* FDMOD: Force device mode */
}
static int dwc2_udc_otg_reset_init(struct udevice *dev,
@@ -1166,7 +1169,8 @@ static int dwc2_udc_otg_probe(struct udevice *dev)
if (platdata->force_b_session_valid)
/* Override B session bits : value and enable */
- setbits_le32(&usbotg_reg->gotgctl, B_VALOEN | B_VALOVAL);
+ setbits_le32(&usbotg_reg->gotgctl,
+ A_VALOEN | A_VALOVAL | B_VALOEN | B_VALOVAL);
ret = dwc2_udc_probe(platdata);
if (ret)