1 /******************************************************************************* 2 Copyright (C) 2007-2009 STMicroelectronics Ltd 3 4 This program is free software; you can redistribute it and/or modify it 5 under the terms and conditions of the GNU General Public License, 6 version 2, as published by the Free Software Foundation. 7 8 This program is distributed in the hope it will be useful, but WITHOUT 9 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 more details. 12 13 You should have received a copy of the GNU General Public License along with 14 this program; if not, write to the Free Software Foundation, Inc., 15 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 16 17 The full GNU General Public License is included in this distribution in 18 the file called "COPYING". 19 20 Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> 21 *******************************************************************************/ 22 23 #ifndef __STMMAC_H__ 24 #define __STMMAC_H__ 25 26 #define STMMAC_RESOURCE_NAME "stmmaceth" 27 #define DRV_MODULE_VERSION "March_2013" 28 29 #include <linux/clk.h> 30 #include <linux/stmmac.h> 31 #include <linux/phy.h> 32 #include <linux/pci.h> 33 #include "common.h" 34 #include <linux/ptp_clock_kernel.h> 35 #include <linux/reset.h> 36 37 struct stmmac_tx_info { 38 dma_addr_t buf; 39 bool map_as_page; 40 }; 41 42 struct stmmac_priv { 43 /* Frequently used values are kept adjacent for cache effect */ 44 struct dma_extended_desc *dma_etx ____cacheline_aligned_in_smp; 45 struct dma_desc *dma_tx; 46 struct sk_buff **tx_skbuff; 47 unsigned int cur_tx; 48 unsigned int dirty_tx; 49 unsigned int dma_tx_size; 50 u32 tx_count_frames; 51 u32 tx_coal_frames; 52 u32 tx_coal_timer; 53 struct stmmac_tx_info *tx_skbuff_dma; 54 dma_addr_t dma_tx_phy; 55 int tx_coalesce; 56 int hwts_tx_en; 57 spinlock_t tx_lock; 58 bool tx_path_in_lpi_mode; 59 struct timer_list txtimer; 60 61 struct dma_desc *dma_rx ____cacheline_aligned_in_smp; 62 struct dma_extended_desc *dma_erx; 63 struct sk_buff **rx_skbuff; 64 unsigned int cur_rx; 65 unsigned int dirty_rx; 66 unsigned int dma_rx_size; 67 unsigned int dma_buf_sz; 68 u32 rx_riwt; 69 int hwts_rx_en; 70 dma_addr_t *rx_skbuff_dma; 71 dma_addr_t dma_rx_phy; 72 73 struct napi_struct napi ____cacheline_aligned_in_smp; 74 75 void __iomem *ioaddr; 76 struct net_device *dev; 77 struct device *device; 78 struct mac_device_info *hw; 79 spinlock_t lock; 80 81 struct phy_device *phydev ____cacheline_aligned_in_smp; 82 int oldlink; 83 int speed; 84 int oldduplex; 85 unsigned int flow_ctrl; 86 unsigned int pause; 87 struct mii_bus *mii; 88 int mii_irq[PHY_MAX_ADDR]; 89 90 struct stmmac_extra_stats xstats ____cacheline_aligned_in_smp; 91 struct plat_stmmacenet_data *plat; 92 struct dma_features dma_cap; 93 struct stmmac_counters mmc; 94 int hw_cap_support; 95 int synopsys_id; 96 u32 msg_enable; 97 int wolopts; 98 int wol_irq; 99 struct clk *stmmac_clk; 100 struct reset_control *stmmac_rst; 101 int clk_csr; 102 struct timer_list eee_ctrl_timer; 103 int lpi_irq; 104 int eee_enabled; 105 int eee_active; 106 int tx_lpi_timer; 107 int pcs; 108 unsigned int mode; 109 int extend_desc; 110 struct ptp_clock *ptp_clock; 111 struct ptp_clock_info ptp_clock_ops; 112 unsigned int default_addend; 113 struct clk *clk_ptp_ref; 114 unsigned int clk_ptp_rate; 115 u32 adv_ts; 116 int use_riwt; 117 int irq_wake; 118 spinlock_t ptp_lock; 119 }; 120 121 int stmmac_mdio_unregister(struct net_device *ndev); 122 int stmmac_mdio_register(struct net_device *ndev); 123 int stmmac_mdio_reset(struct mii_bus *mii); 124 void stmmac_set_ethtool_ops(struct net_device *netdev); 125 126 int stmmac_ptp_register(struct stmmac_priv *priv); 127 void stmmac_ptp_unregister(struct stmmac_priv *priv); 128 int stmmac_resume(struct net_device *ndev); 129 int stmmac_suspend(struct net_device *ndev); 130 int stmmac_dvr_remove(struct net_device *ndev); 131 struct stmmac_priv *stmmac_dvr_probe(struct device *device, 132 struct plat_stmmacenet_data *plat_dat, 133 void __iomem *addr); 134 void stmmac_disable_eee_mode(struct stmmac_priv *priv); 135 bool stmmac_eee_init(struct stmmac_priv *priv); 136 137 #endif /* __STMMAC_H__ */ 138