diff mbox

[U-Boot,PATCHv1,21/22] arm: socfpga: spl: Add SDRAM check

Message ID 1421253662-27222-22-git-send-email-dinguyen@opensource.altera.com
State Superseded
Delegated to: Marek Vasut
Headers show

Commit Message

Dinh Nguyen Jan. 14, 2015, 4:41 p.m. UTC
From: Dinh Nguyen <dinguyen@opensource.altera.com>

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
---
 arch/arm/cpu/armv7/socfpga/spl.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Marek Vasut Jan. 15, 2015, 12:04 a.m. UTC | #1
On Wednesday, January 14, 2015 at 05:41:01 PM, dinguyen@opensource.altera.com 
wrote:
> From: Dinh Nguyen <dinguyen@opensource.altera.com>
> 
> Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
> ---
>  arch/arm/cpu/armv7/socfpga/spl.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/arch/arm/cpu/armv7/socfpga/spl.c
> b/arch/arm/cpu/armv7/socfpga/spl.c index bf5b682..f0ef6b1 100644
> --- a/arch/arm/cpu/armv7/socfpga/spl.c
> +++ b/arch/arm/cpu/armv7/socfpga/spl.c
> @@ -191,4 +191,12 @@ void spl_board_init(void)
> 
>  	sdram_size = sdram_calculate_size();
>  	printf("SDRAM: %ld MiB\n", (sdram_size >> 20));
> +
> +	/* Sanity check ensure correct SDRAM size specified */
> +	puts("SDRAM: Ensuring specified SDRAM size is correct ...");
> +	if (get_ram_size(0, sdram_size) != sdram_size) {
> +		puts("failed\n");

Hi,

you might want to be more verbose about what failed here, possibly include 
__FILE__ , __func__ and __LINE__ to help identify the problem.

Thanks!

> +		hang();
> +	}
> +	puts("passed\n");
>  }

Best regards,
Marek Vasut
Pavel Machek Jan. 16, 2015, 9:59 p.m. UTC | #2
On Thu 2015-01-15 01:04:30, Marek Vasut wrote:
> On Wednesday, January 14, 2015 at 05:41:01 PM, dinguyen@opensource.altera.com 
> wrote:
> > From: Dinh Nguyen <dinguyen@opensource.altera.com>
> > 
> > Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
> > ---
> >  arch/arm/cpu/armv7/socfpga/spl.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/arch/arm/cpu/armv7/socfpga/spl.c
> > b/arch/arm/cpu/armv7/socfpga/spl.c index bf5b682..f0ef6b1 100644
> > --- a/arch/arm/cpu/armv7/socfpga/spl.c
> > +++ b/arch/arm/cpu/armv7/socfpga/spl.c
> > @@ -191,4 +191,12 @@ void spl_board_init(void)
> > 
> >  	sdram_size = sdram_calculate_size();
> >  	printf("SDRAM: %ld MiB\n", (sdram_size >> 20));
> > +
> > +	/* Sanity check ensure correct SDRAM size specified */
> > +	puts("SDRAM: Ensuring specified SDRAM size is correct ...");
> > +	if (get_ram_size(0, sdram_size) != sdram_size) {
> > +		puts("failed\n");
> 
> Hi,
> 
> you might want to be more verbose about what failed here, possibly include 
> __FILE__ , __func__ and __LINE__ to help identify the problem.

Actually, I'd be against adding file/func/line. This should be easy
enough to grep, and we don't normally print that.
									Pavel
Marek Vasut Jan. 17, 2015, 11 a.m. UTC | #3
On Friday, January 16, 2015 at 10:59:27 PM, Pavel Machek wrote:
> On Thu 2015-01-15 01:04:30, Marek Vasut wrote:
> > On Wednesday, January 14, 2015 at 05:41:01 PM,
> > dinguyen@opensource.altera.com
> > 
> > wrote:
> > > From: Dinh Nguyen <dinguyen@opensource.altera.com>
> > > 
> > > Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
> > > ---
> > > 
> > >  arch/arm/cpu/armv7/socfpga/spl.c | 8 ++++++++
> > >  1 file changed, 8 insertions(+)
> > > 
> > > diff --git a/arch/arm/cpu/armv7/socfpga/spl.c
> > > b/arch/arm/cpu/armv7/socfpga/spl.c index bf5b682..f0ef6b1 100644
> > > --- a/arch/arm/cpu/armv7/socfpga/spl.c
> > > +++ b/arch/arm/cpu/armv7/socfpga/spl.c
> > > @@ -191,4 +191,12 @@ void spl_board_init(void)
> > > 
> > >  	sdram_size = sdram_calculate_size();
> > >  	printf("SDRAM: %ld MiB\n", (sdram_size >> 20));
> > > 
> > > +
> > > +	/* Sanity check ensure correct SDRAM size specified */
> > > +	puts("SDRAM: Ensuring specified SDRAM size is correct ...");
> > > +	if (get_ram_size(0, sdram_size) != sdram_size) {
> > > +		puts("failed\n");
> > 
> > Hi,
> > 
> > you might want to be more verbose about what failed here, possibly
> > include __FILE__ , __func__ and __LINE__ to help identify the problem.
> 
> Actually, I'd be against adding file/func/line. This should be easy
> enough to grep, and we don't normally print that.

In case you have those in place, there's nothing to grep for, you just go
straight to the particular point in that particular file. But if there's
some kind of a more unique error message than "failed" (which gives ~1500
hits in recent U-Boot source), I'd be content with it.

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/socfpga/spl.c b/arch/arm/cpu/armv7/socfpga/spl.c
index bf5b682..f0ef6b1 100644
--- a/arch/arm/cpu/armv7/socfpga/spl.c
+++ b/arch/arm/cpu/armv7/socfpga/spl.c
@@ -191,4 +191,12 @@  void spl_board_init(void)
 
 	sdram_size = sdram_calculate_size();
 	printf("SDRAM: %ld MiB\n", (sdram_size >> 20));
+
+	/* Sanity check ensure correct SDRAM size specified */
+	puts("SDRAM: Ensuring specified SDRAM size is correct ...");
+	if (get_ram_size(0, sdram_size) != sdram_size) {
+		puts("failed\n");
+		hang();
+	}
+	puts("passed\n");
 }