This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: AMD flash driver problem - error reading device ID


> From: Uwe Kindler
> 
> currently I'm trying to create a flash driver for our ARM 
> based board. 
> The flash driver uses the generic AMD v1 driver package 
> (packages/devs/flash/amd/am29xxxxx).
> This is the platform definition of my flash driver:
> 
> #define CYGNUM_FLASH_INTERLEAVE	(2)
> #define CYGNUM_FLASH_WIDTH      (16)
> #define CYGNUM_FLASH_SERIES	(1)
> #define CYGNUM_FLASH_BASE 	(0x80000000u)
> 
> The driver fails reading the device ID from the flash device. 
> I tracked 
> the problem down to the function flash_query() in flash_am29xxxxx.inl.
> 
> According to the data sheet of the flash, the sequence for 
> reading the 
> device ID is:
> 
> writing 0xAA to 0x555
> writing 0x55 to 0x2AA
> writing 0x90 to 0x555
> 
> This sequence is represented by the following code in flash_query()
> 
> *f_s1 = FLASH_Setup_Code1;
> *f_s2 = FLASH_Setup_Code2;
> *f_s1 = FLASH_Read_ID;
> 
> The problem is, that the calculation of *f_s1 and *f_s2 goes 
> wrong. This 
> is the code for calculation in flash_query():
> 
> ROM  = (flash_data_t*) CYGNUM_FLASH_BASE;
> f_s1 = FLASH_P2V(ROM+FLASH_Setup_Addr1);
> f_s2 = FLASH_P2V(ROM+FLASH_Setup_Addr2);
> 
> According to my platform definitions I would expect the 
> following values 
> for the 3 pointers:
> 
> ROM  = 0x80000000
> f_s1 = 0x80000555
> f_s2 = 0x800002AA
> 
> but after calculation the values are:
> 
> ROM  = 0x80000000
> f_s1 = 0x80001554
> f_s2 = 0x80000AA8
> 
> I checked the values CYGNUM_FLASH_BASE, FLASH_Setup_Addr1 and 
> FLASH_Setup_Addr2 with diag_printf(). They have the follwing values:
> 
> CYGNUM_FLASH_BASE = 0x80000000
> FLASH_Setup_Addr1 = 0x555
> FLASH_Setup_Addr2 = 0xAA8
> 
> So it seems that the calculation of the pointers goes wrong. 

Unless the flash is a byte-wide device on a byte-wide bus, the flash setup
addresses are supposed to be multiplied by the width of the flash. They're
not byte addresses, they're flash word addresses.

-- 

Ciao,               Paul D. DeRocco
Paul                mailto:pderocco@ix.netcom.com 


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]