Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 1 | /* |
Mike Frysinger | 2fb9d6f | 2008-01-30 16:52:24 +0800 | [diff] [blame] | 2 | * Blackfin On-Chip MAC Driver |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 3 | * |
Mike Frysinger | 2fb9d6f | 2008-01-30 16:52:24 +0800 | [diff] [blame] | 4 | * Copyright 2004-2007 Analog Devices Inc. |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 5 | * |
Mike Frysinger | 2fb9d6f | 2008-01-30 16:52:24 +0800 | [diff] [blame] | 6 | * Enter bugs at http://blackfin.uclinux.org/ |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 7 | * |
Mike Frysinger | 2fb9d6f | 2008-01-30 16:52:24 +0800 | [diff] [blame] | 8 | * Licensed under the GPL-2 or later. |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 9 | */ |
| 10 | |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 11 | #define BFIN_MAC_CSUM_OFFLOAD |
| 12 | |
| 13 | struct dma_descriptor { |
| 14 | struct dma_descriptor *next_dma_desc; |
| 15 | unsigned long start_addr; |
| 16 | unsigned short config; |
| 17 | unsigned short x_count; |
| 18 | }; |
| 19 | |
| 20 | struct status_area_rx { |
| 21 | #if defined(BFIN_MAC_CSUM_OFFLOAD) |
| 22 | unsigned short ip_hdr_csum; /* ip header checksum */ |
| 23 | /* ip payload(udp or tcp or others) checksum */ |
| 24 | unsigned short ip_payload_csum; |
| 25 | #endif |
| 26 | unsigned long status_word; /* the frame status word */ |
| 27 | }; |
| 28 | |
| 29 | struct status_area_tx { |
| 30 | unsigned long status_word; /* the frame status word */ |
| 31 | }; |
| 32 | |
| 33 | /* use two descriptors for a packet */ |
| 34 | struct net_dma_desc_rx { |
| 35 | struct net_dma_desc_rx *next; |
| 36 | struct sk_buff *skb; |
| 37 | struct dma_descriptor desc_a; |
| 38 | struct dma_descriptor desc_b; |
| 39 | struct status_area_rx status; |
| 40 | }; |
| 41 | |
| 42 | /* use two descriptors for a packet */ |
| 43 | struct net_dma_desc_tx { |
| 44 | struct net_dma_desc_tx *next; |
| 45 | struct sk_buff *skb; |
| 46 | struct dma_descriptor desc_a; |
| 47 | struct dma_descriptor desc_b; |
| 48 | unsigned char packet[1560]; |
| 49 | struct status_area_tx status; |
| 50 | }; |
| 51 | |
Bryan Wu | 7ef0a7e | 2008-04-25 11:53:10 +0800 | [diff] [blame] | 52 | struct bfin_mac_local { |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 53 | /* |
| 54 | * these are things that the kernel wants me to keep, so users |
| 55 | * can find out semi-useless statistics of how well the card is |
| 56 | * performing |
| 57 | */ |
Bryan Wu | 4ae5a3a | 2007-09-19 23:37:36 +0800 | [diff] [blame] | 58 | struct net_device_stats stats; |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 59 | |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 60 | unsigned char Mac[6]; /* MAC address of the board */ |
| 61 | spinlock_t lock; |
Bryan Wu | 4ae5a3a | 2007-09-19 23:37:36 +0800 | [diff] [blame] | 62 | |
| 63 | /* MII and PHY stuffs */ |
| 64 | int old_link; /* used by bf537_adjust_link */ |
| 65 | int old_speed; |
| 66 | int old_duplex; |
| 67 | |
| 68 | struct phy_device *phydev; |
Lennert Buytenhek | 298cf9b | 2008-10-08 16:29:57 -0700 | [diff] [blame] | 69 | struct mii_bus *mii_bus; |
Bryan Wu | e190d6b | 2007-07-17 14:43:44 +0800 | [diff] [blame] | 70 | }; |
| 71 | |
Mike Frysinger | 9862cc5 | 2007-11-15 21:21:20 +0800 | [diff] [blame] | 72 | extern void bfin_get_ether_addr(char *addr); |