From nobody Thu Apr 2 16:37:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 925F9ECAAD8 for ; Thu, 22 Sep 2022 22:21:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231749AbiIVWVt (ORCPT ); Thu, 22 Sep 2022 18:21:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231244AbiIVWV3 (ORCPT ); Thu, 22 Sep 2022 18:21:29 -0400 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E220310F72B for ; Thu, 22 Sep 2022 15:21:14 -0700 (PDT) Received: by mail-io1-xd33.google.com with SMTP id y141so8965073iof.5 for ; Thu, 22 Sep 2022 15:21:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=8NQbcO3RxX3i66zbcp0uk7GFHnQ5dOAsJhkZ2O3/nY8=; b=rnQS6/cvRAD9ElWGu7c5+xdFhhhEaPl2HOtLmQIWAmE80cjQmlE8xvf2VIywl0eWGH 3r0KTxEr/8Lgrz8h/DeiI0WEZYzzQnfihyXpCXgzUMK0ghe6xylHP8YG+g7jRIzklO84 kRo5rSA/C9mcfr0Sbl5dZCikTnUb4lFETe88LLFX9yI1MjEwd2OpVeuw1wuVtHiEP7vZ 7HZ48psm0QbchBMTB7J/hqT+wn7RHupQ8WCA83BPk1EXEydqMTC6vzhkesQd2OqGc5kS An9aNx4khHwnLof6Qt0vAg0RtGUlXmcO8woYUqzWKmiUpGGFpVs0Kp3cDRV5knVFtOsp uqcQ== 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; bh=8NQbcO3RxX3i66zbcp0uk7GFHnQ5dOAsJhkZ2O3/nY8=; b=6eykWsP/Im1gFABsAMSMEEDake8Go+oFh6nOy+2mClAZp4IivOUxAI90wHjePYTonE cGWjZ8QE2YCizvlfZS0IVvxsFlCy0FYQAR0p6Zp+Ww9anLIfcuNYzrcDmbNVgJ8DV44f qWfA2el6mJYkQuvvMJnfqXbQLG9dvzSdMpSpWuJBTFtThJc4ALKLuVRq1664WlmAtRLP M+EnIl4OPSyu9Gi5Mw+EswUpKHUzzyLKMDfMreUHZSBXMPJI/1pcObt7qNsFKxih0q3w 3f/AyPhQb4zz4vgyDN3AyXuZIbNXMnW8ay4JYn+i201h/WbFF8bcy2bITQvbOQu8IsmT ++UQ== X-Gm-Message-State: ACrzQf2BYYUz5hBjSm0U7TBkKQfjWDQLPF7UaCfZfCaNnLuMHfagXrI1 Ke/Afj/KWVvXqTlKxPXejhcn+g== X-Google-Smtp-Source: AMsMyM5fqKzWRTm7+LT3vDYZIt2jxEYb4IH+OAshM0Jr14dPUohaWszSwwX80LoYbg/I4QyFzOdk1Q== X-Received: by 2002:a05:6638:430c:b0:35a:1c37:a343 with SMTP id bt12-20020a056638430c00b0035a1c37a343mr3167198jab.183.1663885274263; Thu, 22 Sep 2022 15:21:14 -0700 (PDT) Received: from localhost.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id g12-20020a92d7cc000000b002f592936fbfsm2483332ilq.41.2022.09.22.15.21.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 15:21:13 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, evgreen@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 8/8] net: ipa: encapsulate updating three more registers Date: Thu, 22 Sep 2022 17:21:00 -0500 Message-Id: <20220922222100.2543621-9-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220922222100.2543621-1-elder@linaro.org> References: <20220922222100.2543621-1-elder@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Create a new function that encapsulates setting the BCR, TX_CFG, and CLKON_CFG register values during hardware configuration. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 79 +++++++++++++++++++++++++------------- 1 file changed, 53 insertions(+), 26 deletions(-) diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 8bb4b036df2b4..a552d6edb702d 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -183,6 +183,56 @@ static void ipa_teardown(struct ipa *ipa) gsi_teardown(&ipa->gsi); } =20 +static void +ipa_hardware_config_bcr(struct ipa *ipa, const struct ipa_data *data) +{ + u32 val; + + /* IPA v4.5+ has no backward compatibility register */ + if (ipa->version >=3D IPA_VERSION_4_5) + return; + + val =3D data->backward_compat; + iowrite32(val, ipa->reg_virt + IPA_REG_BCR_OFFSET); +} + +static void ipa_hardware_config_tx(struct ipa *ipa) +{ + enum ipa_version version =3D ipa->version; + u32 val; + + if (version <=3D IPA_VERSION_4_0 || version >=3D IPA_VERSION_4_5) + return; + + /* Disable PA mask to allow HOLB drop */ + val =3D ioread32(ipa->reg_virt + IPA_REG_TX_CFG_OFFSET); + + val &=3D ~PA_MASK_EN_FMASK; + + iowrite32(val, ipa->reg_virt + IPA_REG_TX_CFG_OFFSET); +} + +static void ipa_hardware_config_clkon(struct ipa *ipa) +{ + enum ipa_version version =3D ipa->version; + u32 val; + + if (version < IPA_VERSION_3_1 || version >=3D IPA_VERSION_4_5) + return; + + /* Implement some hardware workarounds */ + if (version >=3D IPA_VERSION_4_0) { + /* Enable open global clocks in the CLKON configuration */ + val =3D GLOBAL_FMASK | GLOBAL_2X_CLK_FMASK; + } else if (version =3D=3D IPA_VERSION_3_1) { + val =3D MISC_FMASK; /* Disable MISC clock gating */ + } else { + return; + } + + iowrite32(val, ipa->reg_virt + IPA_REG_CLKON_CFG_OFFSET); +} + /* Configure bus access behavior for IPA components */ static void ipa_hardware_config_comp(struct ipa *ipa) { @@ -382,32 +432,9 @@ static void ipa_hardware_dcd_deconfig(struct ipa *ipa) */ static void ipa_hardware_config(struct ipa *ipa, const struct ipa_data *da= ta) { - enum ipa_version version =3D ipa->version; - u32 val; - - /* IPA v4.5+ has no backward compatibility register */ - if (version < IPA_VERSION_4_5) { - val =3D data->backward_compat; - iowrite32(val, ipa->reg_virt + IPA_REG_BCR_OFFSET); - } - - /* Implement some hardware workarounds */ - if (version >=3D IPA_VERSION_4_0 && version < IPA_VERSION_4_5) { - /* Disable PA mask to allow HOLB drop */ - val =3D ioread32(ipa->reg_virt + IPA_REG_TX_CFG_OFFSET); - val &=3D ~PA_MASK_EN_FMASK; - iowrite32(val, ipa->reg_virt + IPA_REG_TX_CFG_OFFSET); - - /* Enable open global clocks in the CLKON configuration */ - val =3D GLOBAL_FMASK | GLOBAL_2X_CLK_FMASK; - } else if (version =3D=3D IPA_VERSION_3_1) { - val =3D MISC_FMASK; /* Disable MISC clock gating */ - } else { - val =3D 0; /* No CLKON configuration needed */ - } - if (val) - iowrite32(val, ipa->reg_virt + IPA_REG_CLKON_CFG_OFFSET); - + ipa_hardware_config_bcr(ipa, data); + ipa_hardware_config_tx(ipa); + ipa_hardware_config_clkon(ipa); ipa_hardware_config_comp(ipa); ipa_hardware_config_qsb(ipa, data); ipa_hardware_config_timing(ipa); --=20 2.34.1