From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 5/5] usb, ohci, pci: add DM support for PCI-based OHCI USB controller
Date: Tue, 16 Jul 2019 10:49:07 +0200 [thread overview]
Message-ID: <20190716084907.1568340-6-hs@denx.de> (raw)
In-Reply-To: <20190716084907.1568340-1-hs@denx.de>
add new DM based PCI driver ohci-pci for PCI-based
OHCI USB support.
Signed-off-by: Heiko Schocher <hs@denx.de>
---
drivers/usb/host/Kconfig | 7 +++++
drivers/usb/host/Makefile | 1 +
drivers/usb/host/ohci-pci.c | 52 +++++++++++++++++++++++++++++++++++++
3 files changed, 60 insertions(+)
create mode 100644 drivers/usb/host/ohci-pci.c
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index b1188bcbf5..96954d1673 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -235,6 +235,13 @@ config USB_OHCI_HCD
based system where you're not sure, the "lspci -v" entry will list the
right "prog-if" for your USB controller(s): EHCI, OHCI, or UHCI.
+config USB_OHCI_PCI
+ bool "Support for PCI-based OHCI USB controller"
+ depends on DM_USB
+ default n
+ help
+ Enables support for the PCI-based OHCI controller.
+
if USB_OHCI_HCD
config USB_OHCI_GENERIC
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 6aa574f6f7..dd13528475 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
obj-$(CONFIG_USB_SL811HS) += sl811-hcd.o
obj-$(CONFIG_USB_OHCI_EP93XX) += ohci-ep93xx.o
obj-$(CONFIG_USB_OHCI_LPC32XX) += ohci-lpc32xx.o
+obj-$(CONFIG_USB_OHCI_PCI) += ohci-pci.o
obj-$(CONFIG_USB_OHCI_GENERIC) += ohci-generic.o
# echi
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
new file mode 100644
index 0000000000..4c1c778672
--- /dev/null
+++ b/drivers/usb/host/ohci-pci.c
@@ -0,0 +1,52 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2019
+ * Heiko Schocher, DENX Software Engineering, hs at denx.de.
+ *
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <errno.h>
+#include <pci.h>
+#include <usb.h>
+#include <asm/io.h>
+
+#include "ohci.h"
+
+static int ohci_pci_probe(struct udevice *dev)
+{
+ struct ohci_regs *regs;
+
+ regs = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, PCI_REGION_MEM);
+ return ohci_register(dev, regs);
+}
+
+static int ohci_pci_remove(struct udevice *dev)
+{
+ return ohci_deregister(dev);
+}
+
+static const struct udevice_id ohci_pci_ids[] = {
+ { .compatible = "ohci-pci" },
+ { }
+};
+
+U_BOOT_DRIVER(ohci_pci) = {
+ .name = "ohci_pci",
+ .id = UCLASS_USB,
+ .probe = ohci_pci_probe,
+ .remove = ohci_pci_remove,
+ .of_match = ohci_pci_ids,
+ .ops = &ohci_usb_ops,
+ .platdata_auto_alloc_size = sizeof(struct usb_platdata),
+ .priv_auto_alloc_size = sizeof(ohci_t),
+ .flags = DM_FLAG_ALLOC_PRIV_DMA,
+};
+
+static struct pci_device_id ohci_pci_supported[] = {
+ { PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_OHCI, ~0) },
+ {},
+};
+
+U_BOOT_PCI_DEVICE(ohci_pci, ohci_pci_supported);
--
2.21.0
next prev parent reply other threads:[~2019-07-16 8:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-16 8:49 [U-Boot] [PATCH v1 0/5] usb, ohci-hcd: add usb ohci pci DM driver Heiko Schocher
2019-07-16 8:49 ` [U-Boot] [PATCH v1 1/5] usb, ohci-hdc: fix warning 'ohci_pci_ids' defined but not used Heiko Schocher
2019-07-16 8:49 ` [U-Boot] [PATCH v1 2/5] usb, ohci: fix ohci swap register access Heiko Schocher
2019-07-16 8:49 ` [U-Boot] [PATCH v1 3/5] usb, ohci-hcd: set OHCI_USE_NPS if DM_PCI Heiko Schocher
2019-07-16 8:49 ` [U-Boot] [PATCH v1 4/5] usb, ohci: add warning if none on pci found Heiko Schocher
2019-07-16 8:49 ` Heiko Schocher [this message]
2019-07-21 10:52 ` [U-Boot] [PATCH v1 0/5] usb, ohci-hcd: add usb ohci pci DM driver Marek Vasut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190716084907.1568340-6-hs@denx.de \
--to=hs@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox