Mike Frysinger | 395bce4 | 2008-02-24 23:58:13 -0500 | [diff] [blame] | 1 | /* |
| 2 | * bfin_mac.h - some defines/structures for the Blackfin on-chip MAC. |
| 3 | * |
| 4 | * Copyright (c) 2005-2008 Analog Device, Inc. |
| 5 | * |
| 6 | * Licensed under the GPL-2 or later. |
| 7 | */ |
| 8 | |
| 9 | #ifndef __BFIN_MAC_H__ |
| 10 | #define __BFIN_MAC_H__ |
| 11 | |
Aubrey Li | 26bf7de | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 12 | #define RECV_BUFSIZE (0x614) |
| 13 | |
Aubrey Li | 26bf7de | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 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 */ |
| 24 | } ADI_DMA_CONFIG_REG; |
| 25 | |
| 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; |
| 33 | /* 16 bytes/struct */ |
| 34 | |
| 35 | typedef struct dma_descriptor { |
| 36 | struct dma_descriptor *NEXT_DESC_PTR; |
| 37 | u32 START_ADDR; |
Mike Frysinger | 6d7d480 | 2009-01-08 11:57:57 -0500 | [diff] [blame] | 38 | union { |
| 39 | u16 CONFIG_DATA; |
| 40 | ADI_DMA_CONFIG_REG CONFIG; |
| 41 | }; |
Aubrey Li | 26bf7de | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 42 | } DMA_DESCRIPTOR; |
| 43 | /* 10 bytes/struct in 12 bytes */ |
| 44 | |
| 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 */ |
| 53 | } ADI_ETHER_BUFFER; |
| 54 | /* 40 bytes/struct in 44 bytes */ |
| 55 | |
Mike Frysinger | 395bce4 | 2008-02-24 23:58:13 -0500 | [diff] [blame] | 56 | static ADI_ETHER_BUFFER *SetupRxBuffer(int no); |
| 57 | static ADI_ETHER_BUFFER *SetupTxBuffer(int no); |
Aubrey Li | 26bf7de | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 58 | |
Mike Frysinger | 395bce4 | 2008-02-24 23:58:13 -0500 | [diff] [blame] | 59 | static int bfin_EMAC_init(struct eth_device *dev, bd_t *bd); |
| 60 | static void bfin_EMAC_halt(struct eth_device *dev); |
Joe Hershberger | 10cbe3b | 2012-05-22 18:36:19 +0000 | [diff] [blame] | 61 | static int bfin_EMAC_send(struct eth_device *dev, void *packet, int length); |
Mike Frysinger | 395bce4 | 2008-02-24 23:58:13 -0500 | [diff] [blame] | 62 | static int bfin_EMAC_recv(struct eth_device *dev); |
Mike Frysinger | 4324dc7 | 2010-04-27 14:15:28 -0400 | [diff] [blame] | 63 | static int bfin_EMAC_setup_addr(struct eth_device *dev); |
Mike Frysinger | 395bce4 | 2008-02-24 23:58:13 -0500 | [diff] [blame] | 64 | |
| 65 | #endif |