From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lukasz Majewski Date: Mon, 8 Apr 2019 23:55:40 +0200 Subject: [U-Boot] [PATCH 10/16] usb: dwc2: Add function for session B check In-Reply-To: <1553870544-15734-11-git-send-email-patrick.delaunay@st.com> References: <1553870544-15734-1-git-send-email-patrick.delaunay@st.com> <1553870544-15734-11-git-send-email-patrick.delaunay@st.com> Message-ID: <20190408235540.2273edb3@jawa> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Fri, 29 Mar 2019 15:42:18 +0100 Patrick Delaunay wrote: > Add a new function to check the session B validity, to be use to check > cable connection. > > Signed-off-by: Patrick Delaunay > --- > > drivers/usb/gadget/dwc2_udc_otg.c | 9 +++++++++ > include/usb/dwc2_udc.h | 2 ++ > 2 files changed, 11 insertions(+) > > diff --git a/drivers/usb/gadget/dwc2_udc_otg.c > b/drivers/usb/gadget/dwc2_udc_otg.c index 146f11e..b1efad1 100644 > --- a/drivers/usb/gadget/dwc2_udc_otg.c > +++ b/drivers/usb/gadget/dwc2_udc_otg.c > @@ -1151,4 +1151,13 @@ U_BOOT_DRIVER(dwc2_udc_otg) = { > .platdata_auto_alloc_size = sizeof(struct > dwc2_plat_otg_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) */ > diff --git a/include/usb/dwc2_udc.h b/include/usb/dwc2_udc.h > index 3cf20ea..8a426b6 100644 > --- a/include/usb/dwc2_udc.h > +++ b/include/usb/dwc2_udc.h > @@ -27,4 +27,6 @@ struct dwc2_plat_otg_data { > > int dwc2_udc_probe(struct dwc2_plat_otg_data *pdata); > > +int dwc2_udc_B_session_valid(struct udevice *dev); > + > #endif /* __DWC2_USB_GADGET */ Reviewed-by: Lukasz Majewski Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: