Skip to contentSkip to conversation

mips/usb: Add Octeon xHCI USB support

PATCH Superseded Stefan Roese 2 participants 13 messages Aug 21, 2020

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 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

Changes in v3:
- Add Reviewed-by tag from Bin
- Minor corrections to the commit text as suggested by Bin
- Minor corrections of the commit text as suggested by Bin
- Minor corrections in comments as suggested by Bin
- Removed empty driver remove() function
- Use macros for clock values instead of numbers
- Add Reviewed-by tag from Bin
- Correct multi-line comment style

Changes in v2:
- Completely remove BUG_ON() for this trans_event.buffer check
- Reword commit text
- Only use SPDX format for license info

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
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              |  60 +++
 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 |  56 +++
 configs/octeon_ebb7304_defconfig            |  17 +
 drivers/usb/host/Kconfig                    |   9 +
 drivers/usb/host/Makefile                   |   1 +
 drivers/usb/host/dwc3-octeon-glue.c         | 393 ++++++++++++++++++++
 drivers/usb/host/xhci-dwc3.c                |   2 +-
 drivers/usb/host/xhci-ring.c                |   2 -
 11 files changed, 586 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 v3 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.

---

Changes in v3:
- Add Reviewed-by tag from Bin

 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 v3 2/8 usb: xhci: xhci_bulk_tx: Don't "BUG" when comparing addresses

In reply to Stefan Roese

Octeon uses mapped addresses for virtual and physical memory. It's not that easy to calculate the resulting addresses here. So let's remove this BUG_ON() completely, as it's not really helpful.

Please also note, that BUG_ON() is not recommended any more in the Linux kernel.

---

Changes in v3:
- Minor corrections to the commit text as suggested by Bin

Changes in v2:
- Completely remove BUG_ON() for this trans_event.buffer check
- Reword commit text

 drivers/usb/host/xhci-ring.c | 2 --
 1 file changed, 2 deletions(-)
drivers/usb/host/xhci-ring.c +0 -2
index 092ed6eaf1..fd15f39906 100644
@@ -726,8 +726,6 @@ 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);
 
 	record_transfer_result(udev, event, length);
 	xhci_acknowledge_event(ctrl);
Signature · 1 line
2.28.0
#3 lore raw

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

Quoted 17 lines · Stefan Roese

Octeon uses mapped addresses for virtual and physical memory. It's not that easy to calculate the resulting addresses here. So let's remove this BUG_ON() completely, as it's not really helpful.

Please also note, that BUG_ON() is not recommended any more in the Linux kernel.

---

Changes in v3:
- Minor corrections to the commit text as suggested by Bin

Quoted 7 lines

Changes in v2:
- Completely remove BUG_ON() for this trans_event.buffer check
- Reword commit text

 drivers/usb/host/xhci-ring.c | 2 --
 1 file changed, 2 deletions(-)
#4 lore raw

PATCH v3 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. It's ported mainly from the Linux code.

---

Changes in v3:
- Minor corrections of the commit text as suggested by Bin
- Minor corrections in comments as suggested by Bin
- Removed empty driver remove() function
- Use macros for clock values instead of numbers

 drivers/usb/host/Kconfig            |   9 +
 drivers/usb/host/Makefile           |   1 +
 drivers/usb/host/dwc3-octeon-glue.c | 393 ++++++++++++++++++++++++++++
 3 files changed, 403 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 +393 -0

393 lines not on this page · raw message

Signature · 1 line
2.28.0
#5 lore raw

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

Quoted 16 lines · Stefan Roese

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

---

Changes in v3:
- Minor corrections of the commit text as suggested by Bin
- Minor corrections in comments as suggested by Bin
- Removed empty driver remove() function
- Use macros for clock values instead of numbers

Quoted 6 lines
 drivers/usb/host/Kconfig            |   9 +
 drivers/usb/host/Makefile           |   1 +
 drivers/usb/host/dwc3-octeon-glue.c | 393 ++++++++++++++++++++++++++++
 3 files changed, 403 insertions(+)
 create mode 100644 drivers/usb/host/dwc3-octeon-glue.c
#6 lore raw

PATCH v3 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.

---

(no changes since v1)

 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 v3 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.

---

(no changes since v2)

Changes in v2:
- Only use SPDX format for license info

 arch/mips/mach-octeon/include/mangle-port.h | 56 +++++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 arch/mips/mach-octeon/include/mangle-port.h
arch/mips/mach-octeon/include/mangle-port.h new file +56 -0
new file mode 100644
index 0000000000..7e95dcef5a
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * 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 v3 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().

---

(no changes since v1)

 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
#9 lore raw

PATCH v3 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.

---

Changes in v3:
- Add Reviewed-by tag from Bin
- Correct multi-line comment style

 arch/mips/dts/mrvl,cn73xx.dtsi        | 60 +++++++++++++++++++++++++++
 arch/mips/dts/mrvl,octeon-ebb7304.dts | 22 ++++++++++
 2 files changed, 82 insertions(+)
arch/mips/dts/mrvl,cn73xx.dtsi +60 -0
index 44a5a03014..40eb85ee0c 100644
@@ -143,5 +143,65 @@
 			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
#10 lore raw

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

Hi Stefan,

Quoted 91 lines · Stefan Roese

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

---

Changes in v3:
- Add Reviewed-by tag from Bin
- Correct multi-line comment style

 arch/mips/dts/mrvl,cn73xx.dtsi        | 60 +++++++++++++++++++++++++++
 arch/mips/dts/mrvl,octeon-ebb7304.dts | 22 ++++++++++
 2 files changed, 82 insertions(+)
arch/mips/dts/mrvl,cn73xx.dtsi +60 -0
index 44a5a03014..40eb85ee0c 100644
@@ -143,5 +143,65 @@
                        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 +0 -0
index 6b2e5e84bc..cd576db478 100644

arch/mips/dts/mrvl,octeon-ebb7304.dts line 120

Quoted 8 lines
arch/mips/dts/mrvl,octeon-ebb7304.dts +5 -0
@@ -113,3 +113,25 @@
                reg = <0>;
        };
 };
+
+/* USB 0 */
+&usb0 {
+       status = "okay";
+       /* Power is specified by three parts:

Looks this was missed

arch/mips/dts/mrvl,octeon-ebb7304.dts line 131

Quoted 11 lines
arch/mips/dts/mrvl,octeon-ebb7304.dts +11 -0
+        * 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:

ditto

arch/mips/dts/mrvl,octeon-ebb7304.dts

Quoted 7 lines
arch/mips/dts/mrvl,octeon-ebb7304.dts +6 -1
+        * 1) GPIO handle (must be &gpio)
+        * 2) GPIO pin number
+        * 3) Active high (0) or active low (1)
+        */
+       power = <&gpio 21 0>;
+};
--

Regards,
Bin

#11 lore raw

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

Hi Bin,

Quoted 96 lines · Bin Meng

Hi Stefan,

Quoted 93 lines · Stefan Roese

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

---

Changes in v3:
- Add Reviewed-by tag from Bin
- Correct multi-line comment style

  arch/mips/dts/mrvl,cn73xx.dtsi        | 60 +++++++++++++++++++++++++++
  arch/mips/dts/mrvl,octeon-ebb7304.dts | 22 ++++++++++
  2 files changed, 82 insertions(+)
arch/mips/dts/mrvl,cn73xx.dtsi +60 -0
index 44a5a03014..40eb85ee0c 100644
@@ -143,5 +143,65 @@
                         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 +0 -0
index 6b2e5e84bc..cd576db478 100644
@@ -113,3 +113,25 @@
                 reg = <0>;
         };
Quoted 8 lines

arch/mips/dts/mrvl,octeon-ebb7304.dts line 120

Quoted 6 lines
arch/mips/dts/mrvl,octeon-ebb7304.dts +5 -0
  };
+
+/* USB 0 */
+&usb0 {
+       status = "okay";
+       /* Power is specified by three parts:

Looks this was missed

Ups, too bad. Next version will be final (I hope). ;)

Thanks,
Stefan

Quoted 22 lines

arch/mips/dts/mrvl,octeon-ebb7304.dts line 131

Quoted 11 lines
arch/mips/dts/mrvl,octeon-ebb7304.dts +11 -0
+        * 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:

ditto

arch/mips/dts/mrvl,octeon-ebb7304.dts

Quoted 7 lines
arch/mips/dts/mrvl,octeon-ebb7304.dts +6 -1
+        * 1) GPIO handle (must be &gpio)
+        * 2) GPIO pin number
+        * 3) Active high (0) or active low (1)
+        */
+       power = <&gpio 21 0>;
+};
--
Quoted 3 lines

Regards,
Bin

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
#12 lore raw

PATCH v3 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.

---

(no changes since v1)

 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