[U-Boot-Users] "24.noflash":(1 of 1) [PATCH] Remove unneccessary code, if parallel flash is not available.

Ulf Samuelsson ulf at atmel.com
Tue Mar 27 20:10:02 CEST 2007


Author: Ulf Samuelsson <ulf at atmel.com>
Date:     2007-03-27

Subject:	"24.noflash":(1 of  1)     [PATCH] Remove unneccessary code, if parallel flash is not available.

CHANGELOG:
    [PATCH] Remove unneccessary code, if parallel flash is not available.
    Define CONFIG_NO_PARALLEL_FLASH if you do not have par flash on board

    Patch generated from files:
          common_cmd_flash.c.patch
          common_cmd_mem.c.patch

    Signed-off-by:	Ulf Samuelsson
---------------------------------------------------------------------------------------------------------------------------------
diff -urN u-boot-1.2.0/common/cmd_flash.c u-boot-1.2.0-atmel/common/cmd_flash.c
--- u-boot-1.2.0/common/cmd_flash.c	2007-01-07 00:13:11.000000000 +0100
+++ u-boot-1.2.0-atmel/common/cmd_flash.c	2007-03-24 20:07:32.000000000 +0100
@@ -43,6 +43,7 @@
 		u8 *part_num, struct part_info **part);
 #endif

+#ifndef CFG_NO_PARALLEL_FLASH
 extern flash_info_t flash_info[];	/* info for FLASH chips */

 /*
@@ -277,6 +278,7 @@

 	return rcode;
 }
+#endif /* CFG_NO_PARALLEL_FLASH */

 int do_flinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
@@ -285,7 +287,7 @@
 #ifdef CONFIG_HAS_DATAFLASH
 	dataflash_print_info();
 #endif
-
+#ifndef CFG_NO_PARALLEL_FLASH
 	if (argc == 1) {	/* print info for all FLASH banks */
 		for (bank=0; bank <CFG_MAX_FLASH_BANKS; ++bank) {
 			printf ("\nBank # %ld: ", bank+1);
@@ -303,11 +305,13 @@
 	}
 	printf ("\nBank # %ld: ", bank);
 	flash_print_info (&flash_info[bank-1]);
+#endif /* CFG_NO_PARALLEL_FLASH */	
 	return 0;
 }

 int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
+#ifndef CFG_NO_PARALLEL_FLASH
 	flash_info_t *info;
 	ulong bank, addr_first, addr_last;
 	int n, sect_first, sect_last;
@@ -399,8 +403,13 @@

 	rcode = flash_sect_erase(addr_first, addr_last);
 	return rcode;
+#else
+	return 0;
+#endif /* CFG_NO_PARALLEL_FLASH */
+	
 }

+#ifndef CFG_NO_PARALLEL_FLASH
 int flash_sect_erase (ulong addr_first, ulong addr_last)
 {
 	flash_info_t *info;
@@ -441,12 +450,19 @@
 	}
 	return rcode;
 }
+#endif /* CFG_NO_PARALLEL_FLASH */

 int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
+#ifndef CFG_NO_PARALLEL_FLASH
 	flash_info_t *info;
 	ulong bank, addr_first, addr_last;
-	int i, p, n, sect_first, sect_last;
+	int i, p, n, sect_first, sect_last;	
+#else
+	ulong addr_first, addr_last;
+	int p;
+#endif
+
 #if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
 	struct mtd_device *dev;
 	struct part_info *part;
@@ -488,7 +504,7 @@
 		}
 	}
 #endif
-
+#ifndef CFG_NO_PARALLEL_FLASH
 	if (strcmp(argv[2], "all") == 0) {
 		for (bank=1; bank<=CFG_MAX_FLASH_BANKS; ++bank) {
 			info = &flash_info[bank-1];
@@ -613,10 +629,11 @@
 		return 1;
 	}
 	rcode = flash_sect_protect (p, addr_first, addr_last);
+#endif /* CFG_NO_PARALLEL_FLASH */
 	return rcode;
 }

-
+#ifndef CFG_NO_PARALLEL_FLASH
 int flash_sect_protect (int p, ulong addr_first, ulong addr_last)
 {
 	flash_info_t *info;
@@ -669,7 +686,7 @@
 	}
 	return rcode;
 }
-
+#endif /* CFG_NO_PARALLEL_FLASH */

 /**************************************************/
 #if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
diff -urN u-boot-1.2.0/common/cmd_mem.c u-boot-1.2.0-atmel/common/cmd_mem.c
--- u-boot-1.2.0/common/cmd_mem.c	2007-01-07 00:13:11.000000000 +0100
+++ u-boot-1.2.0-atmel/common/cmd_mem.c	2007-03-24 20:07:32.000000000 +0100
@@ -498,7 +498,11 @@
 	}

 	/* Check if we are copying from DataFlash to RAM */
-	if (addr_dataflash(addr) && !addr_dataflash(dest) && (addr2info(dest)==NULL) ){
+	if (addr_dataflash(addr) && !addr_dataflash(dest)
+#ifndef CFG_NO_PARALLEL_FLASH
+	&& (addr2info(dest)==NULL)
+#endif
+	){
 		int rc;
 		rc = read_dataflash(addr, count * size, (char *) dest);
 		if (rc != 1) {

-- 
Best Regards,
Ulf Samuelsson

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ulf.vcf
Type: text/x-vcard
Size: 301 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20070327/1bf03fbc/attachment.vcf 


More information about the U-Boot mailing list