All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ram: sifive: Check return value on clk_enable()
@ 2020-09-15  8:05 Bin Meng
  2020-09-15  8:05 ` [PATCH 2/2] ram: sifive: Remove regmap dependency Bin Meng
  2020-09-25  6:31 ` [PATCH 1/2] ram: sifive: Check return value on clk_enable() Bin Meng
  0 siblings, 2 replies; 4+ messages in thread
From: Bin Meng @ 2020-09-15  8:05 UTC (permalink / raw)
  To: u-boot

From: Bin Meng <bin.meng@windriver.com>

The return value should be checked otherwise it's useless to
assign the return value to 'ret'.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

 drivers/ram/sifive/fu540_ddr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/ram/sifive/fu540_ddr.c b/drivers/ram/sifive/fu540_ddr.c
index 5ff8869..f5b2873 100644
--- a/drivers/ram/sifive/fu540_ddr.c
+++ b/drivers/ram/sifive/fu540_ddr.c
@@ -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);
-- 
2.7.4

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

* [PATCH 2/2] ram: sifive: Remove regmap dependency
  2020-09-15  8:05 [PATCH 1/2] ram: sifive: Check return value on clk_enable() Bin Meng
@ 2020-09-15  8:05 ` Bin Meng
  2020-09-25  6:31 ` [PATCH 1/2] ram: sifive: Check return value on clk_enable() Bin Meng
  1 sibling, 0 replies; 4+ messages in thread
From: Bin Meng @ 2020-09-15  8:05 UTC (permalink / raw)
  To: u-boot

From: Bin Meng <bin.meng@windriver.com>

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.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

 drivers/ram/sifive/fu540_ddr.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/ram/sifive/fu540_ddr.c b/drivers/ram/sifive/fu540_ddr.c
index f5b2873..60d4945 100644
--- a/drivers/ram/sifive/fu540_ddr.c
+++ b/drivers/ram/sifive/fu540_ddr.c
@@ -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
-- 
2.7.4

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

* [PATCH 1/2] ram: sifive: Check return value on clk_enable()
  2020-09-15  8:05 [PATCH 1/2] ram: sifive: Check return value on clk_enable() Bin Meng
  2020-09-15  8:05 ` [PATCH 2/2] ram: sifive: Remove regmap dependency Bin Meng
@ 2020-09-25  6:31 ` Bin Meng
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4746FAC@ATCPCS16.andestech.com>
  1 sibling, 1 reply; 4+ messages in thread
From: Bin Meng @ 2020-09-25  6:31 UTC (permalink / raw)
  To: u-boot

On Tue, Sep 15, 2020 at 4:05 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> From: Bin Meng <bin.meng@windriver.com>
>
> The return value should be checked otherwise it's useless to
> assign the return value to 'ret'.
>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
>
>  drivers/ram/sifive/fu540_ddr.c | 5 +++++
>  1 file changed, 5 insertions(+)
>

ping?

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

* [PATCH 1/2] ram: sifive: Check return value on clk_enable()
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4746FAC@ATCPCS16.andestech.com>
@ 2020-09-25  6:50     ` Rick Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Rick Chen @ 2020-09-25  6:50 UTC (permalink / raw)
  To: u-boot

> 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 on clk_enable()
>
> On Tue, Sep 15, 2020 at 4:05 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > From: Bin Meng <bin.meng@windriver.com>
> >
> > The return value should be checked otherwise it's useless to
> > assign the return value to 'ret'.
> >
> > Signed-off-by: Bin Meng <bin.meng@windriver.com>
> > ---
> >
> >  drivers/ram/sifive/fu540_ddr.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
>
> ping?

Applied to u-boot-riscv/master!

Thanks,
Rick

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

end of thread, other threads:[~2020-09-25  6:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-15  8:05 [PATCH 1/2] ram: sifive: Check return value on clk_enable() Bin Meng
2020-09-15  8:05 ` [PATCH 2/2] ram: sifive: Remove regmap dependency Bin Meng
2020-09-25  6:31 ` [PATCH 1/2] ram: sifive: Check return value on clk_enable() Bin Meng
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4746FAC@ATCPCS16.andestech.com>
2020-09-25  6:50     ` Rick Chen

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.