Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (c) 2010 ASIX Electronics Corporation
0004  * Copyright (c) 2020 Samsung Electronics
0005  *
0006  * ASIX AX88796C SPI Fast Ethernet Linux driver
0007  */
0008 
0009 #ifndef _AX88796C_MAIN_H
0010 #define _AX88796C_MAIN_H
0011 
0012 #include <linux/netdevice.h>
0013 #include <linux/mii.h>
0014 
0015 #include "ax88796c_spi.h"
0016 
0017 /* These identify the driver base version and may not be removed. */
0018 #define DRV_NAME    "ax88796c"
0019 #define ADP_NAME    "ASIX AX88796C SPI Ethernet Adapter"
0020 
0021 #define TX_QUEUE_HIGH_WATER     45  /* Tx queue high water mark */
0022 #define TX_QUEUE_LOW_WATER      20  /* Tx queue low water mark */
0023 
0024 #define AX88796C_REGDUMP_LEN        256
0025 #define AX88796C_PHY_REGDUMP_LEN    14
0026 #define AX88796C_PHY_ID         0x10
0027 
0028 #define TX_OVERHEAD         8
0029 #define TX_EOP_SIZE         4
0030 
0031 #define AX_MCAST_FILTER_SIZE        8
0032 #define AX_MAX_MCAST            64
0033 #define AX_MAX_CLK                      80000000
0034 #define TX_HDR_SOP_DICF         0x8000
0035 #define TX_HDR_SOP_CPHI         0x4000
0036 #define TX_HDR_SOP_INT          0x2000
0037 #define TX_HDR_SOP_MDEQ         0x1000
0038 #define TX_HDR_SOP_PKTLEN       0x07FF
0039 #define TX_HDR_SOP_SEQNUM       0xF800
0040 #define TX_HDR_SOP_PKTLENBAR        0x07FF
0041 
0042 #define TX_HDR_SEG_FS           0x8000
0043 #define TX_HDR_SEG_LS           0x4000
0044 #define TX_HDR_SEG_SEGNUM       0x3800
0045 #define TX_HDR_SEG_SEGLEN       0x0700
0046 #define TX_HDR_SEG_EOFST        0xC000
0047 #define TX_HDR_SEG_SOFST        0x3800
0048 #define TX_HDR_SEG_SEGLENBAR        0x07FF
0049 
0050 #define TX_HDR_EOP_SEQNUM       0xF800
0051 #define TX_HDR_EOP_PKTLEN       0x07FF
0052 #define TX_HDR_EOP_SEQNUMBAR        0xF800
0053 #define TX_HDR_EOP_PKTLENBAR        0x07FF
0054 
0055 /* Rx header fields mask */
0056 #define RX_HDR1_MCBC            0x8000
0057 #define RX_HDR1_STUFF_PKT       0x4000
0058 #define RX_HDR1_MII_ERR         0x2000
0059 #define RX_HDR1_CRC_ERR         0x1000
0060 #define RX_HDR1_PKT_LEN         0x07FF
0061 
0062 #define RX_HDR2_SEQ_NUM         0xF800
0063 #define RX_HDR2_PKT_LEN_BAR     0x7FFF
0064 
0065 #define RX_HDR3_PE          0x8000
0066 #define RX_HDR3_L3_TYPE_IPV4V6      0x6000
0067 #define RX_HDR3_L3_TYPE_IP      0x4000
0068 #define RX_HDR3_L3_TYPE_IPV6        0x2000
0069 #define RX_HDR3_L4_TYPE_ICMPV6      0x1400
0070 #define RX_HDR3_L4_TYPE_TCP     0x1000
0071 #define RX_HDR3_L4_TYPE_IGMP        0x0c00
0072 #define RX_HDR3_L4_TYPE_ICMP        0x0800
0073 #define RX_HDR3_L4_TYPE_UDP     0x0400
0074 #define RX_HDR3_L3_ERR          0x0200
0075 #define RX_HDR3_L4_ERR          0x0100
0076 #define RX_HDR3_PRIORITY(x)     ((x) << 4)
0077 #define RX_HDR3_STRIP           0x0008
0078 #define RX_HDR3_VLAN_ID         0x0007
0079 
0080 struct ax88796c_pcpu_stats {
0081     u64_stats_t rx_packets;
0082     u64_stats_t rx_bytes;
0083     u64_stats_t tx_packets;
0084     u64_stats_t tx_bytes;
0085     struct u64_stats_sync syncp;
0086     u32 rx_dropped;
0087     u32 tx_dropped;
0088     u32 rx_frame_errors;
0089     u32 rx_crc_errors;
0090 };
0091 
0092 struct ax88796c_device {
0093     struct spi_device   *spi;
0094     struct net_device   *ndev;
0095     struct ax88796c_pcpu_stats __percpu *stats;
0096 
0097     struct work_struct  ax_work;
0098 
0099     struct mutex        spi_lock; /* device access */
0100 
0101     struct sk_buff_head tx_wait_q;
0102 
0103     struct axspi_data   ax_spi;
0104 
0105     struct mii_bus      *mdiobus;
0106     struct phy_device   *phydev;
0107 
0108     int         msg_enable;
0109 
0110     u16         seq_num;
0111 
0112     u8          multi_filter[AX_MCAST_FILTER_SIZE];
0113 
0114     int         link;
0115     int         speed;
0116     int         duplex;
0117     int         pause;
0118     int         asym_pause;
0119     int         flowctrl;
0120         #define AX_FC_NONE      0
0121         #define AX_FC_RX        BIT(0)
0122         #define AX_FC_TX        BIT(1)
0123         #define AX_FC_ANEG      BIT(2)
0124 
0125     u32         priv_flags;
0126         #define AX_CAP_COMP     BIT(0)
0127         #define AX_PRIV_FLAGS_MASK  (AX_CAP_COMP)
0128 
0129     unsigned long       flags;
0130         #define EVENT_INTR      0
0131         #define EVENT_TX        1
0132         #define EVENT_SET_MULTI     2
0133 
0134 };
0135 
0136 #define to_ax88796c_device(ndev) ((struct ax88796c_device *)netdev_priv(ndev))
0137 
0138 enum skb_state {
0139     illegal = 0,
0140     tx_done,
0141     rx_done,
0142     rx_err,
0143 };
0144 
0145 struct skb_data {
0146     enum skb_state state;
0147     size_t len;
0148 };
0149 
0150 /* A88796C register definition */
0151     /* Definition of PAGE0 */
0152 #define P0_PSR      (0x00)
0153     #define PSR_DEV_READY       BIT(7)
0154     #define PSR_RESET       (0 << 15)
0155     #define PSR_RESET_CLR       BIT(15)
0156 #define P0_BOR      (0x02)
0157 #define P0_FER      (0x04)
0158     #define FER_IPALM       BIT(0)
0159     #define FER_DCRC        BIT(1)
0160     #define FER_RH3M        BIT(2)
0161     #define FER_HEADERSWAP      BIT(7)
0162     #define FER_WSWAP       BIT(8)
0163     #define FER_BSWAP       BIT(9)
0164     #define FER_INTHI       BIT(10)
0165     #define FER_INTLO       (0 << 10)
0166     #define FER_IRQ_PULL        BIT(11)
0167     #define FER_RXEN        BIT(14)
0168     #define FER_TXEN        BIT(15)
0169 #define P0_ISR      (0x06)
0170     #define ISR_RXPKT       BIT(0)
0171     #define ISR_MDQ         BIT(4)
0172     #define ISR_TXT         BIT(5)
0173     #define ISR_TXPAGES     BIT(6)
0174     #define ISR_TXERR       BIT(8)
0175     #define ISR_LINK        BIT(9)
0176 #define P0_IMR      (0x08)
0177     #define IMR_RXPKT       BIT(0)
0178     #define IMR_MDQ         BIT(4)
0179     #define IMR_TXT         BIT(5)
0180     #define IMR_TXPAGES     BIT(6)
0181     #define IMR_TXERR       BIT(8)
0182     #define IMR_LINK        BIT(9)
0183     #define IMR_MASKALL     (0xFFFF)
0184     #define IMR_DEFAULT     (IMR_TXERR)
0185 #define P0_WFCR     (0x0A)
0186     #define WFCR_PMEIND     BIT(0) /* PME indication */
0187     #define WFCR_PMETYPE        BIT(1) /* PME I/O type */
0188     #define WFCR_PMEPOL     BIT(2) /* PME polarity */
0189     #define WFCR_PMERST     BIT(3) /* Reset PME */
0190     #define WFCR_SLEEP      BIT(4) /* Enable sleep mode */
0191     #define WFCR_WAKEUP     BIT(5) /* Enable wakeup mode */
0192     #define WFCR_WAITEVENT      BIT(6) /* Reserved */
0193     #define WFCR_CLRWAKE        BIT(7) /* Clear wakeup */
0194     #define WFCR_LINKCH     BIT(8) /* Enable link change */
0195     #define WFCR_MAGICP     BIT(9) /* Enable magic packet */
0196     #define WFCR_WAKEF      BIT(10) /* Enable wakeup frame */
0197     #define WFCR_PMEEN      BIT(11) /* Enable PME pin */
0198     #define WFCR_LINKCHS        BIT(12) /* Link change status */
0199     #define WFCR_MAGICPS        BIT(13) /* Magic packet status */
0200     #define WFCR_WAKEFS     BIT(14) /* Wakeup frame status */
0201     #define WFCR_PMES       BIT(15) /* PME pin status */
0202 #define P0_PSCR     (0x0C)
0203     #define PSCR_PS_MASK        (0xFFF0)
0204     #define PSCR_PS_D0      (0)
0205     #define PSCR_PS_D1      BIT(0)
0206     #define PSCR_PS_D2      BIT(1)
0207     #define PSCR_FPS        BIT(3) /* Enable fiber mode PS */
0208     #define PSCR_SWPS       BIT(4) /* Enable software */
0209                          /* PS control */
0210     #define PSCR_WOLPS      BIT(5) /* Enable WOL PS */
0211     #define PSCR_SWWOL      BIT(6) /* Enable software select */
0212                          /* WOL PS */
0213     #define PSCR_PHYOSC     BIT(7) /* Internal PHY OSC control */
0214     #define PSCR_FOFEF      BIT(8) /* Force PHY generate FEF */
0215     #define PSCR_FOF        BIT(9) /* Force PHY in fiber mode */
0216     #define PSCR_PHYPD      BIT(10) /* PHY power down. */
0217                           /* Active high */
0218     #define PSCR_PHYRST     BIT(11) /* PHY reset signal. */
0219                           /* Active low */
0220     #define PSCR_PHYCSIL        BIT(12) /* PHY cable energy detect */
0221     #define PSCR_PHYCOFF        BIT(13) /* PHY cable off */
0222     #define PSCR_PHYLINK        BIT(14) /* PHY link status */
0223     #define PSCR_EEPOK      BIT(15) /* EEPROM load complete */
0224 #define P0_MACCR    (0x0E)
0225     #define MACCR_RXEN      BIT(0) /* Enable RX */
0226     #define MACCR_DUPLEX_FULL   BIT(1) /* 1: Full, 0: Half */
0227     #define MACCR_SPEED_100     BIT(2) /* 1: 100Mbps, 0: 10Mbps */
0228     #define MACCR_RXFC_ENABLE   BIT(3)
0229     #define MACCR_RXFC_MASK     0xFFF7
0230     #define MACCR_TXFC_ENABLE   BIT(4)
0231     #define MACCR_TXFC_MASK     0xFFEF
0232     #define MACCR_PSI       BIT(6) /* Software Cable-Off */
0233                            /* Power Saving Interrupt */
0234     #define MACCR_PF        BIT(7)
0235     #define MACCR_PMM_BITS      8
0236     #define MACCR_PMM_MASK      (0x1F00)
0237     #define MACCR_PMM_RESET     BIT(8)
0238     #define MACCR_PMM_WAIT      (2 << 8)
0239     #define MACCR_PMM_READY     (3 << 8)
0240     #define MACCR_PMM_D1        (4 << 8)
0241     #define MACCR_PMM_D2        (5 << 8)
0242     #define MACCR_PMM_WAKE      (7 << 8)
0243     #define MACCR_PMM_D1_WAKE   (8 << 8)
0244     #define MACCR_PMM_D2_WAKE   (9 << 8)
0245     #define MACCR_PMM_SLEEP     (10 << 8)
0246     #define MACCR_PMM_PHY_RESET (11 << 8)
0247     #define MACCR_PMM_SOFT_D1   (16 << 8)
0248     #define MACCR_PMM_SOFT_D2   (17 << 8)
0249 #define P0_TFBFCR   (0x10)
0250     #define TFBFCR_SCHE_FREE_PAGE   0xE07F
0251     #define TFBFCR_FREE_PAGE_BITS   0x07
0252     #define TFBFCR_FREE_PAGE_LATCH  BIT(6)
0253     #define TFBFCR_SET_FREE_PAGE(x) (((x) & 0x3F) << TFBFCR_FREE_PAGE_BITS)
0254     #define TFBFCR_TX_PAGE_SET  BIT(13)
0255     #define TFBFCR_MANU_ENTX    BIT(15)
0256     #define TX_FREEBUF_MASK     0x003F
0257     #define TX_DPTSTART     0x4000
0258 
0259 #define P0_TSNR     (0x12)
0260     #define TXNR_TXB_ERR        BIT(5)
0261     #define TXNR_TXB_IDLE       BIT(6)
0262     #define TSNR_PKT_CNT(x)     (((x) & 0x3F) << 8)
0263     #define TXNR_TXB_REINIT     BIT(14)
0264     #define TSNR_TXB_START      BIT(15)
0265 #define P0_RTDPR    (0x14)
0266 #define P0_RXBCR1   (0x16)
0267     #define RXBCR1_RXB_DISCARD  BIT(14)
0268     #define RXBCR1_RXB_START    BIT(15)
0269 #define P0_RXBCR2   (0x18)
0270     #define RXBCR2_PKT_MASK     (0xFF)
0271     #define RXBCR2_RXPC_MASK    (0x7F)
0272     #define RXBCR2_RXB_READY    BIT(13)
0273     #define RXBCR2_RXB_IDLE     BIT(14)
0274     #define RXBCR2_RXB_REINIT   BIT(15)
0275 #define P0_RTWCR    (0x1A)
0276     #define RTWCR_RXWC_MASK     (0x3FFF)
0277     #define RTWCR_RX_LATCH      BIT(15)
0278 #define P0_RCPHR    (0x1C)
0279 
0280     /* Definition of PAGE1 */
0281 #define P1_RPPER    (0x22)
0282     #define RPPER_RXEN      BIT(0)
0283 #define P1_MRCR     (0x28)
0284 #define P1_MDR      (0x2A)
0285 #define P1_RMPR     (0x2C)
0286 #define P1_TMPR     (0x2E)
0287 #define P1_RXBSPCR  (0x30)
0288     #define RXBSPCR_STUF_WORD_CNT(x)    (((x) & 0x7000) >> 12)
0289     #define RXBSPCR_STUF_ENABLE     BIT(15)
0290 #define P1_MCR      (0x32)
0291     #define MCR_SBP         BIT(8)
0292     #define MCR_SM          BIT(9)
0293     #define MCR_CRCENLAN        BIT(11)
0294     #define MCR_STP         BIT(12)
0295     /* Definition of PAGE2 */
0296 #define P2_CIR      (0x42)
0297 #define P2_PCR      (0x44)
0298     #define PCR_POLL_EN     BIT(0)
0299     #define PCR_POLL_FLOWCTRL   BIT(1)
0300     #define PCR_POLL_BMCR       BIT(2)
0301     #define PCR_PHYID(x)        ((x) << 8)
0302 #define P2_PHYSR    (0x46)
0303 #define P2_MDIODR   (0x48)
0304 #define P2_MDIOCR   (0x4A)
0305     #define MDIOCR_RADDR(x)     ((x) & 0x1F)
0306     #define MDIOCR_FADDR(x)     (((x) & 0x1F) << 8)
0307     #define MDIOCR_VALID        BIT(13)
0308     #define MDIOCR_READ     BIT(14)
0309     #define MDIOCR_WRITE        BIT(15)
0310 #define P2_LCR0     (0x4C)
0311     #define LCR_LED0_EN     BIT(0)
0312     #define LCR_LED0_100MODE    BIT(1)
0313     #define LCR_LED0_DUPLEX     BIT(2)
0314     #define LCR_LED0_LINK       BIT(3)
0315     #define LCR_LED0_ACT        BIT(4)
0316     #define LCR_LED0_COL        BIT(5)
0317     #define LCR_LED0_10MODE     BIT(6)
0318     #define LCR_LED0_DUPCOL     BIT(7)
0319     #define LCR_LED1_EN     BIT(8)
0320     #define LCR_LED1_100MODE    BIT(9)
0321     #define LCR_LED1_DUPLEX     BIT(10)
0322     #define LCR_LED1_LINK       BIT(11)
0323     #define LCR_LED1_ACT        BIT(12)
0324     #define LCR_LED1_COL        BIT(13)
0325     #define LCR_LED1_10MODE     BIT(14)
0326     #define LCR_LED1_DUPCOL     BIT(15)
0327 #define P2_LCR1     (0x4E)
0328     #define LCR_LED2_MASK       (0xFF00)
0329     #define LCR_LED2_EN     BIT(0)
0330     #define LCR_LED2_100MODE    BIT(1)
0331     #define LCR_LED2_DUPLEX     BIT(2)
0332     #define LCR_LED2_LINK       BIT(3)
0333     #define LCR_LED2_ACT        BIT(4)
0334     #define LCR_LED2_COL        BIT(5)
0335     #define LCR_LED2_10MODE     BIT(6)
0336     #define LCR_LED2_DUPCOL     BIT(7)
0337 #define P2_IPGCR    (0x50)
0338 #define P2_CRIR     (0x52)
0339 #define P2_FLHWCR   (0x54)
0340 #define P2_RXCR     (0x56)
0341     #define RXCR_PRO        BIT(0)
0342     #define RXCR_AMALL      BIT(1)
0343     #define RXCR_SEP        BIT(2)
0344     #define RXCR_AB         BIT(3)
0345     #define RXCR_AM         BIT(4)
0346     #define RXCR_AP         BIT(5)
0347     #define RXCR_ARP        BIT(6)
0348 #define P2_JLCR     (0x58)
0349 #define P2_MPLR     (0x5C)
0350 
0351     /* Definition of PAGE3 */
0352 #define P3_MACASR0  (0x62)
0353     #define P3_MACASR(x)        (P3_MACASR0 + 2 * (x))
0354     #define MACASR_LOWBYTE_MASK 0x00FF
0355     #define MACASR_HIGH_BITS    0x08
0356 #define P3_MACASR1  (0x64)
0357 #define P3_MACASR2  (0x66)
0358 #define P3_MFAR01   (0x68)
0359 #define P3_MFAR_BASE    (0x68)
0360     #define P3_MFAR(x)      (P3_MFAR_BASE + 2 * (x))
0361 
0362 #define P3_MFAR23   (0x6A)
0363 #define P3_MFAR45   (0x6C)
0364 #define P3_MFAR67   (0x6E)
0365 #define P3_VID0FR   (0x70)
0366 #define P3_VID1FR   (0x72)
0367 #define P3_EECSR    (0x74)
0368 #define P3_EEDR     (0x76)
0369 #define P3_EECR     (0x78)
0370     #define EECR_ADDR_MASK      (0x00FF)
0371     #define EECR_READ_ACT       BIT(8)
0372     #define EECR_WRITE_ACT      BIT(9)
0373     #define EECR_WRITE_DISABLE  BIT(10)
0374     #define EECR_WRITE_ENABLE   BIT(11)
0375     #define EECR_EE_READY       BIT(13)
0376     #define EECR_RELOAD     BIT(14)
0377     #define EECR_RESET      BIT(15)
0378 #define P3_TPCR     (0x7A)
0379     #define TPCR_PATT_MASK      (0xFF)
0380     #define TPCR_RAND_PKT_EN    BIT(14)
0381     #define TPCR_FIXED_PKT_EN   BIT(15)
0382 #define P3_TPLR     (0x7C)
0383     /* Definition of PAGE4 */
0384 #define P4_SPICR    (0x8A)
0385     #define SPICR_RCEN      BIT(0)
0386     #define SPICR_QCEN      BIT(1)
0387     #define SPICR_RBRE      BIT(3)
0388     #define SPICR_PMM       BIT(4)
0389     #define SPICR_LOOPBACK      BIT(8)
0390     #define SPICR_CORE_RES_CLR  BIT(10)
0391     #define SPICR_SPI_RES_CLR   BIT(11)
0392 #define P4_SPIISMR  (0x8C)
0393 
0394 #define P4_COERCR0  (0x92)
0395     #define COERCR0_RXIPCE      BIT(0)
0396     #define COERCR0_RXIPVE      BIT(1)
0397     #define COERCR0_RXV6PE      BIT(2)
0398     #define COERCR0_RXTCPE      BIT(3)
0399     #define COERCR0_RXUDPE      BIT(4)
0400     #define COERCR0_RXICMP      BIT(5)
0401     #define COERCR0_RXIGMP      BIT(6)
0402     #define COERCR0_RXICV6      BIT(7)
0403 
0404     #define COERCR0_RXTCPV6     BIT(8)
0405     #define COERCR0_RXUDPV6     BIT(9)
0406     #define COERCR0_RXICMV6     BIT(10)
0407     #define COERCR0_RXIGMV6     BIT(11)
0408     #define COERCR0_RXICV6V6    BIT(12)
0409 
0410     #define COERCR0_DEFAULT     (COERCR0_RXIPCE | COERCR0_RXV6PE | \
0411                      COERCR0_RXTCPE | COERCR0_RXUDPE | \
0412                      COERCR0_RXTCPV6 | COERCR0_RXUDPV6)
0413 #define P4_COERCR1  (0x94)
0414     #define COERCR1_IPCEDP      BIT(0)
0415     #define COERCR1_IPVEDP      BIT(1)
0416     #define COERCR1_V6VEDP      BIT(2)
0417     #define COERCR1_TCPEDP      BIT(3)
0418     #define COERCR1_UDPEDP      BIT(4)
0419     #define COERCR1_ICMPDP      BIT(5)
0420     #define COERCR1_IGMPDP      BIT(6)
0421     #define COERCR1_ICV6DP      BIT(7)
0422     #define COERCR1_RX64TE      BIT(8)
0423     #define COERCR1_RXPPPE      BIT(9)
0424     #define COERCR1_TCP6DP      BIT(10)
0425     #define COERCR1_UDP6DP      BIT(11)
0426     #define COERCR1_IC6DP       BIT(12)
0427     #define COERCR1_IG6DP       BIT(13)
0428     #define COERCR1_ICV66DP     BIT(14)
0429     #define COERCR1_RPCE        BIT(15)
0430 
0431     #define COERCR1_DEFAULT     (COERCR1_RXPPPE)
0432 
0433 #define P4_COETCR0  (0x96)
0434     #define COETCR0_TXIP        BIT(0)
0435     #define COETCR0_TXTCP       BIT(1)
0436     #define COETCR0_TXUDP       BIT(2)
0437     #define COETCR0_TXICMP      BIT(3)
0438     #define COETCR0_TXIGMP      BIT(4)
0439     #define COETCR0_TXICV6      BIT(5)
0440     #define COETCR0_TXTCPV6     BIT(8)
0441     #define COETCR0_TXUDPV6     BIT(9)
0442     #define COETCR0_TXICMV6     BIT(10)
0443     #define COETCR0_TXIGMV6     BIT(11)
0444     #define COETCR0_TXICV6V6    BIT(12)
0445 
0446     #define COETCR0_DEFAULT     (COETCR0_TXIP | COETCR0_TXTCP | \
0447                      COETCR0_TXUDP | COETCR0_TXTCPV6 | \
0448                      COETCR0_TXUDPV6)
0449 #define P4_COETCR1  (0x98)
0450     #define COETCR1_TX64TE      BIT(0)
0451     #define COETCR1_TXPPPE      BIT(1)
0452 
0453 #define P4_COECEDR  (0x9A)
0454 #define P4_L2CECR   (0x9C)
0455 
0456     /* Definition of PAGE5 */
0457 #define P5_WFTR     (0xA2)
0458     #define WFTR_2MS        (0x01)
0459     #define WFTR_4MS        (0x02)
0460     #define WFTR_8MS        (0x03)
0461     #define WFTR_16MS       (0x04)
0462     #define WFTR_32MS       (0x05)
0463     #define WFTR_64MS       (0x06)
0464     #define WFTR_128MS      (0x07)
0465     #define WFTR_256MS      (0x08)
0466     #define WFTR_512MS      (0x09)
0467     #define WFTR_1024MS     (0x0A)
0468     #define WFTR_2048MS     (0x0B)
0469     #define WFTR_4096MS     (0x0C)
0470     #define WFTR_8192MS     (0x0D)
0471     #define WFTR_16384MS        (0x0E)
0472     #define WFTR_32768MS        (0x0F)
0473 #define P5_WFCCR    (0xA4)
0474 #define P5_WFCR03   (0xA6)
0475     #define WFCR03_F0_EN        BIT(0)
0476     #define WFCR03_F1_EN        BIT(4)
0477     #define WFCR03_F2_EN        BIT(8)
0478     #define WFCR03_F3_EN        BIT(12)
0479 #define P5_WFCR47   (0xA8)
0480     #define WFCR47_F4_EN        BIT(0)
0481     #define WFCR47_F5_EN        BIT(4)
0482     #define WFCR47_F6_EN        BIT(8)
0483     #define WFCR47_F7_EN        BIT(12)
0484 #define P5_WF0BMR0  (0xAA)
0485 #define P5_WF0BMR1  (0xAC)
0486 #define P5_WF0CR    (0xAE)
0487 #define P5_WF0OBR   (0xB0)
0488 #define P5_WF1BMR0  (0xB2)
0489 #define P5_WF1BMR1  (0xB4)
0490 #define P5_WF1CR    (0xB6)
0491 #define P5_WF1OBR   (0xB8)
0492 #define P5_WF2BMR0  (0xBA)
0493 #define P5_WF2BMR1  (0xBC)
0494 
0495     /* Definition of PAGE6 */
0496 #define P6_WF2CR    (0xC2)
0497 #define P6_WF2OBR   (0xC4)
0498 #define P6_WF3BMR0  (0xC6)
0499 #define P6_WF3BMR1  (0xC8)
0500 #define P6_WF3CR    (0xCA)
0501 #define P6_WF3OBR   (0xCC)
0502 #define P6_WF4BMR0  (0xCE)
0503 #define P6_WF4BMR1  (0xD0)
0504 #define P6_WF4CR    (0xD2)
0505 #define P6_WF4OBR   (0xD4)
0506 #define P6_WF5BMR0  (0xD6)
0507 #define P6_WF5BMR1  (0xD8)
0508 #define P6_WF5CR    (0xDA)
0509 #define P6_WF5OBR   (0xDC)
0510 
0511 /* Definition of PAGE7 */
0512 #define P7_WF6BMR0  (0xE2)
0513 #define P7_WF6BMR1  (0xE4)
0514 #define P7_WF6CR    (0xE6)
0515 #define P7_WF6OBR   (0xE8)
0516 #define P7_WF7BMR0  (0xEA)
0517 #define P7_WF7BMR1  (0xEC)
0518 #define P7_WF7CR    (0xEE)
0519 #define P7_WF7OBR   (0xF0)
0520 #define P7_WFR01    (0xF2)
0521 #define P7_WFR23    (0xF4)
0522 #define P7_WFR45    (0xF6)
0523 #define P7_WFR67    (0xF8)
0524 #define P7_WFPC0    (0xFA)
0525 #define P7_WFPC1    (0xFC)
0526 
0527 /* Tx headers structure */
0528 struct tx_sop_header {
0529     /* bit 15-11: flags, bit 10-0: packet length */
0530     u16 flags_len;
0531     /* bit 15-11: sequence number, bit 11-0: packet length bar */
0532     u16 seq_lenbar;
0533 };
0534 
0535 struct tx_segment_header {
0536     /* bit 15-14: flags, bit 13-11: segment number */
0537     /* bit 10-0: segment length */
0538     u16 flags_seqnum_seglen;
0539     /* bit 15-14: end offset, bit 13-11: start offset */
0540     /* bit 10-0: segment length bar */
0541     u16 eo_so_seglenbar;
0542 };
0543 
0544 struct tx_eop_header {
0545     /* bit 15-11: sequence number, bit 10-0: packet length */
0546     u16 seq_len;
0547     /* bit 15-11: sequence number bar, bit 10-0: packet length bar */
0548     u16 seqbar_lenbar;
0549 };
0550 
0551 struct tx_pkt_info {
0552     struct tx_sop_header sop;
0553     struct tx_segment_header seg;
0554     struct tx_eop_header eop;
0555     u16 pkt_len;
0556     u16 seq_num;
0557 };
0558 
0559 /* Rx headers structure */
0560 struct rx_header {
0561     u16 flags_len;
0562     u16 seq_lenbar;
0563     u16 flags;
0564 };
0565 
0566 extern unsigned long ax88796c_no_regs_mask[];
0567 
0568 #endif /* #ifndef _AX88796C_MAIN_H */