Re: [PATCHv3 08/11] usb: dwc3: add hsphy_interface property

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 28, 2015 at 04:24:43PM +0300, Heikki Krogerus wrote:
> Platforms that have configured DWC_USB3_HSPHY_INTERFACE with
> value 3, i.e. UTMI+ and ULPI, need to inform the driver of
> the actual HSPHY interface type with the property. "utmi" if
> the interface is UTMI+ or "ulpi" if the interface is ULPI.
> 
> Signed-off-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
> Acked-by: David Cohen <david.a.cohen@xxxxxxxxxxxxxxx>
> ---
>  Documentation/devicetree/bindings/usb/dwc3.txt |  2 ++
>  drivers/usb/dwc3/core.c                        | 29 ++++++++++++++++++++++++--
>  drivers/usb/dwc3/core.h                        |  3 +++
>  drivers/usb/dwc3/platform_data.h               |  2 ++
>  4 files changed, 34 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
> index 5cc3643..0815eac 100644
> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
> @@ -38,6 +38,8 @@ Optional properties:
>   - snps,is-utmi-l1-suspend: true when DWC3 asserts output signal
>  			utmi_l1_suspend_n, false when asserts utmi_sleep_n
>   - snps,hird-threshold: HIRD threshold
> + - snps,hsphy_interface: High-Speed PHY interface selection between "utmi" for
> +   UTMI+ and "ulpi" for ULPI when the DWC_USB3_HSPHY_INTERFACE has value 3.
>  
>  This is usually a subnode to DWC3 glue to which it is connected.
>  
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 6b02e12..b229ba1 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -395,9 +395,10 @@ static void dwc3_cache_hwparams(struct dwc3 *dwc)
>   * dwc3_phy_setup - Configure USB PHY Interface of DWC3 Core
>   * @dwc: Pointer to our controller context structure
>   */
> -static void dwc3_phy_setup(struct dwc3 *dwc)
> +static int dwc3_phy_setup(struct dwc3 *dwc)
>  {
>  	u32 reg;
> +	int ret;
>  
>  	reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0));
>  
> @@ -438,6 +439,22 @@ static void dwc3_phy_setup(struct dwc3 *dwc)
>  
>  	reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
>  
> +	/* Select the HS PHY interface */
> +	switch (DWC3_GHWPARAMS3_HSPHY_IFC(dwc->hwparams.hwparams3)) {
> +	case DWC3_GHWPARAMS3_HSPHY_IFC_UTMI_ULPI:
> +		if (!strncmp(dwc->hsphy_interface, "utmi", 4)) {
> +			reg &= ~DWC3_GUSB2PHYCFG_ULPI_UTMI;
> +		} else if (!strncmp(dwc->hsphy_interface, "ulpi", 4)) {
> +			reg |= DWC3_GUSB2PHYCFG_ULPI_UTMI;
> +		} else {
> +			dev_err(dwc->dev, "HSPHY Interface not defined\n");
> +			return -EINVAL;

instead of erroring out, just leave default value and convert this to a
dev_warn() or something similar. That way, older DTS will continue to
work.

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux