From patchwork Mon May 23 05:28:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12858661 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6DA7FC433EF for ; Mon, 23 May 2022 09:31:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=TLaOGcTzsXFSIRcoegDEe5ebSwVcxB3ZqW3o3vA3zeY=; b=dYU6ZczjRd+Kxf F+egKmKdxmJ2UTZMu57NmIkrLqYcDiISmyK64CMeje4/xRDgVPzzKPp++MBgU7+4VUxCzWVqFNRng vES2DL9cYrZbEF2m8h6zyvzOx4b2a3jejcRS9Ka99CfcCWxxpD1WnZadtMI1UjO0vL5STopQ5PEr+ wBVsRwC8ycz5HE+lELzQoG02KGMqKok+/tmxE6uyxn5I/uouOw70IslhGkFx4ErRn72EwQacFB+FP mFTEUAMQ/M/5u6pGperUFzpJmzuwxtaBvDCtDPS/pIPaOwb56bEcipBMbDN/AMDM7zJNc+YjczuF0 9eNmbFFt7JOaafUL92Hw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nt4OP-002rBx-25; Mon, 23 May 2022 09:30:25 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nt2pn-002A7b-LU for linux-arm-kernel@bombadil.infradead.org; Mon, 23 May 2022 07:50:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:In-Reply-To:References; bh=9uMuLZ+WHHh5WrmFB7JGvdrkZLB4YOBUOPeV4QL7yzg=; b=Cx5Z53flR3BRI/Y4s0WvK1o7M6 ENvrtJbZUELhY6E4k7L3fDr6FWk+utL9AmKxs93hPCdBG/hZ93TOfbH9tzCkWFIE/WW9Z0dBOWmHr xA8ZU/09BnbAR3pP0XT2gvkjFoyAG+2j5s+alvh2JW1JXhda5WS1Y7CrGthEA7ecgy1Ri32kd/+dM Tn3RxjfsB5fAWXp/g/e1xX3pCrTUk+YJNciPM/ADcpZ3BeXJirrRz1J1kk4U4tbSkr4sVxc8b72oA 4+mTtrfD+43Kcyd1CwrtNXxpX5/qSHnpLpVgdPZ0aQ4XjqfRmP2ww/U3eB/7oYfuvwA0UIzggAMZT o98bg1qA==; Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nt0e2-000r5H-7h for linux-arm-kernel@lists.infradead.org; Mon, 23 May 2022 05:30:21 +0000 Received: by mail-wr1-x436.google.com with SMTP id t13so458601wrg.9 for ; Sun, 22 May 2022 22:30:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9uMuLZ+WHHh5WrmFB7JGvdrkZLB4YOBUOPeV4QL7yzg=; b=Y7kqAoylA+C6m4MPwSA1YrcUGwM5+kRVXDhOpG5OUxWIJDFnBKuVppwLcraDZBlmau LjKXI0nLbe+RKNA6nAJhuLYnXMdAUKpGtIdVzyeDMvWhkYW27wCNe/Us8RWXHLHT4eFH M9So1Iom6hJn88cvubjLP9h1BZHr/wC5YhtxB69uMa3sl7yewtvD584E7joMhnPQJZwe mhH+j7YGGYZYGJtI9SYQoZxp30voOt8m6e3cXBydM/B54I9+bkzkHXmefoySwmYiFb4O UM8f1/QWB8VRoNLefi0UUGG2cdezs+gIpD/jgnWVy6RceLWCpffPXSl93rCbm+tjDWrq LeZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9uMuLZ+WHHh5WrmFB7JGvdrkZLB4YOBUOPeV4QL7yzg=; b=fY37pAkhWX2jwXxUczfrgbsGXKTqKG08+jLTCzPYdKEzpl6d+vhaEMwvLruxRVNcMm s51w7rpKhNbPb4WkwwzwP+Pun8A1d2uN1QVbiViyriftcP4oTWLn6kd1w7NbhqN6nx0Y WNkh+VAYjFGwXqfQqGMGRQQ1Ngn8NxJ+7ycrMvR4fftjYBaaKts6dC3d5N9YnxEzkZ3X MIS2+TRGQ6RAWSs0aBkpaFtLdAJaaG4Ik04B2u/LhK4KbDWuSiHiOSSF664GMdINM2Cb Vc4d1CG0O22Q1g7ZmK9LqOuPt61yLSzxDKOxrIcsL4e9s1ZWuyX56LX7hr4GrIVevg+s yMTA== X-Gm-Message-State: AOAM531jPzQNXBx3sblj6X2NCwyoacvsByLgJX7UbAB98euuDLeilYEu HDWHp3uMndEAKmQ4ihk2fmfGsg== X-Google-Smtp-Source: ABdhPJwqOjOWSF8b13h1bIXClf8iN5Rml8F4bhr0+MrnoZAuILGzkXIwWfoK9xvvCG7fE0z6uPVXbw== X-Received: by 2002:adf:dd8a:0:b0:20d:ff7:ce01 with SMTP id x10-20020adfdd8a000000b0020d0ff7ce01mr17371264wrl.242.1653283694762; Sun, 22 May 2022 22:28:14 -0700 (PDT) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id h2-20020a1ccc02000000b0039466988f6csm7802414wmb.31.2022.05.22.22.28.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 22:28:14 -0700 (PDT) From: Corentin Labbe To: andrew@lunn.ch, broonie@kernel.org, calvin.johnson@oss.nxp.com, davem@davemloft.net, edumazet@google.com, hkallweit1@gmail.com, jernej.skrabec@gmail.com, krzysztof.kozlowski+dt@linaro.org, kuba@kernel.org, lgirdwood@gmail.com, linux@armlinux.org.uk, pabeni@redhat.com, robh+dt@kernel.org, samuel@sholland.org, wens@csie.org Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev, netdev@vger.kernel.org, Corentin Labbe Subject: [PATCH v3 0/3] arm64: add ethernet to orange pi 3 Date: Mon, 23 May 2022 05:28:04 +0000 Message-Id: <20220523052807.4044800-1-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220523_063018_618141_A69C9CB5 X-CRM114-Status: GOOD ( 15.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello 2 sunxi board still does not have ethernet working, orangepi 1+ and orangepi 3. This is due to the fact thoses boards have a PHY which need 2 regulators. A first attempt by Ondřej Jirman was made to support them was made by adding support in stmmac driver: https://lore.kernel.org/lkml/20190820145343.29108-6-megous@megous.com/ Proposal rejected, since regulators need to be handled by the PHY core. My first tentative was to just add handling of phy and phy-io in phy-core: https://lore.kernel.org/netdev/20220509074857.195302-7-clabbe@baylibre.com/T/ But having hard-coded phy names was rejected. Second tentative tryed the same path than clocks and clock-names for regulators. https://lore.kernel.org/netdev/0518eef1-75a6-fbfe-96d8-bb1fc4e5178a@linaro.org/t/ But using this was rejected by DT maintainers. So v3 use a new regulator_bulk_get_all() which grab all supplies properties in a DT node. But this way could have some problem, a netdev driver could handle already its PHY (like dwmac-sun8i already do) and so both phy-core and the netdev will use both. It is why phy-supply was renamed in ephy-supply in patch #3. This serie was tested on whole range of board and PHY architecture: - internal PHY * sun8i-h3-orangepi-pc - external PHY * sun50i-h6-pine-h64 * sun8i-r40-bananapi-m2-ultra * sun8i-a83t-bananapi-m3 * sun50i-a64-bananapi-m64 * sun50i-h6-orangepi-3 * sun50i-h5-nanopi-neo-plus2 The resume/suspend of PHY was tested. Regards changes since v1: - Add regulator_bulk_get_all for ease handling of PHY regulators - Removed all convertion patchs to keep DT compatibility. Changes since v2: - removed use of regulator-names and regulators list. Corentin Labbe (2): regulator: Add regulator_bulk_get_all phy: handle optional regulator for PHY Ondřej Jirman (1): arm64: dts: allwinner: orange-pi-3: Enable ethernet .../dts/allwinner/sun50i-h6-orangepi-3.dts | 38 ++++++++ drivers/net/mdio/Kconfig | 1 + drivers/net/mdio/fwnode_mdio.c | 36 +++++++- drivers/net/phy/phy_device.c | 10 ++ drivers/regulator/core.c | 92 +++++++++++++++++++ include/linux/phy.h | 3 + include/linux/regulator/consumer.h | 2 + 7 files changed, 178 insertions(+), 4 deletions(-)