Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 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 | |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 34 | #define BFIN_MAC_CSUM_OFFLOAD |
| 35 | |
| 36 | struct dma_descriptor { |
| 37 | struct dma_descriptor *next_dma_desc; |
| 38 | unsigned long start_addr; |
| 39 | unsigned short config; |
| 40 | unsigned short x_count; |
| 41 | }; |
| 42 | |
| 43 | struct status_area_rx { |
| 44 | #if defined(BFIN_MAC_CSUM_OFFLOAD) |
| 45 | unsigned short ip_hdr_csum; /* ip header checksum */ |
| 46 | /* ip payload(udp or tcp or others) checksum */ |
| 47 | unsigned short ip_payload_csum; |
| 48 | #endif |
| 49 | unsigned long status_word; /* the frame status word */ |
| 50 | }; |
| 51 | |
| 52 | struct status_area_tx { |
| 53 | unsigned long status_word; /* the frame status word */ |
| 54 | }; |
| 55 | |
| 56 | /* use two descriptors for a packet */ |
| 57 | struct net_dma_desc_rx { |
| 58 | struct net_dma_desc_rx *next; |
| 59 | struct sk_buff *skb; |
| 60 | struct dma_descriptor desc_a; |
| 61 | struct dma_descriptor desc_b; |
| 62 | struct status_area_rx status; |
| 63 | }; |
| 64 | |
| 65 | /* use two descriptors for a packet */ |
| 66 | struct net_dma_desc_tx { |
| 67 | struct net_dma_desc_tx *next; |
| 68 | struct sk_buff *skb; |
| 69 | struct dma_descriptor desc_a; |
| 70 | struct dma_descriptor desc_b; |
| 71 | unsigned char packet[1560]; |
| 72 | struct status_area_tx status; |
| 73 | }; |
| 74 | |
| 75 | struct bf537mac_local { |
| 76 | /* |
| 77 | * these are things that the kernel wants me to keep, so users |
| 78 | * can find out semi-useless statistics of how well the card is |
| 79 | * performing |
| 80 | */ |
Bryan Wu | 4ae5a3a | 2007-09-19 23:37:36 +0800 | [diff] [blame] | 81 | struct net_device_stats stats; |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 82 | |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 83 | unsigned char Mac[6]; /* MAC address of the board */ |
| 84 | spinlock_t lock; |
Bryan Wu | 4ae5a3a | 2007-09-19 23:37:36 +0800 | [diff] [blame] | 85 | |
| 86 | /* MII and PHY stuffs */ |
| 87 | int old_link; /* used by bf537_adjust_link */ |
| 88 | int old_speed; |
| 89 | int old_duplex; |
| 90 | |
| 91 | struct phy_device *phydev; |
| 92 | struct mii_bus mii_bus; |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 93 | }; |
| 94 | |
| 95 | extern void get_bf537_ether_addr(char *addr); |