summaryrefslogtreecommitdiff
path: root/chip/npcx
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2021-01-14 01:29:08 -0700
committerCommit Bot <commit-bot@chromium.org>2021-01-15 04:07:55 +0000
commit9e422c3c05fdd324565049b09be27c446f9dc0ca (patch)
treeb4694ca5abc8c1be1000a1efe7a7bd8a02ddd856 /chip/npcx
parent6aa3d78608b681e6374f30747a7f6ab80938bde6 (diff)
downloadchrome-ec-9e422c3c05fdd324565049b09be27c446f9dc0ca.tar.gz
Refactor CONFIG_FLASH_SIZE to CONFIG_FLASH_SIZE_BYTES
In Zephyr CONFIG_FLASH_SIZE is a Kconfig value that is used throughout. The issue is that the units don't match. In Zephyr the value is in KiB instead of bytes. This refactor simply renames CONFIG_FLASH_SIZE in platform/ec to include the unit (via _BYTES). BRANCH=none BUG=b:174873770 TEST=make buildall be generated by the build instead of per board Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I44bf3c7a20fcf62aaa9ae15715be78db4210f384 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2627638 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'chip/npcx')
-rw-r--r--chip/npcx/config_chip-npcx9.h2
-rw-r--r--chip/npcx/flash.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/chip/npcx/config_chip-npcx9.h b/chip/npcx/config_chip-npcx9.h
index a13723f980..da17cc76ae 100644
--- a/chip/npcx/config_chip-npcx9.h
+++ b/chip/npcx/config_chip-npcx9.h
@@ -100,7 +100,7 @@
/* Internal spi-flash setting */
#define CONFIG_SPI_FLASH_REGS
#define CONFIG_SPI_FLASH_W25Q40 /* Internal spi flash type */
-#define CONFIG_FLASH_SIZE 0x00080000 /* 512 KB internal spi flash */
+#define CONFIG_FLASH_SIZE_BYTES 0x00080000 /* 512 KB internal spi flash */
#endif /* __CROS_EC_CONFIG_CHIP_NPCX9_H */
diff --git a/chip/npcx/flash.c b/chip/npcx/flash.c
index 7afb413c2c..a5f656f8ca 100644
--- a/chip/npcx/flash.c
+++ b/chip/npcx/flash.c
@@ -329,7 +329,7 @@ static int flash_set_status_for_prot(int reg1, int reg2)
static int flash_check_prot_range(unsigned int offset, unsigned int bytes)
{
/* Invalid value */
- if (offset + bytes > CONFIG_FLASH_SIZE)
+ if (offset + bytes > CONFIG_FLASH_SIZE_BYTES)
return EC_ERROR_INVAL;
/* Check if ranges overlap */
if (MAX(addr_prot_start, offset) < MIN(addr_prot_start +
@@ -362,7 +362,7 @@ static int flash_check_prot_reg(unsigned int offset, unsigned int bytes)
sr2 = flash_get_status2();
/* Invalid value */
- if (offset + bytes > CONFIG_FLASH_SIZE)
+ if (offset + bytes > CONFIG_FLASH_SIZE_BYTES)
return EC_ERROR_INVAL;
/* Compute current protect range */
@@ -386,7 +386,7 @@ static int flash_write_prot_reg(unsigned int offset, unsigned int bytes,
uint8_t sr2 = flash_get_status2();
/* Invalid values */
- if (offset + bytes > CONFIG_FLASH_SIZE)
+ if (offset + bytes > CONFIG_FLASH_SIZE_BYTES)
return EC_ERROR_INVAL;
/* Compute desired protect range */