aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vme
diff options
context:
space:
mode:
authorMartyn Welch <martyn.welch@ge.com>2014-02-07 10:48:56 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-07 11:16:14 -0500
commitf0342e66b397947ed8c3eef8c37b5ca2d5b1bb50 (patch)
tree7e3fbaaa0596dd9379db16957b5638ba2763dc33 /drivers/vme
parent5cb906c7035f03a3a44fecece9d3ff8fcc75d6e0 (diff)
VME: Correct read/write alignment algorithm
In order to ensure the correct width cycles on the VME bus, the VME bridge drivers implement an algorithm to utilise the largest possible width reads and writes whilst maintaining natural alignment constraints. The algorithm currently looks at the start address rather than the current read/write address when determining whether a 16-bit width cycle is required to get to 32-bit alignment. This results in incorrect alignment, Reported-by: Jim Strouth <james.strouth@ge.com> Tested-by: Jim Strouth <james.strouth@ge.com> Signed-off-by: Martyn Welch <martyn.welch@ge.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/vme')
-rw-r--r--drivers/vme/bridges/vme_ca91cx42.c4
-rw-r--r--drivers/vme/bridges/vme_tsi148.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/vme/bridges/vme_ca91cx42.c b/drivers/vme/bridges/vme_ca91cx42.c
index a06edbfa95ca..1b5d48c578e1 100644
--- a/drivers/vme/bridges/vme_ca91cx42.c
+++ b/drivers/vme/bridges/vme_ca91cx42.c
@@ -884,7 +884,7 @@ static ssize_t ca91cx42_master_read(struct vme_master_resource *image,
884 if (done == count) 884 if (done == count)
885 goto out; 885 goto out;
886 } 886 }
887 if ((uintptr_t)addr & 0x2) { 887 if ((uintptr_t)(addr + done) & 0x2) {
888 if ((count - done) < 2) { 888 if ((count - done) < 2) {
889 *(u8 *)(buf + done) = ioread8(addr + done); 889 *(u8 *)(buf + done) = ioread8(addr + done);
890 done += 1; 890 done += 1;
@@ -938,7 +938,7 @@ static ssize_t ca91cx42_master_write(struct vme_master_resource *image,
938 if (done == count) 938 if (done == count)
939 goto out; 939 goto out;
940 } 940 }
941 if ((uintptr_t)addr & 0x2) { 941 if ((uintptr_t)(addr + done) & 0x2) {
942 if ((count - done) < 2) { 942 if ((count - done) < 2) {
943 iowrite8(*(u8 *)(buf + done), addr + done); 943 iowrite8(*(u8 *)(buf + done), addr + done);
944 done += 1; 944 done += 1;
diff --git a/drivers/vme/bridges/vme_tsi148.c b/drivers/vme/bridges/vme_tsi148.c
index 16830d8b777c..9911cd5fddb5 100644
--- a/drivers/vme/bridges/vme_tsi148.c
+++ b/drivers/vme/bridges/vme_tsi148.c
@@ -1289,7 +1289,7 @@ static ssize_t tsi148_master_read(struct vme_master_resource *image, void *buf,
1289 if (done == count) 1289 if (done == count)
1290 goto out; 1290 goto out;
1291 } 1291 }
1292 if ((uintptr_t)addr & 0x2) { 1292 if ((uintptr_t)(addr + done) & 0x2) {
1293 if ((count - done) < 2) { 1293 if ((count - done) < 2) {
1294 *(u8 *)(buf + done) = ioread8(addr + done); 1294 *(u8 *)(buf + done) = ioread8(addr + done);
1295 done += 1; 1295 done += 1;
@@ -1371,7 +1371,7 @@ static ssize_t tsi148_master_write(struct vme_master_resource *image, void *buf,
1371 if (done == count) 1371 if (done == count)
1372 goto out; 1372 goto out;
1373 } 1373 }
1374 if ((uintptr_t)addr & 0x2) { 1374 if ((uintptr_t)(addr + done) & 0x2) {
1375 if ((count - done) < 2) { 1375 if ((count - done) < 2) {
1376 iowrite8(*(u8 *)(buf + done), addr + done); 1376 iowrite8(*(u8 *)(buf + done), addr + done);
1377 done += 1; 1377 done += 1;