flash/nor/sfdp, stmqspi: use native type for buffer size

Two different sizes uint8_t and uint32_t was used for this value
without a good reason.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I4bb60cc5397ffd0d37e7034e3930e62793140c8d
Reviewed-on: https://review.openocd.org/c/openocd/+/8439
Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
Tested-by: jenkins
This commit is contained in:
Tomas Vanek 2024-08-14 09:17:36 +02:00 committed by Antonio Borneo
parent 1dc3d7e8fe
commit ea28f96aa9
3 changed files with 4 additions and 4 deletions

View File

@ -99,7 +99,7 @@ int spi_sfdp(struct flash_bank *bank, struct flash_device *dev,
goto err; goto err;
for (k = 0; k < nph; k++) { for (k = 0; k < nph; k++) {
uint8_t words = (pheaders[k].revision >> 24) & 0xFF; unsigned int words = (pheaders[k].revision >> 24) & 0xFF;
uint16_t id = (((pheaders[k].ptr) >> 16) & 0xFF00) | (pheaders[k].revision & 0xFF); uint16_t id = (((pheaders[k].ptr) >> 16) & 0xFF00) | (pheaders[k].revision & 0xFF);
uint32_t ptr = pheaders[k].ptr & 0xFFFFFF; uint32_t ptr = pheaders[k].ptr & 0xFFFFFF;

View File

@ -18,7 +18,7 @@
* *
* buffer contents is supposed to be returned in ***host*** endianness */ * buffer contents is supposed to be returned in ***host*** endianness */
typedef int (*read_sfdp_block_t)(struct flash_bank *bank, uint32_t addr, typedef int (*read_sfdp_block_t)(struct flash_bank *bank, uint32_t addr,
uint32_t words, uint32_t *buffer); unsigned int words, uint32_t *buffer);
extern int spi_sfdp(struct flash_bank *bank, struct flash_device *dev, extern int spi_sfdp(struct flash_bank *bank, struct flash_device *dev,
read_sfdp_block_t read_sfdp_block); read_sfdp_block_t read_sfdp_block);

View File

@ -1807,7 +1807,7 @@ err:
/* Read SFDP parameter block */ /* Read SFDP parameter block */
static int read_sfdp_block(struct flash_bank *bank, uint32_t addr, static int read_sfdp_block(struct flash_bank *bank, uint32_t addr,
uint32_t words, uint32_t *buffer) unsigned int words, uint32_t *buffer)
{ {
struct target *target = bank->target; struct target *target = bank->target;
struct stmqspi_flash_bank *stmqspi_info = bank->driver_priv; struct stmqspi_flash_bank *stmqspi_info = bank->driver_priv;
@ -1848,7 +1848,7 @@ static int read_sfdp_block(struct flash_bank *bank, uint32_t addr,
} }
} }
LOG_DEBUG("%s: addr=0x%08" PRIx32 " words=0x%08" PRIx32 " dummy=%u", LOG_DEBUG("%s: addr=0x%08" PRIx32 " words=0x%08x dummy=%u",
__func__, addr, words, *dummy); __func__, addr, words, *dummy);
/* Abort any previous operation */ /* Abort any previous operation */