Blackfin ethernet driver: on chip ethernet MAC controller driver
This patch implements the driver necessary use the Analog Devices Blackfin processor's on-chip ethernet MAC controller. [try#2] - add timeout control - kill dma_config_reg bitfields - some trivial cleanup [try#3] - add endianess check - add DRV_NAME, DRV_VERSION... driver information string - add some comments for silicon anomaly and dma API confusion - some code trivial cleanup [try#4] - add Blackfin latest GPIO pin mux opertion with Michael Hennerich's help and Dan's review - rewrite the DMA descriptor list operation in a more readable way by Joe's review [try#5] - cleanup some coding style by Joe's review. [try#6] - 1.1 version fix a bug when set up multicast list pointed by Mr. yoshfuji - rearrange the desc_list_free function. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <bryan.wu@analog.com> Cc: Michael Buesch <mb@bu3sch.de> Cc: Mike Frysinger <vapier.adi@gmail.com> Cc: Jeff Garzik <jeff@garzik.org> Cc: Christoph Hellwig <hch@infradead.org> Cc: Dan Williams <dcbw@redhat.com> Cc: Joe Perches <joe@perches.com> Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
parent
308a90683d
commit
e190d6b140
|
@ -732,6 +732,13 @@ L: uclinux-dist-devel@blackfin.uclinux.org (subscribers-only)
|
|||
W: http://blackfin.uclinux.org
|
||||
S: Supported
|
||||
|
||||
BLACKFIN EMAC DRIVER
|
||||
P: Bryan Wu
|
||||
M: bryan.wu@analog.com
|
||||
L: uclinux-dist-devel@blackfin.uclinux.org (subscribers-only)
|
||||
W: http://blackfin.uclinux.org
|
||||
S: Supported
|
||||
|
||||
BLACKFIN RTC DRIVER
|
||||
P: Mike Frysinger
|
||||
M: michael.frysinger@analog.com
|
||||
|
|
|
@ -838,6 +838,50 @@ config ULTRA32
|
|||
<file:Documentation/networking/net-modules.txt>. The module
|
||||
will be called smc-ultra32.
|
||||
|
||||
config BFIN_MAC
|
||||
tristate "Blackfin 536/537 on-chip mac support"
|
||||
depends on NET_ETHERNET && (BF537 || BF536) && (!BF537_PORT_H)
|
||||
select CRC32
|
||||
select BFIN_MAC_USE_L1 if DMA_UNCACHED_NONE
|
||||
help
|
||||
This is the driver for blackfin on-chip mac device. Say Y if you want it
|
||||
compiled into the kernel. This driver is also available as a module
|
||||
( = code which can be inserted in and removed from the running kernel
|
||||
whenever you want). The module will be called bfin_mac.
|
||||
|
||||
config BFIN_MAC_USE_L1
|
||||
bool "Use L1 memory for rx/tx packets"
|
||||
depends on BFIN_MAC && BF537
|
||||
default y
|
||||
help
|
||||
To get maximum network performace, you should use L1 memory as rx/tx buffers.
|
||||
Say N here if you want to reserve L1 memory for other uses.
|
||||
|
||||
config BFIN_TX_DESC_NUM
|
||||
int "Number of transmit buffer packets"
|
||||
depends on BFIN_MAC
|
||||
range 6 10 if BFIN_MAC_USE_L1
|
||||
range 10 100
|
||||
default "10"
|
||||
help
|
||||
Set the number of buffer packets used in driver.
|
||||
|
||||
config BFIN_RX_DESC_NUM
|
||||
int "Number of receive buffer packets"
|
||||
depends on BFIN_MAC
|
||||
range 20 100 if BFIN_MAC_USE_L1
|
||||
range 20 800
|
||||
default "20"
|
||||
help
|
||||
Set the number of buffer packets used in driver.
|
||||
|
||||
config BFIN_MAC_RMII
|
||||
bool "RMII PHY Interface (EXPERIMENTAL)"
|
||||
depends on BFIN_MAC && EXPERIMENTAL
|
||||
default n
|
||||
help
|
||||
Use Reduced PHY MII Interface
|
||||
|
||||
config SMC9194
|
||||
tristate "SMC 9194 support"
|
||||
depends on NET_VENDOR_SMC && (ISA || MAC && BROKEN)
|
||||
|
|
|
@ -200,6 +200,7 @@ obj-$(CONFIG_S2IO) += s2io.o
|
|||
obj-$(CONFIG_MYRI10GE) += myri10ge/
|
||||
obj-$(CONFIG_SMC91X) += smc91x.o
|
||||
obj-$(CONFIG_SMC911X) += smc911x.o
|
||||
obj-$(CONFIG_BFIN_MAC) += bfin_mac.o
|
||||
obj-$(CONFIG_DM9000) += dm9000.o
|
||||
obj-$(CONFIG_FEC_8XX) += fec_8xx/
|
||||
obj-$(CONFIG_PASEMI_MAC) += pasemi_mac.o
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,132 @@
|
|||
/*
|
||||
* File: drivers/net/bfin_mac.c
|
||||
* Based on:
|
||||
* Maintainer:
|
||||
* Bryan Wu <bryan.wu@analog.com>
|
||||
*
|
||||
* Original author:
|
||||
* Luke Yang <luke.yang@analog.com>
|
||||
*
|
||||
* Created:
|
||||
* Description:
|
||||
*
|
||||
* Modified:
|
||||
* Copyright 2004-2006 Analog Devices Inc.
|
||||
*
|
||||
* Bugs: Enter bugs at http://blackfin.uclinux.org/
|
||||
*
|
||||
* This program is free software ; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation ; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program ; see the file COPYING.
|
||||
* If not, write to the Free Software Foundation,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* PHY REGISTER NAMES
|
||||
*/
|
||||
#define PHYREG_MODECTL 0x0000
|
||||
#define PHYREG_MODESTAT 0x0001
|
||||
#define PHYREG_PHYID1 0x0002
|
||||
#define PHYREG_PHYID2 0x0003
|
||||
#define PHYREG_ANAR 0x0004
|
||||
#define PHYREG_ANLPAR 0x0005
|
||||
#define PHYREG_ANER 0x0006
|
||||
#define PHYREG_NSR 0x0010
|
||||
#define PHYREG_LBREMR 0x0011
|
||||
#define PHYREG_REC 0x0012
|
||||
#define PHYREG_10CFG 0x0013
|
||||
#define PHYREG_PHY1_1 0x0014
|
||||
#define PHYREG_PHY1_2 0x0015
|
||||
#define PHYREG_PHY2 0x0016
|
||||
#define PHYREG_TW_1 0x0017
|
||||
#define PHYREG_TW_2 0x0018
|
||||
#define PHYREG_TEST 0x0019
|
||||
|
||||
#define PHY_RESET 0x8000
|
||||
#define PHY_ANEG_EN 0x1000
|
||||
#define PHY_DUPLEX 0x0100
|
||||
#define PHY_SPD_SET 0x2000
|
||||
|
||||
#define BFIN_MAC_CSUM_OFFLOAD
|
||||
|
||||
struct dma_descriptor {
|
||||
struct dma_descriptor *next_dma_desc;
|
||||
unsigned long start_addr;
|
||||
unsigned short config;
|
||||
unsigned short x_count;
|
||||
};
|
||||
|
||||
struct status_area_rx {
|
||||
#if defined(BFIN_MAC_CSUM_OFFLOAD)
|
||||
unsigned short ip_hdr_csum; /* ip header checksum */
|
||||
/* ip payload(udp or tcp or others) checksum */
|
||||
unsigned short ip_payload_csum;
|
||||
#endif
|
||||
unsigned long status_word; /* the frame status word */
|
||||
};
|
||||
|
||||
struct status_area_tx {
|
||||
unsigned long status_word; /* the frame status word */
|
||||
};
|
||||
|
||||
/* use two descriptors for a packet */
|
||||
struct net_dma_desc_rx {
|
||||
struct net_dma_desc_rx *next;
|
||||
struct sk_buff *skb;
|
||||
struct dma_descriptor desc_a;
|
||||
struct dma_descriptor desc_b;
|
||||
struct status_area_rx status;
|
||||
};
|
||||
|
||||
/* use two descriptors for a packet */
|
||||
struct net_dma_desc_tx {
|
||||
struct net_dma_desc_tx *next;
|
||||
struct sk_buff *skb;
|
||||
struct dma_descriptor desc_a;
|
||||
struct dma_descriptor desc_b;
|
||||
unsigned char packet[1560];
|
||||
struct status_area_tx status;
|
||||
};
|
||||
|
||||
struct bf537mac_local {
|
||||
/*
|
||||
* these are things that the kernel wants me to keep, so users
|
||||
* can find out semi-useless statistics of how well the card is
|
||||
* performing
|
||||
*/
|
||||
struct net_device_stats stats;
|
||||
|
||||
int version;
|
||||
|
||||
int FlowEnabled; /* record if data flow is active */
|
||||
int EtherIntIVG; /* IVG for the ethernet interrupt */
|
||||
int RXIVG; /* IVG for the RX completion */
|
||||
int TXIVG; /* IVG for the TX completion */
|
||||
int PhyAddr; /* PHY address */
|
||||
int OpMode; /* set these bits n the OPMODE regs */
|
||||
int Port10; /* set port speed to 10 Mbit/s */
|
||||
int GenChksums; /* IP checksums to be calculated */
|
||||
int NoRcveLnth; /* dont insert recv length at start of buffer */
|
||||
int StripPads; /* remove trailing pad bytes */
|
||||
int FullDuplex; /* set full duplex mode */
|
||||
int Negotiate; /* enable auto negotiation */
|
||||
int Loopback; /* loopback at the PHY */
|
||||
int Cache; /* Buffers may be cached */
|
||||
int FlowControl; /* flow control active */
|
||||
int CLKIN; /* clock in value in MHZ */
|
||||
unsigned short IntMask; /* interrupt mask */
|
||||
unsigned char Mac[6]; /* MAC address of the board */
|
||||
spinlock_t lock;
|
||||
};
|
||||
|
||||
extern void get_bf537_ether_addr(char *addr);
|
Loading…
Reference in New Issue