Skip to contentSkip to conversation

mips/usb: Add Octeon xHCI USB support

PATCH Superseded Stefan Roese 2 participants 15 messages Aug 17, 2020 – Aug 19, 2020

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover mips/usb: Add Octeon xHCI USB support

This patchset adds xHCI USB support for MIPS Octeon. After the xHCI code has been fixed to support mapped addresses (virt != phys), this patchset now adds the missing code pieces to enable USB support on Octeon. This is mainly the USB glue code for Octeon and the MIPS platform specific changes (cache fixes, platform specific swapping based on address areas, DT & defcopnfig changes).

Thanks,
Stefan

Stefan Roese (8):
usb: xhci: xhci-dwc3.c: Use dev_remap_addr() instead of dev_get_addr()
usb: xhci: xhci_bulk_tx: Don't "BUG" when comparing addresses on
Octeon
usb: xhci: octeon: Add DWC3 glue layer for Octeon
mips: octeon: cpu.c: Add table for selective swapping
mips: octeon: Add mangle-port.h
mips: octeon: cache.c: Flush all pending writes in
flush_dcache_range()
mips: octeon: Add USB DT nodes
mips: octeon: octeon_ebb7304_defconfig: Enable USB support

 arch/mips/dts/mrvl,cn73xx.dtsi              |  58 +++
 arch/mips/dts/mrvl,octeon-ebb7304.dts       |  22 ++
 arch/mips/mach-octeon/cache.c               |  12 +-
 arch/mips/mach-octeon/cpu.c                 |  21 ++
 arch/mips/mach-octeon/include/mangle-port.h |  58 +++
 configs/octeon_ebb7304_defconfig            |  17 +
 drivers/usb/host/Kconfig                    |   9 +
 drivers/usb/host/Makefile                   |   1 +
 drivers/usb/host/dwc3-octeon-glue.c         | 396 ++++++++++++++++++++
 drivers/usb/host/xhci-dwc3.c                |   2 +-
 drivers/usb/host/xhci-ring.c                |   7 +-
 11 files changed, 594 insertions(+), 9 deletions(-)
 create mode 100644 arch/mips/mach-octeon/include/mangle-port.h
 create mode 100644 drivers/usb/host/dwc3-octeon-glue.c
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/8 usb: xhci: xhci-dwc3.c: Use dev_remap_addr() instead of dev_get_addr()

On MIPS platforms, mapping of the base address is needed. This patch switches from dev_get_addr() to dev_remap_addr() to get the mapped base address of the xHCI controller.

---

 drivers/usb/host/xhci-dwc3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-dwc3.c +1 -1
index 27f84102db..045de2ffde 100644
@@ -122,7 +122,7 @@ static int xhci_dwc3_probe(struct udevice *dev)
 	u32 reg;
 	int ret;
 
-	hccr = (struct xhci_hccr *)((uintptr_t)dev_read_addr(dev));
+	hccr = (struct xhci_hccr *)((uintptr_t)dev_remap_addr(dev));
 	hcor = (struct xhci_hcor *)((uintptr_t)hccr +
 			HC_LENGTH(xhci_readl(&(hccr)->cr_capbase)));
 
Signature · 1 line
2.28.0
#2 lore raw

PATCH 2/8 usb: xhci: xhci_bulk_tx: Don't "BUG" when comparing addresses on Octeon

In reply to Stefan Roese

Octeon uses mapped addresses for virtual and physical memory. Its not that easy to calculate the resulting addresses here. So lets remove this BUG_ON() for Octeon in xhci_bulk_tx().

---

 drivers/usb/host/xhci-ring.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/host/xhci-ring.c +5 -2
index 092ed6eaf1..a762177c57 100644
@@ -726,8 +726,11 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
 
 	BUG_ON(TRB_TO_SLOT_ID(field) != slot_id);
 	BUG_ON(TRB_TO_EP_INDEX(field) != ep_index);
-	BUG_ON(*(void **)(uintptr_t)le64_to_cpu(event->trans_event.buffer) -
-		buffer > (size_t)length);
+	if (!IS_ENABLED(CONFIG_ARCH_OCTEON)) {
+			BUG_ON(*(void **)(uintptr_t)le64_to_cpu(
+				       event->trans_event.buffer) - buffer >
+			       (size_t)length);
+	}
 
 	record_transfer_result(udev, event, length);
 	xhci_acknowledge_event(ctrl);
Signature · 1 line
2.28.0
#3 lore raw

PATCH 2/8 usb: xhci: xhci_bulk_tx: Don't "BUG" when comparing addresses on Octeon

Am Montag, den 17.08.2020, 15:06 +0200 schrieb Stefan Roese:

Quoted 17 lines

Octeon uses mapped addresses for virtual and physical memory. Its not that easy to calculate the resulting addresses here. So lets remove this BUG_ON() for Octeon in xhci_bulk_tx().

---

 drivers/usb/host/xhci-ring.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/host/xhci-ring.c +0 -0
index 092ed6eaf1..a762177c57 100644

drivers/usb/host/xhci-ring.c int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe, · line 733

Quoted 10 lines
drivers/usb/host/xhci-ring.c +5 -2
@@ -726,8 +726,11 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
 
 	BUG_ON(TRB_TO_SLOT_ID(field) != slot_id);
 	BUG_ON(TRB_TO_EP_INDEX(field) != ep_index);
-	BUG_ON(*(void **)(uintptr_t)le64_to_cpu(event->trans_event.buffer) -
-		buffer > (size_t)length);
+	if (!IS_ENABLED(CONFIG_ARCH_OCTEON)) {
+			BUG_ON(*(void **)(uintptr_t)le64_to_cpu(
+				       event->trans_event.buffer) - buffer >
+			       (size_t)length);
+	}

why not remove the check? Or add at least a generic Kconfig option for special handling on archs with memory remapping. Arch or SoC specific config options in generic code are bad ;)

Quoted 3 lines
drivers/usb/host/xhci-ring.c +0 -0
 	record_transfer_result(udev, event, length);
 	xhci_acknowledge_event(ctrl);
Signature · 1 line
- Daniel
#4 lore raw

PATCH 2/8 usb: xhci: xhci_bulk_tx: Don't "BUG" when comparing addresses on Octeon

Quoted 19 lines · Daniel Schwierzeck

Am Montag, den 17.08.2020, 15:06 +0200 schrieb Stefan Roese:

Quoted 18 lines

Octeon uses mapped addresses for virtual and physical memory. Its not that easy to calculate the resulting addresses here. So lets remove this BUG_ON() for Octeon in xhci_bulk_tx().

---

  drivers/usb/host/xhci-ring.c | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/host/xhci-ring.c +0 -0
index 092ed6eaf1..a762177c57 100644
@@ -726,8 +726,11 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
 
Quoted 13 lines

drivers/usb/host/xhci-ring.c int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe, · line 733

Quoted 9 lines
drivers/usb/host/xhci-ring.c +5 -2
  	BUG_ON(TRB_TO_SLOT_ID(field) != slot_id);
  	BUG_ON(TRB_TO_EP_INDEX(field) != ep_index);
-	BUG_ON(*(void **)(uintptr_t)le64_to_cpu(event->trans_event.buffer) -
-		buffer > (size_t)length);
+	if (!IS_ENABLED(CONFIG_ARCH_OCTEON)) {
+			BUG_ON(*(void **)(uintptr_t)le64_to_cpu(
+				       event->trans_event.buffer) - buffer >
+			       (size_t)length);
+	}

why not remove the check? Or add at least a generic Kconfig option for special handling on archs with memory remapping. Arch or SoC specific config options in generic code are bad ;)

Yes, I agree. I was also thinking about removing this check completely. I'm not 100% sure, but I think that some (most?) of these BUG_ON() macros have been removed from the Linux kernel.

To not make too many changes, I'll change this patch in the next version to just remove this one BUG_ON().

Thanks,
Stefan

#5 lore raw

PATCH 3/8 usb: xhci: octeon: Add DWC3 glue layer for Octeon

In reply to Stefan Roese

This patch adds the glue layer for the MIPS Octeon SoCs. Its ported mainly from the Linux code.

---

 drivers/usb/host/Kconfig            |   9 +
 drivers/usb/host/Makefile           |   1 +
 drivers/usb/host/dwc3-octeon-glue.c | 396 ++++++++++++++++++++++++++++
 3 files changed, 406 insertions(+)
 create mode 100644 drivers/usb/host/dwc3-octeon-glue.c
drivers/usb/host/Kconfig +9 -0
index 1c374a7bd8..d71c12d888 100644
@@ -46,6 +46,15 @@ config USB_XHCI_MVEBU
 	  SoCs, which includes Armada8K, Armada3700 and other Armada
 	  family SoCs.
 
+config USB_XHCI_OCTEON
+	bool "Support for Marvell Octeon family on-chip xHCI USB controller"
+	depends on ARCH_OCTEON
+	default y
+	help
+	  Enables support for the on-chip xHCI controller on Marvell Octeon
+	  family SoCs. This is a driver for the dwc3 to provide the glue logic
+	  to configure the controller.
+
 config USB_XHCI_PCI
 	bool "Support for PCI-based xHCI USB controller"
 	depends on DM_USB
drivers/usb/host/Makefile +1 -0
index 29d4f87e38..a12e8f2702 100644
@@ -56,6 +56,7 @@ obj-$(CONFIG_USB_XHCI_OMAP) += xhci-omap.o
 obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o
 obj-$(CONFIG_USB_XHCI_RCAR) += xhci-rcar.o
 obj-$(CONFIG_USB_XHCI_STI) += dwc3-sti-glue.o
+obj-$(CONFIG_USB_XHCI_OCTEON) += dwc3-octeon-glue.o
 
 # designware
 obj-$(CONFIG_USB_DWC2) += dwc2.o
drivers/usb/host/dwc3-octeon-glue.c new file +396 -0

396 lines not on this page · raw message

Signature · 1 line
2.28.0
#6 lore raw

PATCH 4/8 mips: octeon: cpu.c: Add table for selective swapping

In reply to Stefan Roese

Import octeon_should_swizzle_table[] which is needed for the area specific swapping. It will be used by the platform specific mangle-port.h header.

Imported from Linux v5.7.

---

 arch/mips/mach-octeon/cpu.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/mips/mach-octeon/cpu.c +21 -0
index 2680a2e6ed..6f87a4ef8c 100644
@@ -13,6 +13,27 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+/*
+ * TRUE for devices having registers with little-endian byte
+ * order, FALSE for registers with native-endian byte order.
+ * PCI mandates little-endian, USB and SATA are configurable,
+ * but we chose little-endian for these.
+ *
+ * This table will be referened in the Octeon platform specific
+ * mangle-port.h header.
+ */
+const bool octeon_should_swizzle_table[256] = {
+	[0x00] = true,	/* bootbus/CF */
+	[0x1b] = true,	/* PCI mmio window */
+	[0x1c] = true,	/* PCI mmio window */
+	[0x1d] = true,	/* PCI mmio window */
+	[0x1e] = true,	/* PCI mmio window */
+	[0x68] = true,	/* OCTEON III USB */
+	[0x69] = true,	/* OCTEON III USB */
+	[0x6c] = true,	/* OCTEON III SATA */
+	[0x6f] = true,	/* OCTEON II USB */
+};
+
 static int get_clocks(void)
 {
 	const u64 ref_clock = PLL_REF_CLK;
Signature · 1 line
2.28.0
#7 lore raw

PATCH 5/8 mips: octeon: Add mangle-port.h

In reply to Stefan Roese

Import platform specific mangle-port.h header, allowing a area specific swapping, which is needed on Octeon for USB & PCI areas.

Imported from Linux v5.7.

---

 arch/mips/mach-octeon/include/mangle-port.h | 58 +++++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 arch/mips/mach-octeon/include/mangle-port.h
arch/mips/mach-octeon/include/mangle-port.h new file +58 -0
new file mode 100644
index 0000000000..8ff2cbdf2c
@@ -0,0 +1,58 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2003, 2004 Ralf Baechle
+ */
+#ifndef __ASM_MACH_GENERIC_MANGLE_PORT_H
+#define __ASM_MACH_GENERIC_MANGLE_PORT_H
+
+#include <asm/byteorder.h>
+
+#ifdef __BIG_ENDIAN
+
+static inline bool __should_swizzle_bits(volatile void *a)
+{
+	extern const bool octeon_should_swizzle_table[];
+	u64 did = ((u64)(uintptr_t)a >> 40) & 0xff;
+
+	return octeon_should_swizzle_table[did];
+}
+
+# define __swizzle_addr_b(port)	(port)
+# define __swizzle_addr_w(port)	(port)
+# define __swizzle_addr_l(port)	(port)
+# define __swizzle_addr_q(port)	(port)
+
+#else /* __LITTLE_ENDIAN */
+
+#define __should_swizzle_bits(a)	false
+
+static inline bool __should_swizzle_addr(u64 p)
+{
+	/* boot bus? */
+	return ((p >> 40) & 0xff) == 0;
+}
+
+# define __swizzle_addr_b(port)	\
+	(__should_swizzle_addr(port) ? (port) ^ 7 : (port))
+# define __swizzle_addr_w(port)	\
+	(__should_swizzle_addr(port) ? (port) ^ 6 : (port))
+# define __swizzle_addr_l(port)	\
+	(__should_swizzle_addr(port) ? (port) ^ 4 : (port))
+# define __swizzle_addr_q(port)	(port)
+
+#endif /* __BIG_ENDIAN */
+
+
+# define ioswabb(a, x)		(x)
+# define __mem_ioswabb(a, x)	(x)
+# define ioswabw(a, x)		(__should_swizzle_bits(a) ? le16_to_cpu(x) : x)
+# define __mem_ioswabw(a, x)	(x)
+# define ioswabl(a, x)		(__should_swizzle_bits(a) ? le32_to_cpu(x) : x)
+# define __mem_ioswabl(a, x)	(x)
+# define ioswabq(a, x)		(__should_swizzle_bits(a) ? le64_to_cpu(x) : x)
+# define __mem_ioswabq(a, x)	(x)
+
+#endif /* __ASM_MACH_GENERIC_MANGLE_PORT_H */
Signature · 1 line
2.28.0
#8 lore raw

PATCH 5/8 mips: octeon: Add mangle-port.h

Am Montag, den 17.08.2020, 15:06 +0200 schrieb Stefan Roese:

Quoted 18 lines

Import platform specific mangle-port.h header, allowing a area specific swapping, which is needed on Octeon for USB & PCI areas.

Imported from Linux v5.7.

---

 arch/mips/mach-octeon/include/mangle-port.h | 58 +++++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 arch/mips/mach-octeon/include/mangle-port.h
arch/mips/mach-octeon/include/mangle-port.h new file +0 -0
new file mode 100644
index 0000000000..8ff2cbdf2c

arch/mips/mach-octeon/include/mangle-port.h line 7

Quoted 7 lines
arch/mips/mach-octeon/include/mangle-port.h new file +7 -0
@@ -0,0 +1,58 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2003, 2004 Ralf Baechle
+ */

when importing headers from Linux, please remove the license text and just keep copyrights and optionally additonal info text. At the top insert the SPDX identifier, e.g.

/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (C) 2003, 2004 Ralf Baechle
*/

Quoted 51 lines
arch/mips/mach-octeon/include/mangle-port.h new file +51 -0
+#ifndef __ASM_MACH_GENERIC_MANGLE_PORT_H
+#define __ASM_MACH_GENERIC_MANGLE_PORT_H
+
+#include <asm/byteorder.h>
+
+#ifdef __BIG_ENDIAN
+
+static inline bool __should_swizzle_bits(volatile void *a)
+{
+	extern const bool octeon_should_swizzle_table[];
+	u64 did = ((u64)(uintptr_t)a >> 40) & 0xff;
+
+	return octeon_should_swizzle_table[did];
+}
+
+# define __swizzle_addr_b(port)	(port)
+# define __swizzle_addr_w(port)	(port)
+# define __swizzle_addr_l(port)	(port)
+# define __swizzle_addr_q(port)	(port)
+
+#else /* __LITTLE_ENDIAN */
+
+#define __should_swizzle_bits(a)	false
+
+static inline bool __should_swizzle_addr(u64 p)
+{
+	/* boot bus? */
+	return ((p >> 40) & 0xff) == 0;
+}
+
+# define __swizzle_addr_b(port)	\
+	(__should_swizzle_addr(port) ? (port) ^ 7 : (port))
+# define __swizzle_addr_w(port)	\
+	(__should_swizzle_addr(port) ? (port) ^ 6 : (port))
+# define __swizzle_addr_l(port)	\
+	(__should_swizzle_addr(port) ? (port) ^ 4 : (port))
+# define __swizzle_addr_q(port)	(port)
+
+#endif /* __BIG_ENDIAN */
+
+
+# define ioswabb(a, x)		(x)
+# define __mem_ioswabb(a, x)	(x)
+# define ioswabw(a, x)		(__should_swizzle_bits(a) ? le16_to_cpu(x) : x)
+# define __mem_ioswabw(a, x)	(x)
+# define ioswabl(a, x)		(__should_swizzle_bits(a) ? le32_to_cpu(x) : x)
+# define __mem_ioswabl(a, x)	(x)
+# define ioswabq(a, x)		(__should_swizzle_bits(a) ? le64_to_cpu(x) : x)
+# define __mem_ioswabq(a, x)	(x)
+
+#endif /* __ASM_MACH_GENERIC_MANGLE_PORT_H */
Signature · 1 line
- Daniel
#9 lore raw

PATCH 5/8 mips: octeon: Add mangle-port.h

Quoted 22 lines · Daniel Schwierzeck

Am Montag, den 17.08.2020, 15:06 +0200 schrieb Stefan Roese:

Quoted 21 lines

Import platform specific mangle-port.h header, allowing a area specific swapping, which is needed on Octeon for USB & PCI areas.

Imported from Linux v5.7.

---

  arch/mips/mach-octeon/include/mangle-port.h | 58 +++++++++++++++++++++
  1 file changed, 58 insertions(+)

create mode 100644 arch/mips/mach-octeon/include/mangle-port.h

arch/mips/mach-octeon/include/mangle-port.h new file +3 -0
new file mode 100644
index 0000000000..8ff2cbdf2c
@@ -0,0 +1,58 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
Quoted 8 lines

arch/mips/mach-octeon/include/mangle-port.h line 7

Quoted 4 lines
arch/mips/mach-octeon/include/mangle-port.h new file +4 -0
+ * for more details.
+ *
+ * Copyright (C) 2003, 2004 Ralf Baechle
+ */

when importing headers from Linux, please remove the license text and just keep copyrights and optionally additonal info text. At the top insert the SPDX identifier, e.g.

Okay. Will change in next version.

Thanks,
Stefan

Quoted 49 lines

/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (C) 2003, 2004 Ralf Baechle
*/

Quoted 43 lines
arch/mips/mach-octeon/include/mangle-port.h new file +43 -0
+#ifndef __ASM_MACH_GENERIC_MANGLE_PORT_H
+#define __ASM_MACH_GENERIC_MANGLE_PORT_H
+
+#include <asm/byteorder.h>
+
+#ifdef __BIG_ENDIAN
+
+static inline bool __should_swizzle_bits(volatile void *a)
+{
+	extern const bool octeon_should_swizzle_table[];
+	u64 did = ((u64)(uintptr_t)a >> 40) & 0xff;
+
+	return octeon_should_swizzle_table[did];
+}
+
+# define __swizzle_addr_b(port)	(port)
+# define __swizzle_addr_w(port)	(port)
+# define __swizzle_addr_l(port)	(port)
+# define __swizzle_addr_q(port)	(port)
+
+#else /* __LITTLE_ENDIAN */
+
+#define __should_swizzle_bits(a)	false
+
+static inline bool __should_swizzle_addr(u64 p)
+{
+	/* boot bus? */
+	return ((p >> 40) & 0xff) == 0;
+}
+
+# define __swizzle_addr_b(port)	\
+	(__should_swizzle_addr(port) ? (port) ^ 7 : (port))
+# define __swizzle_addr_w(port)	\
+	(__should_swizzle_addr(port) ? (port) ^ 6 : (port))
+# define __swizzle_addr_l(port)	\
+	(__should_swizzle_addr(port) ? (port) ^ 4 : (port))
+# define __swizzle_addr_q(port)	(port)
+
+#endif /* __BIG_ENDIAN */
+
+
+# define ioswabb(a, x)		(x)
+# define __mem_ioswabb(a, x)	(x)
Quoted 8 lines

arch/mips/mach-octeon/include/mangle-port.h line 58

Quoted 8 lines
arch/mips/mach-octeon/include/mangle-port.h new file +8 -0
+# define ioswabw(a, x)		(__should_swizzle_bits(a) ? le16_to_cpu(x) : x)
+# define __mem_ioswabw(a, x)	(x)
+# define ioswabl(a, x)		(__should_swizzle_bits(a) ? le32_to_cpu(x) : x)
+# define __mem_ioswabl(a, x)	(x)
+# define ioswabq(a, x)		(__should_swizzle_bits(a) ? le64_to_cpu(x) : x)
+# define __mem_ioswabq(a, x)	(x)
+
+#endif /* __ASM_MACH_GENERIC_MANGLE_PORT_H */

Viele Gr??e,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
#10 lore raw

PATCH 6/8 mips: octeon: cache.c: Flush all pending writes in flush_dcache_range()

In reply to Stefan Roese

As noticed while working on the USB xHCI support, Octeon needs to flush all pending writes so that the values are present in the memory. Add this "syncw" instruction (twice) to flush_dcache_range().

---

 arch/mips/mach-octeon/cache.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
arch/mips/mach-octeon/cache.c +6 -6
index 9a88bb97c7..f293d65dae 100644
@@ -5,14 +5,13 @@
 
 #include <cpu_func.h>
 
-/*
- * The Octeon platform is cache coherent and cache flushes and invalidates
- * are not needed. Define some platform specific empty flush_foo()
- * functions here to overwrite the _weak common function as a no-op.
- * This effectively disables all cache operations.
- */
+/* Octeon memory write barrier */
+#define CVMX_SYNCW	asm volatile ("syncw\nsyncw\n" : : : "memory")
+
 void flush_dcache_range(ulong start_addr, ulong stop)
 {
+	/* Flush all pending writes */
+	CVMX_SYNCW;
 }
 
 void flush_cache(ulong start_addr, ulong size)
@@ -21,4 +20,5 @@ void flush_cache(ulong start_addr, ulong size)
 
 void invalidate_dcache_range(ulong start_addr, ulong stop)
 {
+	/* Don't need to do anything for OCTEON */
 }
Signature · 1 line
2.28.0
#11 lore raw

PATCH 7/8 mips: octeon: Add USB DT nodes

In reply to Stefan Roese

Add the USB device tree nodes to the Octeon dts/dtsi files.

---

 arch/mips/dts/mrvl,cn73xx.dtsi        | 58 +++++++++++++++++++++++++++
 arch/mips/dts/mrvl,octeon-ebb7304.dts | 22 ++++++++++
 2 files changed, 80 insertions(+)
arch/mips/dts/mrvl,cn73xx.dtsi +58 -0
index 44a5a03014..1865849fe8 100644
@@ -143,5 +143,63 @@
 			spi-max-frequency = <25000000>;
 			clocks = <&clk OCTEON_CLK_IO>;
 		};
+
+		/* USB 0 */
+		usb0: uctl at 1180068000000 {
+			compatible = "cavium,octeon-7130-usb-uctl";
+			reg = <0x11800 0x68000000 0x0 0x100>;
+			ranges; /* Direct mapping */
+			#address-cells = <2>;
+			#size-cells = <2>;
+			/* Only 100MHz allowed */
+			refclk-frequency = <100000000>;
+			/* Only "dlmc_ref_clk0" is supported for 73xx */
+			refclk-type-ss = "dlmc_ref_clk0";
+			/* Only "dlmc_ref_clk0" is supported for 73xx */
+			refclk-type-hs = "dlmc_ref_clk0";
+
+			/* Power is specified by three parts:
+			 * 1) GPIO handle (must be &gpio)
+			 * 2) GPIO pin number
+			 * 3) Active high (0) or active low (1)
+			 */
+			xhci at 1680000000000 {
+				compatible = "cavium,octeon-7130-xhci","synopsys,dwc3","snps,dwc3";
+				reg = <0x16800 0x00000000 0x10 0x0>;
+				interrupts = <0x68080 4>; /* UAHC_IMAN, level */
+				maximum-speed = "super-speed";
+				dr_mode = "host";
+				snps,dis_u3_susphy_quirk;
+				snps,dis_u2_susphy_quirk;
+				snps,dis_enblslpm_quirk;
+			};
+		};
+
+		/* USB 1 */
+		usb1: uctl at 1180069000000 {
+			compatible = "cavium,octeon-7130-usb-uctl";
+			reg = <0x11800 0x69000000 0x0 0x100>;
+			ranges; /* Direct mapping */
+			#address-cells = <2>;
+			#size-cells = <2>;
+			/* 50MHz, 100MHz and 125MHz allowed */
+			refclk-frequency = <100000000>;
+			/* Either "dlmc_ref_clk0" or "dlmc_ref_clk0" */
+			refclk-type-ss = "dlmc_ref_clk0";
+			/* Either "dlmc_ref_clk0" "dlmc_ref_clk1" or "pll_ref_clk" */
+			refclk-type-hs = "dlmc_ref_clk0";
+
+			/* Power is specified by three parts:
+			 * 1) GPIO handle (must be &gpio)
+			 * 2) GPIO pin number
+			 * 3) Active high (0) or active low (1)
+			 */
+			xhci at 1690000000000 {
+				compatible = "cavium,octeon-7130-xhci","synopsys,dwc3","snps,dwc3";
+				reg = <0x16900 0x00000000 0x10 0x0>;
+				interrupts = <0x69080 4>; /* UAHC_IMAN, level */
+				dr_mode = "host";
+			};
+		};
 	};
 };
arch/mips/dts/mrvl,octeon-ebb7304.dts +22 -0
index 6b2e5e84bc..cd576db478 100644
@@ -113,3 +113,25 @@
 		reg = <0>;
 	};
 };
+
+/* USB 0 */
+&usb0 {
+	status = "okay";
+	/* Power is specified by three parts:
+	 * 1) GPIO handle (must be &gpio)
+	 * 2) GPIO pin number
+	 * 3) Active high (0) or active low (1)
+	 */
+	power = <&gpio 20 0>;
+};
+
+/* USB 1 */
+&usb1 {
+	status = "okay";
+	/* Power is specified by three parts:
+	 * 1) GPIO handle (must be &gpio)
+	 * 2) GPIO pin number
+	 * 3) Active high (0) or active low (1)
+	 */
+	power = <&gpio 21 0>;
+};
Signature · 1 line
2.28.0
#12 lore raw

PATCH 8/8 mips: octeon: octeon_ebb7304_defconfig: Enable USB support

In reply to Stefan Roese

This patch enables USB support with some helpful commands, like fs support.

---

 configs/octeon_ebb7304_defconfig | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
configs/octeon_ebb7304_defconfig +17 -0
index 105fe5b00a..a98d73a268 100644
@@ -15,12 +15,19 @@ CONFIG_HUSH_PARSER=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MTD=y
+CONFIG_CMD_PART=y
 CONFIG_CMD_PCI=y
+CONFIG_CMD_USB=y
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_TIME=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+# CONFIG_DOS_PARTITION is not set
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_ENV_ADDR=0x1FBFE000
+CONFIG_BLK=y
 CONFIG_CLK=y
 # CONFIG_INPUT is not set
 CONFIG_MTD=y
@@ -48,4 +55,14 @@ CONFIG_SPI=y
 CONFIG_OCTEON_SPI=y
 CONFIG_SYSRESET=y
 CONFIG_SYSRESET_OCTEON=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_HOST_ETHER=y
+CONFIG_USB_ETHER_ASIX=y
+CONFIG_USB_ETHER_ASIX88179=y
+CONFIG_USB_ETHER_MCS7830=y
+CONFIG_USB_ETHER_RTL8152=y
+CONFIG_USB_ETHER_SMSC95XX=y
 CONFIG_HEXDUMP=y
Signature · 1 line
2.28.0
#13 lore raw

PATCH 8/8 mips: octeon: octeon_ebb7304_defconfig: Enable USB support

Am Montag, den 17.08.2020, 15:06 +0200 schrieb Stefan Roese:

Quoted 38 lines

This patch enables USB support with some helpful commands, like fs support.

---

 configs/octeon_ebb7304_defconfig | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
configs/octeon_ebb7304_defconfig +7 -0
index 105fe5b00a..a98d73a268 100644
@@ -15,12 +15,19 @@ CONFIG_HUSH_PARSER=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MTD=y
+CONFIG_CMD_PART=y
 CONFIG_CMD_PCI=y
+CONFIG_CMD_USB=y
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_TIME=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+# CONFIG_DOS_PARTITION is not set
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_ENV_ADDR=0x1FBFE000
+CONFIG_BLK=y
 CONFIG_CLK=y
 # CONFIG_INPUT is not set
 CONFIG_MTD=y
@@ -48,4 +55,14 @@ CONFIG_SPI=y
 CONFIG_OCTEON_SPI=y
 CONFIG_SYSRESET=y
 CONFIG_SYSRESET_OCTEON=y

configs/octeon_ebb7304_defconfig CONFIG_SPI=y · line 67

Quoted 10 lines
configs/octeon_ebb7304_defconfig +10 -0
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_HOST_ETHER=y
+CONFIG_USB_ETHER_ASIX=y
+CONFIG_USB_ETHER_ASIX88179=y
+CONFIG_USB_ETHER_MCS7830=y
+CONFIG_USB_ETHER_RTL8152=y
+CONFIG_USB_ETHER_SMSC95XX=y

is it intentional to enable all USB ethernet drivers?

Quoted 1 line
configs/octeon_ebb7304_defconfig +0 -0
 CONFIG_HEXDUMP=y
Signature · 1 line
- Daniel
#14 lore raw

PATCH 8/8 mips: octeon: octeon_ebb7304_defconfig: Enable USB support

Quoted 43 lines · Daniel Schwierzeck

Am Montag, den 17.08.2020, 15:06 +0200 schrieb Stefan Roese:

Quoted 42 lines

This patch enables USB support with some helpful commands, like fs support.

---

  configs/octeon_ebb7304_defconfig | 17 +++++++++++++++++
  1 file changed, 17 insertions(+)
configs/octeon_ebb7304_defconfig +11 -0
index 105fe5b00a..a98d73a268 100644
@@ -15,12 +15,19 @@ CONFIG_HUSH_PARSER=y
  CONFIG_CMD_GPIO=y
  CONFIG_CMD_I2C=y
  CONFIG_CMD_MTD=y
+CONFIG_CMD_PART=y
  CONFIG_CMD_PCI=y
+CONFIG_CMD_USB=y
  CONFIG_CMD_DHCP=y
  CONFIG_CMD_PING=y
  CONFIG_CMD_TIME=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+# CONFIG_DOS_PARTITION is not set
  CONFIG_ENV_IS_IN_FLASH=y
  CONFIG_ENV_ADDR=0x1FBFE000
+CONFIG_BLK=y
  CONFIG_CLK=y
  # CONFIG_INPUT is not set
  CONFIG_MTD=y
@@ -48,4 +55,14 @@ CONFIG_SPI=y
  CONFIG_OCTEON_SPI=y
  CONFIG_SYSRESET=y
  CONFIG_SYSRESET_OCTEON=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
Quoted 8 lines

configs/octeon_ebb7304_defconfig CONFIG_SPI=y · line 67

Quoted 6 lines
configs/octeon_ebb7304_defconfig +6 -0
+CONFIG_USB_HOST_ETHER=y
+CONFIG_USB_ETHER_ASIX=y
+CONFIG_USB_ETHER_ASIX88179=y
+CONFIG_USB_ETHER_MCS7830=y
+CONFIG_USB_ETHER_RTL8152=y
+CONFIG_USB_ETHER_SMSC95XX=y

is it intentional to enable all USB ethernet drivers?

Yes. As we currently don't have support for the integrated ethernet controller(s), I wanted to give the user as many choices of supported USB ethernet adapters as possible.

Thanks,
Stefan