Wykres commitów

39 Commity (9f3c0b1e385abc8c9187672442c242a22438bb41)

Autor SHA1 Wiadomość Data
Cao Sen Miao 6c0aebe279 esp_flash: add opi flash support in esp_flash chip driver, for MXIC 2021-09-07 14:44:40 +08:00
Ivan Grokhotkov 7534c4467f rom, spi_flash: add a patch for esp_flash_erase_region for C3, S3, H2 2021-07-24 13:28:25 +02:00
negativekelvin 8e6700c156
esp_flash_api fixes 2021-07-23 02:35:27 -07:00
Cao Sen Miao fecf27e54c spi_flash: add support for 32Mbit address GD flash, for GD25Q256 2021-07-02 17:13:51 +08:00
Cao Sen Miao 0d81edb174 spi_flash: refactoring flash encryption into new api 2021-04-25 17:09:25 +08:00
Cao Sen Miao c54ea54d98 spi_flash: make suspend off by default and add more information for using suspend 2021-03-26 13:57:14 +08:00
Cao Sen Miao 78a2dbe42a spi_flash: add a new function to support read the unique id
Close https://github.com/espressif/esp-idf/pull/4255
2021-03-15 11:40:33 +08:00
Cao Sen Miao 9905da46e0 spi_flash: Add auto suspend mode on esp32c3 2021-01-25 11:14:02 +08:00
KonstantinKondrashov 60e58eaddb spi_flash: Add auto-suspend mode for ESP32-S2
Uses HW auto_wait_idle, HW auto_suspend and SW resume
2021-01-25 11:13:38 +08:00
Angus Gratton d4c9a45675 spi_flash: Add ESP32-C3 support
Based on internal commit 3ef01301fff
2020-12-17 15:34:13 +11:00
Michael (XIAO Xufeng) 8ae09194ac esp_flash: refactor to support various type of yield
There is a periodically yield in the esp_flash driver, to ensure the
cache will not be disabled for too long on ESP32.

On ESP32-S2 and later, we need to support more different kind of yield:

1. polling conditions, including timeout, SW read request, etc.
2. wait for events, including HW done/error/auto-suspend, timeout
semaphore, etc.

The check_yield() and yield() is separated into two parts, because we
may need to insert suspend, etc. between them.
2020-11-10 19:05:22 +08:00
Michael (XIAO Xufeng) 3bacf35310 esp_flash: support high capacity flash chips (32-bit address) 2020-10-29 18:20:11 +08:00
Renz Bagaporo b3a7c6e27e components: remove some unneeded headers from source files 2020-10-22 19:37:10 +08:00
Michael (XIAO Xufeng) 233b4720b4 esp_flash: fix write issue using buffer on stack out of lifetime 2020-09-10 03:17:39 +00:00
Ivan Grokhotkov 75a874d4fd spi_flash: make {get,release}_temp_buffer OS functions optional
Fixes a crash when calling a NULL release_temp_buffer pointer throug
esp_flash_noos_functions, when doing a core dump.
2020-07-29 12:42:26 +02:00
Michael (XIAO Xufeng) c796bd5e63 esp_flash: refactor to make host driver function a const table
This is also part of ESP32-S3 ROM changes
2020-07-13 03:10:00 +08:00
Michael (XIAO Xufeng) a9c8895bb2 esp_flash: refactor to be compatible with the latest ROM
Including:
1. Change the write bytes/read bytes parameter in the host driver into slicers to meet the requirements of complicated cases.
2. Refactor the esp_flash_api code a bit so that we can use the code in the ROM laster
3. Provide get_temp_buffer and release_temp_buffer in the os_functions when the buffer passed by application cannot be used directly.
4. Make timeout of operations configurable in the chip_driver.
5. Make dummy number configurable.
2020-07-12 02:09:45 +08:00
Michael (XIAO Xufeng) 479269a52b Merge branch 'feature/configure_flash_write_chunk_size' into 'master'
spi_flash: add configuration option to select flash write chunk size

See merge request espressif/esp-idf!9067
2020-06-22 14:50:42 +08:00
Mahavir Jain 05da91f0db spi_flash: add configuration option to select flash write chunk size
Flash write operation is broken down into smaller chunk writes. Size
of this chunk was previously set to 8K but that in-turn meant cache and
non-IRAM resident interrupts could stay disabled upto ~24msec for 8K flash
write operation. If chunk size is brought down to 256 (typical flash page size)
then it brings down cache and non-IRAM interrupts disable duration to ~1msec.

Fix here keeps defaults same but provides configuration option to tweak the
setting based on application requirement.
2020-06-05 14:45:41 +05:30
Ivan Grokhotkov 03bb2774d9 spi_flash: don't call vTaskDelay in non-os context
Fixes regression in core dump, when a crash happens in interrupt
context.
2020-06-02 15:42:24 +02:00
KonstantinKondrashov bc50bd2806 spi_flash(new driver): Add a Kconfig option - Bypass a block erase and always do sector erase
Closes: IDF-1561
2020-04-30 13:58:13 +08:00
KonstantinKondrashov ae89f98d59 spi_flash(new driver): Add vTaskDelay while a long erasing 2020-04-30 13:58:13 +08:00
michael fdf983e0c4 spi: fix config break and reduce overhead of the bus lock on SPI1
The SPI bus lock on SPI1 introduces two side effects:

1. The device lock for the main flash requires the
`CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION` to be selected, however this
option is disabled by default in earlier IDF versions. Some developers
may find their project cannot be built by their old sdkconfig files.

2. Usually we don't need the lock on the SPI1 bus, due to it's
restrictions. However the overhead still exists in this case, the IRAM
cost for static version of semaphore functions, and the time cost when
getting and releasing the lock.

This commit:

1. Add a CONFIG_SPI_FLASH_BYPASS_MAIN_LOCK option, which will forbid the
space cost, as well as the initialization of the main bus lock.

2. When the option is not selected, the bus lock is used, the
`CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION` will be selected explicitly.

3. Revert default value of `CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION`
to `n`.

introduced in 49a48644e4.

Closes https://github.com/espressif/esp-idf/issues/5046
2020-04-22 16:06:13 +08:00
Angus Gratton 95f7b1985b spi_flash: Remove 16KB free internal heap limit for esp_flash_read() into PSRAM
Allocation of the temporary internal buffer will now repeat until a small enough buffer can be
allocated, and only fail if less than a 256 byte block of internal RAM is free.

Adds unit test for the same, and generic test utility for creating memory pressure.
2020-03-03 00:17:27 +00:00
Angus Gratton fb340940d3 spi_flash: Fix over-allocation and OOM crash when reading from SPI flash to PSRAM buffers
Previously would try allocate buffer of minimum size 16KB not maximum size 16KB, causing
out of memory errors for any large reads, or if less than 16KB contiguous free heap.

Also, if using legacy API and internal allocation failed then implementation would abort()
instead of returning the error to the caller.

Added test for using large buffers in PSRAM.

Closes https://github.com/espressif/esp-idf/issues/4769

Also reported on forum: https://esp32.com/viewtopic.php?f=13&t=14304&p=55972
2020-03-03 00:17:27 +00:00
Michael (XIAO Xufeng) eb104aa16f esp_flash: fix the quad issue for some GD flash chips
The GD flash with product ID 40H, is already used in Wrover-nosufix modules.
2019-10-14 17:25:59 +08:00
Michael (XIAO Xufeng) 571864e8ae esp_flash: fix set qe bit and write command issues
There used to be dummy phase before out phase in common command
transactions. This corrupts the data.

The code before never actually operate (clear) the QE bit, once it finds
the QE bit is set. It's hard to check whether the QE set/disable
functions work well.

This commit:

1. Cancel the dummy phase

2. Set and clear the QE bit according to chip settings, allowing tests
   for QE bits. However for some chips (Winbond for example), it's not
   forced to clear the QE bit if not able to.

3. Also refactor to allow chip_generic and other chips to share the same
   code to read and write qe bit; let common command and read command share
   configure_host_io_mode.

4. Rename read mode to io mode since maybe we will write data with quad
   mode one day.
2019-10-14 17:25:58 +08:00
michael 70d771eb2d esp_flash: put adapter to legacy functions into IRAM to be back-compatible 2019-09-18 15:07:47 +08:00
Michael (XIAO Xufeng) 511820820e esp_flash: fix the coredump issue
During coredump, dangerous-area-checking should be disabled, and cache
disabling should be replaced by a safer version.

Dangerous-area-checking used to be in the HAL, but it seems to be more
fit to os functions. So it's moved to os functions. Interfaces are
provided to switch between os functions during coredump.
2019-09-14 17:01:36 +08:00
Michael (XIAO Xufeng) 6139864a4c esp_flash: fix coredump for legacy spi flash API
When legacy mode is used, the coredump still fails during linking
because "esp_flash_init_default_chip", "esp_flash_app_init" and
"esp_flash_default_chip " are not compiled and linked.

Instead of using ``if`` macros in callers, these functions are protected
by ``if`` macros in the header, and also not compiled in the sources.
"esp_flash_default_chip" variable is compiled with safe default value.
2019-09-14 16:56:31 +08:00
Michael (XIAO Xufeng) d008c47dac esp_flash: add support for encrypted read and write
Using legacy implementation.
2019-09-12 12:41:50 +08:00
Ivan Grokhotkov 12c9d9a564 spi_flash: remove duplicate definition of spi_flash_unlock
The other (static) definition is in flash_ops.c, all references are
also in flash_ops.c.
2019-08-23 12:37:55 +08:00
Michael (XIAO Xufeng) e5704ab1a8 esp_flash: fix the set/get write protection functions
Add support for get write protection support, fixed the duplicated
set_write_protection link.

All the write_protection check in the top layer are removed. The lower
levels (chip) should ensure to disable write protection before the
operation start.
2019-08-08 23:18:00 +08:00
Anton Maklakov afbaf74007 tools: Mass fixing of empty prototypes (for -Wstrict-prototypes) 2019-08-01 16:28:56 +07:00
Ivan Grokhotkov ec427a5b43 spi_flash: support for partitions in external flash 2019-07-02 10:26:06 +02:00
Michael (XIAO Xufeng) d6bd24ca67 esp_flash: add initialization interface for SPI devices 2019-06-27 13:27:27 +08:00
Michael (XIAO Xufeng) 37cb673cd7 esp_flash: update the document to the latest API 2019-06-20 11:50:23 +08:00
Ivan Grokhotkov 026533cd72 esp_flash: fix C++ compilation and some typos 2019-06-20 10:55:13 +08:00
Michael (XIAO Xufeng) 1036a091fe spi_flash: support working on differnt buses and frequency 2019-06-18 06:32:52 +00:00