From patchwork Wed Jan 2 09:17:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 154642 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp12686438ljp; Wed, 2 Jan 2019 01:20:01 -0800 (PST) X-Google-Smtp-Source: AFSGD/UXVwaLliBlQwhRkiWYTcVZ2JwWpp49uK2Au7nVC1o3DrFpq6EJMkVo84K7thE2naKKMqOm X-Received: by 2002:a62:2547:: with SMTP id l68mr43257070pfl.131.1546420800876; Wed, 02 Jan 2019 01:20:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546420800; cv=none; d=google.com; s=arc-20160816; b=h4WUaWneHBzE093Gv1D58snendCeHbPMzO9LMH776OBoWp508CdBMmHF2/wdLKLLE9 Z9uhNSiuW6cGePEsHJvy2G1P2njFXsGBFLLDux9IzrXhJ2aXIRNQz4cL0ZRN9Jjje17K MXmrTGvFEWxWN+YSv4gHzxwBBuuXJ5GoHe9nde4DArGZ+60AUO/UKmRzHESLAvgjptKb SsXS5GXHX9bG12pfYtPsuvby7s7Yvc8QhYun4DsJ56XBHgllrlWH2UVPlI/J6m7q7ieS IzR7XKTDOdggRKuCcgCe9E5wC/FrLrAuk0l2MEJk1n9B5iVcsiCIBxjNtxVZZteyuzB2 +KNA== 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 :dkim-signature; bh=d4EeCJQbz7QKcXcslHq526ZAL1XzRYK/bwu4NAVOkII=; b=O2Y0Jxf8kRYQO0BGK7g3BZwqzjK66U18vZMmtxV64/lAsMhBeNCJ7Y4b2hXHwSUsWH oDU2V5wNd4OQYkS+2dSOweyxsLVMAWNWctzLP9/0R3OgQ9jxFG5A7FCw45o9X7eHICkY YUEHJ0wtQJT/9U5CE1tz8GEFaT3N48vGZTd3LwjOT3Ci8ev9uJu+uE/YfdvtIsZCXZBf ABVDNtD66Yh25F+4LPww/3AyNQuVKL5n2EfRQXLGR1JIYH3hQPNuXrTgXXobrMHy77Jp 9NmwcC/xGJsshCpJrXoT+OBsRwcMWoxq4JoKYutN3g6gNnAV/c7sQXRKaencYAdhkjC2 7HbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RdvCkLQq; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t17si14908523pgk.217.2019.01.02.01.20.00; Wed, 02 Jan 2019 01:20:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RdvCkLQq; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729161AbfABJT7 (ORCPT + 10 others); Wed, 2 Jan 2019 04:19:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:46868 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726782AbfABJT7 (ORCPT ); Wed, 2 Jan 2019 04:19:59 -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 5BEE0218A4; Wed, 2 Jan 2019 09:19:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546420798; bh=0XDsmMYL+17wKKpG65ohuCm2jhb9zQwhUoQRloYoyPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RdvCkLQquJT3k1HeHZIRbFn5X8r1y5nb6W8mHclOmXKDEvYOmHRaRhCKq1aKdLJuP /uP1LF2arlfPneci3tIeMSj8+/Mm6MIfW5cVN8prqUApI9fveg3gMAn1vaMgjFicz1 Lh/H5Q+67I98kVT2z/kTm2Mo+D8N4Rj6Cu4sELR8= 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 6/7] net: phy: at803x: Add support to disable tx/rx delays Date: Wed, 2 Jan 2019 14:47:28 +0530 Message-Id: <20190102091729.18582-7-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 Some controllers require the tx and rx delays to be disabled. So check the property and if present do not enable the delay and disable the delay explicitly. Signed-off-by: Vinod Koul --- drivers/net/phy/at803x.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) -- 2.20.1 diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 63e3d3d774d1..9bfc0d381159 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -122,6 +122,17 @@ static inline int at803x_enable_tx_delay(struct phy_device *phydev) AT803X_DEBUG_TX_CLK_DLY_EN); } +static inline int at803x_disable_rx_delay(struct phy_device *phydev) +{ + return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, + AT803X_DEBUG_RX_CLK_DLY_EN, 0); +} + +static inline int at803x_disable_tx_delay(struct phy_device *phydev) +{ + return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, + AT803X_DEBUG_TX_CLK_DLY_EN, 0); +} /* save relevant PHY registers to private copy */ static void at803x_context_save(struct phy_device *phydev, struct at803x_context *context) @@ -250,12 +261,18 @@ static int at803x_probe(struct phy_device *phydev) static int at803x_config_init(struct phy_device *phydev) { bool rx_delay = false, tx_delay = false; + bool rx_disable_prop, tx_disable_prop; int ret; ret = genphy_config_init(phydev); if (ret < 0) return ret; + rx_disable_prop = device_property_read_bool(&phydev->mdio.dev, + "rx-delay-disable"); + tx_disable_prop = device_property_read_bool(&phydev->mdio.dev, + "rx-delay-disable"); + if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID || phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) rx_delay = true; @@ -263,6 +280,12 @@ static int at803x_config_init(struct phy_device *phydev) phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) tx_delay = true; + /* if DT specified disable delay then don't enable it */ + if (rx_disable_prop) + rx_delay = false; + if (tx_disable_prop) + tx_delay = false; + if (rx_delay) { ret = at803x_enable_rx_delay(phydev); if (ret < 0) @@ -275,6 +298,19 @@ static int at803x_config_init(struct phy_device *phydev) return ret; } + /* if DT specified disable delay then disable it explicitly */ + if (rx_disable_prop) { + ret = at803x_disable_rx_delay(phydev); + if (ret < 0) + return ret; + } + + if (tx_disable_prop) { + ret = at803x_disable_tx_delay(phydev); + if (ret < 0) + return ret; + } + return 0; }