All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] usb: ehci-vf: take the register bases from the device tree
@ 2026-08-20  7:15 Mehmet Fide
  2026-08-20  7:15 ` [PATCH v2 1/4] usb: ehci-vf: remove the code path for a build without DM_USB Mehmet Fide
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Mehmet Fide @ 2026-08-20  7:15 UTC (permalink / raw)
  To: Marek Vasut, Simon Glass; +Cc: Tom Rini, u-boot, Mehmet Fide

From: Mehmet Fide <mehmet.fide@screeningeagle.com>

Review of v1 asked for three things and they are all here.

Marek asked whether the code path removed in patch 1 is used in SPL
without DM_USB. The question is a fair one, because the select of DM_USB
that USB_EHCI_HCD does only covers U-Boot proper: in an SPL build
CONFIG_IS_ENABLED(DM_USB) reads CONFIG_SPL_DM_USB, so a board could take
that path there. No build can, though. The driver depends on ARCH_VF610,
five boards select it, drivers/Makefile builds usb/host/ for SPL only
when SPL_USB_HOST is set, and none of the five sets it or CONFIG_SPL at
all. The path also does not compile, which is how it stayed unnoticed.

Patch 2 carries the two Fixes tags Marek pointed at.

Patch 4 no longer uses fdtdec. v1 did, because that is what ehci-mx6
does in mx6_parse_dt_addrs(), but the livetree calls are what review
asked for and the driver now has none of the flat tree API left, not
even the include.

One piece was missing for that. The alias of a node reached through a
phandle could not be read with the livetree API at all: dev_read_alias_seq()
wants a device, of_alias_get_id() wants a live tree and these boards run
a flat one, and ofnode_get_aliases_node() answers the other direction.
Only fdtdec could do it. That gap has stood because the need is rare -
ehci-mx6 is the only driver in the tree that ever asked for the alias of
a node it does not own, and it reached for fdtdec. Patch 3 moves the body
of dev_read_alias_seq() down to the ofnode level and lets both of its
variants call it, so patch 4 has a livetree call to use. It is a pure
move, no functional change.

Testing. test/py on sandbox, before and after patch 3: 11 failed, 414
passed, 210 skipped, 1 xfailed, 20 errors, the same failures both times,
all of them from tools and images missing in my environment.

On a Colibri VF50 V1.2A on an Iris carrier, U-Boot 2026.07 from NAND:
"usb start" brings the host controller up and enumerates the root hub,
and Linux still boots with Ethernet, SD card and USB working.

v1: https://lore.kernel.org/u-boot/20260819093705.4143509-1-mehmet.fide@gmail.com/

Mehmet Fide (4):
  usb: ehci-vf: remove the code path for a build without DM_USB
  usb: ehci-vf: drop the empty bind hook
  dm: core: add ofnode_get_alias_seq()
  usb: ehci-vf: take the register bases from the device tree

 drivers/core/ofnode.c      |  20 +++++
 drivers/core/read.c        |  20 +----
 drivers/usb/host/ehci-vf.c | 178 +++++++++++++------------------------
 include/dm/ofnode.h        |  14 +++
 include/dm/read.h          |   8 +-
 5 files changed, 102 insertions(+), 138 deletions(-)

-- 
2.54.0


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

* [PATCH v2 1/4] usb: ehci-vf: remove the code path for a build without DM_USB
  2026-08-20  7:15 [PATCH v2 0/4] usb: ehci-vf: take the register bases from the device tree Mehmet Fide
@ 2026-08-20  7:15 ` Mehmet Fide
  2026-08-20  7:15 ` [PATCH v2 2/4] usb: ehci-vf: drop the empty bind hook Mehmet Fide
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Mehmet Fide @ 2026-08-20  7:15 UTC (permalink / raw)
  To: Marek Vasut, Simon Glass; +Cc: Tom Rini, u-boot, Mehmet Fide

From: Mehmet Fide <mehmet.fide@screeningeagle.com>

USB_EHCI_HCD selects DM_USB, so the !CONFIG_IS_ENABLED(DM_USB) branch of
this driver can never be selected. It also cannot compile: ehci_hcd_init()
calls ehci_vf_common_init() with one argument while the function takes
two, so the branch has been dead since the controller was added as a
second parameter.

Remove it, together with the board_usb_phy_mode() hook that no board
implements and nothing else calls.

Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
---
 drivers/usb/host/ehci-vf.c | 49 --------------------------------------
 1 file changed, 49 deletions(-)

diff --git a/drivers/usb/host/ehci-vf.c b/drivers/usb/host/ehci-vf.c
index 32fe05920d0..5d27318de62 100644
--- a/drivers/usb/host/ehci-vf.c
+++ b/drivers/usb/host/ehci-vf.c
@@ -128,11 +128,6 @@ static void usb_oc_config(int index)
 	setbits_le32(ctrl, UCTRL_OVER_CUR_DIS);
 }
 
-int __weak board_usb_phy_mode(int port)
-{
-	return 0;
-}
-
 int __weak board_ehci_hcd_init(int port)
 {
 	return 0;
@@ -155,49 +150,6 @@ int ehci_vf_common_init(struct usb_ehci *ehci, int index)
 	return 0;
 }
 
-#if !CONFIG_IS_ENABLED(DM_USB)
-int ehci_hcd_init(int index, enum usb_init_type init,
-		struct ehci_hccr **hccr, struct ehci_hcor **hcor)
-{
-	struct usb_ehci *ehci;
-	enum usb_init_type type;
-	int ret;
-
-	if (index >= ARRAY_SIZE(nc_reg_bases))
-		return -EINVAL;
-
-	ehci = (struct usb_ehci *)nc_reg_bases[index];
-
-	ret = ehci_vf_common_init(index);
-	if (ret)
-		return ret;
-
-	*hccr = (struct ehci_hccr *)((uint32_t)&ehci->caplength);
-	*hcor = (struct ehci_hcor *)((uint32_t)*hccr +
-			HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase)));
-
-	type = board_usb_phy_mode(index);
-	if (type != init)
-		return -ENODEV;
-
-	if (init == USB_INIT_DEVICE) {
-		setbits_le32(&ehci->usbmode, CM_DEVICE);
-		writel((PORT_PTS_UTMI | PORT_PTS_PTW), &ehci->portsc);
-		setbits_le32(&ehci->portsc, USB_EN);
-	} else if (init == USB_INIT_HOST) {
-		setbits_le32(&ehci->usbmode, CM_HOST);
-		writel((PORT_PTS_UTMI | PORT_PTS_PTW), &ehci->portsc);
-		setbits_le32(&ehci->portsc, USB_EN);
-	}
-
-	return 0;
-}
-
-int ehci_hcd_stop(int index)
-{
-	return 0;
-}
-#else
 /* Possible port types (dual role mode) */
 enum dr_mode {
 	DR_MODE_NONE = 0,
@@ -372,4 +324,3 @@ U_BOOT_DRIVER(ehci_vf) = {
 	.priv_auto	= sizeof(struct ehci_vf_priv_data),
 	.flags = DM_FLAG_ALLOC_PRIV_DMA,
 };
-#endif
-- 
2.54.0


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

* [PATCH v2 2/4] usb: ehci-vf: drop the empty bind hook
  2026-08-20  7:15 [PATCH v2 0/4] usb: ehci-vf: take the register bases from the device tree Mehmet Fide
  2026-08-20  7:15 ` [PATCH v2 1/4] usb: ehci-vf: remove the code path for a build without DM_USB Mehmet Fide
@ 2026-08-20  7:15 ` Mehmet Fide
  2026-08-20  7:15 ` [PATCH v2 3/4] dm: core: add ofnode_get_alias_seq() Mehmet Fide
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Mehmet Fide @ 2026-08-20  7:15 UTC (permalink / raw)
  To: Marek Vasut, Simon Glass; +Cc: Tom Rini, u-boot, Mehmet Fide

From: Mehmet Fide <mehmet.fide@screeningeagle.com>

vf_usb_bind() only returns 0. Its comment describes a hack that keeps
the second controller from taking sequence number 0, but no such code
is there, and an empty .bind cannot influence the numbering the uclass
does. Remove it.

Fixes: 0885cdb9d154 ("usb: host: ehci-vf: Migrate Vybrid USB to driver model")
Fixes: b27347f425f7 ("usb: Update for new sequence numbers")
Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
---
 drivers/usb/host/ehci-vf.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/drivers/usb/host/ehci-vf.c b/drivers/usb/host/ehci-vf.c
index 5d27318de62..e5f9ec0fdbb 100644
--- a/drivers/usb/host/ehci-vf.c
+++ b/drivers/usb/host/ehci-vf.c
@@ -261,20 +261,6 @@ static const struct ehci_ops vf_ehci_ops = {
 	.init_after_reset = vf_init_after_reset
 };
 
-static int vf_usb_bind(struct udevice *dev)
-{
-	/*
-	 * Without this hack, if we return ENODEV for USB Controller 0, on
-	 * probe for the next controller, USB Controller 1 will be given a
-	 * sequence number of 0. This conflicts with our requirement of
-	 * sequence numbers while initialising the peripherals.
-	 *
-	 * FIXME: Check that this still works OK with the new sequence numbers
-	 */
-
-	return 0;
-}
-
 static int ehci_usb_probe(struct udevice *dev)
 {
 	struct usb_plat *plat = dev_get_plat(dev);
@@ -315,7 +301,6 @@ U_BOOT_DRIVER(ehci_vf) = {
 	.name = "ehci_vf",
 	.id = UCLASS_USB,
 	.of_match = vf_usb_ids,
-	.bind = vf_usb_bind,
 	.probe = ehci_usb_probe,
 	.remove = ehci_deregister,
 	.ops = &ehci_usb_ops,
-- 
2.54.0


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

* [PATCH v2 3/4] dm: core: add ofnode_get_alias_seq()
  2026-08-20  7:15 [PATCH v2 0/4] usb: ehci-vf: take the register bases from the device tree Mehmet Fide
  2026-08-20  7:15 ` [PATCH v2 1/4] usb: ehci-vf: remove the code path for a build without DM_USB Mehmet Fide
  2026-08-20  7:15 ` [PATCH v2 2/4] usb: ehci-vf: drop the empty bind hook Mehmet Fide
@ 2026-08-20  7:15 ` Mehmet Fide
  2026-08-20  7:15 ` [PATCH v2 4/4] usb: ehci-vf: take the register bases from the device tree Mehmet Fide
  2026-08-21  0:29 ` [PATCH v2 0/4] " Marek Vasut
  4 siblings, 0 replies; 7+ messages in thread
From: Mehmet Fide @ 2026-08-20  7:15 UTC (permalink / raw)
  To: Marek Vasut, Simon Glass; +Cc: Tom Rini, u-boot, Mehmet Fide

From: Mehmet Fide <mehmet.fide@screeningeagle.com>

The sequence number an aliases entry gives a node can only be looked up
for a device, through dev_read_alias_seq(). A driver that has to know
the number of a node it does not own, one it reached through a phandle
for instance, has no livetree call for it and is left with fdtdec.

Move the body of dev_read_alias_seq() to the ofnode level and let both
of its variants call it. No functional change, so the moved lines keep
the ENOTSUPP return, the #if and the fdtdec call they had, which is what
checkpatch complains about here.

Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
---
 drivers/core/ofnode.c | 20 ++++++++++++++++++++
 drivers/core/read.c   | 20 ++------------------
 include/dm/ofnode.h   | 14 ++++++++++++++
 include/dm/read.h     |  8 ++------
 4 files changed, 38 insertions(+), 24 deletions(-)

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index b5d13c43db1..81d91ce5476 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -1233,6 +1233,26 @@ ofnode ofnode_get_aliases_node(const char *name)
 	return ofnode_path(prop);
 }
 
+int ofnode_get_alias_seq(ofnode node, const char *stem, int *seqp)
+{
+	int ret = -ENOTSUPP;
+
+	if (ofnode_is_np(node)) {
+		ret = of_alias_get_id(ofnode_to_np(node), stem);
+		if (ret >= 0) {
+			*seqp = ret;
+			ret = 0;
+		}
+	} else {
+#if CONFIG_IS_ENABLED(OF_CONTROL)
+		ret = fdtdec_get_alias_seq(ofnode_to_fdt(node), stem,
+					   ofnode_to_offset(node), seqp);
+#endif
+	}
+
+	return ret;
+}
+
 int ofnode_get_child_count(ofnode parent)
 {
 	ofnode child;
diff --git a/drivers/core/read.c b/drivers/core/read.c
index ba48862f44b..985f6128d97 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -356,24 +356,8 @@ const void *dev_read_prop_by_prop(struct ofprop *prop,
 
 int dev_read_alias_seq(const struct udevice *dev, int *devnump)
 {
-	ofnode node = dev_ofnode(dev);
-	const char *uc_name = dev->uclass->uc_drv->name;
-	int ret = -ENOTSUPP;
-
-	if (ofnode_is_np(node)) {
-		ret = of_alias_get_id(ofnode_to_np(node), uc_name);
-		if (ret >= 0) {
-			*devnump = ret;
-			ret = 0;
-		}
-	} else {
-#if CONFIG_IS_ENABLED(OF_CONTROL)
-		ret = fdtdec_get_alias_seq(gd->fdt_blob, uc_name,
-					   ofnode_to_offset(node), devnump);
-#endif
-	}
-
-	return ret;
+	return ofnode_get_alias_seq(dev_ofnode(dev),
+				    dev->uclass->uc_drv->name, devnump);
 }
 
 int dev_read_u32_array(const struct udevice *dev, const char *propname,
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index c905e86b283..2363ca0ed33 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -1180,6 +1180,20 @@ const void *ofnode_read_aliases_prop(const char *propname, int *sizep);
  */
 ofnode ofnode_get_aliases_node(const char *propname);
 
+/**
+ * ofnode_get_alias_seq() - get the sequence number of a node from its alias
+ *
+ * The aliases node can name a node with a stem and a number, such as
+ * "serial2". This looks the node up and returns the number.
+ *
+ * @node: Node to look for
+ * @stem: Alias stem, e.g. "serial"
+ * @seqp: Returns the sequence number of the alias, if found
+ * Return: 0 if found, -ENOENT if the node has no such alias, -ENOTSUPP if
+ * there is no device tree to look in
+ */
+int ofnode_get_alias_seq(ofnode node, const char *stem, int *seqp);
+
 struct display_timing;
 /**
  * ofnode_decode_display_timing() - decode display timings
diff --git a/include/dm/read.h b/include/dm/read.h
index 12dcde6645c..d0c17c3d343 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -1168,12 +1168,8 @@ static inline const void *dev_read_prop_by_prop(struct ofprop *prop,
 
 static inline int dev_read_alias_seq(const struct udevice *dev, int *devnump)
 {
-#if CONFIG_IS_ENABLED(OF_CONTROL)
-	return fdtdec_get_alias_seq(gd->fdt_blob, dev->uclass->uc_drv->name,
-				    dev_of_offset(dev), devnump);
-#else
-	return -ENOTSUPP;
-#endif
+	return ofnode_get_alias_seq(dev_ofnode(dev),
+				    dev->uclass->uc_drv->name, devnump);
 }
 
 static inline int dev_read_u32_array(const struct udevice *dev,
-- 
2.54.0


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

* [PATCH v2 4/4] usb: ehci-vf: take the register bases from the device tree
  2026-08-20  7:15 [PATCH v2 0/4] usb: ehci-vf: take the register bases from the device tree Mehmet Fide
                   ` (2 preceding siblings ...)
  2026-08-20  7:15 ` [PATCH v2 3/4] dm: core: add ofnode_get_alias_seq() Mehmet Fide
@ 2026-08-20  7:15 ` Mehmet Fide
  2026-08-21  0:29 ` [PATCH v2 0/4] " Marek Vasut
  4 siblings, 0 replies; 7+ messages in thread
From: Mehmet Fide @ 2026-08-20  7:15 UTC (permalink / raw)
  To: Marek Vasut, Simon Glass; +Cc: Tom Rini, u-boot, Mehmet Fide

From: Mehmet Fide <mehmet.fide@screeningeagle.com>

The driver keeps its own tables of PHY and controller base addresses and
indexes them with a port number, and it reaches the anatop block through
a hardcoded address. The device tree describes all three: the controller
points at its PHY and its usbmisc block, and the PHY points at the
anatop it uses.

Read them from there and drop the tables. The port number stays for the
one thing the device tree does not express, the choice between PLL3 and
PLL7, and it now comes from the alias of the PHY node instead of the
sequence number of the controller.

Note that the usbmisc node already starts at the non-core registers, so
the driver no longer adds an offset of its own to reach them.

The previous version of this patch did the same through fdtdec, because
that is what ehci-mx6 does in mx6_parse_dt_addrs(); this one uses the
livetree calls instead, as asked in review.

Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
---
 drivers/usb/host/ehci-vf.c | 140 ++++++++++++++++++++-----------------
 1 file changed, 77 insertions(+), 63 deletions(-)

diff --git a/drivers/usb/host/ehci-vf.c b/drivers/usb/host/ehci-vf.c
index e5f9ec0fdbb..6c9866bfa5f 100644
--- a/drivers/usb/host/ehci-vf.c
+++ b/drivers/usb/host/ehci-vf.c
@@ -22,12 +22,9 @@
 #include <linux/delay.h>
 #include <usb/ehci-ci.h>
 #include <linux/libfdt.h>
-#include <fdtdec.h>
 
 #include "ehci.h"
 
-#define USB_NC_REG_OFFSET				0x00000800
-
 #define ANADIG_PLL_CTRL_EN_USB_CLKS		(1 << 6)
 
 #define UCTRL_OVER_CUR_POL	(1 << 8) /* OTG Polarity of Overcurrent */
@@ -39,28 +36,33 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static const unsigned phy_bases[] = {
-	USB_PHY0_BASE_ADDR,
-	USB_PHY1_BASE_ADDR,
+/* Possible port types (dual role mode) */
+enum dr_mode {
+	DR_MODE_NONE = 0,
+	DR_MODE_HOST,		/* supports host operation */
+	DR_MODE_DEVICE,		/* supports device operation */
+	DR_MODE_OTG,		/* supports both */
 };
 
-static const unsigned nc_reg_bases[] = {
-	USBC0_BASE_ADDR,
-	USBC1_BASE_ADDR,
+struct ehci_vf_priv_data {
+	struct ehci_ctrl ctrl;
+	struct usb_ehci *ehci;
+	struct gpio_desc cdet_gpio;
+	enum usb_init_type init_type;
+	enum dr_mode dr_mode;
+	struct anadig_reg __iomem *anatop_addr;
+	void __iomem *phy_addr;
+	void __iomem *misc_addr;
+	int portnr;
 };
 
-static void usb_internal_phy_clock_gate(int index)
+static void usb_internal_phy_clock_gate(void __iomem *phy_reg)
 {
-	void __iomem *phy_reg;
-
-	phy_reg = (void __iomem *)phy_bases[index];
 	clrbits_le32(phy_reg + USBPHY_CTRL, USBPHY_CTRL_CLKGATE);
 }
 
-static void usb_power_config(int index)
+static void usb_power_config(struct anadig_reg __iomem *anadig, int index)
 {
-	struct anadig_reg __iomem *anadig =
-		(struct anadig_reg __iomem *)ANADIG_BASE_ADDR;
 	void __iomem *pll_ctrl;
 
 	switch (index) {
@@ -83,13 +85,11 @@ static void usb_power_config(int index)
 	}
 }
 
-static void usb_phy_enable(int index, struct usb_ehci *ehci)
+static void usb_phy_enable(void __iomem *phy_reg, struct usb_ehci *ehci)
 {
-	void __iomem *phy_reg;
 	void __iomem *phy_ctrl;
 	void __iomem *usb_cmd;
 
-	phy_reg = (void __iomem *)phy_bases[index];
 	phy_ctrl = (void __iomem *)(phy_reg + USBPHY_CTRL);
 	usb_cmd = (void __iomem *)&ehci->usbcmd;
 
@@ -118,12 +118,8 @@ static void usb_phy_enable(int index, struct usb_ehci *ehci)
 		 USBPHY_CTRL_ENUTMILEVEL3);
 }
 
-static void usb_oc_config(int index)
+static void usb_oc_config(void __iomem *ctrl)
 {
-	void __iomem *ctrl;
-
-	ctrl = (void __iomem *)(nc_reg_bases[index] + USB_NC_REG_OFFSET);
-
 	setbits_le32(ctrl, UCTRL_OVER_CUR_POL);
 	setbits_le32(ctrl, UCTRL_OVER_CUR_DIS);
 }
@@ -133,63 +129,81 @@ int __weak board_ehci_hcd_init(int port)
 	return 0;
 }
 
-int ehci_vf_common_init(struct usb_ehci *ehci, int index)
+static int ehci_vf_common_init(struct ehci_vf_priv_data *priv)
 {
 	int ret;
 
 	/* Do board specific initialisation */
-	ret = board_ehci_hcd_init(index);
+	ret = board_ehci_hcd_init(priv->portnr);
 	if (ret)
 		return ret;
 
-	usb_power_config(index);
-	usb_oc_config(index);
-	usb_internal_phy_clock_gate(index);
-	usb_phy_enable(index, ehci);
+	usb_power_config(priv->anatop_addr, priv->portnr);
+	usb_oc_config(priv->misc_addr);
+	usb_internal_phy_clock_gate(priv->phy_addr);
+	usb_phy_enable(priv->phy_addr, priv->ehci);
 
 	return 0;
 }
 
-/* Possible port types (dual role mode) */
-enum dr_mode {
-	DR_MODE_NONE = 0,
-	DR_MODE_HOST,		/* supports host operation */
-	DR_MODE_DEVICE,		/* supports device operation */
-	DR_MODE_OTG,		/* supports both */
-};
-
-struct ehci_vf_priv_data {
-	struct ehci_ctrl ctrl;
-	struct usb_ehci *ehci;
-	struct gpio_desc cdet_gpio;
-	enum usb_init_type init_type;
-	enum dr_mode dr_mode;
-	u32 portnr;
-};
-
-static int vf_usb_of_to_plat(struct udevice *dev)
+static int vf_parse_dt_addrs(struct udevice *dev)
 {
 	struct ehci_vf_priv_data *priv = dev_get_priv(dev);
-	const void *dt_blob = gd->fdt_blob;
-	int node = dev_of_offset(dev);
-	const char *mode;
-	fdt_addr_t phy_addr;
-	ofnode phy_node;
-	int i;
+	ofnode phy_node, misc_node, anatop_node;
+	fdt_addr_t addr;
+	int ret;
 
 	phy_node = ofnode_parse_phandle(dev_ofnode(dev), "fsl,usbphy", 0);
 	if (!ofnode_valid(phy_node))
 		return -EINVAL;
 
-	phy_addr = ofnode_get_addr(phy_node);
-	for (i = 0; i < ARRAY_SIZE(phy_bases); i++) {
-		if (phy_addr == phy_bases[i])
-			break;
-	}
-	if (i == ARRAY_SIZE(phy_bases))
+	misc_node = ofnode_parse_phandle(dev_ofnode(dev), "fsl,usbmisc", 0);
+	if (!ofnode_valid(misc_node))
+		return -EINVAL;
+
+	/* the anatop the PHY uses holds the PLL that feeds this port */
+	anatop_node = ofnode_parse_phandle(phy_node, "fsl,anatop", 0);
+	if (!ofnode_valid(anatop_node))
+		return -EINVAL;
+
+	/*
+	 * The PHYs are the only USB nodes the device tree gives an alias, and
+	 * their numbering is the port numbering the PLL selection needs.
+	 */
+	ret = ofnode_get_alias_seq(phy_node, dev->uclass->uc_drv->name,
+				   &priv->portnr);
+	if (ret)
+		return ret;
+
+	addr = ofnode_get_addr(phy_node);
+	if (addr == FDT_ADDR_T_NONE)
+		return -EINVAL;
+	priv->phy_addr = (void __iomem *)addr;
+
+	addr = ofnode_get_addr(misc_node);
+	if (addr == FDT_ADDR_T_NONE)
 		return -EINVAL;
+	priv->misc_addr = (void __iomem *)addr;
 
-	priv->portnr = i;
+	addr = ofnode_get_addr(anatop_node);
+	if (addr == FDT_ADDR_T_NONE)
+		return -EINVAL;
+	priv->anatop_addr = (struct anadig_reg __iomem *)addr;
+
+	return 0;
+}
+
+static int vf_usb_of_to_plat(struct udevice *dev)
+{
+	struct ehci_vf_priv_data *priv = dev_get_priv(dev);
+	const void *dt_blob = gd->fdt_blob;
+	int node = dev_of_offset(dev);
+	const char *mode;
+	int ret;
+
+	ret = vf_parse_dt_addrs(dev);
+	if (ret)
+		return ret;
 
 	priv->ehci = dev_read_addr_ptr(dev);
 	mode = fdt_getprop(dt_blob, node, "dr_mode", NULL);
@@ -241,7 +255,7 @@ static int vf_init_after_reset(struct ehci_ctrl *dev)
 	struct usb_ehci *ehci = priv->ehci;
 	int ret;
 
-	ret = ehci_vf_common_init(priv->ehci, priv->portnr);
+	ret = ehci_vf_common_init(priv);
 	if (ret)
 		return ret;
 
@@ -270,7 +284,7 @@ static int ehci_usb_probe(struct udevice *dev)
 	struct ehci_hcor *hcor;
 	int ret;
 
-	ret = ehci_vf_common_init(ehci, priv->portnr);
+	ret = ehci_vf_common_init(priv);
 	if (ret)
 		return ret;
 
-- 
2.54.0


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

* Re: [PATCH v2 0/4] usb: ehci-vf: take the register bases from the device tree
  2026-08-20  7:15 [PATCH v2 0/4] usb: ehci-vf: take the register bases from the device tree Mehmet Fide
                   ` (3 preceding siblings ...)
  2026-08-20  7:15 ` [PATCH v2 4/4] usb: ehci-vf: take the register bases from the device tree Mehmet Fide
@ 2026-08-21  0:29 ` Marek Vasut
  2026-08-21  5:56   ` Mehmet Fide
  4 siblings, 1 reply; 7+ messages in thread
From: Marek Vasut @ 2026-08-21  0:29 UTC (permalink / raw)
  To: Mehmet Fide, Marek Vasut, Simon Glass; +Cc: Tom Rini, u-boot, Mehmet Fide

On 8/20/26 9:15 AM, Mehmet Fide wrote:
> From: Mehmet Fide <mehmet.fide@screeningeagle.com>
> 
> Review of v1 asked for three things and they are all here.
Can you please respond to the feedback before sending new versions of 
patches daily, and please consider whether or not the feedback applies 
to other parts of the patches too (e.g. whether you have to handle 
ENOSYS or other return values all over the place). Thank you

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

* Re: [PATCH v2 0/4] usb: ehci-vf: take the register bases from the device tree
  2026-08-21  0:29 ` [PATCH v2 0/4] " Marek Vasut
@ 2026-08-21  5:56   ` Mehmet Fide
  0 siblings, 0 replies; 7+ messages in thread
From: Mehmet Fide @ 2026-08-21  5:56 UTC (permalink / raw)
  To: Marek Vasut; +Cc: Mehmet Fide, Simon Glass, Tom Rini, u-boot

Hello Marek,

Please forgive my eagerness. Your reviews made valid points, and my way
of answering them was to fold the answers into the cover letter and
post fixed patches right away. From now on I will proceed the way you
describe: reply in the thread first and let the review settle before a
new version goes out, with per-patch changelogs below the --- line
rather than in the cover letter.

To put the answers where they belong:

- SPL without DM_USB (v1 1/3): no build of this driver can take that
  path. drivers/Makefile builds usb/host/ for SPL only when
  SPL_USB_HOST is set, and none of the five boards selecting
  ARCH_VF610 sets it, or CONFIG_SPL at all. The removed branch also
  does not compile, which is how it went unnoticed.

- The two Fixes tags (v1 2/3): both added in v2 2/4, thank you.

- fdtdec (v1 3/3): v2 4/4 uses the livetree calls throughout and the
  driver no longer includes fdtdec.h. The alias of a phandle-referenced
  node had no livetree accessor, so v2 3/4 moves the body of
  dev_read_alias_seq() down to the ofnode level; if you would rather
  see a different shape for that helper, I am happy to adjust.

- -ENOMEM from the regulator lookup (v2 2/2): v3 2/2 tolerates only
  -ENOENT (no vbus-supply) and -ENOSYS (no DM_REGULATOR, which is the
  case for four of the five vf610 boards) and fails the probe on
  anything else.

On applying the feedback throughout: I checked every return value the
series handles. The five DT parse failures all fail the probe, and the
enable path fails it on anything but -ENOSYS. The one place a return
value is ignored is the regulator disable in ehci_usb_remove(), left
best-effort on teardown as in ehci-mx6 - say the word if you would
rather have it logged.

Best regards,
Mehmet

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

end of thread, other threads:[~2026-08-21  5:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-20  7:15 [PATCH v2 0/4] usb: ehci-vf: take the register bases from the device tree Mehmet Fide
2026-08-20  7:15 ` [PATCH v2 1/4] usb: ehci-vf: remove the code path for a build without DM_USB Mehmet Fide
2026-08-20  7:15 ` [PATCH v2 2/4] usb: ehci-vf: drop the empty bind hook Mehmet Fide
2026-08-20  7:15 ` [PATCH v2 3/4] dm: core: add ofnode_get_alias_seq() Mehmet Fide
2026-08-20  7:15 ` [PATCH v2 4/4] usb: ehci-vf: take the register bases from the device tree Mehmet Fide
2026-08-21  0:29 ` [PATCH v2 0/4] " Marek Vasut
2026-08-21  5:56   ` Mehmet Fide

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.