[PATCH v4 2/2] staging: vt6655: Added missing BE support in CARDbGetCurrentTSF

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Added missing big-endian support in CARDbGetCurrentTSF.

Reported-by: David Laight <David.Laight@xxxxxxxxxx>
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@xxxxxxxxx>
---
Using ioread32be to simulate output of the big endian computer.

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

	low = ioread32be(iobase + MAC_REG_TSFCNTR);
	high = ioread32be(iobase + MAC_REG_TSFCNTR + 4);
	dev_info(&priv->pcid->dev, "CARDbGetCurrentTSF big-endian:    0x%016llx", high + ((u64)low << 32));

Log from testing:
vt6655 0000:01:05.0: CARDbGetCurrentTSF little endian: 0x00 00 00 0e 15 94 3d 7d
vt6655 0000:01:05.0: CARDbGetCurrentTSF big-endian:    0x7d 3d 94 15 0e 00 00 00
vt6655 0000:01:05.0: CARDbGetCurrentTSF little endian: 0x00 00 00 0e 15 94 3d 8b
vt6655 0000:01:05.0: CARDbGetCurrentTSF big-endian:    0x8b 3d 94 15 0e 00 00 00

Taking BE into account both methods generate the same output. 64 Bit numbers are supported.

Code for testing 2:
'#ifdef __BIG_ENDIAN
	*pqwCurrTSF = high + ((u64)low << 32);
'#else
	*pqwCurrTSF = low + ((u64)high << 32);
'#endif
	dev_info(&priv->pcid->dev, "CARDbGetCurrentTSF *pqwCurrTSF from VNSvInPortD: 0x%016llx", *pqwCurrTSF);

Log from testing 2:
[ 3502.410835] vt6655 0000:01:05.0: CARDbGetCurrentTSF *pqwCurrTSF from VNSvInPortD: 0x00 00 00 0e 2a fb ed 86
---
 drivers/staging/vt6655/card.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index 0dd13e475d6b..ec6fd185d3fd 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -756,7 +756,11 @@ bool CARDbGetCurrentTSF(struct vnt_private *priv, u64 *pqwCurrTSF)
 		return false;
 	low = ioread32(iobase + MAC_REG_TSFCNTR);
 	high = ioread32(iobase + MAC_REG_TSFCNTR + 4);
+#ifdef __BIG_ENDIAN
+	*pqwCurrTSF = high + ((u64)low << 32);
+#else
 	*pqwCurrTSF = low + ((u64)high << 32);
+#endif
 
 	return true;
 }
-- 
2.25.1





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux