* [U-Boot-Users] [PATCH: ecb: 1/2] Move at91rm9200dk initialization out of dataflash.c
@ 2007-06-12 0:37 Nelson Castillo
2007-06-12 5:01 ` [U-Boot-Users] [PATCH: ecb: 1/2] Move at91rm9200dk initializationout " Ulf Samuelsson
0 siblings, 1 reply; 4+ messages in thread
From: Nelson Castillo @ 2007-06-12 0:37 UTC (permalink / raw)
To: u-boot
Hi.
There is some initialization specific to the
at91rm9200dk in flash.c : the protected zones in
the dataflash driver.
We made an initializer for that. We need it
because we need to use the same driver. We also added
more information to be printed for the protected sectors
of the dataflash. IMHO the comments wanted to be part of
the code.
Thus:
{0, 0x7fff, FLAG_PROTECT_SET} /* ROM Code */
becomes
{0, 0x7fff, FLAG_PROTECT_SET, "ROM code"}
The string is printed in "dataflash_print_info", if you
don't want an informational message to be printed, just
set to "".
Move at91rm9200dk initialization out of dataflash.c
Signed-off-by: Nelson Castillo <nelson@emqbit.com>
diff --git a/drivers/dataflash.c b/drivers/dataflash.c
index 17eb859..2528a46 100644
--- a/drivers/dataflash.c
+++ b/drivers/dataflash.c
@@ -26,19 +26,10 @@
AT91S_DATAFLASH_INFO dataflash_info[CFG_MAX_DATAFLASH_BANKS];
static AT91S_DataFlash DataFlashInst;
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
- {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0}, /* Logical adress, CS */
- {CFG_DATAFLASH_LOGIC_ADDR_CS3, 3}
-};
-
-/*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 */
-};
+int (*cs)[CFG_MAX_DATAFLASH_BANKS];
+dataflash_protect_t *area_list;
+extern void AT91F_DataflashMapInit(void);
extern void AT91F_SpiInit (void);
extern int AT91F_DataflashProbe (int i, AT91PS_DataflashDesc pDesc);
extern int AT91F_DataFlashRead (AT91PS_DataFlash pDataFlash,
@@ -55,6 +46,7 @@ int AT91F_DataflashInit (void)
int dfcode;
AT91F_SpiInit ();
+ AT91F_DataflashMapInit();
for (i = 0; i < CFG_MAX_DATAFLASH_BANKS; i++) {
dataflash_info[i].Desc.state = IDLE;
@@ -119,11 +111,18 @@ int AT91F_DataflashInit (void)
dataflash_info[i].Device.area_list[j].start = area_list[j].start + dataflash_info[i].logical_address;
dataflash_info[i].Device.area_list[j].end = area_list[j].end + dataflash_info[i].logical_address;
dataflash_info[i].Device.area_list[j].protected = area_list[j].protected;
+ dataflash_info[i].Device.area_list[j].label = area_list[j].label;
}
}
return (1);
}
+extern void AT91F_MapInit (int _cs[][CFG_MAX_DATAFLASH_BANKS], dataflash_protect_t _area_list[])
+{
+ cs = _cs;
+ area_list = _area_list;
+}
+
void dataflash_print_info (void)
{
@@ -159,11 +158,12 @@ void dataflash_print_info (void)
dataflash_info[i].Device.pages_size,
(unsigned int) dataflash_info[i].logical_address);
for (j=0; j< NB_DATAFLASH_AREA; j++) {
- printf ("Area %i:\t%08lX to %08lX %s\n", j,
+ printf ("Area %i:\t%08lX to %08lX %s %s\n", j,
dataflash_info[i].Device.area_list[j].start,
dataflash_info[i].Device.area_list[j].end,
(dataflash_info[i].Device.area_list[j].protected ==
- FLAG_PROTECT_SET) ? "(RO)" : "");
+ FLAG_PROTECT_SET) ? "(RO)" : " ",
+ dataflash_info[i].Device.area_list[j].label);
}
}
}
diff --git a/include/dataflash.h b/include/dataflash.h
index 650454e..d7ec7eb 100644
--- a/include/dataflash.h
+++ b/include/dataflash.h
@@ -37,14 +37,12 @@
#include <asm/arch/hardware.h>
#include "config.h"
-/*number of protected area*/
-#define NB_DATAFLASH_AREA 4
-
/*define the area structure*/
typedef struct {
unsigned long start;
unsigned long end;
unsigned char protected;
+ char *label;
} dataflash_protect_t;
typedef unsigned int AT91S_DataFlashStatus;
@@ -174,5 +172,6 @@ extern int read_dataflash (unsigned long addr, unsigned long size, char *result)
extern int write_dataflash (unsigned long addr, unsigned long dest, unsigned long size);
extern void dataflash_print_info (void);
extern void dataflash_perror (int err);
+extern void AT91F_MapInit (int cs[][CFG_MAX_DATAFLASH_BANKS], dataflash_protect_t area_list[]); /* board initialization */
#endif
diff --git a/include/configs/at91rm9200dk.h b/include/configs/at91rm9200dk.h
index 8fad55d..0daa394 100644
--- a/include/configs/at91rm9200dk.h
+++ b/include/configs/at91rm9200dk.h
@@ -157,6 +157,8 @@
#define CFG_DATAFLASH_LOGIC_ADDR_CS0 0xC0000000 /* Logical adress for CS0 */
#define CFG_DATAFLASH_LOGIC_ADDR_CS3 0xD0000000 /* Logical adress for CS3 */
+#define NB_DATAFLASH_AREA 4 /*number of protected area*/
+
#define PHYS_FLASH_1 0x10000000
#define PHYS_FLASH_SIZE 0x200000 /* 2 megs main flash */
#define CFG_FLASH_BASE PHYS_FLASH_1
diff --git a/board/at91rm9200dk/at91rm9200dk.c b/board/at91rm9200dk/at91rm9200dk.c
index 002981a..84abdbc 100644
--- a/board/at91rm9200dk/at91rm9200dk.c
+++ b/board/at91rm9200dk/at91rm9200dk.c
@@ -140,3 +140,29 @@ void nand_init (void)
printf ("%4lu MB\n", nand_probe(AT91_SMARTMEDIA_BASE) >> 20);
}
#endif
+
+
+#ifdef CONFIG_HAS_DATAFLASH
+#include <dataflash.h>
+
+void AT91F_DataflashMapInit(void)
+{
+ static int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+ /* Logical adress, CS */
+ {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},
+ {CFG_DATAFLASH_LOGIC_ADDR_CS3, 3}
+ };
+
+ static dataflash_protect_t area_list[NB_DATAFLASH_AREA] = {
+ /*define the area offsets*/
+ {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"},
+ };
+
+ AT91F_MapInit (cs, area_list);
+}
+
+#endif
--
http://arhuaco.org
http://emQbit.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.denx.de/pipermail/u-boot/attachments/20070611/7c27b1cb/attachment.pgp
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot-Users] [PATCH: ecb: 1/2] Move at91rm9200dk initializationout of dataflash.c
2007-06-12 0:37 [U-Boot-Users] [PATCH: ecb: 1/2] Move at91rm9200dk initialization out of dataflash.c Nelson Castillo
@ 2007-06-12 5:01 ` Ulf Samuelsson
2007-06-12 5:14 ` Nelson Castillo
0 siblings, 1 reply; 4+ messages in thread
From: Ulf Samuelsson @ 2007-06-12 5:01 UTC (permalink / raw)
To: u-boot
> Subject: [U-Boot-Users] [PATCH: ecb: 1/2] Move at91rm9200dk initializationout of dataflash.c
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
If you look at my code at
ftp://81.80.104.162/ AT91 Third Party Support -> Linux Host -> Source -> u-boot-1.2.0-atmel.tar.bz2
you will see that there is already such a fix available.
This also fixes a number of other problems in the u-boot for the AT91.
We are probably better off, if you use this as a base for your modifications
than the vanilla Atmel patches.
Best Regards
Ulf Samuelsson
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot-Users] [PATCH: ecb: 1/2] Move at91rm9200dk initializationout of dataflash.c
2007-06-12 5:01 ` [U-Boot-Users] [PATCH: ecb: 1/2] Move at91rm9200dk initializationout " Ulf Samuelsson
@ 2007-06-12 5:14 ` Nelson Castillo
2007-06-12 5:20 ` [U-Boot-Users] [PATCH: ecb: 1/2] Move at91rm9200dkinitializationout " Ulf Samuelsson
0 siblings, 1 reply; 4+ messages in thread
From: Nelson Castillo @ 2007-06-12 5:14 UTC (permalink / raw)
To: u-boot
On Tue, Jun 12, 2007 at 07:01:29AM +0200, Ulf Samuelsson wrote:
(cut)
> If you look at my code at
> ftp://81.80.104.162/ AT91 Third Party Support -> Linux Host -> Source -> u-boot-1.2.0-atmel.tar.bz2
> you will see that there is already such a fix available.
>
> This also fixes a number of other problems in the u-boot for the AT91.
> We are probably better off, if you use this as a base for your modifications
Hi Ulf, thanks for the reply.
I couldn't find files in your ftp site. Is it a temporal issue?
Regards,
Nelson.-
--
http://arhuaco.org
http://emQbit.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.denx.de/pipermail/u-boot/attachments/20070612/f7f5226d/attachment.pgp
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot-Users] [PATCH: ecb: 1/2] Move at91rm9200dkinitializationout of dataflash.c
2007-06-12 5:14 ` Nelson Castillo
@ 2007-06-12 5:20 ` Ulf Samuelsson
0 siblings, 0 replies; 4+ messages in thread
From: Ulf Samuelsson @ 2007-06-12 5:20 UTC (permalink / raw)
To: u-boot
Sorry, that should be:
ftp://at91dist:distrib at 81.80.104.162/ AT91 Third Party Support -> Linux Host -> Source -> u-boot-1.2.0-atmel.tar.bz2
If you go to www.at91.com Linux Forum and look for buildroot-2007-06-04 entry,
you will find a script which will build everything you need to getin Linux running from dataflashcard
on an AT91RM9200EK using board = at91rm9200df.
Best Regards
Ulf Samuelsson
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-06-12 5:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-12 0:37 [U-Boot-Users] [PATCH: ecb: 1/2] Move at91rm9200dk initialization out of dataflash.c Nelson Castillo
2007-06-12 5:01 ` [U-Boot-Users] [PATCH: ecb: 1/2] Move at91rm9200dk initializationout " Ulf Samuelsson
2007-06-12 5:14 ` Nelson Castillo
2007-06-12 5:20 ` [U-Boot-Users] [PATCH: ecb: 1/2] Move at91rm9200dkinitializationout " Ulf Samuelsson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox