]> git.baikalelectronics.ru Git - kernel.git/commit
net: ipa: fix resource group field mask definition
authorAlex Elder <elder@linaro.org>
Wed, 28 Oct 2020 19:41:45 +0000 (14:41 -0500)
committerJakub Kicinski <kuba@kernel.org>
Sat, 31 Oct 2020 00:20:03 +0000 (17:20 -0700)
commitd773f404c833b7c88b6e85e55d484081736666db
tree7ae93330975c0597a2de88bf381422e504464a46
parent279dc955745a6800911404fe375686626aa7fed3
net: ipa: fix resource group field mask definition

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.

Tested-by: Sujit Kautkar <sujitka@chromium.org>
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ipa/ipa_reg.h