spiFlash: added MX25L enable/disable quad + display status register

This commit is contained in:
Gwenhael Goavec-Merou 2024-09-22 13:10:18 +02:00
parent 2a46ab9265
commit e56cfb41fc
2 changed files with 19 additions and 8 deletions

View File

@ -40,6 +40,7 @@
#define FLASH_4SE 0x21 #define FLASH_4SE 0x21
/* read configuration register */ /* read configuration register */
#define FLASH_RDCR 0x35 #define FLASH_RDCR 0x35
#define MX25L_RDCR 0x15
/* write function register (at least ISSI) */ /* write function register (at least ISSI) */
#define FLASH_WRFR 0x42 #define FLASH_WRFR 0x42
/* read function register (at least ISSI) */ /* read function register (at least ISSI) */
@ -632,7 +633,7 @@ void SPIFlash::display_status_reg(uint8_t reg)
printf("BPNV : %d\n", ((reg >> 3) & 0x01)); printf("BPNV : %d\n", ((reg >> 3) & 0x01));
printf("TBPROT : %d\n", ((reg >> 5) & 0x01)); printf("TBPROT : %d\n", ((reg >> 5) & 0x01));
if (dev_id == 0x0120) if (dev_id == 0x0120)
printf("LC : %d\n", ((reg >> 6) & 0x02)); printf("LC : %d\n", ((reg >> 6) & 0x03));
break; break;
case 0x0160: case 0x0160:
_spi->spi_put(FLASH_RDCR, NULL, &reg, 1); _spi->spi_put(FLASH_RDCR, NULL, &reg, 1);
@ -658,6 +659,13 @@ void SPIFlash::display_status_reg(uint8_t reg)
printf("DUAL : %d\n", ((nv_reg >> 2) & 0x01)); printf("DUAL : %d\n", ((nv_reg >> 2) & 0x01));
/* 1:0: reserved */ /* 1:0: reserved */
break; break;
case 0xC220:
_spi->spi_put(MX25L_RDCR, NULL, &reg, 1);
printf("\nConfiguration Register\n");
printf("RDCR : %02x\n", reg);
printf("DC : %d\n", ((reg >> 6) & 0x03));
printf("TB : %d\n", ((reg >> 3) & 0x01));
printf("ODS : %d\n", ((reg >> 0) & 0x07));
} }
} }
@ -993,7 +1001,10 @@ int8_t SPIFlash::get_tb()
_spi->spi_put(FLASH_RDFR, NULL, &status, 1); _spi->spi_put(FLASH_RDFR, NULL, &status, 1);
break; break;
case CONFR: // function register case CONFR: // function register
_spi->spi_put(FLASH_RDCR, NULL, &status, 1); if ((_jedec_id >> 8) == 0xC220)
_spi->spi_put(MX25L_RDCR, NULL, &status, 1);
else
_spi->spi_put(FLASH_RDCR, NULL, &status, 1);
break; break;
case NONER: // no TB bit case NONER: // no TB bit
return 0; return 0;

View File

@ -437,8 +437,8 @@ static std::map <uint32_t, flash_t> flash_list = {
.tb_register = CONFR, .tb_register = CONFR,
.bp_len = 5, .bp_len = 5,
.bp_offset = {(1 << 2), (1 << 3), (1 << 4), (1 << 5)}, .bp_offset = {(1 << 2), (1 << 3), (1 << 4), (1 << 5)},
.quad_register = NONER, .quad_register = STATR,
.quad_mask = 0, .quad_mask = (1 << 6),
}}, }},
{0xc22018, { {0xc22018, {
/* https://www.macronix.com/Lists/Datasheet/Attachments/8934/MX25L12833F,%203V,%20128Mb,%20v1.0.pdf */ /* https://www.macronix.com/Lists/Datasheet/Attachments/8934/MX25L12833F,%203V,%20128Mb,%20v1.0.pdf */
@ -453,8 +453,8 @@ static std::map <uint32_t, flash_t> flash_list = {
.tb_register = CONFR, .tb_register = CONFR,
.bp_len = 5, .bp_len = 5,
.bp_offset = {(1 << 2), (1 << 3), (1 << 4), (1 << 5)}, .bp_offset = {(1 << 2), (1 << 3), (1 << 4), (1 << 5)},
.quad_register = NONER, .quad_register = STATR,
.quad_mask = 0, .quad_mask = (1 << 6),
}}, }},
{0xc2201a, { {0xc2201a, {
/* https://www.macronix.com/Lists/Datasheet/Attachments/8745/MX25L51245G,%203V,%20512Mb,%20v1.7.pdf */ /* https://www.macronix.com/Lists/Datasheet/Attachments/8745/MX25L51245G,%203V,%20512Mb,%20v1.7.pdf */
@ -469,8 +469,8 @@ static std::map <uint32_t, flash_t> flash_list = {
.tb_register = CONFR, .tb_register = CONFR,
.bp_len = 5, .bp_len = 5,
.bp_offset = {(1 << 2), (1 << 3), (1 << 4), (1 << 5)}, .bp_offset = {(1 << 2), (1 << 3), (1 << 4), (1 << 5)},
.quad_register = NONER, .quad_register = STATR,
.quad_mask = 0, .quad_mask = (1 << 6),
}}, }},
{0xc22817, { {0xc22817, {
/* https://www.macronix.com/Lists/Datasheet/Attachments/8868/MX25R6435F,%20Wide%20Range,%2064Mb,%20v1.6.pdf */ /* https://www.macronix.com/Lists/Datasheet/Attachments/8868/MX25R6435F,%20Wide%20Range,%2064Mb,%20v1.6.pdf */