// SPDX-License-Identifier: GPL-2.0-only /******************************************************************************* This contains the functions to handle the pci driver.
Copyright (C) 2011-2012 Vayavya Labs Pvt Ltd
Author: Rayagond Kokatanur <rayagond@vayavyalabs.com> Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
staticint stmmac_default_data(struct pci_dev *pdev, struct plat_stmmacenet_data *plat)
{ /* Set common default data first */
common_default_data(plat);
/** * stmmac_pci_probe * * @pdev: pci device pointer * @id: pointer to table of device id/id's. * * Description: This probing function gets called for all PCI devices which * match the ID table and are not "owned" by other driver yet. This function * gets passed a "struct pci_dev *" for each device whose entry in the ID table * matches the device. The probe functions returns zero when the driver choose * to take "ownership" of the device or an error code(-ve no) otherwise.
*/ staticint stmmac_pci_probe(struct pci_dev *pdev, conststruct pci_device_id *id)
{ struct stmmac_pci_info *info = (struct stmmac_pci_info *)id->driver_data; struct plat_stmmacenet_data *plat; struct stmmac_resources res = {}; int ret; int i;
plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL); if (!plat) return -ENOMEM;
plat->mdio_bus_data = devm_kzalloc(&pdev->dev, sizeof(*plat->mdio_bus_data),
GFP_KERNEL); if (!plat->mdio_bus_data) return -ENOMEM;
plat->dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*plat->dma_cfg),
GFP_KERNEL); if (!plat->dma_cfg) return -ENOMEM;
plat->safety_feat_cfg = devm_kzalloc(&pdev->dev, sizeof(*plat->safety_feat_cfg),
GFP_KERNEL); if (!plat->safety_feat_cfg) return -ENOMEM;
/* Enable pci device */
ret = pcim_enable_device(pdev); if (ret) {
dev_err(&pdev->dev, "%s: ERROR: failed to enable device\n",
__func__); return ret;
}
/* Get the base address of device */ for (i = 0; i < PCI_STD_NUM_BARS; i++) { if (pci_resource_len(pdev, i) == 0) continue;
res.addr = pcim_iomap_region(pdev, i, STMMAC_RESOURCE_NAME); if (IS_ERR(res.addr)) return PTR_ERR(res.addr); break;
}
pci_set_master(pdev);
ret = info->setup(pdev, plat); if (ret) return ret;
/** * stmmac_pci_remove * * @pdev: platform device pointer * Description: this function calls the main to free the net resources.
*/ staticvoid stmmac_pci_remove(struct pci_dev *pdev)
{
stmmac_dvr_remove(&pdev->dev);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.