ram: sifive: Check return value on clk_enable()
PATCH 1/2 ram: sifive: Check return value on clk_enable()
From: Bin Meng <[email protected]>
The return value should be checked otherwise it's useless to assign the return value to 'ret'.
---
drivers/ram/sifive/fu540_ddr.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/ram/sifive/fu540_ddr.c +5 -0
@@ -369,6 +369,11 @@ static int fu540_ddr_probe(struct udevice *dev) } ret =clk_enable (&priv->ddr_clk); +if (ret <0 ) { +debug ("Could not enable DDR clock\n" ); +return ret; + } + priv->ctl =regmap_get_range (map,0 ); priv->phy =regmap_get_range (map,1 ); priv->physical_filter_ctrl =regmap_get_range (map,2 );
Signature · 1 line
2.7.4
PATCH 1/2 ram: sifive: Check return value on clk_enable()
Quoted 12 lines · Bin Meng
From: Bin Meng <[email protected]>
The return value should be checked otherwise it's useless to assign the return value to 'ret'.
Signed-off-by Bin Meng <[email protected]>---
drivers/ram/sifive/fu540_ddr.c | 5 +++++ 1 file changed, 5 insertions(+)
ping?
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/2 ram: sifive: Check return value on clk_enable()
Quoted 13 lines
From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Friday, September 25, 2020 2:31 PM
To: Rick Jian-Zhi Chen(???); Pragnesh Patel; U-Boot Mailing List
Cc: Bin Meng
Subject: Re: [PATCH 1/2] ram: sifive: Check return value onclk_enable()Quoted 6 lines · Bin Meng
From: Bin Meng <[email protected]>
The return value should be checked otherwise it's useless to assign the return value to 'ret'.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Bin Meng <[email protected]>---
drivers/ram/sifive/fu540_ddr.c | 5 +++++ 1 file changed, 5 insertions(+)ping?
Applied to u-boot-riscv/master!
Thanks,
Rick
PATCH 2/2 ram: sifive: Remove regmap dependency
In reply to Bin MengFrom: Bin Meng <[email protected]>
The usage of regmap API in the SiFive RAM driver is not correct. The reg address should be obtained via dev_read_addr_index() API.
---
drivers/ram/sifive/fu540_ddr.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/ram/sifive/fu540_ddr.c +3 -9
@@ -11,7 +11,6 @@#include <fdtdec.h> #include <init.h> #include <ram.h> -#include <regmap.h> #include <syscon.h> #include <asm/io.h> #include <clk.h>
@@ -339,17 +338,12 @@ static int fu540_ddr_probe(struct udevice *dev) priv->info.size = gd->ram_size;#if defined(CONFIG_SPL_BUILD ) -struct regmap *map;int ret;u32 clock =0 ;debug ("FU540 DDR probe\n" ); priv->dev = dev; - ret =regmap_init_mem (dev_ofnode (dev), &map); -if (ret) -return ret; - ret =clk_get_by_index (dev,0 , &priv->ddr_clk);if (ret) {debug ("clk get failed %d\n" , ret);
@@ -374,9 +368,9 @@ static int fu540_ddr_probe(struct udevice *dev) return ret; } - priv->ctl =regmap_get_range (map,0 ); - priv->phy =regmap_get_range (map,1 ); - priv->physical_filter_ctrl =regmap_get_range (map,2 ); + priv->ctl = (struct fu540_ddrctl *)dev_read_addr_index (dev,0 ); + priv->phy = (struct fu540_ddrphy *)dev_read_addr_index (dev,1 ); + priv->physical_filter_ctrl = (u32 *)dev_read_addr_index (dev,2 );return fu540_ddr_setup (dev);#endif
Signature · 1 line
2.7.4