x1000: Bootloader now probes for the ONFI flash header at multiple addesses

The location (and number of pages) is apparently manufacturer-dependent.
here are some known so far:

Winbond:    page 1
gigadevice: page 4

This info is only queried/dumped when explicitly requested for debug
purposes.

Change-Id: Icc4f9c0d4f2cc9097b2295c8f42a22aab392d0d5
This commit is contained in:
Solomon Peachy 2026-02-03 06:24:22 -05:00
parent 78542df466
commit 8baeeda23f

View file

@ -437,15 +437,29 @@ static int dump_flash_onfi_info(int fd)
nand_enable_otp(ndrv, true);
int i;
bool is_onfi;
uint8_t* buf = ndrv->page_buf;
/* read ONFI parameter page */
ret = nand_page_read(ndrv, 0x01, ndrv->page_buf);
for (i = 1; i <= 4; i++) {
ret = nand_page_read(ndrv, i, ndrv->page_buf);
if(ret != NAND_SUCCESS) {
splashf(5*HZ, "Dump failed\nNAND read error");
goto out;
}
uint8_t* buf = ndrv->page_buf;
is_onfi = buf[0] == 'O' && buf[1] == 'N' && buf[2] == 'F' && buf[3] == 'I';
if (is_onfi)
break;
}
if(!is_onfi) {
fdprintf(fd, "No ONFI Page!");
goto out;
}
fdprintf(fd, "ONFI Page = %02x\n", i);
fdprintf(fd, "signature = %08lx\n", load_le32(buf));
fdprintf(fd, "revision = %04x\n", load_le16(buf+4));