X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fem357.c;h=38fb73189aaa5c9c2865d6fd77a3ed40157293fa;hb=0a13ca1a8a83119a4e1ffba13a6a8d1977591bc5;hp=70a5431ac68880b2827bbc1984a4db091edd6d3e;hpb=565f8481c7b71614a05d79ab79af8610d2535a81;p=openocd.git diff --git a/src/flash/nor/em357.c b/src/flash/nor/em357.c index 70a5431ac6..38fb73189a 100644 --- a/src/flash/nor/em357.c +++ b/src/flash/nor/em357.c @@ -19,9 +19,7 @@ * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * along with this program. If not, see . * ***************************************************************************/ #ifdef HAVE_CONFIG_H @@ -502,7 +500,6 @@ static int em357_write_block(struct flash_bank *bank, const uint8_t *buffer, LOG_WARNING("no working area available, can't do block memory writes"); return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; } - ; retval = target_write_buffer(target, write_algorithm->address, sizeof(em357_flash_write_code), em357_flash_write_code); @@ -705,6 +702,11 @@ static int em357_probe(struct flash_bank *bank) num_pages = 128; page_size = 2048; break; + case 0x80000: + /* 512k -- 256 2k pages */ + num_pages = 256; + page_size = 2048; + break; default: LOG_WARNING("No size specified for em357 flash driver, assuming 192k!"); num_pages = 96; @@ -774,7 +776,7 @@ COMMAND_HANDLER(em357_handle_lock_command) } if (em357_erase_options(bank) != ERROR_OK) { - command_print(CMD_CTX, "em357 failed to erase options"); + command_print(CMD, "em357 failed to erase options"); return ERROR_OK; } @@ -782,11 +784,11 @@ COMMAND_HANDLER(em357_handle_lock_command) em357_info->option_bytes.RDP = 0; if (em357_write_options(bank) != ERROR_OK) { - command_print(CMD_CTX, "em357 failed to lock device"); + command_print(CMD, "em357 failed to lock device"); return ERROR_OK; } - command_print(CMD_CTX, "em357 locked"); + command_print(CMD, "em357 locked"); return ERROR_OK; } @@ -811,16 +813,16 @@ COMMAND_HANDLER(em357_handle_unlock_command) } if (em357_erase_options(bank) != ERROR_OK) { - command_print(CMD_CTX, "em357 failed to unlock device"); + command_print(CMD, "em357 failed to unlock device"); return ERROR_OK; } if (em357_write_options(bank) != ERROR_OK) { - command_print(CMD_CTX, "em357 failed to lock device"); + command_print(CMD, "em357 failed to lock device"); return ERROR_OK; } - command_print(CMD_CTX, "em357 unlocked.\n" + command_print(CMD, "em357 unlocked.\n" "INFO: a reset or power cycle is required " "for the new settings to take effect."); @@ -884,9 +886,9 @@ COMMAND_HANDLER(em357_handle_mass_erase_command) for (i = 0; i < bank->num_sectors; i++) bank->sectors[i].is_erased = 1; - command_print(CMD_CTX, "em357 mass erase complete"); + command_print(CMD, "em357 mass erase complete"); } else - command_print(CMD_CTX, "em357 mass erase failed"); + command_print(CMD, "em357 mass erase failed"); return retval; } @@ -927,7 +929,7 @@ static const struct command_registration em357_command_handlers[] = { COMMAND_REGISTRATION_DONE }; -struct flash_driver em357_flash = { +const struct flash_driver em357_flash = { .name = "em357", .commands = em357_command_handlers, .flash_bank_command = em357_flash_bank_command, @@ -939,4 +941,5 @@ struct flash_driver em357_flash = { .auto_probe = em357_auto_probe, .erase_check = default_flash_blank_check, .protect_check = em357_protect_check, + .free_driver_priv = default_flash_free_driver_priv, };