* [PATCH v2 0/9] Restore USB and add UMS support for STiH407-B2260
@ 2025-01-16 8:17 Patrice Chotard
2025-01-16 8:17 ` [PATCH v2 1/9] ARM: dts: sti: Add fixed clock for ehci and ohci nodes in stih410-b2260.dtsi Patrice Chotard
` (8 more replies)
0 siblings, 9 replies; 16+ messages in thread
From: Patrice Chotard @ 2025-01-16 8:17 UTC (permalink / raw)
To: u-boot
Cc: Patrice CHOTARD, Patrick DELAUNAY, U-Boot STM32, Caleb Connolly,
Fabio Estevam, Jan Kiszka, Jonas Karlman, Kever Yang, Marek Vasut,
Marek Vasut, Mathieu Othacehe, Mattijs Korpershoek,
Nathan Barrett-Morrison, Neil Armstrong, Oliver Gaskell,
Patrick Rudolph, Paul Barker, Robert Marko, Sam Protsenko,
Simon Glass, Sjoerd Simons, Sumit Garg, Tom Rini
This series is :
_ restoring USB on STiH410-B2260 which hasn't been
tested since a while.
_ migrating STi DWC3 glue from proprietary driver to
dwc3-generic driver.
_ adding UMS support for STiH410-B2260.
Changes in v2:
- remove useless include files
- add dwc3-sti.c DWC3 wrapper as done for dwc3-am62.c
- enable new flag USB_DWC3_STI
Patrice Chotard (9):
ARM: dts: sti: Add fixed clock for ehci and ohci nodes in
stih410-b2260.dtsi
configs: stih410-b2260: Enable DM_REGULATOR flag
usb: dwc3-generic: Reorder include
usb: dwc3-generic: Add STih407 support
configs: stih410-b2260: Enable USB_DWC3_GENERIC and USB_DWC3_STI flags
usb: dwc3: Remove dwc3 glue driver support for STi
configs: stih410-b2260: Enable DM_USB_GADGET flag
board: stih410-b2260: Remove board_usb_init/cleanup()
configs: stih410-b2260: Enable CMD_USB_MASS_STORAGE flag
MAINTAINERS | 3 +-
arch/arm/dts/stih410-b2260-u-boot.dtsi | 10 +
board/st/stih410-b2260/board.c | 30 ---
configs/stih410-b2260_defconfig | 5 +
drivers/usb/dwc3/Kconfig | 6 +
drivers/usb/dwc3/Makefile | 1 +
drivers/usb/dwc3/dwc3-generic-sti.c | 127 +++++++++++++
drivers/usb/dwc3/dwc3-generic.c | 20 +-
drivers/usb/host/Kconfig | 9 -
drivers/usb/host/Makefile | 1 -
drivers/usb/host/dwc3-sti-glue.c | 253 -------------------------
include/dwc3-sti-glue.h | 41 ----
12 files changed, 154 insertions(+), 352 deletions(-)
create mode 100644 drivers/usb/dwc3/dwc3-generic-sti.c
delete mode 100644 drivers/usb/host/dwc3-sti-glue.c
delete mode 100644 include/dwc3-sti-glue.h
--
2.25.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 1/9] ARM: dts: sti: Add fixed clock for ehci and ohci nodes in stih410-b2260.dtsi
2025-01-16 8:17 [PATCH v2 0/9] Restore USB and add UMS support for STiH407-B2260 Patrice Chotard
@ 2025-01-16 8:17 ` Patrice Chotard
2025-01-16 8:17 ` [PATCH v2 2/9] configs: stih410-b2260: Enable DM_REGULATOR flag Patrice Chotard
` (7 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Patrice Chotard @ 2025-01-16 8:17 UTC (permalink / raw)
To: u-boot
Cc: Patrice CHOTARD, Patrick DELAUNAY, U-Boot STM32, Marek Vasut,
Tom Rini
On STi platforms, all clocks are enabled by BOOTROM, so CONFIG_CLK is
not set as no clock driver for STI exists.
As ehci-generic and ohci-generic drivers are used on platforms where
CONFIG_CLK is set, clk_get_bulk() returns-ENOSYS in case of
stih410-b2260.
To avoid this error, add fixed clocks for ehci and ohci nodes for
stih410-b2260 to fix the following errors:
Bus usb@9a03c00: ohci_generic usb@9a03c00: Failed to get clocks (ret=-19)
Port not available.
Bus usb@9a03e00: ehci_generic usb@9a03e00: Failed to get clocks (ret=-19)
Port not available.
Bus usb@9a83c00: ohci_generic usb@9a83c00: Failed to get clocks (ret=-19)
Port not available.
Bus usb@9a83e00: ehci_generic usb@9a83e00: Failed to get clocks (ret=-19)
Port not available.
scanning bus dwc3@9900000 for devices... 1 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Marek Vasut <marex@denx.de>
---
(no changes since v1)
arch/arm/dts/stih410-b2260-u-boot.dtsi | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm/dts/stih410-b2260-u-boot.dtsi b/arch/arm/dts/stih410-b2260-u-boot.dtsi
index 3b080ac7a1b..e9d7ec92281 100644
--- a/arch/arm/dts/stih410-b2260-u-boot.dtsi
+++ b/arch/arm/dts/stih410-b2260-u-boot.dtsi
@@ -14,20 +14,30 @@
};
};
+ clk_usb: clk-usb {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <100000000>;
+ };
+
ohci0: usb@9a03c00 {
compatible = "generic-ohci";
+ clocks = <&clk_usb>;
};
ehci0: usb@9a03e00 {
compatible = "generic-ehci";
+ clocks = <&clk_usb>;
};
ohci1: usb@9a83c00 {
compatible = "generic-ohci";
+ clocks = <&clk_usb>;
};
ehci1: usb@9a83e00 {
compatible = "generic-ehci";
+ clocks = <&clk_usb>;
};
};
};
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 2/9] configs: stih410-b2260: Enable DM_REGULATOR flag
2025-01-16 8:17 [PATCH v2 0/9] Restore USB and add UMS support for STiH407-B2260 Patrice Chotard
2025-01-16 8:17 ` [PATCH v2 1/9] ARM: dts: sti: Add fixed clock for ehci and ohci nodes in stih410-b2260.dtsi Patrice Chotard
@ 2025-01-16 8:17 ` Patrice Chotard
2025-01-16 8:17 ` [PATCH v2 3/9] usb: dwc3-generic: Reorder include Patrice Chotard
` (6 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Patrice Chotard @ 2025-01-16 8:17 UTC (permalink / raw)
To: u-boot
Cc: Patrice CHOTARD, Patrick DELAUNAY, U-Boot STM32, Marek Vasut,
Tom Rini
Since commit 6aa8bde8786d ("usb: host: ehci-generic: Remove DM_REGULATOR
flag") device_get_supply_regulator() returns -ENOSYS which is not handle
by ehci_enable_vbus_supply() and thus, ehci_usb_probe() return an error.
By enabling DM_REGULATOR flag, device_get_supply_regulator() return -ENOENT
which is handle and ehci_usb_probe() return 0.
This fixed the following issue:
stih410-b2260 =>usb start
starting USB...
Bus dwc3@9900000: Register 2000240 NbrPorts 2
Starting the controller
USB XHCI 1.00
Bus usb@9a03c00: USB OHCI 1.0
Bus usb@9a03e00: probe failed, error -38
Bus usb@9a83c00: USB OHCI 1.0
Bus usb@9a83e00: probe failed, error -38
scanning bus dwc3@9900000 for devices... 1 USB Device(s) found
scanning bus usb@9a03c00 for devices... data abort
pc : [<7df929b4>] lr : [<7df92918>]
reloc pc : [<7d6409b4>] lr : [<7d640918>]
sp : 7c73b848 ip : 9cf13c5c fp : 7c879d08
r10: 7c85d040 r9 : 7c74ded0 r8 : 09a03c00
r7 : 00000002 r6 : 7c85d080 r5 : 7c86a040 r4 : 00000000
r3 : 00000000 r2 : 00000000 r1 : 7c85d080 r0 : 7c85d040
Flags: nzCv IRQs off FIQs off Mode SVC_32
Code: 05853ae4 0affffe2 e59a2010 e59a300c (e5832010)
Resetting CPU ...
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Marek Vasut <marex@denx.de>
---
(no changes since v1)
configs/stih410-b2260_defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/configs/stih410-b2260_defconfig b/configs/stih410-b2260_defconfig
index 815f7557d69..e312ca492d2 100644
--- a/configs/stih410-b2260_defconfig
+++ b/configs/stih410-b2260_defconfig
@@ -48,6 +48,7 @@ CONFIG_MMC_SDHCI_STI=y
CONFIG_PHY=y
CONFIG_STI_USB_PHY=y
CONFIG_PINCTRL=y
+CONFIG_DM_REGULATOR=y
CONFIG_STI_RESET=y
CONFIG_STI_ASC_SERIAL=y
CONFIG_SYSRESET=y
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 3/9] usb: dwc3-generic: Reorder include
2025-01-16 8:17 [PATCH v2 0/9] Restore USB and add UMS support for STiH407-B2260 Patrice Chotard
2025-01-16 8:17 ` [PATCH v2 1/9] ARM: dts: sti: Add fixed clock for ehci and ohci nodes in stih410-b2260.dtsi Patrice Chotard
2025-01-16 8:17 ` [PATCH v2 2/9] configs: stih410-b2260: Enable DM_REGULATOR flag Patrice Chotard
@ 2025-01-16 8:17 ` Patrice Chotard
2025-01-16 10:12 ` Mattijs Korpershoek
2025-01-16 8:17 ` [PATCH v2 4/9] usb: dwc3-generic: Add STih407 support Patrice Chotard
` (5 subsequent siblings)
8 siblings, 1 reply; 16+ messages in thread
From: Patrice Chotard @ 2025-01-16 8:17 UTC (permalink / raw)
To: u-boot
Cc: Patrice CHOTARD, Patrick DELAUNAY, U-Boot STM32, Marek Vasut,
Caleb Connolly, Jan Kiszka, Mattijs Korpershoek, Neil Armstrong,
Tom Rini
Reorder include following rules available here :
https://docs.u-boot.org/en/latest/develop/codingstyle.html#include-files
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Marek Vasut <marex@denx.de>
---
Changes in v2:
- remove useless include files
drivers/usb/dwc3/dwc3-generic.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
index 2ab41cbae45..bc7d2d4234b 100644
--- a/drivers/usb/dwc3/dwc3-generic.c
+++ b/drivers/usb/dwc3/dwc3-generic.c
@@ -7,29 +7,17 @@
* Based on dwc3-omap.c.
*/
-#include <cpu_func.h>
-#include <log.h>
#include <dm.h>
-#include <dm/device-internal.h>
+#include <reset.h>
+#include <asm/gpio.h>
#include <dm/lists.h>
-#include <dwc3-uboot.h>
-#include <generic-phy.h>
-#include <linux/bitops.h>
#include <linux/delay.h>
-#include <linux/printk.h>
-#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
-#include <malloc.h>
#include <power/regulator.h>
-#include <usb.h>
-#include "core.h"
-#include "gadget.h"
-#include <reset.h>
-#include <clk.h>
#include <usb/xhci.h>
-#include <asm/gpio.h>
-
+#include "core.h"
#include "dwc3-generic.h"
+#include "gadget.h"
struct dwc3_generic_plat {
fdt_addr_t base;
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 4/9] usb: dwc3-generic: Add STih407 support
2025-01-16 8:17 [PATCH v2 0/9] Restore USB and add UMS support for STiH407-B2260 Patrice Chotard
` (2 preceding siblings ...)
2025-01-16 8:17 ` [PATCH v2 3/9] usb: dwc3-generic: Reorder include Patrice Chotard
@ 2025-01-16 8:17 ` Patrice Chotard
2025-01-16 10:24 ` Mattijs Korpershoek
2025-01-16 8:17 ` [PATCH v2 5/9] configs: stih410-b2260: Enable USB_DWC3_GENERIC and USB_DWC3_STI flags Patrice Chotard
` (4 subsequent siblings)
8 siblings, 1 reply; 16+ messages in thread
From: Patrice Chotard @ 2025-01-16 8:17 UTC (permalink / raw)
To: u-boot
Cc: Patrice CHOTARD, Patrick DELAUNAY, U-Boot STM32, Marek Vasut,
Caleb Connolly, Mattijs Korpershoek, Nathan Barrett-Morrison,
Oliver Gaskell, Robert Marko, Sam Protsenko, Simon Glass,
Sjoerd Simons, Sumit Garg, Tom Rini
Add STi glue logic to manage the DWC3 HC on STiH407
SoC family. It configures the internal glue logic and
syscfg registers.
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Marek Vasut <marex@denx.de>
---
Changes in v2:
- add dwc3-sti.c DWC3 wrapper as done for dwc3-am62.c
MAINTAINERS | 1 +
drivers/usb/dwc3/Kconfig | 6 ++
drivers/usb/dwc3/Makefile | 1 +
drivers/usb/dwc3/dwc3-generic-sti.c | 127 ++++++++++++++++++++++++++++
4 files changed, 135 insertions(+)
create mode 100644 drivers/usb/dwc3/dwc3-generic-sti.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 8c6c0c2a4bc..5d7e251e601 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -656,6 +656,7 @@ F: drivers/mmc/sti_sdhci.c
F: drivers/reset/sti-reset.c
F: drivers/serial/serial_sti_asc.c
F: drivers/sysreset/sysreset_sti.c
+F: drivers/usb/host/dwc3-sti.c
F: drivers/timer/arm_global_timer.c
F: drivers/usb/host/dwc3-sti-glue.c
F: include/dwc3-sti-glue.h
diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index 0100723a68b..7d58ae65fb6 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -87,6 +87,12 @@ config USB_DWC3_LAYERSCAPE
Host and Peripheral operation modes are supported. OTG is not
supported.
+config USB_DWC3_STI
+ bool "STi USB wrapper"
+ depends on DM_USB && USB_DWC3_GENERIC && SYSCON
+ help
+ Select this for STi Platforms.
+
menu "PHY Subsystem"
config USB_DWC3_PHY_OMAP
diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile
index a085c9d4628..985206eafe4 100644
--- a/drivers/usb/dwc3/Makefile
+++ b/drivers/usb/dwc3/Makefile
@@ -15,3 +15,4 @@ obj-$(CONFIG_USB_DWC3_UNIPHIER) += dwc3-uniphier.o
obj-$(CONFIG_USB_DWC3_LAYERSCAPE) += dwc3-layerscape.o
obj-$(CONFIG_USB_DWC3_PHY_OMAP) += ti_usb_phy.o
obj-$(CONFIG_USB_DWC3_PHY_SAMSUNG) += samsung_usb_phy.o
+obj-$(CONFIG_USB_DWC3_STI) += dwc3-generic-sti.o
diff --git a/drivers/usb/dwc3/dwc3-generic-sti.c b/drivers/usb/dwc3/dwc3-generic-sti.c
new file mode 100644
index 00000000000..e316e88d2f8
--- /dev/null
+++ b/drivers/usb/dwc3/dwc3-generic-sti.c
@@ -0,0 +1,127 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause
+/*
+ * STi specific glue layer for DWC3
+ *
+ * Copyright (C) 2025, STMicroelectronics - All Rights Reserved
+ */
+
+#include <reset.h>
+#include <regmap.h>
+#include <syscon.h>
+#include <asm/io.h>
+#include <dm/device.h>
+#include <dm/read.h>
+#include <linux/usb/otg.h>
+#include "dwc3-generic.h"
+
+/* glue registers */
+#define CLKRST_CTRL 0x00
+#define AUX_CLK_EN BIT(0)
+#define SW_PIPEW_RESET_N BIT(4)
+#define EXT_CFG_RESET_N BIT(8)
+
+#define XHCI_REVISION BIT(12)
+
+#define USB2_VBUS_MNGMNT_SEL1 0x2C
+#define USB2_VBUS_UTMIOTG 0x1
+
+#define SEL_OVERRIDE_VBUSVALID(n) ((n) << 0)
+#define SEL_OVERRIDE_POWERPRESENT(n) ((n) << 4)
+#define SEL_OVERRIDE_BVALID(n) ((n) << 8)
+
+/* Static DRD configuration */
+#define USB3_CONTROL_MASK 0xf77
+
+#define USB3_DEVICE_NOT_HOST BIT(0)
+#define USB3_FORCE_VBUSVALID BIT(1)
+#define USB3_DELAY_VBUSVALID BIT(2)
+#define USB3_SEL_FORCE_OPMODE BIT(4)
+#define USB3_FORCE_OPMODE(n) ((n) << 5)
+#define USB3_SEL_FORCE_DPPULLDOWN2 BIT(8)
+#define USB3_FORCE_DPPULLDOWN2 BIT(9)
+#define USB3_SEL_FORCE_DMPULLDOWN2 BIT(10)
+#define USB3_FORCE_DMPULLDOWN2 BIT(11)
+
+static void dwc3_stih407_glue_configure(struct udevice *dev, int index,
+ enum usb_dr_mode mode)
+{
+ struct dwc3_glue_data *glue = dev_get_plat(dev);
+ struct regmap *regmap;
+ ulong syscfg_base;
+ ulong syscfg_offset;
+ ulong glue_base;
+ int ret;
+
+ /* deassert both powerdown and softreset */
+ ret = reset_deassert_bulk(&glue->resets);
+ if (ret) {
+ debug("reset_deassert_bulk error: %d\n", ret);
+ return;
+ }
+
+ regmap = syscon_regmap_lookup_by_phandle(dev, "st,syscfg");
+
+ syscfg_base = regmap->ranges[0].start;
+ glue_base = dev_read_addr_index(dev, 0);
+ syscfg_offset = dev_read_addr_index(dev, 1);
+
+ clrbits_le32(syscfg_base + syscfg_offset, USB3_CONTROL_MASK);
+
+ /* glue drd init */
+ switch (mode) {
+ case USB_DR_MODE_PERIPHERAL:
+ clrbits_le32(syscfg_base + syscfg_offset,
+ USB3_DELAY_VBUSVALID | USB3_SEL_FORCE_OPMODE |
+ USB3_FORCE_OPMODE(0x3) | USB3_SEL_FORCE_DPPULLDOWN2 |
+ USB3_FORCE_DPPULLDOWN2 | USB3_SEL_FORCE_DMPULLDOWN2 |
+ USB3_FORCE_DMPULLDOWN2);
+
+ setbits_le32(syscfg_base + syscfg_offset,
+ USB3_DEVICE_NOT_HOST | USB3_FORCE_VBUSVALID);
+ break;
+
+ case USB_DR_MODE_HOST:
+ clrbits_le32(syscfg_base + syscfg_offset,
+ USB3_DEVICE_NOT_HOST | USB3_FORCE_VBUSVALID |
+ USB3_SEL_FORCE_OPMODE | USB3_FORCE_OPMODE(0x3) |
+ USB3_SEL_FORCE_DPPULLDOWN2 | USB3_FORCE_DPPULLDOWN2 |
+ USB3_SEL_FORCE_DMPULLDOWN2 | USB3_FORCE_DMPULLDOWN2);
+
+ setbits_le32(syscfg_base + syscfg_offset, USB3_DELAY_VBUSVALID);
+ break;
+
+ default:
+ debug("Unsupported mode of operation %d\n", mode);
+ return;
+ }
+
+ /* glue init */
+ setbits_le32(glue_base + CLKRST_CTRL, AUX_CLK_EN | EXT_CFG_RESET_N | XHCI_REVISION);
+ clrbits_le32(glue_base + CLKRST_CTRL, SW_PIPEW_RESET_N);
+
+ /* configure mux for vbus, powerpresent and bvalid signals */
+ setbits_le32(glue_base + USB2_VBUS_MNGMNT_SEL1,
+ SEL_OVERRIDE_VBUSVALID(USB2_VBUS_UTMIOTG) |
+ SEL_OVERRIDE_POWERPRESENT(USB2_VBUS_UTMIOTG) |
+ SEL_OVERRIDE_BVALID(USB2_VBUS_UTMIOTG));
+ setbits_le32(glue_base + CLKRST_CTRL, SW_PIPEW_RESET_N);
+};
+
+struct dwc3_glue_ops stih407_ops = {
+ .glue_configure = dwc3_stih407_glue_configure,
+};
+
+static const struct udevice_id dwc3_sti_match[] = {
+ { .compatible = "st,stih407-dwc3", .data = (ulong)&stih407_ops},
+ { /* sentinel */ }
+};
+
+U_BOOT_DRIVER(dwc3_sti_wrapper) = {
+ .name = "dwc3-sti",
+ .id = UCLASS_SIMPLE_BUS,
+ .of_match = dwc3_sti_match,
+ .bind = dwc3_glue_bind,
+ .probe = dwc3_glue_probe,
+ .remove = dwc3_glue_remove,
+ .plat_auto = sizeof(struct dwc3_glue_data),
+};
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 5/9] configs: stih410-b2260: Enable USB_DWC3_GENERIC and USB_DWC3_STI flags
2025-01-16 8:17 [PATCH v2 0/9] Restore USB and add UMS support for STiH407-B2260 Patrice Chotard
` (3 preceding siblings ...)
2025-01-16 8:17 ` [PATCH v2 4/9] usb: dwc3-generic: Add STih407 support Patrice Chotard
@ 2025-01-16 8:17 ` Patrice Chotard
2025-01-16 8:17 ` [PATCH v2 6/9] usb: dwc3: Remove dwc3 glue driver support for STi Patrice Chotard
` (3 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Patrice Chotard @ 2025-01-16 8:17 UTC (permalink / raw)
To: u-boot
Cc: Patrice CHOTARD, Patrick DELAUNAY, U-Boot STM32, Marek Vasut,
Tom Rini
Enable USB_DWC3_GENERIC and USB_DWC3_STI flags.
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Marek Vasut <marex@denx.de>
---
Changes in v2:
- enable new flag USB_DWC3_STI
configs/stih410-b2260_defconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/configs/stih410-b2260_defconfig b/configs/stih410-b2260_defconfig
index e312ca492d2..4fcbf75548b 100644
--- a/configs/stih410-b2260_defconfig
+++ b/configs/stih410-b2260_defconfig
@@ -61,6 +61,8 @@ CONFIG_USB_EHCI_GENERIC=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_GENERIC=y
CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_GENERIC=y
+CONFIG_USB_DWC3_STI=y
CONFIG_USB_HOST_ETHER=y
CONFIG_USB_ETHER_ASIX=y
CONFIG_USB_ETHER_MCS7830=y
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 6/9] usb: dwc3: Remove dwc3 glue driver support for STi
2025-01-16 8:17 [PATCH v2 0/9] Restore USB and add UMS support for STiH407-B2260 Patrice Chotard
` (4 preceding siblings ...)
2025-01-16 8:17 ` [PATCH v2 5/9] configs: stih410-b2260: Enable USB_DWC3_GENERIC and USB_DWC3_STI flags Patrice Chotard
@ 2025-01-16 8:17 ` Patrice Chotard
2025-01-16 10:25 ` Mattijs Korpershoek
2025-01-16 8:17 ` [PATCH v2 7/9] configs: stih410-b2260: Enable DM_USB_GADGET flag Patrice Chotard
` (2 subsequent siblings)
8 siblings, 1 reply; 16+ messages in thread
From: Patrice Chotard @ 2025-01-16 8:17 UTC (permalink / raw)
To: u-boot
Cc: Patrice CHOTARD, Patrick DELAUNAY, U-Boot STM32, Marek Vasut,
Caleb Connolly, Fabio Estevam, Jonas Karlman, Kever Yang,
Mathieu Othacehe, Mattijs Korpershoek, Nathan Barrett-Morrison,
Neil Armstrong, Oliver Gaskell, Patrick Rudolph, Paul Barker,
Robert Marko, Sam Protsenko, Simon Glass, Sumit Garg, Tom Rini
STi is now using the dwc3-generic driver, dwc3-sti-glue driver
can be removed.
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Marek Vasut <marex@denx.de>
---
(no changes since v1)
MAINTAINERS | 2 -
board/st/stih410-b2260/board.c | 1 -
drivers/usb/host/Kconfig | 9 --
drivers/usb/host/Makefile | 1 -
drivers/usb/host/dwc3-sti-glue.c | 253 -------------------------------
include/dwc3-sti-glue.h | 41 -----
6 files changed, 307 deletions(-)
delete mode 100644 drivers/usb/host/dwc3-sti-glue.c
delete mode 100644 include/dwc3-sti-glue.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 5d7e251e601..0982dfa3fe0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -658,8 +658,6 @@ F: drivers/serial/serial_sti_asc.c
F: drivers/sysreset/sysreset_sti.c
F: drivers/usb/host/dwc3-sti.c
F: drivers/timer/arm_global_timer.c
-F: drivers/usb/host/dwc3-sti-glue.c
-F: include/dwc3-sti-glue.h
F: include/dt-bindings/clock/stih407-clks.h
F: include/dt-bindings/clock/stih410-clks.h
F: include/dt-bindings/reset/stih407-resets.h
diff --git a/board/st/stih410-b2260/board.c b/board/st/stih410-b2260/board.c
index a912712c9dd..3a495eb5089 100644
--- a/board/st/stih410-b2260/board.c
+++ b/board/st/stih410-b2260/board.c
@@ -9,7 +9,6 @@
#include <asm/cache.h>
#include <asm/global_data.h>
#include <linux/usb/otg.h>
-#include <dwc3-sti-glue.h>
#include <dwc3-uboot.h>
#include <usb.h>
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 24786a2bc91..cd1c03f10d7 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -110,15 +110,6 @@ config USB_XHCI_RCAR
Choose this option to add support for USB 3.0 driver on Renesas
R-Car Gen3 SoCs.
-config USB_XHCI_STI
- bool "Support for STMicroelectronics STiH407 family on-chip xHCI USB controller"
- depends on ARCH_STI
- default y
- help
- Enables support for the on-chip xHCI controller on STMicroelectronics
- STiH407 family SoCs. This is a driver for the dwc3 to provide the glue logic
- to configure the controller.
-
config USB_XHCI_DRA7XX_INDEX
int "DRA7XX xHCI USB index"
range 0 1
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 301bb9fdee1..902d68d0378 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -54,7 +54,6 @@ obj-$(CONFIG_USB_XHCI_GENERIC) += xhci-generic.o
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
diff --git a/drivers/usb/host/dwc3-sti-glue.c b/drivers/usb/host/dwc3-sti-glue.c
deleted file mode 100644
index 3e6834e38e3..00000000000
--- a/drivers/usb/host/dwc3-sti-glue.c
+++ /dev/null
@@ -1,253 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * STiH407 family DWC3 specific Glue layer
- *
- * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
- * Author(s): Patrice Chotard, <patrice.chotard@foss.st.com> for STMicroelectronics.
- */
-
-#include <log.h>
-#include <asm/global_data.h>
-#include <asm/io.h>
-#include <dm.h>
-#include <errno.h>
-#include <dm/lists.h>
-#include <regmap.h>
-#include <reset-uclass.h>
-#include <syscon.h>
-#include <usb.h>
-#include <linux/printk.h>
-
-#include <linux/usb/dwc3.h>
-#include <linux/usb/otg.h>
-#include <dwc3-sti-glue.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/*
- * struct sti_dwc3_glue_plat - dwc3 STi glue driver private structure
- * @syscfg_base: addr for the glue syscfg
- * @glue_base: addr for the glue registers
- * @syscfg_offset: usb syscfg control offset
- * @powerdown_ctl: rest controller for powerdown signal
- * @softreset_ctl: reset controller for softreset signal
- * @mode: drd static host/device config
- */
-struct sti_dwc3_glue_plat {
- phys_addr_t syscfg_base;
- phys_addr_t glue_base;
- phys_addr_t syscfg_offset;
- struct reset_ctl powerdown_ctl;
- struct reset_ctl softreset_ctl;
- enum usb_dr_mode mode;
-};
-
-static int sti_dwc3_glue_drd_init(struct sti_dwc3_glue_plat *plat)
-{
- unsigned long val;
-
- val = readl(plat->syscfg_base + plat->syscfg_offset);
-
- val &= USB3_CONTROL_MASK;
-
- switch (plat->mode) {
- case USB_DR_MODE_PERIPHERAL:
- val &= ~(USB3_DELAY_VBUSVALID
- | USB3_SEL_FORCE_OPMODE | USB3_FORCE_OPMODE(0x3)
- | USB3_SEL_FORCE_DPPULLDOWN2 | USB3_FORCE_DPPULLDOWN2
- | USB3_SEL_FORCE_DMPULLDOWN2 | USB3_FORCE_DMPULLDOWN2);
-
- val |= USB3_DEVICE_NOT_HOST | USB3_FORCE_VBUSVALID;
- break;
-
- case USB_DR_MODE_HOST:
- val &= ~(USB3_DEVICE_NOT_HOST | USB3_FORCE_VBUSVALID
- | USB3_SEL_FORCE_OPMODE | USB3_FORCE_OPMODE(0x3)
- | USB3_SEL_FORCE_DPPULLDOWN2 | USB3_FORCE_DPPULLDOWN2
- | USB3_SEL_FORCE_DMPULLDOWN2 | USB3_FORCE_DMPULLDOWN2);
-
- val |= USB3_DELAY_VBUSVALID;
- break;
-
- default:
- pr_err("Unsupported mode of operation %d\n", plat->mode);
- return -EINVAL;
- }
- writel(val, plat->syscfg_base + plat->syscfg_offset);
-
- return 0;
-}
-
-static void sti_dwc3_glue_init(struct sti_dwc3_glue_plat *plat)
-{
- unsigned long reg;
-
- reg = readl(plat->glue_base + CLKRST_CTRL);
-
- reg |= AUX_CLK_EN | EXT_CFG_RESET_N | XHCI_REVISION;
- reg &= ~SW_PIPEW_RESET_N;
-
- writel(reg, plat->glue_base + CLKRST_CTRL);
-
- /* configure mux for vbus, powerpresent and bvalid signals */
- reg = readl(plat->glue_base + USB2_VBUS_MNGMNT_SEL1);
-
- reg |= SEL_OVERRIDE_VBUSVALID(USB2_VBUS_UTMIOTG) |
- SEL_OVERRIDE_POWERPRESENT(USB2_VBUS_UTMIOTG) |
- SEL_OVERRIDE_BVALID(USB2_VBUS_UTMIOTG);
-
- writel(reg, plat->glue_base + USB2_VBUS_MNGMNT_SEL1);
-
- setbits_le32(plat->glue_base + CLKRST_CTRL, SW_PIPEW_RESET_N);
-}
-
-static int sti_dwc3_glue_of_to_plat(struct udevice *dev)
-{
- struct sti_dwc3_glue_plat *plat = dev_get_plat(dev);
- struct udevice *syscon;
- struct regmap *regmap;
- int ret;
- u32 reg[4];
-
- ret = ofnode_read_u32_array(dev_ofnode(dev), "reg", reg,
- ARRAY_SIZE(reg));
- if (ret) {
- pr_err("unable to find st,stih407-dwc3 reg property(%d)\n", ret);
- return ret;
- }
-
- plat->glue_base = reg[0];
- plat->syscfg_offset = reg[2];
-
- /* get corresponding syscon phandle */
- ret = uclass_get_device_by_phandle(UCLASS_SYSCON, dev, "st,syscfg",
- &syscon);
- if (ret) {
- pr_err("unable to find syscon device (%d)\n", ret);
- return ret;
- }
-
- /* get syscfg-reg base address */
- regmap = syscon_get_regmap(syscon);
- if (!regmap) {
- pr_err("unable to find regmap\n");
- return -ENODEV;
- }
- plat->syscfg_base = regmap->ranges[0].start;
-
- /* get powerdown reset */
- ret = reset_get_by_name(dev, "powerdown", &plat->powerdown_ctl);
- if (ret) {
- pr_err("can't get powerdown reset for %s (%d)", dev->name, ret);
- return ret;
- }
-
- /* get softreset reset */
- ret = reset_get_by_name(dev, "softreset", &plat->softreset_ctl);
- if (ret)
- pr_err("can't get soft reset for %s (%d)", dev->name, ret);
-
- return ret;
-};
-
-static int sti_dwc3_glue_bind(struct udevice *dev)
-{
- struct sti_dwc3_glue_plat *plat = dev_get_plat(dev);
- ofnode node, dwc3_node;
-
- /* Find snps,dwc3 node from subnode */
- ofnode_for_each_subnode(node, dev_ofnode(dev)) {
- if (ofnode_device_is_compatible(node, "snps,dwc3"))
- dwc3_node = node;
- }
-
- if (!ofnode_valid(dwc3_node)) {
- pr_err("Can't find dwc3 subnode for %s\n", dev->name);
- return -ENODEV;
- }
-
- /* retrieve the DWC3 dual role mode */
- plat->mode = usb_get_dr_mode(dwc3_node);
- if (plat->mode == USB_DR_MODE_UNKNOWN)
- /* by default set dual role mode to HOST */
- plat->mode = USB_DR_MODE_HOST;
-
- return dm_scan_fdt_dev(dev);
-}
-
-static int sti_dwc3_glue_probe(struct udevice *dev)
-{
- struct sti_dwc3_glue_plat *plat = dev_get_plat(dev);
- int ret;
-
- /* deassert both powerdown and softreset */
- ret = reset_deassert(&plat->powerdown_ctl);
- if (ret < 0) {
- pr_err("DWC3 powerdown reset deassert failed: %d", ret);
- return ret;
- }
-
- ret = reset_deassert(&plat->softreset_ctl);
- if (ret < 0) {
- pr_err("DWC3 soft reset deassert failed: %d", ret);
- goto softreset_err;
- }
-
- ret = sti_dwc3_glue_drd_init(plat);
- if (ret)
- goto init_err;
-
- sti_dwc3_glue_init(plat);
-
- return 0;
-
-init_err:
- ret = reset_assert(&plat->softreset_ctl);
- if (ret < 0) {
- pr_err("DWC3 soft reset deassert failed: %d", ret);
- return ret;
- }
-
-softreset_err:
- ret = reset_assert(&plat->powerdown_ctl);
- if (ret < 0)
- pr_err("DWC3 powerdown reset deassert failed: %d", ret);
-
- return ret;
-}
-
-static int sti_dwc3_glue_remove(struct udevice *dev)
-{
- struct sti_dwc3_glue_plat *plat = dev_get_plat(dev);
- int ret;
-
- /* assert both powerdown and softreset */
- ret = reset_assert(&plat->powerdown_ctl);
- if (ret < 0) {
- pr_err("DWC3 powerdown reset deassert failed: %d", ret);
- return ret;
- }
-
- ret = reset_assert(&plat->softreset_ctl);
- if (ret < 0)
- pr_err("DWC3 soft reset deassert failed: %d", ret);
-
- return ret;
-}
-
-static const struct udevice_id sti_dwc3_glue_ids[] = {
- { .compatible = "st,stih407-dwc3" },
- { }
-};
-
-U_BOOT_DRIVER(dwc3_sti_glue) = {
- .name = "dwc3_sti_glue",
- .id = UCLASS_NOP,
- .of_match = sti_dwc3_glue_ids,
- .of_to_plat = sti_dwc3_glue_of_to_plat,
- .probe = sti_dwc3_glue_probe,
- .remove = sti_dwc3_glue_remove,
- .bind = sti_dwc3_glue_bind,
- .plat_auto = sizeof(struct sti_dwc3_glue_plat),
- .flags = DM_FLAG_ALLOC_PRIV_DMA,
-};
diff --git a/include/dwc3-sti-glue.h b/include/dwc3-sti-glue.h
deleted file mode 100644
index 546ffbaf7b4..00000000000
--- a/include/dwc3-sti-glue.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
- * Author(s): Patrice Chotard, <patrice.chotard@foss.st.com> for STMicroelectronics.
- */
-
-#ifndef __DWC3_STI_UBOOT_H_
-#define __DWC3_STI_UBOOT_H_
-
-/* glue registers */
-#include <linux/bitops.h>
-#define CLKRST_CTRL 0x00
-#define AUX_CLK_EN BIT(0)
-#define SW_PIPEW_RESET_N BIT(4)
-#define EXT_CFG_RESET_N BIT(8)
-
-#define XHCI_REVISION BIT(12)
-
-#define USB2_VBUS_MNGMNT_SEL1 0x2C
-#define USB2_VBUS_UTMIOTG 0x1
-
-#define SEL_OVERRIDE_VBUSVALID(n) ((n) << 0)
-#define SEL_OVERRIDE_POWERPRESENT(n) ((n) << 4)
-#define SEL_OVERRIDE_BVALID(n) ((n) << 8)
-
-/* Static DRD configuration */
-#define USB3_CONTROL_MASK 0xf77
-
-#define USB3_DEVICE_NOT_HOST BIT(0)
-#define USB3_FORCE_VBUSVALID BIT(1)
-#define USB3_DELAY_VBUSVALID BIT(2)
-#define USB3_SEL_FORCE_OPMODE BIT(4)
-#define USB3_FORCE_OPMODE(n) ((n) << 5)
-#define USB3_SEL_FORCE_DPPULLDOWN2 BIT(8)
-#define USB3_FORCE_DPPULLDOWN2 BIT(9)
-#define USB3_SEL_FORCE_DMPULLDOWN2 BIT(10)
-#define USB3_FORCE_DMPULLDOWN2 BIT(11)
-
-int sti_dwc3_init(enum usb_dr_mode mode);
-
-#endif /* __DWC3_STI_UBOOT_H_ */
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 7/9] configs: stih410-b2260: Enable DM_USB_GADGET flag
2025-01-16 8:17 [PATCH v2 0/9] Restore USB and add UMS support for STiH407-B2260 Patrice Chotard
` (5 preceding siblings ...)
2025-01-16 8:17 ` [PATCH v2 6/9] usb: dwc3: Remove dwc3 glue driver support for STi Patrice Chotard
@ 2025-01-16 8:17 ` Patrice Chotard
2025-01-16 8:17 ` [PATCH v2 8/9] board: stih410-b2260: Remove board_usb_init/cleanup() Patrice Chotard
2025-01-16 8:17 ` [PATCH v2 9/9] configs: stih410-b2260: Enable CMD_USB_MASS_STORAGE flag Patrice Chotard
8 siblings, 0 replies; 16+ messages in thread
From: Patrice Chotard @ 2025-01-16 8:17 UTC (permalink / raw)
To: u-boot
Cc: Patrice CHOTARD, Patrick DELAUNAY, U-Boot STM32, Marek Vasut,
Tom Rini
Enable DM_USB_GADGET flag.
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Marek Vasut <marex@denx.de>
---
(no changes since v1)
configs/stih410-b2260_defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/configs/stih410-b2260_defconfig b/configs/stih410-b2260_defconfig
index 4fcbf75548b..5641fd1d8d7 100644
--- a/configs/stih410-b2260_defconfig
+++ b/configs/stih410-b2260_defconfig
@@ -54,6 +54,7 @@ CONFIG_STI_ASC_SERIAL=y
CONFIG_SYSRESET=y
CONFIG_TIMER=y
CONFIG_USB=y
+CONFIG_DM_USB_GADGET=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_EHCI_HCD=y
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 8/9] board: stih410-b2260: Remove board_usb_init/cleanup()
2025-01-16 8:17 [PATCH v2 0/9] Restore USB and add UMS support for STiH407-B2260 Patrice Chotard
` (6 preceding siblings ...)
2025-01-16 8:17 ` [PATCH v2 7/9] configs: stih410-b2260: Enable DM_USB_GADGET flag Patrice Chotard
@ 2025-01-16 8:17 ` Patrice Chotard
2025-01-16 10:15 ` Mattijs Korpershoek
2025-01-16 8:17 ` [PATCH v2 9/9] configs: stih410-b2260: Enable CMD_USB_MASS_STORAGE flag Patrice Chotard
8 siblings, 1 reply; 16+ messages in thread
From: Patrice Chotard @ 2025-01-16 8:17 UTC (permalink / raw)
To: u-boot
Cc: Patrice CHOTARD, Patrick DELAUNAY, U-Boot STM32, Caleb Connolly,
Marek Vasut, Mattijs Korpershoek, Tom Rini
Since DM_USB_GADGET is enable for this board, board_usb_init()
and board_usb_cleanup() can be removed.
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
---
(no changes since v1)
board/st/stih410-b2260/board.c | 29 -----------------------------
1 file changed, 29 deletions(-)
diff --git a/board/st/stih410-b2260/board.c b/board/st/stih410-b2260/board.c
index 3a495eb5089..8ad593cccdd 100644
--- a/board/st/stih410-b2260/board.c
+++ b/board/st/stih410-b2260/board.c
@@ -7,10 +7,6 @@
#include <cpu_func.h>
#include <init.h>
#include <asm/cache.h>
-#include <asm/global_data.h>
-#include <linux/usb/otg.h>
-#include <dwc3-uboot.h>
-#include <usb.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -42,31 +38,6 @@ int board_init(void)
}
#ifdef CONFIG_USB_DWC3
-static struct dwc3_device dwc3_device_data = {
- .maximum_speed = USB_SPEED_HIGH,
- .dr_mode = USB_DR_MODE_PERIPHERAL,
- .index = 0,
-};
-
-int board_usb_init(int index, enum usb_init_type init)
-{
- int node;
- const void *blob = gd->fdt_blob;
-
- /* find the snps,dwc3 node */
- node = fdt_node_offset_by_compatible(blob, -1, "snps,dwc3");
-
- dwc3_device_data.base = fdtdec_get_addr(blob, node, "reg");
-
- return dwc3_uboot_init(&dwc3_device_data);
-}
-
-int board_usb_cleanup(int index, enum usb_init_type init)
-{
- dwc3_uboot_exit(index);
- return 0;
-}
-
int g_dnl_board_usb_cable_connected(void)
{
return 1;
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 9/9] configs: stih410-b2260: Enable CMD_USB_MASS_STORAGE flag
2025-01-16 8:17 [PATCH v2 0/9] Restore USB and add UMS support for STiH407-B2260 Patrice Chotard
` (7 preceding siblings ...)
2025-01-16 8:17 ` [PATCH v2 8/9] board: stih410-b2260: Remove board_usb_init/cleanup() Patrice Chotard
@ 2025-01-16 8:17 ` Patrice Chotard
8 siblings, 0 replies; 16+ messages in thread
From: Patrice Chotard @ 2025-01-16 8:17 UTC (permalink / raw)
To: u-boot
Cc: Patrice CHOTARD, Patrick DELAUNAY, U-Boot STM32, Marek Vasut,
Tom Rini
Enable CMD_USB_MASS_STORAGE flag.
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Marek Vasut <marex@denx.de>
---
(no changes since v1)
configs/stih410-b2260_defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/configs/stih410-b2260_defconfig b/configs/stih410-b2260_defconfig
index 5641fd1d8d7..1e5190dc828 100644
--- a/configs/stih410-b2260_defconfig
+++ b/configs/stih410-b2260_defconfig
@@ -25,6 +25,7 @@ CONFIG_CMD_ASKENV=y
CONFIG_CMD_GPT=y
CONFIG_CMD_MMC=y
CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
CONFIG_CMD_TIME=y
CONFIG_CMD_TIMER=y
CONFIG_CMD_EXT4_WRITE=y
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v2 3/9] usb: dwc3-generic: Reorder include
2025-01-16 8:17 ` [PATCH v2 3/9] usb: dwc3-generic: Reorder include Patrice Chotard
@ 2025-01-16 10:12 ` Mattijs Korpershoek
2025-01-20 7:20 ` Patrice CHOTARD
0 siblings, 1 reply; 16+ messages in thread
From: Mattijs Korpershoek @ 2025-01-16 10:12 UTC (permalink / raw)
To: Patrice Chotard, u-boot
Cc: Patrice CHOTARD, Patrick DELAUNAY, U-Boot STM32, Marek Vasut,
Caleb Connolly, Jan Kiszka, Neil Armstrong, Tom Rini
Hi Patrice,
Thank you for the patch.
On jeu., janv. 16, 2025 at 09:17, Patrice Chotard <patrice.chotard@foss.st.com> wrote:
> Reorder include following rules available here :
> https://docs.u-boot.org/en/latest/develop/codingstyle.html#include-files
Nitpick: we don't state in the commit message that we also removed the
unused includes.
A sentence like: "While at it, also remove the unused includes" would be
nice to have.
If you need to send v3 for other reasons than this comment, please
consider adding it.
In case, this is a nitpick, so:
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
>
> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
> Cc: Marek Vasut <marex@denx.de>
>
> ---
>
> Changes in v2:
> - remove useless include files
>
> drivers/usb/dwc3/dwc3-generic.c | 20 ++++----------------
> 1 file changed, 4 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
> index 2ab41cbae45..bc7d2d4234b 100644
> --- a/drivers/usb/dwc3/dwc3-generic.c
> +++ b/drivers/usb/dwc3/dwc3-generic.c
> @@ -7,29 +7,17 @@
> * Based on dwc3-omap.c.
> */
>
> -#include <cpu_func.h>
> -#include <log.h>
> #include <dm.h>
> -#include <dm/device-internal.h>
> +#include <reset.h>
> +#include <asm/gpio.h>
> #include <dm/lists.h>
> -#include <dwc3-uboot.h>
> -#include <generic-phy.h>
> -#include <linux/bitops.h>
> #include <linux/delay.h>
> -#include <linux/printk.h>
> -#include <linux/usb/ch9.h>
> #include <linux/usb/gadget.h>
> -#include <malloc.h>
> #include <power/regulator.h>
> -#include <usb.h>
> -#include "core.h"
> -#include "gadget.h"
> -#include <reset.h>
> -#include <clk.h>
> #include <usb/xhci.h>
> -#include <asm/gpio.h>
> -
> +#include "core.h"
> #include "dwc3-generic.h"
> +#include "gadget.h"
>
> struct dwc3_generic_plat {
> fdt_addr_t base;
> --
> 2.25.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 8/9] board: stih410-b2260: Remove board_usb_init/cleanup()
2025-01-16 8:17 ` [PATCH v2 8/9] board: stih410-b2260: Remove board_usb_init/cleanup() Patrice Chotard
@ 2025-01-16 10:15 ` Mattijs Korpershoek
0 siblings, 0 replies; 16+ messages in thread
From: Mattijs Korpershoek @ 2025-01-16 10:15 UTC (permalink / raw)
To: Patrice Chotard, u-boot
Cc: Patrice CHOTARD, Patrick DELAUNAY, U-Boot STM32, Caleb Connolly,
Marek Vasut, Tom Rini
Hi Patrice,
Thank you for the patch.
On jeu., janv. 16, 2025 at 09:17, Patrice Chotard <patrice.chotard@foss.st.com> wrote:
> Since DM_USB_GADGET is enable for this board, board_usb_init()
> and board_usb_cleanup() can be removed.
>
> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Yay, glad to see some more board_usb_{init,cleanup}() getting removed!
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
>
> (no changes since v1)
>
> board/st/stih410-b2260/board.c | 29 -----------------------------
> 1 file changed, 29 deletions(-)
>
> diff --git a/board/st/stih410-b2260/board.c b/board/st/stih410-b2260/board.c
> index 3a495eb5089..8ad593cccdd 100644
> --- a/board/st/stih410-b2260/board.c
> +++ b/board/st/stih410-b2260/board.c
> @@ -7,10 +7,6 @@
> #include <cpu_func.h>
> #include <init.h>
> #include <asm/cache.h>
> -#include <asm/global_data.h>
> -#include <linux/usb/otg.h>
> -#include <dwc3-uboot.h>
> -#include <usb.h>
>
> DECLARE_GLOBAL_DATA_PTR;
>
> @@ -42,31 +38,6 @@ int board_init(void)
> }
>
> #ifdef CONFIG_USB_DWC3
> -static struct dwc3_device dwc3_device_data = {
> - .maximum_speed = USB_SPEED_HIGH,
> - .dr_mode = USB_DR_MODE_PERIPHERAL,
> - .index = 0,
> -};
> -
> -int board_usb_init(int index, enum usb_init_type init)
> -{
> - int node;
> - const void *blob = gd->fdt_blob;
> -
> - /* find the snps,dwc3 node */
> - node = fdt_node_offset_by_compatible(blob, -1, "snps,dwc3");
> -
> - dwc3_device_data.base = fdtdec_get_addr(blob, node, "reg");
> -
> - return dwc3_uboot_init(&dwc3_device_data);
> -}
> -
> -int board_usb_cleanup(int index, enum usb_init_type init)
> -{
> - dwc3_uboot_exit(index);
> - return 0;
> -}
> -
> int g_dnl_board_usb_cable_connected(void)
> {
> return 1;
> --
> 2.25.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 4/9] usb: dwc3-generic: Add STih407 support
2025-01-16 8:17 ` [PATCH v2 4/9] usb: dwc3-generic: Add STih407 support Patrice Chotard
@ 2025-01-16 10:24 ` Mattijs Korpershoek
2025-01-20 7:28 ` Patrice CHOTARD
0 siblings, 1 reply; 16+ messages in thread
From: Mattijs Korpershoek @ 2025-01-16 10:24 UTC (permalink / raw)
To: Patrice Chotard, u-boot
Cc: Patrice CHOTARD, Patrick DELAUNAY, U-Boot STM32, Marek Vasut,
Caleb Connolly, Nathan Barrett-Morrison, Oliver Gaskell,
Robert Marko, Sam Protsenko, Simon Glass, Sjoerd Simons,
Sumit Garg, Tom Rini
Hi Patrice,
Thank you for the patch.
On jeu., janv. 16, 2025 at 09:17, Patrice Chotard <patrice.chotard@foss.st.com> wrote:
> Add STi glue logic to manage the DWC3 HC on STiH407
> SoC family. It configures the internal glue logic and
> syscfg registers.
>
> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
> Cc: Marek Vasut <marex@denx.de>
>
> ---
>
> Changes in v2:
> - add dwc3-sti.c DWC3 wrapper as done for dwc3-am62.c
>
> MAINTAINERS | 1 +
> drivers/usb/dwc3/Kconfig | 6 ++
> drivers/usb/dwc3/Makefile | 1 +
> drivers/usb/dwc3/dwc3-generic-sti.c | 127 ++++++++++++++++++++++++++++
> 4 files changed, 135 insertions(+)
> create mode 100644 drivers/usb/dwc3/dwc3-generic-sti.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 8c6c0c2a4bc..5d7e251e601 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -656,6 +656,7 @@ F: drivers/mmc/sti_sdhci.c
> F: drivers/reset/sti-reset.c
> F: drivers/serial/serial_sti_asc.c
> F: drivers/sysreset/sysreset_sti.c
> +F: drivers/usb/host/dwc3-sti.c
> F: drivers/timer/arm_global_timer.c
> F: drivers/usb/host/dwc3-sti-glue.c
> F: include/dwc3-sti-glue.h
> diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
> index 0100723a68b..7d58ae65fb6 100644
> --- a/drivers/usb/dwc3/Kconfig
> +++ b/drivers/usb/dwc3/Kconfig
> @@ -87,6 +87,12 @@ config USB_DWC3_LAYERSCAPE
> Host and Peripheral operation modes are supported. OTG is not
> supported.
>
> +config USB_DWC3_STI
> + bool "STi USB wrapper"
> + depends on DM_USB && USB_DWC3_GENERIC && SYSCON
> + help
> + Select this for STi Platforms.
> +
> menu "PHY Subsystem"
>
> config USB_DWC3_PHY_OMAP
> diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile
> index a085c9d4628..985206eafe4 100644
> --- a/drivers/usb/dwc3/Makefile
> +++ b/drivers/usb/dwc3/Makefile
> @@ -15,3 +15,4 @@ obj-$(CONFIG_USB_DWC3_UNIPHIER) += dwc3-uniphier.o
> obj-$(CONFIG_USB_DWC3_LAYERSCAPE) += dwc3-layerscape.o
> obj-$(CONFIG_USB_DWC3_PHY_OMAP) += ti_usb_phy.o
> obj-$(CONFIG_USB_DWC3_PHY_SAMSUNG) += samsung_usb_phy.o
> +obj-$(CONFIG_USB_DWC3_STI) += dwc3-generic-sti.o
> diff --git a/drivers/usb/dwc3/dwc3-generic-sti.c b/drivers/usb/dwc3/dwc3-generic-sti.c
> new file mode 100644
> index 00000000000..e316e88d2f8
> --- /dev/null
> +++ b/drivers/usb/dwc3/dwc3-generic-sti.c
> @@ -0,0 +1,127 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause
> +/*
> + * STi specific glue layer for DWC3
> + *
> + * Copyright (C) 2025, STMicroelectronics - All Rights Reserved
> + */
> +
> +#include <reset.h>
> +#include <regmap.h>
> +#include <syscon.h>
> +#include <asm/io.h>
> +#include <dm/device.h>
> +#include <dm/read.h>
> +#include <linux/usb/otg.h>
> +#include "dwc3-generic.h"
> +
> +/* glue registers */
> +#define CLKRST_CTRL 0x00
> +#define AUX_CLK_EN BIT(0)
> +#define SW_PIPEW_RESET_N BIT(4)
> +#define EXT_CFG_RESET_N BIT(8)
> +
> +#define XHCI_REVISION BIT(12)
> +
> +#define USB2_VBUS_MNGMNT_SEL1 0x2C
> +#define USB2_VBUS_UTMIOTG 0x1
> +
> +#define SEL_OVERRIDE_VBUSVALID(n) ((n) << 0)
> +#define SEL_OVERRIDE_POWERPRESENT(n) ((n) << 4)
> +#define SEL_OVERRIDE_BVALID(n) ((n) << 8)
> +
> +/* Static DRD configuration */
> +#define USB3_CONTROL_MASK 0xf77
> +
> +#define USB3_DEVICE_NOT_HOST BIT(0)
> +#define USB3_FORCE_VBUSVALID BIT(1)
> +#define USB3_DELAY_VBUSVALID BIT(2)
> +#define USB3_SEL_FORCE_OPMODE BIT(4)
> +#define USB3_FORCE_OPMODE(n) ((n) << 5)
> +#define USB3_SEL_FORCE_DPPULLDOWN2 BIT(8)
> +#define USB3_FORCE_DPPULLDOWN2 BIT(9)
> +#define USB3_SEL_FORCE_DMPULLDOWN2 BIT(10)
> +#define USB3_FORCE_DMPULLDOWN2 BIT(11)
> +
> +static void dwc3_stih407_glue_configure(struct udevice *dev, int index,
> + enum usb_dr_mode mode)
> +{
> + struct dwc3_glue_data *glue = dev_get_plat(dev);
> + struct regmap *regmap;
> + ulong syscfg_base;
> + ulong syscfg_offset;
> + ulong glue_base;
> + int ret;
> +
> + /* deassert both powerdown and softreset */
> + ret = reset_deassert_bulk(&glue->resets);
> + if (ret) {
> + debug("reset_deassert_bulk error: %d\n", ret);
Maybe promote this to a warning message? debug() seems a little too low
priority for an error like this.
> + return;
> + }
> +
> + regmap = syscon_regmap_lookup_by_phandle(dev, "st,syscfg");
syscon_regmap_lookup_by_phandle() can fail, in that case, error handling
should be done with IS_ERR(regmap). Can we add that, please?
Otherwise we might do PTR_ERR->ranges[0].start the line below.
> +
> + syscfg_base = regmap->ranges[0].start;
> + glue_base = dev_read_addr_index(dev, 0);
> + syscfg_offset = dev_read_addr_index(dev, 1);
> +
> + clrbits_le32(syscfg_base + syscfg_offset, USB3_CONTROL_MASK);
> +
> + /* glue drd init */
> + switch (mode) {
> + case USB_DR_MODE_PERIPHERAL:
> + clrbits_le32(syscfg_base + syscfg_offset,
> + USB3_DELAY_VBUSVALID | USB3_SEL_FORCE_OPMODE |
> + USB3_FORCE_OPMODE(0x3) | USB3_SEL_FORCE_DPPULLDOWN2 |
> + USB3_FORCE_DPPULLDOWN2 | USB3_SEL_FORCE_DMPULLDOWN2 |
> + USB3_FORCE_DMPULLDOWN2);
> +
> + setbits_le32(syscfg_base + syscfg_offset,
> + USB3_DEVICE_NOT_HOST | USB3_FORCE_VBUSVALID);
> + break;
> +
> + case USB_DR_MODE_HOST:
> + clrbits_le32(syscfg_base + syscfg_offset,
> + USB3_DEVICE_NOT_HOST | USB3_FORCE_VBUSVALID |
> + USB3_SEL_FORCE_OPMODE | USB3_FORCE_OPMODE(0x3) |
> + USB3_SEL_FORCE_DPPULLDOWN2 | USB3_FORCE_DPPULLDOWN2 |
> + USB3_SEL_FORCE_DMPULLDOWN2 | USB3_FORCE_DMPULLDOWN2);
> +
> + setbits_le32(syscfg_base + syscfg_offset, USB3_DELAY_VBUSVALID);
> + break;
> +
> + default:
> + debug("Unsupported mode of operation %d\n", mode);
> + return;
Nitpick, I think that mode being an enum (with a finite number of values
possibles), we not necessarily have to check if the value is invalid.
But it's okay for me if this stays the same.
> + }
> +
> + /* glue init */
> + setbits_le32(glue_base + CLKRST_CTRL, AUX_CLK_EN | EXT_CFG_RESET_N | XHCI_REVISION);
> + clrbits_le32(glue_base + CLKRST_CTRL, SW_PIPEW_RESET_N);
> +
> + /* configure mux for vbus, powerpresent and bvalid signals */
> + setbits_le32(glue_base + USB2_VBUS_MNGMNT_SEL1,
> + SEL_OVERRIDE_VBUSVALID(USB2_VBUS_UTMIOTG) |
> + SEL_OVERRIDE_POWERPRESENT(USB2_VBUS_UTMIOTG) |
> + SEL_OVERRIDE_BVALID(USB2_VBUS_UTMIOTG));
> + setbits_le32(glue_base + CLKRST_CTRL, SW_PIPEW_RESET_N);
> +};
> +
> +struct dwc3_glue_ops stih407_ops = {
> + .glue_configure = dwc3_stih407_glue_configure,
> +};
> +
> +static const struct udevice_id dwc3_sti_match[] = {
> + { .compatible = "st,stih407-dwc3", .data = (ulong)&stih407_ops},
> + { /* sentinel */ }
> +};
> +
> +U_BOOT_DRIVER(dwc3_sti_wrapper) = {
> + .name = "dwc3-sti",
> + .id = UCLASS_SIMPLE_BUS,
> + .of_match = dwc3_sti_match,
> + .bind = dwc3_glue_bind,
> + .probe = dwc3_glue_probe,
> + .remove = dwc3_glue_remove,
> + .plat_auto = sizeof(struct dwc3_glue_data),
> +};
> --
> 2.25.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 6/9] usb: dwc3: Remove dwc3 glue driver support for STi
2025-01-16 8:17 ` [PATCH v2 6/9] usb: dwc3: Remove dwc3 glue driver support for STi Patrice Chotard
@ 2025-01-16 10:25 ` Mattijs Korpershoek
0 siblings, 0 replies; 16+ messages in thread
From: Mattijs Korpershoek @ 2025-01-16 10:25 UTC (permalink / raw)
To: Patrice Chotard, u-boot
Cc: Patrice CHOTARD, Patrick DELAUNAY, U-Boot STM32, Marek Vasut,
Caleb Connolly, Fabio Estevam, Jonas Karlman, Kever Yang,
Mathieu Othacehe, Nathan Barrett-Morrison, Neil Armstrong,
Oliver Gaskell, Patrick Rudolph, Paul Barker, Robert Marko,
Sam Protsenko, Simon Glass, Sumit Garg, Tom Rini
Hi Patrice,
Thank you for the patch.
On jeu., janv. 16, 2025 at 09:17, Patrice Chotard <patrice.chotard@foss.st.com> wrote:
> STi is now using the dwc3-generic driver, dwc3-sti-glue driver
> can be removed.
>
> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
> Cc: Marek Vasut <marex@denx.de>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
>
> (no changes since v1)
>
> MAINTAINERS | 2 -
> board/st/stih410-b2260/board.c | 1 -
> drivers/usb/host/Kconfig | 9 --
> drivers/usb/host/Makefile | 1 -
> drivers/usb/host/dwc3-sti-glue.c | 253 -------------------------------
> include/dwc3-sti-glue.h | 41 -----
> 6 files changed, 307 deletions(-)
> delete mode 100644 drivers/usb/host/dwc3-sti-glue.c
> delete mode 100644 include/dwc3-sti-glue.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 5d7e251e601..0982dfa3fe0 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -658,8 +658,6 @@ F: drivers/serial/serial_sti_asc.c
> F: drivers/sysreset/sysreset_sti.c
> F: drivers/usb/host/dwc3-sti.c
> F: drivers/timer/arm_global_timer.c
> -F: drivers/usb/host/dwc3-sti-glue.c
> -F: include/dwc3-sti-glue.h
> F: include/dt-bindings/clock/stih407-clks.h
> F: include/dt-bindings/clock/stih410-clks.h
> F: include/dt-bindings/reset/stih407-resets.h
> diff --git a/board/st/stih410-b2260/board.c b/board/st/stih410-b2260/board.c
> index a912712c9dd..3a495eb5089 100644
> --- a/board/st/stih410-b2260/board.c
> +++ b/board/st/stih410-b2260/board.c
> @@ -9,7 +9,6 @@
> #include <asm/cache.h>
> #include <asm/global_data.h>
> #include <linux/usb/otg.h>
> -#include <dwc3-sti-glue.h>
> #include <dwc3-uboot.h>
> #include <usb.h>
>
> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
> index 24786a2bc91..cd1c03f10d7 100644
> --- a/drivers/usb/host/Kconfig
> +++ b/drivers/usb/host/Kconfig
> @@ -110,15 +110,6 @@ config USB_XHCI_RCAR
> Choose this option to add support for USB 3.0 driver on Renesas
> R-Car Gen3 SoCs.
>
> -config USB_XHCI_STI
> - bool "Support for STMicroelectronics STiH407 family on-chip xHCI USB controller"
> - depends on ARCH_STI
> - default y
> - help
> - Enables support for the on-chip xHCI controller on STMicroelectronics
> - STiH407 family SoCs. This is a driver for the dwc3 to provide the glue logic
> - to configure the controller.
> -
> config USB_XHCI_DRA7XX_INDEX
> int "DRA7XX xHCI USB index"
> range 0 1
> diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
> index 301bb9fdee1..902d68d0378 100644
> --- a/drivers/usb/host/Makefile
> +++ b/drivers/usb/host/Makefile
> @@ -54,7 +54,6 @@ obj-$(CONFIG_USB_XHCI_GENERIC) += xhci-generic.o
> 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
> diff --git a/drivers/usb/host/dwc3-sti-glue.c b/drivers/usb/host/dwc3-sti-glue.c
> deleted file mode 100644
> index 3e6834e38e3..00000000000
> --- a/drivers/usb/host/dwc3-sti-glue.c
> +++ /dev/null
> @@ -1,253 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0+
> -/*
> - * STiH407 family DWC3 specific Glue layer
> - *
> - * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
> - * Author(s): Patrice Chotard, <patrice.chotard@foss.st.com> for STMicroelectronics.
> - */
> -
> -#include <log.h>
> -#include <asm/global_data.h>
> -#include <asm/io.h>
> -#include <dm.h>
> -#include <errno.h>
> -#include <dm/lists.h>
> -#include <regmap.h>
> -#include <reset-uclass.h>
> -#include <syscon.h>
> -#include <usb.h>
> -#include <linux/printk.h>
> -
> -#include <linux/usb/dwc3.h>
> -#include <linux/usb/otg.h>
> -#include <dwc3-sti-glue.h>
> -
> -DECLARE_GLOBAL_DATA_PTR;
> -
> -/*
> - * struct sti_dwc3_glue_plat - dwc3 STi glue driver private structure
> - * @syscfg_base: addr for the glue syscfg
> - * @glue_base: addr for the glue registers
> - * @syscfg_offset: usb syscfg control offset
> - * @powerdown_ctl: rest controller for powerdown signal
> - * @softreset_ctl: reset controller for softreset signal
> - * @mode: drd static host/device config
> - */
> -struct sti_dwc3_glue_plat {
> - phys_addr_t syscfg_base;
> - phys_addr_t glue_base;
> - phys_addr_t syscfg_offset;
> - struct reset_ctl powerdown_ctl;
> - struct reset_ctl softreset_ctl;
> - enum usb_dr_mode mode;
> -};
> -
> -static int sti_dwc3_glue_drd_init(struct sti_dwc3_glue_plat *plat)
> -{
> - unsigned long val;
> -
> - val = readl(plat->syscfg_base + plat->syscfg_offset);
> -
> - val &= USB3_CONTROL_MASK;
> -
> - switch (plat->mode) {
> - case USB_DR_MODE_PERIPHERAL:
> - val &= ~(USB3_DELAY_VBUSVALID
> - | USB3_SEL_FORCE_OPMODE | USB3_FORCE_OPMODE(0x3)
> - | USB3_SEL_FORCE_DPPULLDOWN2 | USB3_FORCE_DPPULLDOWN2
> - | USB3_SEL_FORCE_DMPULLDOWN2 | USB3_FORCE_DMPULLDOWN2);
> -
> - val |= USB3_DEVICE_NOT_HOST | USB3_FORCE_VBUSVALID;
> - break;
> -
> - case USB_DR_MODE_HOST:
> - val &= ~(USB3_DEVICE_NOT_HOST | USB3_FORCE_VBUSVALID
> - | USB3_SEL_FORCE_OPMODE | USB3_FORCE_OPMODE(0x3)
> - | USB3_SEL_FORCE_DPPULLDOWN2 | USB3_FORCE_DPPULLDOWN2
> - | USB3_SEL_FORCE_DMPULLDOWN2 | USB3_FORCE_DMPULLDOWN2);
> -
> - val |= USB3_DELAY_VBUSVALID;
> - break;
> -
> - default:
> - pr_err("Unsupported mode of operation %d\n", plat->mode);
> - return -EINVAL;
> - }
> - writel(val, plat->syscfg_base + plat->syscfg_offset);
> -
> - return 0;
> -}
> -
> -static void sti_dwc3_glue_init(struct sti_dwc3_glue_plat *plat)
> -{
> - unsigned long reg;
> -
> - reg = readl(plat->glue_base + CLKRST_CTRL);
> -
> - reg |= AUX_CLK_EN | EXT_CFG_RESET_N | XHCI_REVISION;
> - reg &= ~SW_PIPEW_RESET_N;
> -
> - writel(reg, plat->glue_base + CLKRST_CTRL);
> -
> - /* configure mux for vbus, powerpresent and bvalid signals */
> - reg = readl(plat->glue_base + USB2_VBUS_MNGMNT_SEL1);
> -
> - reg |= SEL_OVERRIDE_VBUSVALID(USB2_VBUS_UTMIOTG) |
> - SEL_OVERRIDE_POWERPRESENT(USB2_VBUS_UTMIOTG) |
> - SEL_OVERRIDE_BVALID(USB2_VBUS_UTMIOTG);
> -
> - writel(reg, plat->glue_base + USB2_VBUS_MNGMNT_SEL1);
> -
> - setbits_le32(plat->glue_base + CLKRST_CTRL, SW_PIPEW_RESET_N);
> -}
> -
> -static int sti_dwc3_glue_of_to_plat(struct udevice *dev)
> -{
> - struct sti_dwc3_glue_plat *plat = dev_get_plat(dev);
> - struct udevice *syscon;
> - struct regmap *regmap;
> - int ret;
> - u32 reg[4];
> -
> - ret = ofnode_read_u32_array(dev_ofnode(dev), "reg", reg,
> - ARRAY_SIZE(reg));
> - if (ret) {
> - pr_err("unable to find st,stih407-dwc3 reg property(%d)\n", ret);
> - return ret;
> - }
> -
> - plat->glue_base = reg[0];
> - plat->syscfg_offset = reg[2];
> -
> - /* get corresponding syscon phandle */
> - ret = uclass_get_device_by_phandle(UCLASS_SYSCON, dev, "st,syscfg",
> - &syscon);
> - if (ret) {
> - pr_err("unable to find syscon device (%d)\n", ret);
> - return ret;
> - }
> -
> - /* get syscfg-reg base address */
> - regmap = syscon_get_regmap(syscon);
> - if (!regmap) {
> - pr_err("unable to find regmap\n");
> - return -ENODEV;
> - }
> - plat->syscfg_base = regmap->ranges[0].start;
> -
> - /* get powerdown reset */
> - ret = reset_get_by_name(dev, "powerdown", &plat->powerdown_ctl);
> - if (ret) {
> - pr_err("can't get powerdown reset for %s (%d)", dev->name, ret);
> - return ret;
> - }
> -
> - /* get softreset reset */
> - ret = reset_get_by_name(dev, "softreset", &plat->softreset_ctl);
> - if (ret)
> - pr_err("can't get soft reset for %s (%d)", dev->name, ret);
> -
> - return ret;
> -};
> -
> -static int sti_dwc3_glue_bind(struct udevice *dev)
> -{
> - struct sti_dwc3_glue_plat *plat = dev_get_plat(dev);
> - ofnode node, dwc3_node;
> -
> - /* Find snps,dwc3 node from subnode */
> - ofnode_for_each_subnode(node, dev_ofnode(dev)) {
> - if (ofnode_device_is_compatible(node, "snps,dwc3"))
> - dwc3_node = node;
> - }
> -
> - if (!ofnode_valid(dwc3_node)) {
> - pr_err("Can't find dwc3 subnode for %s\n", dev->name);
> - return -ENODEV;
> - }
> -
> - /* retrieve the DWC3 dual role mode */
> - plat->mode = usb_get_dr_mode(dwc3_node);
> - if (plat->mode == USB_DR_MODE_UNKNOWN)
> - /* by default set dual role mode to HOST */
> - plat->mode = USB_DR_MODE_HOST;
> -
> - return dm_scan_fdt_dev(dev);
> -}
> -
> -static int sti_dwc3_glue_probe(struct udevice *dev)
> -{
> - struct sti_dwc3_glue_plat *plat = dev_get_plat(dev);
> - int ret;
> -
> - /* deassert both powerdown and softreset */
> - ret = reset_deassert(&plat->powerdown_ctl);
> - if (ret < 0) {
> - pr_err("DWC3 powerdown reset deassert failed: %d", ret);
> - return ret;
> - }
> -
> - ret = reset_deassert(&plat->softreset_ctl);
> - if (ret < 0) {
> - pr_err("DWC3 soft reset deassert failed: %d", ret);
> - goto softreset_err;
> - }
> -
> - ret = sti_dwc3_glue_drd_init(plat);
> - if (ret)
> - goto init_err;
> -
> - sti_dwc3_glue_init(plat);
> -
> - return 0;
> -
> -init_err:
> - ret = reset_assert(&plat->softreset_ctl);
> - if (ret < 0) {
> - pr_err("DWC3 soft reset deassert failed: %d", ret);
> - return ret;
> - }
> -
> -softreset_err:
> - ret = reset_assert(&plat->powerdown_ctl);
> - if (ret < 0)
> - pr_err("DWC3 powerdown reset deassert failed: %d", ret);
> -
> - return ret;
> -}
> -
> -static int sti_dwc3_glue_remove(struct udevice *dev)
> -{
> - struct sti_dwc3_glue_plat *plat = dev_get_plat(dev);
> - int ret;
> -
> - /* assert both powerdown and softreset */
> - ret = reset_assert(&plat->powerdown_ctl);
> - if (ret < 0) {
> - pr_err("DWC3 powerdown reset deassert failed: %d", ret);
> - return ret;
> - }
> -
> - ret = reset_assert(&plat->softreset_ctl);
> - if (ret < 0)
> - pr_err("DWC3 soft reset deassert failed: %d", ret);
> -
> - return ret;
> -}
> -
> -static const struct udevice_id sti_dwc3_glue_ids[] = {
> - { .compatible = "st,stih407-dwc3" },
> - { }
> -};
> -
> -U_BOOT_DRIVER(dwc3_sti_glue) = {
> - .name = "dwc3_sti_glue",
> - .id = UCLASS_NOP,
> - .of_match = sti_dwc3_glue_ids,
> - .of_to_plat = sti_dwc3_glue_of_to_plat,
> - .probe = sti_dwc3_glue_probe,
> - .remove = sti_dwc3_glue_remove,
> - .bind = sti_dwc3_glue_bind,
> - .plat_auto = sizeof(struct sti_dwc3_glue_plat),
> - .flags = DM_FLAG_ALLOC_PRIV_DMA,
> -};
> diff --git a/include/dwc3-sti-glue.h b/include/dwc3-sti-glue.h
> deleted file mode 100644
> index 546ffbaf7b4..00000000000
> --- a/include/dwc3-sti-glue.h
> +++ /dev/null
> @@ -1,41 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0+ */
> -/*
> - * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
> - * Author(s): Patrice Chotard, <patrice.chotard@foss.st.com> for STMicroelectronics.
> - */
> -
> -#ifndef __DWC3_STI_UBOOT_H_
> -#define __DWC3_STI_UBOOT_H_
> -
> -/* glue registers */
> -#include <linux/bitops.h>
> -#define CLKRST_CTRL 0x00
> -#define AUX_CLK_EN BIT(0)
> -#define SW_PIPEW_RESET_N BIT(4)
> -#define EXT_CFG_RESET_N BIT(8)
> -
> -#define XHCI_REVISION BIT(12)
> -
> -#define USB2_VBUS_MNGMNT_SEL1 0x2C
> -#define USB2_VBUS_UTMIOTG 0x1
> -
> -#define SEL_OVERRIDE_VBUSVALID(n) ((n) << 0)
> -#define SEL_OVERRIDE_POWERPRESENT(n) ((n) << 4)
> -#define SEL_OVERRIDE_BVALID(n) ((n) << 8)
> -
> -/* Static DRD configuration */
> -#define USB3_CONTROL_MASK 0xf77
> -
> -#define USB3_DEVICE_NOT_HOST BIT(0)
> -#define USB3_FORCE_VBUSVALID BIT(1)
> -#define USB3_DELAY_VBUSVALID BIT(2)
> -#define USB3_SEL_FORCE_OPMODE BIT(4)
> -#define USB3_FORCE_OPMODE(n) ((n) << 5)
> -#define USB3_SEL_FORCE_DPPULLDOWN2 BIT(8)
> -#define USB3_FORCE_DPPULLDOWN2 BIT(9)
> -#define USB3_SEL_FORCE_DMPULLDOWN2 BIT(10)
> -#define USB3_FORCE_DMPULLDOWN2 BIT(11)
> -
> -int sti_dwc3_init(enum usb_dr_mode mode);
> -
> -#endif /* __DWC3_STI_UBOOT_H_ */
> --
> 2.25.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 3/9] usb: dwc3-generic: Reorder include
2025-01-16 10:12 ` Mattijs Korpershoek
@ 2025-01-20 7:20 ` Patrice CHOTARD
0 siblings, 0 replies; 16+ messages in thread
From: Patrice CHOTARD @ 2025-01-20 7:20 UTC (permalink / raw)
To: Mattijs Korpershoek, u-boot
Cc: Patrick DELAUNAY, U-Boot STM32, Marek Vasut, Caleb Connolly,
Jan Kiszka, Neil Armstrong, Tom Rini
On 1/16/25 11:12, Mattijs Korpershoek wrote:
> Hi Patrice,
>
> Thank you for the patch.
>
> On jeu., janv. 16, 2025 at 09:17, Patrice Chotard <patrice.chotard@foss.st.com> wrote:
>
>> Reorder include following rules available here :
>> https://docs.u-boot.org/en/latest/develop/codingstyle.html#include-files
>
> Nitpick: we don't state in the commit message that we also removed the
> unused includes.
> A sentence like: "While at it, also remove the unused includes" would be
> nice to have.
>
> If you need to send v3 for other reasons than this comment, please
> consider adding it.
Yes, i will update the comment
Thanks
Patrice
>
> In case, this is a nitpick, so:
>
> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
>
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
>> Cc: Marek Vasut <marex@denx.de>
>>
>> ---
>>
>> Changes in v2:
>> - remove useless include files
>>
>> drivers/usb/dwc3/dwc3-generic.c | 20 ++++----------------
>> 1 file changed, 4 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
>> index 2ab41cbae45..bc7d2d4234b 100644
>> --- a/drivers/usb/dwc3/dwc3-generic.c
>> +++ b/drivers/usb/dwc3/dwc3-generic.c
>> @@ -7,29 +7,17 @@
>> * Based on dwc3-omap.c.
>> */
>>
>> -#include <cpu_func.h>
>> -#include <log.h>
>> #include <dm.h>
>> -#include <dm/device-internal.h>
>> +#include <reset.h>
>> +#include <asm/gpio.h>
>> #include <dm/lists.h>
>> -#include <dwc3-uboot.h>
>> -#include <generic-phy.h>
>> -#include <linux/bitops.h>
>> #include <linux/delay.h>
>> -#include <linux/printk.h>
>> -#include <linux/usb/ch9.h>
>> #include <linux/usb/gadget.h>
>> -#include <malloc.h>
>> #include <power/regulator.h>
>> -#include <usb.h>
>> -#include "core.h"
>> -#include "gadget.h"
>> -#include <reset.h>
>> -#include <clk.h>
>> #include <usb/xhci.h>
>> -#include <asm/gpio.h>
>> -
>> +#include "core.h"
>> #include "dwc3-generic.h"
>> +#include "gadget.h"
>>
>> struct dwc3_generic_plat {
>> fdt_addr_t base;
>> --
>> 2.25.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 4/9] usb: dwc3-generic: Add STih407 support
2025-01-16 10:24 ` Mattijs Korpershoek
@ 2025-01-20 7:28 ` Patrice CHOTARD
0 siblings, 0 replies; 16+ messages in thread
From: Patrice CHOTARD @ 2025-01-20 7:28 UTC (permalink / raw)
To: Mattijs Korpershoek, u-boot
Cc: Patrick DELAUNAY, U-Boot STM32, Marek Vasut, Caleb Connolly,
Nathan Barrett-Morrison, Oliver Gaskell, Robert Marko,
Sam Protsenko, Simon Glass, Sjoerd Simons, Sumit Garg, Tom Rini
On 1/16/25 11:24, Mattijs Korpershoek wrote:
> Hi Patrice,
>
> Thank you for the patch.
>
> On jeu., janv. 16, 2025 at 09:17, Patrice Chotard <patrice.chotard@foss.st.com> wrote:
>
>> Add STi glue logic to manage the DWC3 HC on STiH407
>> SoC family. It configures the internal glue logic and
>> syscfg registers.
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
>> Cc: Marek Vasut <marex@denx.de>
>>
>> ---
>>
>> Changes in v2:
>> - add dwc3-sti.c DWC3 wrapper as done for dwc3-am62.c
>>
>> MAINTAINERS | 1 +
>> drivers/usb/dwc3/Kconfig | 6 ++
>> drivers/usb/dwc3/Makefile | 1 +
>> drivers/usb/dwc3/dwc3-generic-sti.c | 127 ++++++++++++++++++++++++++++
>> 4 files changed, 135 insertions(+)
>> create mode 100644 drivers/usb/dwc3/dwc3-generic-sti.c
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 8c6c0c2a4bc..5d7e251e601 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -656,6 +656,7 @@ F: drivers/mmc/sti_sdhci.c
>> F: drivers/reset/sti-reset.c
>> F: drivers/serial/serial_sti_asc.c
>> F: drivers/sysreset/sysreset_sti.c
>> +F: drivers/usb/host/dwc3-sti.c
>> F: drivers/timer/arm_global_timer.c
>> F: drivers/usb/host/dwc3-sti-glue.c
>> F: include/dwc3-sti-glue.h
>> diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
>> index 0100723a68b..7d58ae65fb6 100644
>> --- a/drivers/usb/dwc3/Kconfig
>> +++ b/drivers/usb/dwc3/Kconfig
>> @@ -87,6 +87,12 @@ config USB_DWC3_LAYERSCAPE
>> Host and Peripheral operation modes are supported. OTG is not
>> supported.
>>
>> +config USB_DWC3_STI
>> + bool "STi USB wrapper"
>> + depends on DM_USB && USB_DWC3_GENERIC && SYSCON
>> + help
>> + Select this for STi Platforms.
>> +
>> menu "PHY Subsystem"
>>
>> config USB_DWC3_PHY_OMAP
>> diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile
>> index a085c9d4628..985206eafe4 100644
>> --- a/drivers/usb/dwc3/Makefile
>> +++ b/drivers/usb/dwc3/Makefile
>> @@ -15,3 +15,4 @@ obj-$(CONFIG_USB_DWC3_UNIPHIER) += dwc3-uniphier.o
>> obj-$(CONFIG_USB_DWC3_LAYERSCAPE) += dwc3-layerscape.o
>> obj-$(CONFIG_USB_DWC3_PHY_OMAP) += ti_usb_phy.o
>> obj-$(CONFIG_USB_DWC3_PHY_SAMSUNG) += samsung_usb_phy.o
>> +obj-$(CONFIG_USB_DWC3_STI) += dwc3-generic-sti.o
>> diff --git a/drivers/usb/dwc3/dwc3-generic-sti.c b/drivers/usb/dwc3/dwc3-generic-sti.c
>> new file mode 100644
>> index 00000000000..e316e88d2f8
>> --- /dev/null
>> +++ b/drivers/usb/dwc3/dwc3-generic-sti.c
>> @@ -0,0 +1,127 @@
>> +// SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause
>> +/*
>> + * STi specific glue layer for DWC3
>> + *
>> + * Copyright (C) 2025, STMicroelectronics - All Rights Reserved
>> + */
>> +
>> +#include <reset.h>
>> +#include <regmap.h>
>> +#include <syscon.h>
>> +#include <asm/io.h>
>> +#include <dm/device.h>
>> +#include <dm/read.h>
>> +#include <linux/usb/otg.h>
>> +#include "dwc3-generic.h"
>> +
>> +/* glue registers */
>> +#define CLKRST_CTRL 0x00
>> +#define AUX_CLK_EN BIT(0)
>> +#define SW_PIPEW_RESET_N BIT(4)
>> +#define EXT_CFG_RESET_N BIT(8)
>> +
>> +#define XHCI_REVISION BIT(12)
>> +
>> +#define USB2_VBUS_MNGMNT_SEL1 0x2C
>> +#define USB2_VBUS_UTMIOTG 0x1
>> +
>> +#define SEL_OVERRIDE_VBUSVALID(n) ((n) << 0)
>> +#define SEL_OVERRIDE_POWERPRESENT(n) ((n) << 4)
>> +#define SEL_OVERRIDE_BVALID(n) ((n) << 8)
>> +
>> +/* Static DRD configuration */
>> +#define USB3_CONTROL_MASK 0xf77
>> +
>> +#define USB3_DEVICE_NOT_HOST BIT(0)
>> +#define USB3_FORCE_VBUSVALID BIT(1)
>> +#define USB3_DELAY_VBUSVALID BIT(2)
>> +#define USB3_SEL_FORCE_OPMODE BIT(4)
>> +#define USB3_FORCE_OPMODE(n) ((n) << 5)
>> +#define USB3_SEL_FORCE_DPPULLDOWN2 BIT(8)
>> +#define USB3_FORCE_DPPULLDOWN2 BIT(9)
>> +#define USB3_SEL_FORCE_DMPULLDOWN2 BIT(10)
>> +#define USB3_FORCE_DMPULLDOWN2 BIT(11)
>> +
>> +static void dwc3_stih407_glue_configure(struct udevice *dev, int index,
>> + enum usb_dr_mode mode)
>> +{
>> + struct dwc3_glue_data *glue = dev_get_plat(dev);
>> + struct regmap *regmap;
>> + ulong syscfg_base;
>> + ulong syscfg_offset;
>> + ulong glue_base;
>> + int ret;
>> +
>> + /* deassert both powerdown and softreset */
>> + ret = reset_deassert_bulk(&glue->resets);
>> + if (ret) {
>> + debug("reset_deassert_bulk error: %d\n", ret);
>
> Maybe promote this to a warning message? debug() seems a little too low
> priority for an error like this.
Right, i will add a dev_derr() instead.
>
>> + return;
>> + }
>> +
>> + regmap = syscon_regmap_lookup_by_phandle(dev, "st,syscfg");
>
> syscon_regmap_lookup_by_phandle() can fail, in that case, error handling
> should be done with IS_ERR(regmap). Can we add that, please?
>
> Otherwise we might do PTR_ERR->ranges[0].start the line below.
ok
>
>> +
>> + syscfg_base = regmap->ranges[0].start;
>> + glue_base = dev_read_addr_index(dev, 0);
>> + syscfg_offset = dev_read_addr_index(dev, 1);
>> +
>> + clrbits_le32(syscfg_base + syscfg_offset, USB3_CONTROL_MASK);
>> +
>> + /* glue drd init */
>> + switch (mode) {
>> + case USB_DR_MODE_PERIPHERAL:
>> + clrbits_le32(syscfg_base + syscfg_offset,
>> + USB3_DELAY_VBUSVALID | USB3_SEL_FORCE_OPMODE |
>> + USB3_FORCE_OPMODE(0x3) | USB3_SEL_FORCE_DPPULLDOWN2 |
>> + USB3_FORCE_DPPULLDOWN2 | USB3_SEL_FORCE_DMPULLDOWN2 |
>> + USB3_FORCE_DMPULLDOWN2);
>> +
>> + setbits_le32(syscfg_base + syscfg_offset,
>> + USB3_DEVICE_NOT_HOST | USB3_FORCE_VBUSVALID);
>> + break;
>> +
>> + case USB_DR_MODE_HOST:
>> + clrbits_le32(syscfg_base + syscfg_offset,
>> + USB3_DEVICE_NOT_HOST | USB3_FORCE_VBUSVALID |
>> + USB3_SEL_FORCE_OPMODE | USB3_FORCE_OPMODE(0x3) |
>> + USB3_SEL_FORCE_DPPULLDOWN2 | USB3_FORCE_DPPULLDOWN2 |
>> + USB3_SEL_FORCE_DMPULLDOWN2 | USB3_FORCE_DMPULLDOWN2);
>> +
>> + setbits_le32(syscfg_base + syscfg_offset, USB3_DELAY_VBUSVALID);
>> + break;
>> +
>> + default:
>> + debug("Unsupported mode of operation %d\n", mode);
>> + return;
>
> Nitpick, I think that mode being an enum (with a finite number of values
> possibles), we not necessarily have to check if the value is invalid.
> But it's okay for me if this stays the same.
Nevertheless i will replace debug() by dev_err()
Thanks
Patrice
>
>> + }
>> +
>> + /* glue init */
>> + setbits_le32(glue_base + CLKRST_CTRL, AUX_CLK_EN | EXT_CFG_RESET_N | XHCI_REVISION);
>> + clrbits_le32(glue_base + CLKRST_CTRL, SW_PIPEW_RESET_N);
>> +
>> + /* configure mux for vbus, powerpresent and bvalid signals */
>> + setbits_le32(glue_base + USB2_VBUS_MNGMNT_SEL1,
>> + SEL_OVERRIDE_VBUSVALID(USB2_VBUS_UTMIOTG) |
>> + SEL_OVERRIDE_POWERPRESENT(USB2_VBUS_UTMIOTG) |
>> + SEL_OVERRIDE_BVALID(USB2_VBUS_UTMIOTG));
>> + setbits_le32(glue_base + CLKRST_CTRL, SW_PIPEW_RESET_N);
>> +};
>> +
>> +struct dwc3_glue_ops stih407_ops = {
>> + .glue_configure = dwc3_stih407_glue_configure,
>> +};
>> +
>> +static const struct udevice_id dwc3_sti_match[] = {
>> + { .compatible = "st,stih407-dwc3", .data = (ulong)&stih407_ops},
>> + { /* sentinel */ }
>> +};
>> +
>> +U_BOOT_DRIVER(dwc3_sti_wrapper) = {
>> + .name = "dwc3-sti",
>> + .id = UCLASS_SIMPLE_BUS,
>> + .of_match = dwc3_sti_match,
>> + .bind = dwc3_glue_bind,
>> + .probe = dwc3_glue_probe,
>> + .remove = dwc3_glue_remove,
>> + .plat_auto = sizeof(struct dwc3_glue_data),
>> +};
>> --
>> 2.25.1
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2025-01-20 7:31 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-16 8:17 [PATCH v2 0/9] Restore USB and add UMS support for STiH407-B2260 Patrice Chotard
2025-01-16 8:17 ` [PATCH v2 1/9] ARM: dts: sti: Add fixed clock for ehci and ohci nodes in stih410-b2260.dtsi Patrice Chotard
2025-01-16 8:17 ` [PATCH v2 2/9] configs: stih410-b2260: Enable DM_REGULATOR flag Patrice Chotard
2025-01-16 8:17 ` [PATCH v2 3/9] usb: dwc3-generic: Reorder include Patrice Chotard
2025-01-16 10:12 ` Mattijs Korpershoek
2025-01-20 7:20 ` Patrice CHOTARD
2025-01-16 8:17 ` [PATCH v2 4/9] usb: dwc3-generic: Add STih407 support Patrice Chotard
2025-01-16 10:24 ` Mattijs Korpershoek
2025-01-20 7:28 ` Patrice CHOTARD
2025-01-16 8:17 ` [PATCH v2 5/9] configs: stih410-b2260: Enable USB_DWC3_GENERIC and USB_DWC3_STI flags Patrice Chotard
2025-01-16 8:17 ` [PATCH v2 6/9] usb: dwc3: Remove dwc3 glue driver support for STi Patrice Chotard
2025-01-16 10:25 ` Mattijs Korpershoek
2025-01-16 8:17 ` [PATCH v2 7/9] configs: stih410-b2260: Enable DM_USB_GADGET flag Patrice Chotard
2025-01-16 8:17 ` [PATCH v2 8/9] board: stih410-b2260: Remove board_usb_init/cleanup() Patrice Chotard
2025-01-16 10:15 ` Mattijs Korpershoek
2025-01-16 8:17 ` [PATCH v2 9/9] configs: stih410-b2260: Enable CMD_USB_MASS_STORAGE flag Patrice Chotard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox