From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vinod Koul Subject: [PATCH 5/7] net: phy: at803x: Rework at803x_config_init() Date: Wed, 2 Jan 2019 14:47:27 +0530 Message-ID: <20190102091729.18582-6-vkoul@kernel.org> References: <20190102091729.18582-1-vkoul@kernel.org> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Niklas Cassel , Bjorn Andersson , Vinod Koul , Andrew Lunn , Florian Fainelli To: "David S . Miller" Return-path: Received: from mail.kernel.org ([198.145.29.99]:46818 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726782AbfABJT4 (ORCPT ); Wed, 2 Jan 2019 04:19:56 -0500 In-Reply-To: <20190102091729.18582-1-vkoul@kernel.org> Sender: netdev-owner@vger.kernel.org List-ID: Rework at803x_config_init() function to check and program the tx and rx delay enable separately. This will help in checking the delay to be programmed based on other conditions as well. Signed-off-by: Vinod Koul --- drivers/net/phy/at803x.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index e74a047a846e..63e3d3d774d1 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -249,6 +249,7 @@ static int at803x_probe(struct phy_device *phydev) static int at803x_config_init(struct phy_device *phydev) { + bool rx_delay = false, tx_delay = false; int ret; ret = genphy_config_init(phydev); @@ -256,14 +257,19 @@ static int at803x_config_init(struct phy_device *phydev) return ret; if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID || - phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { + phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) + rx_delay = true; + if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID || + phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) + tx_delay = true; + + if (rx_delay) { ret = at803x_enable_rx_delay(phydev); if (ret < 0) return ret; } - if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID || - phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { + if (tx_delay) { ret = at803x_enable_tx_delay(phydev); if (ret < 0) return ret; -- 2.20.1