/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * drivers/net/ethernet/ibm/emac/core.h * * Driver for PowerPC 4xx on-chip ethernet controller. * * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. * <benh@kernel.crashing.org> * * Based on the arch/ppc version of the driver: * * Copyright (c) 2004, 2005 Zultys Technologies. * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> * * Based on original work by * Armin Kuster <akuster@mvista.com> * Johnnie Peters <jpeters@mvista.com> * Copyright 2000, 2001 MontaVista Softare Inc.
*/ #ifndef __IBM_NEWEMAC_CORE_H #define __IBM_NEWEMAC_CORE_H
/* Simple sanity check */ #if NUM_TX_BUFF > 256 || NUM_RX_BUFF > 256 #error Invalid number of buffer descriptors (greater than 256) #endif
#define EMAC_MIN_MTU 46
/* Maximum L2 header length (VLAN tagged, no FCS) */ #define EMAC_MTU_OVERHEAD (6 * 2 + 2 + 4)
/* RX BD size for the given MTU */ staticinlineint emac_rx_size(int mtu)
{ if (mtu > ETH_DATA_LEN) return MAL_MAX_RX_SIZE; else return mal_rx_size(ETH_DATA_LEN + EMAC_MTU_OVERHEAD);
}
/* Size of RX skb for the given MTU */ staticinlineint emac_rx_skb_size(int mtu)
{ int size = max(mtu + EMAC_MTU_OVERHEAD, emac_rx_size(mtu));
/* Driver statistcs is split into two parts to make it more cache friendly: * - normal statistics (packet count, etc) * - error statistics * * When statistics is requested by ethtool, these parts are concatenated, * normal one goes first. * * Please, keep these structures in sync with emac_stats_keys.
*/
/* Misc
*/ int reset_failed; int stop_timeout; /* in us */ int no_mcast; int mcast_pending; int opened; struct work_struct reset_work;
spinlock_t lock;
};
/* * Features of various EMAC implementations
*/
/* * No flow control on 40x according to the original driver
*/ #define EMAC_FTR_NO_FLOW_CONTROL_40x 0x00000001 /* * Cell is an EMAC4
*/ #define EMAC_FTR_EMAC4 0x00000002 /* * For the 440SPe, AMCC inexplicably changed the polarity of * the "operation complete" bit in the MII control register.
*/ #define EMAC_FTR_STACR_OC_INVERT 0x00000004 /* * Set if we have a TAH.
*/ #define EMAC_FTR_HAS_TAH 0x00000008 /* * Set if we have a ZMII.
*/ #define EMAC_FTR_HAS_ZMII 0x00000010 /* * Set if we have a RGMII.
*/ #define EMAC_FTR_HAS_RGMII 0x00000020 /* * Set if we have new type STACR with STAOPC
*/ #define EMAC_FTR_HAS_NEW_STACR 0x00000040 /* * Set if we need phy clock workaround for 440gx
*/ #define EMAC_FTR_440GX_PHY_CLK_FIX 0x00000080 /* * Set if we need phy clock workaround for 440ep or 440gr
*/ #define EMAC_FTR_440EP_PHY_CLK_FIX 0x00000100 /* * The 405EX and 460EX contain the EMAC4SYNC core
*/ #define EMAC_FTR_EMAC4SYNC 0x00000200 /* * Set if we need phy clock workaround for 460ex or 460gt
*/ #define EMAC_FTR_460EX_PHY_CLK_FIX 0x00000400 /* * APM821xx requires Jumbo frame size set explicitly
*/ #define EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE 0x00000800 /* * APM821xx does not support Half Duplex mode
*/ #define EMAC_FTR_APM821XX_NO_HALF_DUPLEX 0x00001000
/* Right now, we don't quite handle the always/possible masks on the * most optimal way as we don't have a way to say something like * always EMAC4. Patches welcome.
*/ enum {
EMAC_FTRS_ALWAYS = 0,
/* * Various instances of the EMAC core have varying 1) number of * address match slots, 2) width of the registers for handling address * match slots, 3) number of registers for handling address match * slots and 4) base offset for those registers. * * These macros and inlines handle these differences based on * parameters supplied by the device structure which are, in turn, * initialized based on the "compatible" entry in the device tree.
*/
/* The first IAHT entry always is the base of the block of * IAHT and GAHT registers.
*/ if (emac_has_feature(dev, EMAC_FTR_EMAC4SYNC))
offset = offsetof(struct emac_regs, u1.emac4sync.iaht1); else
offset = offsetof(struct emac_regs, u0.emac4.iaht1);
staticinline u32 __iomem *emac_gaht_base(struct emac_instance *dev)
{ /* GAHT registers always come after an identical number of * IAHT registers.
*/ return emac_xaht_base(dev) + EMAC_XAHT_REGS(dev);
}
staticinline u32 *emac_iaht_base(struct emac_instance *dev)
{ /* IAHT registers always come before an identical number of * GAHT registers.
*/ return emac_xaht_base(dev);
}
/* Ethtool get_regs complex data. * We want to get not just EMAC registers, but also MAL, ZMII, RGMII, TAH * when available. * * Returned BLOB consists of the ibm_emac_ethtool_regs_hdr, * MAL registers, EMAC registers and optional ZMII, RGMII, TAH registers. * Each register component is preceded with emac_ethtool_regs_subhdr. * Order of the optional headers follows their relative bit posititions * in emac_ethtool_regs_hdr.components
*/ #define EMAC_ETHTOOL_REGS_ZMII 0x00000001 #define EMAC_ETHTOOL_REGS_RGMII 0x00000002 #define EMAC_ETHTOOL_REGS_TAH 0x00000004
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.