From patchwork Wed Jan 2 09:17:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 1019928 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="2crBKOFl"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43V59T4FRTz9rxp for ; Wed, 2 Jan 2019 20:19:57 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729150AbfABJT4 (ORCPT ); Wed, 2 Jan 2019 04:19:56 -0500 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 Received: from localhost.localdomain (unknown [171.76.109.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 823462171F; Wed, 2 Jan 2019 09:19:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546420795; bh=1sWof/2cFdPJlwhUxyC71vY9rTlmh05IdxWncznxeEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2crBKOFlRLvDkR/DGGqNxZ3A6h7FVruncp0Ekl0aLVXkdUDlL9R4j0Cr+vQhy/3/e BjSOcUGc9jBzGPI/Rgl1wJ1t6mUfU+PFljLGkqoy+fhIzm+YnRh+fW79d5D5/Nd660 EdRrg6U6szxpxA0/yup+nsH21p6ejcns3CMgJ6Z8= From: Vinod Koul To: "David S . Miller" Cc: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Niklas Cassel , Bjorn Andersson , Vinod Koul , Andrew Lunn , Florian Fainelli 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> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190102091729.18582-1-vkoul@kernel.org> References: <20190102091729.18582-1-vkoul@kernel.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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;