18a3b7a25Sdanborkmann@iogearbox.net /* 28a3b7a25Sdanborkmann@iogearbox.net * Definitions for Xilinx Axi Ethernet device driver. 38a3b7a25Sdanborkmann@iogearbox.net * 48a3b7a25Sdanborkmann@iogearbox.net * Copyright (c) 2009 Secret Lab Technologies, Ltd. 5*59a54f30SMichal Simek * Copyright (c) 2010 - 2012 Xilinx, Inc. All rights reserved. 68a3b7a25Sdanborkmann@iogearbox.net */ 78a3b7a25Sdanborkmann@iogearbox.net 88a3b7a25Sdanborkmann@iogearbox.net #ifndef XILINX_AXIENET_H 98a3b7a25Sdanborkmann@iogearbox.net #define XILINX_AXIENET_H 108a3b7a25Sdanborkmann@iogearbox.net 118a3b7a25Sdanborkmann@iogearbox.net #include <linux/netdevice.h> 128a3b7a25Sdanborkmann@iogearbox.net #include <linux/spinlock.h> 138a3b7a25Sdanborkmann@iogearbox.net #include <linux/interrupt.h> 148a3b7a25Sdanborkmann@iogearbox.net 158a3b7a25Sdanborkmann@iogearbox.net /* Packet size info */ 168a3b7a25Sdanborkmann@iogearbox.net #define XAE_HDR_SIZE 14 /* Size of Ethernet header */ 178a3b7a25Sdanborkmann@iogearbox.net #define XAE_HDR_VLAN_SIZE 18 /* Size of an Ethernet hdr + VLAN */ 188a3b7a25Sdanborkmann@iogearbox.net #define XAE_TRL_SIZE 4 /* Size of Ethernet trailer (FCS) */ 198a3b7a25Sdanborkmann@iogearbox.net #define XAE_MTU 1500 /* Max MTU of an Ethernet frame */ 208a3b7a25Sdanborkmann@iogearbox.net #define XAE_JUMBO_MTU 9000 /* Max MTU of a jumbo Eth. frame */ 218a3b7a25Sdanborkmann@iogearbox.net 228a3b7a25Sdanborkmann@iogearbox.net #define XAE_MAX_FRAME_SIZE (XAE_MTU + XAE_HDR_SIZE + XAE_TRL_SIZE) 238a3b7a25Sdanborkmann@iogearbox.net #define XAE_MAX_VLAN_FRAME_SIZE (XAE_MTU + XAE_HDR_VLAN_SIZE + XAE_TRL_SIZE) 248a3b7a25Sdanborkmann@iogearbox.net #define XAE_MAX_JUMBO_FRAME_SIZE (XAE_JUMBO_MTU + XAE_HDR_SIZE + XAE_TRL_SIZE) 258a3b7a25Sdanborkmann@iogearbox.net 268a3b7a25Sdanborkmann@iogearbox.net /* Configuration options */ 278a3b7a25Sdanborkmann@iogearbox.net 288a3b7a25Sdanborkmann@iogearbox.net /* Accept all incoming packets. Default: disabled (cleared) */ 298a3b7a25Sdanborkmann@iogearbox.net #define XAE_OPTION_PROMISC (1 << 0) 308a3b7a25Sdanborkmann@iogearbox.net 318a3b7a25Sdanborkmann@iogearbox.net /* Jumbo frame support for Tx & Rx. Default: disabled (cleared) */ 328a3b7a25Sdanborkmann@iogearbox.net #define XAE_OPTION_JUMBO (1 << 1) 338a3b7a25Sdanborkmann@iogearbox.net 348a3b7a25Sdanborkmann@iogearbox.net /* VLAN Rx & Tx frame support. Default: disabled (cleared) */ 358a3b7a25Sdanborkmann@iogearbox.net #define XAE_OPTION_VLAN (1 << 2) 368a3b7a25Sdanborkmann@iogearbox.net 378a3b7a25Sdanborkmann@iogearbox.net /* Enable recognition of flow control frames on Rx. Default: enabled (set) */ 388a3b7a25Sdanborkmann@iogearbox.net #define XAE_OPTION_FLOW_CONTROL (1 << 4) 398a3b7a25Sdanborkmann@iogearbox.net 408a3b7a25Sdanborkmann@iogearbox.net /* Strip FCS and PAD from incoming frames. Note: PAD from VLAN frames is not 418a3b7a25Sdanborkmann@iogearbox.net * stripped. Default: disabled (set) */ 428a3b7a25Sdanborkmann@iogearbox.net #define XAE_OPTION_FCS_STRIP (1 << 5) 438a3b7a25Sdanborkmann@iogearbox.net 448a3b7a25Sdanborkmann@iogearbox.net /* Generate FCS field and add PAD automatically for outgoing frames. 458a3b7a25Sdanborkmann@iogearbox.net * Default: enabled (set) */ 468a3b7a25Sdanborkmann@iogearbox.net #define XAE_OPTION_FCS_INSERT (1 << 6) 478a3b7a25Sdanborkmann@iogearbox.net 488a3b7a25Sdanborkmann@iogearbox.net /* Enable Length/Type error checking for incoming frames. When this option is 498a3b7a25Sdanborkmann@iogearbox.net * set, the MAC will filter frames that have a mismatched type/length field 508a3b7a25Sdanborkmann@iogearbox.net * and if XAE_OPTION_REPORT_RXERR is set, the user is notified when these 518a3b7a25Sdanborkmann@iogearbox.net * types of frames are encountered. When this option is cleared, the MAC will 528a3b7a25Sdanborkmann@iogearbox.net * allow these types of frames to be received. Default: enabled (set) */ 538a3b7a25Sdanborkmann@iogearbox.net #define XAE_OPTION_LENTYPE_ERR (1 << 7) 548a3b7a25Sdanborkmann@iogearbox.net 558a3b7a25Sdanborkmann@iogearbox.net /* Enable the transmitter. Default: enabled (set) */ 568a3b7a25Sdanborkmann@iogearbox.net #define XAE_OPTION_TXEN (1 << 11) 578a3b7a25Sdanborkmann@iogearbox.net 588a3b7a25Sdanborkmann@iogearbox.net /* Enable the receiver. Default: enabled (set) */ 598a3b7a25Sdanborkmann@iogearbox.net #define XAE_OPTION_RXEN (1 << 12) 608a3b7a25Sdanborkmann@iogearbox.net 618a3b7a25Sdanborkmann@iogearbox.net /* Default options set when device is initialized or reset */ 628a3b7a25Sdanborkmann@iogearbox.net #define XAE_OPTION_DEFAULTS \ 638a3b7a25Sdanborkmann@iogearbox.net (XAE_OPTION_TXEN | \ 648a3b7a25Sdanborkmann@iogearbox.net XAE_OPTION_FLOW_CONTROL | \ 658a3b7a25Sdanborkmann@iogearbox.net XAE_OPTION_RXEN) 668a3b7a25Sdanborkmann@iogearbox.net 678a3b7a25Sdanborkmann@iogearbox.net /* Axi DMA Register definitions */ 688a3b7a25Sdanborkmann@iogearbox.net 698a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_TX_CR_OFFSET 0x00000000 /* Channel control */ 708a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_TX_SR_OFFSET 0x00000004 /* Status */ 718a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_TX_CDESC_OFFSET 0x00000008 /* Current descriptor pointer */ 728a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_TX_TDESC_OFFSET 0x00000010 /* Tail descriptor pointer */ 738a3b7a25Sdanborkmann@iogearbox.net 748a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_RX_CR_OFFSET 0x00000030 /* Channel control */ 758a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_RX_SR_OFFSET 0x00000034 /* Status */ 768a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_RX_CDESC_OFFSET 0x00000038 /* Current descriptor pointer */ 778a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_RX_TDESC_OFFSET 0x00000040 /* Tail descriptor pointer */ 788a3b7a25Sdanborkmann@iogearbox.net 798a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_CR_RUNSTOP_MASK 0x00000001 /* Start/stop DMA channel */ 808a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_CR_RESET_MASK 0x00000004 /* Reset DMA engine */ 818a3b7a25Sdanborkmann@iogearbox.net 828a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_NDESC_OFFSET 0x00 /* Next descriptor pointer */ 838a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_BUFA_OFFSET 0x08 /* Buffer address */ 848a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_CTRL_LEN_OFFSET 0x18 /* Control/buffer length */ 858a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_STS_OFFSET 0x1C /* Status */ 868a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_USR0_OFFSET 0x20 /* User IP specific word0 */ 878a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_USR1_OFFSET 0x24 /* User IP specific word1 */ 888a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_USR2_OFFSET 0x28 /* User IP specific word2 */ 898a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_USR3_OFFSET 0x2C /* User IP specific word3 */ 908a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_USR4_OFFSET 0x30 /* User IP specific word4 */ 918a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_ID_OFFSET 0x34 /* Sw ID */ 928a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_HAS_STSCNTRL_OFFSET 0x38 /* Whether has stscntrl strm */ 938a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_HAS_DRE_OFFSET 0x3C /* Whether has DRE */ 948a3b7a25Sdanborkmann@iogearbox.net 958a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_HAS_DRE_SHIFT 8 /* Whether has DRE shift */ 968a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_HAS_DRE_MASK 0xF00 /* Whether has DRE mask */ 978a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_WORDLEN_MASK 0xFF /* Whether has DRE mask */ 988a3b7a25Sdanborkmann@iogearbox.net 998a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_CTRL_LENGTH_MASK 0x007FFFFF /* Requested len */ 1008a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_CTRL_TXSOF_MASK 0x08000000 /* First tx packet */ 1018a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_CTRL_TXEOF_MASK 0x04000000 /* Last tx packet */ 1028a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_CTRL_ALL_MASK 0x0C000000 /* All control bits */ 1038a3b7a25Sdanborkmann@iogearbox.net 1048a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_DELAY_MASK 0xFF000000 /* Delay timeout counter */ 1058a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_COALESCE_MASK 0x00FF0000 /* Coalesce counter */ 1068a3b7a25Sdanborkmann@iogearbox.net 1078a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_DELAY_SHIFT 24 1088a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_COALESCE_SHIFT 16 1098a3b7a25Sdanborkmann@iogearbox.net 1108a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_IRQ_IOC_MASK 0x00001000 /* Completion intr */ 1118a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_IRQ_DELAY_MASK 0x00002000 /* Delay interrupt */ 1128a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_IRQ_ERROR_MASK 0x00004000 /* Error interrupt */ 1138a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_IRQ_ALL_MASK 0x00007000 /* All interrupts */ 1148a3b7a25Sdanborkmann@iogearbox.net 1158a3b7a25Sdanborkmann@iogearbox.net /* Default TX/RX Threshold and waitbound values for SGDMA mode */ 1168a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_DFT_TX_THRESHOLD 24 1178a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_DFT_TX_WAITBOUND 254 1188a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_DFT_RX_THRESHOLD 24 1198a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_DFT_RX_WAITBOUND 254 1208a3b7a25Sdanborkmann@iogearbox.net 1218a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_CTRL_TXSOF_MASK 0x08000000 /* First tx packet */ 1228a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_CTRL_TXEOF_MASK 0x04000000 /* Last tx packet */ 1238a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_CTRL_ALL_MASK 0x0C000000 /* All control bits */ 1248a3b7a25Sdanborkmann@iogearbox.net 1258a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_STS_ACTUAL_LEN_MASK 0x007FFFFF /* Actual len */ 1268a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_STS_COMPLETE_MASK 0x80000000 /* Completed */ 1278a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_STS_DEC_ERR_MASK 0x40000000 /* Decode error */ 1288a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_STS_SLV_ERR_MASK 0x20000000 /* Slave error */ 1298a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_STS_INT_ERR_MASK 0x10000000 /* Internal err */ 1308a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_STS_ALL_ERR_MASK 0x70000000 /* All errors */ 1318a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_STS_RXSOF_MASK 0x08000000 /* First rx pkt */ 1328a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_STS_RXEOF_MASK 0x04000000 /* Last rx pkt */ 1338a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_STS_ALL_MASK 0xFC000000 /* All status bits */ 1348a3b7a25Sdanborkmann@iogearbox.net 1358a3b7a25Sdanborkmann@iogearbox.net #define XAXIDMA_BD_MINIMUM_ALIGNMENT 0x40 1368a3b7a25Sdanborkmann@iogearbox.net 1378a3b7a25Sdanborkmann@iogearbox.net /* Axi Ethernet registers definition */ 1388a3b7a25Sdanborkmann@iogearbox.net #define XAE_RAF_OFFSET 0x00000000 /* Reset and Address filter */ 1398a3b7a25Sdanborkmann@iogearbox.net #define XAE_TPF_OFFSET 0x00000004 /* Tx Pause Frame */ 1408a3b7a25Sdanborkmann@iogearbox.net #define XAE_IFGP_OFFSET 0x00000008 /* Tx Inter-frame gap adjustment*/ 1418a3b7a25Sdanborkmann@iogearbox.net #define XAE_IS_OFFSET 0x0000000C /* Interrupt status */ 1428a3b7a25Sdanborkmann@iogearbox.net #define XAE_IP_OFFSET 0x00000010 /* Interrupt pending */ 1438a3b7a25Sdanborkmann@iogearbox.net #define XAE_IE_OFFSET 0x00000014 /* Interrupt enable */ 1448a3b7a25Sdanborkmann@iogearbox.net #define XAE_TTAG_OFFSET 0x00000018 /* Tx VLAN TAG */ 1458a3b7a25Sdanborkmann@iogearbox.net #define XAE_RTAG_OFFSET 0x0000001C /* Rx VLAN TAG */ 1468a3b7a25Sdanborkmann@iogearbox.net #define XAE_UAWL_OFFSET 0x00000020 /* Unicast address word lower */ 1478a3b7a25Sdanborkmann@iogearbox.net #define XAE_UAWU_OFFSET 0x00000024 /* Unicast address word upper */ 1488a3b7a25Sdanborkmann@iogearbox.net #define XAE_TPID0_OFFSET 0x00000028 /* VLAN TPID0 register */ 1498a3b7a25Sdanborkmann@iogearbox.net #define XAE_TPID1_OFFSET 0x0000002C /* VLAN TPID1 register */ 1508a3b7a25Sdanborkmann@iogearbox.net #define XAE_PPST_OFFSET 0x00000030 /* PCS PMA Soft Temac Status Reg */ 1518a3b7a25Sdanborkmann@iogearbox.net #define XAE_RCW0_OFFSET 0x00000400 /* Rx Configuration Word 0 */ 1528a3b7a25Sdanborkmann@iogearbox.net #define XAE_RCW1_OFFSET 0x00000404 /* Rx Configuration Word 1 */ 1538a3b7a25Sdanborkmann@iogearbox.net #define XAE_TC_OFFSET 0x00000408 /* Tx Configuration */ 1548a3b7a25Sdanborkmann@iogearbox.net #define XAE_FCC_OFFSET 0x0000040C /* Flow Control Configuration */ 1558a3b7a25Sdanborkmann@iogearbox.net #define XAE_EMMC_OFFSET 0x00000410 /* EMAC mode configuration */ 1568a3b7a25Sdanborkmann@iogearbox.net #define XAE_PHYC_OFFSET 0x00000414 /* RGMII/SGMII configuration */ 1578a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_MC_OFFSET 0x00000500 /* MII Management Config */ 1588a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_MCR_OFFSET 0x00000504 /* MII Management Control */ 1598a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_MWD_OFFSET 0x00000508 /* MII Management Write Data */ 1608a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_MRD_OFFSET 0x0000050C /* MII Management Read Data */ 1618a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_MIS_OFFSET 0x00000600 /* MII Management Interrupt Status */ 1628a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_MIP_OFFSET 0x00000620 /* MII Mgmt Interrupt Pending 1638a3b7a25Sdanborkmann@iogearbox.net * register offset */ 1648a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_MIE_OFFSET 0x00000640 /* MII Management Interrupt Enable 1658a3b7a25Sdanborkmann@iogearbox.net * register offset */ 1668a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_MIC_OFFSET 0x00000660 /* MII Management Interrupt Clear 1678a3b7a25Sdanborkmann@iogearbox.net * register offset. */ 1688a3b7a25Sdanborkmann@iogearbox.net #define XAE_UAW0_OFFSET 0x00000700 /* Unicast address word 0 */ 1698a3b7a25Sdanborkmann@iogearbox.net #define XAE_UAW1_OFFSET 0x00000704 /* Unicast address word 1 */ 1708a3b7a25Sdanborkmann@iogearbox.net #define XAE_FMI_OFFSET 0x00000708 /* Filter Mask Index */ 1718a3b7a25Sdanborkmann@iogearbox.net #define XAE_AF0_OFFSET 0x00000710 /* Address Filter 0 */ 1728a3b7a25Sdanborkmann@iogearbox.net #define XAE_AF1_OFFSET 0x00000714 /* Address Filter 1 */ 1738a3b7a25Sdanborkmann@iogearbox.net 1748a3b7a25Sdanborkmann@iogearbox.net #define XAE_TX_VLAN_DATA_OFFSET 0x00004000 /* TX VLAN data table address */ 1758a3b7a25Sdanborkmann@iogearbox.net #define XAE_RX_VLAN_DATA_OFFSET 0x00008000 /* RX VLAN data table address */ 1768a3b7a25Sdanborkmann@iogearbox.net #define XAE_MCAST_TABLE_OFFSET 0x00020000 /* Multicast table address */ 1778a3b7a25Sdanborkmann@iogearbox.net 1788a3b7a25Sdanborkmann@iogearbox.net /* Bit Masks for Axi Ethernet RAF register */ 1798a3b7a25Sdanborkmann@iogearbox.net #define XAE_RAF_MCSTREJ_MASK 0x00000002 /* Reject receive multicast 1808a3b7a25Sdanborkmann@iogearbox.net * destination address */ 1818a3b7a25Sdanborkmann@iogearbox.net #define XAE_RAF_BCSTREJ_MASK 0x00000004 /* Reject receive broadcast 1828a3b7a25Sdanborkmann@iogearbox.net * destination address */ 1838a3b7a25Sdanborkmann@iogearbox.net #define XAE_RAF_TXVTAGMODE_MASK 0x00000018 /* Tx VLAN TAG mode */ 1848a3b7a25Sdanborkmann@iogearbox.net #define XAE_RAF_RXVTAGMODE_MASK 0x00000060 /* Rx VLAN TAG mode */ 1858a3b7a25Sdanborkmann@iogearbox.net #define XAE_RAF_TXVSTRPMODE_MASK 0x00000180 /* Tx VLAN STRIP mode */ 1868a3b7a25Sdanborkmann@iogearbox.net #define XAE_RAF_RXVSTRPMODE_MASK 0x00000600 /* Rx VLAN STRIP mode */ 1878a3b7a25Sdanborkmann@iogearbox.net #define XAE_RAF_NEWFNCENBL_MASK 0x00000800 /* New function mode */ 1888a3b7a25Sdanborkmann@iogearbox.net #define XAE_RAF_EMULTIFLTRENBL_MASK 0x00001000 /* Exteneded Multicast 1898a3b7a25Sdanborkmann@iogearbox.net * Filtering mode 1908a3b7a25Sdanborkmann@iogearbox.net */ 1918a3b7a25Sdanborkmann@iogearbox.net #define XAE_RAF_STATSRST_MASK 0x00002000 /* Stats. Counter Reset */ 1928a3b7a25Sdanborkmann@iogearbox.net #define XAE_RAF_RXBADFRMEN_MASK 0x00004000 /* Recv Bad Frame Enable */ 1938a3b7a25Sdanborkmann@iogearbox.net #define XAE_RAF_TXVTAGMODE_SHIFT 3 /* Tx Tag mode shift bits */ 1948a3b7a25Sdanborkmann@iogearbox.net #define XAE_RAF_RXVTAGMODE_SHIFT 5 /* Rx Tag mode shift bits */ 1958a3b7a25Sdanborkmann@iogearbox.net #define XAE_RAF_TXVSTRPMODE_SHIFT 7 /* Tx strip mode shift bits*/ 1968a3b7a25Sdanborkmann@iogearbox.net #define XAE_RAF_RXVSTRPMODE_SHIFT 9 /* Rx Strip mode shift bits*/ 1978a3b7a25Sdanborkmann@iogearbox.net 1988a3b7a25Sdanborkmann@iogearbox.net /* Bit Masks for Axi Ethernet TPF and IFGP registers */ 1998a3b7a25Sdanborkmann@iogearbox.net #define XAE_TPF_TPFV_MASK 0x0000FFFF /* Tx pause frame value */ 2008a3b7a25Sdanborkmann@iogearbox.net #define XAE_IFGP0_IFGP_MASK 0x0000007F /* Transmit inter-frame 2018a3b7a25Sdanborkmann@iogearbox.net * gap adjustment value */ 2028a3b7a25Sdanborkmann@iogearbox.net 2038a3b7a25Sdanborkmann@iogearbox.net /* Bit Masks for Axi Ethernet IS, IE and IP registers, Same masks apply 2048a3b7a25Sdanborkmann@iogearbox.net * for all 3 registers. */ 2058a3b7a25Sdanborkmann@iogearbox.net #define XAE_INT_HARDACSCMPLT_MASK 0x00000001 /* Hard register access 2068a3b7a25Sdanborkmann@iogearbox.net * complete */ 2078a3b7a25Sdanborkmann@iogearbox.net #define XAE_INT_AUTONEG_MASK 0x00000002 /* Auto negotiation 2088a3b7a25Sdanborkmann@iogearbox.net * complete */ 2098a3b7a25Sdanborkmann@iogearbox.net #define XAE_INT_RXCMPIT_MASK 0x00000004 /* Rx complete */ 2108a3b7a25Sdanborkmann@iogearbox.net #define XAE_INT_RXRJECT_MASK 0x00000008 /* Rx frame rejected */ 2118a3b7a25Sdanborkmann@iogearbox.net #define XAE_INT_RXFIFOOVR_MASK 0x00000010 /* Rx fifo overrun */ 2128a3b7a25Sdanborkmann@iogearbox.net #define XAE_INT_TXCMPIT_MASK 0x00000020 /* Tx complete */ 2138a3b7a25Sdanborkmann@iogearbox.net #define XAE_INT_RXDCMLOCK_MASK 0x00000040 /* Rx Dcm Lock */ 2148a3b7a25Sdanborkmann@iogearbox.net #define XAE_INT_MGTRDY_MASK 0x00000080 /* MGT clock Lock */ 2158a3b7a25Sdanborkmann@iogearbox.net #define XAE_INT_PHYRSTCMPLT_MASK 0x00000100 /* Phy Reset complete */ 2168a3b7a25Sdanborkmann@iogearbox.net #define XAE_INT_ALL_MASK 0x0000003F /* All the ints */ 2178a3b7a25Sdanborkmann@iogearbox.net 2188a3b7a25Sdanborkmann@iogearbox.net #define XAE_INT_RECV_ERROR_MASK \ 2198a3b7a25Sdanborkmann@iogearbox.net (XAE_INT_RXRJECT_MASK | XAE_INT_RXFIFOOVR_MASK) /* INT bits that 2208a3b7a25Sdanborkmann@iogearbox.net * indicate receive 2218a3b7a25Sdanborkmann@iogearbox.net * errors */ 2228a3b7a25Sdanborkmann@iogearbox.net 2238a3b7a25Sdanborkmann@iogearbox.net /* Bit masks for Axi Ethernet VLAN TPID Word 0 register */ 2248a3b7a25Sdanborkmann@iogearbox.net #define XAE_TPID_0_MASK 0x0000FFFF /* TPID 0 */ 2258a3b7a25Sdanborkmann@iogearbox.net #define XAE_TPID_1_MASK 0xFFFF0000 /* TPID 1 */ 2268a3b7a25Sdanborkmann@iogearbox.net 2278a3b7a25Sdanborkmann@iogearbox.net /* Bit masks for Axi Ethernet VLAN TPID Word 1 register */ 2288a3b7a25Sdanborkmann@iogearbox.net #define XAE_TPID_2_MASK 0x0000FFFF /* TPID 0 */ 2298a3b7a25Sdanborkmann@iogearbox.net #define XAE_TPID_3_MASK 0xFFFF0000 /* TPID 1 */ 2308a3b7a25Sdanborkmann@iogearbox.net 2318a3b7a25Sdanborkmann@iogearbox.net /* Bit masks for Axi Ethernet RCW1 register */ 2328a3b7a25Sdanborkmann@iogearbox.net #define XAE_RCW1_RST_MASK 0x80000000 /* Reset */ 2338a3b7a25Sdanborkmann@iogearbox.net #define XAE_RCW1_JUM_MASK 0x40000000 /* Jumbo frame enable */ 2348a3b7a25Sdanborkmann@iogearbox.net #define XAE_RCW1_FCS_MASK 0x20000000 /* In-Band FCS enable 2358a3b7a25Sdanborkmann@iogearbox.net * (FCS not stripped) */ 2368a3b7a25Sdanborkmann@iogearbox.net #define XAE_RCW1_RX_MASK 0x10000000 /* Receiver enable */ 2378a3b7a25Sdanborkmann@iogearbox.net #define XAE_RCW1_VLAN_MASK 0x08000000 /* VLAN frame enable */ 2388a3b7a25Sdanborkmann@iogearbox.net #define XAE_RCW1_LT_DIS_MASK 0x02000000 /* Length/type field valid check 2398a3b7a25Sdanborkmann@iogearbox.net * disable */ 2408a3b7a25Sdanborkmann@iogearbox.net #define XAE_RCW1_CL_DIS_MASK 0x01000000 /* Control frame Length check 2418a3b7a25Sdanborkmann@iogearbox.net * disable */ 2428a3b7a25Sdanborkmann@iogearbox.net #define XAE_RCW1_PAUSEADDR_MASK 0x0000FFFF /* Pause frame source address 2438a3b7a25Sdanborkmann@iogearbox.net * bits [47:32]. Bits [31:0] are 2448a3b7a25Sdanborkmann@iogearbox.net * stored in register RCW0 */ 2458a3b7a25Sdanborkmann@iogearbox.net 2468a3b7a25Sdanborkmann@iogearbox.net /* Bit masks for Axi Ethernet TC register */ 2478a3b7a25Sdanborkmann@iogearbox.net #define XAE_TC_RST_MASK 0x80000000 /* Reset */ 2488a3b7a25Sdanborkmann@iogearbox.net #define XAE_TC_JUM_MASK 0x40000000 /* Jumbo frame enable */ 2498a3b7a25Sdanborkmann@iogearbox.net #define XAE_TC_FCS_MASK 0x20000000 /* In-Band FCS enable 2508a3b7a25Sdanborkmann@iogearbox.net * (FCS not generated) */ 2518a3b7a25Sdanborkmann@iogearbox.net #define XAE_TC_TX_MASK 0x10000000 /* Transmitter enable */ 2528a3b7a25Sdanborkmann@iogearbox.net #define XAE_TC_VLAN_MASK 0x08000000 /* VLAN frame enable */ 2538a3b7a25Sdanborkmann@iogearbox.net #define XAE_TC_IFG_MASK 0x02000000 /* Inter-frame gap adjustment 2548a3b7a25Sdanborkmann@iogearbox.net * enable */ 2558a3b7a25Sdanborkmann@iogearbox.net 2568a3b7a25Sdanborkmann@iogearbox.net /* Bit masks for Axi Ethernet FCC register */ 2578a3b7a25Sdanborkmann@iogearbox.net #define XAE_FCC_FCRX_MASK 0x20000000 /* Rx flow control enable */ 2588a3b7a25Sdanborkmann@iogearbox.net #define XAE_FCC_FCTX_MASK 0x40000000 /* Tx flow control enable */ 2598a3b7a25Sdanborkmann@iogearbox.net 2608a3b7a25Sdanborkmann@iogearbox.net /* Bit masks for Axi Ethernet EMMC register */ 2618a3b7a25Sdanborkmann@iogearbox.net #define XAE_EMMC_LINKSPEED_MASK 0xC0000000 /* Link speed */ 2628a3b7a25Sdanborkmann@iogearbox.net #define XAE_EMMC_RGMII_MASK 0x20000000 /* RGMII mode enable */ 2638a3b7a25Sdanborkmann@iogearbox.net #define XAE_EMMC_SGMII_MASK 0x10000000 /* SGMII mode enable */ 2648a3b7a25Sdanborkmann@iogearbox.net #define XAE_EMMC_GPCS_MASK 0x08000000 /* 1000BaseX mode enable */ 2658a3b7a25Sdanborkmann@iogearbox.net #define XAE_EMMC_HOST_MASK 0x04000000 /* Host interface enable */ 2668a3b7a25Sdanborkmann@iogearbox.net #define XAE_EMMC_TX16BIT 0x02000000 /* 16 bit Tx client enable */ 2678a3b7a25Sdanborkmann@iogearbox.net #define XAE_EMMC_RX16BIT 0x01000000 /* 16 bit Rx client enable */ 2688a3b7a25Sdanborkmann@iogearbox.net #define XAE_EMMC_LINKSPD_10 0x00000000 /* Link Speed mask for 10 Mbit */ 2698a3b7a25Sdanborkmann@iogearbox.net #define XAE_EMMC_LINKSPD_100 0x40000000 /* Link Speed mask for 100 Mbit */ 2708a3b7a25Sdanborkmann@iogearbox.net #define XAE_EMMC_LINKSPD_1000 0x80000000 /* Link Speed mask for 1000 Mbit */ 2718a3b7a25Sdanborkmann@iogearbox.net 2728a3b7a25Sdanborkmann@iogearbox.net /* Bit masks for Axi Ethernet PHYC register */ 2738a3b7a25Sdanborkmann@iogearbox.net #define XAE_PHYC_SGMIILINKSPEED_MASK 0xC0000000 /* SGMII link speed mask*/ 2748a3b7a25Sdanborkmann@iogearbox.net #define XAE_PHYC_RGMIILINKSPEED_MASK 0x0000000C /* RGMII link speed */ 2758a3b7a25Sdanborkmann@iogearbox.net #define XAE_PHYC_RGMIIHD_MASK 0x00000002 /* RGMII Half-duplex */ 2768a3b7a25Sdanborkmann@iogearbox.net #define XAE_PHYC_RGMIILINK_MASK 0x00000001 /* RGMII link status */ 2778a3b7a25Sdanborkmann@iogearbox.net #define XAE_PHYC_RGLINKSPD_10 0x00000000 /* RGMII link 10 Mbit */ 2788a3b7a25Sdanborkmann@iogearbox.net #define XAE_PHYC_RGLINKSPD_100 0x00000004 /* RGMII link 100 Mbit */ 2798a3b7a25Sdanborkmann@iogearbox.net #define XAE_PHYC_RGLINKSPD_1000 0x00000008 /* RGMII link 1000 Mbit */ 2808a3b7a25Sdanborkmann@iogearbox.net #define XAE_PHYC_SGLINKSPD_10 0x00000000 /* SGMII link 10 Mbit */ 2818a3b7a25Sdanborkmann@iogearbox.net #define XAE_PHYC_SGLINKSPD_100 0x40000000 /* SGMII link 100 Mbit */ 2828a3b7a25Sdanborkmann@iogearbox.net #define XAE_PHYC_SGLINKSPD_1000 0x80000000 /* SGMII link 1000 Mbit */ 2838a3b7a25Sdanborkmann@iogearbox.net 2848a3b7a25Sdanborkmann@iogearbox.net /* Bit masks for Axi Ethernet MDIO interface MC register */ 2858a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_MC_MDIOEN_MASK 0x00000040 /* MII management enable */ 2868a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_MC_CLOCK_DIVIDE_MAX 0x3F /* Maximum MDIO divisor */ 2878a3b7a25Sdanborkmann@iogearbox.net 2888a3b7a25Sdanborkmann@iogearbox.net /* Bit masks for Axi Ethernet MDIO interface MCR register */ 2898a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_MCR_PHYAD_MASK 0x1F000000 /* Phy Address Mask */ 2908a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_MCR_PHYAD_SHIFT 24 /* Phy Address Shift */ 2918a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_MCR_REGAD_MASK 0x001F0000 /* Reg Address Mask */ 2928a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_MCR_REGAD_SHIFT 16 /* Reg Address Shift */ 2938a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_MCR_OP_MASK 0x0000C000 /* Operation Code Mask */ 2948a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_MCR_OP_SHIFT 13 /* Operation Code Shift */ 2958a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_MCR_OP_READ_MASK 0x00008000 /* Op Code Read Mask */ 2968a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_MCR_OP_WRITE_MASK 0x00004000 /* Op Code Write Mask */ 2978a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_MCR_INITIATE_MASK 0x00000800 /* Ready Mask */ 2988a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_MCR_READY_MASK 0x00000080 /* Ready Mask */ 2998a3b7a25Sdanborkmann@iogearbox.net 3008a3b7a25Sdanborkmann@iogearbox.net /* Bit masks for Axi Ethernet MDIO interface MIS, MIP, MIE, MIC registers */ 3018a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_INT_MIIM_RDY_MASK 0x00000001 /* MIIM Interrupt */ 3028a3b7a25Sdanborkmann@iogearbox.net 3038a3b7a25Sdanborkmann@iogearbox.net /* Bit masks for Axi Ethernet UAW1 register */ 3048a3b7a25Sdanborkmann@iogearbox.net #define XAE_UAW1_UNICASTADDR_MASK 0x0000FFFF /* Station address bits 3058a3b7a25Sdanborkmann@iogearbox.net * [47:32]; Station address 3068a3b7a25Sdanborkmann@iogearbox.net * bits [31:0] are stored in 3078a3b7a25Sdanborkmann@iogearbox.net * register UAW0 */ 3088a3b7a25Sdanborkmann@iogearbox.net 3098a3b7a25Sdanborkmann@iogearbox.net /* Bit masks for Axi Ethernet FMI register */ 3108a3b7a25Sdanborkmann@iogearbox.net #define XAE_FMI_PM_MASK 0x80000000 /* Promis. mode enable */ 3118a3b7a25Sdanborkmann@iogearbox.net #define XAE_FMI_IND_MASK 0x00000003 /* Index Mask */ 3128a3b7a25Sdanborkmann@iogearbox.net 3138a3b7a25Sdanborkmann@iogearbox.net #define XAE_MDIO_DIV_DFT 29 /* Default MDIO clock divisor */ 3148a3b7a25Sdanborkmann@iogearbox.net 3158a3b7a25Sdanborkmann@iogearbox.net /* Defines for different options for C_PHY_TYPE parameter in Axi Ethernet IP */ 3168a3b7a25Sdanborkmann@iogearbox.net #define XAE_PHY_TYPE_MII 0 3178a3b7a25Sdanborkmann@iogearbox.net #define XAE_PHY_TYPE_GMII 1 3188a3b7a25Sdanborkmann@iogearbox.net #define XAE_PHY_TYPE_RGMII_1_3 2 3198a3b7a25Sdanborkmann@iogearbox.net #define XAE_PHY_TYPE_RGMII_2_0 3 3208a3b7a25Sdanborkmann@iogearbox.net #define XAE_PHY_TYPE_SGMII 4 3218a3b7a25Sdanborkmann@iogearbox.net #define XAE_PHY_TYPE_1000BASE_X 5 3228a3b7a25Sdanborkmann@iogearbox.net 3238a3b7a25Sdanborkmann@iogearbox.net #define XAE_MULTICAST_CAM_TABLE_NUM 4 /* Total number of entries in the 3248a3b7a25Sdanborkmann@iogearbox.net * hardware multicast table. */ 3258a3b7a25Sdanborkmann@iogearbox.net 3268a3b7a25Sdanborkmann@iogearbox.net /* Axi Ethernet Synthesis features */ 3278a3b7a25Sdanborkmann@iogearbox.net #define XAE_FEATURE_PARTIAL_RX_CSUM (1 << 0) 3288a3b7a25Sdanborkmann@iogearbox.net #define XAE_FEATURE_PARTIAL_TX_CSUM (1 << 1) 3298a3b7a25Sdanborkmann@iogearbox.net #define XAE_FEATURE_FULL_RX_CSUM (1 << 2) 3308a3b7a25Sdanborkmann@iogearbox.net #define XAE_FEATURE_FULL_TX_CSUM (1 << 3) 3318a3b7a25Sdanborkmann@iogearbox.net 3328a3b7a25Sdanborkmann@iogearbox.net #define XAE_NO_CSUM_OFFLOAD 0 3338a3b7a25Sdanborkmann@iogearbox.net 3348a3b7a25Sdanborkmann@iogearbox.net #define XAE_FULL_CSUM_STATUS_MASK 0x00000038 3358a3b7a25Sdanborkmann@iogearbox.net #define XAE_IP_UDP_CSUM_VALIDATED 0x00000003 3368a3b7a25Sdanborkmann@iogearbox.net #define XAE_IP_TCP_CSUM_VALIDATED 0x00000002 3378a3b7a25Sdanborkmann@iogearbox.net 3388a3b7a25Sdanborkmann@iogearbox.net #define DELAY_OF_ONE_MILLISEC 1000 3398a3b7a25Sdanborkmann@iogearbox.net 3408a3b7a25Sdanborkmann@iogearbox.net /** 3418a3b7a25Sdanborkmann@iogearbox.net * struct axidma_bd - Axi Dma buffer descriptor layout 3428a3b7a25Sdanborkmann@iogearbox.net * @next: MM2S/S2MM Next Descriptor Pointer 3438a3b7a25Sdanborkmann@iogearbox.net * @reserved1: Reserved and not used 3448a3b7a25Sdanborkmann@iogearbox.net * @phys: MM2S/S2MM Buffer Address 3458a3b7a25Sdanborkmann@iogearbox.net * @reserved2: Reserved and not used 3468a3b7a25Sdanborkmann@iogearbox.net * @reserved3: Reserved and not used 3478a3b7a25Sdanborkmann@iogearbox.net * @reserved4: Reserved and not used 3488a3b7a25Sdanborkmann@iogearbox.net * @cntrl: MM2S/S2MM Control value 3498a3b7a25Sdanborkmann@iogearbox.net * @status: MM2S/S2MM Status value 3508a3b7a25Sdanborkmann@iogearbox.net * @app0: MM2S/S2MM User Application Field 0. 3518a3b7a25Sdanborkmann@iogearbox.net * @app1: MM2S/S2MM User Application Field 1. 3528a3b7a25Sdanborkmann@iogearbox.net * @app2: MM2S/S2MM User Application Field 2. 3538a3b7a25Sdanborkmann@iogearbox.net * @app3: MM2S/S2MM User Application Field 3. 3548a3b7a25Sdanborkmann@iogearbox.net * @app4: MM2S/S2MM User Application Field 4. 3558a3b7a25Sdanborkmann@iogearbox.net * @sw_id_offset: MM2S/S2MM Sw ID 3568a3b7a25Sdanborkmann@iogearbox.net * @reserved5: Reserved and not used 3578a3b7a25Sdanborkmann@iogearbox.net * @reserved6: Reserved and not used 3588a3b7a25Sdanborkmann@iogearbox.net */ 3598a3b7a25Sdanborkmann@iogearbox.net struct axidma_bd { 3608a3b7a25Sdanborkmann@iogearbox.net u32 next; /* Physical address of next buffer descriptor */ 3618a3b7a25Sdanborkmann@iogearbox.net u32 reserved1; 3628a3b7a25Sdanborkmann@iogearbox.net u32 phys; 3638a3b7a25Sdanborkmann@iogearbox.net u32 reserved2; 3648a3b7a25Sdanborkmann@iogearbox.net u32 reserved3; 3658a3b7a25Sdanborkmann@iogearbox.net u32 reserved4; 3668a3b7a25Sdanborkmann@iogearbox.net u32 cntrl; 3678a3b7a25Sdanborkmann@iogearbox.net u32 status; 3688a3b7a25Sdanborkmann@iogearbox.net u32 app0; 3698a3b7a25Sdanborkmann@iogearbox.net u32 app1; /* TX start << 16 | insert */ 3708a3b7a25Sdanborkmann@iogearbox.net u32 app2; /* TX csum seed */ 3718a3b7a25Sdanborkmann@iogearbox.net u32 app3; 3728a3b7a25Sdanborkmann@iogearbox.net u32 app4; 3738a3b7a25Sdanborkmann@iogearbox.net u32 sw_id_offset; 3748a3b7a25Sdanborkmann@iogearbox.net u32 reserved5; 3758a3b7a25Sdanborkmann@iogearbox.net u32 reserved6; 3768a3b7a25Sdanborkmann@iogearbox.net }; 3778a3b7a25Sdanborkmann@iogearbox.net 3788a3b7a25Sdanborkmann@iogearbox.net /** 3798a3b7a25Sdanborkmann@iogearbox.net * struct axienet_local - axienet private per device data 3808a3b7a25Sdanborkmann@iogearbox.net * @ndev: Pointer for net_device to which it will be attached. 3818a3b7a25Sdanborkmann@iogearbox.net * @dev: Pointer to device structure 3828a3b7a25Sdanborkmann@iogearbox.net * @phy_dev: Pointer to PHY device structure attached to the axienet_local 3838a3b7a25Sdanborkmann@iogearbox.net * @phy_node: Pointer to device node structure 3848a3b7a25Sdanborkmann@iogearbox.net * @mii_bus: Pointer to MII bus structure 3858a3b7a25Sdanborkmann@iogearbox.net * @mdio_irqs: IRQs table for MDIO bus required in mii_bus structure 3868a3b7a25Sdanborkmann@iogearbox.net * @regs: Base address for the axienet_local device address space 3878a3b7a25Sdanborkmann@iogearbox.net * @dma_regs: Base address for the axidma device address space 3888a3b7a25Sdanborkmann@iogearbox.net * @dma_err_tasklet: Tasklet structure to process Axi DMA errors 3898a3b7a25Sdanborkmann@iogearbox.net * @tx_irq: Axidma TX IRQ number 3908a3b7a25Sdanborkmann@iogearbox.net * @rx_irq: Axidma RX IRQ number 3918a3b7a25Sdanborkmann@iogearbox.net * @temac_type: axienet type to identify between soft and hard temac 3928a3b7a25Sdanborkmann@iogearbox.net * @phy_type: Phy type to identify between MII/GMII/RGMII/SGMII/1000 Base-X 3938a3b7a25Sdanborkmann@iogearbox.net * @options: AxiEthernet option word 3948a3b7a25Sdanborkmann@iogearbox.net * @last_link: Phy link state in which the PHY was negotiated earlier 3958a3b7a25Sdanborkmann@iogearbox.net * @features: Stores the extended features supported by the axienet hw 3968a3b7a25Sdanborkmann@iogearbox.net * @tx_bd_v: Virtual address of the TX buffer descriptor ring 3978a3b7a25Sdanborkmann@iogearbox.net * @tx_bd_p: Physical address(start address) of the TX buffer descr. ring 3988a3b7a25Sdanborkmann@iogearbox.net * @rx_bd_v: Virtual address of the RX buffer descriptor ring 3998a3b7a25Sdanborkmann@iogearbox.net * @rx_bd_p: Physical address(start address) of the RX buffer descr. ring 4008a3b7a25Sdanborkmann@iogearbox.net * @tx_bd_ci: Stores the index of the Tx buffer descriptor in the ring being 4018a3b7a25Sdanborkmann@iogearbox.net * accessed currently. Used while alloc. BDs before a TX starts 4028a3b7a25Sdanborkmann@iogearbox.net * @tx_bd_tail: Stores the index of the Tx buffer descriptor in the ring being 4038a3b7a25Sdanborkmann@iogearbox.net * accessed currently. Used while processing BDs after the TX 4048a3b7a25Sdanborkmann@iogearbox.net * completed. 4058a3b7a25Sdanborkmann@iogearbox.net * @rx_bd_ci: Stores the index of the Rx buffer descriptor in the ring being 4068a3b7a25Sdanborkmann@iogearbox.net * accessed currently. 4078a3b7a25Sdanborkmann@iogearbox.net * @max_frm_size: Stores the maximum size of the frame that can be that 4088a3b7a25Sdanborkmann@iogearbox.net * Txed/Rxed in the existing hardware. If jumbo option is 4098a3b7a25Sdanborkmann@iogearbox.net * supported, the maximum frame size would be 9k. Else it is 4108a3b7a25Sdanborkmann@iogearbox.net * 1522 bytes (assuming support for basic VLAN) 4118a3b7a25Sdanborkmann@iogearbox.net * @jumbo_support: Stores hardware configuration for jumbo support. If hardware 4128a3b7a25Sdanborkmann@iogearbox.net * can handle jumbo packets, this entry will be 1, else 0. 4138a3b7a25Sdanborkmann@iogearbox.net */ 4148a3b7a25Sdanborkmann@iogearbox.net struct axienet_local { 4158a3b7a25Sdanborkmann@iogearbox.net struct net_device *ndev; 4168a3b7a25Sdanborkmann@iogearbox.net struct device *dev; 4178a3b7a25Sdanborkmann@iogearbox.net 4188a3b7a25Sdanborkmann@iogearbox.net /* Connection to PHY device */ 4198a3b7a25Sdanborkmann@iogearbox.net struct phy_device *phy_dev; /* Pointer to PHY device */ 4208a3b7a25Sdanborkmann@iogearbox.net struct device_node *phy_node; 4218a3b7a25Sdanborkmann@iogearbox.net 4228a3b7a25Sdanborkmann@iogearbox.net /* MDIO bus data */ 4238a3b7a25Sdanborkmann@iogearbox.net struct mii_bus *mii_bus; /* MII bus reference */ 4248a3b7a25Sdanborkmann@iogearbox.net int mdio_irqs[PHY_MAX_ADDR]; /* IRQs table for MDIO bus */ 4258a3b7a25Sdanborkmann@iogearbox.net 4268a3b7a25Sdanborkmann@iogearbox.net /* IO registers, dma functions and IRQs */ 4278a3b7a25Sdanborkmann@iogearbox.net void __iomem *regs; 4288a3b7a25Sdanborkmann@iogearbox.net void __iomem *dma_regs; 4298a3b7a25Sdanborkmann@iogearbox.net 4308a3b7a25Sdanborkmann@iogearbox.net struct tasklet_struct dma_err_tasklet; 4318a3b7a25Sdanborkmann@iogearbox.net 4328a3b7a25Sdanborkmann@iogearbox.net int tx_irq; 4338a3b7a25Sdanborkmann@iogearbox.net int rx_irq; 4348a3b7a25Sdanborkmann@iogearbox.net u32 temac_type; 4358a3b7a25Sdanborkmann@iogearbox.net u32 phy_type; 4368a3b7a25Sdanborkmann@iogearbox.net 4378a3b7a25Sdanborkmann@iogearbox.net u32 options; /* Current options word */ 4388a3b7a25Sdanborkmann@iogearbox.net u32 last_link; 4398a3b7a25Sdanborkmann@iogearbox.net u32 features; 4408a3b7a25Sdanborkmann@iogearbox.net 4418a3b7a25Sdanborkmann@iogearbox.net /* Buffer descriptors */ 4428a3b7a25Sdanborkmann@iogearbox.net struct axidma_bd *tx_bd_v; 4438a3b7a25Sdanborkmann@iogearbox.net dma_addr_t tx_bd_p; 4448a3b7a25Sdanborkmann@iogearbox.net struct axidma_bd *rx_bd_v; 4458a3b7a25Sdanborkmann@iogearbox.net dma_addr_t rx_bd_p; 4468a3b7a25Sdanborkmann@iogearbox.net u32 tx_bd_ci; 4478a3b7a25Sdanborkmann@iogearbox.net u32 tx_bd_tail; 4488a3b7a25Sdanborkmann@iogearbox.net u32 rx_bd_ci; 4498a3b7a25Sdanborkmann@iogearbox.net 4508a3b7a25Sdanborkmann@iogearbox.net u32 max_frm_size; 4518a3b7a25Sdanborkmann@iogearbox.net u32 jumbo_support; 4528a3b7a25Sdanborkmann@iogearbox.net 4538a3b7a25Sdanborkmann@iogearbox.net int csum_offload_on_tx_path; 4548a3b7a25Sdanborkmann@iogearbox.net int csum_offload_on_rx_path; 4558a3b7a25Sdanborkmann@iogearbox.net 4568a3b7a25Sdanborkmann@iogearbox.net u32 coalesce_count_rx; 4578a3b7a25Sdanborkmann@iogearbox.net u32 coalesce_count_tx; 4588a3b7a25Sdanborkmann@iogearbox.net }; 4598a3b7a25Sdanborkmann@iogearbox.net 4608a3b7a25Sdanborkmann@iogearbox.net /** 4618a3b7a25Sdanborkmann@iogearbox.net * struct axiethernet_option - Used to set axi ethernet hardware options 4628a3b7a25Sdanborkmann@iogearbox.net * @opt: Option to be set. 4638a3b7a25Sdanborkmann@iogearbox.net * @reg: Register offset to be written for setting the option 4648a3b7a25Sdanborkmann@iogearbox.net * @m_or: Mask to be ORed for setting the option in the register 4658a3b7a25Sdanborkmann@iogearbox.net */ 4668a3b7a25Sdanborkmann@iogearbox.net struct axienet_option { 4678a3b7a25Sdanborkmann@iogearbox.net u32 opt; 4688a3b7a25Sdanborkmann@iogearbox.net u32 reg; 4698a3b7a25Sdanborkmann@iogearbox.net u32 m_or; 4708a3b7a25Sdanborkmann@iogearbox.net }; 4718a3b7a25Sdanborkmann@iogearbox.net 4728a3b7a25Sdanborkmann@iogearbox.net /** 4738a3b7a25Sdanborkmann@iogearbox.net * axienet_ior - Memory mapped Axi Ethernet register read 4748a3b7a25Sdanborkmann@iogearbox.net * @lp: Pointer to axienet local structure 4758a3b7a25Sdanborkmann@iogearbox.net * @offset: Address offset from the base address of Axi Ethernet core 4768a3b7a25Sdanborkmann@iogearbox.net * 4778a3b7a25Sdanborkmann@iogearbox.net * returns: The contents of the Axi Ethernet register 4788a3b7a25Sdanborkmann@iogearbox.net * 4798a3b7a25Sdanborkmann@iogearbox.net * This function returns the contents of the corresponding register. 4808a3b7a25Sdanborkmann@iogearbox.net */ 4818a3b7a25Sdanborkmann@iogearbox.net static inline u32 axienet_ior(struct axienet_local *lp, off_t offset) 4828a3b7a25Sdanborkmann@iogearbox.net { 4838a3b7a25Sdanborkmann@iogearbox.net return in_be32(lp->regs + offset); 4848a3b7a25Sdanborkmann@iogearbox.net } 4858a3b7a25Sdanborkmann@iogearbox.net 4868a3b7a25Sdanborkmann@iogearbox.net /** 4878a3b7a25Sdanborkmann@iogearbox.net * axienet_iow - Memory mapped Axi Ethernet register write 4888a3b7a25Sdanborkmann@iogearbox.net * @lp: Pointer to axienet local structure 4898a3b7a25Sdanborkmann@iogearbox.net * @offset: Address offset from the base address of Axi Ethernet core 4908a3b7a25Sdanborkmann@iogearbox.net * @value: Value to be written into the Axi Ethernet register 4918a3b7a25Sdanborkmann@iogearbox.net * 4928a3b7a25Sdanborkmann@iogearbox.net * This function writes the desired value into the corresponding Axi Ethernet 4938a3b7a25Sdanborkmann@iogearbox.net * register. 4948a3b7a25Sdanborkmann@iogearbox.net */ 4958a3b7a25Sdanborkmann@iogearbox.net static inline void axienet_iow(struct axienet_local *lp, off_t offset, 4968a3b7a25Sdanborkmann@iogearbox.net u32 value) 4978a3b7a25Sdanborkmann@iogearbox.net { 4988a3b7a25Sdanborkmann@iogearbox.net out_be32((lp->regs + offset), value); 4998a3b7a25Sdanborkmann@iogearbox.net } 5008a3b7a25Sdanborkmann@iogearbox.net 5018a3b7a25Sdanborkmann@iogearbox.net /* Function prototypes visible in xilinx_axienet_mdio.c for other files */ 5028a3b7a25Sdanborkmann@iogearbox.net int axienet_mdio_setup(struct axienet_local *lp, struct device_node *np); 5038a3b7a25Sdanborkmann@iogearbox.net int axienet_mdio_wait_until_ready(struct axienet_local *lp); 5048a3b7a25Sdanborkmann@iogearbox.net void axienet_mdio_teardown(struct axienet_local *lp); 5058a3b7a25Sdanborkmann@iogearbox.net 5068a3b7a25Sdanborkmann@iogearbox.net #endif /* XILINX_AXI_ENET_H */ 507