From patchwork Sat Aug 26 07:33:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 9923213 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 9DF31602BD for ; Sat, 26 Aug 2017 07:40:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E2D5201A4 for ; Sat, 26 Aug 2017 07:40:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82E29285AE; Sat, 26 Aug 2017 07:40:17 +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=-2.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=ham 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 96C23285C4 for ; Sat, 26 Aug 2017 07:40:15 +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=WwM6tQ8LEjHnrtK1jWxBCypNQDl2HjayD9IosUva8+E=; b=W6g+bLvfx7LBWQqhMCvP8mjOrQ wP9U2oj66Au9NzGZREXzfUQUpcN2R/y8ciSrn9nKqeSPJlbg1XlkoH1gezFHyEE2wH1XmdHKlHB8U 1Q8qeF0BzPwS9OXkSaprhgmxQ1GwEYLFZ661INzvPMd8XZjx6TK2OWpCFXsegCa/xvzSI6fs2lpIt i61J17/e8goiDoCLRPGd9PXCJ/Ru0r6DaeXR7hrXafj4XXlx3HCbBGCB98wP7ttt3nd6/KwJUz81p qVbWTp6Mh4FDOiKqH5XEp90EjOW6Y9CAsFRpUhyPQbxmmhNzyKGgxbjqLIpx4mVcx7KwqqKge/MpS Ss9o5W1w==; 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 1dlVge-0005LB-7r; Sat, 26 Aug 2017 07:39:20 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dlVd8-00038q-LW for linux-arm-kernel@lists.infradead.org; Sat, 26 Aug 2017 07:35:45 +0000 Received: by mail-wr0-x241.google.com with SMTP id p8so1016233wrf.3 for ; Sat, 26 Aug 2017 00:35:25 -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=CuSmvhEPC8JnNKh5wU6VpX7mb/FNPq++fUOKmot9MjE=; b=uh825eLpXpQiUC8EokbuHT11BiIQQfjwuNjmR1qoasZG6RZyBfMdE4iEuZYWwgn1tT uVkasyHuhSD04O+dRg8wiy1iH4z5g3Hj3PaL7CChqmz0BZemEXlQpPMxRbxnskW1Hw+b x47sRjrNMa+6C9mFbkqJIxwu71nGwk4IAl80gqx72NsNTit7RJw/KonGFJszpCU4fOr9 7GAbp6fLKSFHY7RqZoW2FNenbh2qfYpwf2rkum0ajFofBE6W0JyPNJ3DOO8zr8eFlMGv j5lB10af2OLJ0TlX9JEWq2FNi+otFvclqfilGY/CqnkU34JDuc5D8EgpO+xxlZO2oXrV qEpQ== 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=CuSmvhEPC8JnNKh5wU6VpX7mb/FNPq++fUOKmot9MjE=; b=DgXGnuOi0QjNjlo0abwCAo6iqqYZ+K698GYN5H9IglaJMnA83ICbWsnIY/KLLH/eE+ /c8Qj02nUx4NNmtIbm99SMNmg0lC8JsJyFjlcIbm/Z5sq6d9a50rWHa9so54rUEU/A+N xv/XjhnX+2ApwA2UGDBcCzjXoUeL9YbDgpl1gp0pOuoLE4yCM/BpUqwXj4fjFQvS3/zn nIQyRKLa/cZ7mwuz2Iq9dKSGWTiR8HEjJkJGTpBDnd+zxee6sS3bMmV8PKIHe25ja8uu U0NX//vp7zctUuA2Ok7kolFzsAc6DkNPSwWhnIlXz7kF6eXL0EOZR/tSFJJZFsxpL8zQ Tj8g== X-Gm-Message-State: AHYfb5ijDOB7hbRbKlGFVbpaSZmo8LgFMdRrpuDRUOcV5whpP9Ruxp52 S0T8h0G56AHktQ== X-Received: by 10.223.186.13 with SMTP id o13mr678109wrg.129.1503732924140; Sat, 26 Aug 2017 00:35:24 -0700 (PDT) Received: from Red.local (LFbn1-1-65-78.w90-118.abo.wanadoo.fr. [90.118.156.78]) by smtp.googlemail.com with ESMTPSA id u46sm14198550wrf.15.2017.08.26.00.35.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 26 Aug 2017 00:35:23 -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, peppe.cavallaro@st.com, alexandre.torgue@st.com, andrew@lunn.ch, f.fainelli@gmail.com Subject: [PATCH v4 5/5] net: stmmac: Register parent MDIO in case of fake mdio-mux Date: Sat, 26 Aug 2017 09:33:11 +0200 Message-Id: <20170826073311.25612-6-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170826073311.25612-1-clabbe.montjoie@gmail.com> References: <20170826073311.25612-1-clabbe.montjoie@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170826_003542_860208_0D219BF0 X-CRM114-Status: GOOD ( 11.00 ) 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, Corentin Labbe , linux-arm-kernel@lists.infradead.org, icenowy@aosc.io 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 In case of a fake MDIO switch/mux (like Allwinner H3), the registered MDIO node should be the parent of the PHY. Otherwise of_phy_connect will fail. Signed-off-by: Corentin Labbe --- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index e1be5735365b..4d5f3cc82476 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -312,10 +312,12 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat, static const struct of_device_id need_mdio_ids[] = { { .compatible = "snps,dwc-qos-ethernet-4.10" }, { .compatible = "allwinner,sun8i-a83t-emac" }, - { .compatible = "allwinner,sun8i-h3-emac" }, { .compatible = "allwinner,sun8i-v3s-emac" }, { .compatible = "allwinner,sun50i-a64-emac" }, }; + static const struct of_device_id register_parent_mdio_ids[] = { + { .compatible = "allwinner,sun8i-h3-emac" }, + }; /* If phy-handle property is passed from DT, use it as the PHY */ plat->phy_node = of_parse_phandle(np, "phy-handle", 0); @@ -332,7 +334,14 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat, mdio = false; } - if (of_match_node(need_mdio_ids, np) && !of_phy_is_fixed_link(np)) { + /* + * In case of a fake MDIO switch/mux (like Allwinner H3), + * the registered MDIO node should be the parent of the PHY. + * Otherwise of_phy_connect will fail. + */ + if (of_match_node(register_parent_mdio_ids, np) && !of_phy_is_fixed_link(np)) { + plat->mdio_node = of_get_parent(plat->phy_node); + } else if (of_match_node(need_mdio_ids, np) && !of_phy_is_fixed_link(np)) { plat->mdio_node = of_get_child_by_name(np, "mdio"); } else { /**