1# Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd.
2# SPDX-License-Identifier: Apache-2.0
3
4config SOC_ESP32C3
5	bool "ESP32C3"
6	select RISCV
7	select RISCV_GP
8	select DYNAMIC_INTERRUPTS
9	select CLOCK_CONTROL
10	select PINCTRL
11	select XIP if !MCUBOOT
12	select HAS_ESPRESSIF_HAL
13	select RISCV_ISA_RV32I
14	select RISCV_ISA_EXT_M
15	select RISCV_ISA_EXT_C
16	select RISCV_ISA_EXT_ZICSR
17
18if SOC_ESP32C3
19
20config SOC_FAMILY_ESP32
21	bool
22	default y
23
24config IDF_TARGET_ESP32C3
25	bool "ESP32C3 as target board"
26	default y
27
28config ESPTOOLPY_FLASHFREQ_80M
29	bool
30	default y
31
32config FLASH_SIZE
33	int
34	default $(dt_node_reg_size_int,/soc/flash-controller@60002000/flash@0,0)
35
36config FLASH_BASE_ADDRESS
37	hex
38	default $(dt_node_reg_addr_hex,/soc/flash-controller@60002000/flash@0)
39
40config ESP_SYSTEM_RTC_EXT_XTAL
41	bool
42
43config ESP_SYSTEM_RTC_EXT_OSC
44	bool
45
46choice ESP32C3_RTC_CLK_SRC
47	prompt "RTC clock source"
48	default ESP32C3_RTC_CLK_SRC_INT_RC
49	help
50	  Choose which clock is used as RTC clock source.
51
52config ESP32C3_RTC_CLK_SRC_INT_RC
53	bool "Internal 150kHz RC oscillator"
54
55config ESP32C3_RTC_CLK_SRC_EXT_CRYS
56	bool "External 32kHz crystal"
57	select ESP_SYSTEM_RTC_EXT_XTAL
58
59config ESP32C3_RTC_CLK_SRC_EXT_OSC
60	bool "External 32kHz oscillator at 32K_XP pin"
61	select ESP_SYSTEM_RTC_EXT_OSC
62
63config ESP32C3_RTC_CLK_SRC_INT_8MD256
64	bool "Internal 8MHz oscillator, divided by 256 (~32kHz)"
65
66endchoice
67
68config ESP32C3_RTC_CLK_CAL_CYCLES
69	int "Number of cycles for RTC_SLOW_CLK calibration"
70	default 3000 if ESP32C3_RTC_CLK_SRC_EXT_CRYS || ESP32C3_RTC_CLK_SRC_EXT_OSC || ESP32C3_RTC_CLK_SRC_INT_8MD256
71	default 1024 if ESP32C3_RTC_CLK_SRC_INT_RC
72	range 0 27000 if ESP32C3_RTC_CLK_SRC_EXT_CRYS || ESP32C3_RTC_CLK_SRC_EXT_OSC || ESP32C3_RTC_CLK_SRC_INT_8MD256
73	range 0 32766 if ESP32C3_RTC_CLK_SRC_INT_RC
74	help
75	  When the startup code initializes RTC_SLOW_CLK, it can perform
76	  calibration by comparing the RTC_SLOW_CLK frequency with main XTAL
77	  frequency. This option sets the number of RTC_SLOW_CLK cycles measured
78	  by the calibration routine. Higher numbers increase calibration
79	  precision, which may be important for applications which spend a lot of
80	  time in deep sleep. Lower numbers reduce startup time.
81
82	  When this option is set to 0, clock calibration will not be performed at
83	  startup, and approximate clock frequencies will be assumed:
84
85	  - 150000 Hz if internal RC oscillator is used as clock source. For this use value 1024.
86	  - 32768 Hz if the 32k crystal oscillator is used. For this use value 3000 or more.
87	    In case more value will help improve the definition of the launch of the crystal.
88	    If the crystal could not start, it will be switched to internal RC.
89
90config ESP32_PHY_MAX_WIFI_TX_POWER
91	int "Max WiFi TX power (dBm)"
92	range 10 20
93	default 20
94	help
95	  Set maximum transmit power for WiFi radio. Actual transmit power for high
96	  data rates may be lower than this setting.
97
98config ESP32_PHY_MAX_TX_POWER
99	int
100	default ESP32_PHY_MAX_WIFI_TX_POWER
101
102config MAC_BB_PD
103	bool "Power down MAC and baseband of Wi-Fi and Bluetooth when PHY is disabled"
104	depends on SOC_ESP32C3 && TICKLESS_KERNEL
105	default n
106	help
107	  If enabled, the MAC and baseband of Wi-Fi and Bluetooth will be powered
108	  down when PHY is disabled. Enabling this setting reduces power consumption
109	  by a small amount but increases RAM use by approximately 4 KB(Wi-Fi only),
110	  2 KB(Bluetooth only) or 5.3 KB(Wi-Fi + Bluetooth).
111
112endif
113