On Wed, Apr 29, 2015 at 11:30:31AM +0300, Heikki Krogerus wrote: > Registers DWC3's ULPI interface with the ULPI bus when it's > available. > > Signed-off-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx> > Acked-by: David Cohen <david.a.cohen@xxxxxxxxxxxxxxx> > --- > drivers/usb/dwc3/Kconfig | 7 ++++ > drivers/usb/dwc3/Makefile | 4 +++ > drivers/usb/dwc3/core.c | 19 +++++++++- > drivers/usb/dwc3/core.h | 14 ++++++++ > drivers/usb/dwc3/ulpi.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++ > 5 files changed, 134 insertions(+), 1 deletion(-) > create mode 100644 drivers/usb/dwc3/ulpi.c > > diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig > index 827c4f8..6f92b36 100644 > --- a/drivers/usb/dwc3/Kconfig > +++ b/drivers/usb/dwc3/Kconfig > @@ -11,6 +11,13 @@ config USB_DWC3 > > if USB_DWC3 > > +config USB_DWC3_ULPI > + bool "Register ULPI PHY Interface" > + depends on USB_ULPI_BUS > + help > + Select this if you have ULPI type PHY attached to your DWC3 > + controller. > + > choice > bool "DWC3 Mode Selection" > default USB_DWC3_DUAL_ROLE if (USB && USB_GADGET) > diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile > index 46172f4..c7076e3 100644 > --- a/drivers/usb/dwc3/Makefile > +++ b/drivers/usb/dwc3/Makefile > @@ -15,6 +15,10 @@ ifneq ($(filter y,$(CONFIG_USB_DWC3_GADGET) $(CONFIG_USB_DWC3_DUAL_ROLE)),) > dwc3-y += gadget.o ep0.o > endif > > +ifneq ($(CONFIG_USB_DWC3_ULPI),) > + dwc3-y += ulpi.o > +endif > + > ifneq ($(CONFIG_DEBUG_FS),) > dwc3-y += debugfs.o > endif > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c > index fdeff5e..adff5ab 100644 > --- a/drivers/usb/dwc3/core.c > +++ b/drivers/usb/dwc3/core.c > @@ -444,13 +444,28 @@ static int dwc3_phy_setup(struct dwc3 *dwc) > case DWC3_GHWPARAMS3_HSPHY_IFC_UTMI_ULPI: > if (!strncmp(dwc->hsphy_interface, "utmi", 4)) { > reg &= ~DWC3_GUSB2PHYCFG_ULPI_UTMI; > + break; > } else if (!strncmp(dwc->hsphy_interface, "ulpi", 4)) { > reg |= DWC3_GUSB2PHYCFG_ULPI_UTMI; > + dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); > } else { > dev_warn(dwc->dev, "HSPHY Interface not defined\n"); > - break; > + > + /* Relying on default value. */ > + if (!(reg & DWC3_GUSB2PHYCFG_ULPI_UTMI)) > + break; > } > /* FALLTHROUGH */ > + case DWC3_GHWPARAMS3_HSPHY_IFC_ULPI: > + /* Soft reset here to sync the clocks */ > + ret = dwc3_soft_reset(dwc); you just lost all DWC3_GUSB3PIPECTL(0) and DWC3_GUSB2PHYCFG(0) configurations which happened right before this switch. Essentially breaking anybody who needs any of those extra bits enabled even though they're not enabled by default. -- balbi
Attachment:
signature.asc
Description: Digital signature