• Home
  • Raw
  • Download

Lines Matching refs:pdata

125 static int xgbe_config_multi_msi(struct xgbe_prv_data *pdata)  in xgbe_config_multi_msi()  argument
132 vector_count += max(pdata->rx_ring_count, in xgbe_config_multi_msi()
133 pdata->tx_ring_count); in xgbe_config_multi_msi()
135 ret = pci_alloc_irq_vectors(pdata->pcidev, XGBE_MSI_MIN_COUNT, in xgbe_config_multi_msi()
138 dev_info(pdata->dev, "multi MSI/MSI-X enablement failed\n"); in xgbe_config_multi_msi()
142 pdata->isr_as_tasklet = 1; in xgbe_config_multi_msi()
143 pdata->irq_count = ret; in xgbe_config_multi_msi()
145 pdata->dev_irq = pci_irq_vector(pdata->pcidev, 0); in xgbe_config_multi_msi()
146 pdata->ecc_irq = pci_irq_vector(pdata->pcidev, 1); in xgbe_config_multi_msi()
147 pdata->i2c_irq = pci_irq_vector(pdata->pcidev, 2); in xgbe_config_multi_msi()
148 pdata->an_irq = pci_irq_vector(pdata->pcidev, 3); in xgbe_config_multi_msi()
151 pdata->channel_irq[j] = pci_irq_vector(pdata->pcidev, i); in xgbe_config_multi_msi()
152 pdata->channel_irq_count = j; in xgbe_config_multi_msi()
154 pdata->per_channel_irq = 1; in xgbe_config_multi_msi()
155 pdata->channel_irq_mode = XGBE_IRQ_MODE_LEVEL; in xgbe_config_multi_msi()
157 if (netif_msg_probe(pdata)) in xgbe_config_multi_msi()
158 dev_dbg(pdata->dev, "multi %s interrupts enabled\n", in xgbe_config_multi_msi()
159 pdata->pcidev->msix_enabled ? "MSI-X" : "MSI"); in xgbe_config_multi_msi()
164 static int xgbe_config_irqs(struct xgbe_prv_data *pdata) in xgbe_config_irqs() argument
168 ret = xgbe_config_multi_msi(pdata); in xgbe_config_irqs()
172 ret = pci_alloc_irq_vectors(pdata->pcidev, 1, 1, in xgbe_config_irqs()
175 dev_info(pdata->dev, "single IRQ enablement failed\n"); in xgbe_config_irqs()
179 pdata->isr_as_tasklet = pdata->pcidev->msi_enabled ? 1 : 0; in xgbe_config_irqs()
180 pdata->irq_count = 1; in xgbe_config_irqs()
181 pdata->channel_irq_count = 1; in xgbe_config_irqs()
183 pdata->dev_irq = pci_irq_vector(pdata->pcidev, 0); in xgbe_config_irqs()
184 pdata->ecc_irq = pci_irq_vector(pdata->pcidev, 0); in xgbe_config_irqs()
185 pdata->i2c_irq = pci_irq_vector(pdata->pcidev, 0); in xgbe_config_irqs()
186 pdata->an_irq = pci_irq_vector(pdata->pcidev, 0); in xgbe_config_irqs()
188 if (netif_msg_probe(pdata)) in xgbe_config_irqs()
189 dev_dbg(pdata->dev, "single %s interrupt enabled\n", in xgbe_config_irqs()
190 pdata->pcidev->msi_enabled ? "MSI" : "legacy"); in xgbe_config_irqs()
193 if (netif_msg_probe(pdata)) { in xgbe_config_irqs()
196 dev_dbg(pdata->dev, " dev irq=%d\n", pdata->dev_irq); in xgbe_config_irqs()
197 dev_dbg(pdata->dev, " ecc irq=%d\n", pdata->ecc_irq); in xgbe_config_irqs()
198 dev_dbg(pdata->dev, " i2c irq=%d\n", pdata->i2c_irq); in xgbe_config_irqs()
199 dev_dbg(pdata->dev, " an irq=%d\n", pdata->an_irq); in xgbe_config_irqs()
200 for (i = 0; i < pdata->channel_irq_count; i++) in xgbe_config_irqs()
201 dev_dbg(pdata->dev, " dma%u irq=%d\n", in xgbe_config_irqs()
202 i, pdata->channel_irq[i]); in xgbe_config_irqs()
210 struct xgbe_prv_data *pdata; in xgbe_pci_probe() local
219 pdata = xgbe_alloc_pdata(dev); in xgbe_pci_probe()
220 if (IS_ERR(pdata)) { in xgbe_pci_probe()
221 ret = PTR_ERR(pdata); in xgbe_pci_probe()
225 pdata->pcidev = pdev; in xgbe_pci_probe()
226 pci_set_drvdata(pdev, pdata); in xgbe_pci_probe()
229 pdata->vdata = (struct xgbe_version_data *)id->driver_data; in xgbe_pci_probe()
252 pdata->xgmac_regs = iomap_table[XGBE_XGMAC_BAR]; in xgbe_pci_probe()
253 if (!pdata->xgmac_regs) { in xgbe_pci_probe()
258 pdata->xprop_regs = pdata->xgmac_regs + XGBE_MAC_PROP_OFFSET; in xgbe_pci_probe()
259 pdata->xi2c_regs = pdata->xgmac_regs + XGBE_I2C_CTRL_OFFSET; in xgbe_pci_probe()
260 if (netif_msg_probe(pdata)) { in xgbe_pci_probe()
261 dev_dbg(dev, "xgmac_regs = %p\n", pdata->xgmac_regs); in xgbe_pci_probe()
262 dev_dbg(dev, "xprop_regs = %p\n", pdata->xprop_regs); in xgbe_pci_probe()
263 dev_dbg(dev, "xi2c_regs = %p\n", pdata->xi2c_regs); in xgbe_pci_probe()
266 pdata->xpcs_regs = iomap_table[XGBE_XPCS_BAR]; in xgbe_pci_probe()
267 if (!pdata->xpcs_regs) { in xgbe_pci_probe()
272 if (netif_msg_probe(pdata)) in xgbe_pci_probe()
273 dev_dbg(dev, "xpcs_regs = %p\n", pdata->xpcs_regs); in xgbe_pci_probe()
279 pdata->xpcs_window_def_reg = PCS_V2_RV_WINDOW_DEF; in xgbe_pci_probe()
280 pdata->xpcs_window_sel_reg = PCS_V2_RV_WINDOW_SELECT; in xgbe_pci_probe()
282 pdata->xpcs_window_def_reg = PCS_V2_WINDOW_DEF; in xgbe_pci_probe()
283 pdata->xpcs_window_sel_reg = PCS_V2_WINDOW_SELECT; in xgbe_pci_probe()
288 reg = XPCS32_IOREAD(pdata, pdata->xpcs_window_def_reg); in xgbe_pci_probe()
289 pdata->xpcs_window = XPCS_GET_BITS(reg, PCS_V2_WINDOW_DEF, OFFSET); in xgbe_pci_probe()
290 pdata->xpcs_window <<= 6; in xgbe_pci_probe()
291 pdata->xpcs_window_size = XPCS_GET_BITS(reg, PCS_V2_WINDOW_DEF, SIZE); in xgbe_pci_probe()
292 pdata->xpcs_window_size = 1 << (pdata->xpcs_window_size + 7); in xgbe_pci_probe()
293 pdata->xpcs_window_mask = pdata->xpcs_window_size - 1; in xgbe_pci_probe()
294 if (netif_msg_probe(pdata)) { in xgbe_pci_probe()
296 pdata->xpcs_window_def_reg); in xgbe_pci_probe()
298 pdata->xpcs_window_sel_reg); in xgbe_pci_probe()
300 pdata->xpcs_window); in xgbe_pci_probe()
302 pdata->xpcs_window_size); in xgbe_pci_probe()
304 pdata->xpcs_window_mask); in xgbe_pci_probe()
310 XP_IOWRITE(pdata, XP_INT_EN, 0x1fffff); in xgbe_pci_probe()
313 ma_lo = XP_IOREAD(pdata, XP_MAC_ADDR_LO); in xgbe_pci_probe()
314 ma_hi = XP_IOREAD(pdata, XP_MAC_ADDR_HI); in xgbe_pci_probe()
315 pdata->mac_addr[0] = ma_lo & 0xff; in xgbe_pci_probe()
316 pdata->mac_addr[1] = (ma_lo >> 8) & 0xff; in xgbe_pci_probe()
317 pdata->mac_addr[2] = (ma_lo >> 16) & 0xff; in xgbe_pci_probe()
318 pdata->mac_addr[3] = (ma_lo >> 24) & 0xff; in xgbe_pci_probe()
319 pdata->mac_addr[4] = ma_hi & 0xff; in xgbe_pci_probe()
320 pdata->mac_addr[5] = (ma_hi >> 8) & 0xff; in xgbe_pci_probe()
322 !is_valid_ether_addr(pdata->mac_addr)) { in xgbe_pci_probe()
329 pdata->sysclk_rate = XGBE_V2_DMA_CLOCK_FREQ; in xgbe_pci_probe()
330 pdata->ptpclk_rate = XGBE_V2_PTP_CLOCK_FREQ; in xgbe_pci_probe()
333 pdata->coherent = 1; in xgbe_pci_probe()
334 pdata->arcr = XGBE_DMA_PCI_ARCR; in xgbe_pci_probe()
335 pdata->awcr = XGBE_DMA_PCI_AWCR; in xgbe_pci_probe()
336 pdata->awarcr = XGBE_DMA_PCI_AWARCR; in xgbe_pci_probe()
339 pdata->pp0 = XP_IOREAD(pdata, XP_PROP_0); in xgbe_pci_probe()
340 pdata->pp1 = XP_IOREAD(pdata, XP_PROP_1); in xgbe_pci_probe()
341 pdata->pp2 = XP_IOREAD(pdata, XP_PROP_2); in xgbe_pci_probe()
342 pdata->pp3 = XP_IOREAD(pdata, XP_PROP_3); in xgbe_pci_probe()
343 pdata->pp4 = XP_IOREAD(pdata, XP_PROP_4); in xgbe_pci_probe()
344 if (netif_msg_probe(pdata)) { in xgbe_pci_probe()
345 dev_dbg(dev, "port property 0 = %#010x\n", pdata->pp0); in xgbe_pci_probe()
346 dev_dbg(dev, "port property 1 = %#010x\n", pdata->pp1); in xgbe_pci_probe()
347 dev_dbg(dev, "port property 2 = %#010x\n", pdata->pp2); in xgbe_pci_probe()
348 dev_dbg(dev, "port property 3 = %#010x\n", pdata->pp3); in xgbe_pci_probe()
349 dev_dbg(dev, "port property 4 = %#010x\n", pdata->pp4); in xgbe_pci_probe()
353 pdata->tx_max_channel_count = XP_GET_BITS(pdata->pp1, XP_PROP_1, in xgbe_pci_probe()
355 pdata->rx_max_channel_count = XP_GET_BITS(pdata->pp1, XP_PROP_1, in xgbe_pci_probe()
357 pdata->tx_max_q_count = XP_GET_BITS(pdata->pp1, XP_PROP_1, in xgbe_pci_probe()
359 pdata->rx_max_q_count = XP_GET_BITS(pdata->pp1, XP_PROP_1, in xgbe_pci_probe()
361 if (netif_msg_probe(pdata)) { in xgbe_pci_probe()
363 pdata->tx_max_channel_count, in xgbe_pci_probe()
364 pdata->rx_max_channel_count); in xgbe_pci_probe()
366 pdata->tx_max_q_count, pdata->rx_max_q_count); in xgbe_pci_probe()
370 xgbe_set_counts(pdata); in xgbe_pci_probe()
373 pdata->tx_max_fifo_size = XP_GET_BITS(pdata->pp2, XP_PROP_2, in xgbe_pci_probe()
375 pdata->tx_max_fifo_size *= 16384; in xgbe_pci_probe()
376 pdata->tx_max_fifo_size = min(pdata->tx_max_fifo_size, in xgbe_pci_probe()
377 pdata->vdata->tx_max_fifo_size); in xgbe_pci_probe()
378 pdata->rx_max_fifo_size = XP_GET_BITS(pdata->pp2, XP_PROP_2, in xgbe_pci_probe()
380 pdata->rx_max_fifo_size *= 16384; in xgbe_pci_probe()
381 pdata->rx_max_fifo_size = min(pdata->rx_max_fifo_size, in xgbe_pci_probe()
382 pdata->vdata->rx_max_fifo_size); in xgbe_pci_probe()
383 if (netif_msg_probe(pdata)) in xgbe_pci_probe()
385 pdata->tx_max_fifo_size, pdata->rx_max_fifo_size); in xgbe_pci_probe()
388 ret = xgbe_config_irqs(pdata); in xgbe_pci_probe()
393 ret = xgbe_config_netdev(pdata); in xgbe_pci_probe()
397 netdev_notice(pdata->netdev, "net device enabled\n"); in xgbe_pci_probe()
402 pci_free_irq_vectors(pdata->pcidev); in xgbe_pci_probe()
405 xgbe_free_pdata(pdata); in xgbe_pci_probe()
415 struct xgbe_prv_data *pdata = pci_get_drvdata(pdev); in xgbe_pci_remove() local
417 xgbe_deconfig_netdev(pdata); in xgbe_pci_remove()
419 pci_free_irq_vectors(pdata->pcidev); in xgbe_pci_remove()
422 XP_IOWRITE(pdata, XP_INT_EN, 0x0); in xgbe_pci_remove()
424 xgbe_free_pdata(pdata); in xgbe_pci_remove()
429 struct xgbe_prv_data *pdata = dev_get_drvdata(dev); in xgbe_pci_suspend() local
430 struct net_device *netdev = pdata->netdev; in xgbe_pci_suspend()
436 pdata->lpm_ctrl = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_CTRL1); in xgbe_pci_suspend()
437 pdata->lpm_ctrl |= MDIO_CTRL1_LPOWER; in xgbe_pci_suspend()
438 XMDIO_WRITE(pdata, MDIO_MMD_PCS, MDIO_CTRL1, pdata->lpm_ctrl); in xgbe_pci_suspend()
445 struct xgbe_prv_data *pdata = dev_get_drvdata(dev); in xgbe_pci_resume() local
446 struct net_device *netdev = pdata->netdev; in xgbe_pci_resume()
449 XP_IOWRITE(pdata, XP_INT_EN, 0x1fffff); in xgbe_pci_resume()
451 pdata->lpm_ctrl &= ~MDIO_CTRL1_LPOWER; in xgbe_pci_resume()
452 XMDIO_WRITE(pdata, MDIO_MMD_PCS, MDIO_CTRL1, pdata->lpm_ctrl); in xgbe_pci_resume()
460 schedule_work(&pdata->restart_work); in xgbe_pci_resume()