<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-2">
<META content="MSHTML 6.00.6000.16414" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>
<DIV><FONT face=Arial size=2>Hello,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I designed my own board based on AT91RM9200DK but 
used different flash - AT49BV322D atmel flash.</FONT></DIV>
<DIV><FONT face=Arial size=2>I've downloaded uboot-1.1.5 with atmel patch 
already apllied and have there something in flash.c concernig this flash 
memory.</FONT></DIV>
<DIV><FONT face=Arial size=2>I chose target board and compilled uboot properly, 
it works fine but still doesn't detect my flash and I'm unable to do anything 
with it.</FONT></DIV>
<DIV><FONT face=Arial size=2>Maybe there is something missing in the flash.c 
source code. If someone is experienced in this will apreciate any 
help.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>best regards</FONT></DIV>
<DIV><FONT face=Arial size=2>Cyrul</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>here's flash.c:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>#include &lt;common.h&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>ulong myflush(void);</FONT></DIV>
<DIV><FONT face=Arial size=2><BR>typedef struct OrgDef<BR>{<BR>&nbsp;unsigned 
int sector_number;<BR>&nbsp;unsigned int sector_size;<BR>} OrgDef;</DIV>
<DIV><BR>OrgDef OrgAT49BV16x4[] =<BR>{<BR>&nbsp;{&nbsp; 8,&nbsp; 8*1024 
},&nbsp;/*&nbsp;&nbsp; 8 *&nbsp; 8 kBytes sectors */<BR>&nbsp;{&nbsp; 2, 32*1024 
},&nbsp;/*&nbsp;&nbsp; 2 * 32 kBytes sectors */<BR>&nbsp;{ 30, 64*1024 
},&nbsp;/*&nbsp; 30 * 64 kBytes sectors */<BR>};</DIV>
<DIV>&nbsp;</DIV>
<DIV>OrgDef OrgAT49BV16x4A[] =<BR>{<BR>&nbsp;{&nbsp; 8,&nbsp; 8*1024 
},&nbsp;/*&nbsp;&nbsp; 8 *&nbsp; 8 kBytes sectors */<BR>&nbsp;{ 31, 64*1024 
},&nbsp;/*&nbsp; 31 * 64 kBytes sectors */<BR>};</DIV>
<DIV>&nbsp;</DIV>
<DIV>OrgDef OrgAT49BV322D[] =<BR>{<BR>&nbsp;{&nbsp;&nbsp; 8,&nbsp; 8*1024 
},&nbsp;/*&nbsp;&nbsp; 8 *&nbsp; 8 kBytes sectors */<BR>&nbsp;{&nbsp; 63, 
64*1024 },&nbsp;/* 127 * 64 kBytes sectors */<BR>};</DIV>
<DIV>&nbsp;</DIV>
<DIV>OrgDef OrgAT49BV6416[] =<BR>{<BR>&nbsp;{&nbsp;&nbsp; 8,&nbsp; 8*1024 
},&nbsp;/*&nbsp;&nbsp; 8 *&nbsp; 8 kBytes sectors */<BR>&nbsp;{ 127, 64*1024 
},&nbsp;/* 127 * 64 kBytes sectors */<BR>};</DIV>
<DIV>&nbsp;</DIV>
<DIV>flash_info_t&nbsp;&nbsp;&nbsp; flash_info[CFG_MAX_FLASH_BANKS];</DIV>
<DIV><BR>/* AT49BV1614A Codes */<BR>#define 
FLASH_CODE1&nbsp;&nbsp;0xAA<BR>#define FLASH_CODE2&nbsp;&nbsp;0x55<BR>#define 
ID_IN_CODE&nbsp;&nbsp;0x90<BR>#define ID_OUT_CODE&nbsp;&nbsp;0xF0</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>#define CMD_READ_ARRAY&nbsp;&nbsp;0x00F0<BR>#define 
CMD_UNLOCK1&nbsp;&nbsp;0x00AA<BR>#define 
CMD_UNLOCK2&nbsp;&nbsp;0x0055<BR>#define 
CMD_ERASE_SETUP&nbsp;&nbsp;0x0080<BR>#define 
CMD_ERASE_CONFIRM&nbsp;0x0030<BR>#define 
CMD_PROGRAM&nbsp;&nbsp;0x00A0<BR>#define 
CMD_UNLOCK_BYPASS&nbsp;0x0020<BR>#define CMD_SECTOR_UNLOCK&nbsp;0x0070</DIV>
<DIV>&nbsp;</DIV>
<DIV>#define MEM_FLASH_ADDR1&nbsp;&nbsp;(*(volatile u16 *)(CFG_FLASH_BASE + 
(0x00005555&lt;&lt;1)))<BR>#define MEM_FLASH_ADDR2&nbsp;&nbsp;(*(volatile u16 
*)(CFG_FLASH_BASE + (0x00002AAA&lt;&lt;1)))</DIV>
<DIV>&nbsp;</DIV>
<DIV>#define BIT_ERASE_DONE&nbsp;&nbsp;0x0080<BR>#define 
BIT_RDY_MASK&nbsp;&nbsp;0x0080<BR>#define 
BIT_PROGRAM_ERROR&nbsp;0x0020<BR>#define BIT_TIMEOUT&nbsp;&nbsp;0x80000000 /* 
our flag */</DIV>
<DIV>&nbsp;</DIV>
<DIV>#define READY 1<BR>#define ERR&nbsp;&nbsp; 2<BR>#define TMO&nbsp;&nbsp; 
4</DIV>
<DIV><BR>void flash_identification (flash_info_t * info)<BR>{<BR>&nbsp;volatile 
u16 manuf_code, device_code, add_device_code;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;MEM_FLASH_ADDR1 = FLASH_CODE1;<BR>&nbsp;MEM_FLASH_ADDR2 = 
FLASH_CODE2;<BR>&nbsp;MEM_FLASH_ADDR1 = ID_IN_CODE;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;manuf_code = *(volatile u16 *) CFG_FLASH_BASE;<BR>&nbsp;device_code = 
*(volatile u16 *) (CFG_FLASH_BASE + 2);<BR>&nbsp;add_device_code = *(volatile 
u16 *) (CFG_FLASH_BASE + (3 &lt;&lt; 1));</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;MEM_FLASH_ADDR1 = FLASH_CODE1;<BR>&nbsp;MEM_FLASH_ADDR2 = 
FLASH_CODE2;<BR>&nbsp;MEM_FLASH_ADDR1 = ID_OUT_CODE;</DIV>
<DIV>&nbsp;</DIV>
<DIV>#ifdef&nbsp;CFG_IGNORE_PARFLASH<BR>&nbsp;info-&gt;flash_id = 
FLASH_UNKNOWN;<BR>&nbsp;printf ("Parallel flash 
ignored\n");<BR>#else<BR>&nbsp;if(manuf_code == (ATM_MANUFACT &amp; 
FLASH_VENDMASK)) {<BR>&nbsp;&nbsp;/* Vendor type 
*/<BR>&nbsp;&nbsp;info-&gt;flash_id = ATM_MANUFACT &amp; 
FLASH_VENDMASK;<BR>&nbsp;&nbsp;printf ("Atmel: ");<BR>&nbsp;} else 
{<BR>&nbsp;&nbsp;/* Make illegal device doe*/<BR>&nbsp;&nbsp;printf ("Unknown 
Vendor: ");<BR>&nbsp;&nbsp;device_code = 0;<BR>&nbsp;}</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;/* 16 Mbit Devices (Not recommended for new design) 
*/&nbsp;<BR>&nbsp;if ((device_code &amp; FLASH_TYPEMASK) == (ATM_ID_BV1614 &amp; 
FLASH_TYPEMASK)) {</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;if ((add_device_code &amp; FLASH_TYPEMASK) 
==<BR>&nbsp;&nbsp;&nbsp;(ATM_ID_BV1614A &amp; FLASH_TYPEMASK)) 
{<BR>&nbsp;&nbsp;&nbsp;info-&gt;flash_id |= ATM_ID_BV1614A &amp; 
FLASH_TYPEMASK;<BR>&nbsp;&nbsp;&nbsp;printf ("AT49BV1614A 
(16Mbit)\n");<BR>&nbsp;&nbsp;} else {&nbsp;&nbsp;&nbsp;&nbsp;/* AT49BV1614 Flash 
*/<BR>&nbsp;&nbsp;&nbsp;info-&gt;flash_id |= ATM_ID_BV1614 &amp; 
FLASH_TYPEMASK;<BR>&nbsp;&nbsp;&nbsp;printf ("AT49BV1614 
(16Mbit)\n");<BR>&nbsp;&nbsp;}</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;/* 16 Mbit Devices (Recommended for new design) */&nbsp;<BR>&nbsp;} 
else if ((device_code &amp; FLASH_TYPEMASK) == (ATM_ID_BV160D &amp; 
FLASH_TYPEMASK)) {<BR>&nbsp;&nbsp;info-&gt;flash_id |= ATM_ID_BV160D &amp; 
FLASH_TYPEMASK;<BR>&nbsp;&nbsp;printf ("AT49BV160D (16Mbit)\n");<BR>&nbsp;} else 
if ((device_code &amp; FLASH_TYPEMASK) == (ATM_ID_BV160DT &amp; FLASH_TYPEMASK)) 
{<BR>&nbsp;&nbsp;info-&gt;flash_id = 
FLASH_UNKNOWN;<BR>&nbsp;//&nbsp;info-&gt;flash_id |= ATM_ID_BV160DT &amp; 
FLASH_TYPEMASK;<BR>&nbsp;&nbsp;printf ("AT49BV160DT (16Mbit) - Not Yet Supported 
\n");<BR>&nbsp;} else if ((device_code &amp; FLASH_TYPEMASK) == (ATM_ID_BV163D 
&amp; FLASH_TYPEMASK)) {<BR>&nbsp;&nbsp;info-&gt;flash_id |= ATM_ID_BV163D &amp; 
FLASH_TYPEMASK;<BR>&nbsp;&nbsp;printf ("AT49BV163D (16Mbit)\n");<BR>&nbsp;} else 
if ((device_code &amp; FLASH_TYPEMASK) == (ATM_ID_BV163DT &amp; FLASH_TYPEMASK)) 
{<BR>&nbsp;&nbsp;info-&gt;flash_id |= ATM_ID_BV163DT &amp; 
FLASH_TYPEMASK;<BR>&nbsp;&nbsp;printf ("AT49BV163DT (16Mbit) - Not Yet 
Supported\n");</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;/* 32 Mbit Devices (Not recommended for new design) 
*/&nbsp;<BR>&nbsp;} else if ((device_code &amp; FLASH_TYPEMASK) == 
(ATM_ID_BV322A &amp; FLASH_TYPEMASK)) {<BR>&nbsp;&nbsp;info-&gt;flash_id |= 
ATM_ID_BV322A &amp; FLASH_TYPEMASK;<BR>&nbsp;&nbsp;printf ("AT49BV322A 
(64Mbit)\n");</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;/* 32 Mbit Devices (Recommended for new design) */<BR>&nbsp;} else if 
((device_code &amp; FLASH_TYPEMASK) == (ATM_ID_BV320D &amp; FLASH_TYPEMASK)) 
{<BR>&nbsp;&nbsp;info-&gt;flash_id |= ATM_ID_BV320D &amp; 
FLASH_TYPEMASK;<BR>&nbsp;&nbsp;info-&gt;flash_id = 
FLASH_UNKNOWN;<BR>&nbsp;&nbsp;printf ("AT49BV320D (64Mbit) - Not Yet 
Supported\n");<BR>&nbsp;} else if ((device_code &amp; FLASH_TYPEMASK) == 
(ATM_ID_BV320DT &amp; FLASH_TYPEMASK)) {<BR>&nbsp;&nbsp;info-&gt;flash_id |= 
ATM_ID_BV320DT &amp; FLASH_TYPEMASK;<BR>&nbsp;&nbsp;info-&gt;flash_id = 
FLASH_UNKNOWN;<BR>&nbsp;&nbsp;printf ("AT49BV320DT (64Mbit) - Not Yet 
Supported\n");<BR>&nbsp;} else if ((device_code &amp; FLASH_TYPEMASK) == 
(ATM_ID_BV322D &amp; FLASH_TYPEMASK)) {<BR>&nbsp;&nbsp;info-&gt;flash_id |= 
ATM_ID_BV322D &amp; FLASH_TYPEMASK;<BR>&nbsp;&nbsp;printf ("AT49BV322D 
(64Mbit)\n");<BR>&nbsp;} else if ((device_code &amp; FLASH_TYPEMASK) == 
(ATM_ID_BV322DT &amp; FLASH_TYPEMASK)) {<BR>&nbsp;&nbsp;info-&gt;flash_id |= 
ATM_ID_BV322DT &amp; FLASH_TYPEMASK;<BR>&nbsp;&nbsp;info-&gt;flash_id = 
FLASH_UNKNOWN;<BR>&nbsp;&nbsp;printf ("AT49BV322DT (64Mbit) - Not Yet 
Supported\n");</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;/* 64 Mbit Devices (Not recommended for new design) 
*/&nbsp;<BR>&nbsp;} else if ((device_code &amp; FLASH_TYPEMASK) == 
(ATM_ID_BV6416 &amp; FLASH_TYPEMASK)) {<BR>&nbsp;&nbsp;info-&gt;flash_id |= 
ATM_ID_BV6416 &amp; FLASH_TYPEMASK;<BR>&nbsp;&nbsp;printf ("AT49BV6416 
(64Mbit)\n");<BR>&nbsp;} else if ((device_code &amp; FLASH_TYPEMASK) == 
(ATM_ID_BV6416T &amp; FLASH_TYPEMASK)) {<BR>&nbsp;&nbsp;info-&gt;flash_id |= 
ATM_ID_BV6416T &amp; FLASH_TYPEMASK;<BR>&nbsp;&nbsp;info-&gt;flash_id = 
FLASH_UNKNOWN;<BR>&nbsp;&nbsp;printf ("AT49BV6416 (64Mbit) - Top Boot Not Yet 
Supported\n");<BR>&nbsp;} else if ((device_code &amp; FLASH_TYPEMASK) == 
(ATM_ID_BV6416C &amp; FLASH_TYPEMASK)) {<BR>&nbsp;&nbsp;info-&gt;flash_id |= 
ATM_ID_BV6416C &amp; FLASH_TYPEMASK;<BR>&nbsp;&nbsp;info-&gt;flash_id = 
FLASH_UNKNOWN;<BR>&nbsp;&nbsp;printf ("AT49BV6416C (64Mbit) - Not Yet 
Supported\n");<BR>&nbsp;} else if ((device_code &amp; FLASH_TYPEMASK) == 
(ATM_ID_BV6416CT &amp; FLASH_TYPEMASK)) {<BR>&nbsp;&nbsp;info-&gt;flash_id |= 
ATM_ID_BV6416CT &amp; FLASH_TYPEMASK;<BR>&nbsp;&nbsp;info-&gt;flash_id = 
FLASH_UNKNOWN;<BR>&nbsp;&nbsp;printf ("AT49BV6416CT (64Mbit) - Top Boot Not Yet 
Supported\n");</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;/* 64 Mbit Devices (Recommended for new design) */&nbsp;<BR>&nbsp;} 
else if ((device_code &amp; FLASH_TYPEMASK) == (ATM_ID_BV640D &amp; 
FLASH_TYPEMASK)) {<BR>&nbsp;&nbsp;info-&gt;flash_id |= ATM_ID_BV640D &amp; 
FLASH_TYPEMASK;<BR>&nbsp;&nbsp;info-&gt;flash_id = 
FLASH_UNKNOWN;<BR>&nbsp;&nbsp;printf ("AT49BV640D (64Mbit) - Not Yet 
Supported\n");<BR>&nbsp;} else if ((device_code &amp; FLASH_TYPEMASK) == 
(ATM_ID_BV640DT &amp; FLASH_TYPEMASK)) {<BR>&nbsp;&nbsp;info-&gt;flash_id |= 
ATM_ID_BV640DT &amp; FLASH_TYPEMASK;<BR>&nbsp;&nbsp;info-&gt;flash_id = 
FLASH_UNKNOWN;<BR>&nbsp;&nbsp;printf ("AT49BV640DT (64Mbit) - Top Boot Not Yet 
Supported\n");<BR>&nbsp;} else if ((device_code &amp; FLASH_TYPEMASK) == 
(ATM_ID_BV642D &amp; FLASH_TYPEMASK)) {<BR>&nbsp;&nbsp;info-&gt;flash_id |= 
ATM_ID_BV642D &amp; FLASH_TYPEMASK;<BR>&nbsp;&nbsp;printf ("AT49BV642D 
(64Mbit)\n");<BR>&nbsp;} else if ((device_code &amp; FLASH_TYPEMASK) == 
(ATM_ID_BV642DT &amp; FLASH_TYPEMASK)) {<BR>&nbsp;&nbsp;info-&gt;flash_id |= 
ATM_ID_BV642DT &amp; FLASH_TYPEMASK;<BR>&nbsp;&nbsp;info-&gt;flash_id = 
FLASH_UNKNOWN;<BR>&nbsp;&nbsp;printf ("AT49BV642DT (64Mbit) - Top Boot Not Yet 
Supported\n");<BR>&nbsp;} else if ((device_code &amp; FLASH_TYPEMASK) == 
(ATM_ID_BV6404 &amp; FLASH_TYPEMASK)) {<BR>&nbsp;&nbsp;info-&gt;flash_id |= 
ATM_ID_BV6404 &amp; FLASH_TYPEMASK;<BR>&nbsp;&nbsp;info-&gt;flash_id = 
FLASH_UNKNOWN;<BR>&nbsp;&nbsp;printf ("AT49BV6404 (64Mbit - Not Yet 
Supported)\n");<BR>&nbsp;} else {<BR>&nbsp;&nbsp;info-&gt;flash_id = 
FLASH_UNKNOWN;<BR>&nbsp;&nbsp;printf ("UNKNOWN device or not 
present\n");<BR>&nbsp;}<BR>#endif<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>ushort flash_number_sector(OrgDef *pOrgDef, unsigned int 
nb_blocks)<BR>{<BR>&nbsp;int i, nb_sectors = 0;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;for (i=0; i&lt;nb_blocks; i++){<BR>&nbsp;&nbsp;nb_sectors += 
pOrgDef[i].sector_number;<BR>&nbsp;}</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;return nb_sectors;<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>void flash_unlock_sector(flash_info_t * info, unsigned int 
sector)<BR>{<BR>&nbsp;volatile u16 *addr = (volatile u16 *) 
(info-&gt;start[sector]);</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;MEM_FLASH_ADDR1 = CMD_UNLOCK1;<BR>&nbsp;*addr = 
CMD_SECTOR_UNLOCK;<BR>}</DIV>
<DIV><BR>ulong flash_init (void)<BR>{<BR>&nbsp;int i, j, k;<BR>&nbsp;unsigned 
int flash_nb_blocks, sector;<BR>&nbsp;unsigned int 
start_address;<BR>&nbsp;unsigned int unlock;<BR>&nbsp;OrgDef *pOrgDef;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;ulong size = 0;</DIV>
<DIV><BR>&nbsp;for (i = 0; i &lt; CFG_MAX_FLASH_BANKS; i++) 
{<BR>&nbsp;&nbsp;ulong flashbase = 0;<BR>&nbsp;&nbsp;unlock = 0;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;flash_identification (&amp;flash_info[i]);</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;if ((flash_info[i].flash_id &amp; FLASH_TYPEMASK) 
==<BR>&nbsp;&nbsp;&nbsp;(ATM_ID_BV1614 &amp; FLASH_TYPEMASK)) {&nbsp;/* 
AT49BV1614 Flash */</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;pOrgDef = 
OrgAT49BV16x4;<BR>&nbsp;&nbsp;&nbsp;flash_nb_blocks = sizeof (OrgAT49BV16x4) / 
sizeof (OrgDef);<BR>&nbsp;&nbsp;} else if ((flash_info[i].flash_id &amp; 
FLASH_TYPEMASK) ==<BR>&nbsp;&nbsp;&nbsp;(ATM_ID_BV1614A &amp; 
FLASH_TYPEMASK)){&nbsp;/* AT49BV1614A Flash */</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;pOrgDef = 
OrgAT49BV16x4A;<BR>&nbsp;&nbsp;&nbsp;flash_nb_blocks = sizeof (OrgAT49BV16x4A) / 
sizeof (OrgDef);<BR>&nbsp;&nbsp;} else if ((flash_info[i].flash_id &amp; 
FLASH_TYPEMASK) ==<BR>&nbsp;&nbsp;&nbsp;(ATM_ID_BV163D &amp; 
FLASH_TYPEMASK)){&nbsp;/* AT49BV163D Flash */</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;pOrgDef = 
OrgAT49BV16x4A;<BR>&nbsp;&nbsp;&nbsp;flash_nb_blocks = sizeof (OrgAT49BV16x4A) / 
sizeof (OrgDef);<BR>&nbsp;&nbsp;} else if ((flash_info[i].flash_id &amp; 
FLASH_TYPEMASK) ==<BR>&nbsp;&nbsp;&nbsp;(ATM_ID_BV322A &amp; 
FLASH_TYPEMASK)){&nbsp;/* AT49BV322D Flash */</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;pOrgDef = 
OrgAT49BV322D;<BR>&nbsp;&nbsp;&nbsp;flash_nb_blocks = sizeof (OrgAT49BV16x4A) / 
sizeof (OrgDef);<BR>&nbsp;&nbsp;} else if ((flash_info[i].flash_id &amp; 
FLASH_TYPEMASK) ==<BR>&nbsp;&nbsp;&nbsp;(ATM_ID_BV322D &amp; 
FLASH_TYPEMASK)){&nbsp;/* AT49BV322D Flash */<BR>&nbsp;&nbsp;&nbsp;unlock = 
1;<BR>&nbsp;&nbsp;&nbsp;pOrgDef = 
OrgAT49BV322D;<BR>&nbsp;&nbsp;&nbsp;flash_nb_blocks = sizeof (OrgAT49BV16x4A) / 
sizeof (OrgDef);<BR>&nbsp;&nbsp;} else if ((flash_info[i].flash_id &amp; 
FLASH_TYPEMASK) ==<BR>&nbsp;&nbsp;&nbsp;(ATM_ID_BV6416 &amp; 
FLASH_TYPEMASK)){&nbsp;/* AT49BV6416 Flash */<BR>&nbsp;&nbsp;&nbsp;unlock = 
1;<BR>&nbsp;&nbsp;&nbsp;pOrgDef = 
OrgAT49BV6416;<BR>&nbsp;&nbsp;&nbsp;flash_nb_blocks = sizeof (OrgAT49BV6416) / 
sizeof (OrgDef);<BR>&nbsp;&nbsp;} else if ((flash_info[i].flash_id &amp; 
FLASH_TYPEMASK) ==<BR>&nbsp;&nbsp;&nbsp;(ATM_ID_BV642D &amp; 
FLASH_TYPEMASK)){&nbsp;/* AT49BV642D Flash */<BR>&nbsp;&nbsp;&nbsp;unlock = 
1;<BR>&nbsp;&nbsp;&nbsp;pOrgDef = 
OrgAT49BV6416;<BR>&nbsp;&nbsp;&nbsp;flash_nb_blocks = sizeof (OrgAT49BV6416) / 
sizeof (OrgDef);<BR>&nbsp;&nbsp;} else {<BR>&nbsp;&nbsp;&nbsp;flash_nb_blocks = 
0;<BR>&nbsp;&nbsp;&nbsp;pOrgDef = OrgAT49BV16x4;<BR>&nbsp;&nbsp;}</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;flash_info[i].sector_count = flash_number_sector(pOrgDef, 
flash_nb_blocks);<BR>&nbsp;&nbsp;memset (flash_info[i].protect, 0, 
flash_info[i].sector_count);</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;if (i == 0)<BR>&nbsp;&nbsp;&nbsp;flashbase = 
PHYS_FLASH_1;<BR>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;panic ("configured too 
many flash banks!\n");</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;sector = 0;<BR>&nbsp;&nbsp;start_address = 
flashbase;<BR>&nbsp;&nbsp;flash_info[i].size = 0;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;for (j = 0; j &lt; flash_nb_blocks; j++) 
{<BR>&nbsp;&nbsp;&nbsp;for (k = 0; k &lt; pOrgDef[j].sector_number; k++) 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;flash_info[i].start[sector++] = 
start_address;<BR>&nbsp;&nbsp;&nbsp;&nbsp;start_address += 
pOrgDef[j].sector_size;<BR>&nbsp;&nbsp;&nbsp;&nbsp;flash_info[i].size += 
pOrgDef[j].sector_size;<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;size += flash_info[i].size;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;if (unlock){<BR>&nbsp;&nbsp;&nbsp;/* Unlock all sectors at 
reset */<BR>&nbsp;&nbsp;&nbsp;for (j=0; j&lt;flash_info[i].sector_count; 
j++){<BR>&nbsp;&nbsp;&nbsp;&nbsp;flash_unlock_sector(&amp;flash_info[i], 
j);<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}<BR>&nbsp;}</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;/* Protect binary boot image */<BR>&nbsp;flash_protect 
(FLAG_PROTECT_SET,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
CFG_FLASH_BASE,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
CFG_FLASH_BASE + CFG_BOOT_SIZE - 1, &amp;flash_info[0]);</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;/* Protect environment variables */<BR>&nbsp;flash_protect 
(FLAG_PROTECT_SET,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
CFG_ENV_ADDR,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CFG_ENV_ADDR + 
CFG_ENV_SIZE - 1, &amp;flash_info[0]);</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;/* Protect U-Boot gzipped image */<BR>&nbsp;flash_protect 
(FLAG_PROTECT_SET,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
CFG_U_BOOT_BASE,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
CFG_U_BOOT_BASE + CFG_U_BOOT_SIZE - 1, &amp;flash_info[0]);</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;return size;<BR>}</DIV>
<DIV><BR>void flash_print_info (flash_info_t * info)<BR>{<BR>&nbsp;int i;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;switch (info-&gt;flash_id &amp; FLASH_VENDMASK) {<BR>&nbsp;case 
(ATM_MANUFACT &amp; FLASH_VENDMASK):<BR>&nbsp;&nbsp;printf ("Atmel: 
");<BR>&nbsp;&nbsp;break;<BR>&nbsp;default:<BR>&nbsp;&nbsp;printf ("Unknown 
Vendor ");<BR>&nbsp;&nbsp;break;<BR>&nbsp;}</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;switch (info-&gt;flash_id &amp; FLASH_TYPEMASK) {<BR>&nbsp;case 
(ATM_ID_BV1614 &amp; FLASH_TYPEMASK):<BR>&nbsp;&nbsp;printf ("AT49BV1614 
(16Mbit)\n");<BR>&nbsp;&nbsp;break;<BR>&nbsp;case (ATM_ID_BV1614A &amp; 
FLASH_TYPEMASK):<BR>&nbsp;&nbsp;printf ("AT49BV1614A 
(16Mbit)\n");<BR>&nbsp;&nbsp;break;<BR>&nbsp;case (ATM_ID_BV160D &amp; 
FLASH_TYPEMASK):<BR>&nbsp;&nbsp;printf ("AT49BV160D&nbsp; 
(16Mbit)\n");<BR>&nbsp;&nbsp;break;<BR>&nbsp;case (ATM_ID_BV160DT &amp; 
FLASH_TYPEMASK):<BR>&nbsp;&nbsp;printf ("AT49BV160DT&nbsp; 
(16Mbit)\n");<BR>&nbsp;&nbsp;break;<BR>&nbsp;case (ATM_ID_BV163D &amp; 
FLASH_TYPEMASK):<BR>&nbsp;&nbsp;printf ("AT49BV163D 
(16Mbit)\n");<BR>&nbsp;&nbsp;break;<BR>&nbsp;case (ATM_ID_BV163DT &amp; 
FLASH_TYPEMASK):<BR>&nbsp;&nbsp;printf ("AT49BV163DT 
(16Mbit)\n");<BR>&nbsp;&nbsp;break;<BR>#if 0&nbsp;&nbsp;/* Duplicate with 
ATM_ID_BV1614A */<BR>&nbsp;case (ATM_ID_BV322A &amp; 
FLASH_TYPEMASK):<BR>&nbsp;&nbsp;printf ("AT49BV322A 
(32Mbit)\n");<BR>&nbsp;&nbsp;break;<BR>#endif<BR>&nbsp;case (ATM_ID_BV322AT 
&amp; FLASH_TYPEMASK):<BR>&nbsp;&nbsp;printf ("AT49BV322AT 
(32Mbit)\n");<BR>&nbsp;&nbsp;break;<BR>&nbsp;case (ATM_ID_BV320D &amp; 
FLASH_TYPEMASK):<BR>&nbsp;&nbsp;printf ("AT49BV320D&nbsp; 
(32Mbit)\n");<BR>&nbsp;&nbsp;break;<BR>&nbsp;case (ATM_ID_BV320DT &amp; 
FLASH_TYPEMASK):<BR>&nbsp;&nbsp;printf ("AT49BV320DT&nbsp; 
(32Mbit)\n");<BR>&nbsp;&nbsp;break;<BR>&nbsp;case (ATM_ID_BV322D &amp; 
FLASH_TYPEMASK):<BR>&nbsp;&nbsp;printf ("AT49BV322D&nbsp; 
(32Mbit)\n");<BR>&nbsp;&nbsp;break;<BR>&nbsp;case (ATM_ID_BV322DT &amp; 
FLASH_TYPEMASK):<BR>&nbsp;&nbsp;printf ("AT49BV322DT&nbsp; 
(32Mbit)\n");<BR>&nbsp;&nbsp;break;<BR>&nbsp;case (ATM_ID_BV6416 &amp; 
FLASH_TYPEMASK):<BR>&nbsp;&nbsp;printf ("AT49BV6416 
(64Mbit)\n");<BR>&nbsp;&nbsp;break;<BR>&nbsp;case (ATM_ID_BV6416T &amp; 
FLASH_TYPEMASK):<BR>&nbsp;&nbsp;printf ("AT49BV6416T 
(64Mbit)\n");<BR>&nbsp;&nbsp;break;<BR>&nbsp;case (ATM_ID_BV6416C &amp; 
FLASH_TYPEMASK):<BR>&nbsp;&nbsp;printf ("AT49BV6416C 
(64Mbit)\n");<BR>&nbsp;&nbsp;break;<BR>&nbsp;case (ATM_ID_BV6416CT &amp; 
FLASH_TYPEMASK):<BR>&nbsp;&nbsp;printf ("AT49BV6416CT 
(64Mbit)\n");<BR>&nbsp;&nbsp;break;<BR>&nbsp;case (ATM_ID_BV640D &amp; 
FLASH_TYPEMASK):<BR>&nbsp;&nbsp;printf ("AT49BV640D 
(64Mbit)\n");<BR>&nbsp;&nbsp;break;<BR>&nbsp;case (ATM_ID_BV640DT &amp; 
FLASH_TYPEMASK):<BR>&nbsp;&nbsp;printf ("AT49BV640DT 
(64Mbit)\n");<BR>&nbsp;&nbsp;break;<BR>&nbsp;case (ATM_ID_BV642D &amp; 
FLASH_TYPEMASK):<BR>&nbsp;&nbsp;printf ("AT49BV642C 
(64Mbit)\n");<BR>&nbsp;&nbsp;break;<BR>&nbsp;case (ATM_ID_BV642DT &amp; 
FLASH_TYPEMASK):<BR>&nbsp;&nbsp;printf ("AT49BV642DT 
(64Mbit)\n");<BR>&nbsp;&nbsp;break;<BR>&nbsp;default:<BR>&nbsp;&nbsp;printf 
("Unknown Chip Type\n");<BR>&nbsp;&nbsp;return;<BR>&nbsp;}</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;printf ("&nbsp; Size: %ld MB in %d 
Sectors\n",<BR>&nbsp;&nbsp;info-&gt;size &gt;&gt; 20, 
info-&gt;sector_count);</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;printf ("&nbsp; Sector Start Addresses:");<BR>&nbsp;for (i = 0; i 
&lt; info-&gt;sector_count; i++) {<BR>&nbsp;&nbsp;if ((i % 5) == 0) 
{<BR>&nbsp;&nbsp;&nbsp;printf ("\n&nbsp;&nbsp; 
");<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;if(info-&gt;protect[i] != 
FLAG_PROTECT_INVALID) {<BR>&nbsp;&nbsp;&nbsp;printf (" %08lX%s", 
info-&gt;start[i],<BR>&nbsp;&nbsp;&nbsp;&nbsp;info-&gt;protect[i] ? " (RO)" : 
"&nbsp;&nbsp;&nbsp;&nbsp; ");<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>&nbsp;printf 
("\n");<BR>} </FONT></DIV><FONT face=Arial size=2>
<DIV>&nbsp;</DIV>
<DIV>erase, write_buff, write_word&nbsp; functions are the same - like in other 
uboot versions without atmel&nbsp;patch applied</FONT></DIV></DIV><br/>
----------------------<br/>
Panorama Internetu - prognoza pogody, poczta e-mail z największym załącznikiem, SMS, wyszukiwarki: Gooru, Anonser, serwisy: randki, ogłoszenia, wakacje, program TV, Kina, muzyka, DVD, newsy, inne.<br/>
<a href="http://www.panoramainternetu.pl/">www.panoramainternetu.pl (www.epf.pl)</a><br/>

</BODY></HTML>