* [PATCH 0/6] net: Use dev APIs
@ 2026-05-26 7:25 Peng Fan (OSS)
2026-05-26 7:25 ` [PATCH 1/6] net: ethoc: Use dev_read_addr_index() Peng Fan (OSS)
` (5 more replies)
0 siblings, 6 replies; 15+ messages in thread
From: Peng Fan (OSS) @ 2026-05-26 7:25 UTC (permalink / raw)
To: u-boot
Cc: Jerome Forissier, Tom Rini, Peter Robinson, Svyatoslav Ryhel,
Heiko Schocher, Simon Glass, Marek Vasut, Andrew Goodbody,
Rasmus Villemoes, Peng Fan
This series converts several Ethernet drivers to use the generic
device model APIs for device tree access, replacing devfdt_* and
fdtdec/fdt_* interfaces.
The goal is to improve compatibility with both live device tree
and flat device tree backends, and to reduce direct dependencies
on low-level FDT helpers.
Patches 1–5 perform straightforward replacements:
- devfdt_get_addr() → dev_read_addr()
- devfdt_get_addr_index() → dev_read_addr_index()
- devfdt_get_addr_index_ptr() → dev_read_addr_index_ptr()
- map_physmem(devfdt_get_addr()) → dev_remap_addr()
These changes are mechanical and introduce no functional change.
Patch 6 converts the mvpp2 driver from legacy fdtdec/fdt_* APIs
to ofnode-based interfaces. This removes dependencies on
gd->fdt_blob and updates phandle parsing, subnode iteration,
property access, and device lookup.
No intended functional changes.
I not have the platforms to test, just best practice for this work.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
Peng Fan (6):
net: ethoc: Use dev_read_addr_index()
net: qe: dm_qe_uec: Use dev_read_addr()
net: calxedaxgmac: Use dev_read_addr()
net: dc2114x: Use dev_remap_addr()
net: mvpp2: Use dev_read_addr_index_ptr()
net: mvpp2: convert FDT access to ofnode API
drivers/net/calxedaxgmac.c | 2 +-
drivers/net/dc2114x.c | 2 +-
drivers/net/ethoc.c | 2 +-
drivers/net/mvpp2.c | 63 +++++++++++++++++++++++-----------------------
drivers/net/qe/dm_qe_uec.c | 2 +-
5 files changed, 35 insertions(+), 36 deletions(-)
---
base-commit: bb354d04459f5425318aeb8a70bae995ee573f1d
change-id: 20260526-devfdt-net-a0fe75cd7f49
Best regards,
--
Peng Fan <peng.fan@nxp.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/6] net: ethoc: Use dev_read_addr_index()
2026-05-26 7:25 [PATCH 0/6] net: Use dev APIs Peng Fan (OSS)
@ 2026-05-26 7:25 ` Peng Fan (OSS)
2026-05-27 1:17 ` Simon Glass
2026-05-26 7:25 ` [PATCH 2/6] net: qe: dm_qe_uec: Use dev_read_addr() Peng Fan (OSS)
` (4 subsequent siblings)
5 siblings, 1 reply; 15+ messages in thread
From: Peng Fan (OSS) @ 2026-05-26 7:25 UTC (permalink / raw)
To: u-boot
Cc: Jerome Forissier, Tom Rini, Peter Robinson, Svyatoslav Ryhel,
Heiko Schocher, Simon Glass, Marek Vasut, Andrew Goodbody,
Rasmus Villemoes, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Use dev_read_addr_index() which supports both live device tree and flat DT
backends, avoiding direct dependency on devfdt_* helpers.
No functional changes.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/net/ethoc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index dc7e6f1929f..87b2b3426c8 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -686,7 +686,7 @@ static int ethoc_of_to_plat(struct udevice *dev)
fdt_addr_t addr;
pdata->eth_pdata.iobase = dev_read_addr(dev);
- addr = devfdt_get_addr_index(dev, 1);
+ addr = dev_read_addr_index(dev, 1);
if (addr != FDT_ADDR_T_NONE)
pdata->packet_base = addr;
return 0;
--
2.51.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/6] net: qe: dm_qe_uec: Use dev_read_addr()
2026-05-26 7:25 [PATCH 0/6] net: Use dev APIs Peng Fan (OSS)
2026-05-26 7:25 ` [PATCH 1/6] net: ethoc: Use dev_read_addr_index() Peng Fan (OSS)
@ 2026-05-26 7:25 ` Peng Fan (OSS)
2026-05-27 1:17 ` Simon Glass
2026-05-26 7:25 ` [PATCH 3/6] net: calxedaxgmac: " Peng Fan (OSS)
` (3 subsequent siblings)
5 siblings, 1 reply; 15+ messages in thread
From: Peng Fan (OSS) @ 2026-05-26 7:25 UTC (permalink / raw)
To: u-boot
Cc: Jerome Forissier, Tom Rini, Peter Robinson, Svyatoslav Ryhel,
Heiko Schocher, Simon Glass, Marek Vasut, Andrew Goodbody,
Rasmus Villemoes, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Use dev_read_addr() which supports both live device tree and flat DT
backends, avoiding direct dependency on devfdt_* helpers.
No functional changes.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/net/qe/dm_qe_uec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/qe/dm_qe_uec.c b/drivers/net/qe/dm_qe_uec.c
index ac3aedd8b49..f9bc5d49c8f 100644
--- a/drivers/net/qe/dm_qe_uec.c
+++ b/drivers/net/qe/dm_qe_uec.c
@@ -1133,7 +1133,7 @@ static int qe_uec_of_to_plat(struct udevice *dev)
{
struct eth_pdata *pdata = dev_get_plat(dev);
- pdata->iobase = (phys_addr_t)devfdt_get_addr(dev);
+ pdata->iobase = (phys_addr_t)dev_read_addr(dev);
pdata->phy_interface = dev_read_phy_mode(dev);
if (pdata->phy_interface == PHY_INTERFACE_MODE_NA)
--
2.51.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 3/6] net: calxedaxgmac: Use dev_read_addr()
2026-05-26 7:25 [PATCH 0/6] net: Use dev APIs Peng Fan (OSS)
2026-05-26 7:25 ` [PATCH 1/6] net: ethoc: Use dev_read_addr_index() Peng Fan (OSS)
2026-05-26 7:25 ` [PATCH 2/6] net: qe: dm_qe_uec: Use dev_read_addr() Peng Fan (OSS)
@ 2026-05-26 7:25 ` Peng Fan (OSS)
2026-05-27 1:17 ` Simon Glass
2026-05-26 7:25 ` [PATCH 4/6] net: dc2114x: Use dev_remap_addr() Peng Fan (OSS)
` (2 subsequent siblings)
5 siblings, 1 reply; 15+ messages in thread
From: Peng Fan (OSS) @ 2026-05-26 7:25 UTC (permalink / raw)
To: u-boot
Cc: Jerome Forissier, Tom Rini, Peter Robinson, Svyatoslav Ryhel,
Heiko Schocher, Simon Glass, Marek Vasut, Andrew Goodbody,
Rasmus Villemoes, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Use dev_read_addr() which supports both live device tree and flat DT
backends, avoiding direct dependency on devfdt_* helpers.
No functional changes.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/net/calxedaxgmac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/calxedaxgmac.c b/drivers/net/calxedaxgmac.c
index 92990fa6d47..df0ed820e06 100644
--- a/drivers/net/calxedaxgmac.c
+++ b/drivers/net/calxedaxgmac.c
@@ -555,7 +555,7 @@ static int xgmac_ofdata_to_platdata(struct udevice *dev)
return -ENOMEM;
dev_set_priv(dev, priv);
- pdata->iobase = devfdt_get_addr(dev);
+ pdata->iobase = dev_read_addr(dev);
if (pdata->iobase == FDT_ADDR_T_NONE) {
printf("%s: Cannot find XGMAC base address\n", __func__);
return -EINVAL;
--
2.51.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 4/6] net: dc2114x: Use dev_remap_addr()
2026-05-26 7:25 [PATCH 0/6] net: Use dev APIs Peng Fan (OSS)
` (2 preceding siblings ...)
2026-05-26 7:25 ` [PATCH 3/6] net: calxedaxgmac: " Peng Fan (OSS)
@ 2026-05-26 7:25 ` Peng Fan (OSS)
2026-05-27 1:17 ` Simon Glass
2026-05-26 7:25 ` [PATCH 5/6] net: mvpp2: Use dev_read_addr_index_ptr() Peng Fan (OSS)
2026-05-26 7:25 ` [PATCH 6/6] net: mvpp2: convert FDT access to ofnode API Peng Fan (OSS)
5 siblings, 1 reply; 15+ messages in thread
From: Peng Fan (OSS) @ 2026-05-26 7:25 UTC (permalink / raw)
To: u-boot
Cc: Jerome Forissier, Tom Rini, Peter Robinson, Svyatoslav Ryhel,
Heiko Schocher, Simon Glass, Marek Vasut, Andrew Goodbody,
Rasmus Villemoes, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Use dev_remap_addr() to simplify code.
dev_remap_addr() does same thing as dev_read_addr() + map_physmem(). And
it supports both live device tree and flat DT backends, avoiding direct
dependency on devfdt_* helpers.
No functional changes.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/net/dc2114x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/dc2114x.c b/drivers/net/dc2114x.c
index 8fa549280aa..2a21eceac57 100644
--- a/drivers/net/dc2114x.c
+++ b/drivers/net/dc2114x.c
@@ -653,7 +653,7 @@ static int dc2114x_of_to_plat(struct udevice *dev)
struct eth_pdata *plat = dev_get_plat(dev);
struct dc2114x_priv *priv = dev_get_priv(dev);
- plat->iobase = (phys_addr_t)map_physmem((phys_addr_t)devfdt_get_addr(dev), 0, MAP_NOCACHE);
+ plat->iobase = (phys_addr_t)dev_remap_addr(dev);
priv->iobase = (void *)plat->iobase;
return 0;
--
2.51.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 5/6] net: mvpp2: Use dev_read_addr_index_ptr()
2026-05-26 7:25 [PATCH 0/6] net: Use dev APIs Peng Fan (OSS)
` (3 preceding siblings ...)
2026-05-26 7:25 ` [PATCH 4/6] net: dc2114x: Use dev_remap_addr() Peng Fan (OSS)
@ 2026-05-26 7:25 ` Peng Fan (OSS)
2026-05-27 1:17 ` Simon Glass
2026-05-26 7:25 ` [PATCH 6/6] net: mvpp2: convert FDT access to ofnode API Peng Fan (OSS)
5 siblings, 1 reply; 15+ messages in thread
From: Peng Fan (OSS) @ 2026-05-26 7:25 UTC (permalink / raw)
To: u-boot
Cc: Jerome Forissier, Tom Rini, Peter Robinson, Svyatoslav Ryhel,
Heiko Schocher, Simon Glass, Marek Vasut, Andrew Goodbody,
Rasmus Villemoes, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Use dev_read_addr_index_ptr() which supports both live device tree and
flat DT backends, avoiding direct dependency on devfdt_* helpers.
No functional changes.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/net/mvpp2.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
index f9e979c4d58..193f82ea07d 100644
--- a/drivers/net/mvpp2.c
+++ b/drivers/net/mvpp2.c
@@ -5296,16 +5296,16 @@ static int mvpp2_base_probe(struct udevice *dev)
}
/* Save base addresses for later use */
- priv->base = devfdt_get_addr_index_ptr(dev, 0);
+ priv->base = dev_read_addr_index_ptr(dev, 0);
if (!priv->base)
return -EINVAL;
if (priv->hw_version == MVPP21) {
- priv->lms_base = devfdt_get_addr_index_ptr(dev, 1);
+ priv->lms_base = dev_read_addr_index_ptr(dev, 1);
if (!priv->lms_base)
return -EINVAL;
} else {
- priv->iface_base = devfdt_get_addr_index_ptr(dev, 1);
+ priv->iface_base = dev_read_addr_index_ptr(dev, 1);
if (!priv->iface_base)
return -EINVAL;
@@ -5346,8 +5346,7 @@ static int mvpp2_probe(struct udevice *dev)
if (priv->hw_version == MVPP21) {
int priv_common_regs_num = 2;
- port->base = devfdt_get_addr_index_ptr(
- dev->parent, priv_common_regs_num + port->id);
+ port->base = dev_read_addr_index_ptr(dev->parent, priv_common_regs_num + port->id);
if (!port->base)
return -EINVAL;
} else {
--
2.51.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 6/6] net: mvpp2: convert FDT access to ofnode API
2026-05-26 7:25 [PATCH 0/6] net: Use dev APIs Peng Fan (OSS)
` (4 preceding siblings ...)
2026-05-26 7:25 ` [PATCH 5/6] net: mvpp2: Use dev_read_addr_index_ptr() Peng Fan (OSS)
@ 2026-05-26 7:25 ` Peng Fan (OSS)
2026-05-27 1:20 ` Simon Glass
5 siblings, 1 reply; 15+ messages in thread
From: Peng Fan (OSS) @ 2026-05-26 7:25 UTC (permalink / raw)
To: u-boot
Cc: Jerome Forissier, Tom Rini, Peter Robinson, Svyatoslav Ryhel,
Heiko Schocher, Simon Glass, Marek Vasut, Andrew Goodbody,
Rasmus Villemoes, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Convert mvpp2 driver from legacy fdtdec/fdt_* APIs to the ofnode-based
interfaces.
Replace usage of dev_of_offset(), fdtdec_lookup_phandle(),
fdtdec_get_int(), fdt_parent_offset(), and related helpers with their
ofnode equivalents, including dev_ofnode(), ofnode_parse_phandle(),
ofnode_read_s32_default(), ofnode_get_parent(), and
ofnode_for_each_subnode().
Remove direct dependencies on gd->fdt_blob.
Main changes:
- Use ofnode_valid() instead of integer checks for node presence
- Switch fixed-link detection to ofnode_find_subnode()
- Replace uclass_get_device_by_of_offset() with
uclass_get_device_by_ofnode()
- Update subnode iteration and device binding to use ofnode
No functional changes.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/net/mvpp2.c | 54 ++++++++++++++++++++++++++---------------------------
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
index 193f82ea07d..27f785163ba 100644
--- a/drivers/net/mvpp2.c
+++ b/drivers/net/mvpp2.c
@@ -4731,33 +4731,34 @@ static int mvpp2_port_init(struct udevice *dev, struct mvpp2_port *port)
static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port)
{
- int port_node = dev_of_offset(dev);
- int phy_node;
+ ofnode port_node = dev_ofnode(dev);
+ ofnode phy_node;
u32 id;
int phyaddr = 0;
- int fixed_link = 0;
+ ofnode fixed_link;
int ret;
- phy_node = fdtdec_lookup_phandle(gd->fdt_blob, port_node, "phy");
- fixed_link = fdt_subnode_offset(gd->fdt_blob, port_node, "fixed-link");
+ phy_node = ofnode_parse_phandle(port_node, "phy", 0);
+ fixed_link = ofnode_find_subnode(port_node, "fixed-link");
- if (phy_node > 0) {
- int parent;
+ if (ofnode_valid(phy_node)) {
+ ofnode parent;
- if (fixed_link != -FDT_ERR_NOTFOUND) {
+ if (ofnode_valid(fixed_link)) {
/* phy_addr is set to invalid value for fixed links */
phyaddr = PHY_MAX_ADDR;
} else {
- phyaddr = fdtdec_get_int(gd->fdt_blob, phy_node,
- "reg", 0);
+ phyaddr = ofnode_read_s32_default(phy_node, "reg", 0);
if (phyaddr < 0) {
dev_err(dev, "could not find phy address\n");
return -1;
}
}
- parent = fdt_parent_offset(gd->fdt_blob, phy_node);
- ret = uclass_get_device_by_of_offset(UCLASS_MDIO, parent,
- &port->mdio_dev);
+ parent = ofnode_get_parent(phy_node);
+ if (!ofnode_valid(parent))
+ return -ENODEV;
+ ret = uclass_get_device_by_ofnode(UCLASS_MDIO, parent,
+ &port->mdio_dev);
if (ret)
return ret;
} else {
@@ -4771,7 +4772,7 @@ static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port)
return -EINVAL;
}
- id = fdtdec_get_int(gd->fdt_blob, port_node, "port-id", -1);
+ id = dev_read_s32_default(dev, "port-id", -1);
if (id == -1) {
dev_err(dev, "missing port-id value\n");
return -EINVAL;
@@ -4812,7 +4813,7 @@ static void mvpp2_gpio_init(struct mvpp2_port *port)
/* Ports initialization */
static int mvpp2_port_probe(struct udevice *dev,
struct mvpp2_port *port,
- int port_node,
+ ofnode port_node,
struct mvpp2 *priv)
{
int err;
@@ -5350,8 +5351,7 @@ static int mvpp2_probe(struct udevice *dev)
if (!port->base)
return -EINVAL;
} else {
- port->gop_id = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
- "gop-port-id", -1);
+ port->gop_id = ofnode_read_s32_default(dev_ofnode(dev), "gop-port-id", -1);
if (port->gop_id == -1) {
dev_err(dev, "missing gop-port-id value\n");
return -EINVAL;
@@ -5375,7 +5375,7 @@ static int mvpp2_probe(struct udevice *dev)
priv->probe_done = 1;
}
- err = mvpp2_port_probe(dev, port, dev_of_offset(dev), priv);
+ err = mvpp2_port_probe(dev, port, dev_ofnode(dev), priv);
if (err)
return err;
@@ -5436,15 +5436,14 @@ static struct driver mvpp2_driver = {
*/
static int mvpp2_base_bind(struct udevice *parent)
{
- const void *blob = gd->fdt_blob;
- int node = dev_of_offset(parent);
+ ofnode node = dev_ofnode(parent);
struct uclass_driver *drv;
struct udevice *dev;
struct eth_pdata *plat;
char *name;
- int subnode;
+ ofnode subnode;
u32 id;
- int base_id_add;
+ int base_id_add, ret;
/* Lookup eth driver */
drv = lists_uclass_lookup(UCLASS_ETH);
@@ -5455,19 +5454,19 @@ static int mvpp2_base_bind(struct udevice *parent)
base_id_add = base_id;
- fdt_for_each_subnode(subnode, blob, node) {
+ dev_for_each_subnode(subnode, parent) {
/* Increment base_id for all subnodes, also the disabled ones */
base_id++;
/* Skip disabled ports */
- if (!fdtdec_get_is_enabled(blob, subnode))
+ if (!ofnode_is_enabled(subnode))
continue;
plat = calloc(1, sizeof(*plat));
if (!plat)
return -ENOMEM;
- id = fdtdec_get_int(blob, subnode, "port-id", -1);
+ id = ofnode_read_s32_default(subnode, "port-id", -1);
id += base_id_add;
name = calloc(1, 16);
@@ -5478,8 +5477,9 @@ static int mvpp2_base_bind(struct udevice *parent)
sprintf(name, "mvpp2-%d", id);
/* Create child device UCLASS_ETH and bind it */
- device_bind(parent, &mvpp2_driver, name, plat,
- offset_to_ofnode(subnode), &dev);
+ ret = device_bind(parent, &mvpp2_driver, name, plat, subnode, &dev);
+ if (ret)
+ return ret;
}
return 0;
--
2.51.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 1/6] net: ethoc: Use dev_read_addr_index()
2026-05-26 7:25 ` [PATCH 1/6] net: ethoc: Use dev_read_addr_index() Peng Fan (OSS)
@ 2026-05-27 1:17 ` Simon Glass
0 siblings, 0 replies; 15+ messages in thread
From: Simon Glass @ 2026-05-27 1:17 UTC (permalink / raw)
To: peng.fan
Cc: u-boot, Jerome Forissier, Tom Rini, Peter Robinson,
Svyatoslav Ryhel, Heiko Schocher, Simon Glass, Marek Vasut,
Andrew Goodbody, Rasmus Villemoes, Peng Fan
On 2026-05-26T07:25:09, Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:
> net: ethoc: Use dev_read_addr_index()
>
> Use dev_read_addr_index() which supports both live device tree and flat DT
> backends, avoiding direct dependency on devfdt_* helpers.
>
> No functional changes.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
>
> drivers/net/ethoc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/6] net: qe: dm_qe_uec: Use dev_read_addr()
2026-05-26 7:25 ` [PATCH 2/6] net: qe: dm_qe_uec: Use dev_read_addr() Peng Fan (OSS)
@ 2026-05-27 1:17 ` Simon Glass
0 siblings, 0 replies; 15+ messages in thread
From: Simon Glass @ 2026-05-27 1:17 UTC (permalink / raw)
To: peng.fan
Cc: u-boot, Jerome Forissier, Tom Rini, Peter Robinson,
Svyatoslav Ryhel, Heiko Schocher, Simon Glass, Marek Vasut,
Andrew Goodbody, Rasmus Villemoes, Peng Fan
On 2026-05-26T07:25:09, Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:
> net: qe: dm_qe_uec: Use dev_read_addr()
>
> Use dev_read_addr() which supports both live device tree and flat DT
> backends, avoiding direct dependency on devfdt_* helpers.
>
> No functional changes.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
>
> drivers/net/qe/dm_qe_uec.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 3/6] net: calxedaxgmac: Use dev_read_addr()
2026-05-26 7:25 ` [PATCH 3/6] net: calxedaxgmac: " Peng Fan (OSS)
@ 2026-05-27 1:17 ` Simon Glass
0 siblings, 0 replies; 15+ messages in thread
From: Simon Glass @ 2026-05-27 1:17 UTC (permalink / raw)
To: peng.fan
Cc: u-boot, Jerome Forissier, Tom Rini, Peter Robinson,
Svyatoslav Ryhel, Heiko Schocher, Simon Glass, Marek Vasut,
Andrew Goodbody, Rasmus Villemoes, Peng Fan
On 2026-05-26T07:25:09, Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:
> net: calxedaxgmac: Use dev_read_addr()
>
> Use dev_read_addr() which supports both live device tree and flat DT
> backends, avoiding direct dependency on devfdt_* helpers.
>
> No functional changes.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
>
> drivers/net/calxedaxgmac.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 4/6] net: dc2114x: Use dev_remap_addr()
2026-05-26 7:25 ` [PATCH 4/6] net: dc2114x: Use dev_remap_addr() Peng Fan (OSS)
@ 2026-05-27 1:17 ` Simon Glass
0 siblings, 0 replies; 15+ messages in thread
From: Simon Glass @ 2026-05-27 1:17 UTC (permalink / raw)
To: peng.fan
Cc: u-boot, Jerome Forissier, Tom Rini, Peter Robinson,
Svyatoslav Ryhel, Heiko Schocher, Simon Glass, Marek Vasut,
Andrew Goodbody, Rasmus Villemoes, Peng Fan
On 2026-05-26T07:25:09, Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:
> net: dc2114x: Use dev_remap_addr()
>
> Use dev_remap_addr() to simplify code.
>
> dev_remap_addr() does same thing as dev_read_addr() + map_physmem(). And
> it supports both live device tree and flat DT backends, avoiding direct
> dependency on devfdt_* helpers.
>
> No functional changes.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
>
> drivers/net/dc2114x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 5/6] net: mvpp2: Use dev_read_addr_index_ptr()
2026-05-26 7:25 ` [PATCH 5/6] net: mvpp2: Use dev_read_addr_index_ptr() Peng Fan (OSS)
@ 2026-05-27 1:17 ` Simon Glass
0 siblings, 0 replies; 15+ messages in thread
From: Simon Glass @ 2026-05-27 1:17 UTC (permalink / raw)
To: peng.fan
Cc: u-boot, Jerome Forissier, Tom Rini, Peter Robinson,
Svyatoslav Ryhel, Heiko Schocher, Simon Glass, Marek Vasut,
Andrew Goodbody, Rasmus Villemoes, Peng Fan
Hi Peng,
On 2026-05-26T07:25:09, Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:
> net: mvpp2: Use dev_read_addr_index_ptr()
>
> Use dev_read_addr_index_ptr() which supports both live device tree and
> flat DT backends, avoiding direct dependency on devfdt_* helpers.
>
> No functional changes.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
>
> drivers/net/mvpp2.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
> diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
> @@ -5346,8 +5346,7 @@ static int mvpp2_probe(struct udevice *dev)
> if (priv->hw_version == MVPP21) {
> int priv_common_regs_num = 2;
>
> - port->base = devfdt_get_addr_index_ptr(
> - dev->parent, priv_common_regs_num + port->id);
> + port->base = dev_read_addr_index_ptr(dev->parent, priv_common_regs_num + port->id);
Please keep the wrap to stay within 80 columns:
port->base = dev_read_addr_index_ptr(dev->parent,
priv_common_regs_num + port->id);
Regards,
Simon
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 6/6] net: mvpp2: convert FDT access to ofnode API
2026-05-26 7:25 ` [PATCH 6/6] net: mvpp2: convert FDT access to ofnode API Peng Fan (OSS)
@ 2026-05-27 1:20 ` Simon Glass
2026-05-27 14:29 ` Peng Fan (OSS)
0 siblings, 1 reply; 15+ messages in thread
From: Simon Glass @ 2026-05-27 1:20 UTC (permalink / raw)
To: peng.fan
Cc: u-boot, Jerome Forissier, Tom Rini, Peter Robinson,
Svyatoslav Ryhel, Heiko Schocher, Simon Glass, Marek Vasut,
Andrew Goodbody, Rasmus Villemoes, Peng Fan
Hi Peng,
On 2026-05-26T07:25:09, Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:
> net: mvpp2: convert FDT access to ofnode API
>
> Convert mvpp2 driver from legacy fdtdec/fdt_* APIs to the ofnode-based
> interfaces.
>
> Replace usage of dev_of_offset(), fdtdec_lookup_phandle(),
> fdtdec_get_int(), fdt_parent_offset(), and related helpers with their
> ofnode equivalents, including dev_ofnode(), ofnode_parse_phandle(),
> ofnode_read_s32_default(), ofnode_get_parent(), and
> ofnode_for_each_subnode().
>
> Remove direct dependencies on gd->fdt_blob.
>
> Main changes:
> - Use ofnode_valid() instead of integer checks for node presence
> - Switch fixed-link detection to ofnode_find_subnode()
> - Replace uclass_get_device_by_of_offset() with
> uclass_get_device_by_ofnode()
> - Update subnode iteration and device binding to use ofnode
>
> [...]
>
> drivers/net/mvpp2.c | 54 ++++++++++++++++++++++++++---------------------------
> 1 file changed, 27 insertions(+), 27 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
> diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
> @@ -5436,15 +5436,14 @@ static struct driver mvpp2_driver = {
> */
> static int mvpp2_base_bind(struct udevice *parent)
> {
> - const void *blob = gd->fdt_blob;
> - int node = dev_of_offset(parent);
> + ofnode node = dev_ofnode(parent);
'node' is now no longer used by the look of it. Do you see a warning?
> diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
> @@ -5478,8 +5477,9 @@ static int mvpp2_base_bind(struct udevice *parent)
> sprintf(name, 'mvpp2-%d', id);
>
> /* Create child device UCLASS_ETH and bind it */
> - device_bind(parent, &mvpp2_driver, name, plat,
> - offset_to_ofnode(subnode), &dev);
> + ret = device_bind(parent, &mvpp2_driver, name, plat, subnode, &dev);
> + if (ret)
> + return ret;
This is a behavioural change - the old code ignored bind failures and
continued, the new code aborts and leaks the already-allocated plat
and name. Probably the right thing, but please mention it in the
commit message (the "No functional changes" claim is not quite
accurate) and free plat/name on the error path.
> diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
> @@ -4731,33 +4731,34 @@ static int mvpp2_port_init(struct udevice *dev, struct mvpp2_port *port)
> - parent = fdt_parent_offset(gd->fdt_blob, phy_node);
> - ret = uclass_get_device_by_of_offset(UCLASS_MDIO, parent,
> - &port->mdio_dev);
> + parent = ofnode_get_parent(phy_node);
> + if (!ofnode_valid(parent))
> + return -ENODEV;
We should be careful returning -ENODEV as it has a special meaning
with DM. This is a small behavioural change versus the old code, which
passed a negative offset straight through. Worth noting in the commit
message, or drop the check since the call below will return an error
anyway.
Regards,
Simon
^ permalink raw reply [flat|nested] 15+ messages in thread
* RE: [PATCH 6/6] net: mvpp2: convert FDT access to ofnode API
2026-05-27 1:20 ` Simon Glass
@ 2026-05-27 14:29 ` Peng Fan (OSS)
2026-05-27 14:47 ` Tom Rini
0 siblings, 1 reply; 15+ messages in thread
From: Peng Fan (OSS) @ 2026-05-27 14:29 UTC (permalink / raw)
To: Simon Glass, Peng Fan (OSS)
Cc: u-boot@lists.denx.de, Jerome Forissier, Tom Rini, Peter Robinson,
Svyatoslav Ryhel, Heiko Schocher, Marek Vasut, Andrew Goodbody,
Rasmus Villemoes
Hi Simon,
Thanks for giving a look.
> Subject: Re: [PATCH 6/6] net: mvpp2: convert FDT access to ofnode API
>
> Hi Peng,
>
> On 2026-05-26T07:25:09, Peng Fan (OSS) <peng.fan@oss.nxp.com>
> wrote:
> > net: mvpp2: convert FDT access to ofnode API
> >
> > Convert mvpp2 driver from legacy fdtdec/fdt_* APIs to the ofnode-
> based
> > interfaces.
> >
> > Replace usage of dev_of_offset(), fdtdec_lookup_phandle(),
> > fdtdec_get_int(), fdt_parent_offset(), and related helpers with their
> > ofnode equivalents, including dev_ofnode(), ofnode_parse_phandle(),
> > ofnode_read_s32_default(), ofnode_get_parent(), and
> > ofnode_for_each_subnode().
> >
> > Remove direct dependencies on gd->fdt_blob.
> >
> > Main changes:
> > - Use ofnode_valid() instead of integer checks for node presence
> > - Switch fixed-link detection to ofnode_find_subnode()
> > - Replace uclass_get_device_by_of_offset() with
> > uclass_get_device_by_ofnode()
> > - Update subnode iteration and device binding to use ofnode
> >
> > [...]
> >
> > drivers/net/mvpp2.c | 54
> > ++++++++++++++++++++++++++---------------------------
> > 1 file changed, 27 insertions(+), 27 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> > diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c @@ -5436,15
> > +5436,14 @@ static struct driver mvpp2_driver = {
> > */
> > static int mvpp2_base_bind(struct udevice *parent) {
> > - const void *blob = gd->fdt_blob;
> > - int node = dev_of_offset(parent);
> > + ofnode node = dev_ofnode(parent);
>
> 'node' is now no longer used by the look of it. Do you see a warning?
I use "./tools/buildman/buildman x250 ", I may miss something.
indeed no user, I will remove it.
>
> > diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
> > @@ -5478,8 +5477,9 @@ static int mvpp2_base_bind(struct udevice
> *parent)
> > sprintf(name, 'mvpp2-%d', id);
> >
> > /* Create child device UCLASS_ETH and bind it */
> > - device_bind(parent, &mvpp2_driver, name, plat,
> > - offset_to_ofnode(subnode), &dev);
> > + ret = device_bind(parent, &mvpp2_driver, name, plat,
> subnode, &dev);
> > + if (ret)
> > + return ret;
>
> This is a behavioural change - the old code ignored bind failures and
> continued, the new code aborts and leaks the already-allocated plat
> and name. Probably the right thing, but please mention it in the
> commit message (the "No functional changes" claim is not quite
> accurate) and free plat/name on the error path.
Will update commit message in v2.
>
> > diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
> > @@ -4731,33 +4731,34 @@ static int mvpp2_port_init(struct
> udevice *dev, struct mvpp2_port *port)
> > - parent = fdt_parent_offset(gd->fdt_blob, phy_node);
> > - ret = uclass_get_device_by_of_offset(UCLASS_MDIO, parent,
> > - &port->mdio_dev);
> > + parent = ofnode_get_parent(phy_node);
> > + if (!ofnode_valid(parent))
> > + return -ENODEV;
>
> We should be careful returning -ENODEV as it has a special meaning
> with DM. This is a small behavioural change versus the old code, which
> passed a negative offset straight through. Worth noting in the commit
> message, or drop the check since the call below will return an error
I will drop the check in v2.
Thanks,
Peng.
> anyway.
>
> Regards,
> Simon
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 6/6] net: mvpp2: convert FDT access to ofnode API
2026-05-27 14:29 ` Peng Fan (OSS)
@ 2026-05-27 14:47 ` Tom Rini
0 siblings, 0 replies; 15+ messages in thread
From: Tom Rini @ 2026-05-27 14:47 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Simon Glass, u-boot@lists.denx.de, Jerome Forissier,
Peter Robinson, Svyatoslav Ryhel, Heiko Schocher, Marek Vasut,
Andrew Goodbody, Rasmus Villemoes
[-- Attachment #1: Type: text/plain, Size: 2066 bytes --]
On Wed, May 27, 2026 at 02:29:37PM +0000, Peng Fan (OSS) wrote:
> Hi Simon,
>
> Thanks for giving a look.
>
> > Subject: Re: [PATCH 6/6] net: mvpp2: convert FDT access to ofnode API
> >
> > Hi Peng,
> >
> > On 2026-05-26T07:25:09, Peng Fan (OSS) <peng.fan@oss.nxp.com>
> > wrote:
> > > net: mvpp2: convert FDT access to ofnode API
> > >
> > > Convert mvpp2 driver from legacy fdtdec/fdt_* APIs to the ofnode-
> > based
> > > interfaces.
> > >
> > > Replace usage of dev_of_offset(), fdtdec_lookup_phandle(),
> > > fdtdec_get_int(), fdt_parent_offset(), and related helpers with their
> > > ofnode equivalents, including dev_ofnode(), ofnode_parse_phandle(),
> > > ofnode_read_s32_default(), ofnode_get_parent(), and
> > > ofnode_for_each_subnode().
> > >
> > > Remove direct dependencies on gd->fdt_blob.
> > >
> > > Main changes:
> > > - Use ofnode_valid() instead of integer checks for node presence
> > > - Switch fixed-link detection to ofnode_find_subnode()
> > > - Replace uclass_get_device_by_of_offset() with
> > > uclass_get_device_by_ofnode()
> > > - Update subnode iteration and device binding to use ofnode
> > >
> > > [...]
> > >
> > > drivers/net/mvpp2.c | 54
> > > ++++++++++++++++++++++++++---------------------------
> > > 1 file changed, 27 insertions(+), 27 deletions(-)
> >
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> >
> > > diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c @@ -5436,15
> > > +5436,14 @@ static struct driver mvpp2_driver = {
> > > */
> > > static int mvpp2_base_bind(struct udevice *parent) {
> > > - const void *blob = gd->fdt_blob;
> > > - int node = dev_of_offset(parent);
> > > + ofnode node = dev_ofnode(parent);
> >
> > 'node' is now no longer used by the look of it. Do you see a warning?
>
> I use "./tools/buildman/buildman x250 ", I may miss something.
> indeed no user, I will remove it.
You have to use buildman -E to make warnings be errors. Or, *cough*, we
enable WERROR by default, as has been suggested.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2026-05-27 14:47 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-26 7:25 [PATCH 0/6] net: Use dev APIs Peng Fan (OSS)
2026-05-26 7:25 ` [PATCH 1/6] net: ethoc: Use dev_read_addr_index() Peng Fan (OSS)
2026-05-27 1:17 ` Simon Glass
2026-05-26 7:25 ` [PATCH 2/6] net: qe: dm_qe_uec: Use dev_read_addr() Peng Fan (OSS)
2026-05-27 1:17 ` Simon Glass
2026-05-26 7:25 ` [PATCH 3/6] net: calxedaxgmac: " Peng Fan (OSS)
2026-05-27 1:17 ` Simon Glass
2026-05-26 7:25 ` [PATCH 4/6] net: dc2114x: Use dev_remap_addr() Peng Fan (OSS)
2026-05-27 1:17 ` Simon Glass
2026-05-26 7:25 ` [PATCH 5/6] net: mvpp2: Use dev_read_addr_index_ptr() Peng Fan (OSS)
2026-05-27 1:17 ` Simon Glass
2026-05-26 7:25 ` [PATCH 6/6] net: mvpp2: convert FDT access to ofnode API Peng Fan (OSS)
2026-05-27 1:20 ` Simon Glass
2026-05-27 14:29 ` Peng Fan (OSS)
2026-05-27 14:47 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).