ioatdma: Add 64bit chansts register read for ioat v3.3.
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / dma / ioat / dma.h
index 95ae7b3139ec5ebfdc2c4dc5bc7ed43388610810..9285caadf82542bb957c31131ec0599d8ef1276d 100644 (file)
@@ -201,7 +201,7 @@ ioat_chan_by_index(struct ioatdma_device *device, int index)
        return device->idx[index];
 }
 
-static inline u64 ioat_chansts(struct ioat_chan_common *chan)
+static inline u64 ioat_chansts_32(struct ioat_chan_common *chan)
 {
        u8 ver = chan->device->version;
        u64 status;
@@ -218,6 +218,26 @@ static inline u64 ioat_chansts(struct ioat_chan_common *chan)
        return status;
 }
 
+#if BITS_PER_LONG == 64
+
+static inline u64 ioat_chansts(struct ioat_chan_common *chan)
+{
+       u8 ver = chan->device->version;
+       u64 status;
+
+        /* With IOAT v3.3 the status register is 64bit.  */
+       if (ver >= IOAT_VER_3_3)
+               status = readq(chan->reg_base + IOAT_CHANSTS_OFFSET(ver));
+       else
+               status = ioat_chansts_32(chan);
+
+       return status;
+}
+
+#else
+#define ioat_chansts ioat_chansts_32
+#endif
+
 static inline void ioat_start(struct ioat_chan_common *chan)
 {
        u8 ver = chan->device->version;