ram: aspeed: Use dev_read_addr_x() API
PATCH 1/1 ram: aspeed: Use dev_read_addr_x() API
From: Peng Fan <[email protected]>
Use dev_read_addr_ptr() and dev_read_addr_index_ptr() which support both live device tree and flat DT backends, avoiding direct dependency on devfdt_* helpers.
While at here, also use ofnode_read_s32_default() to replace fdtdec_get_int().
No functional changes.
Signed-off-by Peng Fan <[email protected]>
--- drivers/ram/aspeed/sdram_ast2600.c | 15 +++++++-------- drivers/ram/aspeed/sdram_ast2700.c | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-)
drivers/ram/aspeed/sdram_ast2600.c +7 -8
@@ -1076,10 +1076,10 @@ static int ast2600_sdrammc_probe(struct udevice *dev)return ret; } - priv->scu =devfdt_get_addr_ptr (clk_dev); -if (IS_ERR (priv->scu)) { + priv->scu =dev_read_addr_ptr (clk_dev); +if (!priv->scu) {debug ("%s(): can't get SCU\n" , __func__); -return PTR_ERR (priv->scu); +return -ENODEV ; }if (readl (&priv->scu->dram_hdshk) &SCU_DRAM_HDSHK_RDY ) {
@@ -1136,12 +1136,11 @@ static int ast2600_sdrammc_of_to_plat(struct udevice *dev) {struct dram_info *priv =dev_get_priv (dev); - priv->regs = (void *)(uintptr_t )devfdt_get_addr_index (dev,0 ); - priv->phy_setting = (void *)(uintptr_t )devfdt_get_addr_index (dev,1 ); - priv->phy_status = (void *)(uintptr_t )devfdt_get_addr_index (dev,2 ); + priv->regs = (void *)(uintptr_t )dev_read_addr_index (dev,0 ); + priv->phy_setting = (void *)(uintptr_t )dev_read_addr_index (dev,1 ); + priv->phy_status = (void *)(uintptr_t )dev_read_addr_index (dev,2 ); - priv->clock_rate =fdtdec_get_int (gd->fdt_blob,dev_of_offset (dev), -"clock-frequency" ,0 ); + priv->clock_rate =ofnode_read_s32_default (dev_ofnode (dev),"clock-frequency" ,0 );if (!priv->clock_rate) {debug ("DDR Clock Rate not defined\n" );return -EINVAL ;
drivers/ram/aspeed/sdram_ast2700.c +2 -2
@@ -956,13 +956,13 @@ static int ast2700_sdrammc_of_to_plat(struct udevice *dev)ofnode node;int rc; - sdrammc->regs = (struct sdrammc_regs *)devfdt_get_addr_index (dev,0 ); + sdrammc->regs = (struct sdrammc_regs *)dev_read_addr_index (dev,0 );if (sdrammc->regs == (void *)FDT_ADDR_T_NONE ) {debug ("cannot map DRAM register\n" );return -ENODEV ; } - sdrammc->phy = (void *)devfdt_get_addr_index (dev,1 ); + sdrammc->phy = (void *)dev_read_addr_index (dev,1 );if (sdrammc->phy == (void *)FDT_ADDR_T_NONE ) {debug ("cannot map PHY memory\n" );return -ENODEV ;
Signature · 1 line
2.51.0
Quoted 8 lines · On Mon, 25 May 2026 12:07:41 +0800, [email protected] wrote:
Use
dev_read_addr_ptr()anddev_read_addr_index_ptr()which support both live device tree and flat DT backends, avoiding direct dependency on devfdt_* helpers.While at here, also use
ofnode_read_s32_default()to replacefdtdec_get_int().[...]
Applied to u-boot/next, thanks!
[1/1] ram: aspeed: Use dev_read_addr_x() API
commit: d26cbf4667c9b8193b06c6f8e9fa7334866c94ac
Signature · 1 line
Tom