Skip to content

Commit 0ef3fb4

Browse files
author
Jiang Jiang Jian
committed
Merge branch 'fix/fix_psram_cross_page_issue_v5.5' into 'release/v5.5'
psram: fixed psram cross page issue on c5 / c61 (v5.5) See merge request espressif/esp-idf!41403
2 parents 92df757 + 17a23d1 commit 0ef3fb4

File tree

4 files changed

+36
-6
lines changed

4 files changed

+36
-6
lines changed

components/esp_psram/device/esp_psram_impl_ap_hex.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,6 @@ static void s_configure_psram_ecc(void)
391391
{
392392
psram_ctrlr_ll_enable_16to18_ecc(PSRAM_CTRLR_LL_MSPI_ID_2, true);
393393
psram_ctrlr_ll_enable_skip_page_corner(PSRAM_CTRLR_LL_MSPI_ID_2, true);
394-
psram_ctrlr_ll_enable_split_trans(PSRAM_CTRLR_LL_MSPI_ID_2, true);
395-
psram_ctrlr_ll_set_page_size(PSRAM_CTRLR_LL_MSPI_ID_2, 2048);
396394
psram_ctrlr_ll_enable_ecc_addr_conversion(PSRAM_CTRLR_LL_MSPI_ID_2, 2048);
397395

398396
/**
@@ -427,6 +425,8 @@ esp_err_t esp_psram_impl_enable(void)
427425
mspi_timing_ll_enable_dqs(true);
428426

429427
s_set_psram_cs_timing();
428+
psram_ctrlr_ll_enable_split_trans(PSRAM_CTRLR_LL_MSPI_ID_2, true);
429+
psram_ctrlr_ll_set_page_size(PSRAM_CTRLR_LL_MSPI_ID_2, 2048);
430430
#if CONFIG_SPIRAM_ECC_ENABLE
431431
s_configure_psram_ecc();
432432
#endif

components/esp_psram/device/esp_psram_impl_ap_quad.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,6 @@ static void s_configure_psram_ecc(void)
234234
{
235235
psram_ctrlr_ll_set_ecc_mode(PSRAM_CTRLR_LL_MSPI_ID_0, PSRAM_LL_ECC_MODE_16TO18);
236236
psram_ctrlr_ll_enable_skip_page_corner(PSRAM_CTRLR_LL_MSPI_ID_0, true);
237-
psram_ctrlr_ll_enable_split_trans(PSRAM_CTRLR_LL_MSPI_ID_0, true);
238-
psram_ctrlr_ll_set_page_size(PSRAM_CTRLR_LL_MSPI_ID_0, PSRAM_QUAD_PAGE_SIZE);
239237
psram_ctrlr_ll_enable_ecc_addr_conversion(PSRAM_CTRLR_LL_MSPI_ID_0, true);
240238

241239
/**
@@ -399,6 +397,15 @@ esp_err_t esp_psram_impl_enable(void)
399397
psram_reset_mode(PSRAM_CTRLR_LL_MSPI_ID_1);
400398
//SPI1: send QPI enable command
401399
psram_enable_qio_mode(PSRAM_CTRLR_LL_MSPI_ID_1);
400+
//MSPI cross page configs
401+
uint32_t page_size = 0;
402+
if (s_psram_size == PSRAM_SIZE_2MB) {
403+
page_size = 512;
404+
} else {
405+
page_size = 1024;
406+
}
407+
psram_ctrlr_ll_enable_split_trans(PSRAM_CTRLR_LL_MSPI_ID_1, true);
408+
psram_ctrlr_ll_set_page_size(PSRAM_CTRLR_LL_MSPI_ID_1, page_size);
402409

403410
#if SOC_SPI_MEM_SUPPORT_TIMING_TUNING
404411
//Do PSRAM timing tuning, we use SPI1 to do the tuning, and set the SPI0 PSRAM timing related registers accordingly

components/esp_psram/device/esp_quad_psram_defs_ap.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ extern "C" {
7878
#define PSRAM_QUAD_CS_SETUP_VAL 1
7979
#define PSRAM_QUAD_CS_ECC_HOLD_TIME_VAL 3
8080

81-
#define PSRAM_QUAD_PAGE_SIZE 512
8281
#define PSRAM_QUAD_ECC_ENABLE_MASK BIT(8)
8382

8483
// QEMU has a simulated 16MB and 32MB Quad SPI PSRAM. Use a fake ID for these.

components/hal/esp32s3/include/hal/psram_ctrlr_ll.h

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -226,6 +226,30 @@ static inline void psram_ctrlr_ll_enable_quad_command(uint32_t mspi_id, bool ena
226226
SPIMEM1.ctrl.fcmd_quad = ena;
227227
}
228228

229+
/**
230+
* @brief Set page size
231+
*
232+
* @param mspi_id mspi_id
233+
* @param size page size
234+
*/
235+
__attribute__((always_inline))
236+
static inline void psram_ctrlr_ll_set_page_size(uint32_t mspi_id, uint32_t size)
237+
{
238+
//for compatibility
239+
}
240+
241+
/**
242+
* @brief Enable splitting transactions
243+
*
244+
* @param mspi_id mspi_id
245+
* @param en enable / disable
246+
*/
247+
__attribute__((always_inline))
248+
static inline void psram_ctrlr_ll_enable_split_trans(uint32_t mspi_id, bool en)
249+
{
250+
//for compatibility
251+
}
252+
229253
#ifdef __cplusplus
230254
}
231255
#endif

0 commit comments

Comments
 (0)