From patchwork Wed Mar 24 13:15:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 407811 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp402013jai; Wed, 24 Mar 2021 06:16:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrN4UMuUo4FBTmmLIv0B7LUv6S6yx2jskf16hUOkSiqHuneEcD/8qB/e1zCvpjGOS4MZv3 X-Received: by 2002:a17:906:d94:: with SMTP id m20mr3513826eji.511.1616591800815; Wed, 24 Mar 2021 06:16:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616591800; cv=none; d=google.com; s=arc-20160816; b=eCxmYHMe6V63HBLWm+tkd8nb5x3V++3T06bwPIbH15SeCzp3HB9fRrLcz9ZNU3Or/M sbKOiZ+Mhy/AQfVS2v4ehNdvclWb0IzWsOJp5Jd18XQZwBLu0qs1lrmFE6Z3rdS/V3BW xgyRys6Qn+1wRgJGpYDao+l/6QiJdZ/N4ceHpmiPrtYWZySjpMcPuiEeLvvnKTgfY8Iq A+IC1wIC7dpvSYjyj6tdhr8X2e0CdtYA0xmalx59ChJcxYwxx/F4lHCgokIc5XeOQHCz z3qaNGnHbZSGFlG6l5L2Bjqtvlh/A4OGxMsYoo+Furk+sHhPR7Zs6cogNO8Dq0R2pkAp 2quQ== 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=mz7860lZzk6VZ253Yqzghlj/rfYbeBGQaKOgyWdMwc4=; b=WnzcEChFutZ5MtoH0Y9Q3frgaPZ6bRgJy3c386CXhGh7Ve3XzNgwo2UbtEQ8Szm67N kpr11tPb8d1IA06zoSnIcGqUuuK3CYLVEMyhP0A7T4DGo0CWx8g9RMsANFPPxVTH9sKO ODlzk23Gh/oG4mk2Qb70Ti1epdX81KUKiPDZEBIyTalU2zFAm4YIn6/WukL2Ezy2WpcF P0xgq1nVVFtKXbVao2PxyuoAw9xOW+gVNEYCMRXMsI00yrA0V7pZhxoxUpuYQTOfBU4T JPLi2yGXWu06x+0N0Wqph34TPnWfaHbgsUc4XdP4hMNETvyUJj3+pPpViHaeYWS8iCPu WG5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SfYkeKXA; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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. [23.128.96.18]) by mx.google.com with ESMTP id s9si1732044edc.296.2021.03.24.06.16.40; Wed, 24 Mar 2021 06:16:40 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SfYkeKXA; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S235210AbhCXNQU (ORCPT + 8 others); Wed, 24 Mar 2021 09:16:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234735AbhCXNPh (ORCPT ); Wed, 24 Mar 2021 09:15:37 -0400 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3255C0613DE for ; Wed, 24 Mar 2021 06:15:35 -0700 (PDT) Received: by mail-io1-xd31.google.com with SMTP id j26so21396719iog.13 for ; Wed, 24 Mar 2021 06:15:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mz7860lZzk6VZ253Yqzghlj/rfYbeBGQaKOgyWdMwc4=; b=SfYkeKXApi7lSZKgVpP2M8uiYF1rBLg4p9+gmn9IUpwPXMoq00r16kxp3vCdmAW2Gz JIIqu02uE7Tf6n6dCfjqvb0etdxlSWOSq7lBrpS0wBOaKrQuSWPc49g+3GzvqwOuLcnc /Rcm8CdDB7yJg8Ah+8SP+um7FVyE/k72032V9dKXx/3VmYzX6+YMoiquNchfa/B2mQNq R1GlCjfPciEd9XJ6gTnE9ggJFIBlHi24db9B7W1MVwHncVVGDFRnPPjtY4n9DXbSU1SN jsKN0a8YdXC5YxnmCPsdS2eQdYvN6HmLWTKQTIggN+9ae2TckUNaPHfPOAVl06c6wxYx oA3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mz7860lZzk6VZ253Yqzghlj/rfYbeBGQaKOgyWdMwc4=; b=Qv873gx01lhS+Wx6Zz7QEsIYT3CHfVd0F9xe4Ixlx7qZa5Use6w/NGAWUybHBRlLoZ o9hyTT5mJ9wkaAKe1Ksx1r/R8SuNJlm+DGq+ZIFKZUBjCnmBPWS9Km+pgCLQR8QDW9Dc boi78VYjuYlEWJo62tdPHEap6L2aXh2KET/pCb0oWkVEMEYoNZtBVK2QSzZtWCpd5DU3 HDZ6oZhmC+4lye5a52IfwThuiEMhhBS0EXfb2JwUkgnyUVRwV/+spj4PbJ/KHGiaTlMD 3G21I6hve5CJuFKMYPKIdp6pVMhkncYt7EzwSncMyzGZ+yQZJltZaGHbUbOBYJHKaW7H CzIg== X-Gm-Message-State: AOAM533Bj34bwPrXNJRQYneIgNgmqOXGgs6Gj/DtGnFRxEWuoW5JmHn7 oZPtbkJJ+8tCaWB26QerKiVPkA== X-Received: by 2002:a02:aa92:: with SMTP id u18mr2797673jai.119.1616591735389; Wed, 24 Mar 2021 06:15:35 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id n7sm1160486ile.12.2021.03.24.06.15.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 06:15:35 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 5/6] net: ipa: move ipa_aggr_granularity_val() Date: Wed, 24 Mar 2021 08:15:27 -0500 Message-Id: <20210324131528.2369348-6-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210324131528.2369348-1-elder@linaro.org> References: <20210324131528.2369348-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We only use ipa_aggr_granularity_val() inside "ipa_main.c", so it doesn't really need to be defined in a header file. It makes some sense to be grouped with the register definitions, but it is unlike the other inline functions now defined in "ipa_reg.h". So move it into "ipa_main.c" where it's used. TIMER_FREQUENCY is used only by that function, so move that definition as well. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 15 +++++++++++++++ drivers/net/ipa/ipa_reg.h | 12 ------------ 2 files changed, 15 insertions(+), 12 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 62d82d48aed69..ba1bfc30210a3 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -287,6 +287,21 @@ ipa_hardware_config_qsb(struct ipa *ipa, const struct ipa_data *data) iowrite32(val, ipa->reg_virt + IPA_REG_QSB_MAX_READS_OFFSET); } +/* The internal inactivity timer clock is used for the aggregation timer */ +#define TIMER_FREQUENCY 32000 /* 32 KHz inactivity timer clock */ + +/* Compute the value to use in the COUNTER_CFG register AGGR_GRANULARITY + * field to represent the given number of microseconds. The value is one + * less than the number of timer ticks in the requested period. 0 is not + * a valid granularity value. + */ +static u32 ipa_aggr_granularity_val(u32 usec) +{ + /* assert(usec != 0); */ + + return DIV_ROUND_CLOSEST(usec * TIMER_FREQUENCY, USEC_PER_SEC) - 1; +} + /* IPA uses unified Qtime starting at IPA v4.5, implementing various * timestamps and timers independent of the IPA core clock rate. The * Qtimer is based on a 56-bit timestamp incremented at each tick of diff --git a/drivers/net/ipa/ipa_reg.h b/drivers/net/ipa/ipa_reg.h index cbfef27bbcf2c..86fe2978e8102 100644 --- a/drivers/net/ipa/ipa_reg.h +++ b/drivers/net/ipa/ipa_reg.h @@ -237,18 +237,6 @@ static inline u32 proc_cntxt_base_addr_encoded(enum ipa_version version, #define IPA_REG_COUNTER_CFG_OFFSET 0x000001f0 #define AGGR_GRANULARITY_FMASK GENMASK(8, 4) -/* The internal inactivity timer clock is used for the aggregation timer */ -#define TIMER_FREQUENCY 32000 /* 32 KHz inactivity timer clock */ - -/* Compute the value to use in the AGGR_GRANULARITY field representing the - * given number of microseconds. The value is one less than the number of - * timer ticks in the requested period. 0 not a valid granularity value. - */ -static inline u32 ipa_aggr_granularity_val(u32 usec) -{ - return DIV_ROUND_CLOSEST(usec * TIMER_FREQUENCY, USEC_PER_SEC) - 1; -} - /* The next register is not present for IPA v4.5 */ #define IPA_REG_TX_CFG_OFFSET 0x000001fc /* The first three fields are present for IPA v3.5.1 only */