1# STM32 HAL Ethernet driver configuration options
2
3# Copyright (c) 2017 Erwin Rol <erwin@erwinrol.com>
4# Copyright (c) 2020 Alexander Kozhinov <AlexanderKozhinov@yandex.com>
5# SPDX-License-Identifier: Apache-2.0
6
7menuconfig ETH_STM32_HAL
8	bool "STM32 HAL Ethernet driver"
9	default y
10	depends on DT_HAS_ST_STM32_ETHERNET_ENABLED
11	select USE_STM32_HAL_ETH
12	select NOCACHE_MEMORY if SOC_SERIES_STM32H7X && CPU_CORTEX_M7
13	select HWINFO
14	imply CRC
15	help
16	  Enable STM32 HAL based Ethernet driver. It is available for
17	  all Ethernet enabled variants of the F2, F4, F7 and H7 series.
18
19if ETH_STM32_HAL
20
21choice ETH_STM32_HAL_API_VERSION
22	prompt "STM32Cube HAL Ethernet version"
23
24config ETH_STM32_HAL_API_V2
25	bool "Use new HAL driver"
26	depends on SOC_SERIES_STM32H7X || SOC_SERIES_STM32H5X || SOC_SERIES_STM32F4X || SOC_SERIES_STM32F7X
27	help
28	  Use the new HAL driver instead of the legacy one.
29
30config ETH_STM32_HAL_API_V1
31	bool "Use new HAL driver"
32	depends on !SOC_SERIES_STM32H5X
33	select DEPRECATED if SOC_SERIES_STM32H7X || SOC_SERIES_STM32F4X || SOC_SERIES_STM32F7X
34	help
35	  Driver version based on legacy HAL version. Deprecated unless using STM32F2 series.
36
37endchoice
38
39config ETH_STM32_HAL_RX_THREAD_STACK_SIZE
40	int "RX thread stack size"
41	default 1500
42	help
43	  RX thread stack size
44
45config ETH_STM32_HAL_RX_THREAD_PRIO
46	int "RX thread priority"
47	default 2
48	help
49	  RX thread priority
50
51config ETH_STM32_HAL_USE_DTCM_FOR_DMA_BUFFER
52	bool "Use DTCM for DMA buffers"
53	default y
54	depends on SOC_SERIES_STM32F7X
55	help
56	  When this option is activated, the buffers for DMA transfer are
57	  moved from SRAM to the DTCM (Data Tightly Coupled Memory).
58
59config ETH_STM32_HAL_PHY_ADDRESS
60	int "Phy address"
61	default 0
62	help
63	  The phy address to use.
64
65choice
66	prompt "Mac address definition method"
67	optional
68	help
69	  The driver supports 2 methods to define 3 last bytes of MAC address
70	  1. Statically defined by user
71	  2. Generated dynamically at each boot
72
73	  Note: Configuring this methods using Kconfig is now deprecated in favor
74	  of device tree based configuration.
75
76config ETH_STM32_HAL_RANDOM_MAC
77	bool "Random MAC address (DEPRECATED)"
78	depends on ENTROPY_GENERATOR
79	select DEPRECATED
80	help
81	  Generate a random MAC address dynamically.
82	  Deprecated in favor of device tree property "zephyr,random-mac-address"
83
84config ETH_STM32_HAL_USER_STATIC_MAC
85	bool "User defined MAC address (DEPRECATED)"
86	select DEPRECATED
87	help
88	  3 last bytes of MAC address are defined by user thanks to
89	  ETH_STM32_HAL_MAC3, ETH_STM32_HAL_MAC4 and ETH_STM32_HAL_MAC5.
90	  Deprecated in favor of device tree property "local-mac-address"
91
92endchoice
93
94if ETH_STM32_HAL_USER_STATIC_MAC
95
96config ETH_STM32_HAL_MAC3
97	hex "MAC Address Byte 3 (DEPRECATED)"
98	default 0
99	range 0 0xff
100	help
101	  This is the byte 3 of the MAC address.
102
103config ETH_STM32_HAL_MAC4
104	hex "MAC Address Byte 4 (DEPRECATED)"
105	default 0
106	range 0 0xff
107	help
108	  This is the byte 4 of the MAC address.
109
110config ETH_STM32_HAL_MAC5
111	hex "MAC Address Byte 5 (DEPRECATED)"
112	default 0
113	range 0 0xff
114	help
115	  This is the byte 5 of the MAC address.
116
117endif # ETH_STM32_HAL_USER_STATIC_MAC
118
119config ETH_STM32_HAL_MII
120	bool "Use MII interface"
121	help
122	  Use the MII physical interface instead of RMII.
123
124config ETH_STM32_CARRIER_CHECK_RX_IDLE_TIMEOUT_MS
125	int "Carrier check timeout period (ms)"
126	default 500
127	range 100 30000
128	help
129	  Set the RX idle timeout period in milliseconds after which the
130	  PHY's carrier status is re-evaluated.
131
132config ETH_STM32_AUTO_NEGOTIATION_ENABLE
133	bool "Autonegotiation mode"
134	default y
135	help
136	  Enable this if using autonegotiation
137
138config ETH_STM32_HW_CHECKSUM
139	bool "Use TX and RX hardware checksum"
140	depends on (!SOC_SERIES_STM32H7X && !SOC_SERIES_STM32H5X )
141	help
142	  Enable receive and transmit checksum offload to enhance throughput
143	  performances.
144	  See reference manual for more information on this feature.
145
146if !ETH_STM32_AUTO_NEGOTIATION_ENABLE
147
148config ETH_STM32_SPEED_10M
149	bool "Set speed to 10 Mbps when autonegotiation is disabled"
150	help
151	  Set this if using 10 Mbps and when autonegotiation is disabled, otherwise speed
152	  is 100 Mbps
153
154config ETH_STM32_MODE_HALFDUPLEX
155	bool "Half duplex mode"
156	help
157	  Set this if using half duplex when autonegotiation is disabled otherwise
158	  duplex mode is full duplex
159
160endif # !ETH_STM32_AUTO_NEGOTIATION_ENABLE
161
162if SOC_SERIES_STM32F7X || SOC_SERIES_STM32H7X || SOC_SERIES_STM32H5X
163
164config PTP_CLOCK_STM32_HAL
165	bool "STM32 HAL PTP clock driver support"
166	default y
167	depends on PTP_CLOCK || NET_L2_PTP
168	help
169	  Enable STM32 PTP clock support.
170
171config ETH_STM32_HAL_PTP_CLOCK_SRC_HZ
172	int "Frequency of the clock source for the PTP timer"
173	default 50000000
174	depends on PTP_CLOCK_STM32_HAL
175	help
176	  Set the frequency in Hz sourced to the PTP timer.
177	  If the value is set properly, the timer will be accurate.
178
179config ETH_STM32_HAL_PTP_CLOCK_ADJ_MIN_PCT
180	int "Lower bound of clock frequency adjustment (in percent)"
181	default 90
182	depends on PTP_CLOCK_STM32_HAL
183	help
184	  Specifies lower bound of PTP clock rate adjustment.
185
186config ETH_STM32_HAL_PTP_CLOCK_ADJ_MAX_PCT
187	int "Upper bound of clock frequency adjustment (in percent)"
188	default 110
189	depends on PTP_CLOCK_STM32_HAL
190	help
191	  Specifies upper bound of PTP clock rate adjustment.
192
193config ETH_STM32_HAL_PTP_CLOCK_INIT_PRIO
194	int
195	default 85
196	depends on PTP_CLOCK_STM32_HAL
197	help
198	  STM32 PTP Clock initialization priority level. There is
199	  a dependency from the network stack that this device
200	  initializes before network stack (NET_INIT_PRIO).
201
202endif # SOC_SERIES_STM32F7X || SOC_SERIES_STM32H7X || SOC_SERIES_STM32H5X
203
204config ETH_STM32_MULTICAST_FILTER
205	bool "Multicast hash filter support"
206	help
207	  Enable support for multicast hash filtering in the MAC.
208	  Once enabled the ethernet MAC performs imperfect filtering
209	  based on a computed hash of the destination MAC address of
210	  the multicast address. Only multicast with the computed
211	  hash set in the multicast table will be received and all
212	  other multicast is dropped by the MAC. If disabled then all
213	  multicast is received by the MAC.
214
215endif # ETH_STM32_HAL
216