linux-mips
[Top] [All Lists]

[PATCH] Support 8-bit and 16-bit PCI ops on TX4927 in BE

To: linux-mips@linux-mips.org
Subject: [PATCH] Support 8-bit and 16-bit PCI ops on TX4927 in BE
From: Manish Lachwani <mlachwani@mvista.com>
Date: Sat, 22 Jan 2005 09:57:35 -0800
Cc: ralf@linux-mips.org
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.4.1i
Hi Ralf,

Attached patch supports 8-bit and 16-bit PCI operations on TX4927 in big endian 
mode. Please review and/or apply

Thanks
Manish Lachwani
Source: MontaVista Software, Inc. | URL | Manish Lachwani <mlachwani@mvista.com>
MR: 9909
Type: Defect Fix
Disposition: Submitted to linux-mips.org
Keywords:
Signed-off-by: Manish Lachwani <mlachwani@mvista.com>
Description:
        Support for BE mode on Tx4927 based board

Index: linux-2.6.10/arch/mips/pci/ops-tx4927.c
===================================================================
--- linux-2.6.10.orig/arch/mips/pci/ops-tx4927.c
+++ linux-2.6.10/arch/mips/pci/ops-tx4927.c
@@ -130,11 +130,21 @@
        switch (size) {
        case 1:
                *val = *(volatile u8 *) ((ulong) & tx4927_pcicptr->
-                              g2pcfgdata | (where & 3));
+                              g2pcfgdata | 
+#ifdef __LITTLE_ENDIAN
+                                               (where & 3));
+#else
+                                               ((where & 0x3) ^ 0x3));
+#endif
                break;
        case 2:
                *val = *(volatile u16 *) ((ulong) & tx4927_pcicptr->
-                               g2pcfgdata | (where & 3));
+                               g2pcfgdata | 
+#ifdef __LITTLE_ENDIAN
+                                               (where & 3));
+#else
+                                               ((where & 0x3) ^ 0x2));
+#endif
                break;
        case 4:
                *val = tx4927_pcicptr->g2pcfgdata;
@@ -179,12 +189,22 @@
        switch (size) {
        case 1:
                 *(volatile u8 *) ((ulong) & tx4927_pcicptr->
-                          g2pcfgdata | (where & 3)) = val;
+                          g2pcfgdata | 
+#ifdef __LITTLE_ENDIAN
+                                       (where & 3)) = val;
+#else
+                                       ((where & 0x3) ^ 0x3)) = val;
+#endif
                break;
 
        case 2:
                *(volatile u16 *) ((ulong) & tx4927_pcicptr->
-                           g2pcfgdata | (where & 3)) = val;
+                           g2pcfgdata | 
+#ifdef __LITTLE_ENDIAN
+                                       (where & 3)) = val;
+#else
+                                       ((where & 0x3) ^ 0x2)) = val;
+#endif
                break;
        case 4:
                tx4927_pcicptr->g2pcfgdata = val;
<Prev in Thread] Current Thread [Next in Thread>