[PATCH v4 15/22] net: tsec: Use map_physmem() directly instead of dev_remap_addr()

Bin Meng bmeng.cn at gmail.com
Sun Mar 14 13:14:59 CET 2021


dev_remap_addr() eventually calls dev_read_addr_index(), while
pdata->iobase holds the return value of dev_read_addr() that calls
dev_read_addr_index() too. Such duplication can be avoided by using
map_physmem() directly.

Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean at nxp.com>

---

(no changes since v3)

Changes in v3:
- new patch: net: tsec: Use map_physmem() directly instead of dev_remap_addr()

 drivers/net/tsec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index f801d020fb..491d2ef1ae 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -833,7 +833,9 @@ int tsec_probe(struct udevice *dev)
 	data = (struct tsec_data *)dev_get_driver_data(dev);
 
 	pdata->iobase = (phys_addr_t)dev_read_addr(dev);
-	priv->regs = dev_remap_addr(dev);
+	if (pdata->iobase == FDT_ADDR_T_NONE)
+		return -ENOENT;
+	priv->regs = map_physmem(pdata->iobase, 0, MAP_NOCACHE);
 
 	ret = dev_read_phandle_with_args(dev, "tbi-handle", NULL, 0, 0,
 					 &phandle_args);
-- 
2.25.1



More information about the U-Boot mailing list