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_SAMX7X || \
31						SOC_SERIES_SAM4E || \
32						SOC_SERIES_SAME54
33	help
34	  Select the number of hardware queues used by the driver. Packets will be
35	  routed to appropriate queues based on their priority.
36
37config ETH_SAM_GMAC_FORCE_QUEUE
38	bool "Force all traffic to be routed through a specific queue"
39	depends on ETH_SAM_GMAC_QUEUES > 1
40	depends on NET_TC_RX_COUNT < 5
41	help
42	  This option is meant to be used only for debugging. Use it to force all
43	  traffic to be routed through a specific hardware queue. With this enabled
44	  it is easier to verify whether the chosen hardware queue actually works.
45	  This works only if there are four or fewer RX traffic classes enabled, as
46	  the SAM GMAC hardware supports screening up to four traffic classes.
47
48config ETH_SAM_GMAC_FORCED_QUEUE
49	int "Queue to force the packets to"
50	depends on ETH_SAM_GMAC_FORCE_QUEUE
51	default 0
52	range 0 1 if ETH_SAM_GMAC_QUEUES = 2
53	range 0 2 if ETH_SAM_GMAC_QUEUES = 3
54	range 0 3 if ETH_SAM_GMAC_QUEUES = 4
55	range 0 4 if ETH_SAM_GMAC_QUEUES = 5
56	range 0 5 if ETH_SAM_GMAC_QUEUES = 6
57	help
58	  Which queue to force the routing to. This affects both the TX and RX queues
59	  setup.
60
61config ETH_SAM_GMAC_BUF_RX_COUNT
62	int "Network RX buffers preallocated by the SAM ETH driver"
63	default 12
64	help
65	  Number of network buffers that will be permanently allocated by the
66	  Ethernet driver. These buffers are used in receive path. They are
67	  preallocated by the driver and made available to the GMAC module to be
68	  filled in with incoming data. Their number has to be large enough to fit
69	  at least one complete Ethernet frame. SAM ETH driver will always allocate
70	  that amount of buffers for itself thus reducing the NET_BUF_RX_COUNT
71	  which is a total amount of RX data buffers used by the whole networking
72	  stack. One has to ensure that NET_PKT_RX_COUNT is large enough to
73	  fit at least two Ethernet frames: one being received by the GMAC module
74	  and the other being processed by the higher layer networking stack.
75
76config ETH_SAM_GMAC_MAC_I2C_EEPROM
77	bool "Read from an I2C EEPROM"
78	help
79	  Read MAC address from an I2C EEPROM.
80
81if ETH_SAM_GMAC_MAC_I2C_EEPROM
82
83config ETH_SAM_GMAC_MAC_I2C_INT_ADDRESS
84	hex "I2C EEPROM internal address"
85	range 0 0xffffffff
86	help
87	  Internal address of the EEPROM chip where the MAC address is stored.
88	  Chips with 1 to 4 byte internal address size are supported. Address
89	  size has to be configured in a separate Kconfig option.
90
91config ETH_SAM_GMAC_MAC_I2C_INT_ADDRESS_SIZE
92	int "I2C EEPROM internal address size"
93	default 1
94	range 1 4
95	help
96	  Size (in bytes) of the internal EEPROM address.
97
98endif # ETH_SAM_GMAC_MAC_I2C_EEPROM
99
100config PTP_CLOCK_SAM_GMAC
101	bool "SAM GMAC PTP clock driver support"
102	default y
103	depends on PTP_CLOCK
104	help
105	  Enable SAM GMAC PTP Clock support.
106
107endif # ETH_SAM_GMAC
108