Skip to contentSkip to conversation

usb, ohci-hcd: add usb ohci pci DM driver

PATCH New Heiko Schocher 2 participants 7 messages Jul 16, 2019 – Jul 21, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover usb, ohci-hcd: add usb ohci pci DM driver

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
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/5 usb, ohci-hdc: fix warning 'ohci_pci_ids' defined but not used

var ohci_pci_ids is only used if DM_USB is not enabled. So define this varaible only if !CONFIG_IS_ENABLED(DM_USB)

---

 drivers/usb/host/ohci-hcd.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/host/ohci-hcd.c +2 -0
index 2b0df88f49..bd498da096 100644
@@ -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[] = {
Signature · 1 line
2.21.0
#2 lore raw

PATCH 2/5 usb, ohci: fix ohci swap register access

In reply to Heiko Schocher

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.

---

 drivers/usb/host/ohci.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/ohci.h +2 -2
index f9f02cb09c..9b264bd92a 100644
@@ -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)
Signature · 1 line
2.21.0
#3 lore raw

PATCH 3/5 usb, ohci-hcd: set OHCI_USE_NPS if DM_PCI

In reply to Heiko Schocher

set OHCI_USE_NPS if DM_PCI is enabled.

---

 drivers/usb/host/ohci-hcd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-hcd.c +3 -2
index bd498da096..23ea2af5d7 100644
@@ -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
 
Signature · 1 line
2.21.0
#4 lore raw

PATCH 4/5 usb, ohci: add warning if none on pci found

In reply to Heiko Schocher

---

 drivers/usb/host/ohci-hcd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/host/ohci-hcd.c +4 -1
index 23ea2af5d7..58aa824ec0 100644
@@ -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
Signature · 1 line
2.21.0
#5 lore raw

PATCH 5/5 usb, ohci, pci: add DM support for PCI-based OHCI USB controller

In reply to Heiko Schocher

add new DM based PCI driver ohci-pci for PCI-based OHCI USB support.

---

 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
drivers/usb/host/Kconfig +7 -0
index b1188bcbf5..96954d1673 100644
@@ -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
drivers/usb/host/Makefile +1 -0
index 6aa574f6f7..dd13528475 100644
@@ -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
drivers/usb/host/ohci-pci.c new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
2.21.0
Applied
#6 lore raw

cover usb, ohci-hcd: add usb ohci pci DM driver

In reply to Heiko Schocher
Quoted 6 lines · Heiko Schocher

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.