P1010 legacy u-boot

cancel
Showing results for 
Search instead for 
Did you mean: 

P1010 legacy u-boot

165 Views
naiyingkoong
Contributor I

Hi,

I would like to add MX25L25635F flash in to the legacy u-boot with the old architecture.

Because the SDK supports the espi only, I can not use the spi function in it.

Modification:

static int macronix_wait_ready(struct spi_flash *flash, unsigned long timeout)
{
struct spi_slave *spi = flash->spi;
unsigned long timebase;
int ret;
u8 status;

timebase = get_timer(0);
do {
ret = spi_flash_cmd(spi, CMD_MX25XX_RDSR, &status, sizeof(status));
if (ret)
return -1;

if ((status & MACRONIX_SR_WIP) == 0)
break;

} while (get_timer(timebase) < timeout);


if ((status & MACRONIX_SR_WIP) == 0)
return 0;

/* Timed out */
return -1;

}

  • About the 32-bit access, I also tried to modify the read-write command:

static int macronix_read_fast(struct spi_flash *flash,
u32 offset, size_t len, void *buf)
{
struct macronix_spi_flash *mcx = to_macronix_spi_flash(flash);
unsigned long page_addr;
unsigned long page_size;
int ret=0;
u8 cmd[6];
const u8 Wreg=0xC5;
const u8 EXTE=0x80;
const u8 EXTD=0x00;
spi_flash_cmd_write(flash->spi, &Wreg, 0x1, &EXTE, 0x1);

page_size = mcx->params->page_size;
page_addr = offset / page_size;

cmd[0] = CMD_READ_ARRAY_FAST;
cmd[1] = page_addr >> 16;
cmd[2] = page_addr >> 8;
cmd[3] = page_addr;
cmd[4] = offset % page_size;
cmd[5] = 0x00;


ret=spi_flash_read_common(flash, cmd, sizeof(cmd), buf, len);

spi_flash_cmd_write(flash->spi, &Wreg, 0x1, &EXTD, 0x1);
return ret;
}

Could you help to check? Do I miss anything?

Thank you.

0 Kudos
1 Reply

32 Views
tsi-chung_liew
NXP Employee
NXP Employee

Hi,

I don't support u-boot.

If you plan to add new SPI flash support to existing u-boot, you can add as you desired. Refer to u-boot SPI directory and source for more information, and the SPI flash spec to provide proper command value.

Note: Do not apply u-boot source to any NXP code that is not GPL (Linux/U-boot).

Regards,

TC

0 Kudos