From a5bbcc3c53a7fb541f812d25d576c35f097438ba Mon Sep 17 00:00:00 2001
From: wdenk <wdenk>
Date: Wed, 29 Sep 2004 22:55:14 +0000
Subject: [PATCH] * Patches by Sean Chang, 09 Aug 2004:   - Added support for
 both 8 and 16 bit mode access to System ACE CF     through MPU.   - Fixed
 missing System ACE CF device during get FAT partition info     in
 fat_register_device function.   - Enabled System ACE CF support on ML300.

* Patch by Sean Chang, 09 Aug 2004:
  Synch defines for saveenv and do_saveenv functions so they get
  compiled under the same statement.
---
 CHANGELOG               | 15 +++++++++++++--
 common/cmd_ace.c        | 27 +++++++++++++++++++++++++--
 common/cmd_nvedit.c     |  5 +++--
 fs/fat/fat.c            |  2 +-
 include/configs/ml300.h |  5 +++++
 5 files changed, 47 insertions(+), 7 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 788ea84b220..82b473f6868 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,7 +2,18 @@
 Changes since U-Boot 1.1.1:
 ======================================================================
 
-* Patch by Sean Chang, 9 Aug 2004:
+* Patches by Sean Chang, 09 Aug 2004:
+  - Added support for both 8 and 16 bit mode access to System ACE CF
+    through MPU.
+  - Fixed missing System ACE CF device during get FAT partition info
+    in fat_register_device function.
+  - Enabled System ACE CF support on ML300.
+
+* Patch by Sean Chang, 09 Aug 2004:
+  Synch defines for saveenv and do_saveenv functions so they get
+  compiled under the same statement.
+
+* Patch by Sean Chang, 09 Aug 2004:
   - Added I2C support for ML300.
   - Added support for ML300 to read out its environment information
     stored on the EEPROM.
@@ -11,7 +22,7 @@ Changes since U-Boot 1.1.1:
   - Updated MLD files to support configuration for new features
     above.
 
-* Patches by Travis Sawyer, 5 Aug 2004:
+* Patches by Travis Sawyer, 05 Aug 2004:
   - Remove incorrect bridge settings for eth group 6
   - Add call to setup bridge in ppc_440x_eth_initialize
   - Fix ppc_440x_eth_init to reset the phy only if its the
diff --git a/common/cmd_ace.c b/common/cmd_ace.c
index 4969811f3b2..c5b08bf772e 100644
--- a/common/cmd_ace.c
+++ b/common/cmd_ace.c
@@ -50,12 +50,35 @@
  */
 static unsigned ace_readw(unsigned offset)
 {
-      return readw(CFG_SYSTEMACE_BASE+offset);
+#if (CFG_SYSTEMACE_WIDTH == 8)
+  u16 temp;
+
+#if !defined(__BIG_ENDIAN)
+  temp =((u16)readb(CFG_SYSTEMACE_BASE+offset) << 8);
+  temp |= (u16)readb(CFG_SYSTEMACE_BASE+offset+1);
+#else
+  temp = (u16)readb(CFG_SYSTEMACE_BASE+offset);
+  temp |=((u16)readb(CFG_SYSTEMACE_BASE+offset+1) << 8);
+#endif
+  return temp;
+#else
+  return readw(CFG_SYSTEMACE_BASE+offset);
+#endif
 }
 
 static void ace_writew(unsigned val, unsigned offset)
 {
-      writew(val, CFG_SYSTEMACE_BASE+offset);
+#if (CFG_SYSTEMACE_WIDTH == 8)
+#if !defined(__BIG_ENDIAN)
+  writeb((u8)(val>>8), CFG_SYSTEMACE_BASE+offset);
+  writeb((u8)val, CFG_SYSTEMACE_BASE+offset+1);
+#else
+  writeb((u8)val, CFG_SYSTEMACE_BASE+offset);
+  writeb((u8)(val>>8), CFG_SYSTEMACE_BASE+offset+1);
+#endif
+#else
+  writew(val, CFG_SYSTEMACE_BASE+offset);
+#endif
 }
 
 /* */
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 3510561428a..578b0ca9360 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -586,8 +586,9 @@ U_BOOT_CMD(
 	"    - delete environment variable 'name'\n"
 );
 
-#if ((CONFIG_COMMANDS & (CFG_CMD_ENV|CFG_CMD_FLASH)) == (CFG_CMD_ENV|CFG_CMD_FLASH))
-
+#if defined(CFG_ENV_IS_IN_NVRAM) || defined(CFG_ENV_IS_IN_EEPROM) || \
+    ((CONFIG_COMMANDS & (CFG_CMD_ENV|CFG_CMD_FLASH)) == \
+      (CFG_CMD_ENV|CFG_CMD_FLASH))
 U_BOOT_CMD(
 	saveenv, 1, 0,	do_saveenv,
 	"saveenv - save environment variables to persistent storage\n",
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 6025ad5c303..9c13825dd3f 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -90,7 +90,7 @@ fat_register_device(block_dev_desc_t *dev_desc, int part_no)
 	}
 	else {
 #if (CONFIG_COMMANDS & CFG_CMD_IDE) || (CONFIG_COMMANDS & CFG_CMD_SCSI) || \
-    (CONFIG_COMMANDS & CFG_CMD_USB)
+    (CONFIG_COMMANDS & CFG_CMD_USB) || defined(CONFIG_SYSTEMACE)
 		disk_partition_t info;
 		if(!get_partition_info(dev_desc, part_no, &info)) {
 			part_offset = info.start;
diff --git a/include/configs/ml300.h b/include/configs/ml300.h
index bcd5c17c5b3..d36e3c725a6 100644
--- a/include/configs/ml300.h
+++ b/include/configs/ml300.h
@@ -56,6 +56,11 @@
 #define CONFIG_4xx		1	/* ...member of PPC4xx family	*/
 #define CONFIG_XILINX_ML300	1	/* ...on a Xilinx ML300 board	*/
 
+#define CONFIG_SYSTEMACE	1
+#define CONFIG_DOS_PARTITION	1
+#define CFG_SYSTEMACE_BASE	XPAR_SYSACE_0_BASEADDR
+#define CFG_SYSTEMACE_WIDTH	XPAR_XSYSACE_MEM_WIDTH
+
 #define CFG_ENV_IS_IN_EEPROM	1	/* environment is in EEPROM */
 
 /* following are used only if env is in EEPROM */
-- 
GitLab