driver/cfi-flash: Add a config option for the page size of CFI flash.

We have added a defconfig configuration to set the page size of the flash.
According to the CFI protocol, the flash supports a single write operation
with a data volume ranging from byte size up to the maximum number of bytes.
However, the MTD device structure requires defining a page size, which serves
as the minimum write unit of the flash. Hence, this configuration is introduced.
Any page size within the range of 1 to the maximum number of bytes is considered
valid.

Signed-off-by: jingfei <jingfei@xiaomi.com>
This commit is contained in:
jingfei
2025-08-20 19:42:53 +08:00
committed by Xiang Xiao
parent ad3abcd277
commit 9483df3571
2 changed files with 16 additions and 2 deletions
+3 -2
View File
@@ -969,8 +969,9 @@ int cfi_check(FAR struct cfi_dev_s *cfi)
cfi->cfi_offset = g_cfi_query_address[i];
cfi->dev_num = cfi->bankwidth / cfi->dev_width;
cfi->page_size = (1 << info->max_write_bytes_num) *
cfi->dev_num;
cfi->page_size = MIN(CONFIG_MTD_CFI_PAGE_SIZE,
(1 << info->max_write_bytes_num) *
cfi->dev_num);
/* fix amd feature */