Skip to content

Commit bd12291

Browse files
donghengqazxiaoxiang781216
authored andcommitted
xtensa/esp32s3: Support octal lines mode SPIRAM
1 parent 31b2f9c commit bd12291

File tree

16 files changed

+1422
-21
lines changed

16 files changed

+1422
-21
lines changed

Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,38 @@ To test it, just run the ``oneshot`` example::
162162
Waiting...
163163
Finished
164164

165+
psram_quad
166+
----------
167+
168+
This config tests the PSRAM driver over SPIRAM interface in quad mode.
169+
You can use the mm command to test the PSRAM memory::
170+
171+
nsh> mm
172+
mallinfo:
173+
Total space allocated from system = 8803232
174+
Number of non-inuse chunks = 2
175+
Largest non-inuse chunk = 8388592
176+
Total allocated space = 9672
177+
Total non-inuse space = 8793560
178+
(0)Allocating 5011 bytes
179+
180+
......
181+
182+
(31)Releasing memory at 0x3fc8c088 (size=24 bytes)
183+
mallinfo:
184+
Total space allocated from system = 8803232
185+
Number of non-inuse chunks = 2
186+
Largest non-inuse chunk = 8388592
187+
Total allocated space = 9672
188+
Total non-inuse space = 8793560
189+
TEST COMPLETE
190+
191+
psram_octal
192+
-----------
193+
194+
Similar to the ```psram_quad``` configuration but using the SPIRAM
195+
interface in octal mode.
196+
165197
pwm
166198
---
167199

arch/xtensa/src/esp32s3/Kconfig

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ config ESP32S3_SPIRAM_SPEED_80M
531531

532532
config ESP32S3_SPIRAM_SPEED_120M
533533
bool "120MHz clock speed"
534+
depends on ESP32S3_SPIRAM_MODE_QUAD
534535

535536
endchoice # ESP32S3_SPIRAM_SPEED
536537

@@ -1017,6 +1018,9 @@ choice ESP32S3_FLASH_MODE
10171018
config ESP32S3_FLASH_MODE_QOUT
10181019
bool "Quad Output (QOUT)"
10191020

1021+
config ESP32S3_FLASH_MODE_OCT
1022+
bool "Octal"
1023+
10201024
endchoice # ESP32S3_FLASH_MODE
10211025

10221026
choice ESP32S3_FLASH_FREQ
@@ -1039,6 +1043,25 @@ choice ESP32S3_FLASH_FREQ
10391043

10401044
endchoice # ESP32S3_FLASH_FREQ
10411045

1046+
config ESP32S3_FLASH_FREQ
1047+
int
1048+
default 120 if ESP32S3_FLASH_FREQ_120M
1049+
default 80 if ESP32S3_FLASH_FREQ_80M
1050+
default 40 if ESP32S3_FLASH_FREQ_40M
1051+
default 20 if ESP32S3_FLASH_FREQ_20M
1052+
1053+
choice ESP32S3_FLASH_SAMPLE_MODE
1054+
prompt "Flash Sampling Mode"
1055+
default ESP32S3_FLASH_SAMPLE_MODE_DTR if ESP32S3_FLASH_MODE_OCT
1056+
default ESP32S3_FLASH_SAMPLE_MODE_STR if !ESP32S3_FLASH_MODE_OCT
1057+
1058+
config ESP32S3_FLASH_SAMPLE_MODE_DTR
1059+
depends on ESP32S3_FLASH_MODE_OCT
1060+
bool "DTR Mode"
1061+
config ESP32S3_FLASH_SAMPLE_MODE_STR
1062+
bool "STR Mode"
1063+
endchoice
1064+
10421065
config ESP32S3_HAVE_OTA_PARTITION
10431066
bool
10441067
default n

arch/xtensa/src/esp32s3/Make.defs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ HEAD_CSRC = esp32s3_start.c
3030
CHIP_CSRCS = esp32s3_irq.c esp32s3_clockconfig.c esp32s3_region.c
3131
CHIP_CSRCS += esp32s3_systemreset.c esp32s3_user.c esp32s3_allocateheap.c
3232
CHIP_CSRCS += esp32s3_wdt.c esp32s3_gpio.c esp32s3_lowputc.c esp32s3_serial.c
33-
CHIP_CSRCS += esp32s3_rtc_gpio.c esp32s3_libc_stubs.c
33+
CHIP_CSRCS += esp32s3_rtc_gpio.c esp32s3_libc_stubs.c esp32s3_spi_timing.c
3434

3535
# Configuration-dependent ESP32-S3 files
3636

@@ -118,7 +118,14 @@ endif
118118

119119
ifeq ($(CONFIG_ESP32S3_SPIRAM),y)
120120
CHIP_CSRCS += esp32s3_spiram.c
121-
CHIP_CSRCS += esp32s3_psram.c
121+
122+
ifeq ($(CONFIG_ESP32S3_SPIRAM_MODE_QUAD),y)
123+
CHIP_CSRCS += esp32s3_psram_quad.c
124+
endif
125+
126+
ifeq ($(CONFIG_ESP32S3_SPIRAM_MODE_OCT),y)
127+
CHIP_CSRCS += esp32s3_psram_octal.c
128+
endif
122129
endif
123130

124131
ifeq ($(CONFIG_ESP32S3_TOUCH),y)

arch/xtensa/src/esp32s3/esp32s3_allocateheap.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838

3939
#include "xtensa.h"
4040
#include "hardware/esp32s3_rom_layout.h"
41+
#ifdef CONFIG_ESP32S3_SPIRAM
42+
# include "esp32s3_spiram.h"
43+
#endif
4144

4245
/****************************************************************************
4346
* Pre-processor Definitions
@@ -154,5 +157,14 @@ void up_allocate_kheap(void **heap_start, size_t *heap_size)
154157
#if CONFIG_MM_REGIONS > 1
155158
void xtensa_add_region(void)
156159
{
160+
#ifdef CONFIG_ESP32S3_SPIRAM
161+
void *start;
162+
size_t size;
163+
164+
start = (void *)esp_spiram_allocable_vaddr_start();
165+
size = (size_t)(esp_spiram_allocable_vaddr_end() -
166+
esp_spiram_allocable_vaddr_start());
167+
umm_addregion(start, size);
168+
#endif
157169
}
158170
#endif

0 commit comments

Comments
 (0)