78 #define VIRT_TO_B44(addr) ( virt_to_bus(addr) + SB_PCI_DMA ) 133 for (i = 0; i <
timeout; i++) {
178 u32 bar_orig, pci_rev,
val;
268 bp->tx_dirty =
bp->tx_cur = 0;
315 DBG(
"b44: powering down PHY\n");
337 #define CTRL_MASK (DMARX_CTRL_ENABLE | (RX_PKT_OFFSET << DMARX_CTRL_ROSHIFT)) 383 rh =
bp->rx_iobuf[idx]->data;
410 if (
bp->rx_iobuf[i] !=
NULL)
415 DBG(
"Refill rx ring failed!!\n");
419 DBG(
"Refill rx ring bad address!!\n");
423 bp->rx_iobuf[i] = iobuf;
457 memset(
bp->rx_iobuf, 0,
sizeof(
bp->rx_iobuf));
490 memset(
bp->tx_iobuf, 0,
sizeof(
bp->tx_iobuf));
600 for (i = 0; i < 128; i += 2)
611 bp->netdev->hw_addr[0] =
eeprom[79];
612 bp->netdev->hw_addr[1] =
eeprom[78];
613 bp->netdev->hw_addr[2] =
eeprom[81];
614 bp->netdev->hw_addr[3] =
eeprom[80];
615 bp->netdev->hw_addr[4] =
eeprom[83];
616 bp->netdev->hw_addr[5] =
eeprom[82];
626 unsigned char zero[6] = { 0, 0, 0, 0, 0, 0 };
636 for (i = 1; i < 64; i++)
699 DBG(
"b44 %s (%04x:%04x) regs=%p MAC=%s\n",
pci->
id->
name,
789 u32 cur =
bp->tx_cur;
793 if (
bp->tx[cur].ctrl) {
794 DBG(
"tx overflow\n");
803 bp->tx_iobuf[cur] = iobuf;
836 for (i =
bp->tx_dirty; i != cur; i =
ring_next(i)) {
859 iob =
bp->rx_iobuf[i];
879 DBG(
"rx error len=%d flags=%04x\n",
len,
922 DBG(
"b44 error istat=0x%08x\n", istat);
948 PCI_ROM(0x14e4, 0x170c,
"BCM4401-B0",
"BCM4401-B0", 0),
949 PCI_ROM(0x14e4, 0x4401,
"BCM4401",
"BCM4401", 0),
950 PCI_ROM(0x14e4, 0x4402,
"BCM4401-B1",
"BCM4401-B1", 0),
#define EINVAL
Invalid argument.
unsigned long membase
Memory base.
struct arbelprm_rc_send_wqe rc
static void netdev_tx_complete(struct net_device *netdev, struct io_buffer *iobuf)
Complete network transmission.
#define iob_put(iobuf, len)
static void b44_chip_reset(struct b44_private *bp, int reset_kind)
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
static u32 ssb_get_core_rev(struct b44_private *bp)
static void b44_poll(struct net_device *netdev)
Poll for completed and received packets.
static unsigned int unsigned int reg
static unsigned int unsigned long unsigned long unsigned long unsigned long arg4
#define MDIO_DATA_OP_SHIFT
static void b44_read_eeprom(struct b44_private *bp, u8 *data)
int(* open)(struct net_device *netdev)
Open network device.
static void bflush(const struct b44_private *bp, u32 reg, u32 timeout)
#define DMATX_STAT_CDMASK
#define CAM_CTRL_INDEX_SHIFT
#define MDIO_CTRL_PREAMBLE
static struct pci_device_id b44_nics[]
uint16_t readw(volatile uint16_t *io_addr)
Read 16-bit word from memory-mapped device.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
struct pci_device_id * ids
PCI ID table.
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.
uint64_t address
Base address.
#define MDIO_DATA_RA_SHIFT
static void b44_set_mac_addr(struct b44_private *bp)
uint32_t readl(volatile uint32_t *io_addr)
Read 32-bit dword from memory-mapped device.
static void *__malloc malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
static void b44_init_hw(struct b44_private *bp, int reset_kind)
static unsigned int unsigned int bit
static void b44_load_mac_and_phy_addr(struct b44_private *bp)
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
static void bw32(const struct b44_private *bp, u32 reg, u32 val)
struct device dev
Generic device.
#define VIRT_TO_B44(addr)
#define ENOTSUP
Operation not supported.
static unsigned int unsigned long arg1
Dynamic memory allocation.
static int ring_next(int index)
static void b44_process_rx_packets(struct b44_private *bp)
uint32_t pending
Pending events.
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
static void ssb_core_disable(struct b44_private *bp)
static void ssb_core_reset(struct b44_private *bp)
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
#define ENOMEM
Not enough space.
static void b44_set_rx_mode(struct net_device *netdev)
FILE_LICENCE(GPL2_OR_LATER)
#define MAC_CTRL_PHY_PDOWN
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
#define MAC_CTRL_PHY_LEDCTRL
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
int pci_read_config_dword(struct pci_device *pci, unsigned int where, uint32_t *value)
Read 32-bit dword from PCI configuration space.
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.
void * priv
Driver private data.
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
void writel(uint32_t data, volatile uint32_t *io_addr)
Write 32-bit dword to memory-mapped device.
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
#define RXCONFIG_ALLMULTI
static void b44_remove(struct pci_device *pci)
Remove device.
static struct net_device * netdev
#define DMARX_STAT_CDMASK
static void b44_cam_write(struct b44_private *bp, unsigned char *data, int index)
void unregister_netdev(struct net_device *netdev)
Unregister network device.
static int b44_phy_reset(struct b44_private *bp)
static void b44_free_rx_ring(struct b44_private *bp)
#define cpu_to_le32(value)
static int b44_init_tx_ring(struct b44_private *bp)
#define ENET_CTRL_DISABLE
static void b44_tx_complete(struct b44_private *bp)
Recycles sent TX descriptors and notifies network stack.
static u32 br32(const struct b44_private *bp, u32 reg)
static void b44_rx_refill(struct b44_private *bp, u32 pending)
#define B44_TX_RING_LEN_BYTES
int register_netdev(struct net_device *netdev)
Register network device.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
#define BCM4400_PCI_CORE_ADDR
#define ENODEV
No such device.
#define B44_DMA_ALIGNMENT
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
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.
A PCI device ID list entry.
#define le16_to_cpu(value)
#define MDIO_DATA_SB_START
#define B44_PARTIAL_RESET
static void b44_free_tx_ring(struct b44_private *bp)
Network device operations.
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
struct device * dev
Underlying hardware device.
static struct net_device_operations b44_operations
Network device management.
#define B44_CHIP_RESET_FULL
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
uint16_t vendor
PCI vendor ID.
#define iob_reserve(iobuf, len)
uint16_t device
PCI device ID.
struct option_descriptor clear[0]
static int b44_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
#define ENOBUFS
No buffer space available.
Media Independent Interface constants.
static unsigned int unsigned long unsigned long unsigned long unsigned long unsigned long arg5
static int b44_init_rx_ring(struct b44_private *bp)
static void b44_halt(struct b44_private *bp)
called by b44_poll in the error path
void * data
Start of data.
static int b44_phy_read(struct b44_private *bp, int reg, u32 *val)
#define CAM_DATA_HI_VALID
#define MDIO_CTRL_MAXF_MASK
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
static int b44_address_ok(void *address)
Check if card can access address.
struct pci_device_id * id
Driver device ID.
static void b44_close(struct net_device *netdev)
Close network device.
int pci_write_config_dword(struct pci_device *pci, unsigned int where, uint32_t value)
Write 32-bit dword to PCI configuration space.
#define cpu_to_le16(value)
void iounmap(volatile const void *io_addr)
Unmap I/O address.
uint8_t data[48]
Additional event data.
static void b44_populate_rx_descriptor(struct b44_private *bp, u32 idx)
#define MDIO_DATA_PMD_SHIFT
static int b44_phy_write(struct b44_private *bp, int reg, u32 val)
static int b44_open(struct net_device *netdev)
Open network device.
static void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
#define B44_RX_RING_LEN_BYTES
#define MAC_CTRL_CRC32_ENAB
static u32 ssb_pci_setup(struct b44_private *bp, u32 cores)
#define MIB_CTRL_CLR_ON_READ
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
#define B44_30BIT_DMA_MASK
#define DBG(...)
Print a debugging message.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
static unsigned int unsigned long unsigned long arg2
static int b44_probe(struct pci_device *pci)
Probe device.
static unsigned int unsigned long unsigned long unsigned long arg3
#define RCV_LAZY_FC_SHIFT
struct pci_driver b44_driver __pci_driver
#define NULL
NULL pointer (VOID *)
#define PCI_ROM(_vendor, _device, _name, _description, _data)
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 B44_FULL_RESET_SKIP_PHY
#define DMATX_CTRL_ENABLE
#define B44_CHIP_RESET_PARTIAL
void * memset(void *dest, int character, size_t len) __nonnull
#define MDIO_DATA_TA_SHIFT