xref: /openbmc/linux/drivers/net/ethernet/stmicro/stmmac/stmmac.h (revision 3172d3afa998ffb8f1971746ca960cbe98d62444)
17ac6653aSJeff Kirsher /*******************************************************************************
27ac6653aSJeff Kirsher   Copyright (C) 2007-2009  STMicroelectronics Ltd
37ac6653aSJeff Kirsher 
47ac6653aSJeff Kirsher   This program is free software; you can redistribute it and/or modify it
57ac6653aSJeff Kirsher   under the terms and conditions of the GNU General Public License,
67ac6653aSJeff Kirsher   version 2, as published by the Free Software Foundation.
77ac6653aSJeff Kirsher 
87ac6653aSJeff Kirsher   This program is distributed in the hope it will be useful, but WITHOUT
97ac6653aSJeff Kirsher   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
107ac6653aSJeff Kirsher   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
117ac6653aSJeff Kirsher   more details.
127ac6653aSJeff Kirsher 
137ac6653aSJeff Kirsher   You should have received a copy of the GNU General Public License along with
147ac6653aSJeff Kirsher   this program; if not, write to the Free Software Foundation, Inc.,
157ac6653aSJeff Kirsher   51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
167ac6653aSJeff Kirsher 
177ac6653aSJeff Kirsher   The full GNU General Public License is included in this distribution in
187ac6653aSJeff Kirsher   the file called "COPYING".
197ac6653aSJeff Kirsher 
207ac6653aSJeff Kirsher   Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
217ac6653aSJeff Kirsher *******************************************************************************/
227ac6653aSJeff Kirsher 
237ac6653aSJeff Kirsher #define DRV_MODULE_VERSION	"July_2011"
247ac6653aSJeff Kirsher #include <linux/stmmac.h>
257ac6653aSJeff Kirsher 
267ac6653aSJeff Kirsher #include "common.h"
277ac6653aSJeff Kirsher #ifdef CONFIG_STMMAC_TIMER
287ac6653aSJeff Kirsher #include "stmmac_timer.h"
297ac6653aSJeff Kirsher #endif
307ac6653aSJeff Kirsher 
317ac6653aSJeff Kirsher struct stmmac_priv {
327ac6653aSJeff Kirsher 	/* Frequently used values are kept adjacent for cache effect */
337ac6653aSJeff Kirsher 	struct dma_desc *dma_tx ____cacheline_aligned;
347ac6653aSJeff Kirsher 	dma_addr_t dma_tx_phy;
357ac6653aSJeff Kirsher 	struct sk_buff **tx_skbuff;
367ac6653aSJeff Kirsher 	unsigned int cur_tx;
377ac6653aSJeff Kirsher 	unsigned int dirty_tx;
387ac6653aSJeff Kirsher 	unsigned int dma_tx_size;
397ac6653aSJeff Kirsher 	int tx_coalesce;
407ac6653aSJeff Kirsher 
417ac6653aSJeff Kirsher 	struct dma_desc *dma_rx ;
427ac6653aSJeff Kirsher 	unsigned int cur_rx;
437ac6653aSJeff Kirsher 	unsigned int dirty_rx;
447ac6653aSJeff Kirsher 	struct sk_buff **rx_skbuff;
457ac6653aSJeff Kirsher 	dma_addr_t *rx_skbuff_dma;
467ac6653aSJeff Kirsher 	struct sk_buff_head rx_recycle;
477ac6653aSJeff Kirsher 
487ac6653aSJeff Kirsher 	struct net_device *dev;
497ac6653aSJeff Kirsher 	dma_addr_t dma_rx_phy;
507ac6653aSJeff Kirsher 	unsigned int dma_rx_size;
517ac6653aSJeff Kirsher 	unsigned int dma_buf_sz;
527ac6653aSJeff Kirsher 	struct device *device;
537ac6653aSJeff Kirsher 	struct mac_device_info *hw;
547ac6653aSJeff Kirsher 	void __iomem *ioaddr;
557ac6653aSJeff Kirsher 
567ac6653aSJeff Kirsher 	struct stmmac_extra_stats xstats;
577ac6653aSJeff Kirsher 	struct napi_struct napi;
587ac6653aSJeff Kirsher 
597ac6653aSJeff Kirsher 	int rx_coe;
607ac6653aSJeff Kirsher 	int no_csum_insertion;
617ac6653aSJeff Kirsher 
627ac6653aSJeff Kirsher 	struct phy_device *phydev;
637ac6653aSJeff Kirsher 	int oldlink;
647ac6653aSJeff Kirsher 	int speed;
657ac6653aSJeff Kirsher 	int oldduplex;
667ac6653aSJeff Kirsher 	unsigned int flow_ctrl;
677ac6653aSJeff Kirsher 	unsigned int pause;
687ac6653aSJeff Kirsher 	struct mii_bus *mii;
697ac6653aSJeff Kirsher 	int mii_irq[PHY_MAX_ADDR];
707ac6653aSJeff Kirsher 
717ac6653aSJeff Kirsher 	u32 msg_enable;
727ac6653aSJeff Kirsher 	spinlock_t lock;
737ac6653aSJeff Kirsher 	int wolopts;
747ac6653aSJeff Kirsher 	int wolenabled;
75*3172d3afSDeepak Sikri 	int wol_irq;
767ac6653aSJeff Kirsher #ifdef CONFIG_STMMAC_TIMER
777ac6653aSJeff Kirsher 	struct stmmac_timer *tm;
787ac6653aSJeff Kirsher #endif
797ac6653aSJeff Kirsher 	struct plat_stmmacenet_data *plat;
807ac6653aSJeff Kirsher };
817ac6653aSJeff Kirsher 
827ac6653aSJeff Kirsher extern int stmmac_mdio_unregister(struct net_device *ndev);
837ac6653aSJeff Kirsher extern int stmmac_mdio_register(struct net_device *ndev);
847ac6653aSJeff Kirsher extern void stmmac_set_ethtool_ops(struct net_device *netdev);
857ac6653aSJeff Kirsher extern const struct stmmac_desc_ops enh_desc_ops;
867ac6653aSJeff Kirsher extern const struct stmmac_desc_ops ndesc_ops;
87