From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Patrice Chotard <patrice.chotard@foss.st.com>, u-boot@lists.denx.de
Cc: Patrice CHOTARD <patrice.chotard@foss.st.com>,
Patrick DELAUNAY <patrick.delaunay@foss.st.com>,
U-Boot STM32 <uboot-stm32@st-md-mailman.stormreply.com>,
Marek Vasut <marex@denx.de>,
Caleb Connolly <caleb.connolly@linaro.org>,
Fabio Estevam <festevam@gmail.com>,
Jonas Karlman <jonas@kwiboo.se>,
Kever Yang <kever.yang@rock-chips.com>,
Mathieu Othacehe <othacehe@gnu.org>,
Nathan Barrett-Morrison <nathan.morrison@timesys.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Oliver Gaskell <Oliver.Gaskell@analog.com>,
Patrick Rudolph <patrick.rudolph@9elements.com>,
Paul Barker <paul.barker.ct@bp.renesas.com>,
Robert Marko <robert.marko@sartura.hr>,
Sam Protsenko <semen.protsenko@linaro.org>,
Simon Glass <sjg@chromium.org>,
Sumit Garg <sumit.garg@linaro.org>, Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH v2 6/9] usb: dwc3: Remove dwc3 glue driver support for STi
Date: Thu, 16 Jan 2025 11:25:42 +0100 [thread overview]
Message-ID: <87y0zb6ont.fsf@baylibre.com> (raw)
In-Reply-To: <20250116081738.2511223-7-patrice.chotard@foss.st.com>
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
next prev parent reply other threads:[~2025-01-16 10:25 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y0zb6ont.fsf@baylibre.com \
--to=mkorpershoek@baylibre.com \
--cc=Oliver.Gaskell@analog.com \
--cc=caleb.connolly@linaro.org \
--cc=festevam@gmail.com \
--cc=jonas@kwiboo.se \
--cc=kever.yang@rock-chips.com \
--cc=marex@denx.de \
--cc=nathan.morrison@timesys.com \
--cc=neil.armstrong@linaro.org \
--cc=othacehe@gnu.org \
--cc=patrice.chotard@foss.st.com \
--cc=patrick.delaunay@foss.st.com \
--cc=patrick.rudolph@9elements.com \
--cc=paul.barker.ct@bp.renesas.com \
--cc=robert.marko@sartura.hr \
--cc=semen.protsenko@linaro.org \
--cc=sjg@chromium.org \
--cc=sumit.garg@linaro.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=uboot-stm32@st-md-mailman.stormreply.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.