Browse Source

Merge branch 'feat/sdspi_esp32p4' into 'master'

sdspi: supported sdspi on esp32p4

Closes IDF-7501

See merge request espressif/esp-idf!26458
Armando (Dou Yiwen) 2 years ago
parent
commit
1bce665e73

+ 13 - 0
components/driver/spi/gpspi/spi_master.c

@@ -1147,6 +1147,19 @@ esp_err_t SPI_MASTER_ISR_ATTR spi_device_polling_end(spi_device_handle_t handle,
         }
     }
 
+#if SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE   //invalidate here to let user access rx data in post_cb if possible
+    const spi_bus_attr_t *bus_attr = host->bus_attr;
+    if (host->cur_trans_buf.buffer_to_rcv) {
+        uint16_t alignment = bus_attr->internal_mem_align_size;
+        uint32_t buffer_byte_len = (host->cur_trans_buf.trans->rxlength + 7) / 8;
+        buffer_byte_len = (buffer_byte_len + alignment - 1) & (~(alignment - 1));
+        esp_err_t ret = esp_cache_msync((void *)host->cur_trans_buf.buffer_to_rcv, buffer_byte_len, ESP_CACHE_MSYNC_FLAG_DIR_M2C);
+        if (ret != ESP_OK) {
+            return ret;
+        }
+    }
+#endif
+
     ESP_LOGV(SPI_TAG, "polling trans done");
     //deal with the in-flight transaction
     spi_post_trans(host);

+ 0 - 2
docs/docs_not_updated/esp32p4.txt

@@ -78,7 +78,6 @@ api-reference/storage/mass_mfg.rst
 api-reference/storage/fatfsgen.rst
 api-reference/storage/index.rst
 api-reference/storage/nvs_partition_parse.rst
-api-reference/peripherals/sdspi_share.rst
 api-reference/peripherals/gpio/esp32p4.inc
 api-reference/peripherals/adc_continuous.rst
 api-reference/peripherals/adc_oneshot.rst
@@ -90,7 +89,6 @@ api-reference/peripherals/usb_host/usb_host_notes_dwc_otg.rst
 api-reference/peripherals/usb_host/usb_host_notes_design.rst
 api-reference/peripherals/usb_device.rst
 api-reference/peripherals/gpio.rst
-api-reference/peripherals/sdspi_host.rst
 api-reference/peripherals/dac.rst
 api-reference/peripherals/spi_slave.rst
 api-reference/peripherals/touch_element.rst

+ 2 - 4
examples/storage/.build-test-rules.yml

@@ -131,11 +131,9 @@ examples/storage/sd_card/sdmmc:
 
 examples/storage/sd_card/sdspi:
   disable:
-    - if: IDF_TARGET in ["esp32h2", "esp32p4"]
-      temporary: true
-      reason: Not supported
+    - if: SOC_GPSPI_SUPPORTED != 1
   disable_test:
-    - if: IDF_TARGET in ["esp32s3", "esp32c2", "esp32c6"]
+    - if: IDF_TARGET in ["esp32s3", "esp32c2", "esp32c6", "esp32h2", "esp32p4"]
       temporary: true
       reason: lack of runners
 

+ 2 - 2
examples/storage/sd_card/sdspi/README.md

@@ -1,5 +1,5 @@
-| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-S2 | ESP32-S3 |
-| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- |
+| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
+| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
 
 # SD Card example (SDSPI)
 

+ 4 - 0
examples/storage/sd_card/sdspi/main/Kconfig.projbuild

@@ -13,6 +13,7 @@ menu "SD SPI Example Configuration"
         default 35 if IDF_TARGET_ESP32S2
         default 35 if IDF_TARGET_ESP32S3
         default 5  if IDF_TARGET_ESP32H2
+        default 11 if IDF_TARGET_ESP32P4
         default 4  # C3 and others
 
     config EXAMPLE_PIN_MISO
@@ -21,6 +22,7 @@ menu "SD SPI Example Configuration"
         default 37 if IDF_TARGET_ESP32S2
         default 37 if IDF_TARGET_ESP32S3
         default 0  if IDF_TARGET_ESP32H2
+        default 13 if IDF_TARGET_ESP32P4
         default 6  # C3 and others
 
     config EXAMPLE_PIN_CLK
@@ -29,6 +31,7 @@ menu "SD SPI Example Configuration"
         default 36 if IDF_TARGET_ESP32S2
         default 36 if IDF_TARGET_ESP32S3
         default 4  if IDF_TARGET_ESP32H2
+        default 12 if IDF_TARGET_ESP32P4
         default 5  # C3 and others
 
     config EXAMPLE_PIN_CS
@@ -36,6 +39,7 @@ menu "SD SPI Example Configuration"
         default 13 if IDF_TARGET_ESP32
         default 34 if IDF_TARGET_ESP32S2
         default 34 if IDF_TARGET_ESP32S3
+        default 10 if IDF_TARGET_ESP32P4
         default 1  # C3 and others
 
 endmenu