Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751307AbdFBHfM (ORCPT ); Fri, 2 Jun 2017 03:35:12 -0400 Received: from david.siemens.de ([192.35.17.14]:44182 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751142AbdFBHfI (ORCPT ); Fri, 2 Jun 2017 03:35:08 -0400 From: Jan Kiszka To: Giuseppe Cavallaro , Alexandre Torgue , David Miller Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [PATCH v4 3/6] stmmac: pci: Make stmmac_pci_find_phy_addr truly generic Date: Fri, 2 Jun 2017 09:34:51 +0200 Message-Id: <007d588e119a6c5b91c8527a508b03c4fa1861be.1496388893.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 2.12.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1751 Lines: 51 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 Reviewed-by: Andy Shevchenko --- drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c index d3d74e526e17..f44ae49eb11c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c @@ -51,12 +51,8 @@ static int stmmac_pci_find_phy_addr(struct pci_dev *pdev, unsigned int func = PCI_FUNC(pdev->devfn); 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) - return 1; + return -ENODEV; for (dmi = info->dmi; dmi->name && *dmi->name; dmi++) { if (!strcmp(dmi->name, name) && dmi->func == func) { @@ -136,8 +132,18 @@ static int quark_default_data(struct pci_dev *pdev, * does not connect to any PHY interface. */ ret = stmmac_pci_find_phy_addr(pdev, info); - if (ret < 0) - return ret; + if (ret < 0) { + /* Return error to the caller on DMI enabled boards. */ + if (dmi_get_system_info(DMI_BOARD_NAME)) + 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->phy_addr = ret; -- 2.12.3