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