18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* $Id: sunhme.h,v 1.33 2001/08/03 06:23:04 davem Exp $ 38c2ecf20Sopenharmony_ci * sunhme.h: Definitions for Sparc HME/BigMac 10/100baseT ethernet driver. 48c2ecf20Sopenharmony_ci * Also known as the "Happy Meal". 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (C) 1996, 1999 David S. Miller (davem@redhat.com) 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#ifndef _SUNHME_H 108c2ecf20Sopenharmony_ci#define _SUNHME_H 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include <linux/pci.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci/* Happy Meal global registers. */ 158c2ecf20Sopenharmony_ci#define GREG_SWRESET 0x000UL /* Software Reset */ 168c2ecf20Sopenharmony_ci#define GREG_CFG 0x004UL /* Config Register */ 178c2ecf20Sopenharmony_ci#define GREG_STAT 0x100UL /* Status */ 188c2ecf20Sopenharmony_ci#define GREG_IMASK 0x104UL /* Interrupt Mask */ 198c2ecf20Sopenharmony_ci#define GREG_REG_SIZE 0x108UL 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci/* Global reset register. */ 228c2ecf20Sopenharmony_ci#define GREG_RESET_ETX 0x01 238c2ecf20Sopenharmony_ci#define GREG_RESET_ERX 0x02 248c2ecf20Sopenharmony_ci#define GREG_RESET_ALL 0x03 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* Global config register. */ 278c2ecf20Sopenharmony_ci#define GREG_CFG_BURSTMSK 0x03 288c2ecf20Sopenharmony_ci#define GREG_CFG_BURST16 0x00 298c2ecf20Sopenharmony_ci#define GREG_CFG_BURST32 0x01 308c2ecf20Sopenharmony_ci#define GREG_CFG_BURST64 0x02 318c2ecf20Sopenharmony_ci#define GREG_CFG_64BIT 0x04 328c2ecf20Sopenharmony_ci#define GREG_CFG_PARITY 0x08 338c2ecf20Sopenharmony_ci#define GREG_CFG_RESV 0x10 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci/* Global status register. */ 368c2ecf20Sopenharmony_ci#define GREG_STAT_GOTFRAME 0x00000001 /* Received a frame */ 378c2ecf20Sopenharmony_ci#define GREG_STAT_RCNTEXP 0x00000002 /* Receive frame counter expired */ 388c2ecf20Sopenharmony_ci#define GREG_STAT_ACNTEXP 0x00000004 /* Align-error counter expired */ 398c2ecf20Sopenharmony_ci#define GREG_STAT_CCNTEXP 0x00000008 /* CRC-error counter expired */ 408c2ecf20Sopenharmony_ci#define GREG_STAT_LCNTEXP 0x00000010 /* Length-error counter expired */ 418c2ecf20Sopenharmony_ci#define GREG_STAT_RFIFOVF 0x00000020 /* Receive FIFO overflow */ 428c2ecf20Sopenharmony_ci#define GREG_STAT_CVCNTEXP 0x00000040 /* Code-violation counter expired */ 438c2ecf20Sopenharmony_ci#define GREG_STAT_STSTERR 0x00000080 /* Test error in XIF for SQE */ 448c2ecf20Sopenharmony_ci#define GREG_STAT_SENTFRAME 0x00000100 /* Transmitted a frame */ 458c2ecf20Sopenharmony_ci#define GREG_STAT_TFIFO_UND 0x00000200 /* Transmit FIFO underrun */ 468c2ecf20Sopenharmony_ci#define GREG_STAT_MAXPKTERR 0x00000400 /* Max-packet size error */ 478c2ecf20Sopenharmony_ci#define GREG_STAT_NCNTEXP 0x00000800 /* Normal-collision counter expired */ 488c2ecf20Sopenharmony_ci#define GREG_STAT_ECNTEXP 0x00001000 /* Excess-collision counter expired */ 498c2ecf20Sopenharmony_ci#define GREG_STAT_LCCNTEXP 0x00002000 /* Late-collision counter expired */ 508c2ecf20Sopenharmony_ci#define GREG_STAT_FCNTEXP 0x00004000 /* First-collision counter expired */ 518c2ecf20Sopenharmony_ci#define GREG_STAT_DTIMEXP 0x00008000 /* Defer-timer expired */ 528c2ecf20Sopenharmony_ci#define GREG_STAT_RXTOHOST 0x00010000 /* Moved from receive-FIFO to host memory */ 538c2ecf20Sopenharmony_ci#define GREG_STAT_NORXD 0x00020000 /* No more receive descriptors */ 548c2ecf20Sopenharmony_ci#define GREG_STAT_RXERR 0x00040000 /* Error during receive dma */ 558c2ecf20Sopenharmony_ci#define GREG_STAT_RXLATERR 0x00080000 /* Late error during receive dma */ 568c2ecf20Sopenharmony_ci#define GREG_STAT_RXPERR 0x00100000 /* Parity error during receive dma */ 578c2ecf20Sopenharmony_ci#define GREG_STAT_RXTERR 0x00200000 /* Tag error during receive dma */ 588c2ecf20Sopenharmony_ci#define GREG_STAT_EOPERR 0x00400000 /* Transmit descriptor did not have EOP set */ 598c2ecf20Sopenharmony_ci#define GREG_STAT_MIFIRQ 0x00800000 /* MIF is signaling an interrupt condition */ 608c2ecf20Sopenharmony_ci#define GREG_STAT_HOSTTOTX 0x01000000 /* Moved from host memory to transmit-FIFO */ 618c2ecf20Sopenharmony_ci#define GREG_STAT_TXALL 0x02000000 /* Transmitted all packets in the tx-fifo */ 628c2ecf20Sopenharmony_ci#define GREG_STAT_TXEACK 0x04000000 /* Error during transmit dma */ 638c2ecf20Sopenharmony_ci#define GREG_STAT_TXLERR 0x08000000 /* Late error during transmit dma */ 648c2ecf20Sopenharmony_ci#define GREG_STAT_TXPERR 0x10000000 /* Parity error during transmit dma */ 658c2ecf20Sopenharmony_ci#define GREG_STAT_TXTERR 0x20000000 /* Tag error during transmit dma */ 668c2ecf20Sopenharmony_ci#define GREG_STAT_SLVERR 0x40000000 /* PIO access got an error */ 678c2ecf20Sopenharmony_ci#define GREG_STAT_SLVPERR 0x80000000 /* PIO access got a parity error */ 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci/* All interesting error conditions. */ 708c2ecf20Sopenharmony_ci#define GREG_STAT_ERRORS 0xfc7efefc 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci/* Global interrupt mask register. */ 738c2ecf20Sopenharmony_ci#define GREG_IMASK_GOTFRAME 0x00000001 /* Received a frame */ 748c2ecf20Sopenharmony_ci#define GREG_IMASK_RCNTEXP 0x00000002 /* Receive frame counter expired */ 758c2ecf20Sopenharmony_ci#define GREG_IMASK_ACNTEXP 0x00000004 /* Align-error counter expired */ 768c2ecf20Sopenharmony_ci#define GREG_IMASK_CCNTEXP 0x00000008 /* CRC-error counter expired */ 778c2ecf20Sopenharmony_ci#define GREG_IMASK_LCNTEXP 0x00000010 /* Length-error counter expired */ 788c2ecf20Sopenharmony_ci#define GREG_IMASK_RFIFOVF 0x00000020 /* Receive FIFO overflow */ 798c2ecf20Sopenharmony_ci#define GREG_IMASK_CVCNTEXP 0x00000040 /* Code-violation counter expired */ 808c2ecf20Sopenharmony_ci#define GREG_IMASK_STSTERR 0x00000080 /* Test error in XIF for SQE */ 818c2ecf20Sopenharmony_ci#define GREG_IMASK_SENTFRAME 0x00000100 /* Transmitted a frame */ 828c2ecf20Sopenharmony_ci#define GREG_IMASK_TFIFO_UND 0x00000200 /* Transmit FIFO underrun */ 838c2ecf20Sopenharmony_ci#define GREG_IMASK_MAXPKTERR 0x00000400 /* Max-packet size error */ 848c2ecf20Sopenharmony_ci#define GREG_IMASK_NCNTEXP 0x00000800 /* Normal-collision counter expired */ 858c2ecf20Sopenharmony_ci#define GREG_IMASK_ECNTEXP 0x00001000 /* Excess-collision counter expired */ 868c2ecf20Sopenharmony_ci#define GREG_IMASK_LCCNTEXP 0x00002000 /* Late-collision counter expired */ 878c2ecf20Sopenharmony_ci#define GREG_IMASK_FCNTEXP 0x00004000 /* First-collision counter expired */ 888c2ecf20Sopenharmony_ci#define GREG_IMASK_DTIMEXP 0x00008000 /* Defer-timer expired */ 898c2ecf20Sopenharmony_ci#define GREG_IMASK_RXTOHOST 0x00010000 /* Moved from receive-FIFO to host memory */ 908c2ecf20Sopenharmony_ci#define GREG_IMASK_NORXD 0x00020000 /* No more receive descriptors */ 918c2ecf20Sopenharmony_ci#define GREG_IMASK_RXERR 0x00040000 /* Error during receive dma */ 928c2ecf20Sopenharmony_ci#define GREG_IMASK_RXLATERR 0x00080000 /* Late error during receive dma */ 938c2ecf20Sopenharmony_ci#define GREG_IMASK_RXPERR 0x00100000 /* Parity error during receive dma */ 948c2ecf20Sopenharmony_ci#define GREG_IMASK_RXTERR 0x00200000 /* Tag error during receive dma */ 958c2ecf20Sopenharmony_ci#define GREG_IMASK_EOPERR 0x00400000 /* Transmit descriptor did not have EOP set */ 968c2ecf20Sopenharmony_ci#define GREG_IMASK_MIFIRQ 0x00800000 /* MIF is signaling an interrupt condition */ 978c2ecf20Sopenharmony_ci#define GREG_IMASK_HOSTTOTX 0x01000000 /* Moved from host memory to transmit-FIFO */ 988c2ecf20Sopenharmony_ci#define GREG_IMASK_TXALL 0x02000000 /* Transmitted all packets in the tx-fifo */ 998c2ecf20Sopenharmony_ci#define GREG_IMASK_TXEACK 0x04000000 /* Error during transmit dma */ 1008c2ecf20Sopenharmony_ci#define GREG_IMASK_TXLERR 0x08000000 /* Late error during transmit dma */ 1018c2ecf20Sopenharmony_ci#define GREG_IMASK_TXPERR 0x10000000 /* Parity error during transmit dma */ 1028c2ecf20Sopenharmony_ci#define GREG_IMASK_TXTERR 0x20000000 /* Tag error during transmit dma */ 1038c2ecf20Sopenharmony_ci#define GREG_IMASK_SLVERR 0x40000000 /* PIO access got an error */ 1048c2ecf20Sopenharmony_ci#define GREG_IMASK_SLVPERR 0x80000000 /* PIO access got a parity error */ 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci/* Happy Meal external transmitter registers. */ 1078c2ecf20Sopenharmony_ci#define ETX_PENDING 0x00UL /* Transmit pending/wakeup register */ 1088c2ecf20Sopenharmony_ci#define ETX_CFG 0x04UL /* Transmit config register */ 1098c2ecf20Sopenharmony_ci#define ETX_RING 0x08UL /* Transmit ring pointer */ 1108c2ecf20Sopenharmony_ci#define ETX_BBASE 0x0cUL /* Transmit buffer base */ 1118c2ecf20Sopenharmony_ci#define ETX_BDISP 0x10UL /* Transmit buffer displacement */ 1128c2ecf20Sopenharmony_ci#define ETX_FIFOWPTR 0x14UL /* FIFO write ptr */ 1138c2ecf20Sopenharmony_ci#define ETX_FIFOSWPTR 0x18UL /* FIFO write ptr (shadow register) */ 1148c2ecf20Sopenharmony_ci#define ETX_FIFORPTR 0x1cUL /* FIFO read ptr */ 1158c2ecf20Sopenharmony_ci#define ETX_FIFOSRPTR 0x20UL /* FIFO read ptr (shadow register) */ 1168c2ecf20Sopenharmony_ci#define ETX_FIFOPCNT 0x24UL /* FIFO packet counter */ 1178c2ecf20Sopenharmony_ci#define ETX_SMACHINE 0x28UL /* Transmitter state machine */ 1188c2ecf20Sopenharmony_ci#define ETX_RSIZE 0x2cUL /* Ring descriptor size */ 1198c2ecf20Sopenharmony_ci#define ETX_BPTR 0x30UL /* Transmit data buffer ptr */ 1208c2ecf20Sopenharmony_ci#define ETX_REG_SIZE 0x34UL 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci/* ETX transmit pending register. */ 1238c2ecf20Sopenharmony_ci#define ETX_TP_DMAWAKEUP 0x00000001 /* Restart transmit dma */ 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci/* ETX config register. */ 1268c2ecf20Sopenharmony_ci#define ETX_CFG_DMAENABLE 0x00000001 /* Enable transmit dma */ 1278c2ecf20Sopenharmony_ci#define ETX_CFG_FIFOTHRESH 0x000003fe /* Transmit FIFO threshold */ 1288c2ecf20Sopenharmony_ci#define ETX_CFG_IRQDAFTER 0x00000400 /* Interrupt after TX-FIFO drained */ 1298c2ecf20Sopenharmony_ci#define ETX_CFG_IRQDBEFORE 0x00000000 /* Interrupt before TX-FIFO drained */ 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci#define ETX_RSIZE_SHIFT 4 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ci/* Happy Meal external receiver registers. */ 1348c2ecf20Sopenharmony_ci#define ERX_CFG 0x00UL /* Receiver config register */ 1358c2ecf20Sopenharmony_ci#define ERX_RING 0x04UL /* Receiver ring ptr */ 1368c2ecf20Sopenharmony_ci#define ERX_BPTR 0x08UL /* Receiver buffer ptr */ 1378c2ecf20Sopenharmony_ci#define ERX_FIFOWPTR 0x0cUL /* FIFO write ptr */ 1388c2ecf20Sopenharmony_ci#define ERX_FIFOSWPTR 0x10UL /* FIFO write ptr (shadow register) */ 1398c2ecf20Sopenharmony_ci#define ERX_FIFORPTR 0x14UL /* FIFO read ptr */ 1408c2ecf20Sopenharmony_ci#define ERX_FIFOSRPTR 0x18UL /* FIFO read ptr (shadow register) */ 1418c2ecf20Sopenharmony_ci#define ERX_SMACHINE 0x1cUL /* Receiver state machine */ 1428c2ecf20Sopenharmony_ci#define ERX_REG_SIZE 0x20UL 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci/* ERX config register. */ 1458c2ecf20Sopenharmony_ci#define ERX_CFG_DMAENABLE 0x00000001 /* Enable receive DMA */ 1468c2ecf20Sopenharmony_ci#define ERX_CFG_RESV1 0x00000006 /* Unused... */ 1478c2ecf20Sopenharmony_ci#define ERX_CFG_BYTEOFFSET 0x00000038 /* Receive first byte offset */ 1488c2ecf20Sopenharmony_ci#define ERX_CFG_RESV2 0x000001c0 /* Unused... */ 1498c2ecf20Sopenharmony_ci#define ERX_CFG_SIZE32 0x00000000 /* Receive ring size == 32 */ 1508c2ecf20Sopenharmony_ci#define ERX_CFG_SIZE64 0x00000200 /* Receive ring size == 64 */ 1518c2ecf20Sopenharmony_ci#define ERX_CFG_SIZE128 0x00000400 /* Receive ring size == 128 */ 1528c2ecf20Sopenharmony_ci#define ERX_CFG_SIZE256 0x00000600 /* Receive ring size == 256 */ 1538c2ecf20Sopenharmony_ci#define ERX_CFG_RESV3 0x0000f800 /* Unused... */ 1548c2ecf20Sopenharmony_ci#define ERX_CFG_CSUMSTART 0x007f0000 /* Offset of checksum start, 1558c2ecf20Sopenharmony_ci * in halfwords. */ 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci/* I'd like a Big Mac, small fries, small coke, and SparcLinux please. */ 1588c2ecf20Sopenharmony_ci#define BMAC_XIFCFG 0x0000UL /* XIF config register */ 1598c2ecf20Sopenharmony_ci /* 0x4-->0x204, reserved */ 1608c2ecf20Sopenharmony_ci#define BMAC_TXSWRESET 0x208UL /* Transmitter software reset */ 1618c2ecf20Sopenharmony_ci#define BMAC_TXCFG 0x20cUL /* Transmitter config register */ 1628c2ecf20Sopenharmony_ci#define BMAC_IGAP1 0x210UL /* Inter-packet gap 1 */ 1638c2ecf20Sopenharmony_ci#define BMAC_IGAP2 0x214UL /* Inter-packet gap 2 */ 1648c2ecf20Sopenharmony_ci#define BMAC_ALIMIT 0x218UL /* Transmit attempt limit */ 1658c2ecf20Sopenharmony_ci#define BMAC_STIME 0x21cUL /* Transmit slot time */ 1668c2ecf20Sopenharmony_ci#define BMAC_PLEN 0x220UL /* Size of transmit preamble */ 1678c2ecf20Sopenharmony_ci#define BMAC_PPAT 0x224UL /* Pattern for transmit preamble */ 1688c2ecf20Sopenharmony_ci#define BMAC_TXSDELIM 0x228UL /* Transmit delimiter */ 1698c2ecf20Sopenharmony_ci#define BMAC_JSIZE 0x22cUL /* Jam size */ 1708c2ecf20Sopenharmony_ci#define BMAC_TXMAX 0x230UL /* Transmit max pkt size */ 1718c2ecf20Sopenharmony_ci#define BMAC_TXMIN 0x234UL /* Transmit min pkt size */ 1728c2ecf20Sopenharmony_ci#define BMAC_PATTEMPT 0x238UL /* Count of transmit peak attempts */ 1738c2ecf20Sopenharmony_ci#define BMAC_DTCTR 0x23cUL /* Transmit defer timer */ 1748c2ecf20Sopenharmony_ci#define BMAC_NCCTR 0x240UL /* Transmit normal-collision counter */ 1758c2ecf20Sopenharmony_ci#define BMAC_FCCTR 0x244UL /* Transmit first-collision counter */ 1768c2ecf20Sopenharmony_ci#define BMAC_EXCTR 0x248UL /* Transmit excess-collision counter */ 1778c2ecf20Sopenharmony_ci#define BMAC_LTCTR 0x24cUL /* Transmit late-collision counter */ 1788c2ecf20Sopenharmony_ci#define BMAC_RSEED 0x250UL /* Transmit random number seed */ 1798c2ecf20Sopenharmony_ci#define BMAC_TXSMACHINE 0x254UL /* Transmit state machine */ 1808c2ecf20Sopenharmony_ci /* 0x258-->0x304, reserved */ 1818c2ecf20Sopenharmony_ci#define BMAC_RXSWRESET 0x308UL /* Receiver software reset */ 1828c2ecf20Sopenharmony_ci#define BMAC_RXCFG 0x30cUL /* Receiver config register */ 1838c2ecf20Sopenharmony_ci#define BMAC_RXMAX 0x310UL /* Receive max pkt size */ 1848c2ecf20Sopenharmony_ci#define BMAC_RXMIN 0x314UL /* Receive min pkt size */ 1858c2ecf20Sopenharmony_ci#define BMAC_MACADDR2 0x318UL /* Ether address register 2 */ 1868c2ecf20Sopenharmony_ci#define BMAC_MACADDR1 0x31cUL /* Ether address register 1 */ 1878c2ecf20Sopenharmony_ci#define BMAC_MACADDR0 0x320UL /* Ether address register 0 */ 1888c2ecf20Sopenharmony_ci#define BMAC_FRCTR 0x324UL /* Receive frame receive counter */ 1898c2ecf20Sopenharmony_ci#define BMAC_GLECTR 0x328UL /* Receive giant-length error counter */ 1908c2ecf20Sopenharmony_ci#define BMAC_UNALECTR 0x32cUL /* Receive unaligned error counter */ 1918c2ecf20Sopenharmony_ci#define BMAC_RCRCECTR 0x330UL /* Receive CRC error counter */ 1928c2ecf20Sopenharmony_ci#define BMAC_RXSMACHINE 0x334UL /* Receiver state machine */ 1938c2ecf20Sopenharmony_ci#define BMAC_RXCVALID 0x338UL /* Receiver code violation */ 1948c2ecf20Sopenharmony_ci /* 0x33c, reserved */ 1958c2ecf20Sopenharmony_ci#define BMAC_HTABLE3 0x340UL /* Hash table 3 */ 1968c2ecf20Sopenharmony_ci#define BMAC_HTABLE2 0x344UL /* Hash table 2 */ 1978c2ecf20Sopenharmony_ci#define BMAC_HTABLE1 0x348UL /* Hash table 1 */ 1988c2ecf20Sopenharmony_ci#define BMAC_HTABLE0 0x34cUL /* Hash table 0 */ 1998c2ecf20Sopenharmony_ci#define BMAC_AFILTER2 0x350UL /* Address filter 2 */ 2008c2ecf20Sopenharmony_ci#define BMAC_AFILTER1 0x354UL /* Address filter 1 */ 2018c2ecf20Sopenharmony_ci#define BMAC_AFILTER0 0x358UL /* Address filter 0 */ 2028c2ecf20Sopenharmony_ci#define BMAC_AFMASK 0x35cUL /* Address filter mask */ 2038c2ecf20Sopenharmony_ci#define BMAC_REG_SIZE 0x360UL 2048c2ecf20Sopenharmony_ci 2058c2ecf20Sopenharmony_ci/* BigMac XIF config register. */ 2068c2ecf20Sopenharmony_ci#define BIGMAC_XCFG_ODENABLE 0x00000001 /* Output driver enable */ 2078c2ecf20Sopenharmony_ci#define BIGMAC_XCFG_XLBACK 0x00000002 /* Loopback-mode XIF enable */ 2088c2ecf20Sopenharmony_ci#define BIGMAC_XCFG_MLBACK 0x00000004 /* Loopback-mode MII enable */ 2098c2ecf20Sopenharmony_ci#define BIGMAC_XCFG_MIIDISAB 0x00000008 /* MII receive buffer disable */ 2108c2ecf20Sopenharmony_ci#define BIGMAC_XCFG_SQENABLE 0x00000010 /* SQE test enable */ 2118c2ecf20Sopenharmony_ci#define BIGMAC_XCFG_SQETWIN 0x000003e0 /* SQE time window */ 2128c2ecf20Sopenharmony_ci#define BIGMAC_XCFG_LANCE 0x00000010 /* Lance mode enable */ 2138c2ecf20Sopenharmony_ci#define BIGMAC_XCFG_LIPG0 0x000003e0 /* Lance mode IPG0 */ 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ci/* BigMac transmit config register. */ 2168c2ecf20Sopenharmony_ci#define BIGMAC_TXCFG_ENABLE 0x00000001 /* Enable the transmitter */ 2178c2ecf20Sopenharmony_ci#define BIGMAC_TXCFG_SMODE 0x00000020 /* Enable slow transmit mode */ 2188c2ecf20Sopenharmony_ci#define BIGMAC_TXCFG_CIGN 0x00000040 /* Ignore transmit collisions */ 2198c2ecf20Sopenharmony_ci#define BIGMAC_TXCFG_FCSOFF 0x00000080 /* Do not emit FCS */ 2208c2ecf20Sopenharmony_ci#define BIGMAC_TXCFG_DBACKOFF 0x00000100 /* Disable backoff */ 2218c2ecf20Sopenharmony_ci#define BIGMAC_TXCFG_FULLDPLX 0x00000200 /* Enable full-duplex */ 2228c2ecf20Sopenharmony_ci#define BIGMAC_TXCFG_DGIVEUP 0x00000400 /* Don't give up on transmits */ 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ci/* BigMac receive config register. */ 2258c2ecf20Sopenharmony_ci#define BIGMAC_RXCFG_ENABLE 0x00000001 /* Enable the receiver */ 2268c2ecf20Sopenharmony_ci#define BIGMAC_RXCFG_PSTRIP 0x00000020 /* Pad byte strip enable */ 2278c2ecf20Sopenharmony_ci#define BIGMAC_RXCFG_PMISC 0x00000040 /* Enable promiscuous mode */ 2288c2ecf20Sopenharmony_ci#define BIGMAC_RXCFG_DERR 0x00000080 /* Disable error checking */ 2298c2ecf20Sopenharmony_ci#define BIGMAC_RXCFG_DCRCS 0x00000100 /* Disable CRC stripping */ 2308c2ecf20Sopenharmony_ci#define BIGMAC_RXCFG_REJME 0x00000200 /* Reject packets addressed to me */ 2318c2ecf20Sopenharmony_ci#define BIGMAC_RXCFG_PGRP 0x00000400 /* Enable promisc group mode */ 2328c2ecf20Sopenharmony_ci#define BIGMAC_RXCFG_HENABLE 0x00000800 /* Enable the hash filter */ 2338c2ecf20Sopenharmony_ci#define BIGMAC_RXCFG_AENABLE 0x00001000 /* Enable the address filter */ 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_ci/* These are the "Management Interface" (ie. MIF) registers of the transceiver. */ 2368c2ecf20Sopenharmony_ci#define TCVR_BBCLOCK 0x00UL /* Bit bang clock register */ 2378c2ecf20Sopenharmony_ci#define TCVR_BBDATA 0x04UL /* Bit bang data register */ 2388c2ecf20Sopenharmony_ci#define TCVR_BBOENAB 0x08UL /* Bit bang output enable */ 2398c2ecf20Sopenharmony_ci#define TCVR_FRAME 0x0cUL /* Frame control/data register */ 2408c2ecf20Sopenharmony_ci#define TCVR_CFG 0x10UL /* MIF config register */ 2418c2ecf20Sopenharmony_ci#define TCVR_IMASK 0x14UL /* MIF interrupt mask */ 2428c2ecf20Sopenharmony_ci#define TCVR_STATUS 0x18UL /* MIF status */ 2438c2ecf20Sopenharmony_ci#define TCVR_SMACHINE 0x1cUL /* MIF state machine */ 2448c2ecf20Sopenharmony_ci#define TCVR_REG_SIZE 0x20UL 2458c2ecf20Sopenharmony_ci 2468c2ecf20Sopenharmony_ci/* Frame commands. */ 2478c2ecf20Sopenharmony_ci#define FRAME_WRITE 0x50020000 2488c2ecf20Sopenharmony_ci#define FRAME_READ 0x60020000 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci/* Transceiver config register */ 2518c2ecf20Sopenharmony_ci#define TCV_CFG_PSELECT 0x00000001 /* Select PHY */ 2528c2ecf20Sopenharmony_ci#define TCV_CFG_PENABLE 0x00000002 /* Enable MIF polling */ 2538c2ecf20Sopenharmony_ci#define TCV_CFG_BENABLE 0x00000004 /* Enable the "bit banger" oh baby */ 2548c2ecf20Sopenharmony_ci#define TCV_CFG_PREGADDR 0x000000f8 /* Address of poll register */ 2558c2ecf20Sopenharmony_ci#define TCV_CFG_MDIO0 0x00000100 /* MDIO zero, data/attached */ 2568c2ecf20Sopenharmony_ci#define TCV_CFG_MDIO1 0x00000200 /* MDIO one, data/attached */ 2578c2ecf20Sopenharmony_ci#define TCV_CFG_PDADDR 0x00007c00 /* Device PHY address polling */ 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_ci/* Here are some PHY addresses. */ 2608c2ecf20Sopenharmony_ci#define TCV_PADDR_ETX 0 /* Internal transceiver */ 2618c2ecf20Sopenharmony_ci#define TCV_PADDR_ITX 1 /* External transceiver */ 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_ci/* Transceiver status register */ 2648c2ecf20Sopenharmony_ci#define TCV_STAT_BASIC 0xffff0000 /* The "basic" part */ 2658c2ecf20Sopenharmony_ci#define TCV_STAT_NORMAL 0x0000ffff /* The "non-basic" part */ 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci/* Inside the Happy Meal transceiver is the physical layer, they use an 2688c2ecf20Sopenharmony_ci * implementations for National Semiconductor, part number DP83840VCE. 2698c2ecf20Sopenharmony_ci * You can retrieve the data sheets and programming docs for this beast 2708c2ecf20Sopenharmony_ci * from http://www.national.com/ 2718c2ecf20Sopenharmony_ci * 2728c2ecf20Sopenharmony_ci * The DP83840 is capable of both 10 and 100Mbps ethernet, in both 2738c2ecf20Sopenharmony_ci * half and full duplex mode. It also supports auto negotiation. 2748c2ecf20Sopenharmony_ci * 2758c2ecf20Sopenharmony_ci * But.... THIS THING IS A PAIN IN THE ASS TO PROGRAM! 2768c2ecf20Sopenharmony_ci * Debugging eeprom burnt code is more fun than programming this chip! 2778c2ecf20Sopenharmony_ci */ 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_ci/* Generic MII registers defined in linux/mii.h, these below 2808c2ecf20Sopenharmony_ci * are DP83840 specific. 2818c2ecf20Sopenharmony_ci */ 2828c2ecf20Sopenharmony_ci#define DP83840_CSCONFIG 0x17 /* CS configuration */ 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_ci/* The Carrier Sense config register. */ 2858c2ecf20Sopenharmony_ci#define CSCONFIG_RESV1 0x0001 /* Unused... */ 2868c2ecf20Sopenharmony_ci#define CSCONFIG_LED4 0x0002 /* Pin for full-dplx LED4 */ 2878c2ecf20Sopenharmony_ci#define CSCONFIG_LED1 0x0004 /* Pin for conn-status LED1 */ 2888c2ecf20Sopenharmony_ci#define CSCONFIG_RESV2 0x0008 /* Unused... */ 2898c2ecf20Sopenharmony_ci#define CSCONFIG_TCVDISAB 0x0010 /* Turns off the transceiver */ 2908c2ecf20Sopenharmony_ci#define CSCONFIG_DFBYPASS 0x0020 /* Bypass disconnect function */ 2918c2ecf20Sopenharmony_ci#define CSCONFIG_GLFORCE 0x0040 /* Good link force for 100mbps */ 2928c2ecf20Sopenharmony_ci#define CSCONFIG_CLKTRISTATE 0x0080 /* Tristate 25m clock */ 2938c2ecf20Sopenharmony_ci#define CSCONFIG_RESV3 0x0700 /* Unused... */ 2948c2ecf20Sopenharmony_ci#define CSCONFIG_ENCODE 0x0800 /* 1=MLT-3, 0=binary */ 2958c2ecf20Sopenharmony_ci#define CSCONFIG_RENABLE 0x1000 /* Repeater mode enable */ 2968c2ecf20Sopenharmony_ci#define CSCONFIG_TCDISABLE 0x2000 /* Disable timeout counter */ 2978c2ecf20Sopenharmony_ci#define CSCONFIG_RESV4 0x4000 /* Unused... */ 2988c2ecf20Sopenharmony_ci#define CSCONFIG_NDISABLE 0x8000 /* Disable NRZI */ 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci/* Happy Meal descriptor rings and such. 3018c2ecf20Sopenharmony_ci * All descriptor rings must be aligned on a 2K boundary. 3028c2ecf20Sopenharmony_ci * All receive buffers must be 64 byte aligned. 3038c2ecf20Sopenharmony_ci * Always write the address first before setting the ownership 3048c2ecf20Sopenharmony_ci * bits to avoid races with the hardware scanning the ring. 3058c2ecf20Sopenharmony_ci */ 3068c2ecf20Sopenharmony_citypedef u32 __bitwise hme32; 3078c2ecf20Sopenharmony_ci 3088c2ecf20Sopenharmony_cistruct happy_meal_rxd { 3098c2ecf20Sopenharmony_ci hme32 rx_flags; 3108c2ecf20Sopenharmony_ci hme32 rx_addr; 3118c2ecf20Sopenharmony_ci}; 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci#define RXFLAG_OWN 0x80000000 /* 1 = hardware, 0 = software */ 3148c2ecf20Sopenharmony_ci#define RXFLAG_OVERFLOW 0x40000000 /* 1 = buffer overflow */ 3158c2ecf20Sopenharmony_ci#define RXFLAG_SIZE 0x3fff0000 /* Size of the buffer */ 3168c2ecf20Sopenharmony_ci#define RXFLAG_CSUM 0x0000ffff /* HW computed checksum */ 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_cistruct happy_meal_txd { 3198c2ecf20Sopenharmony_ci hme32 tx_flags; 3208c2ecf20Sopenharmony_ci hme32 tx_addr; 3218c2ecf20Sopenharmony_ci}; 3228c2ecf20Sopenharmony_ci 3238c2ecf20Sopenharmony_ci#define TXFLAG_OWN 0x80000000 /* 1 = hardware, 0 = software */ 3248c2ecf20Sopenharmony_ci#define TXFLAG_SOP 0x40000000 /* 1 = start of packet */ 3258c2ecf20Sopenharmony_ci#define TXFLAG_EOP 0x20000000 /* 1 = end of packet */ 3268c2ecf20Sopenharmony_ci#define TXFLAG_CSENABLE 0x10000000 /* 1 = enable hw-checksums */ 3278c2ecf20Sopenharmony_ci#define TXFLAG_CSLOCATION 0x0ff00000 /* Where to stick the csum */ 3288c2ecf20Sopenharmony_ci#define TXFLAG_CSBUFBEGIN 0x000fc000 /* Where to begin checksum */ 3298c2ecf20Sopenharmony_ci#define TXFLAG_SIZE 0x00003fff /* Size of the packet */ 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_ci#define TX_RING_SIZE 32 /* Must be >16 and <255, multiple of 16 */ 3328c2ecf20Sopenharmony_ci#define RX_RING_SIZE 32 /* see ERX_CFG_SIZE* for possible values */ 3338c2ecf20Sopenharmony_ci 3348c2ecf20Sopenharmony_ci#if (TX_RING_SIZE < 16 || TX_RING_SIZE > 256 || (TX_RING_SIZE % 16) != 0) 3358c2ecf20Sopenharmony_ci#error TX_RING_SIZE holds illegal value 3368c2ecf20Sopenharmony_ci#endif 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_ci#define TX_RING_MAXSIZE 256 3398c2ecf20Sopenharmony_ci#define RX_RING_MAXSIZE 256 3408c2ecf20Sopenharmony_ci 3418c2ecf20Sopenharmony_ci/* We use a 14 byte offset for checksum computation. */ 3428c2ecf20Sopenharmony_ci#if (RX_RING_SIZE == 32) 3438c2ecf20Sopenharmony_ci#define ERX_CFG_DEFAULT(off) (ERX_CFG_DMAENABLE|((off)<<3)|ERX_CFG_SIZE32|((14/2)<<16)) 3448c2ecf20Sopenharmony_ci#else 3458c2ecf20Sopenharmony_ci#if (RX_RING_SIZE == 64) 3468c2ecf20Sopenharmony_ci#define ERX_CFG_DEFAULT(off) (ERX_CFG_DMAENABLE|((off)<<3)|ERX_CFG_SIZE64|((14/2)<<16)) 3478c2ecf20Sopenharmony_ci#else 3488c2ecf20Sopenharmony_ci#if (RX_RING_SIZE == 128) 3498c2ecf20Sopenharmony_ci#define ERX_CFG_DEFAULT(off) (ERX_CFG_DMAENABLE|((off)<<3)|ERX_CFG_SIZE128|((14/2)<<16)) 3508c2ecf20Sopenharmony_ci#else 3518c2ecf20Sopenharmony_ci#if (RX_RING_SIZE == 256) 3528c2ecf20Sopenharmony_ci#define ERX_CFG_DEFAULT(off) (ERX_CFG_DMAENABLE|((off)<<3)|ERX_CFG_SIZE256|((14/2)<<16)) 3538c2ecf20Sopenharmony_ci#else 3548c2ecf20Sopenharmony_ci#error RX_RING_SIZE holds illegal value 3558c2ecf20Sopenharmony_ci#endif 3568c2ecf20Sopenharmony_ci#endif 3578c2ecf20Sopenharmony_ci#endif 3588c2ecf20Sopenharmony_ci#endif 3598c2ecf20Sopenharmony_ci 3608c2ecf20Sopenharmony_ci#define NEXT_RX(num) (((num) + 1) & (RX_RING_SIZE - 1)) 3618c2ecf20Sopenharmony_ci#define NEXT_TX(num) (((num) + 1) & (TX_RING_SIZE - 1)) 3628c2ecf20Sopenharmony_ci#define PREV_RX(num) (((num) - 1) & (RX_RING_SIZE - 1)) 3638c2ecf20Sopenharmony_ci#define PREV_TX(num) (((num) - 1) & (TX_RING_SIZE - 1)) 3648c2ecf20Sopenharmony_ci 3658c2ecf20Sopenharmony_ci#define TX_BUFFS_AVAIL(hp) \ 3668c2ecf20Sopenharmony_ci (((hp)->tx_old <= (hp)->tx_new) ? \ 3678c2ecf20Sopenharmony_ci (hp)->tx_old + (TX_RING_SIZE - 1) - (hp)->tx_new : \ 3688c2ecf20Sopenharmony_ci (hp)->tx_old - (hp)->tx_new - 1) 3698c2ecf20Sopenharmony_ci 3708c2ecf20Sopenharmony_ci#define RX_OFFSET 2 3718c2ecf20Sopenharmony_ci#define RX_BUF_ALLOC_SIZE (1546 + RX_OFFSET + 64) 3728c2ecf20Sopenharmony_ci 3738c2ecf20Sopenharmony_ci#define RX_COPY_THRESHOLD 256 3748c2ecf20Sopenharmony_ci 3758c2ecf20Sopenharmony_cistruct hmeal_init_block { 3768c2ecf20Sopenharmony_ci struct happy_meal_rxd happy_meal_rxd[RX_RING_MAXSIZE]; 3778c2ecf20Sopenharmony_ci struct happy_meal_txd happy_meal_txd[TX_RING_MAXSIZE]; 3788c2ecf20Sopenharmony_ci}; 3798c2ecf20Sopenharmony_ci 3808c2ecf20Sopenharmony_ci#define hblock_offset(mem, elem) \ 3818c2ecf20Sopenharmony_ci((__u32)((unsigned long)(&(((struct hmeal_init_block *)0)->mem[elem])))) 3828c2ecf20Sopenharmony_ci 3838c2ecf20Sopenharmony_ci/* Now software state stuff. */ 3848c2ecf20Sopenharmony_cienum happy_transceiver { 3858c2ecf20Sopenharmony_ci external = 0, 3868c2ecf20Sopenharmony_ci internal = 1, 3878c2ecf20Sopenharmony_ci none = 2, 3888c2ecf20Sopenharmony_ci}; 3898c2ecf20Sopenharmony_ci 3908c2ecf20Sopenharmony_ci/* Timer state engine. */ 3918c2ecf20Sopenharmony_cienum happy_timer_state { 3928c2ecf20Sopenharmony_ci arbwait = 0, /* Waiting for auto negotiation to complete. */ 3938c2ecf20Sopenharmony_ci lupwait = 1, /* Auto-neg complete, awaiting link-up status. */ 3948c2ecf20Sopenharmony_ci ltrywait = 2, /* Forcing try of all modes, from fastest to slowest. */ 3958c2ecf20Sopenharmony_ci asleep = 3, /* Time inactive. */ 3968c2ecf20Sopenharmony_ci}; 3978c2ecf20Sopenharmony_ci 3988c2ecf20Sopenharmony_cistruct quattro; 3998c2ecf20Sopenharmony_ci 4008c2ecf20Sopenharmony_ci/* Happy happy, joy joy! */ 4018c2ecf20Sopenharmony_cistruct happy_meal { 4028c2ecf20Sopenharmony_ci void __iomem *gregs; /* Happy meal global registers */ 4038c2ecf20Sopenharmony_ci struct hmeal_init_block *happy_block; /* RX and TX descriptors (CPU addr) */ 4048c2ecf20Sopenharmony_ci 4058c2ecf20Sopenharmony_ci#if defined(CONFIG_SBUS) && defined(CONFIG_PCI) 4068c2ecf20Sopenharmony_ci u32 (*read_desc32)(hme32 *); 4078c2ecf20Sopenharmony_ci void (*write_txd)(struct happy_meal_txd *, u32, u32); 4088c2ecf20Sopenharmony_ci void (*write_rxd)(struct happy_meal_rxd *, u32, u32); 4098c2ecf20Sopenharmony_ci#endif 4108c2ecf20Sopenharmony_ci 4118c2ecf20Sopenharmony_ci /* This is either an platform_device or a pci_dev. */ 4128c2ecf20Sopenharmony_ci void *happy_dev; 4138c2ecf20Sopenharmony_ci struct device *dma_dev; 4148c2ecf20Sopenharmony_ci 4158c2ecf20Sopenharmony_ci spinlock_t happy_lock; 4168c2ecf20Sopenharmony_ci 4178c2ecf20Sopenharmony_ci struct sk_buff *rx_skbs[RX_RING_SIZE]; 4188c2ecf20Sopenharmony_ci struct sk_buff *tx_skbs[TX_RING_SIZE]; 4198c2ecf20Sopenharmony_ci 4208c2ecf20Sopenharmony_ci int rx_new, tx_new, rx_old, tx_old; 4218c2ecf20Sopenharmony_ci 4228c2ecf20Sopenharmony_ci#if defined(CONFIG_SBUS) && defined(CONFIG_PCI) 4238c2ecf20Sopenharmony_ci u32 (*read32)(void __iomem *); 4248c2ecf20Sopenharmony_ci void (*write32)(void __iomem *, u32); 4258c2ecf20Sopenharmony_ci#endif 4268c2ecf20Sopenharmony_ci 4278c2ecf20Sopenharmony_ci void __iomem *etxregs; /* External transmitter regs */ 4288c2ecf20Sopenharmony_ci void __iomem *erxregs; /* External receiver regs */ 4298c2ecf20Sopenharmony_ci void __iomem *bigmacregs; /* BIGMAC core regs */ 4308c2ecf20Sopenharmony_ci void __iomem *tcvregs; /* MIF transceiver regs */ 4318c2ecf20Sopenharmony_ci 4328c2ecf20Sopenharmony_ci dma_addr_t hblock_dvma; /* DVMA visible address happy block */ 4338c2ecf20Sopenharmony_ci unsigned int happy_flags; /* Driver state flags */ 4348c2ecf20Sopenharmony_ci int irq; 4358c2ecf20Sopenharmony_ci enum happy_transceiver tcvr_type; /* Kind of transceiver in use */ 4368c2ecf20Sopenharmony_ci unsigned int happy_bursts; /* Get your mind out of the gutter */ 4378c2ecf20Sopenharmony_ci unsigned int paddr; /* PHY address for transceiver */ 4388c2ecf20Sopenharmony_ci unsigned short hm_revision; /* Happy meal revision */ 4398c2ecf20Sopenharmony_ci unsigned short sw_bmcr; /* SW copy of BMCR */ 4408c2ecf20Sopenharmony_ci unsigned short sw_bmsr; /* SW copy of BMSR */ 4418c2ecf20Sopenharmony_ci unsigned short sw_physid1; /* SW copy of PHYSID1 */ 4428c2ecf20Sopenharmony_ci unsigned short sw_physid2; /* SW copy of PHYSID2 */ 4438c2ecf20Sopenharmony_ci unsigned short sw_advertise; /* SW copy of ADVERTISE */ 4448c2ecf20Sopenharmony_ci unsigned short sw_lpa; /* SW copy of LPA */ 4458c2ecf20Sopenharmony_ci unsigned short sw_expansion; /* SW copy of EXPANSION */ 4468c2ecf20Sopenharmony_ci unsigned short sw_csconfig; /* SW copy of CSCONFIG */ 4478c2ecf20Sopenharmony_ci unsigned int auto_speed; /* Auto-nego link speed */ 4488c2ecf20Sopenharmony_ci unsigned int forced_speed; /* Force mode link speed */ 4498c2ecf20Sopenharmony_ci unsigned int poll_data; /* MIF poll data */ 4508c2ecf20Sopenharmony_ci unsigned int poll_flag; /* MIF poll flag */ 4518c2ecf20Sopenharmony_ci unsigned int linkcheck; /* Have we checked the link yet? */ 4528c2ecf20Sopenharmony_ci unsigned int lnkup; /* Is the link up as far as we know? */ 4538c2ecf20Sopenharmony_ci unsigned int lnkdown; /* Trying to force the link down? */ 4548c2ecf20Sopenharmony_ci unsigned int lnkcnt; /* Counter for link-up attempts. */ 4558c2ecf20Sopenharmony_ci struct timer_list happy_timer; /* To watch the link when coming up. */ 4568c2ecf20Sopenharmony_ci enum happy_timer_state timer_state; /* State of the auto-neg timer. */ 4578c2ecf20Sopenharmony_ci unsigned int timer_ticks; /* Number of clicks at each state. */ 4588c2ecf20Sopenharmony_ci 4598c2ecf20Sopenharmony_ci struct net_device *dev; /* Backpointer */ 4608c2ecf20Sopenharmony_ci struct quattro *qfe_parent; /* For Quattro cards */ 4618c2ecf20Sopenharmony_ci int qfe_ent; /* Which instance on quattro */ 4628c2ecf20Sopenharmony_ci}; 4638c2ecf20Sopenharmony_ci 4648c2ecf20Sopenharmony_ci/* Here are the happy flags. */ 4658c2ecf20Sopenharmony_ci#define HFLAG_POLL 0x00000001 /* We are doing MIF polling */ 4668c2ecf20Sopenharmony_ci#define HFLAG_FENABLE 0x00000002 /* The MII frame is enabled */ 4678c2ecf20Sopenharmony_ci#define HFLAG_LANCE 0x00000004 /* We are using lance-mode */ 4688c2ecf20Sopenharmony_ci#define HFLAG_RXENABLE 0x00000008 /* Receiver is enabled */ 4698c2ecf20Sopenharmony_ci#define HFLAG_AUTO 0x00000010 /* Using auto-negotiation, 0 = force */ 4708c2ecf20Sopenharmony_ci#define HFLAG_FULL 0x00000020 /* Full duplex enable */ 4718c2ecf20Sopenharmony_ci#define HFLAG_MACFULL 0x00000040 /* Using full duplex in the MAC */ 4728c2ecf20Sopenharmony_ci#define HFLAG_POLLENABLE 0x00000080 /* Actually try MIF polling */ 4738c2ecf20Sopenharmony_ci#define HFLAG_RXCV 0x00000100 /* XXX RXCV ENABLE */ 4748c2ecf20Sopenharmony_ci#define HFLAG_INIT 0x00000200 /* Init called at least once */ 4758c2ecf20Sopenharmony_ci#define HFLAG_LINKUP 0x00000400 /* 1 = Link is up */ 4768c2ecf20Sopenharmony_ci#define HFLAG_PCI 0x00000800 /* PCI based Happy Meal */ 4778c2ecf20Sopenharmony_ci#define HFLAG_QUATTRO 0x00001000 /* On QFE/Quattro card */ 4788c2ecf20Sopenharmony_ci 4798c2ecf20Sopenharmony_ci#define HFLAG_20_21 (HFLAG_POLLENABLE | HFLAG_FENABLE) 4808c2ecf20Sopenharmony_ci#define HFLAG_NOT_A0 (HFLAG_POLLENABLE | HFLAG_FENABLE | HFLAG_LANCE | HFLAG_RXCV) 4818c2ecf20Sopenharmony_ci 4828c2ecf20Sopenharmony_ci/* Support for QFE/Quattro cards. */ 4838c2ecf20Sopenharmony_cistruct quattro { 4848c2ecf20Sopenharmony_ci struct net_device *happy_meals[4]; 4858c2ecf20Sopenharmony_ci 4868c2ecf20Sopenharmony_ci /* This is either a sbus_dev or a pci_dev. */ 4878c2ecf20Sopenharmony_ci void *quattro_dev; 4888c2ecf20Sopenharmony_ci 4898c2ecf20Sopenharmony_ci struct quattro *next; 4908c2ecf20Sopenharmony_ci 4918c2ecf20Sopenharmony_ci /* PROM ranges, if any. */ 4928c2ecf20Sopenharmony_ci#ifdef CONFIG_SBUS 4938c2ecf20Sopenharmony_ci struct linux_prom_ranges ranges[8]; 4948c2ecf20Sopenharmony_ci#endif 4958c2ecf20Sopenharmony_ci int nranges; 4968c2ecf20Sopenharmony_ci}; 4978c2ecf20Sopenharmony_ci 4988c2ecf20Sopenharmony_ci/* We use this to acquire receive skb's that we can DMA directly into. */ 4998c2ecf20Sopenharmony_ci#define ALIGNED_RX_SKB_ADDR(addr) \ 5008c2ecf20Sopenharmony_ci ((((unsigned long)(addr) + (64UL - 1UL)) & ~(64UL - 1UL)) - (unsigned long)(addr)) 5018c2ecf20Sopenharmony_ci#define happy_meal_alloc_skb(__length, __gfp_flags) \ 5028c2ecf20Sopenharmony_ci({ struct sk_buff *__skb; \ 5038c2ecf20Sopenharmony_ci __skb = alloc_skb((__length) + 64, (__gfp_flags)); \ 5048c2ecf20Sopenharmony_ci if(__skb) { \ 5058c2ecf20Sopenharmony_ci int __offset = (int) ALIGNED_RX_SKB_ADDR(__skb->data); \ 5068c2ecf20Sopenharmony_ci if(__offset) \ 5078c2ecf20Sopenharmony_ci skb_reserve(__skb, __offset); \ 5088c2ecf20Sopenharmony_ci } \ 5098c2ecf20Sopenharmony_ci __skb; \ 5108c2ecf20Sopenharmony_ci}) 5118c2ecf20Sopenharmony_ci 5128c2ecf20Sopenharmony_ci#endif /* !(_SUNHME_H) */ 513