[U-Boot-Users] [PATCH] MIPS: Fix CFG_NO_FLASH support

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Sun Feb 17 16:58:04 CET 2008


- Fix flash_init call when CFG_NO_FLASH is used
- Remove no more needed flash.c for qemu-mips

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>

diff --git a/board/qemu-mips/Makefile b/board/qemu-mips/Makefile
index 23be447..837b6b9 100644
--- a/board/qemu-mips/Makefile
+++ b/board/qemu-mips/Makefile
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).a
 
-COBJS	= $(BOARD).o flash.o
+COBJS	= $(BOARD).o
 SOBJS	= lowlevel_init.o
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
diff --git a/board/qemu-mips/flash.c b/board/qemu-mips/flash.c
deleted file mode 100644
index e988272..0000000
--- a/board/qemu-mips/flash.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * (C) Copyright 2003
- * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-/*-----------------------------------------------------------------------
- * flash_init()
- *
- * sets up flash_info and returns size of FLASH (bytes)
- */
-unsigned long flash_init(void)
-{
-	printf("Skipping flash_init\n");
-	return(0);
-}
-
-int write_buff(void *info, uchar *src, ulong addr, ulong cnt)
-{
-	printf("write_buff not implemented\n");
-	return(-1);
-}
diff --git a/lib_mips/board.c b/lib_mips/board.c
index c1a0acf..1645f2c 100644
--- a/lib_mips/board.c
+++ b/lib_mips/board.c
@@ -121,12 +121,13 @@ static int display_banner(void)
 	return (0);
 }
 
+#ifndef CFG_NO_FLASH
 static void display_flash_config(ulong size)
 {
 	puts ("Flash: ");
 	print_size (size, "\n");
 }
-
+#endif
 
 static int init_baudrate (void)
 {
@@ -247,7 +248,7 @@ void board_init_f(ulong bootflag)
 	debug ("Reserving %d Bytes for Global Data at: %08lx\n",
 			sizeof (gd_t), addr_sp);
 
- 	/* Reserve memory for boot params.
+	/* Reserve memory for boot params.
 	 */
 	addr_sp -= CFG_BOOTPARAMS_LEN;
 	bd->bi_boot_params = addr_sp;
@@ -301,7 +302,9 @@ void board_init_f(ulong bootflag)
 void board_init_r (gd_t *id, ulong dest_addr)
 {
 	cmd_tbl_t *cmdtp;
+#ifndef CFG_NO_FLASH
 	ulong size;
+#endif
 	extern void malloc_bin_reloc (void);
 #ifndef CFG_ENV_IS_NOWHERE
 	extern char * env_name_spec;
@@ -322,7 +325,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	/*
 	 * We have to relocate the command table manually
 	 */
- 	for (cmdtp = &__u_boot_cmd_start; cmdtp !=  &__u_boot_cmd_end; cmdtp++) {
+	for (cmdtp = &__u_boot_cmd_start; cmdtp !=  &__u_boot_cmd_end; cmdtp++) {
 		ulong addr;
 
 		addr = (ulong) (cmdtp->cmd) + gd->reloc_off;
@@ -352,13 +355,16 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	env_name_spec += gd->reloc_off;
 #endif
 
+	bd = gd->bd;
+
+#ifndef CFG_NO_FLASH
 	/* configure available FLASH banks */
 	size = flash_init();
 	display_flash_config (size);
+	bd->bi_flashsize = size;
+#endif
 
-	bd = gd->bd;
 	bd->bi_flashstart = CFG_FLASH_BASE;
-	bd->bi_flashsize = size;
 #if CFG_MONITOR_BASE == CFG_FLASH_BASE
 	bd->bi_flashoffset = monitor_flash_len;	/* reserved area for U-Boot */
 #else
-- 
1.5.4.1





More information about the U-Boot mailing list