stmmac: pci: Make stmmac_pci_find_phy_addr truly generic

Move the special case for the early Galileo firmware into
quark_default_setup. This allows to use stmmac_pci_find_phy_addr for
non-quark cases.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jan Kiszka 2017-06-22 08:17:59 +02:00 committed by David S. Miller
parent b6a4c8f013
commit c5f657e49c
1 changed files with 13 additions and 7 deletions

View File

@ -51,12 +51,8 @@ static int stmmac_pci_find_phy_addr(struct pci_dev *pdev,
unsigned int func = PCI_FUNC(pdev->devfn); unsigned int func = PCI_FUNC(pdev->devfn);
struct stmmac_pci_dmi_data *dmi; struct stmmac_pci_dmi_data *dmi;
/*
* Galileo boards with old firmware don't support DMI. We always return
* 1 here, so at least first found MAC controller would be probed.
*/
if (!name) if (!name)
return 1; return -ENODEV;
for (dmi = info->dmi; dmi->name && *dmi->name; dmi++) { for (dmi = info->dmi; dmi->name && *dmi->name; dmi++) {
if (!strcmp(dmi->name, name) && dmi->func == func) { if (!strcmp(dmi->name, name) && dmi->func == func) {
@ -136,9 +132,19 @@ static int quark_default_data(struct pci_dev *pdev,
* does not connect to any PHY interface. * does not connect to any PHY interface.
*/ */
ret = stmmac_pci_find_phy_addr(pdev, info); ret = stmmac_pci_find_phy_addr(pdev, info);
if (ret < 0) if (ret < 0) {
/* Return error to the caller on DMI enabled boards. */
if (dmi_get_system_info(DMI_BOARD_NAME))
return ret; return ret;
/*
* Galileo boards with old firmware don't support DMI. We always
* use 1 here as PHY address, so at least the first found MAC
* controller would be probed.
*/
ret = 1;
}
plat->bus_id = PCI_DEVID(pdev->bus->number, pdev->devfn); plat->bus_id = PCI_DEVID(pdev->bus->number, pdev->devfn);
plat->phy_addr = ret; plat->phy_addr = ret;
plat->interface = PHY_INTERFACE_MODE_RMII; plat->interface = PHY_INTERFACE_MODE_RMII;