Lines Matching refs:pdata
140 static struct xgbe_version_data *xgbe_acpi_vdata(struct xgbe_prv_data *pdata) in xgbe_acpi_vdata() argument
144 id = acpi_match_device(xgbe_acpi_match, pdata->dev); in xgbe_acpi_vdata()
149 static int xgbe_acpi_support(struct xgbe_prv_data *pdata) in xgbe_acpi_support() argument
151 struct device *dev = pdata->dev; in xgbe_acpi_support()
162 pdata->sysclk_rate = property; in xgbe_acpi_support()
171 pdata->ptpclk_rate = property; in xgbe_acpi_support()
176 static struct xgbe_version_data *xgbe_acpi_vdata(struct xgbe_prv_data *pdata) in xgbe_acpi_vdata() argument
181 static int xgbe_acpi_support(struct xgbe_prv_data *pdata) in xgbe_acpi_support() argument
190 static struct xgbe_version_data *xgbe_of_vdata(struct xgbe_prv_data *pdata) in xgbe_of_vdata() argument
194 id = of_match_device(xgbe_of_match, pdata->dev); in xgbe_of_vdata()
199 static int xgbe_of_support(struct xgbe_prv_data *pdata) in xgbe_of_support() argument
201 struct device *dev = pdata->dev; in xgbe_of_support()
204 pdata->sysclk = devm_clk_get(dev, XGBE_DMA_CLOCK); in xgbe_of_support()
205 if (IS_ERR(pdata->sysclk)) { in xgbe_of_support()
207 return PTR_ERR(pdata->sysclk); in xgbe_of_support()
209 pdata->sysclk_rate = clk_get_rate(pdata->sysclk); in xgbe_of_support()
212 pdata->ptpclk = devm_clk_get(dev, XGBE_PTP_CLOCK); in xgbe_of_support()
213 if (IS_ERR(pdata->ptpclk)) { in xgbe_of_support()
215 return PTR_ERR(pdata->ptpclk); in xgbe_of_support()
217 pdata->ptpclk_rate = clk_get_rate(pdata->ptpclk); in xgbe_of_support()
222 static struct platform_device *xgbe_of_get_phy_pdev(struct xgbe_prv_data *pdata) in xgbe_of_get_phy_pdev() argument
224 struct device *dev = pdata->dev; in xgbe_of_get_phy_pdev()
241 phy_pdev = pdata->platdev; in xgbe_of_get_phy_pdev()
247 static struct xgbe_version_data *xgbe_of_vdata(struct xgbe_prv_data *pdata) in xgbe_of_vdata() argument
252 static int xgbe_of_support(struct xgbe_prv_data *pdata) in xgbe_of_support() argument
257 static struct platform_device *xgbe_of_get_phy_pdev(struct xgbe_prv_data *pdata) in xgbe_of_get_phy_pdev() argument
279 static struct platform_device *xgbe_get_phy_pdev(struct xgbe_prv_data *pdata) in xgbe_get_phy_pdev() argument
283 if (pdata->use_acpi) { in xgbe_get_phy_pdev()
284 get_device(pdata->dev); in xgbe_get_phy_pdev()
285 phy_pdev = pdata->platdev; in xgbe_get_phy_pdev()
287 phy_pdev = xgbe_of_get_phy_pdev(pdata); in xgbe_get_phy_pdev()
293 static struct xgbe_version_data *xgbe_get_vdata(struct xgbe_prv_data *pdata) in xgbe_get_vdata() argument
295 return pdata->use_acpi ? xgbe_acpi_vdata(pdata) in xgbe_get_vdata()
296 : xgbe_of_vdata(pdata); in xgbe_get_vdata()
301 struct xgbe_prv_data *pdata; in xgbe_platform_probe() local
310 pdata = xgbe_alloc_pdata(dev); in xgbe_platform_probe()
311 if (IS_ERR(pdata)) { in xgbe_platform_probe()
312 ret = PTR_ERR(pdata); in xgbe_platform_probe()
316 pdata->platdev = pdev; in xgbe_platform_probe()
317 pdata->adev = ACPI_COMPANION(dev); in xgbe_platform_probe()
318 platform_set_drvdata(pdev, pdata); in xgbe_platform_probe()
321 pdata->use_acpi = dev->of_node ? 0 : 1; in xgbe_platform_probe()
324 pdata->vdata = xgbe_get_vdata(pdata); in xgbe_platform_probe()
326 phy_pdev = xgbe_get_phy_pdev(pdata); in xgbe_platform_probe()
332 pdata->phy_platdev = phy_pdev; in xgbe_platform_probe()
333 pdata->phy_dev = &phy_pdev->dev; in xgbe_platform_probe()
355 pdata->xgmac_regs = devm_platform_ioremap_resource(pdev, 0); in xgbe_platform_probe()
356 if (IS_ERR(pdata->xgmac_regs)) { in xgbe_platform_probe()
358 ret = PTR_ERR(pdata->xgmac_regs); in xgbe_platform_probe()
361 if (netif_msg_probe(pdata)) in xgbe_platform_probe()
362 dev_dbg(dev, "xgmac_regs = %p\n", pdata->xgmac_regs); in xgbe_platform_probe()
364 pdata->xpcs_regs = devm_platform_ioremap_resource(pdev, 1); in xgbe_platform_probe()
365 if (IS_ERR(pdata->xpcs_regs)) { in xgbe_platform_probe()
367 ret = PTR_ERR(pdata->xpcs_regs); in xgbe_platform_probe()
370 if (netif_msg_probe(pdata)) in xgbe_platform_probe()
371 dev_dbg(dev, "xpcs_regs = %p\n", pdata->xpcs_regs); in xgbe_platform_probe()
373 pdata->rxtx_regs = devm_platform_ioremap_resource(phy_pdev, in xgbe_platform_probe()
375 if (IS_ERR(pdata->rxtx_regs)) { in xgbe_platform_probe()
377 ret = PTR_ERR(pdata->rxtx_regs); in xgbe_platform_probe()
380 if (netif_msg_probe(pdata)) in xgbe_platform_probe()
381 dev_dbg(dev, "rxtx_regs = %p\n", pdata->rxtx_regs); in xgbe_platform_probe()
383 pdata->sir0_regs = devm_platform_ioremap_resource(phy_pdev, in xgbe_platform_probe()
385 if (IS_ERR(pdata->sir0_regs)) { in xgbe_platform_probe()
387 ret = PTR_ERR(pdata->sir0_regs); in xgbe_platform_probe()
390 if (netif_msg_probe(pdata)) in xgbe_platform_probe()
391 dev_dbg(dev, "sir0_regs = %p\n", pdata->sir0_regs); in xgbe_platform_probe()
393 pdata->sir1_regs = devm_platform_ioremap_resource(phy_pdev, in xgbe_platform_probe()
395 if (IS_ERR(pdata->sir1_regs)) { in xgbe_platform_probe()
397 ret = PTR_ERR(pdata->sir1_regs); in xgbe_platform_probe()
400 if (netif_msg_probe(pdata)) in xgbe_platform_probe()
401 dev_dbg(dev, "sir1_regs = %p\n", pdata->sir1_regs); in xgbe_platform_probe()
405 pdata->mac_addr, in xgbe_platform_probe()
406 sizeof(pdata->mac_addr)); in xgbe_platform_probe()
407 if (ret || !is_valid_ether_addr(pdata->mac_addr)) { in xgbe_platform_probe()
423 pdata->phy_mode = PHY_INTERFACE_MODE_XGMII; in xgbe_platform_probe()
427 pdata->per_channel_irq = 1; in xgbe_platform_probe()
428 pdata->channel_irq_mode = XGBE_IRQ_MODE_EDGE; in xgbe_platform_probe()
432 if (pdata->use_acpi) in xgbe_platform_probe()
433 ret = xgbe_acpi_support(pdata); in xgbe_platform_probe()
435 ret = xgbe_of_support(pdata); in xgbe_platform_probe()
446 pdata->coherent = (attr == DEV_DMA_COHERENT); in xgbe_platform_probe()
447 if (pdata->coherent) { in xgbe_platform_probe()
448 pdata->arcr = XGBE_DMA_OS_ARCR; in xgbe_platform_probe()
449 pdata->awcr = XGBE_DMA_OS_AWCR; in xgbe_platform_probe()
451 pdata->arcr = XGBE_DMA_SYS_ARCR; in xgbe_platform_probe()
452 pdata->awcr = XGBE_DMA_SYS_AWCR; in xgbe_platform_probe()
456 pdata->tx_max_fifo_size = pdata->vdata->tx_max_fifo_size; in xgbe_platform_probe()
457 pdata->rx_max_fifo_size = pdata->vdata->rx_max_fifo_size; in xgbe_platform_probe()
460 xgbe_set_counts(pdata); in xgbe_platform_probe()
463 pdata->irq_count = 2; in xgbe_platform_probe()
469 pdata->dev_irq = ret; in xgbe_platform_probe()
472 if (pdata->per_channel_irq) { in xgbe_platform_probe()
473 unsigned int i, max = ARRAY_SIZE(pdata->channel_irq); in xgbe_platform_probe()
476 ret = platform_get_irq(pdata->platdev, dma_irqnum++); in xgbe_platform_probe()
480 pdata->channel_irq[i] = ret; in xgbe_platform_probe()
483 pdata->channel_irq_count = max; in xgbe_platform_probe()
485 pdata->irq_count += max; in xgbe_platform_probe()
492 pdata->an_irq = ret; in xgbe_platform_probe()
495 ret = xgbe_config_netdev(pdata); in xgbe_platform_probe()
499 netdev_notice(pdata->netdev, "net device enabled\n"); in xgbe_platform_probe()
507 xgbe_free_pdata(pdata); in xgbe_platform_probe()
517 struct xgbe_prv_data *pdata = platform_get_drvdata(pdev); in xgbe_platform_remove() local
519 xgbe_deconfig_netdev(pdata); in xgbe_platform_remove()
521 platform_device_put(pdata->phy_platdev); in xgbe_platform_remove()
523 xgbe_free_pdata(pdata); in xgbe_platform_remove()
531 struct xgbe_prv_data *pdata = dev_get_drvdata(dev); in xgbe_platform_suspend() local
532 struct net_device *netdev = pdata->netdev; in xgbe_platform_suspend()
540 pdata->lpm_ctrl = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_CTRL1); in xgbe_platform_suspend()
541 pdata->lpm_ctrl |= MDIO_CTRL1_LPOWER; in xgbe_platform_suspend()
542 XMDIO_WRITE(pdata, MDIO_MMD_PCS, MDIO_CTRL1, pdata->lpm_ctrl); in xgbe_platform_suspend()
551 struct xgbe_prv_data *pdata = dev_get_drvdata(dev); in xgbe_platform_resume() local
552 struct net_device *netdev = pdata->netdev; in xgbe_platform_resume()
557 pdata->lpm_ctrl &= ~MDIO_CTRL1_LPOWER; in xgbe_platform_resume()
558 XMDIO_WRITE(pdata, MDIO_MMD_PCS, MDIO_CTRL1, pdata->lpm_ctrl); in xgbe_platform_resume()
566 schedule_work(&pdata->restart_work); in xgbe_platform_resume()