Skip to contentSkip to conversation

Update SystemACE driver for 16bit access

PATCH New Stefan Roese 2 participants 3 messages Feb 20, 2007 – Feb 21, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Update SystemACE driver for 16bit access

This patch removes some problems when the Xilinx SystemACE driver is used with 16bit access on an big endian platform (like the AMCC Katmai).

---
commit d93e2212f962668b3dce091ff5edc33f2347fe37
tree 19b9b366ae1bdb33437370fa5dd009068c2039ec
parent 874bb7b88fe9b4648e1288a387af2e31014a72f3
author Stefan Roese <[email protected]> Tue, 20 Feb 2007 13:17:42 +0100 committer Stefan Roese <[email protected]> Tue, 20 Feb 2007 13:17:42 +0100

 drivers/systemace.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
drivers/systemace.c +11 -3
index 9502623..3bd2ea9 100644
@@ -66,8 +66,8 @@
                              writeb(val>>8, CFG_SYSTEMACE_BASE+off+1);}
 #endif
 #else
-#define ace_readw(off) (readw(CFG_SYSTEMACE_BASE+off))
-#define ace_writew(val, off) (writew(val, CFG_SYSTEMACE_BASE+off))
+#define ace_readw(off) (in16(CFG_SYSTEMACE_BASE+off))
+#define ace_writew(val, off) (out16(CFG_SYSTEMACE_BASE+off,val))
 #endif
 
 /* */
@@ -119,6 +119,14 @@ block_dev_desc_t *systemace_get_dev(int dev)
 		systemace_dev.removable = 1;
 		systemace_dev.block_read = systemace_read;
 
+#if (CFG_SYSTEMACE_WIDTH == 16)
+		/*
+		 * By default the SystemACE comes up in 8-bit mode.
+		 * Ensure that 16-bit mode gets enabled.
+		 */
+		ace_writew(0x0001, 0);
+#endif
+
 		init_part(&systemace_dev);
 
 	}
@@ -197,7 +205,7 @@ static unsigned long systemace_read(int dev, unsigned long start,
 #endif
 		/* Write LBA block address */
 		ace_writew((start >> 0) & 0xffff, 0x10);
-		ace_writew((start >> 16) & 0x00ff, 0x12);
+		ace_writew((start >> 16) & 0x0fff, 0x12);
 
 		/* NOTE: in the Write Sector count below, a count of 0
 		   causes a transfer of 256, so &0xff gives the right
#1 lore raw

PATCH 1/1 Update SystemACE driver for 16bit access

Quoted 33 lines · Stefan Roese

This patch removes some problems when the Xilinx SystemACE driver is used with 16bit access on an big endian platform (like the AMCC Katmai).

---
commit d93e2212f962668b3dce091ff5edc33f2347fe37
tree 19b9b366ae1bdb33437370fa5dd009068c2039ec
parent 874bb7b88fe9b4648e1288a387af2e31014a72f3
author Stefan Roese <[email protected]> Tue, 20 Feb 2007 13:17:42 +0100 committer Stefan Roese <[email protected]> Tue, 20 Feb 2007 13:17:42 +0100

 drivers/systemace.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
drivers/systemace.c +2 -2
index 9502623..3bd2ea9 100644
@@ -66,8 +66,8 @@
                              writeb(val>>8, CFG_SYSTEMACE_BASE+off+1);}
 #endif
 #else
-#define ace_readw(off) (readw(CFG_SYSTEMACE_BASE+off))
-#define ace_writew(val, off) (writew(val, CFG_SYSTEMACE_BASE+off))
+#define ace_readw(off) (in16(CFG_SYSTEMACE_BASE+off))
+#define ace_writew(val, off) (out16(CFG_SYSTEMACE_BASE+off,val))
 #endif
 
 /* */
@@ -119,6 +119,14 @@ block_dev_desc_t *systemace_get_dev(int dev)
                systemace_dev.removable = 1;

drivers/systemace.c block_dev_desc_t *systemace_get_dev(int dev) · line 129

Quoted 10 lines
drivers/systemace.c +8 -0
                systemace_dev.block_read = systemace_read;
 
+#if (CFG_SYSTEMACE_WIDTH == 16)
+               /*
+                * By default the SystemACE comes up in 8-bit mode.
+                * Ensure that 16-bit mode gets enabled.
+                */
+               ace_writew(0x0001, 0);
+#endif
+

I've got a similar patch in my tree; How about something like this instead:

ace_writew(CFG_SYSTEMACE_WIDTH == 8 ? 0 : 0x0001, 0);

That way it handles both conditions; 8 when it should be 16, and 16 when it should be 8

drivers/systemace.c static unsigned long systemace_read(int dev, unsigned long start, · line 208

Quoted 9 lines
drivers/systemace.c +1 -1
                init_part(&systemace_dev);
 
        }
@@ -197,7 +205,7 @@ static unsigned long systemace_read(int dev, unsigned long start,
 #endif
                /* Write LBA block address */
                ace_writew((start >> 0) & 0xffff, 0x10);
-               ace_writew((start >> 16) & 0x00ff, 0x12);
+               ace_writew((start >> 16) & 0x0fff, 0x12);

Good catch!

Cheers,
g.

Signature · 4 lines
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely at secretlab.ca
(403) 399-0195
#2 lore raw

PATCH 1/1 Update SystemACE driver for 16bit access

Quoted 16 lines · Grant Likely

drivers/systemace.c block_dev_desc_t *systemace_get_dev(int dev) · line 129

Quoted 12 lines
drivers/systemace.c +8 -0
@@ -119,6 +119,14 @@ block_dev_desc_t *systemace_get_dev(int dev)
                systemace_dev.removable = 1;
                systemace_dev.block_read = systemace_read;
 
+#if (CFG_SYSTEMACE_WIDTH == 16)
+               /*
+                * By default the SystemACE comes up in 8-bit mode.
+                * Ensure that 16-bit mode gets enabled.
+                */
+               ace_writew(0x0001, 0);
+#endif
+

I've got a similar patch in my tree; How about something like this instead:

Quoted 4 lines

ace_writew(CFG_SYSTEMACE_WIDTH == 8 ? 0 : 0x0001, 0);

That way it handles both conditions; 8 when it should be 16, and 16 when it should be 8

Even better. Will update my version.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
=====================================================================