FreeCalypso > hg > freecalypso-tools
comparison loadtools/flashid.c @ 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 | f229efbfd581 |
| children | 7c18eac91457 |
comparison
equal
deleted
inserted
replaced
| 915:71edc12b1aa7 | 916:54a0bc149d9c |
|---|---|
| 18 extern struct flash_device flashdev_PL032J; | 18 extern struct flash_device flashdev_PL032J; |
| 19 extern struct flash_device flashdev_PL129J; | 19 extern struct flash_device flashdev_PL129J; |
| 20 extern struct flash_device flashdev_PL129N; | 20 extern struct flash_device flashdev_PL129N; |
| 21 extern struct flash_device flashdev_K5A32xx_T; | 21 extern struct flash_device flashdev_K5A32xx_T; |
| 22 extern struct flash_device flashdev_K5L33xx_A; | 22 extern struct flash_device flashdev_K5L33xx_A; |
| 23 extern struct flash_device flashdev_K5L29xx_A; | |
| 23 | 24 |
| 24 extern int flash_global_config; | 25 extern int flash_global_config; |
| 25 extern struct flash_bank_info flash_bank_info[2]; | 26 extern struct flash_bank_info flash_bank_info[2]; |
| 26 | 27 |
| 27 static | 28 static |
| 51 printf("Appears to be %s or compatible, checking CFI\n", dev->name); | 52 printf("Appears to be %s or compatible, checking CFI\n", dev->name); |
| 52 if (do_w16(bi->base_addr + 0xAA, 0x98)) { | 53 if (do_w16(bi->base_addr + 0xAA, 0x98)) { |
| 53 fprintf(stderr, "unexpected response to w16 - aborting\n"); | 54 fprintf(stderr, "unexpected response to w16 - aborting\n"); |
| 54 return(-1); | 55 return(-1); |
| 55 } | 56 } |
| 57 rc = run_cfi_check(bi, dev->cfi_table); | |
| 58 if (rc < 0) | |
| 59 return(rc); | |
| 60 if (!rc) { | |
| 61 fprintf(stderr, "Error: CFI mismatch, unsafe to continue\n"); | |
| 62 return(-1); | |
| 63 } | |
| 64 printf("Confirmed %s or compatible\n", dev->name); | |
| 65 bi->device = dev; | |
| 66 return(0); | |
| 67 } | |
| 68 | |
| 69 static | |
| 70 try_device_amdreset(bi, dev) | |
| 71 struct flash_bank_info *bi; | |
| 72 struct flash_device *dev; | |
| 73 { | |
| 74 int rc; | |
| 75 | |
| 76 printf("Appears to be %s or compatible, checking CFI\n", dev->name); | |
| 77 /* need to go back to read array first, CFI cmd ignored otherwise */ | |
| 78 if (do_w16(bi->base_addr + 0xAAA, 0xF0)) { | |
| 79 bad_w16: fprintf(stderr, "unexpected response to w16 - aborting\n"); | |
| 80 return(-1); | |
| 81 } | |
| 82 if (do_w16(bi->base_addr + 0xAA, 0x98)) | |
| 83 goto bad_w16; | |
| 56 rc = run_cfi_check(bi, dev->cfi_table); | 84 rc = run_cfi_check(bi, dev->cfi_table); |
| 57 if (rc < 0) | 85 if (rc < 0) |
| 58 return(rc); | 86 return(rc); |
| 59 if (!rc) { | 87 if (!rc) { |
| 60 fprintf(stderr, "Error: CFI mismatch, unsafe to continue\n"); | 88 fprintf(stderr, "Error: CFI mismatch, unsafe to continue\n"); |
| 133 if (do_r16(bi->base_addr + 0x1E, &ext2) < 0) | 161 if (do_r16(bi->base_addr + 0x1E, &ext2) < 0) |
| 134 return(-1); | 162 return(-1); |
| 135 printf("Extended ID: %04X %04X\n", ext1, ext2); | 163 printf("Extended ID: %04X %04X\n", ext1, ext2); |
| 136 if (ext1 == 0x2503 && ext2 == 0x2501) | 164 if (ext1 == 0x2503 && ext2 == 0x2501) |
| 137 return try_device(bi, &flashdev_K5L33xx_A); | 165 return try_device(bi, &flashdev_K5L33xx_A); |
| 166 if (ext1 == 0x2508 && ext2 == 0x2501) | |
| 167 return try_device_amdreset(bi, &flashdev_K5L29xx_A); | |
| 138 fprintf(stderr, "Error: unknown device ID\n"); | 168 fprintf(stderr, "Error: unknown device ID\n"); |
| 139 return(-1); | 169 return(-1); |
| 140 } | 170 } |
| 141 | 171 |
| 142 static struct idmap { | 172 static struct idmap { |
