# HG changeset patch # User bartv # Date 1061144749 0 # Node ID 2fe7cd7dffaa7d6be84c279c41315705be8f0fb4 # Parent 5c0607157fec4a37e9fed5f4594031ed8a33af1c Add support for the AM29PL160. Allow platform-specific code to override the default loop counts used for various timeouts. diff --git a/packages/devs/flash/amd/am29xxxxx/current/ChangeLog b/packages/devs/flash/amd/am29xxxxx/current/ChangeLog --- a/packages/devs/flash/amd/am29xxxxx/current/ChangeLog +++ b/packages/devs/flash/amd/am29xxxxx/current/ChangeLog @@ -1,3 +1,12 @@ +2003-08-17 Bart Veer + + * include/flash_am29xxxxx.inl: + Allow platform-specific code to override the default loop counts + used for timeouts. + + * include/flash_am29xxxxx_parts.inl, cdl/flash_amd_am29xxxxx.cdl: + Add AM29PL160 device + 2003-07-23 Chris Garry * include/flash_am29xxxxx_parts.inl (CYGHWR_DEVS_FLASH_AMD_AM29LV400): diff --git a/packages/devs/flash/amd/am29xxxxx/current/cdl/flash_amd_am29xxxxx.cdl b/packages/devs/flash/amd/am29xxxxx/current/cdl/flash_amd_am29xxxxx.cdl --- a/packages/devs/flash/amd/am29xxxxx/current/cdl/flash_amd_am29xxxxx.cdl +++ b/packages/devs/flash/amd/am29xxxxx/current/cdl/flash_amd_am29xxxxx.cdl @@ -87,6 +87,16 @@ cdl_package CYGPKG_DEVS_FLASH_AMD_AM29XX part in the family." } + cdl_option CYGHWR_DEVS_FLASH_AMD_AM29PL160 { + display "AMD AM29PL160 flash memory support" + default_value 0 + implements CYGINT_DEVS_FLASH_AMD_VARIANTS + description " + When this option is enabled, the AMD flash driver will be + able to recognize and handle the AMD29PL160 + part in the family." + } + cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV320D { display "AMD AM29LV320 flash memory support" default_value 0 diff --git a/packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl b/packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl --- a/packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl +++ b/packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl @@ -121,6 +121,23 @@ // #define CYGNUM_FLASH_WIDTH : Width of devices on platform // #define CYGNUM_FLASH_BASE : Address of first device +// Platform code may define some or all of the below, to provide +// timeouts appropriate to the target hardware. The timeout +// values depend partly on the flash part being used, partly +// on the target (including bus and cpu speeds). +#ifndef CYGNUM_FLASH_TIMEOUT_QUERY +# define CYGNUM_FLASH_TIMEOUT_QUERY 500000 +#endif +#ifndef CYGNUM_FLASH_TIMEOUT_ERASE_TIMER +# define CYGNUM_FLASH_TIMEOUT_ERASE_TIMER 10000000 +#endif +#ifndef CYGNUM_FLASH_TIMEOUT_ERASE_COMPLETE +# define CYGNUM_FLASH_TIMEOUT_ERASE_COMPLETE 10000000 +#endif +#ifndef CYGNUM_FLASH_TIMEOUT_PROGRAM +# define CYGNUM_FLASH_TIMEOUT_PROGRAM 10000000 +#endif + #define CYGNUM_FLASH_BLANK (1) #ifndef FLASH_P2V @@ -183,7 +200,7 @@ flash_query(void* data) volatile flash_data_t *f_s1, *f_s2; flash_data_t* id = (flash_data_t*) data; flash_data_t w; - long timeout = 500000; + long timeout = CYGNUM_FLASH_TIMEOUT_QUERY; ROM = (flash_data_t*) CYGNUM_FLASH_BASE; f_s1 = FLASH_P2V(ROM+FLASH_Setup_Addr1); @@ -282,14 +299,13 @@ flash_erase_block(void* block, unsigned volatile flash_data_t* b_p = (flash_data_t*) block; volatile flash_data_t *b_v; volatile flash_data_t *f_s0, *f_s1, *f_s2; - int timeout = 50000; + int timeout = CYGNUM_FLASH_TIMEOUT_QUERY; int len = 0; int res = FLASH_ERR_OK; flash_data_t state; cyg_bool bootblock = false; cyg_uint32 *bootblocks = (cyg_uint32 *)0; CYG_ADDRWORD bank_offset; - BANK = ROM = (volatile flash_data_t*)((unsigned long)block & flash_dev_info->base_mask); // If this is a banked device, find the bank where commands should @@ -355,7 +371,7 @@ flash_erase_block(void* block, unsigned *b_v = FLASH_Block_Erase; // Now poll for the completion of the sector erase timer (50us) - timeout = 10000000; // how many retries? + timeout = CYGNUM_FLASH_TIMEOUT_ERASE_TIMER; // how many retries? while (true) { state = *b_v; if ((state & FLASH_Sector_Erase_Timer) @@ -369,7 +385,7 @@ flash_erase_block(void* block, unsigned // Then wait for erase completion. if (FLASH_ERR_OK == res) { - timeout = 10000000; + timeout = CYGNUM_FLASH_TIMEOUT_ERASE_COMPLETE; while (true) { state = *b_v; if (FLASH_BlankValue == state) { @@ -462,7 +478,7 @@ flash_program_buf(void* addr, void* data *f_s1 = FLASH_Program; *addr_v = *data_ptr; - timeout = 10000000; + timeout = CYGNUM_FLASH_TIMEOUT_PROGRAM; while (true) { state = *addr_v; if (*data_ptr == state) { diff --git a/packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx_parts.inl b/packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx_parts.inl --- a/packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx_parts.inl +++ b/packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx_parts.inl @@ -507,6 +507,24 @@ banked : false }, #endif +#ifdef CYGHWR_DEVS_FLASH_AMD_AM29PL160 + { // AM29PL160 + device_id : FLASHWORD(0x2245), + block_size : 0x00040000 * CYGNUM_FLASH_INTERLEAVE, + block_count: 8, + device_size: 0x00200000 * CYGNUM_FLASH_INTERLEAVE, + base_mask : ~(0x00200000 * CYGNUM_FLASH_INTERLEAVE - 1), + bootblock : true, + bootblocks : { 0x000000 * CYGNUM_FLASH_INTERLEAVE, + 0x004000 * CYGNUM_FLASH_INTERLEAVE, + 0x002000 * CYGNUM_FLASH_INTERLEAVE, + 0x002000 * CYGNUM_FLASH_INTERLEAVE, + 0x038000 * CYGNUM_FLASH_INTERLEAVE, + _LAST_BOOTBLOCK + }, + banked : false + }, +#endif #ifdef CYGHWR_DEVS_FLASH_AMD_AM29LV200 { // AM29LV200-T device_id : FLASHWORD(0x223b),