Re: [PATCH 3/5] usb: chipidea: tegra: add dr_mode checking to tegra-udc

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

 



On Tue, Oct 01, 2019 at 09:41:51PM -0400, Peter Geis wrote:
> As the tegra-udc driver does not yet support all modes, add dr_mode
> checking capability.
> Warn about invalid configurations and explicitly assign dr_mode before
> handing off to the chipidea core driver.
> 
> Signed-off-by: Peter Geis <pgwipeout@xxxxxxxxx>
> ---
>  drivers/usb/chipidea/ci_hdrc_tegra.c | 24 +++++++++++++++++++++++-
>  1 file changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/chipidea/ci_hdrc_tegra.c b/drivers/usb/chipidea/ci_hdrc_tegra.c
> index 0c9911d44ee5..29415c3a2f48 100644
> --- a/drivers/usb/chipidea/ci_hdrc_tegra.c
> +++ b/drivers/usb/chipidea/ci_hdrc_tegra.c
> @@ -25,7 +25,7 @@ struct tegra_udc_soc_info {
>  };
>  
>  static const struct tegra_udc_soc_info tegra_udc_soc_info = {
> -	.flags = CI_HDRC_REQUIRES_ALIGNED_DMA,
> +	.flags = CI_HDRC_REQUIRES_ALIGNED_DMA | CI_HDRC_TEGRA_HOST,

This seems to be not at all related to the rest of this patch. Also, I
think this patch makes sense standalone, so it may be worth sending it
out separately, perhaps marked for integration into stable branches if
you think it worth it.

Thierry

>  };
>  
>  static const struct of_device_id tegra_udc_of_match[] = {
> @@ -63,6 +63,28 @@ static int tegra_udc_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	}
>  
> +	/* check the dual mode and warn about bad configurations */
> +	switch (usb_get_dr_mode(&pdev->dev)) {
> +	case USB_DR_MODE_HOST:
> +		dev_dbg(&pdev->dev, "dr_mode is set to host\n");
> +		udc->data.dr_mode = USB_DR_MODE_HOST;
> +		break;
> +
> +	case USB_DR_MODE_UNKNOWN:
> +		dev_warn(&pdev->dev, "dr_mode is unset or unknown, setting host mode\n");
> +		udc->data.dr_mode = USB_DR_MODE_HOST;
> +		break;
> +
> +	case USB_DR_MODE_PERIPHERAL:
> +		dev_dbg(&pdev->dev, "dr_mode is set to peripheral\n");
> +		udc->data.dr_mode = USB_DR_MODE_PERIPHERAL;
> +		break;
> +
> +	case USB_DR_MODE_OTG:
> +		dev_err(&pdev->dev, "dr_mode is otg, tegra-udc does not support otg at this time\n");
> +		return -EINVAL;
> +	}
> +
>  	udc->phy = devm_usb_get_phy_by_phandle(&pdev->dev, "nvidia,phy", 0);
>  	if (IS_ERR(udc->phy)) {
>  		err = PTR_ERR(udc->phy);
> -- 
> 2.17.1
> 

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux