Go to menu

Bright Moon T25S40 in flashrom

2024-02-26

While trying to resurrect a dead SATA to USB 3 bridge, I turned my attention to one of the two ICs it had: an SPI flash chip marked T25S40, which seems to be made by Bright Moon, and also isn’t supported by flashrom out of the box.

Thankfully, someone made a pull request for its support. That, however, got lost somewhere in the review process, so I had to apply it and build flashrom myself.

Curiously, my T25S40 didn’t have model ID 0x2013, but 0x3213. Changing the expected value in flashrom worked, so I suppose it’s another revision the original patch didn’t account for.

Since I had to fix the patch to compile with newer flashrom version, here is the modified version:

diff --git a/flashchips.c b/flashchips.c
index 204f34f..9c311a0 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -3670,6 +3670,45 @@ const struct flashchip flashchips[] = {
                .voltage        = {4500, 5500},
        },
 
+       {
+               .vendor         = "BrightMoon",
+               .name           = "T25S40",
+               .bustype        = BUS_SPI,
+               .manufacture_id = 0x5e,
+               //.model_id       = 0x2013,
+               .model_id       = 0x3213,
+               .total_size     = 512,
+               .page_size      = 256,
+               .feature_bits   = FEATURE_WRSR_WREN,
+               .tested         = TEST_OK_PREW,
+               .probe          = PROBE_SPI_RDID,
+               .probe_timing   = TIMING_ZERO,
+               .block_erasers  =
+               {
+                       {
+                               .eraseblocks = { {4 * 1024, 128} },
+                               .block_erase = SPI_BLOCK_ERASE_20,
+                       }, {
+                               .eraseblocks = { {32 * 1024, 16} },
+                               .block_erase = SPI_BLOCK_ERASE_52,
+                       }, {
+                               .eraseblocks = { {64 * 1024, 8} },
+                               .block_erase = SPI_BLOCK_ERASE_D8,
+                       }, {
+                               .eraseblocks = { {512 * 1024, 1} },
+                               .block_erase = SPI_BLOCK_ERASE_60,
+                       }, {
+                               .eraseblocks = { {512 * 1024, 1} },
+                               .block_erase = SPI_BLOCK_ERASE_C7,
+                       }
+               },
+               .printlock      = SPI_PRETTYPRINT_STATUS_REGISTER_BP3_SRWD,
+               .unlock         = SPI_DISABLE_BLOCKPROTECT_BP3_SRWD,
+               .write          = SPI_CHIP_WRITE256,
+               .read           = SPI_CHIP_READ, /* Fast read (0x0B), dual I/O read (0x3B) supported */
+               .voltage        = {2700, 3600},
+       },
+
        {
                .vendor         = "Catalyst",
                .name           = "CAT28F512",

And no, I didn’t manage to fix that SATA bridge. I wager the main IC is dead, sadly.