From patchwork Wed Sep 27 07:34:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 9973291 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C2B97603F2 for ; Wed, 27 Sep 2017 07:39:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5C3628DBA for ; Wed, 27 Sep 2017 07:39:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A916B28F16; Wed, 27 Sep 2017 07:39:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4D83228F19 for ; Wed, 27 Sep 2017 07:39:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=5IwSSsXXtAdMa8S3i2Cw4QA/pQtZWLN/H7g5EuhJhnM=; b=sPEXApj6mWEiqjouSQP9+ggOeM g4nVB4QCBaU8QUmt4S8AOyfWl06rtf4k0t3ZC9vQHtAyFJvELvT+FJ1j3ikZn7rIuYkI4TjtwkG34 XDh68GNIzkdevJcToWd72ErkXaNhBD9htcnVlKQqYWR3js/INd6J1FV5w5V6Bui6qRvm71p+NjfIK MegWMg3yKRgkx7gQSZdSIAFxue1j9jECZzGX/yluau4GqE6knVSzeOZntMDsSfJUVqT2H9840Jzai krHqXwYkKfzNJa7xzYIQoxyflpwWltlnLFwiwXHFuhm67Ps9bRds/6uq7rnjFoC42l2Un/x5AW7nd vUh63JCw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dx6vw-0002EA-1w; Wed, 27 Sep 2017 07:39:04 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dx6u1-0000Tg-BO for linux-arm-kernel@lists.infradead.org; Wed, 27 Sep 2017 07:37:13 +0000 Received: by mail-wm0-x242.google.com with SMTP id q124so436723wmb.5 for ; Wed, 27 Sep 2017 00:36:44 -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=Y5xkQZv7NlW+JPuhuUeAIf/RLKL5RLGMOUL8nDR7vDobmMK/iCZFAVURM0WGMt78P7 uLjK627x2xnqsY/1jFkzTJLS8LPeMbghg7Ja12MUskf32sAYwME7CvR0yPsOamrHBwyA Xbh87NQcak5lQcOKjSXObZXmPBGyWR22Ktm4ksd0TR8Znp6q+EGZ+drA00rTQaV0snkQ 8malRw+xa7AVKlnrPivsmzPvBehKtGdpvlXZOwEYgLPP1jq6KxRIIW0C8jwKheJVFQEF NNEATMjdLP0zjqfOVeGjbgjEo6ATbkRSmyBGmIXGTKyV7W9ShoxmJDwz1iZDGM4SIEU0 8C3A== 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=RIZKK/WfhmQmQBd51yJWaRGkpXM5/zalFI6+uJMH3CmpOjVyAcy1W5ozak5wgQJkkf dY6YXsnfjstvXdL5B8wZ+5FR6klSB4j6T0gG/YltpVa1z7ha5OVGn45QbraDrtYhHP+Q oaJj5XDjAZ3XDte1EuarKQg/NSa2veOW/t6WHUdnaaYuIL2/3YTLuzUicHtkBbCDUxum qy4pFoO0m2vjLSpDYk3BXS9l8uCstg61qlnTIXHm+F+siUJQq2K6rQz/iC51zUaUIx3K lfOztWcpTOzqO4ejFJ+c7NZY+DdHmc1miAlcpd4RAsvY4EHKKMvZ/Ny9TAxGiWpelgsI wCng== X-Gm-Message-State: AHPjjUgaBtNCO4RAgFb4pXGXSZaQe4+oKPSqxqwPncNp/eJe3tBL3MnK HT61VSeQSMHK5ZkAf1ckusc= X-Google-Smtp-Source: AOwi7QDBaWlxuVxF7md9etaP9138p45geQ9EjxZKr4ZtLdEK2D9r6jUGSvLwrE2MugskF00ZK1uRjg== X-Received: by 10.28.38.198 with SMTP id m189mr634465wmm.28.1506497803328; Wed, 27 Sep 2017 00:36:43 -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 n9sm5660526wmd.12.2017.09.27.00.36.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Sep 2017 00:36:42 -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, frowand.list@gmail.com Subject: [PATCH v6 09/11] net: stmmac: dwmac-sun8i: choose internal PHY via phy-is-integrated Date: Wed, 27 Sep 2017 09:34:12 +0200 Message-Id: <20170927073414.17361-10-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927073414.17361-1-clabbe.montjoie@gmail.com> References: <20170927073414.17361-1-clabbe.montjoie@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170927_003705_834032_806BBC71 X-CRM114-Status: GOOD ( 15.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Corentin Labbe , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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);