[PATCH v2 1/2] mtd: spi-nor: add Octal DTR support for Macronix flash

Michael Walle michael at walle.cc
Thu Jul 27 03:11:19 PDT 2023


Hi,

>> +	/* Macronix SPI-NOR flash 8D-8D-8D read ID would get 6 bytes data 
>> A-A-B-B-C-C */
>> +	for (i = 0; i < nor->info->id_len; i++)
>> +		if (buf[i * 2] != nor->info->id[i])
>> +			return -EINVAL;

We need some kind of per flash rdid override. I guess rdid won't work
in octal mode then. Are any other commands also affected?

I had something like a per flash .rdid op in mind where for this flash
you do like

rdid() {
    if (octal mode) {
        buf = spi_xfer(2 * SPI_NOR_MAX_ID_LEN);
        strip_every_other_byte(buf);
        return buf;
    } else {
       spi_nor_default_read_id();
    }
}

rename spi_nor_read_id() to spi_nor_default_read_id()

spi_nor_read_id() {
    if (nor->info->rdid)
       return nor->info->rdid();
    return spi_nor_default_read_id();
}

And also move the readid and compare code to a common helper, as
discussed.

-michael



More information about the linux-mtd mailing list