public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] Make drivers/cfi_flash.c protect environment and redundant enviro nment
@ 2004-08-30 18:56 Michael Bendzick
  2004-10-10 21:59 ` Wolfgang Denk
  2005-02-26 10:52 ` [U-Boot-Users] " Ladislav Michl
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Bendzick @ 2004-08-30 18:56 UTC (permalink / raw)
  To: u-boot

Included is a patch to the drivers/cfi_flash.c driver that will
automatically enable environment and redundant environment protection
protection upon booting.  Previously, only the monitor (U-Boot) was
protected by the driver.

Change log snippet:

* Patch by Michael Bendzick, 12 Jul 2004:
  - Make drivers/cfi_flash.c protect environment and redundant
    environment.

-Michael Bendzick
Systems and Software Engineering
Logic Product Development
michael.b at logicpd.com
612-436-5122
www.logicpd.com


-------------- next part --------------
A non-text attachment was scrubbed...
Name: cfi-env-protect.patch
Type: application/octet-stream
Size: 1187 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20040830/28f4feab/attachment.obj 

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

* [U-Boot-Users] Make drivers/cfi_flash.c protect environment and redundant enviro nment
  2004-08-30 18:56 [U-Boot-Users] Make drivers/cfi_flash.c protect environment and redundant enviro nment Michael Bendzick
@ 2004-10-10 21:59 ` Wolfgang Denk
  2005-02-26 10:52 ` [U-Boot-Users] " Ladislav Michl
  1 sibling, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2004-10-10 21:59 UTC (permalink / raw)
  To: u-boot

In message <31ADFA827355984B9E2A161514595B561C33A5@lpdsrv04.logicpd.com> you wrote:
> 
> * Patch by Michael Bendzick, 12 Jul 2004:

Ummm... 30 Aug 2004 ???

>   - Make drivers/cfi_flash.c protect environment and redundant
>     environment.

Added, thanks.


Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
panic: can't find /

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

* [U-Boot-Users] Re: Make drivers/cfi_flash.c protect environment and redundant enviro nment
  2004-08-30 18:56 [U-Boot-Users] Make drivers/cfi_flash.c protect environment and redundant enviro nment Michael Bendzick
  2004-10-10 21:59 ` Wolfgang Denk
@ 2005-02-26 10:52 ` Ladislav Michl
  1 sibling, 0 replies; 4+ messages in thread
From: Ladislav Michl @ 2005-02-26 10:52 UTC (permalink / raw)
  To: u-boot

On Mon, Aug 30, 2004 at 01:56:34PM -0500, Michael Bendzick wrote:
> Included is a patch to the drivers/cfi_flash.c driver that will
> automatically enable environment and redundant environment protection
> protection upon booting.  Previously, only the monitor (U-Boot) was
> protected by the driver.
[snip]
> diff -purN a/drivers/cfi_flash.c b/drivers/cfi_flash.c
> --- a/drivers/cfi_flash.c	2004-07-12 17:34:52.000000000 -0500
> +++ b/drivers/cfi_flash.c	2004-08-30 13:34:23.783099389 -0500
> @@ -338,6 +338,21 @@ unsigned long flash_init (void)
>  		       &flash_info[0]);
>  #endif
>  
> +	/* Environment protection ON by default */
> +#ifdef CFG_ENV_IS_IN_FLASH
> +	flash_protect (FLAG_PROTECT_SET,
> +		       CFG_ENV_ADDR,
> +		       CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1,
> +		       &flash_info[0]);
> +#endif
> +
> +	/* Redundant environment protection ON by default */
> +#ifdef CFG_ENV_ADDR_REDUND
> +	flash_protect (FLAG_PROTECT_SET,
> +		       CFG_ENV_ADDR_REDUND,
> +		       CFG_ENV_ADDR_REDUND + CFG_ENV_SIZE_REDUND - 1,
> +		       &flash_info[0]);
> +#endif
>  	return (size);
>  }
 
Well, if you are using CFG_ENV_SIZE_REDUND it would make sense to use
CFG_ENV_SIZE instead of CFG_ENV_SECT_SIZE to make code a bit more
consistent. flash_protect will extend end address to sector boundary
anyway.

Index: drivers/cfi_flash.c
===================================================================
RCS file: /cvsroot/u-boot/u-boot/drivers/cfi_flash.c,v
retrieving revision 1.16
diff -u -r1.16 cfi_flash.c
--- drivers/cfi_flash.c	9 Jan 2005 17:12:33 -0000	1.16
+++ drivers/cfi_flash.c	26 Feb 2005 10:42:12 -0000
@@ -348,10 +347,8 @@
 #ifdef CFG_ENV_IS_IN_FLASH
 	flash_protect (FLAG_PROTECT_SET,
 		       CFG_ENV_ADDR,
-		       CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1,
+		       CFG_ENV_ADDR + CFG_ENV_SIZE - 1,
 		       &flash_info[0]);
-#endif
-
 	/* Redundant environment protection ON by default */
 #ifdef CFG_ENV_ADDR_REDUND
 	flash_protect (FLAG_PROTECT_SET,
@@ -359,6 +356,7 @@
 		       CFG_ENV_ADDR_REDUND + CFG_ENV_SIZE_REDUND - 1,
 		       &flash_info[0]);
 #endif
+#endif
 	return (size);
 }
 

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

* [U-Boot-Users] Re: Make drivers/cfi_flash.c protect environment and redundant enviro nment
@ 2005-02-26 13:36 Woodruff, Richard
  0 siblings, 0 replies; 4+ messages in thread
From: Woodruff, Richard @ 2005-02-26 13:36 UTC (permalink / raw)
  To: u-boot

A half related note is, I recently switched the OMAP/H4 driver to use
CFI.  Intel parts after power on reset have all their lock bits
set...So, the explicit protect of env sectors is kind of moot when they
are all set...software reset doesn't clear them.  The Intel doc's say
its that way to protect the flash through power cycles.

I also needed to fix up the hardware protect routine for the parts in
question as be base command set only works per partition, not per part.

Regards,
Richard W.



> -----Original Message-----
> From: u-boot-users-admin at lists.sourceforge.net [mailto:u-boot-users-
> admin at lists.sourceforge.net] On Behalf Of Ladislav Michl
> Sent: Saturday, February 26, 2005 4:52 AM
> To: Michael Bendzick
> Cc: U-Boot-Users (E-mail)
> Subject: [U-Boot-Users] Re: Make drivers/cfi_flash.c protect
environment
> and redundant enviro nment
> 
> On Mon, Aug 30, 2004 at 01:56:34PM -0500, Michael Bendzick wrote:
> > Included is a patch to the drivers/cfi_flash.c driver that will
> > automatically enable environment and redundant environment
protection
> > protection upon booting.  Previously, only the monitor (U-Boot) was
> > protected by the driver.
> [snip]
> > diff -purN a/drivers/cfi_flash.c b/drivers/cfi_flash.c
> > --- a/drivers/cfi_flash.c	2004-07-12 17:34:52.000000000 -0500
> > +++ b/drivers/cfi_flash.c	2004-08-30 13:34:23.783099389 -0500
> > @@ -338,6 +338,21 @@ unsigned long flash_init (void)
> >  		       &flash_info[0]);
> >  #endif
> >
> > +	/* Environment protection ON by default */
> > +#ifdef CFG_ENV_IS_IN_FLASH
> > +	flash_protect (FLAG_PROTECT_SET,
> > +		       CFG_ENV_ADDR,
> > +		       CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1,
> > +		       &flash_info[0]);
> > +#endif
> > +
> > +	/* Redundant environment protection ON by default */
> > +#ifdef CFG_ENV_ADDR_REDUND
> > +	flash_protect (FLAG_PROTECT_SET,
> > +		       CFG_ENV_ADDR_REDUND,
> > +		       CFG_ENV_ADDR_REDUND + CFG_ENV_SIZE_REDUND - 1,
> > +		       &flash_info[0]);
> > +#endif
> >  	return (size);
> >  }
> 
> Well, if you are using CFG_ENV_SIZE_REDUND it would make sense to use
> CFG_ENV_SIZE instead of CFG_ENV_SECT_SIZE to make code a bit more
> consistent. flash_protect will extend end address to sector boundary
> anyway.
> 
> Index: drivers/cfi_flash.c
> ===================================================================
> RCS file: /cvsroot/u-boot/u-boot/drivers/cfi_flash.c,v
> retrieving revision 1.16
> diff -u -r1.16 cfi_flash.c
> --- drivers/cfi_flash.c	9 Jan 2005 17:12:33 -0000	1.16
> +++ drivers/cfi_flash.c	26 Feb 2005 10:42:12 -0000
> @@ -348,10 +347,8 @@
>  #ifdef CFG_ENV_IS_IN_FLASH
>  	flash_protect (FLAG_PROTECT_SET,
>  		       CFG_ENV_ADDR,
> -		       CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1,
> +		       CFG_ENV_ADDR + CFG_ENV_SIZE - 1,
>  		       &flash_info[0]);
> -#endif
> -
>  	/* Redundant environment protection ON by default */
>  #ifdef CFG_ENV_ADDR_REDUND
>  	flash_protect (FLAG_PROTECT_SET,
> @@ -359,6 +356,7 @@
>  		       CFG_ENV_ADDR_REDUND + CFG_ENV_SIZE_REDUND - 1,
>  		       &flash_info[0]);
>  #endif
> +#endif
>  	return (size);
>  }
> 
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real
users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> U-Boot-Users mailing list
> U-Boot-Users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/u-boot-users

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

end of thread, other threads:[~2005-02-26 13:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-30 18:56 [U-Boot-Users] Make drivers/cfi_flash.c protect environment and redundant enviro nment Michael Bendzick
2004-10-10 21:59 ` Wolfgang Denk
2005-02-26 10:52 ` [U-Boot-Users] " Ladislav Michl
  -- strict thread matches above, loose matches on Subject: below --
2005-02-26 13:36 Woodruff, Richard

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