All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: dwc3-generic: support i.MX flattened DT
@ 2026-12-04 15:15 Advait Dhamorikar
  2026-12-04 19:08 ` Francesco Dolcini
  0 siblings, 1 reply; 2+ messages in thread
From: Advait Dhamorikar @ 2026-12-04 15:15 UTC (permalink / raw)
  To: Marek Vasut, u-boot
  Cc: Stefan Eichenberger, Xu Yang, Fabio Estevam, Stefano Babic,
	NXP i . MX U-Boot Team, Advait Dhamorikar

The i.MX95 devicetree doesn't use a glue node with dwc3 as a
subnode and now has a single flattened "nxp,imx95-dwc3/imx8mp-dwc3"
node, with the register regions described by reg-names. The i.MX8MP
devicetree too is expected to move to the same binding.

Reuse the existing glue_get_ctrl_dev op to bind dwc3 to the glue node
itself, and look up the glue registers by name when using the new
binding.

Tested on the i.MX95 Mecha Comet.

Link: https://lore.kernel.org/all/20260427082728.3641872-2-xu.yang_2@nxp.com/
Signed-off-by: Advait Dhamorikar <advaitd@mechasystems.com>
---
 drivers/usb/dwc3/dwc3-generic.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
index 2406f844617..aba69681ba2 100644
--- a/drivers/usb/dwc3/dwc3-generic.c
+++ b/drivers/usb/dwc3/dwc3-generic.c
@@ -325,10 +325,22 @@ void dwc3_imx8mp_glue_configure(struct udevice *dev, int index,
 
 #define USB_CTRL1_OC_POLARITY	BIT(16) /* 0 - HIGH / 1 - LOW */
 #define USB_CTRL1_PWR_POLARITY	BIT(17) /* 0 - HIGH / 1 - LOW */
-	fdt_addr_t regs = dev_read_addr_index(dev, 1);
-	void *base = map_physmem(regs, 0x8, MAP_NOCACHE);
+	fdt_addr_t regs;
+	void *base;
 	u32 value;
 
+	if (device_is_compatible(dev, "nxp,imx8mp-dwc3"))
+		regs = dev_read_addr_name(dev, "glue");
+	else
+		regs = dev_read_addr_index(dev, 1);
+
+	if (regs == FDT_ADDR_T_NONE) {
+		dev_err(dev, "missing glue registers\n");
+		return;
+	}
+
+	base = map_physmem(regs, 0x8, MAP_NOCACHE);
+
 	value = readl(base + USB_CTRL0);
 
 	if (dev_read_bool(dev, "fsl,permanently-attached"))
@@ -548,6 +560,11 @@ static const struct dwc3_glue_ops rk_ops = {
 	.glue_get_ctrl_dev = dwc3_flat_dt_get_ctrl_dev,
 };
 
+static const struct dwc3_glue_ops imx8mp_flat_dt_ops = {
+	.glue_configure = dwc3_imx8mp_glue_configure,
+	.glue_get_ctrl_dev = dwc3_flat_dt_get_ctrl_dev,
+};
+
 static int dwc3_glue_bind_common(struct udevice *parent, ofnode node)
 {
 	const char *name = ofnode_get_name(node);
@@ -758,6 +775,7 @@ static const struct udevice_id dwc3_glue_ids[] = {
 	{ .compatible = "qcom,dwc3", .data = (ulong)&qcom_ops },
 	{ .compatible = "qcom,snps-dwc3", .data = (ulong)&qcom_flat_dt_ops },
 	{ .compatible = "fsl,imx8mp-dwc3", .data = (ulong)&imx8mp_ops },
+	{ .compatible = "nxp,imx8mp-dwc3", .data = (ulong)&imx8mp_flat_dt_ops },
 	{ .compatible = "fsl,imx8mq-dwc3" },
 	{ .compatible = "intel,tangier-dwc3" },
 	{ .compatible = "samsung,exynos7870-dwusb3" },
-- 
2.56.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: dwc3-generic: support i.MX flattened DT
  2026-12-04 15:15 [PATCH] usb: dwc3-generic: support i.MX flattened DT Advait Dhamorikar
@ 2026-12-04 19:08 ` Francesco Dolcini
  0 siblings, 0 replies; 2+ messages in thread
From: Francesco Dolcini @ 2026-12-04 19:08 UTC (permalink / raw)
  To: Advait Dhamorikar
  Cc: Marek Vasut, u-boot, Stefan Eichenberger, Xu Yang, Fabio Estevam,
	Stefano Babic, NXP i . MX U-Boot Team

On Fri, Dec 04, 2026 at 08:45:37PM +0530, Advait Dhamorikar wrote:
> The i.MX8MP devicetree too is expected to move to the same binding.

Not anymore

  Due to the compatibility issue, we give up on merging this patchset at
  the end.

from https://lore.kernel.org/all/wsvzr6sl6xg3j7oqn24ohjoi2shftat3lxc4nl5j4gazax2ham@oz5c3jjyboxf/

Francesco


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-04 19:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 15:15 [PATCH] usb: dwc3-generic: support i.MX flattened DT Advait Dhamorikar
2026-12-04 19:08 ` Francesco Dolcini

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.