public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH - RFC] env_nand.c: fail gracefully if no nand is present
@ 2010-08-16 21:30 Steve Sakoman
  2010-08-16 21:36 ` Scott Wood
  0 siblings, 1 reply; 3+ messages in thread
From: Steve Sakoman @ 2010-08-16 21:30 UTC (permalink / raw)
  To: u-boot

Rationale:

The upcoming Beagle xM, unlike previous Beagles, has no on-board NAND.

I'd like to continue to have a single version of u-boot that works for
all version of Beagles.  Therefore I need to have env_nand fail
gracefully when it runs on the xM.

The patch below does the job, but I am not sure that my method of
checking for the existence of nand (nand_info[0].type = 0 when no nand
detected) is "correct"?  Any opinions or advice?

Steve

---

diff --git a/common/env_nand.c b/common/env_nand.c
index a15a950..325f112 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -268,6 +268,10 @@ int readenv (size_t offset, u_char * buf)
 
 	u_char *char_ptr;
 
+	/* fail if no nand detected */
+	if (nand_info[0].type == 0)
+		return 1;
+
 	blocksize = nand_info[0].erasesize;
 	len = min(blocksize, CONFIG_ENV_SIZE);
 

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

* [U-Boot] [PATCH - RFC] env_nand.c: fail gracefully if no nand is present
  2010-08-16 21:30 [U-Boot] [PATCH - RFC] env_nand.c: fail gracefully if no nand is present Steve Sakoman
@ 2010-08-16 21:36 ` Scott Wood
  2010-08-16 22:33   ` Steve Sakoman
  0 siblings, 1 reply; 3+ messages in thread
From: Scott Wood @ 2010-08-16 21:36 UTC (permalink / raw)
  To: u-boot

On 08/16/2010 04:30 PM, Steve Sakoman wrote:
> Rationale:
>
> The upcoming Beagle xM, unlike previous Beagles, has no on-board NAND.
>
> I'd like to continue to have a single version of u-boot that works for
> all version of Beagles.  Therefore I need to have env_nand fail
> gracefully when it runs on the xM.
>
> The patch below does the job, but I am not sure that my method of
> checking for the existence of nand (nand_info[0].type = 0 when no nand
> detected) is "correct"?  Any opinions or advice?

I just applied Mike's patch for this a few days ago:
http://git.denx.de/?p=u-boot/u-boot-nand-flash.git;a=commitdiff;h=962ad59e25640e586e2bceabf67a628a27f8f508

-Scott

>
> Steve
>
> ---
>
> diff --git a/common/env_nand.c b/common/env_nand.c
> index a15a950..325f112 100644
> --- a/common/env_nand.c
> +++ b/common/env_nand.c
> @@ -268,6 +268,10 @@ int readenv (size_t offset, u_char * buf)
>
>   	u_char *char_ptr;
>
> +	/* fail if no nand detected */
> +	if (nand_info[0].type == 0)
> +		return 1;
> +
>   	blocksize = nand_info[0].erasesize;
>   	len = min(blocksize, CONFIG_ENV_SIZE);
>
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>

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

* [U-Boot] [PATCH - RFC] env_nand.c: fail gracefully if no nand is present
  2010-08-16 21:36 ` Scott Wood
@ 2010-08-16 22:33   ` Steve Sakoman
  0 siblings, 0 replies; 3+ messages in thread
From: Steve Sakoman @ 2010-08-16 22:33 UTC (permalink / raw)
  To: u-boot

On Mon, 2010-08-16 at 16:36 -0500, Scott Wood wrote:
> On 08/16/2010 04:30 PM, Steve Sakoman wrote:
> > Rationale:
> >
> > The upcoming Beagle xM, unlike previous Beagles, has no on-board NAND.
> >
> > I'd like to continue to have a single version of u-boot that works for
> > all version of Beagles.  Therefore I need to have env_nand fail
> > gracefully when it runs on the xM.
> >
> > The patch below does the job, but I am not sure that my method of
> > checking for the existence of nand (nand_info[0].type = 0 when no nand
> > detected) is "correct"?  Any opinions or advice?
> 
> I just applied Mike's patch for this a few days ago:
> http://git.denx.de/?p=u-boot/u-boot-nand-flash.git;a=commitdiff;h=962ad59e25640e586e2bceabf67a628a27f8f508

Thanks Scott!  I'll add that patch to my working branch under the
assumption that it will eventually make its way to mainline.

Steve

> -Scott
> 
> >
> > Steve
> >
> > ---
> >
> > diff --git a/common/env_nand.c b/common/env_nand.c
> > index a15a950..325f112 100644
> > --- a/common/env_nand.c
> > +++ b/common/env_nand.c
> > @@ -268,6 +268,10 @@ int readenv (size_t offset, u_char * buf)
> >
> >   	u_char *char_ptr;
> >
> > +	/* fail if no nand detected */
> > +	if (nand_info[0].type == 0)
> > +		return 1;
> > +
> >   	blocksize = nand_info[0].erasesize;
> >   	len = min(blocksize, CONFIG_ENV_SIZE);
> >
> >
> > _______________________________________________
> > U-Boot mailing list
> > U-Boot at lists.denx.de
> > http://lists.denx.de/mailman/listinfo/u-boot
> >
> 
> 

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

end of thread, other threads:[~2010-08-16 22:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-16 21:30 [U-Boot] [PATCH - RFC] env_nand.c: fail gracefully if no nand is present Steve Sakoman
2010-08-16 21:36 ` Scott Wood
2010-08-16 22:33   ` Steve Sakoman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox