summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>2014-07-26 17:24:45 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-07-28 07:31:18 +0200
commitb8d2d4923f199d25d6465e3ef09a90ca420ca3f7 (patch)
tree5750a17757b5f626c9ddbb2549f8dc0166247f41
parent237bad9cc7b42d98c065dd6e20425b441248358d (diff)
downloadbarebox-b8d2d4923f199d25d6465e3ef09a90ca420ca3f7.tar.gz
barebox-b8d2d4923f199d25d6465e3ef09a90ca420ca3f7.tar.xz
USB: host: add xHCI PCI driver
This adds a driver for PCI-attached xHCI controllers. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/usb/host/Kconfig7
-rw-r--r--drivers/usb/host/Makefile1
-rw-r--r--drivers/usb/host/xhci-pci.c45
3 files changed, 53 insertions, 0 deletions
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 8c64a3b99c..c5dc2ea532 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -33,3 +33,10 @@ config USB_XHCI
This driver currently only supports virtual USB 2.0 ports, if you
plan to use USB 3.0 devices, use a USB 2.0 cable in between.
+
+config USB_XHCI_PCI
+ depends on PCI
+ select USB_XHCI
+ bool "PCI xHCI driver"
+ help
+ Enables support for PCI attached xHCI controllers.
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index a5c009ebd6..0478d34272 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -4,3 +4,4 @@ obj-$(CONFIG_USB_EHCI_ATMEL) += ehci-atmel.o
obj-$(CONFIG_USB_OHCI) += ohci-hcd.o
obj-$(CONFIG_USB_OHCI_AT91) += ohci-at91.o
obj-$(CONFIG_USB_XHCI) += xhci-hcd.o xhci-hub.o
+obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
new file mode 100644
index 0000000000..a140b1dd07
--- /dev/null
+++ b/drivers/usb/host/xhci-pci.c
@@ -0,0 +1,45 @@
+/*
+ * PCI driver for xHCI controllers
+ *
+ * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <common.h>
+#include <init.h>
+#include <io.h>
+#include <linux/pci.h>
+#include <usb/xhci.h>
+
+static int xhci_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+{
+ struct xhci_data data = {};
+
+ pci_enable_device(pdev);
+ pci_set_master(pdev);
+
+ data.regs = pci_iomap(pdev, 0);
+
+ return xhci_register(&pdev->dev, &data);
+}
+
+static DEFINE_PCI_DEVICE_TABLE(xhci_pci_tbl) = {
+ /* handle any USB 3.0 xHCI controller */
+ { PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_XHCI, ~0), },
+ { },
+};
+
+static struct pci_driver xhci_pci_driver = {
+ .name = "xHCI PCI",
+ .id_table = xhci_pci_tbl,
+ .probe = xhci_pci_probe,
+};
+
+static int xhci_pci_init(void)
+{
+ return pci_register_driver(&xhci_pci_driver);
+}
+device_initcall(xhci_pci_init);