summaryrefslogtreecommitdiff
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorAlexey Brodkin <Alexey.Brodkin@synopsys.com>2015-12-14 17:18:50 +0300
committerMarek Vasut <marex@denx.de>2015-12-17 21:54:41 +0100
commitfee331f66c923bd1b481b4a72fe7814e5436daed (patch)
tree50cc38caca87f1f789812fbdfa6b0c0b78e35c32 /drivers/usb/host
parent70cc443d5833b27dd4dd4a48a771778c39734f75 (diff)
usb: add support of generic OHCI devices
This driver is meant to be used with any OHCI-compatible host controller in case if there's no need for platform-specific glue such as setup of controller or PHY's power mode via GPIOs etc. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Cc: Simon Glass <sjg@chromium.org> Cc: Marek Vasut <marex@denx.de>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/Kconfig8
-rw-r--r--drivers/usb/host/Makefile1
-rw-r--r--drivers/usb/host/ohci-generic.c45
3 files changed, 54 insertions, 0 deletions
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 0096a2fdd9..39f7185e86 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -26,6 +26,14 @@ config USB_XHCI_UNIPHIER
endif
+config USB_OHCI_GENERIC
+ bool "Support for generic OHCI USB controller"
+ depends on OF_CONTROL
+ depends on DM_USB
+ default n
+ ---help---
+ Enables support for generic OHCI controller.
+
config USB_EHCI_HCD
bool "EHCI HCD (USB 2.0) support"
---help---
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 0b4b458cca..6183b80c75 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_USB_OHCI_S3C24XX) += ohci-s3c24xx.o
obj-$(CONFIG_USB_OHCI_EP93XX) += ohci-ep93xx.o
obj-$(CONFIG_USB_OHCI_SUNXI) += ohci-sunxi.o
obj-$(CONFIG_USB_OHCI_LPC32XX) += ohci-lpc32xx.o
+obj-$(CONFIG_USB_OHCI_GENERIC) += ohci-generic.o
# echi
obj-$(CONFIG_USB_EHCI) += ehci-hcd.o
diff --git a/drivers/usb/host/ohci-generic.c b/drivers/usb/host/ohci-generic.c
new file mode 100644
index 0000000000..f3307f47a7
--- /dev/null
+++ b/drivers/usb/host/ohci-generic.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2015 Alexey Brodkin <abrodkin@synopsys.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include "ohci.h"
+
+#if !defined(CONFIG_USB_OHCI_NEW)
+# error "Generic OHCI driver requires CONFIG_USB_OHCI_NEW"
+#endif
+
+struct generic_ohci {
+ ohci_t ohci;
+};
+
+static int ohci_usb_probe(struct udevice *dev)
+{
+ struct ohci_regs *regs = (struct ohci_regs *)dev_get_addr(dev);
+
+ return ohci_register(dev, regs);
+}
+
+static int ohci_usb_remove(struct udevice *dev)
+{
+ return ohci_deregister(dev);
+}
+
+static const struct udevice_id ohci_usb_ids[] = {
+ { .compatible = "generic-ohci" },
+ { }
+};
+
+U_BOOT_DRIVER(ohci_generic) = {
+ .name = "ohci_generic",
+ .id = UCLASS_USB,
+ .of_match = ohci_usb_ids,
+ .probe = ohci_usb_probe,
+ .remove = ohci_usb_remove,
+ .ops = &ohci_usb_ops,
+ .priv_auto_alloc_size = sizeof(struct generic_ohci),
+ .flags = DM_FLAG_ALLOC_PRIV_DMA,
+};