Skip to contentSkip to conversation

FIX: dataflash.c

U-Boot-Users Wolfgang Denk 4 participants 14 messages Aug 19, 2007 – Aug 29, 2007 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 18 lines · In message <[email protected]> you wrote:

Change in dataflash.c for fixing

---

dataflash.c renamed from dataflash.c.orig +1 -1
@@ -27,16 +27,16 @@ AT91S_DATAFLASH_INFO dataflash_info[CFG_
 static AT91S_DataFlash DataFlashInst;
 
 #ifdef CONFIG_AT91SAM9260EK
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
 	{CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},	/* Logical adress, CS */
 	{CFG_DATAFLASH_LOGIC_ADDR_CS1, 1}
 };
 #elif defined(CONFIG_AT91SAM9263EK)

dataflash.c AT91S_DATAFLASH_INFO dataflash_info[CFG_ · line 42

Quoted 10 lines
dataflash.c renamed from dataflash.c.orig +2 -2
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
 	{CFG_DATAFLASH_LOGIC_ADDR_CS0, 0}	/* Logical adress, CS */
 };
 #else
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
 	{CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},	/* Logical adress, CS */
 	{CFG_DATAFLASH_LOGIC_ADDR_CS3, 3}
 };

I hereby reject this patch.

Replacing a configuration option by a hardwired constant which is probably wrong on most of the boards is definitely a Bad Thing.

Also, you did not even mention what sort of problem you are trying to fix.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
There is an order of things in this universe.
	-- Apollo, "Who Mourns for Adonais?" stardate 3468.1
#2 lore raw
Quoted 34 lines · Wolfgang Denk
Quoted 19 lines · In message <[email protected]> you wrote:

Change in dataflash.c for fixing

---

dataflash.c renamed from dataflash.c.orig +1 -1
@@ -27,16 +27,16 @@ AT91S_DATAFLASH_INFO dataflash_info[CFG_
 static AT91S_DataFlash DataFlashInst;
 
 #ifdef CONFIG_AT91SAM9260EK
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
 	{CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},	/* Logical adress, CS */
 	{CFG_DATAFLASH_LOGIC_ADDR_CS1, 1}
 };
 #elif defined(CONFIG_AT91SAM9263EK)

dataflash.c AT91S_DATAFLASH_INFO dataflash_info[CFG_ · line 42

Quoted 10 lines
dataflash.c renamed from dataflash.c.orig +2 -2
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
 	{CFG_DATAFLASH_LOGIC_ADDR_CS0, 0}	/* Logical adress, CS */
 };
 #else
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
 	{CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},	/* Logical adress, CS */
 	{CFG_DATAFLASH_LOGIC_ADDR_CS3, 3}
 };

I hereby reject this patch.

Quoted 3 lines

Replacing a configuration option by a hardwired constant which is probably wrong on most of the boards is definitely a Bad Thing.

The length of the array row is fixed and it is two... It can't be different.

Regards Michael

#3 lore raw
Quoted 27 lines
Quoted 27 lines
Quoted 14 lines
dataflash.c 2007-08-18 17:37:05.000000000 +0200 renamed from dataflash.c.orig 2007-08-18 17:36:08.000000000 +0200 +1 -1
@@ -27,16 +27,16 @@ AT91S_DATAFLASH_INFO dataflash_info[CFG_
 static AT91S_DataFlash DataFlashInst;
 
 #ifdef CONFIG_AT91SAM9260EK
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
 {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0}, /* Logical adress, CS */
 {CFG_DATAFLASH_LOGIC_ADDR_CS1, 1}
 };
 #elif defined(CONFIG_AT91SAM9263EK)

dataflash.c 2007-08-18 17:37:05.000000000 +0200 AT91S_DATAFLASH_INFO dataflash_info[CFG_ · line 42

Quoted 10 lines
dataflash.c 2007-08-18 17:37:05.000000000 +0200 renamed from dataflash.c.orig 2007-08-18 17:36:08.000000000 +0200 +2 -2
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
 {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0} /* Logical adress, CS */
 };
 #else
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
 {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0}, /* Logical adress, CS */
 {CFG_DATAFLASH_LOGIC_ADDR_CS3, 3}
 };

I hereby reject this patch.

Quoted 5 lines
Quoted 3 lines

Replacing a configuration option by a hardwired constant which is probably wrong on most of the boards is definitely a Bad Thing.

The length of the array row is fixed and it is two... It can't be different.

Yes, but that means that you leave the config/*.h info dangling. With the current code you can see how many dataflash are supported.

I agree with Wolfgang (wow, that is an experience!) that the patch should be rejected.

Best Regards
Ulf Samuelsson

#4 lore raw
In reply to Wolfgang Denk
Quoted 7 lines

I hereby reject this patch.

Replacing a configuration option by a hardwired constant which is probably wrong on most of the boards is definitely a Bad Thing.

ok

Quoted 4 lines

Also, you did not even mention what sort of problem you are trying to fix.

It fix an invalid use of a pointer and and invalid use of an array.

regards michael

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dataflash.at41.patch
Type: text/x-patch
Size: 1038 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20070819/345eeafe/attachment.bin

#5 lore raw
Quoted 8 lines

for (i = 0; i < CFG_MAX_DATAFLASH_BANKS; i++)
if ( dataflash_info[i].id
- && ((((int) addr) & 0xFF000000) ==
+ && ((((unsigned int) *addr) & 0xFF000000) ==
dataflash_info[i].logical_address)) {
addr_valid = 1;
break;

Quoted 5 lines

It fix an invalid use of a pointer and and invalid use of an array.

regards michael

AFAIK, This patch is introducing a bug.

The intention of the code is to check if "addr" is within
0xC0000000..0xCFFFFFFF or
0xD0000000..0xDFFFFFFF.

Your patch will make the ARM core *read* from whereever 'addr' is pointing at.

'addr' is an address specified by the user!

You do not know *where* is it located, and if the ARM reads from an arbitrary address, there is a big chance that it will trap...

Best Regards
Ulf Samuelsson

#6 lore raw
Quoted 15 lines · Ulf Samuelsson
Quoted 8 lines

for (i = 0; i < CFG_MAX_DATAFLASH_BANKS; i++)
if ( dataflash_info[i].id
- && ((((int) addr) & 0xFF000000) ==
+ && ((((unsigned int) *addr) & 0xFF000000) ==
dataflash_info[i].logical_address)) {
addr_valid = 1;
break;

Quoted 6 lines

It fix an invalid use of a pointer and and invalid use of an array.

regards michael

Quoted 9 lines

AFAIK, This patch is introducing a bug.

The intention of the code is to check if "addr" is within
0xC0000000..0xCFFFFFFF or
0xD0000000..0xDFFFFFFF.

Your patch will make the ARM core *read* from whereever 'addr' is pointing at.

The patch is only reversed.
- new code
+ old code
Regards Michael

#7 lore raw
In reply to Ulf Samuelsson
Quoted 23 lines · Ulf Samuelsson
Quoted 8 lines

for (i = 0; i < CFG_MAX_DATAFLASH_BANKS; i++)
if ( dataflash_info[i].id
- && ((((int) addr) & 0xFF000000) ==
+ && ((((unsigned int) *addr) & 0xFF000000) ==
dataflash_info[i].logical_address)) {
addr_valid = 1;
break;

Quoted 6 lines

It fix an invalid use of a pointer and and invalid use of an array.

regards michael

AFAIK, This patch is introducing a bug.

The intention of the code is to check if "addr" is within
0xC0000000..0xCFFFFFFF or
0xD0000000..0xDFFFFFFF.

Your patch will make the ARM core *read* from whereever 'addr' is pointing at.

Quoted 10 lines

'addr' is an address specified by the user!

You do not know *where* is it located, and if the ARM reads from an arbitrary address, there is a big chance that it will trap...

Best Regards
Ulf Samuelsson

* addr is the value of the logical address to check. addr is the address of the variable that contain the logical address.
I think that my patch is ok but reversed .orig .new.
Regards Michael

#8 lore raw
In reply to Wolfgang Denk
Quoted 15 lines · Wolfgang Denk
Quoted 14 lines · In message <[email protected]> you wrote:
dataflash.c 2007-08-18 17:37:05.000000000 +0200 renamed from dataflash.c.orig 2007-08-18 17:36:08.000000000 +0200 +2 -2
@@ -27,16 +27,16 @@ AT91S_DATAFLASH_INFO dataflash_info[CFG_
 static AT91S_DataFlash DataFlashInst;
 
 #ifdef CONFIG_AT91SAM9260EK
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
      {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},      /* Logical adress, CS */
      {CFG_DATAFLASH_LOGIC_ADDR_CS1, 1}
 };
 #elif defined(CONFIG_AT91SAM9263EK)
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
Quoted 8 lines

dataflash.c 2007-08-18 17:37:05.000000000 +0200 AT91S_DATAFLASH_INFO dataflash_info[CFG_ · line 42

Quoted 8 lines
dataflash.c 2007-08-18 17:37:05.000000000 +0200 renamed from dataflash.c.orig 2007-08-18 17:36:08.000000000 +0200 +1 -1
      {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0}       /* Logical adress, CS */
 };
 #else
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
      {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},      /* Logical adress, CS */
      {CFG_DATAFLASH_LOGIC_ADDR_CS3, 3}
 };

Why not call it dataflash_cs[] and move it into the board code? It already pollutes the namespace, is already board-dependent (hence the #ifdefs) and is apparently buggy?

Then the board code is responsible for defining a CFG_MAX_DATAFLASH_BANKS symbol which corresponds with the actual number of entries in the array. Of course, it can still be buggy, but at least it's contained within the board code.

Haavard

Quoted 29 lines

I hereby reject this patch.

Replacing a configuration option by a hardwired constant which is probably wrong on most of the boards is definitely a Bad Thing.

Also, you did not even mention what sort of problem you are trying to fix.

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de There is an order of things in this universe.
-- Apollo, "Who Mourns for Adonais?" stardate 3468.1

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

#9 lore raw
Quoted 20 lines · In message <[email protected]> you…
Quoted 19 lines · Wolfgang Denk
Quoted 18 lines · In message <[email protected]> you wrote:
dataflash.c 2007-08-18 17:37:05.000000000 +0200 renamed from dataflash.c.orig 2007-08-18 17:36:08.000000000 +0200 +2 -3
@@ -27,16 +27,16 @@ AT91S_DATAFLASH_INFO dataflash_info[CFG_
 static AT91S_DataFlash DataFlashInst;
 
 #ifdef CONFIG_AT91SAM9260EK
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
      {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},      /* Logical adress, CS */
      {CFG_DATAFLASH_LOGIC_ADDR_CS1, 1}
 };
 #elif defined(CONFIG_AT91SAM9263EK)
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
      {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0}       /* Logical adress, CS */
 };
 #else
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
Quoted 8 lines
Quoted 4 lines

dataflash.c 2007-08-18 17:37:05.000000000 +0200 AT91S_DATAFLASH_INFO dataflash_info[CFG_ · line 42

Quoted 4 lines
dataflash.c 2007-08-18 17:37:05.000000000 +0200 renamed from dataflash.c.orig 2007-08-18 17:36:08.000000000 +0200 +1 -0
+int cs[][2] = {
      {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},      /* Logical adress, CS */
      {CFG_DATAFLASH_LOGIC_ADDR_CS3, 3}
 };

Why not call it dataflash_cs[] and move it into the board code? It already pollutes the namespace, is already board-dependent (hence the #ifdefs) and is apparently buggy?

Excellent idea.

Quoted 4 lines

Then the board code is responsible for defining a CFG_MAX_DATAFLASH_BANKS symbol which corresponds with the actual number of entries in the array. Of course, it can still be buggy, but at least it's contained within the board code.

I agree completely.

Who will provide such a patch?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Der Horizont vieler Menschen ist ein Kreis mit Radius Null --
und das nennen sie ihren Standpunkt.
#10 lore raw

Quoting Wolfgang Denk <[email protected]>:

Quoted 32 lines

In message <[email protected]> you

Quoted 20 lines · wrote:
Quoted 19 lines · Wolfgang Denk
Quoted 18 lines · In message <[email protected]> you wrote:
dataflash.c 2007-08-18 17:37:05.000000000 +0200 renamed from dataflash.c.orig 2007-08-18 17:36:08.000000000 +0200 +2 -3
@@ -27,16 +27,16 @@ AT91S_DATAFLASH_INFO dataflash_info[CFG_
 static AT91S_DataFlash DataFlashInst;
 
 #ifdef CONFIG_AT91SAM9260EK
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
      {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},      /* Logical adress, CS */
      {CFG_DATAFLASH_LOGIC_ADDR_CS1, 1}
 };
 #elif defined(CONFIG_AT91SAM9263EK)
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
      {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0}       /* Logical adress, CS */
 };
 #else
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
Quoted 8 lines
Quoted 4 lines

dataflash.c 2007-08-18 17:37:05.000000000 +0200 AT91S_DATAFLASH_INFO dataflash_info[CFG_ · line 42

Quoted 4 lines
dataflash.c 2007-08-18 17:37:05.000000000 +0200 renamed from dataflash.c.orig 2007-08-18 17:36:08.000000000 +0200 +1 -0
+int cs[][2] = {
      {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},      /* Logical adress, CS */
      {CFG_DATAFLASH_LOGIC_ADDR_CS3, 3}
 };

Why not call it dataflash_cs[] and move it into the board code? It already pollutes the namespace, is already board-dependent (hence the #ifdefs) and is apparently buggy?

Quoted 2 lines

Excellent idea.

I think that the dataflash layer must be rewritten and he must conformed to the flash layer.

Regards Michael

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

#11 lore raw
In reply to Wolfgang Denk

m?n 2007-08-20 klockan 01:29 +0200 skrev Wolfgang Denk:

Quoted 37 lines
Quoted 20 lines · In message <[email protected]> you…
Quoted 19 lines · Wolfgang Denk
Quoted 18 lines · In message <[email protected]> you wrote:
dataflash.c 2007-08-18 17:37:05.000000000 +0200 renamed from dataflash.c.orig 2007-08-18 17:36:08.000000000 +0200 +2 -3
@@ -27,16 +27,16 @@ AT91S_DATAFLASH_INFO dataflash_info[CFG_
 static AT91S_DataFlash DataFlashInst;
 
 #ifdef CONFIG_AT91SAM9260EK
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
      {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},      /* Logical adress, CS */
      {CFG_DATAFLASH_LOGIC_ADDR_CS1, 1}
 };
 #elif defined(CONFIG_AT91SAM9263EK)
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
      {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0}       /* Logical adress, CS */
 };
 #else
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
Quoted 8 lines
Quoted 4 lines

dataflash.c 2007-08-18 17:37:05.000000000 +0200 AT91S_DATAFLASH_INFO dataflash_info[CFG_ · line 42

Quoted 4 lines
dataflash.c 2007-08-18 17:37:05.000000000 +0200 renamed from dataflash.c.orig 2007-08-18 17:36:08.000000000 +0200 +1 -0
+int cs[][2] = {
      {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},      /* Logical adress, CS */
      {CFG_DATAFLASH_LOGIC_ADDR_CS3, 3}
 };

Why not call it dataflash_cs[] and move it into the board code? It already pollutes the namespace, is already board-dependent (hence the #ifdefs) and is apparently buggy?

Excellent idea.

Quoted 4 lines

Then the board code is responsible for defining a CFG_MAX_DATAFLASH_BANKS symbol which corresponds with the actual number of entries in the array. Of course, it can still be buggy, but at least it's contained within the board code.

Quoted 4 lines

I agree completely.

Who will provide such a patch?

I can do it, in a week or two.

Quoted 5 lines

Best regards,

Wolfgang Denk

#12 lore raw

Dear Ulf,

Quoted 12 lines · in message <[email protected]> you wrote:
Quoted 12 lines
Quoted 4 lines

Why not call it dataflash_cs[] and move it into the board code? It already pollutes the namespace, is already board-dependent (hence the #ifdefs) and is apparently buggy?

Excellent idea.

Quoted 4 lines

Then the board code is responsible for defining a CFG_MAX_DATAFLASH_BANKS symbol which corresponds with the actual number of entries in the array. Of course, it can still be buggy, but at least it's contained within the board code.

Quoted 6 lines
Quoted 4 lines

I agree completely.

Who will provide such a patch?

I can do it, in a week or two.

Just to make sure I understand correctly: are you working on this? Any estimates when it might be ready?

Thanks in advance.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Probably the best operating system in the world  is  the  [operating
system] made for the PDP-11 by Bell Laboratories."
                                           - Ted Nelson, October 1977
#13 lore raw
In reply to Håvard Skinnemoen

Quoting H?vard Skinnemoen <[email protected]>:

Quoted 29 lines · Wolfgang Denk
Quoted 15 lines
Quoted 14 lines · In message <[email protected]> you wrote:
dataflash.c 2007-08-18 17:37:05.000000000 +0200 renamed from dataflash.c.orig 2007-08-18 17:36:08.000000000 +0200 +2 -2
@@ -27,16 +27,16 @@ AT91S_DATAFLASH_INFO dataflash_info[CFG_
 static AT91S_DataFlash DataFlashInst;
 
 #ifdef CONFIG_AT91SAM9260EK
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
      {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},      /* Logical adress, CS */
      {CFG_DATAFLASH_LOGIC_ADDR_CS1, 1}
 };
 #elif defined(CONFIG_AT91SAM9263EK)
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
Quoted 8 lines

dataflash.c 2007-08-18 17:37:05.000000000 +0200 AT91S_DATAFLASH_INFO dataflash_info[CFG_ · line 42

Quoted 8 lines
dataflash.c 2007-08-18 17:37:05.000000000 +0200 renamed from dataflash.c.orig 2007-08-18 17:36:08.000000000 +0200 +1 -1
      {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0}       /* Logical adress, CS */
 };
 #else
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
      {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},      /* Logical adress, CS */
      {CFG_DATAFLASH_LOGIC_ADDR_CS3, 3}
 };

Why not call it dataflash_cs[] and move it into the board code? It already pollutes the namespace, is already board-dependent (hence the #ifdefs) and is apparently buggy?

Quoted 6 lines

Then the board code is responsible for defining a CFG_MAX_DATAFLASH_BANKS symbol which corresponds with the actual number of entries in the array. Of course, it can still be buggy, but at least it's contained within the board code.

Haavard

I send the patch just to say that the implementation does't work in the u-boot git code when CFG_MAX_DATAFLASH_BANKS is egual to 1. I find this fixing for me and send to the mailing list for a better solution. There are a lot of problem in the implementation of the dataflash layer. Take the cmd_mem.c file and It simple to observ that is not possible to use a dataflash cp operation to memory without define a dummy flash with parameters like CONFIG_MAX_BANKS set to 0. Regards Michael

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

#14 lore raw

m?n 2007-08-20 klockan 01:40 +0200 skrev trimarchi at gandalf.sssup.it:

Quoted 38 lines

Quoting H?vard Skinnemoen <[email protected]>:

Quoted 29 lines · Wolfgang Denk
Quoted 15 lines
Quoted 14 lines · In message <[email protected]> you wrote:
dataflash.c 2007-08-18 17:37:05.000000000 +0200 renamed from dataflash.c.orig 2007-08-18 17:36:08.000000000 +0200 +2 -2
@@ -27,16 +27,16 @@ AT91S_DATAFLASH_INFO dataflash_info[CFG_
 static AT91S_DataFlash DataFlashInst;
 
 #ifdef CONFIG_AT91SAM9260EK
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
      {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},      /* Logical adress, CS */
      {CFG_DATAFLASH_LOGIC_ADDR_CS1, 1}
 };
 #elif defined(CONFIG_AT91SAM9263EK)
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
Quoted 8 lines

dataflash.c 2007-08-18 17:37:05.000000000 +0200 AT91S_DATAFLASH_INFO dataflash_info[CFG_ · line 42

Quoted 8 lines
dataflash.c 2007-08-18 17:37:05.000000000 +0200 renamed from dataflash.c.orig 2007-08-18 17:36:08.000000000 +0200 +1 -1
      {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0}       /* Logical adress, CS */
 };
 #else
-int cs[][CFG_MAX_DATAFLASH_BANKS] = {
+int cs[][2] = {
      {CFG_DATAFLASH_LOGIC_ADDR_CS0, 0},      /* Logical adress, CS */
      {CFG_DATAFLASH_LOGIC_ADDR_CS3, 3}
 };

Why not call it dataflash_cs[] and move it into the board code? It already pollutes the namespace, is already board-dependent (hence the #ifdefs) and is apparently buggy?

Quoted 6 lines

Then the board code is responsible for defining a CFG_MAX_DATAFLASH_BANKS symbol which corresponds with the actual number of entries in the array. Of course, it can still be buggy, but at least it's contained within the board code.

Haavard

Quoted 9 lines

I send the patch just to say that the implementation does't work in the u-boot git code when CFG_MAX_DATAFLASH_BANKS is egual to 1. I find this fixing for me and send to the mailing list for a better solution. There are a lot of problem in the implementation of the dataflash layer. Take the cmd_mem.c file and It simple to observ that is not possible to use a dataflash cp operation to memory without define a dummy flash with parameters like CONFIG_MAX_BANKS set to 0. Regards Michael

Yes, but you fix it in the wrong way.

You remove the error message by introducing an inconsistency between the configuration and the actual code.

BR
Ulf Samuelsson