mirror of
https://xff.cz/git/u-boot/
synced 2025-09-07 19:52:15 +02:00
usb: dwc2: Add function for session B check
Add a new function to check the session B validity, to be use to check cable connection. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Lukasz Majewski <lukma@denx.de>
This commit is contained in:
committed by
Marek Vasut
parent
0fdd0bc621
commit
2d76160f04
@@ -1151,4 +1151,13 @@ U_BOOT_DRIVER(dwc2_udc_otg) = {
|
|||||||
.platdata_auto_alloc_size = sizeof(struct dwc2_plat_otg_data),
|
.platdata_auto_alloc_size = sizeof(struct dwc2_plat_otg_data),
|
||||||
.priv_auto_alloc_size = sizeof(struct dwc2_priv_data),
|
.priv_auto_alloc_size = sizeof(struct dwc2_priv_data),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int dwc2_udc_B_session_valid(struct udevice *dev)
|
||||||
|
{
|
||||||
|
struct dwc2_plat_otg_data *platdata = dev_get_platdata(dev);
|
||||||
|
struct dwc2_usbotg_reg *usbotg_reg =
|
||||||
|
(struct dwc2_usbotg_reg *)platdata->regs_otg;
|
||||||
|
|
||||||
|
return readl(&usbotg_reg->gotgctl) & B_SESSION_VALID;
|
||||||
|
}
|
||||||
#endif /* CONFIG_IS_ENABLED(DM_USB_GADGET) */
|
#endif /* CONFIG_IS_ENABLED(DM_USB_GADGET) */
|
||||||
|
@@ -27,4 +27,6 @@ struct dwc2_plat_otg_data {
|
|||||||
|
|
||||||
int dwc2_udc_probe(struct dwc2_plat_otg_data *pdata);
|
int dwc2_udc_probe(struct dwc2_plat_otg_data *pdata);
|
||||||
|
|
||||||
|
int dwc2_udc_B_session_valid(struct udevice *dev);
|
||||||
|
|
||||||
#endif /* __DWC2_USB_GADGET */
|
#endif /* __DWC2_USB_GADGET */
|
||||||
|
Reference in New Issue
Block a user