2 * bfin_mac.h - some defines/structures for the Blackfin on-chip MAC.
4 * Copyright (c) 2005-2008 Analog Device, Inc.
6 * Licensed under the GPL-2 or later.
10 #define __BFIN_MAC_H__
12 #define RECV_BUFSIZE (0x614)
14 typedef struct ADI_DMA_CONFIG_REG
{
15 u16 b_DMA_EN
:1; /* 0 Enabled */
16 u16 b_WNR
:1; /* 1 Direction */
17 u16 b_WDSIZE
:2; /* 2:3 Transfer word size */
18 u16 b_DMA2D
:1; /* 4 DMA mode */
19 u16 b_RESTART
:1; /* 5 Retain FIFO */
20 u16 b_DI_SEL
:1; /* 6 Data interrupt timing select */
21 u16 b_DI_EN
:1; /* 7 Data interrupt enabled */
22 u16 b_NDSIZE
:4; /* 8:11 Flex descriptor size */
23 u16 b_FLOW
:3; /* 12:14Flow */
26 typedef struct adi_ether_frame_buffer
{
27 u16 NoBytes
; /* the no. of following bytes */
28 u8 Dest
[6]; /* destination MAC address */
29 u8 Srce
[6]; /* source MAC address */
30 u16 LTfield
; /* length/type field */
31 u8 Data
[0]; /* payload bytes */
32 } ADI_ETHER_FRAME_BUFFER
;
35 typedef struct dma_descriptor
{
36 struct dma_descriptor
*NEXT_DESC_PTR
;
40 ADI_DMA_CONFIG_REG CONFIG
;
43 /* 10 bytes/struct in 12 bytes */
45 typedef struct adi_ether_buffer
{
46 DMA_DESCRIPTOR Dma
[2]; /* first for the frame, second for the status */
47 ADI_ETHER_FRAME_BUFFER
*FrmData
;/* pointer to data */
48 struct adi_ether_buffer
*pNext
; /* next buffer */
49 struct adi_ether_buffer
*pPrev
; /* prev buffer */
50 u16 IPHdrChksum
; /* the IP header checksum */
51 u16 IPPayloadChksum
; /* the IP header and payload checksum */
52 volatile u32 StatusWord
; /* the frame status word */
54 /* 40 bytes/struct in 44 bytes */
56 static ADI_ETHER_BUFFER
*SetupRxBuffer(int no
);
57 static ADI_ETHER_BUFFER
*SetupTxBuffer(int no
);
59 static int bfin_EMAC_init(struct eth_device
*dev
, bd_t
*bd
);
60 static void bfin_EMAC_halt(struct eth_device
*dev
);
61 static int bfin_EMAC_send(struct eth_device
*dev
, volatile void *packet
, int length
);
62 static int bfin_EMAC_recv(struct eth_device
*dev
);
64 void bfin_EMAC_setup_addr(uchar
*enetaddr
);