79#define VIRT_TO_B44(addr) ( virt_to_bus(addr) + SB_PCI_DMA )
134 for (i = 0; i <
timeout; i++) {
179 u32 bar_orig, pci_rev,
val;
269 bp->tx_dirty =
bp->tx_cur = 0;
316 DBG(
"b44: powering down PHY\n");
338#define CTRL_MASK (DMARX_CTRL_ENABLE | (RX_PKT_OFFSET << DMARX_CTRL_ROSHIFT))
384 rh =
bp->rx_iobuf[idx]->data;
411 if (
bp->rx_iobuf[i] !=
NULL)
416 DBG(
"Refill rx ring failed!!\n");
420 DBG(
"Refill rx ring bad address!!\n");
424 bp->rx_iobuf[i] = iobuf;
458 memset(
bp->rx_iobuf, 0,
sizeof(
bp->rx_iobuf));
491 memset(
bp->tx_iobuf, 0,
sizeof(
bp->tx_iobuf));
601 for (i = 0; i < 128; i += 2)
612 bp->netdev->hw_addr[0] =
eeprom[79];
613 bp->netdev->hw_addr[1] =
eeprom[78];
614 bp->netdev->hw_addr[2] =
eeprom[81];
615 bp->netdev->hw_addr[3] =
eeprom[80];
616 bp->netdev->hw_addr[4] =
eeprom[83];
617 bp->netdev->hw_addr[5] =
eeprom[82];
627 unsigned char zero[6] = { 0, 0, 0, 0, 0, 0 };
637 for (i = 1; i < 64; i++)
700 DBG(
"b44 %s (%04x:%04x) regs=%p MAC=%s\n",
pci->
id->
name,
790 u32 cur =
bp->tx_cur;
794 if (
bp->tx[cur].ctrl) {
795 DBG(
"tx overflow\n");
804 bp->tx_iobuf[cur] = iobuf;
837 for (i =
bp->tx_dirty; i != cur; i =
ring_next(i)) {
860 iob =
bp->rx_iobuf[i];
880 DBG(
"rx error len=%d flags=%04x\n",
len,
923 DBG(
"b44 error istat=0x%08x\n", istat);
949 PCI_ROM(0x14e4, 0x170c,
"BCM4401-B0",
"BCM4401-B0", 0),
950 PCI_ROM(0x14e4, 0x4401,
"BCM4401",
"BCM4401", 0),
951 PCI_ROM(0x14e4, 0x4402,
"BCM4401-B1",
"BCM4401-B1", 0),
#define NULL
NULL pointer (VOID *)
struct arbelprm_rc_send_wqe rc
static unsigned int unsigned long unsigned long arg2
static unsigned int unsigned long unsigned long unsigned long unsigned long arg4
static unsigned int unsigned long arg1
static unsigned int unsigned long unsigned long unsigned long arg3
static unsigned int unsigned long unsigned long unsigned long unsigned long unsigned long arg5
static int b44_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
static int ring_next(int index)
static void b44_free_tx_ring(struct b44_private *bp)
static int b44_phy_write(struct b44_private *bp, int reg, u32 val)
static void b44_process_rx_packets(struct b44_private *bp)
static int b44_init_rx_ring(struct b44_private *bp)
static int b44_wait_bit(struct b44_private *bp, unsigned long reg, u32 bit, unsigned long timeout, const int clear)
Wait until the given bit is set/cleared.
static int b44_probe(struct pci_device *pci)
Probe device.
static void b44_chip_reset(struct b44_private *bp, int reset_kind)
static u32 br32(const struct b44_private *bp, u32 reg)
static int b44_open(struct net_device *netdev)
Open network device.
static void ssb_core_disable(struct b44_private *bp)
static int b44_phy_reset(struct b44_private *bp)
static int b44_init_tx_ring(struct b44_private *bp)
static void bflush(const struct b44_private *bp, u32 reg, u32 timeout)
static void b44_remove(struct pci_device *pci)
Remove device.
static struct pci_device_id b44_nics[]
static void bw32(const struct b44_private *bp, u32 reg, u32 val)
#define VIRT_TO_B44(addr)
static int b44_address_ok(void *address)
Check if card can access address.
static void b44_halt(struct b44_private *bp)
called by b44_poll in the error path
static u32 ssb_get_core_rev(struct b44_private *bp)
static void b44_set_mac_addr(struct b44_private *bp)
static void b44_free_rx_ring(struct b44_private *bp)
static void b44_set_rx_mode(struct net_device *netdev)
static u32 pending_tx_index(struct b44_private *bp)
Ring cells waiting to be processed are between 'tx_cur' and 'pending' indexes in the ring.
static void b44_init_hw(struct b44_private *bp, int reset_kind)
static int b44_phy_read(struct b44_private *bp, int reg, u32 *val)
static void b44_tx_complete(struct b44_private *bp)
Recycles sent TX descriptors and notifies network stack.
static void b44_load_mac_and_phy_addr(struct b44_private *bp)
static void b44_poll(struct net_device *netdev)
Poll for completed and received packets.
static void b44_close(struct net_device *netdev)
Close network device.
static void b44_rx_refill(struct b44_private *bp, u32 pending)
static void b44_populate_rx_descriptor(struct b44_private *bp, u32 idx)
static void b44_cam_write(struct b44_private *bp, unsigned char *data, int index)
static void b44_read_eeprom(struct b44_private *bp, u8 *data)
static struct net_device_operations b44_operations
static void ssb_core_reset(struct b44_private *bp)
static u32 ssb_pci_setup(struct b44_private *bp, u32 cores)
static u32 pending_rx_index(struct b44_private *bp)
Ring cells waiting to be processed are between 'rx_cur' and 'pending' indexes in the ring.
static void b44_irq(struct net_device *netdev, int enable)
Enable or disable interrupts.
static int ssb_is_core_up(struct b44_private *bp)
#define DMARX_STAT_CDMASK
#define B44_CHIP_RESET_PARTIAL
#define CAM_DATA_HI_VALID
#define MDIO_CTRL_MAXF_MASK
#define MDIO_CTRL_PREAMBLE
#define MDIO_DATA_SB_START
#define MAC_CTRL_PHY_PDOWN
#define B44_CHIP_RESET_FULL
#define BCM4400_PCI_CORE_ADDR
#define MDIO_DATA_PMD_SHIFT
#define B44_RX_RING_LEN_BYTES
#define B44_DMA_ALIGNMENT
#define MDIO_DATA_TA_SHIFT
#define B44_FULL_RESET_SKIP_PHY
#define B44_30BIT_DMA_MASK
#define MIB_CTRL_CLR_ON_READ
#define RXCONFIG_ALLMULTI
#define CAM_CTRL_INDEX_SHIFT
#define DMATX_CTRL_ENABLE
#define DMATX_STAT_CDMASK
#define MAC_CTRL_PHY_LEDCTRL
#define B44_PARTIAL_RESET
#define RCV_LAZY_FC_SHIFT
#define MDIO_DATA_RA_SHIFT
#define ENET_CTRL_DISABLE
#define MDIO_DATA_OP_SHIFT
#define B44_TX_RING_LEN_BYTES
#define MAC_CTRL_CRC32_ENAB
uint8_t ctrl
Ring control.
uint32_t addr
Buffer address.
uint8_t data[48]
Additional event data.
uint64_t address
Base address.
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
static struct net_device * netdev
#define DBG(...)
Print a debugging message.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define EINVAL
Invalid argument.
#define ENOMEM
Not enough space.
#define ENOTSUP
Operation not supported.
#define ENOBUFS
No buffer space available.
#define ENODEV
No such device.
#define le16_to_cpu(value)
#define cpu_to_le32(value)
#define cpu_to_le16(value)
static unsigned int unsigned int bit
uint32_t pending
Pending events.
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
void iounmap(volatile const void *io_addr)
Unmap I/O address.
int pci_read_config_dword(struct pci_device *pci, unsigned int where, uint32_t *value)
Read 32-bit dword from PCI configuration space.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
int pci_write_config_dword(struct pci_device *pci, unsigned int where, uint32_t value)
Write 32-bit dword to PCI configuration space.
void * memset(void *dest, int character, size_t len) __nonnull
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
#define iob_put(iobuf, len)
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define iob_reserve(iobuf, len)
#define CTRL_MASK
Control character mask.
void * malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
Dynamic memory allocation.
Media Independent Interface constants.
static unsigned int unsigned int reg
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
void unregister_netdev(struct net_device *netdev)
Unregister network device.
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
int register_netdev(struct net_device *netdev)
Register network device.
Network device management.
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
static void netdev_tx_complete(struct net_device *netdev, struct io_buffer *iobuf)
Complete network transmission.
struct option_descriptor clear[0]
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
#define __pci_driver
Declare a PCI driver.
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
#define PCI_ROM(_vendor, _device, _name, _description, _data)
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
void * data
Start of data.
Network device operations.
A PCI device ID list entry.
uint16_t vendor
PCI vendor ID.
uint16_t device
PCI device ID.
unsigned long membase
Memory base.
struct device dev
Generic device.
struct pci_device_id * id
Driver device ID.
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.