Bas Stottelaar
62994dfb16
drivers/*: replace #if ENABLE_DEBUG with IS_ACTIVE
2020-11-02 21:34:12 +01:00
Benjamin Valentin
fde3026312
drivers/mtd_spi_nor: prevent data corruption on 'sector erase'
...
There is no difference between 4k erase and sector erase.
But sector erase would previously do `.block_erase` which would not
erase a sector (4k) but a whole block (64k).
Fortunately all boards declare `SPI_NOR_F_SECT_4K` and all file systems
don't try to erase anything smaller, so this was never triggered.
Add an `assert(0)` to crash instead of corrupting data.
2020-10-26 13:48:26 +01:00
Benjamin Valentin
783df5990b
drivers/mtd_spi_nor: do address conversion in SPI function
2020-10-26 13:02:09 +01:00
Benjamin Valentin
27cf34d836
drivers/mtd_spi_nor: introduce helper function to get SPI device
2020-10-26 13:02:09 +01:00
Benjamin Valentin
0425325260
drivers/mtd_spi_nor: use single transfer to read JEDEC ID
...
Just read the JEDEC ID with a single SPI transfer, there can only
be 10 banks.
This makes adaption to QSPI much simpler because now flash functions
don't call the SPI API directly anymore.
2020-10-26 13:02:09 +01:00
Benjamin Valentin
2fa208e5ed
drivers/mtd_spi_nor: cleanup
...
- remove forward declarations
- remove useless do { … } while (0); loops
- insert whitespace
2020-10-26 13:02:09 +01:00
Bas Stottelaar
92b1dfc703
drivers/*: realign ENABLE_DEBUG
2020-10-23 01:26:09 +02:00
Benjamin Valentin
68a47b63e3
drivers/mtd_spi_nor: implement mtd_spi_nor_write_page()
2020-08-18 17:25:39 +02:00
Benjamin Valentin
50914cbf96
drivers/mtd_spi_nor: move printing of flash debug info
...
Move printing the flash information after deriving the capacity.
2020-06-09 16:09:40 +02:00
Benjamin Valentin
585928f23d
drivers/mtd_spi_nor: derive capacity from JEDEC ID
...
Most manufacturers (Spansion, Micron & ISSI) just encode the capacity
in the second ID byte.
Old Adesto (Atmel) chips use a different scheme here.
2020-06-09 16:09:40 +02:00
fabian18
a3a1c160ee
mtd: Change API to return 0 on success
...
Returning the number of bytes written/read could return a negative integer
because a uint32_t is expected for the length in read()/write() operations.
2020-05-06 20:24:27 +02:00
Vincent Dupont
c077c07017
drivers/mrd_spi_nor: fix read spanning pages
2020-05-06 16:36:29 +02:00
Francisco Molina
61eecf6fe0
drivers/mtd_spi_nor: power up MTD on init
2020-04-21 11:09:40 +02:00
Francisco Molina
8a256eba12
drivers/mtd_spi_nor: return error on invalid manuf id
2020-04-21 11:09:40 +02:00
Koen Zandberg
dc04b86d1b
mtd_spi_nor: Add wait timings to parameters
2020-03-03 09:49:00 +01:00
2dcf65d942
Merge pull request #13332 from bergzand/pr/mtd_spi_nor/params_struct
...
mtd_spi_nor: Move const params to separate struct
2020-02-26 09:43:18 +01:00
Koen Zandberg
d40015a41a
mtd_spi_nor: Add chip wait timings to debug output
2020-02-25 11:21:20 +01:00
Koen Zandberg
e5fa8921b3
mtd_spi_nor: Move const params to separate struct
2020-02-11 15:55:41 +01:00
Vincent Dupont
f11fac8811
mtd_spi_nor: remove sleep when waiting for write completed
2020-02-05 16:20:01 +01:00
Pieter Willemsen
372cd64547
mtd_spi_nor: run uncrustify
2018-03-05 15:54:29 +01:00
Pieter Willemsen
e4055d5cd5
mtd_spi_nor: make thread safe
2018-03-05 15:54:29 +01:00
Vincent Dupont
063a7835c4
driver/mtd_spi_nor: fix erase with unaligned addresses
2018-02-26 12:22:59 +01:00
Vincent Dupont
a02db9c551
drivers/mtd_spi_nor: fix chip erase
2017-11-24 16:48:21 +01:00
Alexandre Abadie
8d74212afa
drivers/mtd: constify where possible
2017-06-29 22:46:16 +02:00
Joakim Nohlgård
9313d8ec67
mtd_spi_nor: MTD interface driver for SPI NOR flash memory
...
This is a generic SPI NOR flash driver which can be used with many
different flash chips.
2017-03-29 16:52:07 +02:00