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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <575FBDEB.3050004@ti.com>
Date:	Tue, 14 Jun 2016 11:18:51 +0300
From:	Roger Quadros <rogerq@...com>
To:	<mathias.nyman@...ux.intel.com>
CC:	<peter.chen@...escale.com>, <balbi@...nel.org>, <tony@...mide.com>,
	<gregkh@...uxfoundation.org>, <dan.j.williams@...el.com>,
	<Joao.Pinto@...opsys.com>, <sergei.shtylyov@...entembedded.com>,
	<jun.li@...escale.com>, <grygorii.strashko@...com>,
	<yoshihiro.shimoda.uh@...esas.com>, <robh@...nel.org>,
	<nsekhar@...com>, <b-liu@...com>, <joe@...ches.com>,
	<linux-usb@...r.kernel.org>, <linux-omap@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>
Subject: Re: [PATCH v10 14/14] usb: host: xhci-plat: Add otg device to
 platform data

Mathias,

On 10/06/16 16:07, Roger Quadros wrote:
> Host controllers that are part of an OTG/dual-role instance
> need to somehow pass the OTG controller device information
> to the HCD core.
> 
> We use platform data to pass the OTG controller device.
> 
> Signed-off-by: Roger Quadros <rogerq@...com>
> Reviewed-by: Peter Chen <peter.chen@....com>
> ---
>  drivers/usb/host/xhci-plat.c     | 35 ++++++++++++++++++++++++++++-------
>  include/linux/usb/xhci_pdriver.h |  3 +++
>  2 files changed, 31 insertions(+), 7 deletions(-)

Any comments on this one?

> 
> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index 676ea45..24d030a 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -239,11 +239,20 @@ static int xhci_plat_probe(struct platform_device *pdev)
>  			goto put_usb3_hcd;
>  	}
>  
> -	ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
> +	if (pdata && pdata->otg_dev)
> +		ret = usb_otg_add_hcd(hcd, irq, IRQF_SHARED, pdata->otg_dev);
> +	else
> +		ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
> +
>  	if (ret)
>  		goto disable_usb_phy;
>  
> -	ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
> +	if (pdata && pdata->otg_dev)
> +		ret = usb_otg_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED,
> +				      pdata->otg_dev);
> +	else
> +		ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
> +
>  	if (ret)
>  		goto dealloc_usb2_hcd;
>  
> @@ -251,7 +260,10 @@ static int xhci_plat_probe(struct platform_device *pdev)
>  
>  
>  dealloc_usb2_hcd:
> -	usb_remove_hcd(hcd);
> +	if (pdata && pdata->otg_dev)
> +		usb_otg_remove_hcd(hcd);
> +	else
> +		usb_remove_hcd(hcd);
>  
>  disable_usb_phy:
>  	usb_phy_shutdown(hcd->usb_phy);
> @@ -269,16 +281,25 @@ put_hcd:
>  	return ret;
>  }
>  
> -static int xhci_plat_remove(struct platform_device *dev)
> +static int xhci_plat_remove(struct platform_device *pdev)
>  {
> -	struct usb_hcd	*hcd = platform_get_drvdata(dev);
> +	struct usb_hcd	*hcd = platform_get_drvdata(pdev);
>  	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
>  	struct clk *clk = xhci->clk;
> +	struct usb_xhci_pdata *pdata = dev_get_platdata(&pdev->dev);
> +
> +	if (pdata && pdata->otg_dev)
> +		usb_otg_remove_hcd(xhci->shared_hcd);
> +	else
> +		usb_remove_hcd(xhci->shared_hcd);
>  
> -	usb_remove_hcd(xhci->shared_hcd);
>  	usb_phy_shutdown(hcd->usb_phy);
>  
> -	usb_remove_hcd(hcd);
> +	if (pdata && pdata->otg_dev)
> +		usb_otg_remove_hcd(hcd);
> +	else
> +		usb_remove_hcd(hcd);
> +
>  	usb_put_hcd(xhci->shared_hcd);
>  
>  	if (!IS_ERR(clk))
> diff --git a/include/linux/usb/xhci_pdriver.h b/include/linux/usb/xhci_pdriver.h
> index 376654b..5c68b83 100644
> --- a/include/linux/usb/xhci_pdriver.h
> +++ b/include/linux/usb/xhci_pdriver.h
> @@ -18,10 +18,13 @@
>   *
>   * @usb3_lpm_capable:	determines if this xhci platform supports USB3
>   *			LPM capability
> + * @otg_dev:		OTG controller device. Only requied if part of
> + *			OTG/dual-role.
>   *
>   */
>  struct usb_xhci_pdata {
>  	unsigned	usb3_lpm_capable:1;
> +	struct device	*otg_dev;
>  };
>  
>  #endif /* __USB_CORE_XHCI_PDRIVER_H */
> 

--
cheers,
-roger

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ