lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 29 Apr 2015 10:04:50 -0500
From:	Felipe Balbi <balbi@...com>
To:	Heikki Krogerus <heikki.krogerus@...ux.intel.com>
CC:	Felipe Balbi <balbi@...com>,
	David Cohen <david.a.cohen@...ux.intel.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Stephen Boyd <sboyd@...eaurora.org>,
	Baolu Lu <baolu.lu@...ux.intel.com>,
	Paul Bolle <pebolle@...cali.nl>, <linux-usb@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCHv3 10/12] usb: dwc3: add ULPI interface support

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@...ux.intel.com>
> Acked-by: David Cohen <david.a.cohen@...ux.intel.com>
> ---
>  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

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists