helper/command: change prototype of command_print/command_print_sameline
[fw/openocd] / src / flash / nor / avrf.c
index 627418c63770a45b2f1bbd8840015bac033ea031..178567e6b4fceb90d2bf26519c8e6bb9fcc85a19 100644 (file)
@@ -66,6 +66,7 @@ static const struct avrf_type avft_chips_info[] = {
  *                     eeprom_page_size, eeprom_page_num
  */
        {"atmega128", 0x9702, 256, 512, 8, 512},
+       {"atmega128rfa1", 0xa701, 128, 512, 8, 512},
        {"at90can128", 0x9781, 256, 512, 8, 512},
        {"at90usb128", 0x9782, 256, 512, 8, 512},
        {"atmega164p", 0x940a, 128, 128, 4, 128},
@@ -232,12 +233,6 @@ static int avrf_erase(struct flash_bank *bank, int first, int last)
        return avr_jtagprg_leaveprogmode(avr);
 }
 
-static int avrf_protect(struct flash_bank *bank, int set, int first, int last)
-{
-       LOG_INFO("%s", __func__);
-       return ERROR_OK;
-}
-
 static int avrf_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 {
        struct target *target = bank->target;
@@ -337,7 +332,7 @@ static int avrf_probe(struct flash_bank *bank)
                        bank->sectors[i].offset = i * avr_info->flash_page_size;
                        bank->sectors[i].size = avr_info->flash_page_size;
                        bank->sectors[i].is_erased = -1;
-                       bank->sectors[i].is_protected = 1;
+                       bank->sectors[i].is_protected = -1;
                }
 
                avrf_info->probed = 1;
@@ -359,12 +354,6 @@ static int avrf_auto_probe(struct flash_bank *bank)
        return avrf_probe(bank);
 }
 
-static int avrf_protect_check(struct flash_bank *bank)
-{
-       LOG_INFO("%s", __func__);
-       return ERROR_OK;
-}
-
 static int avrf_info(struct flash_bank *bank, char *buf, int buf_size)
 {
        struct target *target = bank->target;
@@ -444,9 +433,9 @@ COMMAND_HANDLER(avrf_handle_mass_erase_command)
                for (i = 0; i < bank->num_sectors; i++)
                        bank->sectors[i].is_erased = 1;
 
-               command_print(CMD_CTX, "avr mass erase complete");
+               command_print(CMD, "avr mass erase complete");
        } else
-               command_print(CMD_CTX, "avr mass erase failed");
+               command_print(CMD, "avr mass erase failed");
 
        LOG_DEBUG("%s", __func__);
        return ERROR_OK;
@@ -473,17 +462,16 @@ static const struct command_registration avrf_command_handlers[] = {
        COMMAND_REGISTRATION_DONE
 };
 
-struct flash_driver avr_flash = {
+const struct flash_driver avr_flash = {
        .name = "avr",
        .commands = avrf_command_handlers,
        .flash_bank_command = avrf_flash_bank_command,
        .erase = avrf_erase,
-       .protect = avrf_protect,
        .write = avrf_write,
        .read = default_flash_read,
        .probe = avrf_probe,
        .auto_probe = avrf_auto_probe,
        .erase_check = default_flash_blank_check,
-       .protect_check = avrf_protect_check,
        .info = avrf_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };