FreeCalypso > hg > freecalypso-tools
changeset 916:54a0bc149d9c
fc-loadtool: add support for Samsung K5L29xx_A flash
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 30 Dec 2022 21:07:30 +0000 |
parents | 71edc12b1aa7 |
children | 81f4b8722206 |
files | loadtools/flashid.c loadtools/fldevs.c |
diffstat | 2 files changed, 71 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/loadtools/flashid.c Thu Dec 29 23:59:00 2022 +0000 +++ b/loadtools/flashid.c Fri Dec 30 21:07:30 2022 +0000 @@ -20,6 +20,7 @@ extern struct flash_device flashdev_PL129N; extern struct flash_device flashdev_K5A32xx_T; extern struct flash_device flashdev_K5L33xx_A; +extern struct flash_device flashdev_K5L29xx_A; extern int flash_global_config; extern struct flash_bank_info flash_bank_info[2]; @@ -66,6 +67,33 @@ } static +try_device_amdreset(bi, dev) + struct flash_bank_info *bi; + struct flash_device *dev; +{ + int rc; + + printf("Appears to be %s or compatible, checking CFI\n", dev->name); + /* need to go back to read array first, CFI cmd ignored otherwise */ + if (do_w16(bi->base_addr + 0xAAA, 0xF0)) { +bad_w16: fprintf(stderr, "unexpected response to w16 - aborting\n"); + return(-1); + } + if (do_w16(bi->base_addr + 0xAA, 0x98)) + goto bad_w16; + rc = run_cfi_check(bi, dev->cfi_table); + if (rc < 0) + return(rc); + if (!rc) { + fprintf(stderr, "Error: CFI mismatch, unsafe to continue\n"); + return(-1); + } + printf("Confirmed %s or compatible\n", dev->name); + bi->device = dev; + return(0); +} + +static spansion_pl129j_or_n(bi) struct flash_bank_info *bi; { @@ -135,6 +163,8 @@ printf("Extended ID: %04X %04X\n", ext1, ext2); if (ext1 == 0x2503 && ext2 == 0x2501) return try_device(bi, &flashdev_K5L33xx_A); + if (ext1 == 0x2508 && ext2 == 0x2501) + return try_device_amdreset(bi, &flashdev_K5L29xx_A); fprintf(stderr, "Error: unknown device ID\n"); return(-1); }
--- a/loadtools/fldevs.c Thu Dec 29 23:59:00 2022 +0000 +++ b/loadtools/fldevs.c Fri Dec 30 21:07:30 2022 +0000 @@ -429,3 +429,44 @@ .bank_geom = {&geom_4M_bothends, 0}, .cmdset = &flash_cmdset_amd, }; + +/* Samsung equivalent of S71PL129J, found in Sony Ericsson K200/220 phones */ + +static struct cfi_check samsung_PL129J_equiv_cfi[] = { + {0x10, 'Q'}, + {0x11, 'R'}, + {0x12, 'Y'}, + {0x13, 0x02}, + {0x14, 0x00}, + {0x15, 0x40}, + {0x16, 0x00}, + {0x27, 0x18}, + {0x2C, 0x03}, + {0x2D, 0x07}, + {0x2E, 0x00}, + {0x2F, 0x20}, + {0x30, 0x00}, + {0x31, 0xFD}, + {0x32, 0x00}, + {0x33, 0x00}, + {0x34, 0x01}, + {0x35, 0x07}, + {0x36, 0x00}, + {0x37, 0x20}, + {0x38, 0x00}, + {0x40, 'P'}, + {0x41, 'R'}, + {0x42, 'I'}, + {0x43, '0'}, + {0x44, '0'}, + {0x4F, 0x04}, + {-1, 0} +}; + +struct flash_device flashdev_K5L29xx_A = { + .name = "Samsung K5L29xx_A", + .cfi_table = samsung_PL129J_equiv_cfi, + .required_global_config = FLASH_GLOBAL_CFG_DUAL_8M, + .bank_geom = {&geom_8M_bottomboot, &geom_8M_topboot}, + .cmdset = &flash_cmdset_amd, +};