1bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO/******************************************************************************* 2bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO This contains the functions to handle the pci driver. 3bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 4bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO Copyright (C) 2011-2012 Vayavya Labs Pvt Ltd 5bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 6bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO This program is free software; you can redistribute it and/or modify it 7bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO under the terms and conditions of the GNU General Public License, 8bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO version 2, as published by the Free Software Foundation. 9bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 10bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO This program is distributed in the hope it will be useful, but WITHOUT 11bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO more details. 14bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 15bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO You should have received a copy of the GNU General Public License along with 16bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO this program; if not, write to the Free Software Foundation, Inc., 17bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 18bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 19bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO The full GNU General Public License is included in this distribution in 20bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO the file called "COPYING". 21bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 22bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO Author: Rayagond Kokatanur <rayagond@vayavyalabs.com> 23bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> 24bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO*******************************************************************************/ 25bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 26bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO#include <linux/pci.h> 27bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO#include "stmmac.h" 28bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 29bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROstruct plat_stmmacenet_data plat_dat; 30bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROstruct stmmac_mdio_bus_data mdio_data; 31bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 32bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROstatic void stmmac_default_data(void) 33bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO{ 34bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO memset(&plat_dat, 0, sizeof(struct plat_stmmacenet_data)); 35bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO plat_dat.bus_id = 1; 36bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO plat_dat.phy_addr = 0; 37bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO plat_dat.interface = PHY_INTERFACE_MODE_GMII; 38bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO plat_dat.pbl = 32; 39bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO plat_dat.clk_csr = 2; /* clk_csr_i = 20-35MHz & MDC = clk_csr_i/16 */ 40bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO plat_dat.has_gmac = 1; 41bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO plat_dat.force_sf_dma_mode = 1; 42bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 43bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO mdio_data.bus_id = 1; 44bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO mdio_data.phy_reset = NULL; 45bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO mdio_data.phy_mask = 0; 46bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO plat_dat.mdio_bus_data = &mdio_data; 47bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO} 48bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 49bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO/** 50bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO * stmmac_pci_probe 51bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO * 52bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO * @pdev: pci device pointer 53bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO * @id: pointer to table of device id/id's. 54bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO * 55bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO * Description: This probing function gets called for all PCI devices which 56bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO * match the ID table and are not "owned" by other driver yet. This function 57bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO * gets passed a "struct pci_dev *" for each device whose entry in the ID table 58bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO * matches the device. The probe functions returns zero when the driver choose 59bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO * to take "ownership" of the device or an error code(-ve no) otherwise. 60bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO */ 61bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROstatic int __devinit stmmac_pci_probe(struct pci_dev *pdev, 62bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO const struct pci_device_id *id) 63bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO{ 64bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO int ret = 0; 65bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO void __iomem *addr = NULL; 66bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO struct stmmac_priv *priv = NULL; 67bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO int i; 68bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 69bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO /* Enable pci device */ 70bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO ret = pci_enable_device(pdev); 71bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO if (ret) { 72bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO pr_err("%s : ERROR: failed to enable %s device\n", __func__, 73bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO pci_name(pdev)); 74bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO return ret; 75bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO } 76bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO if (pci_request_regions(pdev, STMMAC_RESOURCE_NAME)) { 77bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO pr_err("%s: ERROR: failed to get PCI region\n", __func__); 78bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO ret = -ENODEV; 79bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO goto err_out_req_reg_failed; 80bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO } 81bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 82bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO /* Get the base address of device */ 83bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO for (i = 0; i <= 5; i++) { 84bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO if (pci_resource_len(pdev, i) == 0) 85bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO continue; 86bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO addr = pci_iomap(pdev, i, 0); 87bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO if (addr == NULL) { 888c1a7f5283e72306d1d23524f051501ffa1baf57Masanari Iida pr_err("%s: ERROR: cannot map register memory, aborting", 89bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO __func__); 90bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO ret = -EIO; 91bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO goto err_out_map_failed; 92bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO } 93bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO break; 94bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO } 95bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO pci_set_master(pdev); 96bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 97bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO stmmac_default_data(); 98bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 99cf3f047b9af49d4ee8abfa31b0ef0e99cbcaf17dGiuseppe CAVALLARO priv = stmmac_dvr_probe(&(pdev->dev), &plat_dat, addr); 100bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO if (!priv) { 1010f09a343dabeadc4dcde4714317e25de2e93fd13Masanari Iida pr_err("%s: main driver probe failed", __func__); 102bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO goto err_out; 103bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO } 104bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO priv->dev->irq = pdev->irq; 105bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO priv->wol_irq = pdev->irq; 106bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 107bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO pci_set_drvdata(pdev, priv->dev); 108bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 109bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO pr_debug("STMMAC platform driver registration completed"); 110bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 111bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO return 0; 112bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 113bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROerr_out: 114bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO pci_clear_master(pdev); 115bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROerr_out_map_failed: 116bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO pci_release_regions(pdev); 117bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROerr_out_req_reg_failed: 118bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO pci_disable_device(pdev); 119bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 120bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO return ret; 121bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO} 122bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 123bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO/** 124bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO * stmmac_dvr_remove 125bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO * 126bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO * @pdev: platform device pointer 127bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO * Description: this function calls the main to free the net resources 128bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO * and releases the PCI resources. 129bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO */ 130bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROstatic void __devexit stmmac_pci_remove(struct pci_dev *pdev) 131bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO{ 132bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO struct net_device *ndev = pci_get_drvdata(pdev); 133bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO struct stmmac_priv *priv = netdev_priv(ndev); 134bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 135bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO stmmac_dvr_remove(ndev); 136bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 137bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO pci_set_drvdata(pdev, NULL); 138bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO pci_iounmap(pdev, priv->ioaddr); 139bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO pci_release_regions(pdev); 140bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO pci_disable_device(pdev); 141bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO} 142bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 143bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO#ifdef CONFIG_PM 144bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROstatic int stmmac_pci_suspend(struct pci_dev *pdev, pm_message_t state) 145bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO{ 146bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO struct net_device *ndev = pci_get_drvdata(pdev); 147bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO int ret; 148bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 149bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO ret = stmmac_suspend(ndev); 150bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO pci_save_state(pdev); 151bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO pci_set_power_state(pdev, pci_choose_state(pdev, state)); 152bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 153bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO return ret; 154bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO} 155bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 156bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROstatic int stmmac_pci_resume(struct pci_dev *pdev) 157bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO{ 158bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO struct net_device *ndev = pci_get_drvdata(pdev); 159bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 160bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO pci_set_power_state(pdev, PCI_D0); 161bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO pci_restore_state(pdev); 162bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 163bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO return stmmac_resume(ndev); 164bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO} 165bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO#endif 166bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 167bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO#define STMMAC_VENDOR_ID 0x700 168bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO#define STMMAC_DEVICE_ID 0x1108 169bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 170bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROstatic DEFINE_PCI_DEVICE_TABLE(stmmac_id_table) = { 1715437f4b2576f1763a27bc4c0e7f7c280220ba1aaAlessandro Rubini {PCI_DEVICE(STMMAC_VENDOR_ID, STMMAC_DEVICE_ID)}, 1725437f4b2576f1763a27bc4c0e7f7c280220ba1aaAlessandro Rubini {PCI_DEVICE(PCI_VENDOR_ID_STMICRO, PCI_DEVICE_ID_STMICRO_MAC)}, 1735437f4b2576f1763a27bc4c0e7f7c280220ba1aaAlessandro Rubini {} 174bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO}; 175bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 176bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROMODULE_DEVICE_TABLE(pci, stmmac_id_table); 177bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 178bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROstatic struct pci_driver stmmac_driver = { 179bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO .name = STMMAC_RESOURCE_NAME, 180bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO .id_table = stmmac_id_table, 181bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO .probe = stmmac_pci_probe, 182bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO .remove = __devexit_p(stmmac_pci_remove), 183bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO#ifdef CONFIG_PM 184bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO .suspend = stmmac_pci_suspend, 185bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO .resume = stmmac_pci_resume, 186bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO#endif 187bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO}; 188bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 189bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO/** 190bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO * stmmac_init_module - Entry point for the driver 191bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO * Description: This function is the entry point for the driver. 192bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO */ 193bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROstatic int __init stmmac_init_module(void) 194bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO{ 195bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO int ret; 196bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 197bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO ret = pci_register_driver(&stmmac_driver); 198bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO if (ret < 0) 199bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO pr_err("%s: ERROR: driver registration failed\n", __func__); 200bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 201bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO return ret; 202bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO} 203bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 204bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO/** 205bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO * stmmac_cleanup_module - Cleanup routine for the driver 206bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO * Description: This function is the cleanup routine for the driver. 207bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO */ 208bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROstatic void __exit stmmac_cleanup_module(void) 209bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO{ 210bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO pci_unregister_driver(&stmmac_driver); 211bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO} 212bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 213bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROmodule_init(stmmac_init_module); 214bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROmodule_exit(stmmac_cleanup_module); 215bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLARO 216bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROMODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet PCI driver"); 217bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROMODULE_AUTHOR("Rayagond Kokatanur <rayagond.kokatanur@vayavyalabs.com>"); 218bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROMODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>"); 219bfab27a146ed4d722c6d399f844f955f29cd2b81Giuseppe CAVALLAROMODULE_LICENSE("GPL"); 220