From d451fda4674ab53e382ff7f01e2da20ff27f8932 Mon Sep 17 00:00:00 2001 From: Glauber Maroto Ferreira Date: Thu, 2 Sep 2021 11:18:51 -0300 Subject: [PATCH] wifi: esp32s2: add driver support add support for esp32s2 wifi. Signed-off-by: Glauber Maroto Ferreira --- dts/xtensa/espressif/esp32s2.dtsi | 5 ++++ soc/xtensa/esp32s2/Kconfig.soc | 42 ++++++++++++++++++++++++++++++- soc/xtensa/esp32s2/linker.ld | 22 ++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) diff --git a/dts/xtensa/espressif/esp32s2.dtsi b/dts/xtensa/espressif/esp32s2.dtsi index 64c42bdad66..ca79c01d948 100644 --- a/dts/xtensa/espressif/esp32s2.dtsi +++ b/dts/xtensa/espressif/esp32s2.dtsi @@ -25,6 +25,11 @@ }; }; + wifi: wifi { + compatible = "espressif,esp32-wifi"; + status = "disabled"; + }; + soc { #address-cells = <1>; #size-cells = <1>; diff --git a/soc/xtensa/esp32s2/Kconfig.soc b/soc/xtensa/esp32s2/Kconfig.soc index 75b0cb2a0f7..4ce2da2e5b0 100644 --- a/soc/xtensa/esp32s2/Kconfig.soc +++ b/soc/xtensa/esp32s2/Kconfig.soc @@ -69,4 +69,44 @@ config ESP32S2_DATA_CACHE_SIZE default 0x2000 if ESP32S2_DATA_CACHE_8KB default 0x4000 if ESP32S2_DATA_CACHE_16KB -endif +choice ESP32S2_UNIVERSAL_MAC_ADDRESSES + bool "Number of universally administered (by IEEE) MAC address" + default ESP32S2_UNIVERSAL_MAC_ADDRESSES_TWO + help + Configure the number of universally administered (by IEEE) MAC addresses. + During initialization, MAC addresses for each network interface are generated or + derived from a single base MAC address. If the number of universal MAC addresses is two, + all interfaces (WiFi station, WiFi softap) receive a universally administered MAC + address. + They are generated sequentially by adding 0, and 1 (respectively) to the final octet of + the base MAC address. If the number of universal MAC addresses is one, only WiFi station + receives a universally administered MAC address. + The WiFi softap receives local MAC addresses. It's derived from the universal WiFi + station MAC addresses. + When using the default (Espressif-assigned) base MAC address, either setting can be used. + When using a custom universal MAC address range, the correct setting will depend on the + allocation of MAC addresses in this range (either 1 or 2 per device). + + config ESP32S2_UNIVERSAL_MAC_ADDRESSES_ONE + bool "Two" + select ESP_MAC_ADDR_UNIVERSE_WIFI_STA + + config ESP32S2_UNIVERSAL_MAC_ADDRESSES_TWO + bool "Two" + select ESP_MAC_ADDR_UNIVERSE_WIFI_STA + select ESP_MAC_ADDR_UNIVERSE_WIFI_AP + +endchoice + +config ESP_MAC_ADDR_UNIVERSE_WIFI_AP + bool + +config ESP_MAC_ADDR_UNIVERSE_WIFI_STA + bool + +config ESP32S2_UNIVERSAL_MAC_ADDRESSES + int + default 1 if ESP32S2_UNIVERSAL_MAC_ADDRESSES_ONE + default 2 if ESP32S2_UNIVERSAL_MAC_ADDRESSES_TWO + +endif # SOC_ESP32S2 diff --git a/soc/xtensa/esp32s2/linker.ld b/soc/xtensa/esp32s2/linker.ld index d481644655e..c4ac4e83a94 100644 --- a/soc/xtensa/esp32s2/linker.ld +++ b/soc/xtensa/esp32s2/linker.ld @@ -323,6 +323,17 @@ __shell_root_cmds_end = __esp_shell_root_cmds_end; *libzephyr.a:log_backend_uart.*(.literal .text .literal.* .text.*) *liblib__libc__minimal.a:string.*(.literal .text .literal.* .text.*) *libgcov.a:(.literal .text .literal.* .text.*) + +#if defined(CONFIG_ESP32_WIFI_IRAM_OPT) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) +#endif + +#if defined(CONFIG_ESP32_WIFI_RX_IRAM_OPT) + *libnet80211.a:( .wifirxiram .wifirxiram.* .wifislprxiram .wifislprxiram.*) + *libpp.a:( .wifirxiram .wifirxiram.* .wifislprxiram .wifislprxiram.*) +#endif + _iram_text_end = ABSOLUTE(.); . = ALIGN(4); _iram_end = ABSOLUTE(.); @@ -332,6 +343,17 @@ __shell_root_cmds_end = __esp_shell_root_cmds_end; { _stext = .; _text_start = ABSOLUTE(.); + +#if !defined(CONFIG_ESP32_WIFI_IRAM_OPT) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) +#endif + +#if !defined(CONFIG_ESP32_WIFI_RX_IRAM_OPT) + *libnet80211.a:( .wifirxiram .wifirxiram.* .wifislprxiram .wifislprxiram.*) + *libpp.a:( .wifirxiram .wifirxiram.* .wifislprxiram .wifislprxiram.*) +#endif + *(.literal .text .literal.* .text.*) _text_end = ABSOLUTE(.); _etext = .;