[PATCH 2/2] mtd: spi: add support for BoyaMicro BY25Q256FS
Shiji Yang
yangshiji66 at outlook.com
Wed Dec 31 13:32:33 CET 2025
BY25Q256FS is a 256 Mb SPI NOR Flash chip. This Flash supports the
SFDP standard. Since SFDP is optional in u-boot, we still describe
all features it supports in the flash info table. This change has
been tested on Mediatek MT7981 platform. SFDP dump:
00000000 53 46 44 50 08 01 02 ff 00 07 01 10 30 00 00 ff |SFDP........0...|
00000010 68 00 01 03 90 00 00 ff 84 01 01 02 c0 00 00 ff |h...............|
00000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000030 e5 20 fb ff ff ff ff 0f 44 eb 08 6b 08 3b 42 bb |. ......D..k.;B.|
00000040 fe ff ff ff ff ff 00 ff ff ff 44 eb 0c 20 0f 52 |..........D.. .R|
00000050 10 d8 00 ff 22 4a 05 ff 82 e9 14 ce ed 61 06 33 |...."J.......a.3|
00000060 7a 75 7a 75 07 b3 d5 5c 11 42 44 ff 88 50 00 01 |zuzu...\.BD..P..|
00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000090 00 36 00 27 9e f9 77 64 fc cb ff ff ff ff ff ff |.6.'..wd........|
000000a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000c0 ff 8e 00 fe 21 5c dc ff |....!\..|
Signed-off-by: Shiji Yang <yangshiji66 at outlook.com>
---
drivers/mtd/spi/Kconfig | 5 +++++
drivers/mtd/spi/spi-nor-core.c | 4 +++-
drivers/mtd/spi/spi-nor-ids.c | 7 +++++++
drivers/mtd/spi/spi-nor-tiny.c | 4 +++-
include/linux/mtd/spi-nor.h | 1 +
5 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig
index ca60a425ba3..68f81079715 100644
--- a/drivers/mtd/spi/Kconfig
+++ b/drivers/mtd/spi/Kconfig
@@ -156,6 +156,11 @@ config SPI_FLASH_ATMEL
help
Add support for various Atmel SPI flash chips (AT45xxx and AT25xxx)
+config SPI_FLASH_BOYAMICRO
+ bool "BoyaMicro SPI flash support"
+ help
+ Add support for various BoyaMicro SPI flash chips (BY25xxx)
+
config SPI_FLASH_EON
bool "EON SPI flash support"
help
diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index 5fa7ba27ae5..1a844057d9f 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -193,7 +193,8 @@ struct sfdp_header {
#define SNOR_SR1_BIT6_QUAD_ENABLE
#endif
-#if IS_ENABLED(CONFIG_SPI_FLASH_SPANSION) || \
+#if IS_ENABLED(CONFIG_SPI_FLASH_BOYAMICRO) || \
+ IS_ENABLED(CONFIG_SPI_FLASH_SPANSION) || \
IS_ENABLED(CONFIG_SPI_FLASH_WINBOND)
#define SNOR_SR2_BIT1_QUAD_ENABLE
#endif
@@ -765,6 +766,7 @@ static int set_4byte(struct spi_nor *nor, const struct flash_info *info,
/* Some Micron need WREN command; all will accept it */
need_wren = true;
fallthrough;
+ case SNOR_MFR_BOYAMICRO:
case SNOR_MFR_ISSI:
case SNOR_MFR_MACRONIX:
case SNOR_MFR_WINBOND:
diff --git a/drivers/mtd/spi/spi-nor-ids.c b/drivers/mtd/spi/spi-nor-ids.c
index b6a07fa9063..1bda2854ade 100644
--- a/drivers/mtd/spi/spi-nor-ids.c
+++ b/drivers/mtd/spi/spi-nor-ids.c
@@ -77,6 +77,13 @@ const struct flash_info spi_nor_ids[] = {
{ INFO("at25sl321", 0x1f4216, 0, 64 * 1024, 64, SECT_4K) },
{ INFO("at26df081a", 0x1f4501, 0, 64 * 1024, 16, SECT_4K) },
#endif
+#ifdef CONFIG_SPI_FLASH_BOYAMICRO /* BoyaMicro */
+ {
+ INFO("BY25Q256FS", 0x684919, 0, 64 * 1024, 512,
+ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
+ SPI_NOR_4B_OPCODES | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
+ },
+#endif
#ifdef CONFIG_SPI_FLASH_EON /* EON */
/* EON -- en25xxx */
{ INFO("en25q80b", 0x1c3014, 0, 64 * 1024, 16, SECT_4K) },
diff --git a/drivers/mtd/spi/spi-nor-tiny.c b/drivers/mtd/spi/spi-nor-tiny.c
index dde290ca6a4..5d8cee3f1c6 100644
--- a/drivers/mtd/spi/spi-nor-tiny.c
+++ b/drivers/mtd/spi/spi-nor-tiny.c
@@ -40,7 +40,8 @@
#define SNOR_SR1_BIT6_QUAD_ENABLE
#endif
-#if IS_ENABLED(CONFIG_SPI_FLASH_SPANSION) || \
+#if IS_ENABLED(CONFIG_SPI_FLASH_BOYAMICRO) || \
+ IS_ENABLED(CONFIG_SPI_FLASH_SPANSION) || \
IS_ENABLED(CONFIG_SPI_FLASH_WINBOND)
#define SNOR_SR2_BIT1_QUAD_ENABLE
#endif
@@ -229,6 +230,7 @@ static inline int set_4byte(struct spi_nor *nor, const struct flash_info *info,
/* Some Micron need WREN command; all will accept it */
need_wren = true;
fallthrough;
+ case SNOR_MFR_BOYAMICRO:
case SNOR_MFR_MACRONIX:
case SNOR_MFR_WINBOND:
if (need_wren)
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 4eef4ab0488..8768d794592 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -23,6 +23,7 @@
* Sometimes these are the same as CFI IDs, but sometimes they aren't.
*/
#define SNOR_MFR_ATMEL CFI_MFR_ATMEL
+#define SNOR_MFR_BOYAMICRO 0x68
#define SNOR_MFR_GIGADEVICE 0xc8
#define SNOR_MFR_INTEL CFI_MFR_INTEL
#define SNOR_MFR_ST CFI_MFR_ST /* ST Micro <--> Micron */
--
2.51.0
More information about the U-Boot
mailing list