xref: /openbmc/linux/drivers/net/ethernet/stmicro/stmmac/stmmac.h (revision 7ac6653a085b41405758bc16b2525db56ee0a23f)
1*7ac6653aSJeff Kirsher /*******************************************************************************
2*7ac6653aSJeff Kirsher   Copyright (C) 2007-2009  STMicroelectronics Ltd
3*7ac6653aSJeff Kirsher 
4*7ac6653aSJeff Kirsher   This program is free software; you can redistribute it and/or modify it
5*7ac6653aSJeff Kirsher   under the terms and conditions of the GNU General Public License,
6*7ac6653aSJeff Kirsher   version 2, as published by the Free Software Foundation.
7*7ac6653aSJeff Kirsher 
8*7ac6653aSJeff Kirsher   This program is distributed in the hope it will be useful, but WITHOUT
9*7ac6653aSJeff Kirsher   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10*7ac6653aSJeff Kirsher   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
11*7ac6653aSJeff Kirsher   more details.
12*7ac6653aSJeff Kirsher 
13*7ac6653aSJeff Kirsher   You should have received a copy of the GNU General Public License along with
14*7ac6653aSJeff Kirsher   this program; if not, write to the Free Software Foundation, Inc.,
15*7ac6653aSJeff Kirsher   51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16*7ac6653aSJeff Kirsher 
17*7ac6653aSJeff Kirsher   The full GNU General Public License is included in this distribution in
18*7ac6653aSJeff Kirsher   the file called "COPYING".
19*7ac6653aSJeff Kirsher 
20*7ac6653aSJeff Kirsher   Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
21*7ac6653aSJeff Kirsher *******************************************************************************/
22*7ac6653aSJeff Kirsher 
23*7ac6653aSJeff Kirsher #define DRV_MODULE_VERSION	"July_2011"
24*7ac6653aSJeff Kirsher #include <linux/stmmac.h>
25*7ac6653aSJeff Kirsher 
26*7ac6653aSJeff Kirsher #include "common.h"
27*7ac6653aSJeff Kirsher #ifdef CONFIG_STMMAC_TIMER
28*7ac6653aSJeff Kirsher #include "stmmac_timer.h"
29*7ac6653aSJeff Kirsher #endif
30*7ac6653aSJeff Kirsher 
31*7ac6653aSJeff Kirsher struct stmmac_priv {
32*7ac6653aSJeff Kirsher 	/* Frequently used values are kept adjacent for cache effect */
33*7ac6653aSJeff Kirsher 	struct dma_desc *dma_tx ____cacheline_aligned;
34*7ac6653aSJeff Kirsher 	dma_addr_t dma_tx_phy;
35*7ac6653aSJeff Kirsher 	struct sk_buff **tx_skbuff;
36*7ac6653aSJeff Kirsher 	unsigned int cur_tx;
37*7ac6653aSJeff Kirsher 	unsigned int dirty_tx;
38*7ac6653aSJeff Kirsher 	unsigned int dma_tx_size;
39*7ac6653aSJeff Kirsher 	int tx_coalesce;
40*7ac6653aSJeff Kirsher 
41*7ac6653aSJeff Kirsher 	struct dma_desc *dma_rx ;
42*7ac6653aSJeff Kirsher 	unsigned int cur_rx;
43*7ac6653aSJeff Kirsher 	unsigned int dirty_rx;
44*7ac6653aSJeff Kirsher 	struct sk_buff **rx_skbuff;
45*7ac6653aSJeff Kirsher 	dma_addr_t *rx_skbuff_dma;
46*7ac6653aSJeff Kirsher 	struct sk_buff_head rx_recycle;
47*7ac6653aSJeff Kirsher 
48*7ac6653aSJeff Kirsher 	struct net_device *dev;
49*7ac6653aSJeff Kirsher 	dma_addr_t dma_rx_phy;
50*7ac6653aSJeff Kirsher 	unsigned int dma_rx_size;
51*7ac6653aSJeff Kirsher 	unsigned int dma_buf_sz;
52*7ac6653aSJeff Kirsher 	struct device *device;
53*7ac6653aSJeff Kirsher 	struct mac_device_info *hw;
54*7ac6653aSJeff Kirsher 	void __iomem *ioaddr;
55*7ac6653aSJeff Kirsher 
56*7ac6653aSJeff Kirsher 	struct stmmac_extra_stats xstats;
57*7ac6653aSJeff Kirsher 	struct napi_struct napi;
58*7ac6653aSJeff Kirsher 
59*7ac6653aSJeff Kirsher 	int rx_coe;
60*7ac6653aSJeff Kirsher 	int no_csum_insertion;
61*7ac6653aSJeff Kirsher 
62*7ac6653aSJeff Kirsher 	struct phy_device *phydev;
63*7ac6653aSJeff Kirsher 	int oldlink;
64*7ac6653aSJeff Kirsher 	int speed;
65*7ac6653aSJeff Kirsher 	int oldduplex;
66*7ac6653aSJeff Kirsher 	unsigned int flow_ctrl;
67*7ac6653aSJeff Kirsher 	unsigned int pause;
68*7ac6653aSJeff Kirsher 	struct mii_bus *mii;
69*7ac6653aSJeff Kirsher 	int mii_irq[PHY_MAX_ADDR];
70*7ac6653aSJeff Kirsher 
71*7ac6653aSJeff Kirsher 	u32 msg_enable;
72*7ac6653aSJeff Kirsher 	spinlock_t lock;
73*7ac6653aSJeff Kirsher 	int wolopts;
74*7ac6653aSJeff Kirsher 	int wolenabled;
75*7ac6653aSJeff Kirsher #ifdef CONFIG_STMMAC_TIMER
76*7ac6653aSJeff Kirsher 	struct stmmac_timer *tm;
77*7ac6653aSJeff Kirsher #endif
78*7ac6653aSJeff Kirsher 	struct plat_stmmacenet_data *plat;
79*7ac6653aSJeff Kirsher };
80*7ac6653aSJeff Kirsher 
81*7ac6653aSJeff Kirsher extern int stmmac_mdio_unregister(struct net_device *ndev);
82*7ac6653aSJeff Kirsher extern int stmmac_mdio_register(struct net_device *ndev);
83*7ac6653aSJeff Kirsher extern void stmmac_set_ethtool_ops(struct net_device *netdev);
84*7ac6653aSJeff Kirsher extern const struct stmmac_desc_ops enh_desc_ops;
85*7ac6653aSJeff Kirsher extern const struct stmmac_desc_ops ndesc_ops;
86