From patchwork Fri Sep 8 07:11:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 112016 Delivered-To: patch@linaro.org Received: by 10.140.94.239 with SMTP id g102csp1126589qge; Fri, 8 Sep 2017 00:15:27 -0700 (PDT) X-Received: by 10.84.216.73 with SMTP id f9mr2449333plj.169.1504854927780; Fri, 08 Sep 2017 00:15:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504854927; cv=none; d=google.com; s=arc-20160816; b=X+LdfpnzzZIisBBeJCuJS3g+bQuvf7RThIItWH+VdAM1DZ8otYP9spGRLfRtAQW21X DNLZfd+KTquLQ72f12S5YS2qmkHdHS85ya15lAq5ADKWG6SlVZnTfha3BUBGXw5yNk2f XLtJbdlz1DJKxBSR7DQJ1JFCzVOoTtRwvq+ChRFRYgsmwYAjSvYT9iK1dIvdb5BvS3yM pWPPMrkuXWrvrEzsdWc1xKbo6kf5EO0te1Xx/C9o56JHx8YyqgDQyAnnEBOi22l/SnkG CZa2DCgXp5S//0Hn/SueFsuWmhdM1nLMd5PzFLvXR6dzZnbOPOPrgrps3647PQlFTcZv c13A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=ZDRqn6oM7YLvC7qyulEsdiG4u/Ek3wP9CmcxSAqe5YU=; b=H0cMbASOJ4OWMIj28ZK0G+fu//RCMECA66npFZQRBbLCYe1zMS128qazJ/l/JFEQuc Jkc6wWj+VkZrxcGSUQ2PClik63qmCx9Ryec+hLqi6nDjbOOme8Tew4baY5GpO6u/oz5O CUTZQtUSO6dBINDHmBW0rOkCs690qajA8bP5UrABc3VzBKR6U3JdZ6okEHmrNdfEJQG+ oXhYwXGJEFp41JU1uKaZwlih/WHvchLLwVd/SZH2Rr/hn6GxRcgHllac5Z7aTFe8yK9F EhDMPedQQwg+sgX19X71eWmibDejatjZhPql9HB/sAPwqgoNzsLvLOcJmw8fkKbuor8V D6XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Gx4ouKee; 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=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u124si1074574pgb.271.2017.09.08.00.15.27; Fri, 08 Sep 2017 00:15:27 -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=@gmail.com header.s=20161025 header.b=Gx4ouKee; 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=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755721AbdIHHPX (ORCPT + 26 others); Fri, 8 Sep 2017 03:15:23 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:34824 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755013AbdIHHOS (ORCPT ); Fri, 8 Sep 2017 03:14:18 -0400 Received: by mail-wr0-f193.google.com with SMTP id n64so827750wrb.2; Fri, 08 Sep 2017 00:14:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZDRqn6oM7YLvC7qyulEsdiG4u/Ek3wP9CmcxSAqe5YU=; b=Gx4ouKee8qpfDta/NQS+KDkCr3DdnR0+9lBqzs1mdm3BIcpndYniu6+jzWsAjimDK2 Eyvd9B3c6pYir9Bse7MePflJgU5ZgiSzyrO3jEOtmXBFewx9kHEU1Ac2fn5XLT5VYHca k6HIu0WEJT3Sf9RaWsk8m3cNIAV1yzhisNcE3IrXBfJ5hx9SLZPB3vRsZagM5kBvX3dX y5PQiEI9ezTL5qn2QXjFc6kBFZ7j0huzVGVo/Vrlg2YLTWf/hsAFRu2WgLNYZAFbLcn6 52l2LAZoDCRl1KoYdYY+QYXQ2visBB0CeFae8/+riZPF8g4Al4BazBfFvQZdGlcWCt5R 9xZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZDRqn6oM7YLvC7qyulEsdiG4u/Ek3wP9CmcxSAqe5YU=; b=rusEi4w0C+VQAHXHA3bkpm84RZu4VXj5Jg61Ozn3a0jn6frsZYXKdV8wr0JxS7W14v XcrgK54/oqWXYABf0vrYQFRvrya9ySGnrXexU7OKtaGoHYigfGCyNEExRWKlI8Kmb7LY plFQXAQjqPea4olnuhJ++bi8Op5ig7fOFRjWz10dKwixuM87qBI3RCq8Ho+szcs1InJM xMVBP1i9BuVbBmikdHyPR85mBpgfPAf9qALV90ufAOz/H+bKcX8HeArbCf3j/QP3fLYW e2ZAU5bAVkAZ8G1dXpFsHG763daoxrp/hOdWWBDpnDRQpktO1hK5G4hnd7gqc/ZKvD3t EEXA== X-Gm-Message-State: AHPjjUgVAsVxznQd3pnduLIGb8QyTGqkauv2XCDPHClqdDjTvc92FCqA BZyp0cNFv6A0/A== X-Google-Smtp-Source: ADKCNb4z3ywIzIXc17DTrY3eRhgS7GdHnwPgPow+b3AipK3o/03OM+48frHpnpawGXI+zweKmE+84Q== X-Received: by 10.223.130.77 with SMTP id 71mr1178456wrb.247.1504854856643; Fri, 08 Sep 2017 00:14:16 -0700 (PDT) Received: from Red.local (LFbn-MAR-1-580-96.w90-118.abo.wanadoo.fr. [90.118.159.96]) by smtp.googlemail.com with ESMTPSA id l19sm684566wrl.47.2017.09.08.00.14.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Sep 2017 00:14:16 -0700 (PDT) From: Corentin Labbe To: robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@free-electrons.com, wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com, andrew@lunn.ch, f.fainelli@gmail.com Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Corentin Labbe Subject: [PATCH v5 08/10] net: stmmac: dwmac-sun8i: choose internal PHY via phy-is-integrated Date: Fri, 8 Sep 2017 09:11:54 +0200 Message-Id: <20170908071156.5115-9-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170908071156.5115-1-clabbe.montjoie@gmail.com> References: <20170908071156.5115-1-clabbe.montjoie@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current way to find if the phy is internal is to compare DT phy-mode and emac_variant/internal_phy. But it will negate a possible future SoC where an external PHY use the same phy mode than the internal one. This patch adds a new way to find if the PHY is internal, via the phy-is-integrated property. Since the internal_phy variable does not need anymore to contain the xMII mode used by the internal PHY, it is still used for knowing the presence of an internal PHY, so it is modified to a boolean soc_has_internal_phy. Signed-off-by: Corentin Labbe Acked-by: Chen-Yu Tsai Reviewed-by: Florian Fainelli --- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) -- 2.13.5 diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c index fffd6d5fc907..672553b652bd 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c @@ -41,14 +41,14 @@ * This value is used for disabling properly EMAC * and used as a good starting value in case of the * boot process(uboot) leave some stuff. - * @internal_phy: Does the MAC embed an internal PHY + * @soc_has_internal_phy: Does the MAC embed an internal PHY * @support_mii: Does the MAC handle MII * @support_rmii: Does the MAC handle RMII * @support_rgmii: Does the MAC handle RGMII */ struct emac_variant { u32 default_syscon_value; - int internal_phy; + bool soc_has_internal_phy; bool support_mii; bool support_rmii; bool support_rgmii; @@ -75,7 +75,7 @@ struct sunxi_priv_data { static const struct emac_variant emac_variant_h3 = { .default_syscon_value = 0x58000, - .internal_phy = PHY_INTERFACE_MODE_MII, + .soc_has_internal_phy = true, .support_mii = true, .support_rmii = true, .support_rgmii = true @@ -83,20 +83,20 @@ static const struct emac_variant emac_variant_h3 = { static const struct emac_variant emac_variant_v3s = { .default_syscon_value = 0x38000, - .internal_phy = PHY_INTERFACE_MODE_MII, + .soc_has_internal_phy = true, .support_mii = true }; static const struct emac_variant emac_variant_a83t = { .default_syscon_value = 0, - .internal_phy = 0, + .soc_has_internal_phy = false, .support_mii = true, .support_rgmii = true }; static const struct emac_variant emac_variant_a64 = { .default_syscon_value = 0, - .internal_phy = 0, + .soc_has_internal_phy = false, .support_mii = true, .support_rmii = true, .support_rgmii = true @@ -648,7 +648,7 @@ static int sun8i_dwmac_set_syscon(struct stmmac_priv *priv) "Current syscon value is not the default %x (expect %x)\n", val, reg); - if (gmac->variant->internal_phy) { + if (gmac->variant->soc_has_internal_phy) { if (!gmac->use_internal_phy) { /* switch to external PHY interface */ reg &= ~H3_EPHY_SELECT; @@ -932,7 +932,7 @@ static int sun8i_dwmac_probe(struct platform_device *pdev) } plat_dat->interface = of_get_phy_mode(dev->of_node); - if (plat_dat->interface == gmac->variant->internal_phy) { + if (of_property_read_bool(plat_dat->phy_node, "phy-is-integrated")) { dev_info(&pdev->dev, "Will use internal PHY\n"); gmac->use_internal_phy = true; gmac->ephy_clk = of_clk_get(plat_dat->phy_node, 0);