2 * Copyright (C) 2009 Matthias Kaehlcke <matthias@kaehlcke.net>
4 * Copyright (C) 2004, 2005
5 * Cory T. Tusar, Videon Central, Inc., <ctusar@videon-central.com>
7 * See file CREDITS for list of people who contributed to this
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
33 * #define this to dump device status and queue info during initialization and
36 #undef EP93XX_MAC_DEBUG
39 * Number of descriptor and status entries in our RX queues.
40 * It must be power of 2 !
42 #define NUMRXDESC PKTBUFSRX
45 * Number of descriptor and status entries in our TX queues.
50 * 944 = (1024 - 64) - 16, Fifo size - Minframesize - 16 (Chip FACT)
52 #define TXSTARTMAX 944
55 * Receive descriptor queue entry
57 struct rx_descriptor {
63 * Receive status queue entry
70 #define RX_STATUS_RWE(rx_status) ((rx_status->word1 >> 30) & 0x01)
71 #define RX_STATUS_RFP(rx_status) ((rx_status->word1 >> 31) & 0x01)
72 #define RX_STATUS_FRAME_LEN(rx_status) (rx_status->word2 & 0xFFFF)
75 * Transmit descriptor queue entry
77 struct tx_descriptor {
82 #define TX_DESC_EOF (1 << 31)
85 * Transmit status queue entry
91 #define TX_STATUS_TXWE(tx_status) (((tx_status)->word1 >> 30) & 0x01)
92 #define TX_STATUS_TXFP(tx_status) (((tx_status)->word1 >> 31) & 0x01)
95 * Transmit descriptor queue
97 struct tx_descriptor_queue {
98 struct tx_descriptor *base;
99 struct tx_descriptor *current;
100 struct tx_descriptor *end;
104 * Transmit status queue
106 struct tx_status_queue {
107 struct tx_status *base;
108 volatile struct tx_status *current;
109 struct tx_status *end;
113 * Receive descriptor queue
115 struct rx_descriptor_queue {
116 struct rx_descriptor *base;
117 struct rx_descriptor *current;
118 struct rx_descriptor *end;
122 * Receive status queue
124 struct rx_status_queue {
125 struct rx_status *base;
126 volatile struct rx_status *current;
127 struct rx_status *end;
131 * EP93xx MAC private data structure
134 struct rx_descriptor_queue rx_dq;
135 struct rx_status_queue rx_sq;
136 void *rx_buffer[NUMRXDESC];
138 struct tx_descriptor_queue tx_dq;
139 struct tx_status_queue tx_sq;
141 struct mac_regs *regs;