Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1068992ybi; Fri, 14 Jun 2019 08:07:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzaEegBEIwuMOExAuR72Tchq626sZuVthMQAQABJWr8t1ybDoEmdnXZR1lr1SpWC7xksZuX X-Received: by 2002:a17:902:2ba9:: with SMTP id l38mr87748740plb.300.1560524858111; Fri, 14 Jun 2019 08:07:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560524858; cv=none; d=google.com; s=arc-20160816; b=tvtR9m3RCwCKfb3aibw5thUdiS5UEUEzy83dvUHecWTRq5WeXD7n/I0XrvmR9ZgU3y xGGM7ffecvqcS1SwrBMY56EbXdbQjNUBr2ZUle7eQfVMP3EwkLSs11sjIJkH1MN03EZE WpCpBkPg+YY3SRV45lCnhJWdc4ghXh7HPYbr2gIRpbpuBbFS8C8UfFKXH4kPSsRcmOR1 baNhgum4HVUvdyhAYykROe9qLCHuOdB+9VnDhTKY2/oohn1sfa1qnqt3TxQpI6rVhS/7 c5lXg11DTVj0x1NhNPWAHPkatmzicVmLAOBClyIB65EONxca/1DK4+tLhdjbzMpjirH0 pkNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=HMc2M2aqUxIINCNE3XlsgBQUuxkm6It93UoTxw6y8K8=; b=VvIavLHmK1TOMePn8U5D/q7ELyvKrFaU3SIRvuke7bs5CXLyLTwGSjFV8+ikBPzuup EKtXJ/B+4z1C66BbAOyhbFUy7V29Y30RL8NYHHbHU41GiBlI2f1mPvjawluxZVMbFv7Z t9hzD+2C3qQ97td1gJyVXYhteJ6Y8u3t+8eL6bhT8p2tJHl8I2tNpOE5BKU5bIkKiNkT ndTs1QfIX3gEaJNBP6YEhlJlCmtmZaXQ17lyzZLooZn9WLS4N69RKwwH50sTfVkm+W6v NiFL1R8NirSAT6XdmRD8vcE6evdINIGVZ79Rk390+UMTriTCWMPyrzGFlCL15I245oTd Cr1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=dBsQifPE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s5si2486617pjp.29.2019.06.14.08.07.20; Fri, 14 Jun 2019 08:07:38 -0700 (PDT) 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; dkim=pass header.i=@synopsys.com header.s=mail header.b=dBsQifPE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726298AbfFNPHC (ORCPT + 99 others); Fri, 14 Jun 2019 11:07:02 -0400 Received: from smtprelay-out1.synopsys.com ([198.182.47.102]:43456 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725780AbfFNPHB (ORCPT ); Fri, 14 Jun 2019 11:07:01 -0400 Received: from mailhost.synopsys.com (unknown [10.225.0.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 15BE3C2390; Fri, 14 Jun 2019 15:07:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1560524821; bh=Op4ZxYsnB/J5QGVqA8PvUdINkiagCSQfGiBRXY2o7c0=; h=From:To:Cc:Subject:Date:From; b=dBsQifPEpa85HVcpdeXh7YlLop1tFH1dgbIUVMj/+qGvYBo37np+zKGyj5yGZh/Lz EQLtISnYcXPrDkB5MiXjpzbptFax6EMHsj2XDHt0vqNDdw9ht+VuxwTue1G4W4uA9w pbeKycT5xzRERcspB85uSBJQafSjjbMEGxKN6YEonznaEB7j90ycqm0cKEe2woUQ0w /z05pmZwlr8kRmKmJqDA4U6ekBGsYly3Zay0jKcDdz0E/ekoBL2/Rkh3MoamsaulHd KbLIxbVb8Gams6DsHkRcspDCqOYmughUsZFZEG9cp3Pqe7b77VYLrgh23vT1fNDFom IZY/RIgpNUXUg== Received: from de02.synopsys.com (de02.internal.synopsys.com [10.225.17.21]) by mailhost.synopsys.com (Postfix) with ESMTP id 371EAA022E; Fri, 14 Jun 2019 15:06:58 +0000 (UTC) Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by de02.synopsys.com (Postfix) with ESMTP id D390E3F849; Fri, 14 Jun 2019 17:06:58 +0200 (CEST) From: Jose Abreu To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Jose Abreu , Joao Pinto , "David S . Miller" , Giuseppe Cavallaro , Alexandre Torgue Subject: [PATCH net-next] net: stmmac: Fix wrapper drivers not detecting PHY Date: Fri, 14 Jun 2019 17:06:57 +0200 Message-Id: X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Because of PHYLINK conversion we stopped parsing the phy-handle property from DT. Unfortunatelly, some wrapper drivers still rely on this phy node to configure the PHY. Let's restore the parsing of PHY handle while these wrapper drivers are not fully converted to PHYLINK. Reported-by: Corentin Labbe Fixes: 74371272f97f ("net: stmmac: Convert to phylink and remove phylib logic") Signed-off-by: Jose Abreu Cc: Joao Pinto Cc: David S. Miller Cc: Giuseppe Cavallaro Cc: Alexandre Torgue --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++-- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 9 ++++++++- include/linux/stmmac.h | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index ad007d8bf9d7..069951590018 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -958,7 +958,7 @@ static int stmmac_init_phy(struct net_device *dev) struct device_node *node; int ret; - node = priv->plat->phy_node; + node = priv->plat->phylink_node; if (node) { ret = phylink_of_phy_connect(priv->phylink, node, 0); @@ -980,7 +980,7 @@ static int stmmac_init_phy(struct net_device *dev) static int stmmac_phy_setup(struct stmmac_priv *priv) { - struct device_node *node = priv->plat->phy_node; + struct device_node *node = priv->plat->phylink_node; int mode = priv->plat->interface; struct phylink *phylink; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 898f94aced53..49adda9b0ad8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -381,7 +381,13 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) *mac = of_get_mac_address(np); plat->interface = of_get_phy_mode(np); - plat->phy_node = np; + + /* Some wrapper drivers still rely on phy_node. Let's save it while + * they are not converted to phylink. */ + plat->phy_node = of_parse_phandle(np, "phy-handle", 0); + + /* PHYLINK automatically parses the phy-handle property */ + plat->phylink_node = np; /* Get max speed of operation from device tree */ if (of_property_read_u32(np, "max-speed", &plat->max_speed)) @@ -577,6 +583,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) void stmmac_remove_config_dt(struct platform_device *pdev, struct plat_stmmacenet_data *plat) { + of_node_put(plat->phy_node); of_node_put(plat->mdio_node); } #else diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 4335bd771ce5..1250e737f320 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -151,6 +151,7 @@ struct plat_stmmacenet_data { int interface; struct stmmac_mdio_bus_data *mdio_bus_data; struct device_node *phy_node; + struct device_node *phylink_node; struct device_node *mdio_node; struct stmmac_dma_cfg *dma_cfg; int clk_csr; -- 2.7.4