linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Philipp Hortmann <philipp.g.hortmann@gmail.com>
To: Forest Bond <forest@alittletooquiet.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	David Laight <David.Laight@ACULAB.COM>
Subject: [PATCH v5 2/2] staging: vt6655: Added missing BE support in CARDbGetCurrentTSF
Date: Sun, 1 May 2022 21:12:29 +0200	[thread overview]
Message-ID: <25c80e3eb889ef2e530f26b4a97a9f5fe88e01ab.1651431640.git.philipp.g.hortmann@gmail.com> (raw)
In-Reply-To: <cover.1651431640.git.philipp.g.hortmann@gmail.com>

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


      parent reply	other threads:[~2022-05-01 19:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-01 19:12 [PATCH v5 0/2] staging: vt6655: Replace macro VNSvInPortD with ioread32() Philipp Hortmann
2022-05-01 19:12 ` [PATCH v5 1/2] staging: vt6655: Replace VNSvInPortD with ioread32 Philipp Hortmann
2022-05-01 19:12 ` Philipp Hortmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=25c80e3eb889ef2e530f26b4a97a9f5fe88e01ab.1651431640.git.philipp.g.hortmann@gmail.com \
    --to=philipp.g.hortmann@gmail.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=forest@alittletooquiet.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).