* [U-Boot] [PATCH v1 0/5] usb, ohci-hcd: add usb ohci pci DM driver
@ 2019-07-16 8:49 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
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Heiko Schocher @ 2019-07-16 8:49 UTC (permalink / raw)
To: u-boot
add DM support for USB OHCI over PCI. Therefore first add
some small fixes to get usb ohci-hcd driver working again
with mpc85xx.
Base for the patchset is:
6070ef409c - Merge branch '2019-07-12-master-imports'
Travis build see:
https://travis-ci.org/hsdenx/u-boot-test/builds/559243960
Heiko Schocher (5):
usb, ohci-hdc: fix warning 'ohci_pci_ids' defined but not used
usb, ohci: fix ohci swap register access
usb, ohci-hcd: set OHCI_USE_NPS if DM_PCI
usb, ohci: add warning if none on pci found
usb, ohci, pci: add DM support for PCI-based OHCI USB controller
drivers/usb/host/Kconfig | 7 +++++
drivers/usb/host/Makefile | 1 +
drivers/usb/host/ohci-hcd.c | 12 ++++++---
drivers/usb/host/ohci-pci.c | 52 +++++++++++++++++++++++++++++++++++++
drivers/usb/host/ohci.h | 4 +--
5 files changed, 71 insertions(+), 5 deletions(-)
create mode 100644 drivers/usb/host/ohci-pci.c
--
2.21.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v1 1/5] usb, ohci-hdc: fix warning 'ohci_pci_ids' defined but not used
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 ` Heiko Schocher
2019-07-16 8:49 ` [U-Boot] [PATCH v1 2/5] usb, ohci: fix ohci swap register access Heiko Schocher
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Heiko Schocher @ 2019-07-16 8:49 UTC (permalink / raw)
To: u-boot
var ohci_pci_ids is only used if DM_USB is not enabled.
So define this varaible only if
!CONFIG_IS_ENABLED(DM_USB)
Signed-off-by: Heiko Schocher <hs@denx.de>
---
drivers/usb/host/ohci-hcd.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 2b0df88f49..bd498da096 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -64,6 +64,7 @@
#define OHCI_CONTROL_INIT \
(OHCI_CTRL_CBSR & 0x3) | OHCI_CTRL_IE | OHCI_CTRL_PLE
+#if !CONFIG_IS_ENABLED(DM_USB)
#ifdef CONFIG_PCI_OHCI
static struct pci_device_id ohci_pci_ids[] = {
{0x10b9, 0x5237}, /* ULI1575 PCI OHCI module ids */
@@ -73,6 +74,7 @@ static struct pci_device_id ohci_pci_ids[] = {
{0, 0}
};
#endif
+#endif
#ifdef CONFIG_PCI_EHCI_DEVNO
static struct pci_device_id ehci_pci_ids[] = {
--
2.21.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v1 2/5] usb, ohci: fix ohci swap register access
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 ` 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
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Heiko Schocher @ 2019-07-16 8:49 UTC (permalink / raw)
To: u-boot
commit 57faca19a82f ("drivers: USB: OHCI: allow compilation for 64-bit targets")
broke ohci support for the mpc85xx based socrates board,
as it removed volatile keyword from ohci_readl/writel.
Fix this so usb works again on socrates board.
Signed-off-by: Heiko Schocher <hs@denx.de>
---
drivers/usb/host/ohci.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index f9f02cb09c..9b264bd92a 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -14,8 +14,8 @@
#include <asm/io.h>
#ifdef CONFIG_SYS_OHCI_SWAP_REG_ACCESS
-# define ohci_readl(a) __swap_32(readl(a))
-# define ohci_writel(v, a) writel(__swap_32(v), a)
+# define ohci_readl(a) __swap_32(in_be32((u32 *)a))
+# define ohci_writel(a, b) out_be32((u32 *)b, __swap_32(a))
#else
# define ohci_readl(a) readl(a)
# define ohci_writel(v, a) writel(v, a)
--
2.21.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v1 3/5] usb, ohci-hcd: set OHCI_USE_NPS if DM_PCI
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 ` Heiko Schocher
2019-07-16 8:49 ` [U-Boot] [PATCH v1 4/5] usb, ohci: add warning if none on pci found Heiko Schocher
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Heiko Schocher @ 2019-07-16 8:49 UTC (permalink / raw)
To: u-boot
set OHCI_USE_NPS if DM_PCI is enabled.
Signed-off-by: Heiko Schocher <hs@denx.de>
---
drivers/usb/host/ohci-hcd.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index bd498da096..23ea2af5d7 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -50,8 +50,9 @@
#endif
#if defined(CONFIG_CPU_ARM920T) || \
- defined(CONFIG_PCI_OHCI) || \
- defined(CONFIG_SYS_OHCI_USE_NPS)
+ defined(CONFIG_PCI_OHCI) || \
+ defined(CONFIG_DM_PCI) || \
+ defined(CONFIG_SYS_OHCI_USE_NPS)
# define OHCI_USE_NPS /* force NoPowerSwitching mode */
#endif
--
2.21.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v1 4/5] usb, ohci: add warning if none on pci found
2019-07-16 8:49 [U-Boot] [PATCH v1 0/5] usb, ohci-hcd: add usb ohci pci DM driver Heiko Schocher
` (2 preceding siblings ...)
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 ` Heiko Schocher
2019-07-16 8:49 ` [U-Boot] [PATCH v1 5/5] usb, ohci, pci: add DM support for PCI-based OHCI USB controller Heiko Schocher
2019-07-21 10:52 ` [U-Boot] [PATCH v1 0/5] usb, ohci-hcd: add usb ohci pci DM driver Marek Vasut
5 siblings, 0 replies; 7+ messages in thread
From: Heiko Schocher @ 2019-07-16 8:49 UTC (permalink / raw)
To: u-boot
Signed-off-by: Heiko Schocher <hs@denx.de>
---
drivers/usb/host/ohci-hcd.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 23ea2af5d7..58aa824ec0 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -2047,8 +2047,11 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)
pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &base);
printf("OHCI regs address 0x%08x\n", base);
gohci.regs = (struct ohci_regs *)base;
- } else
+ } else {
+ printf("%s: OHCI devnr: %d not found\n", __func__,
+ CONFIG_PCI_OHCI_DEVNO);
return -1;
+ }
#else
gohci.regs = (struct ohci_regs *)CONFIG_SYS_USB_OHCI_REGS_BASE;
#endif
--
2.21.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v1 5/5] usb, ohci, pci: add DM support for PCI-based OHCI USB controller
2019-07-16 8:49 [U-Boot] [PATCH v1 0/5] usb, ohci-hcd: add usb ohci pci DM driver Heiko Schocher
` (3 preceding siblings ...)
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
2019-07-21 10:52 ` [U-Boot] [PATCH v1 0/5] usb, ohci-hcd: add usb ohci pci DM driver Marek Vasut
5 siblings, 0 replies; 7+ messages in thread
From: Heiko Schocher @ 2019-07-16 8:49 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v1 0/5] usb, ohci-hcd: add usb ohci pci DM driver
2019-07-16 8:49 [U-Boot] [PATCH v1 0/5] usb, ohci-hcd: add usb ohci pci DM driver Heiko Schocher
` (4 preceding siblings ...)
2019-07-16 8:49 ` [U-Boot] [PATCH v1 5/5] usb, ohci, pci: add DM support for PCI-based OHCI USB controller Heiko Schocher
@ 2019-07-21 10:52 ` Marek Vasut
5 siblings, 0 replies; 7+ messages in thread
From: Marek Vasut @ 2019-07-21 10:52 UTC (permalink / raw)
To: u-boot
On 7/16/19 10:49 AM, Heiko Schocher wrote:
> add DM support for USB OHCI over PCI. Therefore first add
> some small fixes to get usb ohci-hcd driver working again
> with mpc85xx.
>
> Base for the patchset is:
> 6070ef409c - Merge branch '2019-07-12-master-imports'
Applied all, thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-07-21 10:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [U-Boot] [PATCH v1 5/5] usb, ohci, pci: add DM support for PCI-based OHCI USB controller Heiko Schocher
2019-07-21 10:52 ` [U-Boot] [PATCH v1 0/5] usb, ohci-hcd: add usb ohci pci DM driver Marek Vasut
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox