Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
host.c
Go to the documentation of this file.
1 
38 #include <linux/platform_device.h>
39 
40 #include "core.h"
41 
42 int dwc3_host_init(struct dwc3 *dwc)
43 {
44  struct platform_device *xhci;
45  int ret;
46 
47  xhci = platform_device_alloc("xhci-hcd", -1);
48  if (!xhci) {
49  dev_err(dwc->dev, "couldn't allocate xHCI device\n");
50  ret = -ENOMEM;
51  goto err0;
52  }
53 
54  dma_set_coherent_mask(&xhci->dev, dwc->dev->coherent_dma_mask);
55 
56  xhci->dev.parent = dwc->dev;
57  xhci->dev.dma_mask = dwc->dev->dma_mask;
58  xhci->dev.dma_parms = dwc->dev->dma_parms;
59 
60  dwc->xhci = xhci;
61 
64  if (ret) {
65  dev_err(dwc->dev, "couldn't add resources to xHCI device\n");
66  goto err1;
67  }
68 
69  ret = platform_device_add(xhci);
70  if (ret) {
71  dev_err(dwc->dev, "failed to register xHCI device\n");
72  goto err1;
73  }
74 
75  return 0;
76 
77 err1:
78  platform_device_put(xhci);
79 
80 err0:
81  return ret;
82 }
83 
84 void dwc3_host_exit(struct dwc3 *dwc)
85 {
87 }