aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-03-17 21:37:25 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-17 21:37:25 -0400
commit33125df35d7fe7c403a6aa92995916169fd93df2 (patch)
treedab40897b69cfd3df76902928bac10e4847adb03 /Documentation
parentd5d20912d33f13766902a27087323f5c94e831c8 (diff)
parentf7b18249ef15788f7f4bb9c9d4a6016b3efb0500 (diff)
Merge branch 'altera_tse'
Vince Bridgers says: ==================== Altera Triple Speed Ethernet (TSE) Driver This is the version 6 submission for the Altera Triple Speed Ethernet (TSE) driver. All comments received during the version 2, 3, 4, and 5 submissions have been accepted. Please find the change log and a description of the submission below. If you find the submission acceptable, please consider this patch set for inclusion into the Linux kernel. V6: Address comments from V5 review - add call to skb_tx_timestamp in the drivers transmit path - correct use of unsigned int where it was cast to pointer. Use types appropriate for intended and correct use to let the compiler warn us when type usage is incorrect. - use correct semantics for pointer arithmetic in same code path V5: Address comments from V4 review - Add descriptions of statistics to driver documentation. The statstics supported by the driver/controller map to IEEE and RFC statistics, and the names and mappings are described in the user documentation. - Change "unsigned int" to u32 in device structure definitions - Change used of netdev_warn to netif_warn in altera_sgdma.c - Change stat name rx_fifo_drops to ether_drops to match the event actually counted by the hardware. V4: Address comments from V3 review - Change statistics names in ethtool module to follow common use in other ethernet drivers. - remove an unnecessary case in ethtool module - change logging to use netdev_* where possible instead of dev_* - remove logging for OOM errors since those are already logged V3: Address comments from V2 review - Reorder patch submission so that net/ethernet Makefile and Kconfig are committed last, thus not breaking bisect - Use of_get_mac_address instead of of_get_property - Change supplemental and hash configuration bindings to boolean/empty, and more meaningful names - Add check for failure from calls to of_phy_connect and connect_local_phy - Correct code to find mdio child node - Update bindings document - Remove cast to u64 when not necessary - add use of const for statistics strings V2: Address comments from initial RFC review. - The driver files were broken up by major sections of functionality. These include MSGDMA, SGDMA, Misc, and Main. - Add patch for MAINTAINERS file, add the maintainer for this submission - Use 32-bit lower/upper physical address accessor functions so the driver is 64-bit ready. - Use standard bindings where applicable. Especially phy-addr, and change "altr,rx-fifo-depth" to "rx-fifo-depth" and "altr,tx-fifo-depth" to "tx-fifo-depth". - Add use of max-frame-size property - Update bindings documents accordingly - Correct interrupt handler to use budget parameter in the convential way - Use macros consistently to define bit fields across files - Correct include exclusion macro in altera_msgdmahw.h (typo) - Remove use of barriers, these were not necessary since the DMA APIs ensure memory & buffer consistency - Remove use of netif_carrier_off in driver - move probing of phy from the open function to the probe function - use of_get_phy_mode instead of custom function - Use the .data field in the device structure to obtain a pointer to SGDMA or MSGDMA device specific properties and functions. - remove custom function to access devicetree since Altera specific bindings requiring it's use have been deprecated in favor of standard bindings. The Altera TSE is a 10/100/1000 Mbps Ethernet soft IP component that can be configured and synthesized using Quartus, and programmed into Altera FPGAs. Two types of soft DMA IP components are supported by this driver - the Altera SGDMA and the MSGDMA. The MSGDMA DMA component is preferred over the SGDMA, since the SGDMA will be deprecated in favor of the MSGDMA. Software supporting both is provided for customers still using the SGDMA and to demonstrate how multiple types of DMA engines may be supported by the TSE driver in the event customers wish to develop their own custom soft DMA engine for particular applications. The design has been tested on Altera's Cyclone 4, 5, and Cyclone 5 SOC development kits using an ARM A9 processor and an Altera NIOS2 processor. Differences in CPU/DMA coherency management and address alignment are addressed by proper use of driver APIs and semantics. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/devicetree/bindings/net/altera_tse.txt114
-rw-r--r--Documentation/networking/altera_tse.txt263
2 files changed, 377 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/net/altera_tse.txt b/Documentation/devicetree/bindings/net/altera_tse.txt
new file mode 100644
index 000000000000..a706297998e9
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/altera_tse.txt
@@ -0,0 +1,114 @@
1* Altera Triple-Speed Ethernet MAC driver (TSE)
2
3Required properties:
4- compatible: Should be "altr,tse-1.0" for legacy SGDMA based TSE, and should
5 be "altr,tse-msgdma-1.0" for the preferred MSGDMA based TSE.
6 ALTR is supported for legacy device trees, but is deprecated.
7 altr should be used for all new designs.
8- reg: Address and length of the register set for the device. It contains
9 the information of registers in the same order as described by reg-names
10- reg-names: Should contain the reg names
11 "control_port": MAC configuration space region
12 "tx_csr": xDMA Tx dispatcher control and status space region
13 "tx_desc": MSGDMA Tx dispatcher descriptor space region
14 "rx_csr" : xDMA Rx dispatcher control and status space region
15 "rx_desc": MSGDMA Rx dispatcher descriptor space region
16 "rx_resp": MSGDMA Rx dispatcher response space region
17 "s1": SGDMA descriptor memory
18- interrupts: Should contain the TSE interrupts and it's mode.
19- interrupt-names: Should contain the interrupt names
20 "rx_irq": xDMA Rx dispatcher interrupt
21 "tx_irq": xDMA Tx dispatcher interrupt
22- rx-fifo-depth: MAC receive FIFO buffer depth in bytes
23- tx-fifo-depth: MAC transmit FIFO buffer depth in bytes
24- phy-mode: See ethernet.txt in the same directory.
25- phy-handle: See ethernet.txt in the same directory.
26- phy-addr: See ethernet.txt in the same directory. A configuration should
27 include phy-handle or phy-addr.
28- altr,has-supplementary-unicast:
29 If present, TSE supports additional unicast addresses.
30 Otherwise additional unicast addresses are not supported.
31- altr,has-hash-multicast-filter:
32 If present, TSE supports a hash based multicast filter.
33 Otherwise, hash-based multicast filtering is not supported.
34
35- mdio device tree subnode: When the TSE has a phy connected to its local
36 mdio, there must be device tree subnode with the following
37 required properties:
38
39 - compatible: Must be "altr,tse-mdio".
40 - #address-cells: Must be <1>.
41 - #size-cells: Must be <0>.
42
43 For each phy on the mdio bus, there must be a node with the following
44 fields:
45
46 - reg: phy id used to communicate to phy.
47 - device_type: Must be "ethernet-phy".
48
49Optional properties:
50- local-mac-address: See ethernet.txt in the same directory.
51- max-frame-size: See ethernet.txt in the same directory.
52
53Example:
54
55 tse_sub_0_eth_tse_0: ethernet@0x1,00000000 {
56 compatible = "altr,tse-msgdma-1.0";
57 reg = <0x00000001 0x00000000 0x00000400>,
58 <0x00000001 0x00000460 0x00000020>,
59 <0x00000001 0x00000480 0x00000020>,
60 <0x00000001 0x000004A0 0x00000008>,
61 <0x00000001 0x00000400 0x00000020>,
62 <0x00000001 0x00000420 0x00000020>;
63 reg-names = "control_port", "rx_csr", "rx_desc", "rx_resp", "tx_csr", "tx_desc";
64 interrupt-parent = <&hps_0_arm_gic_0>;
65 interrupts = <0 41 4>, <0 40 4>;
66 interrupt-names = "rx_irq", "tx_irq";
67 rx-fifo-depth = <2048>;
68 tx-fifo-depth = <2048>;
69 address-bits = <48>;
70 max-frame-size = <1500>;
71 local-mac-address = [ 00 00 00 00 00 00 ];
72 phy-mode = "gmii";
73 altr,has-supplementary-unicast;
74 altr,has-hash-multicast-filter;
75 phy-handle = <&phy0>;
76 mdio {
77 compatible = "altr,tse-mdio";
78 #address-cells = <1>;
79 #size-cells = <0>;
80 phy0: ethernet-phy@0 {
81 reg = <0x0>;
82 device_type = "ethernet-phy";
83 };
84
85 phy1: ethernet-phy@1 {
86 reg = <0x1>;
87 device_type = "ethernet-phy";
88 };
89
90 };
91 };
92
93 tse_sub_1_eth_tse_0: ethernet@0x1,00001000 {
94 compatible = "altr,tse-msgdma-1.0";
95 reg = <0x00000001 0x00001000 0x00000400>,
96 <0x00000001 0x00001460 0x00000020>,
97 <0x00000001 0x00001480 0x00000020>,
98 <0x00000001 0x000014A0 0x00000008>,
99 <0x00000001 0x00001400 0x00000020>,
100 <0x00000001 0x00001420 0x00000020>;
101 reg-names = "control_port", "rx_csr", "rx_desc", "rx_resp", "tx_csr", "tx_desc";
102 interrupt-parent = <&hps_0_arm_gic_0>;
103 interrupts = <0 43 4>, <0 42 4>;
104 interrupt-names = "rx_irq", "tx_irq";
105 rx-fifo-depth = <2048>;
106 tx-fifo-depth = <2048>;
107 address-bits = <48>;
108 max-frame-size = <1500>;
109 local-mac-address = [ 00 00 00 00 00 00 ];
110 phy-mode = "gmii";
111 altr,has-supplementary-unicast;
112 altr,has-hash-multicast-filter;
113 phy-handle = <&phy1>;
114 };
diff --git a/Documentation/networking/altera_tse.txt b/Documentation/networking/altera_tse.txt
new file mode 100644
index 000000000000..3f24df8c6e65
--- /dev/null
+++ b/Documentation/networking/altera_tse.txt
@@ -0,0 +1,263 @@
1 Altera Triple-Speed Ethernet MAC driver
2
3Copyright (C) 2008-2014 Altera Corporation
4
5This is the driver for the Altera Triple-Speed Ethernet (TSE) controllers
6using the SGDMA and MSGDMA soft DMA IP components. The driver uses the
7platform bus to obtain component resources. The designs used to test this
8driver were built for a Cyclone(R) V SOC FPGA board, a Cyclone(R) V FPGA board,
9and tested with ARM and NIOS processor hosts seperately. The anticipated use
10cases are simple communications between an embedded system and an external peer
11for status and simple configuration of the embedded system.
12
13For more information visit www.altera.com and www.rocketboards.org. Support
14forums for the driver may be found on www.rocketboards.org, and a design used
15to test this driver may be found there as well. Support is also available from
16the maintainer of this driver, found in MAINTAINERS.
17
18The Triple-Speed Ethernet, SGDMA, and MSGDMA components are all soft IP
19components that can be assembled and built into an FPGA using the Altera
20Quartus toolchain. Quartus 13.1 and 14.0 were used to build the design that
21this driver was tested against. The sopc2dts tool is used to create the
22device tree for the driver, and may be found at rocketboards.org.
23
24The driver probe function examines the device tree and determines if the
25Triple-Speed Ethernet instance is using an SGDMA or MSGDMA component. The
26probe function then installs the appropriate set of DMA routines to
27initialize, setup transmits, receives, and interrupt handling primitives for
28the respective configurations.
29
30The SGDMA component is to be deprecated in the near future (over the next 1-2
31years as of this writing in early 2014) in favor of the MSGDMA component.
32SGDMA support is included for existing designs and reference in case a
33developer wishes to support their own soft DMA logic and driver support. Any
34new designs should not use the SGDMA.
35
36The SGDMA supports only a single transmit or receive operation at a time, and
37therefore will not perform as well compared to the MSGDMA soft IP. Please
38visit www.altera.com for known, documented SGDMA errata.
39
40Scatter-gather DMA is not supported by the SGDMA or MSGDMA at this time.
41Scatter-gather DMA will be added to a future maintenance update to this
42driver.
43
44Jumbo frames are not supported at this time.
45
46The driver limits PHY operations to 10/100Mbps, and has not yet been fully
47tested for 1Gbps. This support will be added in a future maintenance update.
48
491) Kernel Configuration
50The kernel configuration option is ALTERA_TSE:
51 Device Drivers ---> Network device support ---> Ethernet driver support --->
52 Altera Triple-Speed Ethernet MAC support (ALTERA_TSE)
53
542) Driver parameters list:
55 debug: message level (0: no output, 16: all);
56 dma_rx_num: Number of descriptors in the RX list (default is 64);
57 dma_tx_num: Number of descriptors in the TX list (default is 64).
58
593) Command line options
60Driver parameters can be also passed in command line by using:
61 altera_tse=dma_rx_num:128,dma_tx_num:512
62
634) Driver information and notes
64
654.1) Transmit process
66When the driver's transmit routine is called by the kernel, it sets up a
67transmit descriptor by calling the underlying DMA transmit routine (SGDMA or
68MSGDMA), and initites a transmit operation. Once the transmit is complete, an
69interrupt is driven by the transmit DMA logic. The driver handles the transmit
70completion in the context of the interrupt handling chain by recycling
71resource required to send and track the requested transmit operation.
72
734.2) Receive process
74The driver will post receive buffers to the receive DMA logic during driver
75intialization. Receive buffers may or may not be queued depending upon the
76underlying DMA logic (MSGDMA is able queue receive buffers, SGDMA is not able
77to queue receive buffers to the SGDMA receive logic). When a packet is
78received, the DMA logic generates an interrupt. The driver handles a receive
79interrupt by obtaining the DMA receive logic status, reaping receive
80completions until no more receive completions are available.
81
824.3) Interrupt Mitigation
83The driver is able to mitigate the number of its DMA interrupts
84using NAPI for receive operations. Interrupt mitigation is not yet supported
85for transmit operations, but will be added in a future maintenance release.
86
874.4) Ethtool support
88Ethtool is supported. Driver statistics and internal errors can be taken using:
89ethtool -S ethX command. It is possible to dump registers etc.
90
914.5) PHY Support
92The driver is compatible with PAL to work with PHY and GPHY devices.
93
944.7) List of source files:
95 o Kconfig
96 o Makefile
97 o altera_tse_main.c: main network device driver
98 o altera_tse_ethtool.c: ethtool support
99 o altera_tse.h: private driver structure and common definitions
100 o altera_msgdma.h: MSGDMA implementation function definitions
101 o altera_sgdma.h: SGDMA implementation function definitions
102 o altera_msgdma.c: MSGDMA implementation
103 o altera_sgdma.c: SGDMA implementation
104 o altera_sgdmahw.h: SGDMA register and descriptor definitions
105 o altera_msgdmahw.h: MSGDMA register and descriptor definitions
106 o altera_utils.c: Driver utility functions
107 o altera_utils.h: Driver utility function definitions
108
1095) Debug Information
110
111The driver exports debug information such as internal statistics,
112debug information, MAC and DMA registers etc.
113
114A user may use the ethtool support to get statistics:
115e.g. using: ethtool -S ethX (that shows the statistics counters)
116or sees the MAC registers: e.g. using: ethtool -d ethX
117
118The developer can also use the "debug" module parameter to get
119further debug information.
120
1216) Statistics Support
122
123The controller and driver support a mix of IEEE standard defined statistics,
124RFC defined statistics, and driver or Altera defined statistics. The four
125specifications containing the standard definitions for these statistics are
126as follows:
127
128 o IEEE 802.3-2012 - IEEE Standard for Ethernet.
129 o RFC 2863 found at http://www.rfc-editor.org/rfc/rfc2863.txt.
130 o RFC 2819 found at http://www.rfc-editor.org/rfc/rfc2819.txt.
131 o Altera Triple Speed Ethernet User Guide, found at http://www.altera.com
132
133The statistics supported by the TSE and the device driver are as follows:
134
135"tx_packets" is equivalent to aFramesTransmittedOK defined in IEEE 802.3-2012,
136Section 5.2.2.1.2. This statistics is the count of frames that are successfully
137transmitted.
138
139"rx_packets" is equivalent to aFramesReceivedOK defined in IEEE 802.3-2012,
140Section 5.2.2.1.5. This statistic is the count of frames that are successfully
141received. This count does not include any error packets such as CRC errors,
142length errors, or alignment errors.
143
144"rx_crc_errors" is equivalent to aFrameCheckSequenceErrors defined in IEEE
145802.3-2012, Section 5.2.2.1.6. This statistic is the count of frames that are
146an integral number of bytes in length and do not pass the CRC test as the frame
147is received.
148
149"rx_align_errors" is equivalent to aAlignmentErrors defined in IEEE 802.3-2012,
150Section 5.2.2.1.7. This statistic is the count of frames that are not an
151integral number of bytes in length and do not pass the CRC test as the frame is
152received.
153
154"tx_bytes" is equivalent to aOctetsTransmittedOK defined in IEEE 802.3-2012,
155Section 5.2.2.1.8. This statistic is the count of data and pad bytes
156successfully transmitted from the interface.
157
158"rx_bytes" is equivalent to aOctetsReceivedOK defined in IEEE 802.3-2012,
159Section 5.2.2.1.14. This statistic is the count of data and pad bytes
160successfully received by the controller.
161
162"tx_pause" is equivalent to aPAUSEMACCtrlFramesTransmitted defined in IEEE
163802.3-2012, Section 30.3.4.2. This statistic is a count of PAUSE frames
164transmitted from the network controller.
165
166"rx_pause" is equivalent to aPAUSEMACCtrlFramesReceived defined in IEEE
167802.3-2012, Section 30.3.4.3. This statistic is a count of PAUSE frames
168received by the network controller.
169
170"rx_errors" is equivalent to ifInErrors defined in RFC 2863. This statistic is
171a count of the number of packets received containing errors that prevented the
172packet from being delivered to a higher level protocol.
173
174"tx_errors" is equivalent to ifOutErrors defined in RFC 2863. This statistic
175is a count of the number of packets that could not be transmitted due to errors.
176
177"rx_unicast" is equivalent to ifInUcastPkts defined in RFC 2863. This
178statistic is a count of the number of packets received that were not addressed
179to the broadcast address or a multicast group.
180
181"rx_multicast" is equivalent to ifInMulticastPkts defined in RFC 2863. This
182statistic is a count of the number of packets received that were addressed to
183a multicast address group.
184
185"rx_broadcast" is equivalent to ifInBroadcastPkts defined in RFC 2863. This
186statistic is a count of the number of packets received that were addressed to
187the broadcast address.
188
189"tx_discards" is equivalent to ifOutDiscards defined in RFC 2863. This
190statistic is the number of outbound packets not transmitted even though an
191error was not detected. An example of a reason this might occur is to free up
192internal buffer space.
193
194"tx_unicast" is equivalent to ifOutUcastPkts defined in RFC 2863. This
195statistic counts the number of packets transmitted that were not addressed to
196a multicast group or broadcast address.
197
198"tx_multicast" is equivalent to ifOutMulticastPkts defined in RFC 2863. This
199statistic counts the number of packets transmitted that were addressed to a
200multicast group.
201
202"tx_broadcast" is equivalent to ifOutBroadcastPkts defined in RFC 2863. This
203statistic counts the number of packets transmitted that were addressed to a
204broadcast address.
205
206"ether_drops" is equivalent to etherStatsDropEvents defined in RFC 2819.
207This statistic counts the number of packets dropped due to lack of internal
208controller resources.
209
210"rx_total_bytes" is equivalent to etherStatsOctets defined in RFC 2819.
211This statistic counts the total number of bytes received by the controller,
212including error and discarded packets.
213
214"rx_total_packets" is equivalent to etherStatsPkts defined in RFC 2819.
215This statistic counts the total number of packets received by the controller,
216including error, discarded, unicast, multicast, and broadcast packets.
217
218"rx_undersize" is equivalent to etherStatsUndersizePkts defined in RFC 2819.
219This statistic counts the number of correctly formed packets received less
220than 64 bytes long.
221
222"rx_oversize" is equivalent to etherStatsOversizePkts defined in RFC 2819.
223This statistic counts the number of correctly formed packets greater than 1518
224bytes long.
225
226"rx_64_bytes" is equivalent to etherStatsPkts64Octets defined in RFC 2819.
227This statistic counts the total number of packets received that were 64 octets
228in length.
229
230"rx_65_127_bytes" is equivalent to etherStatsPkts65to127Octets defined in RFC
2312819. This statistic counts the total number of packets received that were
232between 65 and 127 octets in length inclusive.
233
234"rx_128_255_bytes" is equivalent to etherStatsPkts128to255Octets defined in
235RFC 2819. This statistic is the total number of packets received that were
236between 128 and 255 octets in length inclusive.
237
238"rx_256_511_bytes" is equivalent to etherStatsPkts256to511Octets defined in
239RFC 2819. This statistic is the total number of packets received that were
240between 256 and 511 octets in length inclusive.
241
242"rx_512_1023_bytes" is equivalent to etherStatsPkts512to1023Octets defined in
243RFC 2819. This statistic is the total number of packets received that were
244between 512 and 1023 octets in length inclusive.
245
246"rx_1024_1518_bytes" is equivalent to etherStatsPkts1024to1518Octets define
247in RFC 2819. This statistic is the total number of packets received that were
248between 1024 and 1518 octets in length inclusive.
249
250"rx_gte_1519_bytes" is a statistic defined specific to the behavior of the
251Altera TSE. This statistics counts the number of received good and errored
252frames between the length of 1519 and the maximum frame length configured
253in the frm_length register. See the Altera TSE User Guide for More details.
254
255"rx_jabbers" is equivalent to etherStatsJabbers defined in RFC 2819. This
256statistic is the total number of packets received that were longer than 1518
257octets, and had either a bad CRC with an integral number of octets (CRC Error)
258or a bad CRC with a non-integral number of octets (Alignment Error).
259
260"rx_runts" is equivalent to etherStatsFragments defined in RFC 2819. This
261statistic is the total number of packets received that were less than 64 octets
262in length and had either a bad CRC with an integral number of octets (CRC
263error) or a bad CRC with a non-integral number of octets (Alignment Error).