flash/nor/numicro: remove useless architecture check
[fw/openocd] / src / flash / nor / numicro.c
index c212cbc309d925e0b3e0d0bc2e7f38b73d979db5..34875084c032d3c38bd74dfc1c10db6ff8d98c21 100644 (file)
@@ -151,7 +151,7 @@ struct numicro_cpu_type {
        {NUMICRO_CONFIG_BASE, 1024} }
 
 
-static const struct numicro_cpu_type NuMicroParts[] = {
+static const struct numicro_cpu_type numicro_parts[] = {
        /*PART NO*/     /*PART ID*/ /*Banks*/
        /* NUC100 Version B */
        {"NUC100LD2BN", 0x10010004, NUMICRO_BANKS_NUC100(64*1024)},
@@ -1132,7 +1132,7 @@ static const struct numicro_cpu_type NuMicroParts[] = {
 /* Private bank information for NuMicro. */
 struct  numicro_flash_bank {
        struct working_area *write_algorithm;
-       int probed;
+       bool probed;
        const struct numicro_cpu_type *cpu;
 };
 
@@ -1243,7 +1243,7 @@ static uint32_t numicro_fmc_cmd(struct target *target, uint32_t cmd, uint32_t ad
                retval = target_read_u32(target, NUMICRO_FLASH_ISPTRG, &status);
                if (retval != ERROR_OK)
                        return retval;
-                       LOG_DEBUG("status: 0x%" PRIx32 "", status);
+               LOG_DEBUG("status: 0x%" PRIx32 "", status);
                if ((status & (ISPTRG_ISPGO)) == 0)
                        break;
                if (timeout-- <= 0) {
@@ -1385,13 +1385,6 @@ static int numicro_writeblock(struct flash_bank *bank, const uint8_t *buffer,
        init_reg_param(&reg_params[1], "r1", 32, PARAM_OUT);    /* faddr */
        init_reg_param(&reg_params[2], "r2", 32, PARAM_OUT);    /* number of words to program */
 
-       struct armv7m_common *armv7m = target_to_armv7m(target);
-       if (armv7m == NULL) {
-               /* something is very wrong if armv7m is NULL */
-               LOG_ERROR("unable to get armv7m target");
-               return retval;
-       }
-
        /* write code buffer and use Flash programming code within NuMicro     */
        /* Set breakpoint to 0 with time-out of 1000 ms                        */
        while (count > 0) {
@@ -1512,7 +1505,7 @@ static int numicro_erase(struct flash_bank *bank, unsigned int first,
                        retval = target_read_u32(target, NUMICRO_FLASH_ISPTRG, &status);
                        if (retval != ERROR_OK)
                                return retval;
-                               LOG_DEBUG("status: 0x%" PRIx32 "", status);
+                       LOG_DEBUG("status: 0x%" PRIx32 "", status);
                        if (status == 0)
                                break;
                        if (timeout-- <= 0) {
@@ -1532,8 +1525,6 @@ static int numicro_erase(struct flash_bank *bank, unsigned int first,
                        retval = target_write_u32(target, NUMICRO_FLASH_ISPCON, (status | ISPCON_ISPFF));
                        if (retval != ERROR_OK)
                                return retval;
-               } else {
-                       bank->sectors[i].is_erased = 1;
                }
        }
 
@@ -1583,7 +1574,7 @@ static int numicro_write(struct flash_bank *bank, const uint8_t *buffer,
                /* program command */
                for (uint32_t i = 0; i < count; i += 4) {
 
-                       LOG_DEBUG("write longword @ %08X", offset + i);
+                       LOG_DEBUG("write longword @ %08" PRIX32, offset + i);
 
                        retval = target_write_u32(target, NUMICRO_FLASH_ISPADR, bank->base + offset + i);
                        if (retval != ERROR_OK)
@@ -1601,7 +1592,7 @@ static int numicro_write(struct flash_bank *bank, const uint8_t *buffer,
                                retval = target_read_u32(target, NUMICRO_FLASH_ISPTRG, &status);
                                if (retval != ERROR_OK)
                                        return retval;
-                                       LOG_DEBUG("status: 0x%" PRIx32 "", status);
+                               LOG_DEBUG("status: 0x%" PRIx32 "", status);
                                if (status == 0)
                                        break;
                                if (timeout-- <= 0) {
@@ -1648,9 +1639,9 @@ static int numicro_get_cpu_type(struct target *target, const struct numicro_cpu_
 
        LOG_INFO("Device ID: 0x%08" PRIx32 "", part_id);
        /* search part numbers */
-       for (size_t i = 0; i < ARRAY_SIZE(NuMicroParts); i++) {
-               if (part_id == NuMicroParts[i].partid) {
-                       *cpu = &NuMicroParts[i];
+       for (size_t i = 0; i < ARRAY_SIZE(numicro_parts); i++) {
+               if (part_id == numicro_parts[i].partid) {
+                       *cpu = &numicro_parts[i];
                        LOG_INFO("Device Name: %s", (*cpu)->partname);
                        return ERROR_OK;
                }