diff mbox series

[v2,4/9] usb: host: xhci-plat: add platform data support

Message ID 20200523232304.23976-5-peter.chen@nxp.com (mailing list archive)
State Superseded
Headers show
Series usb: some PM changes for cdns3 and xhci-plat | expand

Commit Message

Peter Chen May 23, 2020, 11:22 p.m. UTC
Some xhci hosts (eg dwc3 and cdns3) do not use OF to create
platform device, they create xhci-plat platform device runtime.
And these platforms may also have quirks, and the quirks could
be supplied by their parent device through platform data.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/usb/host/xhci-plat.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Mathias Nyman May 29, 2020, 10:21 a.m. UTC | #1
On 24.5.2020 2.22, Peter Chen wrote:
> Some xhci hosts (eg dwc3 and cdns3) do not use OF to create
> platform device, they create xhci-plat platform device runtime.
> And these platforms may also have quirks, and the quirks could
> be supplied by their parent device through platform data.
> 
> Signed-off-by: Peter Chen <peter.chen@nxp.com>
> ---
>  drivers/usb/host/xhci-plat.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index f6b4089bfc4a..38bea2b6a17d 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -264,7 +264,11 @@ static int xhci_plat_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto disable_reg_clk;
>  
> -	priv_match = of_device_get_match_data(&pdev->dev);
> +	if (pdev->dev.of_node)
> +		priv_match = of_device_get_match_data(&pdev->dev);
> +	else
> +		priv_match = dev_get_platdata(&pdev->dev);
> +
>  	if (priv_match) {
>  		struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
>  
> 

Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index f6b4089bfc4a..38bea2b6a17d 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -264,7 +264,11 @@  static int xhci_plat_probe(struct platform_device *pdev)
 	if (ret)
 		goto disable_reg_clk;
 
-	priv_match = of_device_get_match_data(&pdev->dev);
+	if (pdev->dev.of_node)
+		priv_match = of_device_get_match_data(&pdev->dev);
+	else
+		priv_match = dev_get_platdata(&pdev->dev);
+
 	if (priv_match) {
 		struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);