Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp924778imu; Wed, 23 Jan 2019 08:01:38 -0800 (PST) X-Google-Smtp-Source: ALg8bN4nuc16QH7fgA00Rb2WcN6Yg2cC8mhcbJ8EGkJaUgkvJXnsukgV3n++0EqrqE5BNM5hRKuI X-Received: by 2002:a17:902:9f93:: with SMTP id g19mr2686473plq.195.1548259298757; Wed, 23 Jan 2019 08:01:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548259298; cv=none; d=google.com; s=arc-20160816; b=Nlw6bzNMhLZPn+UMH+hJWlmdBVmoiN+KUxe/qQP09es8Dum88O5a/JtDtMQJ0flI6m BWDE/dU91kCmuW6ayBsWDsH7KTB2Lnhg1/I/18XvD/BblYT8BwpI5P9GkA1ZBK6fuKtC 2ORDce3Xj1+mwxBBh50UFTDrSiKRbW8eiIrg5mYJTqB3ooTxVBvzpjsmeim24tdeIxCs URfBpFdsQh4lL44fnZDXxD5jaMkqefX9lGrSBV6QnvXm8UhLndTSVKwtykIn9mhCmxAW F36qrvEpqRe7CooeosuZ7afvS/3B4OXdT7RCzHGXQvWJcljCKy+wtpj6XMfpaSlmz2fg xkMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=WJTpgSDuuA8u4Rrj+tx3WgrMzzLsrHLFSQZRr+LUvdo=; b=o0tk7YQb2+PG1I/w8ZhS0SG3wzT9rUTsIXlmcnTC2o5CwAe1AjdNj8fhYV3X+q+rH5 xhC+uC/nK3v1jowsuLDw3CDv/cn2rSPjUPhQU6dV24fvnsaiN6ZXsTLV0nQOYc1BfRZl hRIWrMfSC+XqvArLfSyfOad/AzDyOuFdLkI4XJ4uOSZy6Ag7lDbI7fTvY5wkSIW17tNR 5w3n85uchpta+6E/6c5xgayk3YxB8J5dGA2Lkej6DcTOqqRVtoiclM8CXftaPjhX6+bS i7vm/Qu5lqT038xD/BiVQTTG+Sg1GCvoZWkKIntkFECGAJwRBV9oMgSHux6Ya6u11JZG iSYA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d8si17203326pgh.505.2019.01.23.08.01.23; Wed, 23 Jan 2019 08:01:38 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727268AbfAWP7s (ORCPT + 99 others); Wed, 23 Jan 2019 10:59:48 -0500 Received: from mail.bootlin.com ([62.4.15.54]:42255 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726863AbfAWP7R (ORCPT ); Wed, 23 Jan 2019 10:59:17 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 6DF73207AC; Wed, 23 Jan 2019 16:59:14 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from localhost (aaubervilliers-681-1-87-206.w90-88.abo.wanadoo.fr [90.88.29.206]) by mail.bootlin.com (Postfix) with ESMTPSA id 32339209BF; Wed, 23 Jan 2019 16:58:56 +0100 (CET) From: Antoine Tenart To: davem@davemloft.net, sd@queasysnail.net, andrew@lunn.ch, f.fainelli@gmail.com, hkallweit1@gmail.com Cc: Antoine Tenart , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, alexandre.belloni@bootlin.com, quentin.schulz@bootlin.com, allan.nielsen@microchip.com Subject: [PATCH net-next 08/10] net: phy: export __phy_read_page/__phy_write_page Date: Wed, 23 Jan 2019 16:56:36 +0100 Message-Id: <20190123155638.13852-9-antoine.tenart@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190123155638.13852-1-antoine.tenart@bootlin.com> References: <20190123155638.13852-1-antoine.tenart@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch exports the __phy_read_page and __phy_write_page helpers, to allow reading and setting the current page when a function already holds the MDIO lock. This is something the Microsemi PHY driver does during its initialization because parts of its registers and engines are shared between ports. With the upcoming MACsec offloading support in this PHY, we'll need to configure the MACsec engine and to do so changing pages is required. Signed-off-by: Antoine Tenart --- drivers/net/phy/phy-core.c | 6 ++++-- include/linux/phy.h | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c index 909b3344babf..be0c65b6e2da 100644 --- a/drivers/net/phy/phy-core.c +++ b/drivers/net/phy/phy-core.c @@ -538,15 +538,17 @@ int phy_modify(struct phy_device *phydev, u32 regnum, u16 mask, u16 set) } EXPORT_SYMBOL_GPL(phy_modify); -static int __phy_read_page(struct phy_device *phydev) +int __phy_read_page(struct phy_device *phydev) { return phydev->drv->read_page(phydev); } +EXPORT_SYMBOL_GPL(__phy_read_page); -static int __phy_write_page(struct phy_device *phydev, int page) +int __phy_write_page(struct phy_device *phydev, int page) { return phydev->drv->write_page(phydev, page); } +EXPORT_SYMBOL_GPL(__phy_write_page); /** * phy_save_page() - take the bus lock and save the current page diff --git a/include/linux/phy.h b/include/linux/phy.h index 21839f352e7c..5f17080bc697 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -766,6 +766,9 @@ static inline int __phy_write(struct phy_device *phydev, u32 regnum, u16 val) val); } +int __phy_read_page(struct phy_device *phydev); +int __phy_write_page(struct phy_device *phydev, int page); + int __phy_modify(struct phy_device *phydev, u32 regnum, u16 mask, u16 set); int phy_modify(struct phy_device *phydev, u32 regnum, u16 mask, u16 set); -- 2.20.1