mirror of
https://github.com/u-boot/u-boot.git
synced 2024-11-26 21:54:37 +08:00
Improve DataFlash CS definition.
Use a structure instead of the error prone unnamed array to define the possible dataflash banks. Signed-off-by: Stelian Pop <stelian@popies.net>
This commit is contained in:
parent
a6cdd21b56
commit
d49fe4bed5
@ -26,17 +26,22 @@
|
||||
AT91S_DATAFLASH_INFO dataflash_info[CFG_MAX_DATAFLASH_BANKS];
|
||||
static AT91S_DataFlash DataFlashInst;
|
||||
|
||||
struct dataflash_addr {
|
||||
unsigned long addr;
|
||||
int cs;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_AT91SAM9260EK
|
||||
int cs[][CFG_MAX_DATAFLASH_BANKS] = {
|
||||
struct dataflash_addr cs[CFG_MAX_DATAFLASH_BANKS] = {
|
||||
{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] = {
|
||||
{CFG_DATAFLASH_LOGIC_ADDR_CS0, 0} /* Logical adress, CS */
|
||||
struct dataflash_addr cs[CFG_MAX_DATAFLASH_BANKS] = {
|
||||
{CFG_DATAFLASH_LOGIC_ADDR_CS0, 0}, /* Logical adress, CS */
|
||||
};
|
||||
#else
|
||||
int cs[][CFG_MAX_DATAFLASH_BANKS] = {
|
||||
struct dataflash_addr cs[CFG_MAX_DATAFLASH_BANKS] = {
|
||||
{CFG_DATAFLASH_LOGIC_ADDR_CS0, 0}, /* Logical adress, CS */
|
||||
{CFG_DATAFLASH_LOGIC_ADDR_CS3, 3}
|
||||
};
|
||||
@ -114,7 +119,7 @@ int AT91F_DataflashInit (void)
|
||||
dataflash_info[i].Desc.state = IDLE;
|
||||
dataflash_info[i].id = 0;
|
||||
dataflash_info[i].Device.pages_number = 0;
|
||||
dfcode = AT91F_DataflashProbe (cs[i][1],
|
||||
dfcode = AT91F_DataflashProbe (cs[i].cs,
|
||||
&dataflash_info[i].Desc);
|
||||
|
||||
switch (dfcode) {
|
||||
@ -123,9 +128,9 @@ int AT91F_DataflashInit (void)
|
||||
dataflash_info[i].Device.pages_size = 528;
|
||||
dataflash_info[i].Device.page_offset = 10;
|
||||
dataflash_info[i].Device.byte_mask = 0x300;
|
||||
dataflash_info[i].Device.cs = cs[i][1];
|
||||
dataflash_info[i].Device.cs = cs[i].cs;
|
||||
dataflash_info[i].Desc.DataFlash_state = IDLE;
|
||||
dataflash_info[i].logical_address = cs[i][0];
|
||||
dataflash_info[i].logical_address = cs[i].addr;
|
||||
dataflash_info[i].id = dfcode;
|
||||
found[i] += dfcode;;
|
||||
break;
|
||||
@ -135,9 +140,9 @@ int AT91F_DataflashInit (void)
|
||||
dataflash_info[i].Device.pages_size = 528;
|
||||
dataflash_info[i].Device.page_offset = 10;
|
||||
dataflash_info[i].Device.byte_mask = 0x300;
|
||||
dataflash_info[i].Device.cs = cs[i][1];
|
||||
dataflash_info[i].Device.cs = cs[i].cs;
|
||||
dataflash_info[i].Desc.DataFlash_state = IDLE;
|
||||
dataflash_info[i].logical_address = cs[i][0];
|
||||
dataflash_info[i].logical_address = cs[i].addr;
|
||||
dataflash_info[i].id = dfcode;
|
||||
found[i] += dfcode;;
|
||||
break;
|
||||
@ -147,9 +152,9 @@ int AT91F_DataflashInit (void)
|
||||
dataflash_info[i].Device.pages_size = 1056;
|
||||
dataflash_info[i].Device.page_offset = 11;
|
||||
dataflash_info[i].Device.byte_mask = 0x700;
|
||||
dataflash_info[i].Device.cs = cs[i][1];
|
||||
dataflash_info[i].Device.cs = cs[i].cs;
|
||||
dataflash_info[i].Desc.DataFlash_state = IDLE;
|
||||
dataflash_info[i].logical_address = cs[i][0];
|
||||
dataflash_info[i].logical_address = cs[i].addr;
|
||||
dataflash_info[i].id = dfcode;
|
||||
found[i] += dfcode;;
|
||||
break;
|
||||
@ -159,9 +164,9 @@ int AT91F_DataflashInit (void)
|
||||
dataflash_info[i].Device.pages_size = 1056;
|
||||
dataflash_info[i].Device.page_offset = 11;
|
||||
dataflash_info[i].Device.byte_mask = 0x700;
|
||||
dataflash_info[i].Device.cs = cs[i][1];
|
||||
dataflash_info[i].Device.cs = cs[i].cs;
|
||||
dataflash_info[i].Desc.DataFlash_state = IDLE;
|
||||
dataflash_info[i].logical_address = cs[i][0];
|
||||
dataflash_info[i].logical_address = cs[i].addr;
|
||||
dataflash_info[i].id = dfcode;
|
||||
found[i] += dfcode;;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user