diff options
Diffstat (limited to 'src/flash/nor')
-rw-r--r-- | src/flash/nor/kinetis.c | 2 | ||||
-rw-r--r-- | src/flash/nor/mrvlqspi.c | 2 | ||||
-rw-r--r-- | src/flash/nor/msp432.h | 2 | ||||
-rw-r--r-- | src/flash/nor/nrf5.c | 2 | ||||
-rw-r--r-- | src/flash/nor/psoc4.c | 2 | ||||
-rw-r--r-- | src/flash/nor/stm32l4x.c | 4 | ||||
-rw-r--r-- | src/flash/nor/stm32lx.c | 4 | ||||
-rw-r--r-- | src/flash/nor/stmqspi.c | 2 | ||||
-rw-r--r-- | src/flash/nor/xcf.c | 22 |
9 files changed, 22 insertions, 20 deletions
diff --git a/src/flash/nor/kinetis.c b/src/flash/nor/kinetis.c index e6b452e..1fee6eb 100644 --- a/src/flash/nor/kinetis.c +++ b/src/flash/nor/kinetis.c @@ -2803,7 +2803,7 @@ static int kinetis_blank_check(struct flash_bank *bank) struct kinetis_chip *k_chip = k_bank->k_chip; int result; - /* suprisingly blank check does not work in VLPR and HSRUN modes */ + /* surprisingly blank check does not work in VLPR and HSRUN modes */ result = kinetis_check_run_mode(k_chip); if (result != ERROR_OK) return result; diff --git a/src/flash/nor/mrvlqspi.c b/src/flash/nor/mrvlqspi.c index 3f5ce2c..b98c49d 100644 --- a/src/flash/nor/mrvlqspi.c +++ b/src/flash/nor/mrvlqspi.c @@ -37,7 +37,7 @@ #define QSPI_W_EN (0x1) #define QSPI_SS_DISABLE (0x0) #define QSPI_SS_ENABLE (0x1) -#define WRITE_DISBALE (0x0) +#define WRITE_DISABLE (0x0) #define WRITE_ENABLE (0x1) #define QSPI_TIMEOUT (1000) diff --git a/src/flash/nor/msp432.h b/src/flash/nor/msp432.h index 663393b..af1d40c 100644 --- a/src/flash/nor/msp432.h +++ b/src/flash/nor/msp432.h @@ -43,7 +43,7 @@ #define P4_SECTOR_LENGTH 0x1000 #define P4_ALGO_ENTRY_ADDR 0x01000110 -/* MSP432E4 flash paramters */ +/* MSP432E4 flash parameters */ #define E4_FLASH_BASE FLASH_BASE #define E4_FLASH_SIZE 0x100000 #define E4_SECTOR_LENGTH 0x4000 diff --git a/src/flash/nor/nrf5.c b/src/flash/nor/nrf5.c index b9d567e..de799fa 100644 --- a/src/flash/nor/nrf5.c +++ b/src/flash/nor/nrf5.c @@ -1037,7 +1037,7 @@ static int nrf5_write(struct flash_bank *bank, const uint8_t *buffer, * RM reads: Code running from code region 1 will not be able to write * to code region 0. * Unfortunately the flash loader running from RAM can write to both - * code regions whithout any hint the protection is violated. + * code regions without any hint the protection is violated. * * Update protection state and check if any flash sector to be written * is protected. */ diff --git a/src/flash/nor/psoc4.c b/src/flash/nor/psoc4.c index b606e18..3ca1f36 100644 --- a/src/flash/nor/psoc4.c +++ b/src/flash/nor/psoc4.c @@ -335,7 +335,7 @@ static int psoc4_sysreq(struct flash_bank *bank, uint8_t cmd, /* Execute wait code */ retval = target_run_algorithm(target, 0, NULL, - sizeof(reg_params) / sizeof(*reg_params), reg_params, + ARRAY_SIZE(reg_params), reg_params, sysreq_wait_algorithm->address, 0, 1000, &armv7m_info); if (retval != ERROR_OK) { LOG_ERROR("sysreq wait code execution failed"); diff --git a/src/flash/nor/stm32l4x.c b/src/flash/nor/stm32l4x.c index 594bce0..7e1fe7c 100644 --- a/src/flash/nor/stm32l4x.c +++ b/src/flash/nor/stm32l4x.c @@ -1351,8 +1351,10 @@ static int stm32l4_probe(struct flash_bank *bank) device_id = stm32l4_info->idcode & 0xFFF; for (unsigned int n = 0; n < ARRAY_SIZE(stm32l4_parts); n++) { - if (device_id == stm32l4_parts[n].id) + if (device_id == stm32l4_parts[n].id) { stm32l4_info->part_info = &stm32l4_parts[n]; + break; + } } if (!stm32l4_info->part_info) { diff --git a/src/flash/nor/stm32lx.c b/src/flash/nor/stm32lx.c index 3cb1a49..b014d09 100644 --- a/src/flash/nor/stm32lx.c +++ b/src/flash/nor/stm32lx.c @@ -533,8 +533,8 @@ static int stm32lx_write_half_pages(struct flash_bank *bank, const uint8_t *buff buf_set_u32(reg_params[2].value, 0, 32, this_count / 4); /* 5: Execute the bunch of code */ - retval = target_run_algorithm(target, 0, NULL, sizeof(reg_params) - / sizeof(*reg_params), reg_params, + retval = target_run_algorithm(target, 0, NULL, + ARRAY_SIZE(reg_params), reg_params, write_algorithm->address, 0, 10000, &armv7m_info); if (retval != ERROR_OK) break; diff --git a/src/flash/nor/stmqspi.c b/src/flash/nor/stmqspi.c index 11aa438..a3555a4 100644 --- a/src/flash/nor/stmqspi.c +++ b/src/flash/nor/stmqspi.c @@ -175,7 +175,7 @@ struct stmqspi_flash_bank { bool octo; struct flash_device dev; uint32_t io_base; - uint32_t saved_cr; /* in particalar FSEL, DFM bit mask in QUADSPI_CR *AND* OCTOSPI_CR */ + uint32_t saved_cr; /* in particular FSEL, DFM bit mask in QUADSPI_CR *AND* OCTOSPI_CR */ uint32_t saved_ccr; /* different meaning for QUADSPI and OCTOSPI */ uint32_t saved_tcr; /* only for OCTOSPI */ uint32_t saved_ir; /* only for OCTOSPI */ diff --git a/src/flash/nor/xcf.c b/src/flash/nor/xcf.c index 0cef43b..01329f4 100644 --- a/src/flash/nor/xcf.c +++ b/src/flash/nor/xcf.c @@ -169,7 +169,7 @@ static int isc_enter(struct flash_bank *bank) jtag_execute_queue(); status = read_status(bank); - if (false == status.isc_mode) { + if (!status.isc_mode) { LOG_ERROR("*** XCF: FAILED to enter ISC mode"); return ERROR_FLASH_OPERATION_FAILED; } @@ -183,7 +183,7 @@ static int isc_leave(struct flash_bank *bank) struct xcf_status status = read_status(bank); - if (false == status.isc_mode) + if (!status.isc_mode) return ERROR_OK; else { struct scan_field scan; @@ -199,7 +199,7 @@ static int isc_leave(struct flash_bank *bank) alive_sleep(1); /* device needs 50 uS to leave ISC mode */ status = read_status(bank); - if (true == status.isc_mode) { + if (status.isc_mode) { LOG_ERROR("*** XCF: FAILED to leave ISC mode"); return ERROR_FLASH_OPERATION_FAILED; } @@ -280,7 +280,7 @@ static int isc_set_register(struct flash_bank *bank, const uint8_t *cmd, scan.in_value = NULL; jtag_add_dr_scan(bank->target->tap, 1, &scan, TAP_IDLE); - if (0 == timeout_ms) + if (timeout_ms == 0) return jtag_execute_queue(); else return isc_wait_erase_program(bank, timeout_ms); @@ -311,7 +311,7 @@ static int isc_program_register(struct flash_bank *bank, const uint8_t *cmd, scan.in_value = NULL; jtag_add_ir_scan(bank->target->tap, &scan, TAP_IDLE); - if (0 == timeout_ms) + if (timeout_ms == 0) return jtag_execute_queue(); else return isc_wait_erase_program(bank, timeout_ms); @@ -409,7 +409,7 @@ static bool need_bit_reverse(const uint8_t *buffer) reference[18] = 0xAA; reference[19] = 0x66; - if (0 == memcmp(reference, buffer, L)) + if (memcmp(reference, buffer, L) == 0) return false; else return true; @@ -444,7 +444,7 @@ static int read_write_data(struct flash_bank *bank, const uint8_t *w_buffer, goto EXIT; } - if ((write_flag) && (0 == offset) && (count >= XCF_PAGE_SIZE)) + if ((write_flag) && (offset == 0) && (count >= XCF_PAGE_SIZE)) revbit = need_bit_reverse(w_buffer); while (count > 0) { @@ -585,7 +585,7 @@ static int xcf_info(struct flash_bank *bank, char *buf, int buf_size) { const struct xcf_priv *priv = bank->driver_priv; - if (false == priv->probed) { + if (!priv->probed) { snprintf(buf, buf_size, "\nXCF flash bank not probed yet\n"); return ERROR_OK; } @@ -598,7 +598,7 @@ static int xcf_probe(struct flash_bank *bank) struct xcf_priv *priv = bank->driver_priv; uint32_t id; - if (true == priv->probed) + if (priv->probed) free(bank->sectors); priv->probed = false; @@ -629,7 +629,7 @@ static int xcf_probe(struct flash_bank *bank) } bank->sectors = malloc(bank->num_sectors * sizeof(struct flash_sector)); - if (NULL == bank->sectors) { + if (bank->sectors == NULL) { LOG_ERROR("No memory for sector table"); return ERROR_FAIL; } @@ -652,7 +652,7 @@ static int xcf_auto_probe(struct flash_bank *bank) { struct xcf_priv *priv = bank->driver_priv; - if (true == priv->probed) + if (priv->probed) return ERROR_OK; else return xcf_probe(bank); |