From patchwork Mon Dec 2 10:30:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 180592 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp5012094ile; Mon, 2 Dec 2019 02:31:12 -0800 (PST) X-Google-Smtp-Source: APXvYqw1mEoba+5yzn/vNp+zLW5aEaT89cvLCAhCZ8/BhdVLRbyOxvZuYlllGFUkoS3yvhDuE0d3 X-Received: by 2002:aa7:d48d:: with SMTP id b13mr22489365edr.246.1575282672443; Mon, 02 Dec 2019 02:31:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575282672; cv=none; d=google.com; s=arc-20160816; b=ZthKh2GIetSEJ3igHZEV9CQWwUigO6buNioCiUZtnFWW15oiZpA8oZ1Z6Zs8Hn//s5 Cu8kwOy3q7d1OB9hDgGxvgPHUlphg5PohYSfgbLSIDkSllikYmS4tUVxQzuA2F7rH/nd 0mUE+YFu7nw4ZoxDRZ6U0oCUqmKLPqN5oGwY7mJvH4E20zKpvoRuWwLwF1gWpUJcVww3 Kqvox3Nfa7UF260RKqgIOCYHdggdKYoxCSsr6w0WFncP/iGy0Zr+BQAst5nYrzSChuG+ wJDaqLRW9pvOfR8xkdNJ0K8oyCk5+lhB5ilYZoJqPN/TvZqgKlNdI7KZClSC5irEUQMc RQ9g== 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:to:from :dkim-signature; bh=g1aRXdZIL7DyaMdVPCxZFmg5TXh5yLg89o9u2qBK/18=; b=bNfupquXHWbU5nhrRsnaoy748N08aRSxfXuoOLjqelqmqf8HV3bU1Pj4mY6vypGzkB XLj+mmWVTqjhrvuFlXBspaHbiqxyJpPPE9UtLKm5bhblcrqpS50lvmDNh60DZohOR23t asEofQHo2hKy/yQ7eRt842vv4/FbZPJKwW2vQ1Bd75dUPFzIiVY4LEBKz2cHaSe6mtGg bMZXILqeWq9hg/wwu/LJRbURF+quyDUID8VsFUaApqTKUo3qzPnwC5JfUXihgxK08Zbz ArX1ffcr6M7884KcBS6vRPt6Qw00AWMp4ZRkSTotQlpZWKyOmBaOxLiz6TphWbE7Ub8n Rfww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="M/LUdfYX"; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e21si4015152edq.191.2019.12.02.02.31.12; Mon, 02 Dec 2019 02:31:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org header.s=google header.b="M/LUdfYX"; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726469AbfLBKbL (ORCPT + 15 others); Mon, 2 Dec 2019 05:31:11 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:33238 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727366AbfLBKbL (ORCPT ); Mon, 2 Dec 2019 05:31:11 -0500 Received: by mail-wm1-f68.google.com with SMTP id y23so10390822wma.0 for ; Mon, 02 Dec 2019 02:31:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=g1aRXdZIL7DyaMdVPCxZFmg5TXh5yLg89o9u2qBK/18=; b=M/LUdfYXDFOh+XWQ9Rid95XqG8HePYh04/nxkU3XAUPvAuFwwGmgoLU5b53xU6nLr0 DhunGG5IXWEzdT3cvCyC0/RcaycOyy6ZsMyAJCmem6ZQkXLMMcYsSuzezVR9jePR2LOO T+BiIIb9JfisxP0zSXTIBZeEVUBMrDEyWiVtYM2RBqL8tZpFQ4GhIQpdFGGijRMHCyNL nciSJ1vOxoUdR4XC1Js7PQLgQvjz89edO+QsPYRqrSXeZBf7PqQfh4HKO1cs0zytCEZF DtjT41hnHzuRnkan42rRHCHJFhAed5P/hKUCZxDDxF1JUTaof+Vp5i8Olylj3W9h7So6 dtsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g1aRXdZIL7DyaMdVPCxZFmg5TXh5yLg89o9u2qBK/18=; b=iit6GvCHvCOapXNXE7IPfmjVOvR6llasOmlaE9rlwMpButuqHHdMjzYF3R51khTvV2 sWF0Tt6urPvEcYUM9rD5Mq3S5Z7PDCGay7thKPCaIRvyZdJ1WokHlLFcY8L2PsQaUzPu VL5C8TvDzAuj79kSDYbWFBG9FhQqMGJg6Kpw9XqDMYWODetc6mQ3Iy7rlaF0Ha2m7NrW jGOB9KUqBv/BA9sKugBttWpa5NRfrmm47MiSSg9XGrHx4PIUA02T91+r7Kb7jQeH62XS gczMTXCtoaQFySdPbTCWauBc1tTbRvqYOeKeXAL4MXeIh50xJZ/ZZncda0IVg7aQs0Lg 5v2A== X-Gm-Message-State: APjAAAUxFrDZyWEFxhROnV/+Az7UgKSqVpfnIO85qw+aZLWya4Xk/jcb cjWr02VJG62RM09osaDJjWGtpdOqMgI= X-Received: by 2002:a1c:7d92:: with SMTP id y140mr26772766wmc.145.1575282668811; Mon, 02 Dec 2019 02:31:08 -0800 (PST) Received: from localhost.localdomain ([2.27.35.155]) by smtp.gmail.com with ESMTPSA id r6sm26402860wrq.92.2019.12.02.02.31.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2019 02:31:08 -0800 (PST) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.19 05/15] net: macb: Fix SUBNS increment and increase resolution Date: Mon, 2 Dec 2019 10:30:40 +0000 Message-Id: <20191202103050.2668-5-lee.jones@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191202103050.2668-1-lee.jones@linaro.org> References: <20191202103050.2668-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Harini Katakam [ Upstream commit 7ad342bc58cc5197cd2f12a3c30b3949528c6d83 ] The subns increment register has 24 bits as follows: RegBit[15:0] = Subns[23:8]; RegBit[31:24] = Subns[7:0] Fix the same in the driver and increase sub ns resolution to the best capable, 24 bits. This should be the case on all GEM versions that this PTP driver supports. Signed-off-by: Harini Katakam Signed-off-by: David S. Miller Signed-off-by: Lee Jones --- drivers/net/ethernet/cadence/macb.h | 6 +++++- drivers/net/ethernet/cadence/macb_ptp.c | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) -- 2.24.0 diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 9bbaad9f3d63..efb44d5ab021 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -499,7 +499,11 @@ /* Bitfields in TISUBN */ #define GEM_SUBNSINCR_OFFSET 0 -#define GEM_SUBNSINCR_SIZE 16 +#define GEM_SUBNSINCRL_OFFSET 24 +#define GEM_SUBNSINCRL_SIZE 8 +#define GEM_SUBNSINCRH_OFFSET 0 +#define GEM_SUBNSINCRH_SIZE 16 +#define GEM_SUBNSINCR_SIZE 24 /* Bitfields in TI */ #define GEM_NSINCR_OFFSET 0 diff --git a/drivers/net/ethernet/cadence/macb_ptp.c b/drivers/net/ethernet/cadence/macb_ptp.c index a6dc47edc4cf..8f912de44def 100644 --- a/drivers/net/ethernet/cadence/macb_ptp.c +++ b/drivers/net/ethernet/cadence/macb_ptp.c @@ -115,7 +115,10 @@ static int gem_tsu_incr_set(struct macb *bp, struct tsu_incr *incr_spec) * to take effect. */ spin_lock_irqsave(&bp->tsu_clk_lock, flags); - gem_writel(bp, TISUBN, GEM_BF(SUBNSINCR, incr_spec->sub_ns)); + /* RegBit[15:0] = Subns[23:8]; RegBit[31:24] = Subns[7:0] */ + gem_writel(bp, TISUBN, GEM_BF(SUBNSINCRL, incr_spec->sub_ns) | + GEM_BF(SUBNSINCRH, (incr_spec->sub_ns >> + GEM_SUBNSINCRL_SIZE))); gem_writel(bp, TI, GEM_BF(NSINCR, incr_spec->ns)); spin_unlock_irqrestore(&bp->tsu_clk_lock, flags);