From patchwork Tue Oct 27 16:11:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 319163 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp1709036ilc; Tue, 27 Oct 2020 09:13:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvGIMG66/aCgWa0M64wZ3YINWoTQo9SsazOHdMFxyRsPV/q905DDbjyyIBfkc7AcVboGvX X-Received: by 2002:a05:6402:1585:: with SMTP id c5mr3079402edv.278.1603815193152; Tue, 27 Oct 2020 09:13:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603815193; cv=none; d=google.com; s=arc-20160816; b=eGWIeq3BppIj0kikAmXL7be5BuYyU6d/xaK1z4VQxS+heYE+34uGRTI7/Ek1OKVJi/ aCVqPDob0ywWklHwl0eeJDZC2rafDZFKHGUE8KZulUuayiZ1Iw/7Lj1U1o175U+FqTXS ra73UzahUMS6XFtdoDnR4tK6eVkm5G93n9ESGgTk7zjAw/7ixOeqRnXEAkipXfoOW+Z1 F3tgwqmYuq4/tWqqNPrZnwgiHYaom7f8TXmTvnB33APMV340T8ZwW9t5H9vkWyaMb/ce 3ElRZwnTOULo2oXKPrjTiy+/to5QkP+wTDD8LHlLGV5t9Uv2urM3eYQXifZXJOxUBo5I MnKQ== 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=sNsja6RVkW4lCiOuiuPXRLZQ8pFPcNRAN/TOMPINMPw=; b=aFGD1x/UJ52I32nM7gkTq/1H8bPQJ37eIh5Py8rqvNbyVNEfMfX+2dKb4KVu/pCLzh A5KR5LDJtKqmFak44CNjRh8S9Hw6wG97Gn73UBwPpprPeFV7KXspzCOPpCl33K3IX7vo e6szR26LZksIDiLMlxX6mb4CDqyFBtpwjyzJ4h8914mhUOSEaxr+1mfmq1Cf39AgYkda rqirfgnP3g4OpnLa+NTykGRvDN/zGwFQLCDtnc9b+YSSRoGQKNt1VpQYI9fzfFgultA0 UqxNmR6kOOha/39hr3PQUHhE9WhDviD5KB/kZVPcPDGjOJ+FACg1pTRy8jXi1xkcUM3X Yd9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kCJEcAdE; 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 bt15si1425884ejb.170.2020.10.27.09.13.12; Tue, 27 Oct 2020 09:13:13 -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=kCJEcAdE; 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 S1807696AbgJ0QNJ (ORCPT + 8 others); Tue, 27 Oct 2020 12:13:09 -0400 Received: from mail-il1-f195.google.com ([209.85.166.195]:44887 "EHLO mail-il1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1807521AbgJ0QLb (ORCPT ); Tue, 27 Oct 2020 12:11:31 -0400 Received: by mail-il1-f195.google.com with SMTP id z2so1980820ilh.11 for ; Tue, 27 Oct 2020 09:11:30 -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=sNsja6RVkW4lCiOuiuPXRLZQ8pFPcNRAN/TOMPINMPw=; b=kCJEcAdEsNHqBQ8Cjwn1oY56xM29srDtn9h/gH2iJnw90q6FYSMQeB+oXsedzvFvFH Uw61dhZwme9Ws8p/VyvOZoN8nFF2MaLQxTe6XsuLvQOkcgBvpJ59DC0AKpMwc1ZjMEZo VtmKKesT8jz+mWRPt1mzhorgM9GpoXqvJmEugxXO+aV1kCBqCAKpIVDjWZnKEcJtWA42 VQpILjb6Suq8OPuH4aiiPYRwu+bRC/e1DOa4lDsQ1MldvR6GfujUYs4mSmnKzfdOrzwU 1cPd8fLX1dSMvEcvaKdV1NpTlXiiAiPAuuPuN1nGZZ3icwUqX58ANu+vufWOuFH3WTl8 +mgg== 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=sNsja6RVkW4lCiOuiuPXRLZQ8pFPcNRAN/TOMPINMPw=; b=rFx80RkwTO9GxNcjF4FH1GLnQhExFNf1/Pg0FGvtadgpSZ2MYxhsdl4U6t5shcMo3h kYLPwjMxrLxZGwowhC9rHT7330bjzSY4KJIBqvwaWf5lfqOGWVo5Bow/yMn3ZTIzCJr6 ubTIfzWUb1XOf7WEX3DNCI1FzuLXx2URnr2J65vYHSYgmBlB7bPd6GUydmHCqwU+JbEr 0k7CaMkSkdOV43o+egWVCakNhuESea2hT47WxAzstq8II+f+7VUh+fNtlhYihv61A7pe X9wJ57w020bNZtoaK3OijOlr7csNr+LpuXBemhglr8KJkfGxl/O73ow8tJIzGIOfM1ZV o8bA== X-Gm-Message-State: AOAM5324o2ckrF+n9njkP/qjw6eTRL6ldTv8flcjqCfsh4jt3ZTWXjCu bDjFhCQhtLwcJJUyDoqTlexUoUno/x5J+8Lk X-Received: by 2002:a92:740c:: with SMTP id p12mr2306704ilc.277.1603815089887; Tue, 27 Oct 2020 09:11:29 -0700 (PDT) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id w15sm1082264iom.6.2020.10.27.09.11.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 09:11:29 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net 2/5] net: ipa: fix resource group field mask definition Date: Tue, 27 Oct 2020 11:11:17 -0500 Message-Id: <20201027161120.5575-3-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201027161120.5575-1-elder@linaro.org> References: <20201027161120.5575-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The mask for the RSRC_GRP field in the INIT_RSRC_GRP endpoint initialization register is incorrectly defined for IPA v4.2 (where it is only one bit wide). So we need to fix this. The fix is not straightforward, however. Field masks are passed to functions like u32_encode_bits(), and for that they must be constant. To address this, we define a new inline function that returns the *encoded* value to use for a given RSRC_GRP field, which depends on the IPA version. The caller can then use something like this, to assign a given endpoint resource id 1: u32 offset = IPA_REG_ENDP_INIT_RSRC_GRP_N_OFFSET(endpoint_id); u32 val = rsrc_grp_encoded(ipa->version, 1); iowrite32(val, ipa->reg_virt + offset); The next patch requires this fix. Fixes: cdf2e9419dd91 ("soc: qcom: ipa: main code") Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_reg.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/drivers/net/ipa/ipa_reg.h b/drivers/net/ipa/ipa_reg.h index e542598fd7759..7dcfa07180f9f 100644 --- a/drivers/net/ipa/ipa_reg.h +++ b/drivers/net/ipa/ipa_reg.h @@ -341,7 +341,16 @@ static inline u32 ipa_reg_idle_indication_cfg_offset(enum ipa_version version) #define IPA_REG_ENDP_INIT_RSRC_GRP_N_OFFSET(ep) \ (0x00000838 + 0x0070 * (ep)) -#define RSRC_GRP_FMASK GENMASK(1, 0) +/* Encoded value for RSRC_GRP endpoint register RSRC_GRP field */ +static inline u32 rsrc_grp_encoded(enum ipa_version version, u32 rsrc_grp) +{ + switch (version) { + case IPA_VERSION_4_2: + return u32_encode_bits(rsrc_grp, GENMASK(0, 0)); + default: + return u32_encode_bits(rsrc_grp, GENMASK(1, 0)); + } +} /* Valid only for TX (IPA consumer) endpoints */ #define IPA_REG_ENDP_INIT_SEQ_N_OFFSET(txep) \