Commit 22f2e3d2b24799be881b9f5adc1bcabf095aa956

Authored by George Cherian
Committed by Sekhar Nori
1 parent 73b07c425e

usb: host: xhci: Adapt xhci to use usb drd library

Adapt the xhci-plat driver  to use drd library functions.
In prepration to support DRD on dwc3.

Signed-off-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>

Showing 1 changed file with 15 additions and 0 deletions Side-by-side Diff

drivers/usb/host/xhci-plat.c
... ... @@ -17,6 +17,8 @@
17 17 #include <linux/of.h>
18 18 #include <linux/platform_device.h>
19 19 #include <linux/slab.h>
  20 +#include <linux/usb/otg.h>
  21 +#include <linux/usb/drd.h>
20 22 #include <linux/usb/xhci_pdriver.h>
21 23  
22 24 #include "xhci.h"
... ... @@ -129,6 +131,7 @@
129 131 struct resource *res;
130 132 struct usb_hcd *hcd;
131 133 struct clk *clk;
  134 + struct usb_drd_host *drd_host;
132 135 int ret;
133 136 int irq;
134 137  
... ... @@ -220,6 +223,17 @@
220 223 if (ret)
221 224 goto put_usb3_hcd;
222 225  
  226 + drd_host = kzalloc(sizeof(*drd_host), GFP_KERNEL);
  227 + if (!drd_host)
  228 + return -ENOMEM;
  229 +
  230 + drd_host->main_hcd = xhci->main_hcd;
  231 + drd_host->shared_hcd = xhci->shared_hcd;
  232 + drd_host->hcd_irq = irq;
  233 + drd_host->host_setup = NULL;
  234 +
  235 + usb_drd_register_hcd(pdev->dev.parent, drd_host);
  236 +
223 237 return 0;
224 238  
225 239 put_usb3_hcd:
... ... @@ -251,6 +265,7 @@
251 265 if (!IS_ERR(clk))
252 266 clk_disable_unprepare(clk);
253 267 usb_put_hcd(hcd);
  268 + usb_drd_unregister_hcd(dev->dev.parent);
254 269 kfree(xhci);
255 270  
256 271 return 0;