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