[U-Boot] [PATCH v4] dm: sf: Add Atmel DataFlash spi flash driver

Jagan Teki jteki at openedev.com
Sun May 17 13:10:42 CEST 2015


On 15 May 2015 at 07:49, Wang Haikun <Haikun.Wang at freescale.com> wrote:
> On 5/14/2015 6:50 PM, Jagan Teki wrote:
>> On 14 May 2015 at 14:57, Haikun Wang <haikun.wang at freescale.com> wrote:
>>> Atmel DataFlash chips have commands different from common spi
>>> flash commands.
>>> Atmel DataFlash also have special page-size.
>>> This driver add support for accessing Atmel DataFlash.
>>> It is based on the Driver Model.
>>> Example:
>>> => sf probe 1:0
>>> SPI DataFlash: Detected AT45DB021B with page size 264 Bytes, erase size 264 Bytes, total 264 KiB, revision d
>>> => sf erase 0 42000
>>> SF: 270336 bytes @ 0x0 Erased: OK
>>> => mw.l 82000000 45444342 20000
>>> => sf write 82000000 0 42000
>>> SF: 270336 bytes @ 0x0 Written: OK
>>> => sf read 83000000 0 42000
>>> SF: 270336 bytes @ 0x0 Read: OK
>>> => cmp.b 82000000 83000000 42000
>>> Total of 270336 byte(s) were the same
>>>
>>> Signed-off-by: Haikun Wang <haikun.wang at freescale.com>
>>> ---
>>> Verified with AT45DB021B on LS1021AQDS.
>>>
>>> Changes in v4:
>>> - Use dev_get_priv and dev_get_uclass_priv
>>> - Add test log to commit message
>>>
>>> Changes in v3:
>>> - 1. Rename file spi_dataflash.c to sf_dataflash.c
>>> - 2. Add comment for array "dataflash_data"
>>>
>>> Changes in v2:
>>> - 1. Correct comment style
>>> - 2. Use get_timer in dataflash_waitready to check whether timeout
>>> - 3. Remove struct spi_flash * in struct dataflash, and get it from udevice->uclass_priv
>>> - 4. Replace spi_flash_write_common with spi_flash_cmd_write
>>> - 5. Replace spi_flash_read with spi_flash_cmd_read
>>> - 6. Change type of varible "status" form char to u8 in dataflash_status
>>> - 7. Change add_dataflash's argument type due to <change 3>
>>> - 8. Add claim_bus and release_bus in erase/write/read due to <change 4 & 5>
>>>
>>> Changes in v1: None
>>>   drivers/mtd/spi/Makefile       |   1 +
>>>   drivers/mtd/spi/sf_dataflash.c | 711 +++++++++++++++++++++++++++++++++++++++++
>>>   2 files changed, 712 insertions(+)
>>>   create mode 100644 drivers/mtd/spi/sf_dataflash.c
>>>
>>> diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
>>> index c61b784..8adec3d 100644
>>> --- a/drivers/mtd/spi/Makefile
>>> +++ b/drivers/mtd/spi/Makefile
>>> @@ -15,6 +15,7 @@ endif
>>>   #ifndef CONFIG_DM_SPI
>>>   obj-$(CONFIG_SPI_FLASH) += sf_probe.o
>>>   #endif
>>> +obj-$(CONFIG_DM_SF_DATAFLASH) += sf_dataflash.o
>>
>> This looks confuse to me,  CONFIG_SF_DATAFLASH looks simpler.
> Fine.
>>
>> For long run all the driver stuff could move to DM, no need to specify
>> explicitly.
>>
>> BTW:
>> Did you define this any board config?
> I will add it to LS1021AQDS board config and submit a separate patch.

Can you please send the patch as well, I will apply both at once.

Applying new feature driver with proper usage in particular board config
with well tested - make me more confident to apply [for new feature-list]

thanks!
-- 
Jagan Teki,
Openedev.


More information about the U-Boot mailing list