From patchwork Mon Jun 22 09:37:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11619093 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0863260D for ; Mon, 22 Jun 2020 20:35:02 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C720720732 for ; Mon, 22 Jun 2020 20:35:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="3PplQBeb"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="I/eaN9xr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C720720732 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References:List-Owner; bh=1bOS5D/zoPnQJpjkHN7ac1XVN4ibmfrGU57xmQMvkb8=; b=3PplQBebJM1mpkDDV2ZctaoX/T kbDOKSsCY6IqL3dsdMge0zrNkHlzZVCFoZERg28/d2/Jo7aPutWw+sXZK79KeRGrWiYkzxJegMHa8 6kb9w5hUPooLEQylTMODCkRmVbViTjr2Ya65yvJ2qFk/gSfFoOAPf8ocoGflPgEiwhNoACES3z7md VltK6lH+nc5dzJWyDKZ+HcA9npejyEJHK2XEwkxQvdsM5Olv/ubr8H+GUUUgcwCCcTy6mm2rCsLjx HfTuW9GvO7I1+WyxbO6KwdNE8Tzae5PJ6douiptgk4uwFDgNgERbJy8O1RH9yYxNZIiZnypDEY65y awuKaDIg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnT9f-0005Eh-En; Mon, 22 Jun 2020 20:34:59 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnIxf-0007hu-TX for linux-mediatek@lists.infradead.org; Mon, 22 Jun 2020 09:41:56 +0000 Received: by mail-wm1-x341.google.com with SMTP id g75so6113805wme.5 for ; Mon, 22 Jun 2020 02:41:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=7JOFF+Nl1qiIhM1iOj4oCorX86E5B7hR8kg9WCnzUnw=; b=I/eaN9xrQqwwgmhuM+4CqaeHsY6aV60kH8mKn4OebmUYtK7pNQK0wVGunsLFglKTAy eUfthcd2EIQ1C+6upxc/23ua64/60kfHPQMRmNReX5PP2rqNblnCuw0jNW6ITtVZgxqW JMjW13bHUWbsnkuYKGTXldz63/aT5JAfKOHfJsdcPLDI6CaCjZlEVCVN1/cNK9IA3bVM sWSBmTqNhgt/nNmxR0EvpDrZ4oceKA+bx2hJY0Lo1o/pDYzIwKGHfLU+2NxtIdO7LXgx 9KJhrZfL7yYB7s5BDFwVOlo/2O7aGyMMJ8C/qk+ipYeZOh/5oEPkN+TeTC0+JThrTbg7 00hQ== 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:mime-version :content-transfer-encoding; bh=7JOFF+Nl1qiIhM1iOj4oCorX86E5B7hR8kg9WCnzUnw=; b=SFVr3IQQfhme9Qg7aeGQNjj1SyhvEK9YN/V6fB7Dx5sXgF9XCen1Pmgo/8ckroOsr8 CyGitrZmxHZJ6w8CqzIC43dZLr7LKrih+Kovv24W/RNq5r2TONkzjZCWwQUA4513TyCJ vOTdTogSQTyyl1+geq1BEeXghjAaZNEdgVWYaM3NhDHbRZaqj/dLWGFVxlmzJfnqKINm tsDJUvKc6rsOPRiYhzeX/IvI9wxR2vQMxrZond1LNpK5TQkWc7aV0qkShfYcl35Y+uAB iWOBxmdnsaFSeZBN8LO4m88F2/nlS8MkuCkZxVvKd5ZiNgMaEaVX19hglk19sKkB0jmw +imQ== X-Gm-Message-State: AOAM532CLq56+WXGpmDj0Wfxivrm3KCGDH0v8HurGwVWavYkEF2gxUIA 5/YmPzhk0eO1k9OMRLG9SRJjgA== X-Google-Smtp-Source: ABdhPJwbib6BkarNo+K48caVL1EEcMyD4P1NjsZ159e2tdZhAydKdMgyxCTWdsPKQgIV/5CqbPqSBg== X-Received: by 2002:a1c:4d0a:: with SMTP id o10mr17628133wmh.150.1592818881779; Mon, 22 Jun 2020 02:41:21 -0700 (PDT) Received: from localhost.localdomain (lfbn-nic-1-65-232.w2-15.abo.wanadoo.fr. [2.15.156.232]) by smtp.gmail.com with ESMTPSA id j24sm14392652wrd.43.2020.06.22.02.41.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 02:41:21 -0700 (PDT) From: Bartosz Golaszewski To: Andrew Lunn , Florian Fainelli , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Rob Herring , Matthias Brugger , Microchip Linux Driver Support , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , Vivien Didelot , Tom Lendacky , Yisen Zhuang , Salil Mehta , Jassi Brar , Ilias Apalodimas , Iyappan Subramanian , Keyur Chudgar , Quan Nguyen , Frank Rowand , Philipp Zabel , Liam Girdwood , Mark Brown Subject: [PATCH 00/15] net: phy: correctly model the PHY voltage supply in DT Date: Mon, 22 Jun 2020 11:37:29 +0200 Message-Id: <20200622093744.13685-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:341 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Stephane Le Provost , Bartosz Golaszewski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Fabien Parent , linux-mediatek@lists.infradead.org, Andrew Perepech , Pedro Tsai , linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org From: Bartosz Golaszewski PHY devices on an MDIO bus can have their own regulators. This is currently mostly modeled using the semi-standard phy-supply property on the MAC node. This seems to be conceptually wrong though, as the MAC shouldn't need to care about enabling the PHY regulator explicitly. Instead this should be done by the core PHY/MDIO code. This series introduces a new DT property at the PHY node level in mdio.yaml and adds support for PHY regulator, then uses the new property on pumpkin boards. It also addresses several issues I noticed when working on this feature. First four patches are just cosmetic improvements in source files we'll modify later in this series. Patches 5 and 6 modify the way PHY reset handling works. Currently the probe() callback needs to be implemented to take the PHY out of reset but PHY drivers without probe() can have resets defined as well. Patches 7-11 address an issue where we probe the PHY for ID without deasserting its reset signal. We delay the ID read until after the logical device is created and resets have been configured. Last four patches add the new DT property, implement support for PHY regulator in phy and mdio code and set the new property in the DT file for MediaTek's pumpkin boards. Bartosz Golaszewski (15): net: phy: arrange headers in mdio_bus.c alphabetically net: phy: arrange headers in mdio_device.c alphabetically net: phy: arrange headers in phy_device.c alphabetically net: mdio: add a forward declaration for reset_control to mdio.h net: phy: reset the PHY even if probe() is not implemented net: phy: mdio: reset MDIO devices even if probe() is not implemented net: phy: split out the PHY driver request out of phy_device_create() net: phy: check the PHY presence in get_phy_id() net: phy: delay PHY driver probe until PHY registration net: phy: simplify phy_device_create() net: phy: drop get_phy_device() dt-bindings: mdio: add phy-supply property to ethernet phy node net: phy: mdio: add support for PHY supply regulator net: phy: add PHY regulator support ARM64: dts: mediatek: add a phy regulator to pumpkin-common.dtsi .../devicetree/bindings/net/mdio.yaml | 4 + .../boot/dts/mediatek/pumpkin-common.dtsi | 1 + drivers/net/dsa/ocelot/felix_vsc9959.c | 3 +- drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 5 +- .../net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 2 +- drivers/net/ethernet/socionext/netsec.c | 3 +- drivers/net/phy/fixed_phy.c | 2 +- drivers/net/phy/mdio-xgene.c | 2 +- drivers/net/phy/mdio_bus.c | 55 +++-- drivers/net/phy/mdio_device.c | 51 ++++- drivers/net/phy/nxp-tja11xx.c | 2 +- drivers/net/phy/phy_device.c | 216 ++++++++++-------- drivers/net/phy/sfp.c | 2 +- drivers/of/of_mdio.c | 11 +- include/linux/mdio.h | 4 + include/linux/phy.h | 21 +- 16 files changed, 240 insertions(+), 144 deletions(-)