summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorWolfgang Denk <wd@pollux.denx.de>2005-08-07 23:55:50 +0200
committerWolfgang Denk <wd@pollux.denx.de>2005-08-07 23:55:50 +0200
commitfe599e17ed8c9d5964d46d93b682d6af90b0b247 (patch)
treede5346127e8646e7f390363f3e2e0ccd3c80a3cb /common
parent7ebdb19b395cabb4b6425baeb7cff6d5a31e2844 (diff)
downloadu-boot-imx-fe599e17ed8c9d5964d46d93b682d6af90b0b247.zip
u-boot-imx-fe599e17ed8c9d5964d46d93b682d6af90b0b247.tar.gz
u-boot-imx-fe599e17ed8c9d5964d46d93b682d6af90b0b247.tar.bz2
Fix errors that occur when accessing SystemACE CF
Patch by Jeff Angielski, 09 Jan 2005
Diffstat (limited to 'common')
-rw-r--r--common/cmd_ace.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/common/cmd_ace.c b/common/cmd_ace.c
index c5b08bf..54fb918 100644
--- a/common/cmd_ace.c
+++ b/common/cmd_ace.c
@@ -31,6 +31,12 @@
* available to cmd_fat.c:get_dev and filling in a block device
* description that has all the bits needed for FAT support to
* read sectors.
+ *
+ * According to Xilinx technical support, before accessing the
+ * SystemACE CF you need to set the following control bits:
+ * FORCECFGMODE : 1
+ * CFGMODE : 0
+ * CFGSTART : 0
*/
# include <common.h>
@@ -95,7 +101,9 @@ static int get_cf_lock(void)
int retry = 10;
/* CONTROLREG = LOCKREG */
- ace_writew(0x0002, 0x18);
+ unsigned val=ace_readw(0x18);
+ val|=0x0002;
+ ace_writew((val&0xffff), 0x18);
/* Wait for MPULOCK in STATUSREG[15:0] */
while (! (ace_readw(0x04) & 0x0002)) {
@@ -112,8 +120,9 @@ static int get_cf_lock(void)
static void release_cf_lock(void)
{
- /* CONTROLREG = none */
- ace_writew(0x0000, 0x18);
+ unsigned val=ace_readw(0x18);
+ val&=~(0x0002);
+ ace_writew((val&0xffff), 0x18);
}
block_dev_desc_t * systemace_get_dev(int dev)
@@ -127,6 +136,9 @@ block_dev_desc_t * systemace_get_dev(int dev)
systemace_dev.blksz = 512;
systemace_dev.removable = 1;
systemace_dev.block_read = systemace_read;
+
+ init_part(&systemace_dev);
+
}
return &systemace_dev;
@@ -145,6 +157,7 @@ static unsigned long systemace_read(int dev,
int retry;
unsigned blk_countdown;
unsigned char*dp = (unsigned char*)buffer;
+ unsigned val;
if (get_cf_lock() < 0) {
unsigned status = ace_readw(0x04);
@@ -165,7 +178,7 @@ static unsigned long systemace_read(int dev,
retry = 2000;
for (;;) {
- unsigned val = ace_readw(0x04);
+ val = ace_readw(0x04);
/* If CFDETECT is false, card is missing. */
if (! (val & 0x0010)) {
@@ -212,6 +225,11 @@ static unsigned long systemace_read(int dev,
/* Write sector count | ReadMemCardData. */
ace_writew((trans&0xff) | 0x0300, 0x14);
+ /* Reset the configruation controller */
+ val = ace_readw(0x18);
+ val|=0x0080;
+ ace_writew(val, 0x18);
+
retry = trans * 16;
while (retry > 0) {
int idx;
@@ -231,6 +249,11 @@ static unsigned long systemace_read(int dev,
retry -= 1;
}
+ /* Clear the configruation controller reset */
+ val = ace_readw(0x18);
+ val&=~0x0080;
+ ace_writew(val, 0x18);
+
/* Count the blocks we transfer this time. */
start += trans;
blk_countdown -= trans;