Lines Matching refs:pdata
139 static void xgbe_default_config(struct xgbe_prv_data *pdata) in xgbe_default_config() argument
143 pdata->blen = DMA_SBMR_BLEN_64; in xgbe_default_config()
144 pdata->pbl = DMA_PBL_128; in xgbe_default_config()
145 pdata->aal = 1; in xgbe_default_config()
146 pdata->rd_osr_limit = 8; in xgbe_default_config()
147 pdata->wr_osr_limit = 8; in xgbe_default_config()
148 pdata->tx_sf_mode = MTL_TSF_ENABLE; in xgbe_default_config()
149 pdata->tx_threshold = MTL_TX_THRESHOLD_64; in xgbe_default_config()
150 pdata->tx_osp_mode = DMA_OSP_ENABLE; in xgbe_default_config()
151 pdata->rx_sf_mode = MTL_RSF_DISABLE; in xgbe_default_config()
152 pdata->rx_threshold = MTL_RX_THRESHOLD_64; in xgbe_default_config()
153 pdata->pause_autoneg = 1; in xgbe_default_config()
154 pdata->tx_pause = 1; in xgbe_default_config()
155 pdata->rx_pause = 1; in xgbe_default_config()
156 pdata->phy_speed = SPEED_UNKNOWN; in xgbe_default_config()
157 pdata->power_down = 0; in xgbe_default_config()
162 static void xgbe_init_all_fptrs(struct xgbe_prv_data *pdata) in xgbe_init_all_fptrs() argument
164 xgbe_init_function_ptrs_dev(&pdata->hw_if); in xgbe_init_all_fptrs()
165 xgbe_init_function_ptrs_phy(&pdata->phy_if); in xgbe_init_all_fptrs()
166 xgbe_init_function_ptrs_i2c(&pdata->i2c_if); in xgbe_init_all_fptrs()
167 xgbe_init_function_ptrs_desc(&pdata->desc_if); in xgbe_init_all_fptrs()
169 pdata->vdata->init_function_ptrs_phy_impl(&pdata->phy_if); in xgbe_init_all_fptrs()
174 struct xgbe_prv_data *pdata; in xgbe_alloc_pdata() local
184 pdata = netdev_priv(netdev); in xgbe_alloc_pdata()
185 pdata->netdev = netdev; in xgbe_alloc_pdata()
186 pdata->dev = dev; in xgbe_alloc_pdata()
188 spin_lock_init(&pdata->lock); in xgbe_alloc_pdata()
189 spin_lock_init(&pdata->xpcs_lock); in xgbe_alloc_pdata()
190 mutex_init(&pdata->rss_mutex); in xgbe_alloc_pdata()
191 spin_lock_init(&pdata->tstamp_lock); in xgbe_alloc_pdata()
192 mutex_init(&pdata->i2c_mutex); in xgbe_alloc_pdata()
193 init_completion(&pdata->i2c_complete); in xgbe_alloc_pdata()
194 init_completion(&pdata->mdio_complete); in xgbe_alloc_pdata()
196 pdata->msg_enable = netif_msg_init(debug, default_msg_level); in xgbe_alloc_pdata()
198 set_bit(XGBE_DOWN, &pdata->dev_state); in xgbe_alloc_pdata()
199 set_bit(XGBE_STOPPED, &pdata->dev_state); in xgbe_alloc_pdata()
201 return pdata; in xgbe_alloc_pdata()
204 void xgbe_free_pdata(struct xgbe_prv_data *pdata) in xgbe_free_pdata() argument
206 struct net_device *netdev = pdata->netdev; in xgbe_free_pdata()
211 void xgbe_set_counts(struct xgbe_prv_data *pdata) in xgbe_set_counts() argument
214 xgbe_init_all_fptrs(pdata); in xgbe_set_counts()
217 xgbe_get_all_hw_features(pdata); in xgbe_set_counts()
220 if (!pdata->tx_max_channel_count) in xgbe_set_counts()
221 pdata->tx_max_channel_count = pdata->hw_feat.tx_ch_cnt; in xgbe_set_counts()
222 if (!pdata->rx_max_channel_count) in xgbe_set_counts()
223 pdata->rx_max_channel_count = pdata->hw_feat.rx_ch_cnt; in xgbe_set_counts()
225 if (!pdata->tx_max_q_count) in xgbe_set_counts()
226 pdata->tx_max_q_count = pdata->hw_feat.tx_q_cnt; in xgbe_set_counts()
227 if (!pdata->rx_max_q_count) in xgbe_set_counts()
228 pdata->rx_max_q_count = pdata->hw_feat.rx_q_cnt; in xgbe_set_counts()
237 pdata->tx_ring_count = min_t(unsigned int, num_online_cpus(), in xgbe_set_counts()
238 pdata->hw_feat.tx_ch_cnt); in xgbe_set_counts()
239 pdata->tx_ring_count = min_t(unsigned int, pdata->tx_ring_count, in xgbe_set_counts()
240 pdata->tx_max_channel_count); in xgbe_set_counts()
241 pdata->tx_ring_count = min_t(unsigned int, pdata->tx_ring_count, in xgbe_set_counts()
242 pdata->tx_max_q_count); in xgbe_set_counts()
244 pdata->tx_q_count = pdata->tx_ring_count; in xgbe_set_counts()
246 pdata->rx_ring_count = min_t(unsigned int, num_online_cpus(), in xgbe_set_counts()
247 pdata->hw_feat.rx_ch_cnt); in xgbe_set_counts()
248 pdata->rx_ring_count = min_t(unsigned int, pdata->rx_ring_count, in xgbe_set_counts()
249 pdata->rx_max_channel_count); in xgbe_set_counts()
251 pdata->rx_q_count = min_t(unsigned int, pdata->hw_feat.rx_q_cnt, in xgbe_set_counts()
252 pdata->rx_max_q_count); in xgbe_set_counts()
254 if (netif_msg_probe(pdata)) { in xgbe_set_counts()
255 dev_dbg(pdata->dev, "TX/RX DMA channel count = %u/%u\n", in xgbe_set_counts()
256 pdata->tx_ring_count, pdata->rx_ring_count); in xgbe_set_counts()
257 dev_dbg(pdata->dev, "TX/RX hardware queue count = %u/%u\n", in xgbe_set_counts()
258 pdata->tx_q_count, pdata->rx_q_count); in xgbe_set_counts()
262 int xgbe_config_netdev(struct xgbe_prv_data *pdata) in xgbe_config_netdev() argument
264 struct net_device *netdev = pdata->netdev; in xgbe_config_netdev()
265 struct device *dev = pdata->dev; in xgbe_config_netdev()
268 netdev->irq = pdata->dev_irq; in xgbe_config_netdev()
269 netdev->base_addr = (unsigned long)pdata->xgmac_regs; in xgbe_config_netdev()
270 eth_hw_addr_set(netdev, pdata->mac_addr); in xgbe_config_netdev()
273 pdata->tx_sec_period = jiffies; in xgbe_config_netdev()
274 pdata->tx_ded_period = jiffies; in xgbe_config_netdev()
275 pdata->rx_sec_period = jiffies; in xgbe_config_netdev()
276 pdata->rx_ded_period = jiffies; in xgbe_config_netdev()
277 pdata->desc_sec_period = jiffies; in xgbe_config_netdev()
278 pdata->desc_ded_period = jiffies; in xgbe_config_netdev()
281 ret = pdata->hw_if.exit(pdata); in xgbe_config_netdev()
288 xgbe_default_config(pdata); in xgbe_config_netdev()
292 DMA_BIT_MASK(pdata->hw_feat.dma_width)); in xgbe_config_netdev()
299 if (!pdata->tx_max_fifo_size) in xgbe_config_netdev()
300 pdata->tx_max_fifo_size = pdata->hw_feat.tx_fifo_size; in xgbe_config_netdev()
301 if (!pdata->rx_max_fifo_size) in xgbe_config_netdev()
302 pdata->rx_max_fifo_size = pdata->hw_feat.rx_fifo_size; in xgbe_config_netdev()
306 pdata->tx_desc_count = XGBE_TX_DESC_CNT; in xgbe_config_netdev()
309 pdata->rx_desc_count = XGBE_RX_DESC_CNT; in xgbe_config_netdev()
312 if (pdata->channel_irq_count) { in xgbe_config_netdev()
313 pdata->tx_ring_count = min_t(unsigned int, pdata->tx_ring_count, in xgbe_config_netdev()
314 pdata->channel_irq_count); in xgbe_config_netdev()
315 pdata->rx_ring_count = min_t(unsigned int, pdata->rx_ring_count, in xgbe_config_netdev()
316 pdata->channel_irq_count); in xgbe_config_netdev()
318 if (netif_msg_probe(pdata)) in xgbe_config_netdev()
319 dev_dbg(pdata->dev, in xgbe_config_netdev()
321 pdata->tx_ring_count, pdata->rx_ring_count); in xgbe_config_netdev()
325 netdev_rss_key_fill(pdata->rss_key, sizeof(pdata->rss_key)); in xgbe_config_netdev()
327 XGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, IP2TE, 1); in xgbe_config_netdev()
328 XGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, TCP4TE, 1); in xgbe_config_netdev()
329 XGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, UDP4TE, 1); in xgbe_config_netdev()
332 pdata->debugfs_an_cdr_workaround = pdata->vdata->an_cdr_workaround; in xgbe_config_netdev()
333 ret = pdata->phy_if.phy_init(pdata); in xgbe_config_netdev()
356 if (pdata->hw_feat.rss) in xgbe_config_netdev()
359 if (pdata->hw_feat.vxn) { in xgbe_config_netdev()
383 pdata->netdev_features = netdev->features; in xgbe_config_netdev()
392 xgbe_init_rx_coalesce(pdata); in xgbe_config_netdev()
393 xgbe_init_tx_coalesce(pdata); in xgbe_config_netdev()
403 xgbe_ptp_register(pdata); in xgbe_config_netdev()
405 xgbe_debugfs_init(pdata); in xgbe_config_netdev()
407 netif_dbg(pdata, drv, pdata->netdev, "%u Tx software queues\n", in xgbe_config_netdev()
408 pdata->tx_ring_count); in xgbe_config_netdev()
409 netif_dbg(pdata, drv, pdata->netdev, "%u Rx software queues\n", in xgbe_config_netdev()
410 pdata->rx_ring_count); in xgbe_config_netdev()
415 void xgbe_deconfig_netdev(struct xgbe_prv_data *pdata) in xgbe_deconfig_netdev() argument
417 struct net_device *netdev = pdata->netdev; in xgbe_deconfig_netdev()
419 xgbe_debugfs_exit(pdata); in xgbe_deconfig_netdev()
422 xgbe_ptp_unregister(pdata); in xgbe_deconfig_netdev()
426 pdata->phy_if.phy_exit(pdata); in xgbe_deconfig_netdev()
433 struct xgbe_prv_data *pdata = netdev_priv(netdev); in xgbe_netdev_event() local
440 xgbe_debugfs_rename(pdata); in xgbe_netdev_event()