flashchips: Add Boya/BoHong BY25Q32/64/128 3.3V variants
Add all remaining 3BA, 3.3V parts of the BY25Q family. Once more,
datasheets look very similar. The whole family supports volatile
status-register writes, three status registers, and all the usual
dual- and quad-i/o instructions. Also, they use the common, Win-
bond-like block protection bits.
Datasheets used:
http://en.boyamicro.com/download/SPI_NOR_Flash/BY25Q32BS.pdf
http://en.boyamicro.com/download/SPI_NOR_Flash/BY25Q32CS.pdf
http://en.boyamicro.com/download/SPI_NOR_Flash/BY25Q32ES.pdf
http://en.boyamicro.com/download/SPI_NOR_Flash/BY25Q64AS.pdf
http://en.boyamicro.com/download/SPI_NOR_Flash/BY25Q64ES.pdf
http://en.boyamicro.com/download/SPI_NOR_Flash/BY25Q128AS.pdf
http://en.boyamicro.com/download/SPI_NOR_Flash/BY25Q128ES.pdf
http://en.boyamicro.com/download/SPI_NOR_Flash/BY25Q128FS.pdf
Change-Id: Iff9c0459d215669025bc2af8b619fcf17c56f528
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/282
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/flashchips.c b/flashchips.c
index 0136749..dcffe9b 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -3786,13 +3786,124 @@
{
.vendor = "Boya/BoHong Microelectronics",
- .name = "B.25Q128AS",
+ .name = "B.25Q32BS/BY25Q32CS/BY25Q32ES",
+ .bustype = BUS_SPI,
+ .manufacture_id = BOYA_BOHONG_ID,
+ .model_id = BOYA_BOHONG_B_25Q32BS,
+ .total_size = 4096,
+ .page_size = 256,
+ /* BY25Q32CS: QPI w/ SRP (4, 4, 6, 8) */
+ .feature_bits = FEATURE_WRSR_EITHER | FEATURE_WRSR2 | FEATURE_WRSR3 |
+ FEATURE_OTP | FEATURE_QIO,
+ .tested = TEST_UNTESTED,
+ .probe = probe_spi_rdid,
+ .probe_timing = TIMING_ZERO,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {4 * 1024, 1024} },
+ .block_erase = spi_block_erase_20,
+ }, {
+ .eraseblocks = { {32 * 1024, 128} },
+ .block_erase = spi_block_erase_52,
+ }, {
+ .eraseblocks = { {64 * 1024, 64} },
+ .block_erase = spi_block_erase_d8,
+ }, {
+ .eraseblocks = { {4096 * 1024, 1} },
+ .block_erase = spi_block_erase_60,
+ }, {
+ .eraseblocks = { {4096 * 1024, 1} },
+ .block_erase = spi_block_erase_c7,
+ },
+ },
+ .reg_bits =
+ {
+ .qe = {STATUS2, 1, RW},
+ .srp = {STATUS1, 7, RW},
+ .srl = {STATUS2, 0, RW},
+ .bp = {{STATUS1, 2, RW}, {STATUS1, 3, RW}, {STATUS1, 4, RW}},
+ .tb = {STATUS1, 5, RW}, /* Called BP3 in datasheet, acts like TB */
+ .sec = {STATUS1, 6, RW}, /* Called BP4 in datasheet, acts like SEC */
+ .cmp = {STATUS2, 6, RW},
+ },
+ .wp_write_cfg = spi_wp_write_cfg,
+ .wp_read_cfg = spi_wp_read_cfg,
+ .wp_get_ranges = spi_wp_get_available_ranges,
+ .decode_range = decode_range_spi25,
+ .printlock = spi_prettyprint_status_register_bp4_srwd,
+ .unlock = spi_disable_blockprotect_bp4_srwd,
+ .write = spi_chip_write_256,
+ .read = spi_chip_read,
+ .voltage = {2700, 3600},
+ .prepare_access = spi_prepare_io,
+ .finish_access = spi_finish_io,
+ },
+
+ {
+ .vendor = "Boya/BoHong Microelectronics",
+ .name = "B.25Q64AS/BY25Q64ES",
+ .bustype = BUS_SPI,
+ .manufacture_id = BOYA_BOHONG_ID,
+ .model_id = BOYA_BOHONG_B_25Q64AS,
+ .total_size = 8192,
+ .page_size = 256,
+ .feature_bits = FEATURE_WRSR_EITHER | FEATURE_WRSR2 | FEATURE_WRSR3 |
+ FEATURE_OTP | FEATURE_QIO,
+ .tested = TEST_UNTESTED,
+ .probe = probe_spi_rdid,
+ .probe_timing = TIMING_ZERO,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {4 * 1024, 2048} },
+ .block_erase = spi_block_erase_20,
+ }, {
+ .eraseblocks = { {32 * 1024, 256} },
+ .block_erase = spi_block_erase_52,
+ }, {
+ .eraseblocks = { {64 * 1024, 128} },
+ .block_erase = spi_block_erase_d8,
+ }, {
+ .eraseblocks = { {8192 * 1024, 1} },
+ .block_erase = spi_block_erase_60,
+ }, {
+ .eraseblocks = { {8192 * 1024, 1} },
+ .block_erase = spi_block_erase_c7,
+ },
+ },
+ .reg_bits =
+ {
+ .qe = {STATUS2, 1, RW},
+ .srp = {STATUS1, 7, RW},
+ .srl = {STATUS2, 0, RW},
+ .bp = {{STATUS1, 2, RW}, {STATUS1, 3, RW}, {STATUS1, 4, RW}},
+ .tb = {STATUS1, 5, RW}, /* Called BP3 in datasheet, acts like TB */
+ .sec = {STATUS1, 6, RW}, /* Called BP4 in datasheet, acts like SEC */
+ .cmp = {STATUS2, 6, RW},
+ },
+ .wp_write_cfg = spi_wp_write_cfg,
+ .wp_read_cfg = spi_wp_read_cfg,
+ .wp_get_ranges = spi_wp_get_available_ranges,
+ .decode_range = decode_range_spi25,
+ .printlock = spi_prettyprint_status_register_bp4_srwd,
+ .unlock = spi_disable_blockprotect_bp4_srwd,
+ .write = spi_chip_write_256,
+ .read = spi_chip_read,
+ .voltage = {2700, 3600},
+ .prepare_access = spi_prepare_io,
+ .finish_access = spi_finish_io,
+ },
+
+ {
+ .vendor = "Boya/BoHong Microelectronics",
+ .name = "B.25Q128AS/BY25Q128ES",
.bustype = BUS_SPI,
.manufacture_id = BOYA_BOHONG_ID,
.model_id = BOYA_BOHONG_B_25Q128AS,
.total_size = 16384,
.page_size = 256,
- .feature_bits = FEATURE_WRSR_WREN | FEATURE_WRSR2 | FEATURE_WRSR3 |
+ .feature_bits = FEATURE_WRSR_EITHER | FEATURE_WRSR2 | FEATURE_WRSR3 |
FEATURE_OTP | FEATURE_QIO,
.tested = TEST_OK_PREW,
.probe = probe_spi_rdid,
@@ -3819,9 +3930,74 @@
.reg_bits =
{
.qe = {STATUS2, 1, RW},
+ .srp = {STATUS1, 7, RW},
+ .srl = {STATUS2, 0, RW},
+ .bp = {{STATUS1, 2, RW}, {STATUS1, 3, RW}, {STATUS1, 4, RW}},
+ .tb = {STATUS1, 5, RW}, /* Called BP3 in datasheet, acts like TB */
+ .sec = {STATUS1, 6, RW}, /* Called BP4 in datasheet, acts like SEC */
+ .cmp = {STATUS2, 6, RW},
},
- .printlock = spi_prettyprint_status_register_plain,
- .unlock = spi_disable_blockprotect_at25fs040,
+ .wp_write_cfg = spi_wp_write_cfg,
+ .wp_read_cfg = spi_wp_read_cfg,
+ .wp_get_ranges = spi_wp_get_available_ranges,
+ .decode_range = decode_range_spi25,
+ .printlock = spi_prettyprint_status_register_bp4_srwd,
+ .unlock = spi_disable_blockprotect_bp4_srwd,
+ .write = spi_chip_write_256,
+ .read = spi_chip_read,
+ .voltage = {2700, 3600},
+ .prepare_access = spi_prepare_io,
+ .finish_access = spi_finish_io,
+ },
+
+ {
+ .vendor = "Boya Microelectronics",
+ .name = "BY25Q128FS",
+ .bustype = BUS_SPI,
+ .manufacture_id = BOYA_BOHONG_ID,
+ .model_id = BOYA_BOHONG_B_25Q128FS,
+ .total_size = 16384,
+ .page_size = 256,
+ .feature_bits = FEATURE_WRSR_EITHER | FEATURE_WRSR2 | FEATURE_WRSR3 |
+ FEATURE_OTP | FEATURE_QIO,
+ .tested = TEST_UNTESTED,
+ .probe = probe_spi_rdid,
+ .probe_timing = TIMING_ZERO,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {4 * 1024, 4096} },
+ .block_erase = spi_block_erase_20,
+ }, {
+ .eraseblocks = { {32 * 1024, 512} },
+ .block_erase = spi_block_erase_52,
+ }, {
+ .eraseblocks = { {64 * 1024, 256} },
+ .block_erase = spi_block_erase_d8,
+ }, {
+ .eraseblocks = { {16 * 1024 * 1024, 1} },
+ .block_erase = spi_block_erase_60,
+ }, {
+ .eraseblocks = { {16 * 1024 * 1024, 1} },
+ .block_erase = spi_block_erase_c7,
+ }
+ },
+ .reg_bits =
+ {
+ .qe = {STATUS2, 1, RW},
+ .srp = {STATUS1, 7, RW},
+ .srl = {STATUS2, 0, RW},
+ .bp = {{STATUS1, 2, RW}, {STATUS1, 3, RW}, {STATUS1, 4, RW}},
+ .tb = {STATUS1, 5, RW}, /* Called BP3 in datasheet, acts like TB */
+ .sec = {STATUS1, 6, RW}, /* Called BP4 in datasheet, acts like SEC */
+ .cmp = {STATUS2, 6, RW},
+ },
+ .wp_write_cfg = spi_wp_write_cfg,
+ .wp_read_cfg = spi_wp_read_cfg,
+ .wp_get_ranges = spi_wp_get_available_ranges,
+ .decode_range = decode_range_spi25,
+ .printlock = spi_prettyprint_status_register_bp4_srwd,
+ .unlock = spi_disable_blockprotect_bp4_srwd,
.write = spi_chip_write_256,
.read = spi_chip_read,
.voltage = {2700, 3600},
diff --git a/include/flashchips.h b/include/flashchips.h
index d86aa5d..d755c1e 100644
--- a/include/flashchips.h
+++ b/include/flashchips.h
@@ -215,7 +215,10 @@
#define BOYA_BOHONG_B_25D40AS 0x4013
#define BOYA_BOHONG_B_25D80AS 0x4014 /* Same as BY25Q80* */
#define BOYA_BOHONG_B_25D16AS 0x4015 /* Same as BY25Q16* */
+#define BOYA_BOHONG_B_25Q32BS 0x4016
+#define BOYA_BOHONG_B_25Q64AS 0x4017
#define BOYA_BOHONG_B_25Q128AS 0x4018
+#define BOYA_BOHONG_B_25Q128FS 0x4118
/* Bright Microelectronics has the same manufacturer ID as Hyundai... */
#define BRIGHT_ID 0xAD /* Bright Microelectronics */