From patchwork Wed Jan 2 09:17:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 154643 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp12686471ljp; Wed, 2 Jan 2019 01:20:03 -0800 (PST) X-Google-Smtp-Source: ALg8bN6W5xWrz2O6bzIDV9Rv68ArLH8NMqaP3Ej9BcDbFiYWhZxBt1UftxPoe60bxCUsgL2M5+bx X-Received: by 2002:a63:6704:: with SMTP id b4mr12917225pgc.100.1546420803773; Wed, 02 Jan 2019 01:20:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546420803; cv=none; d=google.com; s=arc-20160816; b=P7CLouSTVyPrivsMATItZrrxhn4qasfABcelxyf5u4VCUPpq+9Z3yvcbJZKmcmi156 fHl9wMph4b5bklvCMk0elL4+RmWaCtkafx9NFZQHnefP81wNL0Qp9I+iVLKPKpcH/2LW +XgTbEUy+PBc6ObWKlFTef8eBSgTf3k8UIvooagWTuepk1qrYhDZDkv1PFUGteC8h5r1 koIxRsyZx7mWTVE3qYQDCh8tLFdVvh+XIjjPhi/ltT5c3d8zlV258NEKM2/NEhx5pm2X 3li5jrVULTBKXTvsuxOoKURj1o9j7TAhthxAVsD76HSqdIUfg7dQ4UqpbkIsF8ePo8Kh yYew== 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=QZvb8gYs4ICWC9CIKKB0UGYNw8rXesc7JPG0wUjVObA=; b=gvotHabl49uSwCzC/p8ctt5kLFCO6LKVhuVvqNG+OZtJYqasZTkQQZxpT991yIrCY3 +JCTuooEAvnFq8QvVcca2XtpfiBClqN74oqBqscd9hxSwh6O6CT/4j8HkQbBSnZYF8VO 8b8fLbvpLgu4AXhQsx0Wb5F5A1nfZlr6Xb5m897jiHCVn9XWD30CvVOes48p8H4Btc9N B3FqO6A2fkXd9QDo6HUnlWbdeG45MzfSnhjBFZ09qBtPOgwNWG5zrFMHKcS0pnyzsxw4 Rk91Mw9P78yOgZIPCrSRq7XGiNEyy8Pkn9pG1Z94opPLLvODzdR6MtDVl10nQoN9nY0x 07Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XDZ4Vuv1; 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.03; Wed, 02 Jan 2019 01:20:03 -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=XDZ4Vuv1; 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 S1729175AbfABJUC (ORCPT + 10 others); Wed, 2 Jan 2019 04:20:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:46918 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729162AbfABJUC (ORCPT ); Wed, 2 Jan 2019 04:20:02 -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 348F0218CD; Wed, 2 Jan 2019 09:19:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546420801; bh=ISzi6VIvKOeIXa1T9gbMLQkOrZXT1YJKRukIO9DEgMo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XDZ4Vuv1AxAdbEh8P/LJx0t19sobn6ceSkU1kd5TFUs95ZQNSAyveF403h2IQB4OT cTyFZRIeTGg8wxDNNoQ6wGiPXuiYGQrLJbbuE7uaWuBRdULNza4Symani6QKayGqFs jgy9PEJUw2b4SdtP5Hi3p2tshpLRhJeXEhHdzX18= 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 , Vivien Didelot Subject: [PATCH 7/7] net: dsa: qca8k: handle disable tx/rx delay Date: Wed, 2 Jan 2019 14:47:29 +0530 Message-Id: <20190102091729.18582-8-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 We should disable tx/rx delay in rgmii mode, but driver doesn't do so. Hence add a device tree property to avoid breaking current users and disable only when this property is set Signed-off-by: Vinod Koul --- drivers/net/dsa/qca8k.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) -- 2.20.1 diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c index 7e97e620bd44..6dfb390ebe66 100644 --- a/drivers/net/dsa/qca8k.c +++ b/drivers/net/dsa/qca8k.c @@ -420,7 +420,9 @@ qca8k_mib_init(struct qca8k_priv *priv) static int qca8k_set_pad_ctrl(struct qca8k_priv *priv, int port, int mode) { - u32 reg; + u32 reg, val; + struct dsa_switch *ds = priv->ds; + bool rx_delay_disable, tx_delay_disable; switch (port) { case 0: @@ -439,17 +441,24 @@ qca8k_set_pad_ctrl(struct qca8k_priv *priv, int port, int mode) */ switch (mode) { case PHY_INTERFACE_MODE_RGMII: - qca8k_write(priv, reg, - QCA8K_PORT_PAD_RGMII_EN | - QCA8K_PORT_PAD_RGMII_TX_DELAY(3) | - QCA8K_PORT_PAD_RGMII_RX_DELAY(3)); - - /* According to the datasheet, RGMII delay is enabled through + rx_delay_disable = of_property_read_bool(ds->dst->cpu_dp->dn, + "rx-delay-disable"); + tx_delay_disable = of_property_read_bool(ds->dst->cpu_dp->dn, + "tx-delay-disable"); + val = QCA8K_PORT_PAD_RGMII_EN; + if (!rx_delay_disable) + val |= QCA8K_PORT_PAD_RGMII_RX_DELAY(3); + if (!tx_delay_disable) + val |= QCA8K_PORT_PAD_RGMII_TX_DELAY(3); + qca8k_write(priv, reg, val); + + /* According to the datasheet, RGMII rx delay is enabled through * PORT5_PAD_CTRL for all ports, rather than individual port * registers */ - qca8k_write(priv, QCA8K_REG_PORT5_PAD_CTRL, - QCA8K_PORT_PAD_RGMII_RX_DELAY_EN); + if (!rx_delay_disable) + qca8k_write(priv, QCA8K_REG_PORT5_PAD_CTRL, + QCA8K_PORT_PAD_RGMII_RX_DELAY_EN); break; case PHY_INTERFACE_MODE_SGMII: qca8k_write(priv, reg, QCA8K_PORT_PAD_SGMII_EN);