From patchwork Wed Sep 27 07:34:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 114353 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4721264qgf; Wed, 27 Sep 2017 00:36:38 -0700 (PDT) X-Received: by 10.84.244.6 with SMTP id g6mr483570pll.223.1506497798870; Wed, 27 Sep 2017 00:36:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506497798; cv=none; d=google.com; s=arc-20160816; b=DyEvlTgJNDLeCdJUoMR/lJ3Jzh96yhpx1nZEXMI2ow4fOX3v7dRFNjH39rOXODQ0SI TBXT35jJP1C4REpBIF8fkT3okdDXnjvRLmO0h0cXmVcjkBdmR0cu5wt4ZVyYCLHggCbY kY9OLgItvev8IrQowWevCiwY0BFTky2OqNXI4w346emogye/1i6SvjHVJQxOtpqVO7nl I9teDZfNSN0U1rPQBp90shSKyMEKdHyPSF/KEYZ5Q0VrK+lWRNl+PJm7PmNH2mTd7OSO 50kc71trsTnJFyljhLVbQKs9Ds7tZ3tdOHcIRyNG2s7c2WA6BHNI4njYobvsoWXGkDps dI6A== 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:arc-authentication-results; bh=0iGZ05zLDopjyurz8TyQXFuWkZwV0YEFnuoFSMpDwhA=; b=ISCxpTV5RS949d3kXjtOUuvmvCwQjzuNn0jAkAyGqckWsK+AltvqjKBZWHexppXfO1 TlvTfn7f/LemTdpSpkMUKhOo55eObk9BJ4Vof2inOO8joBPPrJ2wzmNL3THCt5SUG3eu 29cTx9dLXbQTDoG0zlOoUl34c5e/2MAI0j2Jxchac23h9sp0UwALODXQNLt47d7QT0kO ReQfxyiTD8+R6SktoGLfmTaWswEhCmU3yv5BEZdeagYV9boMRYr2shsp7MaOWcCYWuQI 1MG8+Ap3nepMyagf33UWw1UyCLq4jmtO5LiKXly+7cPWHenvHNbOUiT6AGdR/cwTsnWF LRAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GG+DaiFL; 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 s83si4095805pfa.320.2017.09.27.00.36.38; Wed, 27 Sep 2017 00:36: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=@gmail.com header.s=20161025 header.b=GG+DaiFL; 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 S1752135AbdI0Hgg (ORCPT + 26 others); Wed, 27 Sep 2017 03:36:36 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:47668 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751887AbdI0Hge (ORCPT ); Wed, 27 Sep 2017 03:36:34 -0400 Received: by mail-wm0-f48.google.com with SMTP id r136so14853927wmf.2; Wed, 27 Sep 2017 00:36:33 -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; bh=0iGZ05zLDopjyurz8TyQXFuWkZwV0YEFnuoFSMpDwhA=; b=GG+DaiFLhc/lu/LdbhMndEiExFTLZs+1gcwwyc1oHGgbAkfdYHHtI3rDdOENRI7HK/ bbpZI2sVfQGLW5gDLgw3z4kbPUdJJVRLmjAFPCXcbzxQiVb8llKcvXmqcws9SdR8B3rx XmBVMxfc1rQqjXo7kkNn1PRs6xEZ4xQ+gW92ZRQvLv+hq3lOMKCIecHpAVq55xy+oMD0 jVoiBfcLoFmUBXc8ewJy99TwW6OQ5Aj9tBAZJ3wfPRkn8AVqNjTXAvje990dN/mUM89p nNA3gFO0rjUT3msCyJDRQTQDmJg6ZiydaQIZpIf+l5DPCvsMhQIoL/s5VAvHOUiHO5NX m+Ww== 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; bh=0iGZ05zLDopjyurz8TyQXFuWkZwV0YEFnuoFSMpDwhA=; b=DxY9TIY4kkWcW6qTwtOFI/ukl9J3K629YYPGabo8z1Qfx/okUe1DN3TV6pLGCXsSd2 yhsjsvY3AMZocDv24/3dDbXZTO8lNyNK6ZyYDWmyAFVPOmgtONM9AJaR4bedy32hiIT3 7mmRz7M1bOgRj9HGr6Ww5rBF2f+3KxKOudhro01fDQ5vOy3/Dxy77ne/HyC0reB/mTTM a9ssBBX7JwGAOY5QHm/W5i//QDigFgOTmFP7pEM3fcd2DYqRLI65hdxu5KPbFIk9bRL/ VrsFG+caUlyEk7Uj5mtEpA2PTc9oSX5k6KZ4Kc2aQiapUER8Bd3g4vkx6eTMs9/uKPZK wvpg== X-Gm-Message-State: AHPjjUjKbApG24rrN2D9o5874Cq8/rtPro289nWBK63SxtrhH0r7VnD7 pkc5WUgO3qOn1Odp9mDJpw4= X-Google-Smtp-Source: AOwi7QBOGwKJUFYGcXQ1+ZAXIYeYFPvdmzffd9qt7F4TRtMxh0rOPJwurh9kyeULmXfK3tLqNKdAxA== X-Received: by 10.28.59.215 with SMTP id i206mr681258wma.116.1506497792630; Wed, 27 Sep 2017 00:36:32 -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.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Sep 2017 00:36:31 -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 Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Corentin Labbe Subject: [PATCH v6 00/11] net: stmmac: dwmac-sun8i: Handle integrated PHY Date: Wed, 27 Sep 2017 09:34:03 +0200 Message-Id: <20170927073414.17361-1-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.13.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello 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 integrated one. This patchs series adds a new way to find if the PHY is integrated, via the phy-is-integrated DT property. Since it exists both integrated and external ethernet-phy@1, they are merged in the final DTB and so share all properties. For avoiding this, and better represent the reality, we use a MDIO mux. The first try was to create a new MDIO mux "mdio-mux-syscon". mdio-mux-syscon working the same way than mdio-mux-mmioreg with the exception that the register is used via syscon/regmap. But this solution does not work for two reason: - changing the MDIO selection need the reset of MAC which cannot be done by the mdio-mux-syscon driver - There were driver loading order problem: - mdio-mux-syscon needing that stmmac register the parent MDIO - stmmac needing that child MDIO was registered just after registering parent MDIO So we cannot use any external MDIO-mux. The final solution was to represent a mdio-mux and let the MAC handle all things. Note that phy-is-integrated is still needed (even if we use a MDIO mux) since some properties apply only on integrated PHY and we need to know the final MDIO bus in mdio_mux_syscon_switch_fn(). Since DT bits was reverted in 4.13, this patch series include the revert of the revert. So - the first four patchs bring back DT/stmmac stuff that was in 4.13 (and reverted) - fifth patch document how DT MDIO mux is implemented - patch 6 and 7 modify DT - patch 8, 9, 10 Modify stmmac according to the new bindings I have let patch splited for easy review. (for seeing what's new) But the final serie could have some patch squashed if someone want. Like squashing patch and 2 and 5 (documentation) Since DT worked well in 4.13, could it be targeted for 4.14 ? If necessary I could split this serie in two: - bring back A64/A83T (patchs 1, 2, 4, 7, 9) - add MXIO-mux and H3 (patchs 3, 4, 5, 6, 8, 10) Regards Changes since v5: - reordered patch 1 and 2 - mdio-mux node is now a mdio's child - added patch 11 for removing unnecessary scan of mdio-mux Changes since v4: - Update documentation for new bindings - Added 4 patchs for bring back reverted stuff of 4.13 - dwmac-sun8i now handle mdio-mux - MDIO use now compatible = "snps,dwmac-mdio"; Changes since v3: - Added a patch for handling fixed-link - Updated documentation Changes since v2: - Add a MDIO mux for creating distinction between integrated and external MDIO. - phy-is-integrated is not set in dtsi. Changes since v1: - Dropped phy-is-integrated documentation patch since another same patch was already merged - Moved phy-is-integrated from SoC dtsi to final board DT. Corentin Labbe (11): dt-bindings: net: Restore sun8i dwmac binding arm: dts: sunxi: Restore EMAC changes arm64: dts: allwinner: Restore EMAC changes net: stmmac: sun8i: Restore the compatibles dt-bindings: net: dwmac-sun8i: update documentation about integrated PHY ARM: dts: sunxi: h3/h5: represent the mdio switch used by sun8i-h3-emac arm64: dts: allwinner: add snps,dwmac-mdio compatible to emac/mdio net: stmmac: snps,dwmac-mdio MDIOs are automatically registered net: stmmac: dwmac-sun8i: choose internal PHY via phy-is-integrated net: stmmac: dwmac-sun8i: Handle integrated/external MDIOs of: mdio: Prevent of_mdiobus_register from scanning mdio-mux nodes .../devicetree/bindings/net/dwmac-sun8i.txt | 198 +++++++++++++++++++++ arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts | 9 + arch/arm/boot/dts/sun8i-h3-bananapi-m2-plus.dts | 19 ++ arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts | 7 + arch/arm/boot/dts/sun8i-h3-orangepi-2.dts | 8 + arch/arm/boot/dts/sun8i-h3-orangepi-one.dts | 8 + arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dts | 5 + arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts | 8 + arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts | 22 +++ arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts | 16 ++ arch/arm/boot/dts/sunxi-h3-h5.dtsi | 45 +++++ .../boot/dts/allwinner/sun50i-a64-bananapi-m64.dts | 16 ++ .../boot/dts/allwinner/sun50i-a64-pine64-plus.dts | 15 ++ .../arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 17 ++ .../dts/allwinner/sun50i-a64-sopine-baseboard.dts | 16 ++ arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 21 +++ .../boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts | 17 ++ .../boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts | 17 ++ .../dts/allwinner/sun50i-h5-orangepi-prime.dts | 17 ++ drivers/net/ethernet/stmicro/stmmac/Kconfig | 1 + drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 140 ++++++++++++--- .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 4 - drivers/of/of_mdio.c | 10 ++ 23 files changed, 611 insertions(+), 25 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/dwmac-sun8i.txt -- 2.13.5