From patchwork Mon Feb 29 16:18:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel Fernandez X-Patchwork-Id: 63228 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp1340284lbc; Mon, 29 Feb 2016 08:18:31 -0800 (PST) X-Received: by 10.98.72.24 with SMTP id v24mr23062062pfa.15.1456762711459; Mon, 29 Feb 2016 08:18:31 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ey9si43899863pab.123.2016.02.29.08.18.31; Mon, 29 Feb 2016 08:18:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=pass header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756210AbcB2QS3 (ORCPT + 30 others); Mon, 29 Feb 2016 11:18:29 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:33968 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754636AbcB2QS0 (ORCPT ); Mon, 29 Feb 2016 11:18:26 -0500 Received: by mail-wm0-f52.google.com with SMTP id p65so75880322wmp.1 for ; Mon, 29 Feb 2016 08:18:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=pk4jthAZ2+dtamCp0FhJgUBM7yjle/kz40SyMLMGrT4=; b=QUX44EO7EmPjsA5gZwx7eSjKQ3C3sa4iYsz05kTap0fAYDF9WGfEVM9CLrzS9vDXvr WqAj2ExzcUyoUpDkZouT5rSrrjwRLTzeCuxbWBqTqPLvxsI6LApHAfIrLLvLEs3St7HL 1pl05f8N3v592atL2dpQTIfw/EICX57mTVQFU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=pk4jthAZ2+dtamCp0FhJgUBM7yjle/kz40SyMLMGrT4=; b=TVTyTnZ50tE3bYw5xB2Orj5Dga7ZkUE7M7xQYNZFzQOqX0mwgz8mPMxK1XNoF0drew BA00xbU0fO/6tKRKmuBDFueD37omepEgFyEtEzh0USGbnIQRpVTa8EX6srDhmTVWzpsg UdFJLAA0Tuw07yOUZJf2xEu8xd52wQRC0350x/3aplwJwk4Ru9ga2r2jSVZzwVzL0aPq ZgQNyKIHxBr+9Lw2U3Ka6Rh9yAZUS796vYbiidatTstj76fdVAiOk/TQRv0fc/UGh12q OxHHiQdiZvjrbY59Tg9y1ksWSc6v9jD8H5PzYH/v7OZDw3DvKrcj4R3cHl/fzcLJ0i6/ txeg== X-Gm-Message-State: AD7BkJI9KiRDxweYVtO2JFqf1YtDW+LKKa8fguneok32PtFikUDtCiIH1evn4//WZpO1OVmT X-Received: by 10.194.246.35 with SMTP id xt3mr17439155wjc.57.1456762705393; Mon, 29 Feb 2016 08:18:25 -0800 (PST) Received: from lmenx315.st.com. ([80.12.39.16]) by smtp.gmail.com with ESMTPSA id c7sm16986637wmd.13.2016.02.29.08.18.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 29 Feb 2016 08:18:24 -0800 (PST) From: Gabriel Fernandez To: Giuseppe Cavallaro , Phil Reid , davem@davemloft.net, Joachim Eastwood , Vince Bridgers , Gabriel Fernandez , Mathieu Olivari Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, alexandre.torgue@st.com, maxime.coquelin@st.com Subject: [PATCH] stmmac: Fix 'eth0: No PHY found' regression Date: Mon, 29 Feb 2016 17:18:22 +0100 Message-Id: <1456762702-23713-1-git-send-email-gabriel.fernandez@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch manages the case when you have an Ethernet MAC with a "fixed link", and not connected to a normal MDIO-managed PHY device. The test of phy_bus_name was not helpful because it was never affected and replaced by the mdio test node. Signed-off-by: Gabriel Fernandez --- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 11 +---------- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 9 ++++++++- include/linux/stmmac.h | 1 + 3 files changed, 10 insertions(+), 11 deletions(-) -- 1.9.1 diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index 0faf163..efb54f3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -199,21 +199,12 @@ int stmmac_mdio_register(struct net_device *ndev) struct stmmac_priv *priv = netdev_priv(ndev); struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data; int addr, found; - struct device_node *mdio_node = NULL; - struct device_node *child_node = NULL; + struct device_node *mdio_node = priv->plat->mdio_node; if (!mdio_bus_data) return 0; if (IS_ENABLED(CONFIG_OF)) { - for_each_child_of_node(priv->device->of_node, child_node) { - if (of_device_is_compatible(child_node, - "snps,dwmac-mdio")) { - mdio_node = child_node; - break; - } - } - if (mdio_node) { netdev_dbg(ndev, "FOUND MDIO subnode\n"); } else { diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 6a52fa1..4514ba7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -110,6 +110,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) struct device_node *np = pdev->dev.of_node; struct plat_stmmacenet_data *plat; struct stmmac_dma_cfg *dma_cfg; + struct device_node *child_node = NULL; plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL); if (!plat) @@ -140,13 +141,19 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) plat->phy_node = of_node_get(np); } + for_each_child_of_node(np, child_node) + if (of_device_is_compatible(child_node, "snps,dwmac-mdio")) { + plat->mdio_node = child_node; + break; + } + /* "snps,phy-addr" is not a standard property. Mark it as deprecated * and warn of its use. Remove this when phy node support is added. */ if (of_property_read_u32(np, "snps,phy-addr", &plat->phy_addr) == 0) dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n"); - if ((plat->phy_node && !of_phy_is_fixed_link(np)) || plat->phy_bus_name) + if ((plat->phy_node && !of_phy_is_fixed_link(np)) || !plat->mdio_node) plat->mdio_bus_data = NULL; else plat->mdio_bus_data = diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index eead8ab..881a79d 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -100,6 +100,7 @@ struct plat_stmmacenet_data { int interface; struct stmmac_mdio_bus_data *mdio_bus_data; struct device_node *phy_node; + struct device_node *mdio_node; struct stmmac_dma_cfg *dma_cfg; int clk_csr; int has_gmac;