[U-Boot] [PATCH 3/5] spi: sf: Support byte program for sst spi flash

Bin Meng bmeng.cn at gmail.com
Tue Oct 28 02:42:02 CET 2014


Hi Jegan,

On Tue, Oct 28, 2014 at 2:00 AM, Jagan Teki <jagannadh.teki at gmail.com> wrote:
> I believe byte write is already been used within the sst_write_wp -
> please check.
>

Yes, byte write is used within sst_write_wp, however that does not
mean sst_write_wp is doing the correct thing for byte program (02h).
The sst_write_wp() is using the AAI command (ADh) which might not be
supported by every spi host controller.

>>  /* Send a single-byte command to the device and read the response */
>> diff --git a/drivers/mtd/spi/sf_ops.c b/drivers/mtd/spi/sf_ops.c
>> index 85cf22d..3703acb 100644
>> --- a/drivers/mtd/spi/sf_ops.c
>> +++ b/drivers/mtd/spi/sf_ops.c
>> @@ -516,4 +516,35 @@ int sst_write_wp(struct spi_flash *flash, u32 offset, size_t len,
>>         spi_release_bus(flash->spi);
>>         return ret;
>>  }
>> +
>> +int sst_write_bp(struct spi_flash *flash, u32 offset, size_t len,
>> +               const void *buf)
>
> This function is simply calling existing sst_byte_write().

Yes, but with a loop counter of buffer length.

> SST commands(write) is different than normal flash commands,  I don't like
> to change the controller driver to know the flash command usage.
>
> May be this part can think later, try to see above comments.

Yes, SST is different. But since there is already a spi->op_mode_tx
field we can make use of it to do similar thing like spi->op_mode_rx
(determining which read command to use). Again this might be revisited
in the future if this is not that clean.

Regards,
Bin


More information about the U-Boot mailing list