]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - drivers/net/bfin_mac.h
Blackfin EMAC driver: add power management interface and change the bf537mac_reset...
[mirror_ubuntu-zesty-kernel.git] / drivers / net / bfin_mac.h
CommitLineData
e190d6b1
BW
1/*
2 * File: drivers/net/bfin_mac.c
3 * Based on:
4 * Maintainer:
5 * Bryan Wu <bryan.wu@analog.com>
6 *
7 * Original author:
8 * Luke Yang <luke.yang@analog.com>
9 *
10 * Created:
11 * Description:
12 *
13 * Modified:
14 * Copyright 2004-2006 Analog Devices Inc.
15 *
16 * Bugs: Enter bugs at http://blackfin.uclinux.org/
17 *
18 * This program is free software ; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation ; either version 2, or (at your option)
21 * any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY ; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program ; see the file COPYING.
30 * If not, write to the Free Software Foundation,
31 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
32 */
33
34/*
35 * PHY REGISTER NAMES
36 */
37#define PHYREG_MODECTL 0x0000
38#define PHYREG_MODESTAT 0x0001
39#define PHYREG_PHYID1 0x0002
40#define PHYREG_PHYID2 0x0003
41#define PHYREG_ANAR 0x0004
42#define PHYREG_ANLPAR 0x0005
43#define PHYREG_ANER 0x0006
44#define PHYREG_NSR 0x0010
45#define PHYREG_LBREMR 0x0011
46#define PHYREG_REC 0x0012
47#define PHYREG_10CFG 0x0013
48#define PHYREG_PHY1_1 0x0014
49#define PHYREG_PHY1_2 0x0015
50#define PHYREG_PHY2 0x0016
51#define PHYREG_TW_1 0x0017
52#define PHYREG_TW_2 0x0018
53#define PHYREG_TEST 0x0019
54
55#define PHY_RESET 0x8000
56#define PHY_ANEG_EN 0x1000
57#define PHY_DUPLEX 0x0100
58#define PHY_SPD_SET 0x2000
59
60#define BFIN_MAC_CSUM_OFFLOAD
61
62struct dma_descriptor {
63 struct dma_descriptor *next_dma_desc;
64 unsigned long start_addr;
65 unsigned short config;
66 unsigned short x_count;
67};
68
69struct status_area_rx {
70#if defined(BFIN_MAC_CSUM_OFFLOAD)
71 unsigned short ip_hdr_csum; /* ip header checksum */
72 /* ip payload(udp or tcp or others) checksum */
73 unsigned short ip_payload_csum;
74#endif
75 unsigned long status_word; /* the frame status word */
76};
77
78struct status_area_tx {
79 unsigned long status_word; /* the frame status word */
80};
81
82/* use two descriptors for a packet */
83struct net_dma_desc_rx {
84 struct net_dma_desc_rx *next;
85 struct sk_buff *skb;
86 struct dma_descriptor desc_a;
87 struct dma_descriptor desc_b;
88 struct status_area_rx status;
89};
90
91/* use two descriptors for a packet */
92struct net_dma_desc_tx {
93 struct net_dma_desc_tx *next;
94 struct sk_buff *skb;
95 struct dma_descriptor desc_a;
96 struct dma_descriptor desc_b;
97 unsigned char packet[1560];
98 struct status_area_tx status;
99};
100
101struct bf537mac_local {
102 /*
103 * these are things that the kernel wants me to keep, so users
104 * can find out semi-useless statistics of how well the card is
105 * performing
106 */
e190d6b1
BW
107 int version;
108
109 int FlowEnabled; /* record if data flow is active */
110 int EtherIntIVG; /* IVG for the ethernet interrupt */
111 int RXIVG; /* IVG for the RX completion */
112 int TXIVG; /* IVG for the TX completion */
113 int PhyAddr; /* PHY address */
114 int OpMode; /* set these bits n the OPMODE regs */
115 int Port10; /* set port speed to 10 Mbit/s */
116 int GenChksums; /* IP checksums to be calculated */
117 int NoRcveLnth; /* dont insert recv length at start of buffer */
118 int StripPads; /* remove trailing pad bytes */
119 int FullDuplex; /* set full duplex mode */
120 int Negotiate; /* enable auto negotiation */
121 int Loopback; /* loopback at the PHY */
122 int Cache; /* Buffers may be cached */
123 int FlowControl; /* flow control active */
124 int CLKIN; /* clock in value in MHZ */
125 unsigned short IntMask; /* interrupt mask */
126 unsigned char Mac[6]; /* MAC address of the board */
127 spinlock_t lock;
128};
129
130extern void get_bf537_ether_addr(char *addr);