lkml.org 
[lkml]   [2020]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.9 160/757] crypto: sun8i-ce - handle endianness of t_common_ctl
    Date
    From: Corentin Labbe <clabbe@baylibre.com>

    [ Upstream commit 87f34260f5e09a4578132ad1c05aef2d707dd4bf ]

    t_common_ctl is LE32 so we need to convert its value before using it.
    This value is only used on H6 (ignored on other SoCs) and not handling
    the endianness cause failure on xRNG/hashes operations on H6 when running BE.

    Fixes: 06f751b61329 ("crypto: allwinner - Add sun8i-ce Crypto Engine")
    Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c | 5 ++++-
    1 file changed, 4 insertions(+), 1 deletion(-)

    diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
    index 138759dc8190e..08ed1ca12baf9 100644
    --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
    +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
    @@ -120,7 +120,10 @@ int sun8i_ce_run_task(struct sun8i_ce_dev *ce, int flow, const char *name)
    /* Be sure all data is written before enabling the task */
    wmb();

    - v = 1 | (ce->chanlist[flow].tl->t_common_ctl & 0x7F) << 8;
    + /* Only H6 needs to write a part of t_common_ctl along with "1", but since it is ignored
    + * on older SoCs, we have no reason to complicate things.
    + */
    + v = 1 | ((le32_to_cpu(ce->chanlist[flow].tl->t_common_ctl) & 0x7F) << 8);
    writel(v, ce->base + CE_TLR);
    mutex_unlock(&ce->mlock);

    --
    2.25.1


    \
     
     \ /
      Last update: 2020-10-27 16:29    [W:4.054 / U:0.044 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site