Message ID | 20221116205308.2996556-9-msp@baylibre.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp57619wrr; Wed, 16 Nov 2022 12:57:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf69686CSXXY44g5V7nXvYLflUzau+Hrnmesr+JhPoF/ggQxcehhscji9poCmdVNRf/RmCdr X-Received: by 2002:aa7:8e46:0:b0:56b:abf4:f77c with SMTP id d6-20020aa78e46000000b0056babf4f77cmr24844967pfr.37.1668632279254; Wed, 16 Nov 2022 12:57:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668632279; cv=none; d=google.com; s=arc-20160816; b=FdrnyMA2tQOimgUG7fsjiFV/Nt8TDCISOV87s6HDhd5kDs+dlVAYVwFf+B3JeYb47+ 64AFjn1CSd0+U6TECspVaV5VZtSW+/jCWb19wofVHJ85ZsbBjPH0i/SLDTXF8lNvPwuV SP2x3kg9psV/CRiO1/AarmnHzjkmaq7UpFhIS/UKQR8aARdXbycHQJFkDidyW1c367k3 KEL7VCgkini3T21PZql0yqEgXkQmWg4Wooef8ld2osMwpST7XmSSBLIXvCHivWhp48cf F4y2liFx2ux5SLcnhmmbfm8o/kR4BYdMbzKE/CU1aOCQlLEXlf+4LIv49YeC7AO5MCoQ /Gzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=b1NW4yffam7J6Z66UeY98X/Lxzuu+uqNj1++GX3J7z0=; b=zIkS7flXVTjxZxiidoGIotonzb9pidfxqDAjpv329NImgNoUDbySbpVHV42GPoZfpR DBdLHrkqKKT2c0bMwE9uHg79x2ct301NfYD8O0l248/UrxL7ivKDLr3RGeL+Nkcx2Tjf hj8NFf+eFq/AEdoRz6jMyGyO8ynJb57n+dlGCDFhNwOhuRB5FIfkcbIPKgNWwyc2AEI7 CiFWpdmpXDaNWhVg/MQqhj4NgQUIDJISl32iM2dx9pwa62EHUXI2R49cKxJoMgkO4KOb Cfc5tWnu7V0Ui7A1oZAZMrQb9Dh8qTRMdiimXm1VIwGd1iNHeZomyEXp7Y/pfn3u8Gk7 XVQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=Fn+pjOi7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t11-20020a170902d14b00b00174c5fdc8d2si14162631plt.307.2022.11.16.12.57.43; Wed, 16 Nov 2022 12:57:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=Fn+pjOi7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239006AbiKPUyl (ORCPT <rfc822;just.gull.subs@gmail.com> + 99 others); Wed, 16 Nov 2022 15:54:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237515AbiKPUxw (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 16 Nov 2022 15:53:52 -0500 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B0856272 for <linux-kernel@vger.kernel.org>; Wed, 16 Nov 2022 12:53:31 -0800 (PST) Received: by mail-ej1-x62b.google.com with SMTP id n21so6410378ejb.9 for <linux-kernel@vger.kernel.org>; Wed, 16 Nov 2022 12:53:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=b1NW4yffam7J6Z66UeY98X/Lxzuu+uqNj1++GX3J7z0=; b=Fn+pjOi7VxZlwBiOMmabPiR+6IHaFVnPkFKbMENKhdrwfdApvpUQBK2DrzSm8UZ3l+ LBgLnkruBLVK5H9Tz3LtB/DxxziqVAKGYdy+2KAVIJ3tPxXMTLxirF7JOIUcPu3bk1s5 Ah2GESoKw9t04qJclb9ZKouemoIya66kpstWZwAR76Ni2A6BXsyOjIau71qtKm2twGCH OZewz/IsWr1KR9xbm3owiIWYvu9j4qJ6AWvx6bzdTD0OK/RnbkqCeFRwpg88Birnm2FI IBOaNk32rlVnzjgJDp+VA4edjSpYwHv/Iw52HlvRGfnLV14A4FTa8v7sbR1UtkAAbsVg JDqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b1NW4yffam7J6Z66UeY98X/Lxzuu+uqNj1++GX3J7z0=; b=4iQk7Pht3Mz38WKvyoPfJKAmO8CndG4atdxm/AzKNKdXmEw9JDomUUFyoAMqtKmiNO kAZERBT8ftsoMZ1CXBG32533AKnu0rfc4ug3C6+TJfUkye+cIirneQjffMsuyVjyq2BQ 9JUX0ySMGN9U4Peq9LrzWFVPQj2sEnEtvRDOgb/8QkC8IiaPrO3DPoVfggJuuMrRiAt3 6Ws8eYz7xEA5Yi6mpGn2jlF/TVH9GCaFb2uDO6Drvzh/OFvWrXBCqJhUku+TW/tix0Ik RIXd7fd3NPVAAjiMBnsaYm0w4hT62dXfeuq7hzl5/7mxq7xXqvCi7/07iTvhSnqw088n fp5Q== X-Gm-Message-State: ANoB5pnvmeM0zshXq4byabEsn5VsP/uulPvDm7O333cMPEVtnyH1ghYS FB6mF/+vO1/qeDzYNLRAjLMZlA== X-Received: by 2002:a17:906:489a:b0:7b2:73d0:4b9c with SMTP id v26-20020a170906489a00b007b273d04b9cmr6681647ejq.746.1668632010464; Wed, 16 Nov 2022 12:53:30 -0800 (PST) Received: from blmsp.fritz.box ([2001:4090:a244:804b:353b:565:addf:3aa7]) by smtp.gmail.com with ESMTPSA id kv17-20020a17090778d100b007aece68483csm6782828ejc.193.2022.11.16.12.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 12:53:30 -0800 (PST) From: Markus Schneider-Pargmann <msp@baylibre.com> To: Chandrasekar Ramakrishnan <rcsekar@samsung.com>, Marc Kleine-Budde <mkl@pengutronix.de>, Wolfgang Grandegger <wg@grandegger.com> Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Markus Schneider-Pargmann <msp@baylibre.com> Subject: [PATCH 08/15] can: m_can: Count TXE FIFO getidx in the driver Date: Wed, 16 Nov 2022 21:53:01 +0100 Message-Id: <20221116205308.2996556-9-msp@baylibre.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116205308.2996556-1-msp@baylibre.com> References: <20221116205308.2996556-1-msp@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749687761142142576?= X-GMAIL-MSGID: =?utf-8?q?1749687761142142576?= |
Series |
can: m_can: Optimizations for tcan and peripheral chips
|
|
Commit Message
Markus Schneider-Pargmann
Nov. 16, 2022, 8:53 p.m. UTC
The getindex simply increases by one for every iteration. There is no
need to get the current getidx every time from a register. Instead we
can just count and wrap if necessary.
Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>
---
drivers/net/can/m_can/m_can.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index 1d15beaea920..27095a7254dd 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -1021,15 +1021,13 @@ static int m_can_echo_tx_event(struct net_device *dev) /* Get Tx Event fifo element count */ txe_count = FIELD_GET(TXEFS_EFFL_MASK, m_can_txefs); + fgi = FIELD_GET(TXEFS_EFGI_MASK, m_can_txefs); /* Get and process all sent elements */ for (i = 0; i < txe_count; i++) { u32 txe, timestamp = 0; int err; - /* retrieve get index */ - fgi = FIELD_GET(TXEFS_EFGI_MASK, m_can_read(cdev, M_CAN_TXEFS)); - /* get message marker, timestamp */ err = m_can_txe_fifo_read(cdev, fgi, 4, &txe); if (err) { @@ -1043,6 +1041,7 @@ static int m_can_echo_tx_event(struct net_device *dev) /* ack txe element */ m_can_write(cdev, M_CAN_TXEFA, FIELD_PREP(TXEFA_EFAI_MASK, fgi)); + fgi = (++fgi >= cdev->mcfg[MRAM_TXE].num ? 0 : fgi); --cdev->tx_fifo_in_flight; /* update stats */