FreeCalypso > hg > freecalypso-tools
diff loadtools/fldevs.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 | a400bb4a1620 |
line wrap: on
line diff
--- a/loadtools/fldevs.c Tue Nov 28 19:08:53 2023 +0000 +++ b/loadtools/fldevs.c Fri Dec 01 06:43:21 2023 +0000 @@ -316,15 +316,31 @@ {0x42, 'I'}, {0x43, '1'}, {0x44, '3'}, + {0x49, 0x04}, {-1, 0} }; +static struct amd_lock_info Am29DL640G_lock_info = { + .ngroups = 8, + .groups = { + {0x2000, 8, 0, 1, 0}, + {0x10000, 3, 0, 0, 0}, + {0x40000, 3, 1, 0, 1}, + {0x40000, 12, 1, 1, 1}, + {0x40000, 12, 1, 1, 1}, + {0x40000, 3, 1, 1, 0}, + {0x10000, 3, 0, 0, 0}, + {0x2000, 8, 0, 0, 1}}, + .have_status_word_3 = 1, +}; + struct flash_device flashdev_Am29DL640G = { .name = "Am29DL640G", .cfi_table = Am29DL640G_cfi, .required_global_config = FLASH_GLOBAL_CFG_SINGLE_8M, .bank_geom = {&geom_8M_bothends, 0}, .cmdset = &flash_cmdset_amd, + .lock_info = {&Am29DL640G_lock_info, 0}, }; /* Spansion S71PL-J and S71PL-N flash */ @@ -367,7 +383,67 @@ .cmdset = &flash_cmdset_amd, }; -/* S29PL064J/S71PL064J is identical to Am29DL640G covered above */ +/* + * For our purposes, S29PL064J/S71PL064J differs from Am29DL640G only + * in terms of lock status retrieval and manipulation: the older chip + * lacks persistent/password mode lock bits and in-system lock/unlock + * operations. We distinguish them by one byte in CFI. + */ + +static struct cfi_check spansion_PL064J_cfi[] = { + {0x10, 'Q'}, + {0x11, 'R'}, + {0x12, 'Y'}, + {0x13, 0x02}, + {0x14, 0x00}, + {0x15, 0x40}, + {0x16, 0x00}, + {0x27, 0x17}, + {0x2C, 0x03}, + {0x2D, 0x07}, + {0x2E, 0x00}, + {0x2F, 0x20}, + {0x30, 0x00}, + {0x31, 0x7D}, + {0x32, 0x00}, + {0x33, 0x00}, + {0x34, 0x01}, + {0x35, 0x07}, + {0x36, 0x00}, + {0x37, 0x20}, + {0x38, 0x00}, + {0x40, 'P'}, + {0x41, 'R'}, + {0x42, 'I'}, + {0x43, '1'}, + {0x44, '3'}, + {0x49, 0x07}, + {-1, 0} +}; + +static struct amd_lock_info PL064J_lock_info = { + .ngroups = 8, + .groups = { + {0x2000, 8, 0, 1, 0}, + {0x10000, 3, 0, 0, 0}, + {0x40000, 3, 1, 0, 1}, + {0x40000, 12, 1, 1, 1}, + {0x40000, 12, 1, 1, 1}, + {0x40000, 3, 1, 1, 0}, + {0x10000, 3, 0, 0, 0}, + {0x2000, 8, 0, 0, 1}}, + .have_status_word_3 = 1, + .have_mode_lock_bits = 1, +}; + +struct flash_device flashdev_PL064J = { + .name = "Spansion S29PL064J", + .cfi_table = spansion_PL064J_cfi, + .required_global_config = FLASH_GLOBAL_CFG_SINGLE_8M, + .bank_geom = {&geom_8M_bothends, 0}, + .cmdset = &flash_cmdset_amd, + .lock_info = {&PL064J_lock_info, 0}, +}; static struct cfi_check spansion_PL129J_cfi[] = { {0x10, 'Q'}, @@ -399,12 +475,35 @@ {-1, 0} }; +static struct amd_lock_info PL129J_lock_info_0 = { + .ngroups = 4, + .groups = { + {0x2000, 8, 0, 1, 0}, + {0x10000, 3, 0, 0, 0}, + {0x40000, 7, 1, 0, 1}, + {0x40000, 24, 1, 1, 1}}, + .have_status_word_3 = 1, + .have_mode_lock_bits = 1, +}; + +static struct amd_lock_info PL129J_lock_info_1 = { + .ngroups = 4, + .groups = { + {0x40000, 24, 1, 1, 1}, + {0x40000, 7, 1, 1, 0}, + {0x10000, 3, 0, 0, 0}, + {0x2000, 8, 0, 0, 1}}, + .have_status_word_3 = 1, + .have_mode_lock_bits = 1, +}; + struct flash_device flashdev_PL129J = { .name = "Spansion S29PL129J", .cfi_table = spansion_PL129J_cfi, .required_global_config = FLASH_GLOBAL_CFG_DUAL_8M, .bank_geom = {&geom_8M_bottomboot, &geom_8M_topboot}, .cmdset = &flash_cmdset_amd, + .lock_info = {&PL129J_lock_info_0, &PL129J_lock_info_1}, }; static struct cfi_check spansion_PL129N_cfi[] = { @@ -437,6 +536,26 @@ {-1, 0} }; +static struct amd_lock_info PL129N_lock_info_0 = { + .ngroups = 3, + .groups = { + {0x10000, 4, 0, 1, 0}, + {0x40000, 7, 1, 0, 1}, + {0x40000, 24, 1, 1, 1}}, + .have_status_word_3 = 1, + .have_pln_lock_reg = 1, +}; + +static struct amd_lock_info PL129N_lock_info_1 = { + .ngroups = 3, + .groups = { + {0x40000, 24, 1, 1, 1}, + {0x40000, 7, 1, 1, 0}, + {0x10000, 4, 0, 0, 1}}, + .have_status_word_3 = 1, + .have_pln_lock_reg = 1, +}; + struct flash_device flashdev_PL129N = { .name = "Spansion S29PL129N", .cfi_table = spansion_PL129N_cfi, @@ -444,6 +563,7 @@ .bank_geom = {&geom_8M_bottomboot_big, &geom_8M_topboot_big}, .cmdset = &flash_cmdset_amd, + .lock_info = {&PL129N_lock_info_0, &PL129N_lock_info_1}, }; /* Samsung K5A32xxCTM introduced onto the scene by Openmoko */ @@ -557,10 +677,35 @@ {-1, 0} }; +static struct amd_lock_info K5L29_lock_info_0 = { + .ngroups = 4, + .groups = { + {0x2000, 8, 0, 1, 0}, + {0x10000, 3, 0, 0, 0}, + {0x40000, 7, 1, 0, 1}, + {0x40000, 24, 1, 1, 1}}, + .have_status_word_3 = 1, + .have_status_word_7 = 1, + .have_mode_lock_bits = 1, +}; + +static struct amd_lock_info K5L29_lock_info_1 = { + .ngroups = 4, + .groups = { + {0x40000, 24, 1, 1, 1}, + {0x40000, 7, 1, 1, 0}, + {0x10000, 3, 0, 0, 0}, + {0x2000, 8, 0, 0, 1}}, + .have_status_word_3 = 1, + .have_status_word_7 = 1, + .have_mode_lock_bits = 1, +}; + 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, + .lock_info = {&K5L29_lock_info_0, &K5L29_lock_info_1}, };