FreeCalypso > hg > freecalypso-tools
diff loadtools/flashid.c @ 976:ff4ce8d5ece4
fc-loadtool flash: definitions for AMD sector lock architecture
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 01 Dec 2023 06:43:21 +0000 |
parents | 7c18eac91457 |
children |
line wrap: on
line diff
--- a/loadtools/flashid.c Tue Nov 28 19:08:53 2023 +0000 +++ b/loadtools/flashid.c Fri Dec 01 06:43:21 2023 +0000 @@ -21,6 +21,7 @@ extern struct flash_device flashdev_Am29DL640G; extern struct flash_device flashdev_PL032J; +extern struct flash_device flashdev_PL064J; extern struct flash_device flashdev_PL129J; extern struct flash_device flashdev_PL129N; extern struct flash_device flashdev_K5A32xx_T; @@ -133,6 +134,37 @@ } static +spansion_pl064j_or_oldamd(bi) + struct flash_bank_info *bi; +{ + int rc; + + printf("Am29DL640G or PL064J, looking at CFI\n"); + if (do_w16(bi->base_addr + 0xAA, 0x98)) { + fprintf(stderr, "unexpected response to w16 - aborting\n"); + return(-1); + } + rc = run_cfi_check(bi, flashdev_PL064J.cfi_table); + if (rc < 0) + return(rc); + if (rc) { + printf("Found PL064J\n"); + bi->device = &flashdev_PL064J; + return(0); + } + rc = run_cfi_check(bi, flashdev_Am29DL640G.cfi_table); + if (rc < 0) + return(rc); + if (rc) { + printf("Found Am29DL640G\n"); + bi->device = &flashdev_Am29DL640G; + return(0); + } + fprintf(stderr, "Error: no matching CFI found\n"); + return(-1); +} + +static amd_extended_id(bi) struct flash_bank_info *bi; { @@ -147,7 +179,7 @@ if (ext1 == 0x2221 && ext2 == 0x2200) return spansion_pl129j_or_n(bi); if (ext1 == 0x2202 && ext2 == 0x2201) - return try_device(bi, &flashdev_Am29DL640G); + return spansion_pl064j_or_oldamd(bi); if (ext1 == 0x220A && ext2 == 0x2201) return try_device(bi, &flashdev_PL032J); fprintf(stderr, "Error: unknown device ID\n"); @@ -251,10 +283,13 @@ return(-1); } /* good to go */ - if (bi->device->bank_geom[1] && bank) + if (bi->device->bank_geom[1] && bank) { bi->geom = bi->device->bank_geom[1]; - else + bi->amd_lock = bi->device->lock_info[1]; + } else { bi->geom = bi->device->bank_geom[0]; + bi->amd_lock = bi->device->lock_info[0]; + } bi->ops = bi->device->cmdset; bi->detect_done = 1; /* return device to read array mode */