lkml.org 
[lkml]   [2022]   [May]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH v5 2/2] staging: vt6655: Added missing BE support in CARDbGetCurrentTSF
    Added missing big-endian support in CARDbGetCurrentTSF.

    Reported-by: David Laight <David.Laight@ACULAB.COM>
    Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
    ---
    V1 -> V2: Replaced #ifdef __BIG_ENDIAN with le64_to_cpu()
    Updated below example

    Code for testing:
    low = ioread32(iobase + MAC_REG_TSFCNTR);
    high = ioread32(iobase + MAC_REG_TSFCNTR + 4);
    *pqwCurrTSF = le64_to_cpu(low + ((u64)high << 32));
    dev_info(&priv->pcid->dev, "CARDbGetCurrentTSF little endian: 0x%016llx", *pqwCurrTSF);
    dev_info(&priv->pcid->dev, "CARDbGetCurrentTSF big-endian: 0x%016llx", be64_to_cpu(low + ((u64)high << 32)));

    Log of the microsecond counter:
    vt6655 0000:01:05.0: CARDbGetCurrentTSF little endian: 0x00 00 00 03 6a ce 0d 7d
    vt6655 0000:01:05.0: CARDbGetCurrentTSF big-endian: 0x7d 0d ce 6a 03 00 00 00
    vt6655 0000:01:05.0: CARDbGetCurrentTSF little endian: 0x00 00 00 03 6a ce 0d 89
    vt6655 0000:01:05.0: CARDbGetCurrentTSF big-endian: 0x89 0d ce 6a 03 00 00 00
    ---
    drivers/staging/vt6655/card.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
    index 0dd13e475d6b..431890e6b8d2 100644
    --- a/drivers/staging/vt6655/card.c
    +++ b/drivers/staging/vt6655/card.c
    @@ -756,7 +756,7 @@ bool CARDbGetCurrentTSF(struct vnt_private *priv, u64 *pqwCurrTSF)
    return false;
    low = ioread32(iobase + MAC_REG_TSFCNTR);
    high = ioread32(iobase + MAC_REG_TSFCNTR + 4);
    - *pqwCurrTSF = low + ((u64)high << 32);
    + *pqwCurrTSF = le64_to_cpu(low + ((u64)high << 32));

    return true;
    }
    --
    2.25.1
    \
     
     \ /
      Last update: 2022-05-01 21:13    [W:2.355 / U:0.116 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site