[U-Boot-Users] [PATCH][RESEND] eliminate assumptions about dataflash layout

Anders Larsen al at alarsen.net
Tue Nov 28 16:01:31 CET 2006


Hi,

the dataflash driver contains a hard-coded partition table which might
suit one particular board (which I doubt, however) but certainly isn't
generally applicable.

Furthermore, it write-protects the first two partitions, which violates
the U-Boot standard of allowing the user enough rope to shoot himself
in the foot.

Besides, the dataflash partitions aren't even on sector boundaries (the
dataflash chips have rather unusual sector sizes; 528 or 1056 bytes,
which makes one wonder what the folks at Atmel are smoking).

The patch below places the entire dataflash in one (writable) partition.

Cheers
 Anders

CHANGELOG:
  Don't make assumptions about dataflash layout
  Patch by Anders Larsen, 13 Oct 2005

Signed-off-by: Anders Larsen <al at alarsen.net>

---

 drivers/dataflash.c |    7 ++-----
 include/dataflash.h |    4 ++--
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/dataflash.c b/drivers/dataflash.c
index 17eb859..62a2029 100644
--- a/drivers/dataflash.c
+++ b/drivers/dataflash.c
@@ -33,10 +33,7 @@ int cs[][CFG_MAX_DATAFLASH_BANKS] = {
 
 /*define the area offsets*/
 dataflash_protect_t area_list[NB_DATAFLASH_AREA] = {
-	{0, 0x7fff, FLAG_PROTECT_SET},			/* ROM code */
-	{0x8000, 0x1ffff, FLAG_PROTECT_SET},		/* u-boot code */
-	{0x20000, 0x27fff, FLAG_PROTECT_CLEAR},		/* u-boot environment */
-	{0x28000, 0x1fffff, FLAG_PROTECT_CLEAR},	/* data area size to tune */
+	{0, 0x1fffff, FLAG_PROTECT_CLEAR},	/* filesystem */
 };
 
 extern void AT91F_SpiInit (void);
@@ -110,7 +107,7 @@ int AT91F_DataflashInit (void)
 			break;
 		}
 		/* set the last area end to the dataflash size*/
-		area_list[NB_DATAFLASH_AREA -1].end =
+		area_list[NB_DATAFLASH_AREA - 1].end =
 				(dataflash_info[i].Device.pages_number *
 				dataflash_info[i].Device.pages_size)-1;
 
diff --git a/include/dataflash.h b/include/dataflash.h
index 650454e..825eec6 100644
--- a/include/dataflash.h
+++ b/include/dataflash.h
@@ -37,8 +37,8 @@
 #include <asm/arch/hardware.h>
 #include "config.h"
 
-/*number of protected area*/
-#define NB_DATAFLASH_AREA	4
+/*number of areas*/
+#define NB_DATAFLASH_AREA	1
 
 /*define the area structure*/
 typedef struct {





More information about the U-Boot mailing list