Skip to contentSkip to conversation

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

U-Boot-Users NAK Ulf Samuelsson 2 participants 2 messages Mar 27, 2007

lore
Share & tools
lore
#0 lore raw

Author: Ulf Samuelsson <[email protected]>
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.

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

Signed-off-by: Ulf Samuelsson
---------------------------------------------------------------------------------------------------------------------------------

common/cmd_flash.c +22 -5
diff -urN u-boot-1.2.0/common/cmd_flash.c u-boot-1.2.0-atmel/common/cmd_flash.c
@@ -43,6 +43,7 @@
 		u8 *part_num, struct part_info **part);
 #endif
 
+#ifndef CFG_NO_FLASH
 extern flash_info_t flash_info[];	/* info for FLASH chips */
 
 /*
@@ -277,6 +278,7 @@
 
 	return rcode;
 }
+#endif /* CFG_NO_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_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_FLASH */	
 	return 0;
 }
 
 int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
+#ifndef CFG_NO_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_FLASH */
+	
 }
 
+#ifndef CFG_NO_FLASH
 int flash_sect_erase (ulong addr_first, ulong addr_last)
 {
 	flash_info_t *info;
@@ -441,12 +450,19 @@
 	}
 	return rcode;
 }
+#endif /* CFG_NO_FLASH */
 
 int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
+#ifndef CFG_NO_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_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_FLASH */
 	return rcode;
 }
 
-
+#ifndef CFG_NO_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_FLASH */
 
 /**************************************************/
 #if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
common/cmd_mem.c +5 -1
diff -urN u-boot-1.2.0/common/cmd_mem.c u-boot-1.2.0-atmel/common/cmd_mem.c
@@ -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_FLASH
+	&& (addr2info(dest)==NULL)
+#endif
+	){
 		int rc;
 		rc = read_dataflash(addr, count * size, (char *) dest);
 		if (rc != 1) {
Signature · 9 lines
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/e0ce7139/attachment.vcf 
#1 lore raw
Quoted 6 lines · In message <[email protected]> you wrote:

[PATCH] Remove unneccessary code, if parallel flash is not available.

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

I don't understand the rationale behind this patch. If CFG_NO_FLASH is defined, that means that there is no flash on the board, and it makes no sense to enable CFG_CMD_FLASH. Why compile a whole set of empty commands?

NAK.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office:  Kirchenstr. 5,       D-82194 Groebenzell,            Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Schshschshchsch.
	-- The Gorn, "Arena", stardate 3046.2