From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from vps0.lunn.ch ([185.16.172.187]:59457 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932302AbeBTC2k (ORCPT ); Mon, 19 Feb 2018 21:28:40 -0500 From: Andrew Lunn To: paul.burton@mips.com Cc: netdev , Andrew Lunn Subject: [PATCH net-next RFC 1/2] net: phy: at803x: Export at803x_debug_reg_mask() Date: Tue, 20 Feb 2018 03:28:18 +0100 Message-Id: <1519093699-26437-2-git-send-email-andrew@lunn.ch> In-Reply-To: <1519093699-26437-1-git-send-email-andrew@lunn.ch> References: <1519093699-26437-1-git-send-email-andrew@lunn.ch> Sender: netdev-owner@vger.kernel.org List-ID: On some boards, this PHY has a problem when it hibernates. Export this function to a board can register a PHY fixup to disable hibernation. Signed-off-by: Andrew Lunn --- drivers/net/phy/at803x.c | 5 +++-- include/linux/at803x_phy.h | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 include/linux/at803x_phy.h diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 411cf1072bae..5aede5708abf 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -18,6 +18,7 @@ #include #include #include +#include #define AT803X_INTR_ENABLE 0x12 #define AT803X_INTR_ENABLE_AUTONEG_ERR BIT(15) @@ -93,8 +94,8 @@ static int at803x_debug_reg_read(struct phy_device *phydev, u16 reg) return phy_read(phydev, AT803X_DEBUG_DATA); } -static int at803x_debug_reg_mask(struct phy_device *phydev, u16 reg, - u16 clear, u16 set) +int at803x_debug_reg_mask(struct phy_device *phydev, u16 reg, + u16 clear, u16 set) { u16 val; int ret; diff --git a/include/linux/at803x_phy.h b/include/linux/at803x_phy.h new file mode 100644 index 000000000000..2460c17d56ec --- /dev/null +++ b/include/linux/at803x_phy.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _AT803X_PHY_H +#define _PHY_AT803X_PHY + +#define ATH8030_PHY_ID 0x004dd076 +#define ATH8031_PHY_ID 0x004dd074 +#define ATH8035_PHY_ID 0x004dd072 +#define AT803X_PHY_ID_MASK 0xffffffef + +#define AT8031_HIBERNATE 0x0B +#define AT8031_PS_HIB_EN 0x8000 /* Hibernate enable */ + +int at803x_debug_reg_mask(struct phy_device *phydev, u16 reg, + u16 clear, u16 set); + +#endif /* _AT803X_PHY_H */ -- 2.16.1