1# Atmel SAM Ethernet (GMAC) driver configuration options
2
3# Copyright (c) 2016 Piotr Mienkowski
4# SPDX-License-Identifier: Apache-2.0
5
6menuconfig ETH_SAM_GMAC
7	bool "Atmel SAM Ethernet driver"
8	default y
9	depends on NET_BUF_FIXED_DATA_SIZE
10	depends on DT_HAS_ATMEL_SAM_GMAC_ENABLED || \
11		   DT_HAS_ATMEL_SAM0_GMAC_ENABLED
12	select NOCACHE_MEMORY if ARCH_HAS_NOCACHE_MEMORY_SUPPORT
13	select MDIO
14	select ETH_DSA_SUPPORT
15	select PINCTRL
16	help
17	  Enable Atmel SAM MCU Family Ethernet driver.
18
19if ETH_SAM_GMAC
20
21# Workaround for not being able to have commas in macro arguments
22DT_ETH_SAM_GMAC_PATH := $(dt_nodelabel_path,gmac)
23
24# Just for readability, to keep the following lines shorter.
25DT_ETH_SAM_GMAC_NQ := $(dt_node_int_prop_int,$(DT_ETH_SAM_GMAC_PATH),num-queues)
26
27config ETH_SAM_GMAC_QUEUES
28	int "Number of active hardware TX and RX queues"
29	default 1
30	range 1 $(DT_ETH_SAM_GMAC_NQ) if SOC_SERIES_SAME70 || \
31						SOC_SERIES_SAMV71 || \
32						SOC_SERIES_SAM4E || \
33						SOC_SERIES_SAME54
34	help
35	  Select the number of hardware queues used by the driver. Packets will be
36	  routed to appropriate queues based on their priority.
37
38config ETH_SAM_GMAC_FORCE_QUEUE
39	bool "Force all traffic to be routed through a specific queue"
40	depends on ETH_SAM_GMAC_QUEUES > 1
41	depends on NET_TC_RX_COUNT < 5
42	help
43	  This option is meant to be used only for debugging. Use it to force all
44	  traffic to be routed through a specific hardware queue. With this enabled
45	  it is easier to verify whether the chosen hardware queue actually works.
46	  This works only if there are four or fewer RX traffic classes enabled, as
47	  the SAM GMAC hardware supports screening up to four traffic classes.
48
49config ETH_SAM_GMAC_FORCED_QUEUE
50	int "Queue to force the packets to"
51	depends on ETH_SAM_GMAC_FORCE_QUEUE
52	default 0
53	range 0 1 if ETH_SAM_GMAC_QUEUES = 2
54	range 0 2 if ETH_SAM_GMAC_QUEUES = 3
55	range 0 3 if ETH_SAM_GMAC_QUEUES = 4
56	range 0 4 if ETH_SAM_GMAC_QUEUES = 5
57	range 0 5 if ETH_SAM_GMAC_QUEUES = 6
58	help
59	  Which queue to force the routing to. This affects both the TX and RX queues
60	  setup.
61
62config ETH_SAM_GMAC_BUF_RX_COUNT
63	int "Network RX buffers preallocated by the SAM ETH driver"
64	default 12
65	help
66	  Number of network buffers that will be permanently allocated by the
67	  Ethernet driver. These buffers are used in receive path. They are
68	  preallocated by the driver and made available to the GMAC module to be
69	  filled in with incoming data. Their number has to be large enough to fit
70	  at least one complete Ethernet frame. SAM ETH driver will always allocate
71	  that amount of buffers for itself thus reducing the NET_BUF_RX_COUNT
72	  which is a total amount of RX data buffers used by the whole networking
73	  stack. One has to ensure that NET_PKT_RX_COUNT is large enough to
74	  fit at least two Ethernet frames: one being received by the GMAC module
75	  and the other being processed by the higher layer networking stack.
76
77config ETH_SAM_GMAC_MAC_I2C_EEPROM
78	bool "Read from an I2C EEPROM"
79	help
80	  Read MAC address from an I2C EEPROM.
81
82if ETH_SAM_GMAC_MAC_I2C_EEPROM
83
84config ETH_SAM_GMAC_MAC_I2C_INT_ADDRESS
85	hex "I2C EEPROM internal address"
86	range 0 0xffffffff
87	help
88	  Internal address of the EEPROM chip where the MAC address is stored.
89	  Chips with 1 to 4 byte internal address size are supported. Address
90	  size has to be configured in a separate Kconfig option.
91
92config ETH_SAM_GMAC_MAC_I2C_INT_ADDRESS_SIZE
93	int "I2C EEPROM internal address size"
94	default 1
95	range 1 4
96	help
97	  Size (in bytes) of the internal EEPROM address.
98
99endif # ETH_SAM_GMAC_MAC_I2C_EEPROM
100
101config PTP_CLOCK_SAM_GMAC
102	bool "SAM GMAC PTP clock driver support"
103	default y
104	depends on PTP_CLOCK
105	help
106	  Enable SAM GMAC PTP Clock support.
107
108endif # ETH_SAM_GMAC
109