summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2008-09-12 16:14:28 +0200
committerWolfgang Denk <wd@denx.de>2008-09-12 16:14:28 +0200
commit225f0eaa745adfae05931848543d99942798756a (patch)
treef5c2b1a7ddb5f2c64063b5ef3ccae0f5ded41fb8 /common
parent6b8be3e58e9cc1badb7a709b0f3568d4d8eca4b7 (diff)
parentafbc526336447a7357e9c82852df0377d09a8089 (diff)
downloadu-boot-imx-225f0eaa745adfae05931848543d99942798756a.zip
u-boot-imx-225f0eaa745adfae05931848543d99942798756a.tar.gz
u-boot-imx-225f0eaa745adfae05931848543d99942798756a.tar.bz2
Merge branch 'master' of /home/wd/git/u-boot/custodians
Diffstat (limited to 'common')
-rw-r--r--common/Makefile41
-rw-r--r--common/cmd_bdinfo.c2
-rw-r--r--common/cmd_eeprom.c6
-rw-r--r--common/cmd_fdc.c12
-rw-r--r--common/cmd_i2c.c1
-rw-r--r--common/cmd_itest.c2
-rw-r--r--common/cmd_mac.c3
-rw-r--r--common/cmd_mem.c33
-rw-r--r--common/cmd_nvedit.c30
-rw-r--r--common/cmd_pci.c2
-rw-r--r--common/cmd_portio.c2
-rw-r--r--common/cmd_vfd.c2
-rw-r--r--common/command.c24
-rw-r--r--common/env_common.c8
-rw-r--r--common/env_dataflash.c19
-rw-r--r--common/env_eeprom.c19
-rw-r--r--common/env_embedded.c (renamed from common/environment.c)6
-rw-r--r--common/env_flash.c89
-rw-r--r--common/env_nand.c85
-rw-r--r--common/env_nowhere.c5
-rw-r--r--common/env_nvram.c29
-rw-r--r--common/env_onenand.c11
-rw-r--r--common/env_sf.c39
23 files changed, 197 insertions, 273 deletions
diff --git a/common/Makefile b/common/Makefile
index 8d4a426..8bddf8e 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -42,17 +42,22 @@ COBJS-y += s_record.o
COBJS-y += serial.o
COBJS-y += xyzModem.o
+#core command
+COBJS-y += cmd_boot.o
+COBJS-y += cmd_bootm.o
+COBJS-y += cmd_nvedit.o
+
# environment
-COBJS-y += environment.o
COBJS-y += env_common.o
-COBJS-y += env_dataflash.o
-COBJS-y += env_eeprom.o
-COBJS-y += env_flash.o
-COBJS-y += env_nand.o
-COBJS-y += env_nvram.o
-COBJS-y += env_onenand.o
-COBJS-y += env_sf.o
-COBJS-y += env_nowhere.o
+COBJS-$(CONFIG_ENV_IS_IN_DATAFLASH) += env_dataflash.o
+COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_eeprom.o
+COBJS-y += env_embedded.o
+COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
+COBJS-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
+COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_nvram.o
+COBJS-$(CONFIG_ENV_IS_IN_ONENAND) += env_onenand.o
+COBJS-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_sf.o
+COBJS-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
# command
COBJS-$(CONFIG_CMD_AMBAPP) += cmd_ambapp.o
@@ -61,9 +66,7 @@ COBJS-$(CONFIG_CMD_AUTOSCRIPT) += cmd_autoscript.o
COBJS-$(CONFIG_CMD_BDI) += cmd_bdinfo.o
COBJS-$(CONFIG_CMD_BEDBUG) += bedbug.o cmd_bedbug.o
COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o
-COBJS-y += cmd_boot.o
COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o
-COBJS-y += cmd_bootm.o
COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o
COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o
COBJS-$(CONFIG_CMD_CPLBINFO) += cmd_cplbinfo.o
@@ -77,11 +80,12 @@ endif
COBJS-$(CONFIG_CMD_DISPLAY) += cmd_display.o
COBJS-$(CONFIG_CMD_DOC) += cmd_doc.o
COBJS-$(CONFIG_CMD_DTT) += cmd_dtt.o
-COBJS-y += cmd_eeprom.o
+COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += cmd_eeprom.o
+COBJS-$(CONFIG_CMD_EEPROM) += cmd_eeprom.o
COBJS-$(CONFIG_CMD_ELF) += cmd_elf.o
COBJS-$(CONFIG_CMD_EXT2) += cmd_ext2.o
COBJS-$(CONFIG_CMD_FAT) += cmd_fat.o
-COBJS-y += cmd_fdc.o
+COBJS-$(CONFIG_CMD_FDC)$(CONFIG_CMD_FDOS) += cmd_fdc.o
COBJS-$(CONFIG_OF_LIBFDT) += cmd_fdt.o fdt_support.o
COBJS-$(CONFIG_CMD_FDOS) += cmd_fdos.o
COBJS-$(CONFIG_CMD_FLASH) += cmd_flash.o
@@ -108,8 +112,8 @@ COBJS-$(CONFIG_CMD_JFFS2) += cmd_jffs2.o
COBJS-$(CONFIG_CMD_LICENSE) += cmd_license.o
COBJS-y += cmd_load.o
COBJS-$(CONFIG_LOGBUFFER) += cmd_log.o
-COBJS-y += cmd_mac.o
-COBJS-y += cmd_mem.o
+COBJS-$(CONFIG_ID_EEPROM) += cmd_mac.o
+COBJS-$(CONFIG_CMD_MEMORY) += cmd_mem.o
COBJS-$(CONFIG_CMD_MFSL) += cmd_mfsl.o
COBJS-$(CONFIG_MII) += miiphyutil.o
COBJS-$(CONFIG_CMD_MII) += miiphyutil.o
@@ -119,7 +123,6 @@ COBJS-$(CONFIG_CMD_MMC) += cmd_mmc.o
COBJS-$(CONFIG_MP) += cmd_mp.o
COBJS-y += cmd_nand.o
COBJS-$(CONFIG_CMD_NET) += cmd_net.o
-COBJS-y += cmd_nvedit.o
COBJS-$(CONFIG_CMD_ONENAND) += cmd_onenand.o
COBJS-$(CONFIG_CMD_OTP) += cmd_otp.o
ifdef CONFIG_PCI
@@ -144,7 +147,7 @@ COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o
endif
COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o
COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o
-COBJS-y += cmd_vfd.o
+COBJS-$(CONFIG_VFD) += cmd_vfd.o
COBJS-$(CONFIG_CMD_DOC) += docecc.o
COBJS-y += flash.o
COBJS-y += kgdb.o
@@ -164,10 +167,10 @@ all: $(LIB) $(AOBJS)
$(LIB): $(obj).depend $(OBJS)
$(AR) $(ARFLAGS) $@ $(OBJS)
-$(obj)environment.o: $(src)environment.c $(obj)../tools/envcrc
+$(obj)env_embedded.o: $(src)env_embedded.c $(obj)../tools/envcrc
$(CC) $(AFLAGS) -Wa,--no-warn \
-DENV_CRC=$(shell $(obj)../tools/envcrc) \
- -c -o $@ $(src)environment.c
+ -c -o $@ $(src)env_embedded.c
$(obj)../tools/envcrc:
$(MAKE) -C ../tools
diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index 24ff9b9..f4d9d40 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -224,7 +224,7 @@ int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
print_lnum("memsize ", bd->bi_memsize);
print_num("flashstart ", bd->bi_flashstart);
print_num("CFG_MONITOR_BASE ", CFG_MONITOR_BASE);
- print_num("CFG_ENV_ADDR ", CFG_ENV_ADDR);
+ print_num("CONFIG_ENV_ADDR ", CONFIG_ENV_ADDR);
printf("CFG_RELOC_MONITOR_BASE = 0x%lx (%d)\n", CFG_RELOC_MONITOR_BASE,
CFG_MONITOR_LEN);
printf("CFG_MALLOC_BASE = 0x%lx (%d)\n", CFG_MALLOC_BASE,
diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c
index e5000e9..44d44fe 100644
--- a/common/cmd_eeprom.c
+++ b/common/cmd_eeprom.c
@@ -42,8 +42,6 @@
#include <command.h>
#include <i2c.h>
-#if defined(CFG_ENV_IS_IN_EEPROM) || defined(CONFIG_CMD_EEPROM)
-
extern void eeprom_init (void);
extern int eeprom_read (unsigned dev_addr, unsigned offset,
uchar *buffer, unsigned cnt);
@@ -52,7 +50,6 @@ extern int eeprom_write (unsigned dev_addr, unsigned offset,
#if defined(CFG_EEPROM_WREN)
extern int eeprom_write_enable (unsigned dev_addr, int state);
#endif
-#endif
#if defined(CFG_EEPROM_X40430)
@@ -121,8 +118,6 @@ int do_eeprom ( cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
* 0x00000nxx for EEPROM address selectors and page number at n.
*/
-#if defined(CFG_ENV_IS_IN_EEPROM) || defined(CONFIG_CMD_EEPROM)
-
#ifndef CONFIG_SPI
#if !defined(CFG_I2C_EEPROM_ADDR_LEN) || CFG_I2C_EEPROM_ADDR_LEN < 1 || CFG_I2C_EEPROM_ADDR_LEN > 2
#error CFG_I2C_EEPROM_ADDR_LEN must be 1 or 2
@@ -422,7 +417,6 @@ void eeprom_init (void)
}
/*-----------------------------------------------------------------------
*/
-#endif
/***************************************************/
diff --git a/common/cmd_fdc.c b/common/cmd_fdc.c
index 8493def..b663d60 100644
--- a/common/cmd_fdc.c
+++ b/common/cmd_fdc.c
@@ -50,8 +50,6 @@
/*#include <rtc.h> */
/*#endif */
-#if defined(CONFIG_CMD_FDC) || defined(CONFIG_CMD_FDOS)
-
typedef struct {
int flags; /* connected drives ect */
unsigned long blnr; /* Logical block nr */
@@ -705,7 +703,6 @@ int fdc_setup(int drive, FDC_COMMAND_STRUCT *pCMD, FD_GEO_STRUCT *pFG)
return TRUE;
}
-#endif
#if defined(CONFIG_CMD_FDOS)
@@ -903,15 +900,6 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return rcode;
}
-
-#endif
-
-
-/***************************************************/
-
-
-#if defined(CONFIG_CMD_FDC)
-
U_BOOT_CMD(
fdcboot, 3, 1, do_fdcboot,
"fdcboot - boot from floppy device\n",
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
index 91bf25b..ef3928e 100644
--- a/common/cmd_i2c.c
+++ b/common/cmd_i2c.c
@@ -127,7 +127,6 @@ static uchar i2c_no_probes[] = CFG_I2C_NOPROBES;
static int
mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[]);
-extern int cmd_get_data_size(char* arg, int default_size);
/*
* Syntax:
diff --git a/common/cmd_itest.c b/common/cmd_itest.c
index ce98872..9e77fa9 100644
--- a/common/cmd_itest.c
+++ b/common/cmd_itest.c
@@ -64,8 +64,6 @@ op_tbl_t op_table [] = {
#define op_tbl_size (sizeof(op_table)/sizeof(op_table[0]))
-extern int cmd_get_data_size(char* arg, int default_size);
-
static long evalexp(char *s, int w)
{
long l, *p;
diff --git a/common/cmd_mac.c b/common/cmd_mac.c
index faed8f7..4453299 100644
--- a/common/cmd_mac.c
+++ b/common/cmd_mac.c
@@ -24,8 +24,6 @@
#include <common.h>
#include <command.h>
-#ifdef CFG_ID_EEPROM
-
extern int do_mac(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
U_BOOT_CMD(
@@ -63,4 +61,3 @@ U_BOOT_CMD(
"mac 7\n"
" - program the MAC address for port 7\n"
);
-#endif /* CFG_ID_EEPROM */
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index d0a6ca8..07b08fb 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -37,37 +37,6 @@
#endif
#include <watchdog.h>
-#if defined(CONFIG_CMD_MEMORY) \
- || defined(CONFIG_CMD_I2C) \
- || defined(CONFIG_CMD_ITEST) \
- || defined(CONFIG_CMD_PCI) \
- || defined(CONFIG_CMD_PORTIO)
-
-int cmd_get_data_size(char* arg, int default_size)
-{
- /* Check for a size specification .b, .w or .l.
- */
- int len = strlen(arg);
- if (len > 2 && arg[len-2] == '.') {
- switch(arg[len-1]) {
- case 'b':
- return 1;
- case 'w':
- return 2;
- case 'l':
- return 4;
- case 's':
- return -2;
- default:
- return -1;
- }
- }
- return default_size;
-}
-#endif
-
-#if defined(CONFIG_CMD_MEMORY)
-
#ifdef CMD_MEM_DEBUG
#define PRINTF(fmt,args...) printf (fmt ,##args)
#else
@@ -1335,5 +1304,3 @@ U_BOOT_CMD(
"srcaddr dstaddr [dstsize]\n"
);
#endif /* CONFIG_CMD_UNZIP */
-
-#endif
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 7089706..637d6c9 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -52,15 +52,15 @@
DECLARE_GLOBAL_DATA_PTR;
-#if !defined(CFG_ENV_IS_IN_NVRAM) && \
- !defined(CFG_ENV_IS_IN_EEPROM) && \
- !defined(CFG_ENV_IS_IN_FLASH) && \
- !defined(CFG_ENV_IS_IN_DATAFLASH) && \
- !defined(CFG_ENV_IS_IN_NAND) && \
- !defined(CFG_ENV_IS_IN_ONENAND) && \
- !defined(CFG_ENV_IS_IN_SPI_FLASH) && \
- !defined(CFG_ENV_IS_NOWHERE)
-# error Define one of CFG_ENV_IS_IN_{NVRAM|EEPROM|FLASH|DATAFLASH|ONENAND|SPI_FLASH|NOWHERE}
+#if !defined(CONFIG_ENV_IS_IN_NVRAM) && \
+ !defined(CONFIG_ENV_IS_IN_EEPROM) && \
+ !defined(CONFIG_ENV_IS_IN_FLASH) && \
+ !defined(CONFIG_ENV_IS_IN_DATAFLASH) && \
+ !defined(CONFIG_ENV_IS_IN_NAND) && \
+ !defined(CONFIG_ENV_IS_IN_ONENAND) && \
+ !defined(CONFIG_ENV_IS_IN_SPI_FLASH) && \
+ !defined(CONFIG_ENV_IS_NOWHERE)
+# error Define one of CONFIG_ENV_IS_IN_{NVRAM|EEPROM|FLASH|DATAFLASH|ONENAND|SPI_FLASH|NOWHERE}
#endif
#define XMK_STR(x) #x
@@ -503,7 +503,7 @@ char *getenv (char *name)
int val;
for (nxt=i; env_get_char(nxt) != '\0'; ++nxt) {
- if (nxt >= CFG_ENV_SIZE) {
+ if (nxt >= CONFIG_ENV_SIZE) {
return (NULL);
}
}
@@ -523,7 +523,7 @@ int getenv_r (char *name, char *buf, unsigned len)
int val, n;
for (nxt=i; env_get_char(nxt) != '\0'; ++nxt) {
- if (nxt >= CFG_ENV_SIZE) {
+ if (nxt >= CONFIG_ENV_SIZE) {
return (-1);
}
}
@@ -540,11 +540,11 @@ int getenv_r (char *name, char *buf, unsigned len)
return (-1);
}
-#if ((defined(CFG_ENV_IS_IN_NVRAM) || defined(CFG_ENV_IS_IN_EEPROM) \
+#if ((defined(CONFIG_ENV_IS_IN_NVRAM) || defined(CONFIG_ENV_IS_IN_EEPROM) \
|| (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_FLASH)) \
|| (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND)) \
|| (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_ONENAND))) \
- && !defined(CFG_ENV_IS_NOWHERE))
+ && !defined(CONFIG_ENV_IS_NOWHERE))
int do_saveenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
extern char * env_name_spec;
@@ -596,11 +596,11 @@ U_BOOT_CMD(
" - delete environment variable 'name'\n"
);
-#if ((defined(CFG_ENV_IS_IN_NVRAM) || defined(CFG_ENV_IS_IN_EEPROM) \
+#if ((defined(CONFIG_ENV_IS_IN_NVRAM) || defined(CONFIG_ENV_IS_IN_EEPROM) \
|| (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_FLASH)) \
|| (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND)) \
|| (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_ONENAND))) \
- && !defined(CFG_ENV_IS_NOWHERE))
+ && !defined(CONFIG_ENV_IS_NOWHERE))
U_BOOT_CMD(
saveenv, 1, 0, do_saveenv,
"saveenv - save environment variables to persistent storage\n",
diff --git a/common/cmd_pci.c b/common/cmd_pci.c
index 8968701..b2aa833 100644
--- a/common/cmd_pci.c
+++ b/common/cmd_pci.c
@@ -35,8 +35,6 @@
#include <asm/io.h>
#include <pci.h>
-extern int cmd_get_data_size(char* arg, int default_size);
-
unsigned char ShortPCIListing = 1;
/*
diff --git a/common/cmd_portio.c b/common/cmd_portio.c
index a06cac0..c88fcd5 100644
--- a/common/cmd_portio.c
+++ b/common/cmd_portio.c
@@ -30,8 +30,6 @@
#include <common.h>
#include <command.h>
-extern int cmd_get_data_size (char *arg, int default_size);
-
/* Display values from last command.
* Memory modify remembered values are different from display memory.
*/
diff --git a/common/cmd_vfd.c b/common/cmd_vfd.c
index 104c310..45f4271 100644
--- a/common/cmd_vfd.c
+++ b/common/cmd_vfd.c
@@ -75,7 +75,6 @@ U_BOOT_CMD(
);
#endif
-#ifdef CONFIG_VFD
int trab_vfd (ulong bitmap)
{
uchar *addr;
@@ -103,4 +102,3 @@ int trab_vfd (ulong bitmap)
transfer_pic(3, addr, VFD_LOGO_HEIGHT, VFD_LOGO_WIDTH);
return 0;
}
-#endif /* CONFIG_VFD */
diff --git a/common/command.c b/common/command.c
index 861796d..aca57b2 100644
--- a/common/command.c
+++ b/common/command.c
@@ -654,3 +654,27 @@ int cmd_auto_complete(const char *const prompt, char *buf, int *np, int *colp)
}
#endif
+
+#ifdef CMD_DATA_SIZE
+int cmd_get_data_size(char* arg, int default_size)
+{
+ /* Check for a size specification .b, .w or .l.
+ */
+ int len = strlen(arg);
+ if (len > 2 && arg[len-2] == '.') {
+ switch(arg[len-1]) {
+ case 'b':
+ return 1;
+ case 'w':
+ return 2;
+ case 'l':
+ return 4;
+ case 's':
+ return -2;
+ default:
+ return -1;
+ }
+ }
+ return default_size;
+}
+#endif
diff --git a/common/env_common.c b/common/env_common.c
index d51c211..77f9944 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -133,8 +133,8 @@ uchar default_environment[] = {
"\0"
};
-#if defined(CFG_ENV_IS_IN_NAND) /* Environment is in Nand Flash */ \
- || defined(CFG_ENV_IS_IN_SPI_FLASH)
+#if defined(CONFIG_ENV_IS_IN_NAND) /* Environment is in Nand Flash */ \
+ || defined(CONFIG_ENV_IS_IN_SPI_FLASH)
int default_environment_size = sizeof(default_environment);
#endif
@@ -241,12 +241,12 @@ void env_relocate (void)
/*
* We must allocate a buffer for the environment
*/
- env_ptr = (env_t *)malloc (CFG_ENV_SIZE);
+ env_ptr = (env_t *)malloc (CONFIG_ENV_SIZE);
DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__,__LINE__,env_ptr);
#endif
if (gd->env_valid == 0) {
-#if defined(CONFIG_GTH) || defined(CFG_ENV_IS_NOWHERE) /* Environment not changable */
+#if defined(CONFIG_GTH) || defined(CONFIG_ENV_IS_NOWHERE) /* Environment not changable */
puts ("Using default environment\n\n");
#else
puts ("*** Warning - bad CRC, using default environment\n\n");
diff --git a/common/env_dataflash.c b/common/env_dataflash.c
index 2945364..fed919e 100644
--- a/common/env_dataflash.c
+++ b/common/env_dataflash.c
@@ -18,9 +18,6 @@
*
*/
#include <common.h>
-
-#if defined(CFG_ENV_IS_IN_DATAFLASH) /* Environment is in DataFlash */
-
#include <command.h>
#include <environment.h>
#include <linux/stddef.h>
@@ -44,22 +41,22 @@ extern uchar default_environment[];
uchar env_get_char_spec (int index)
{
uchar c;
- read_dataflash(CFG_ENV_ADDR + index + offsetof(env_t,data),
+ read_dataflash(CONFIG_ENV_ADDR + index + offsetof(env_t,data),
1, (char *)&c);
return (c);
}
void env_relocate_spec (void)
{
- read_dataflash(CFG_ENV_ADDR, CFG_ENV_SIZE, (char *)env_ptr);
+ read_dataflash(CONFIG_ENV_ADDR, CONFIG_ENV_SIZE, (char *)env_ptr);
}
int saveenv(void)
{
/* env must be copied to do not alter env structure in memory*/
- unsigned char temp[CFG_ENV_SIZE];
- memcpy(temp, env_ptr, CFG_ENV_SIZE);
- return write_dataflash(CFG_ENV_ADDR, (unsigned long)temp, CFG_ENV_SIZE);
+ unsigned char temp[CONFIG_ENV_SIZE];
+ memcpy(temp, env_ptr, CONFIG_ENV_SIZE);
+ return write_dataflash(CONFIG_ENV_ADDR, (unsigned long)temp, CONFIG_ENV_SIZE);
}
/************************************************************************
@@ -77,14 +74,14 @@ int env_init(void)
AT91F_DataflashInit(); /* prepare for DATAFLASH read/write */
/* read old CRC */
- read_dataflash(CFG_ENV_ADDR + offsetof(env_t, crc),
+ read_dataflash(CONFIG_ENV_ADDR + offsetof(env_t, crc),
sizeof(ulong), (char *)&crc);
new = 0;
len = ENV_SIZE;
off = offsetof(env_t,data);
while (len > 0) {
int n = (len > sizeof(buf)) ? sizeof(buf) : len;
- read_dataflash(CFG_ENV_ADDR + off, n, (char *)buf);
+ read_dataflash(CONFIG_ENV_ADDR + off, n, (char *)buf);
new = crc32 (new, buf, n);
len -= n;
off += n;
@@ -100,5 +97,3 @@ int env_init(void)
return (0);
}
-
-#endif /* CFG_ENV_IS_IN_DATAFLASH */
diff --git a/common/env_eeprom.c b/common/env_eeprom.c
index 9e1a201..1f0f413 100644
--- a/common/env_eeprom.c
+++ b/common/env_eeprom.c
@@ -25,9 +25,6 @@
*/
#include <common.h>
-
-#if defined(CFG_ENV_IS_IN_EEPROM) /* Environment is in EEPROM */
-
#include <command.h>
#include <environment.h>
#include <linux/stddef.h>
@@ -43,7 +40,7 @@ uchar env_get_char_spec (int index)
uchar c;
eeprom_read (CFG_DEF_EEPROM_ADDR,
- CFG_ENV_OFFSET+index+offsetof(env_t,data),
+ CONFIG_ENV_OFFSET+index+offsetof(env_t,data),
&c, 1);
return (c);
@@ -52,17 +49,17 @@ uchar env_get_char_spec (int index)
void env_relocate_spec (void)
{
eeprom_read (CFG_DEF_EEPROM_ADDR,
- CFG_ENV_OFFSET,
+ CONFIG_ENV_OFFSET,
(uchar*)env_ptr,
- CFG_ENV_SIZE);
+ CONFIG_ENV_SIZE);
}
int saveenv(void)
{
return eeprom_write (CFG_DEF_EEPROM_ADDR,
- CFG_ENV_OFFSET,
+ CONFIG_ENV_OFFSET,
(uchar *)env_ptr,
- CFG_ENV_SIZE);
+ CONFIG_ENV_SIZE);
}
/************************************************************************
@@ -81,7 +78,7 @@ int env_init(void)
/* read old CRC */
eeprom_read (CFG_DEF_EEPROM_ADDR,
- CFG_ENV_OFFSET+offsetof(env_t,crc),
+ CONFIG_ENV_OFFSET+offsetof(env_t,crc),
(uchar *)&crc, sizeof(ulong));
new = 0;
@@ -90,7 +87,7 @@ int env_init(void)
while (len > 0) {
int n = (len > sizeof(buf)) ? sizeof(buf) : len;
- eeprom_read (CFG_DEF_EEPROM_ADDR, CFG_ENV_OFFSET+off, buf, n);
+ eeprom_read (CFG_DEF_EEPROM_ADDR, CONFIG_ENV_OFFSET+off, buf, n);
new = crc32 (new, buf, n);
len -= n;
off += n;
@@ -106,5 +103,3 @@ int env_init(void)
return (0);
}
-
-#endif /* CFG_ENV_IS_IN_EEPROM */
diff --git a/common/environment.c b/common/env_embedded.c
index 3b9914f..77e5619 100644
--- a/common/environment.c
+++ b/common/env_embedded.c
@@ -180,7 +180,7 @@ env_t environment __PPCENV__ = {
"\0" /* Term. env_t.data with 2 NULs */
}
};
-#ifdef CFG_ENV_ADDR_REDUND
+#ifdef CONFIG_ENV_ADDR_REDUND
env_t redundand_environment __PPCENV__ = {
0, /* CRC Sum: invalid */
0, /* Flags: invalid */
@@ -188,7 +188,7 @@ env_t redundand_environment __PPCENV__ = {
"\0"
}
};
-#endif /* CFG_ENV_ADDR_REDUND */
+#endif /* CONFIG_ENV_ADDR_REDUND */
/*
* These will end up in the .text section
@@ -203,6 +203,6 @@ unsigned long env_size __PPCTEXT__ = sizeof(env_t);
/*
* Add in absolutes.
*/
-GEN_ABS(env_offset, CFG_ENV_OFFSET);
+GEN_ABS(env_offset, CONFIG_ENV_OFFSET);
#endif /* ENV_IS_EMBEDDED */
diff --git a/common/env_flash.c b/common/env_flash.c
index a92160d..75ee8dd 100644
--- a/common/env_flash.c
+++ b/common/env_flash.c
@@ -27,9 +27,6 @@
/* #define DEBUG */
#include <common.h>
-
-#if defined(CFG_ENV_IS_IN_FLASH) /* Environment is in Flash */
-
#include <command.h>
#include <environment.h>
#include <linux/stddef.h>
@@ -39,17 +36,17 @@ DECLARE_GLOBAL_DATA_PTR;
#if defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_FLASH)
#define CMD_SAVEENV
-#elif defined(CFG_ENV_ADDR_REDUND)
-#error Cannot use CFG_ENV_ADDR_REDUND without CONFIG_CMD_ENV & CONFIG_CMD_FLASH
+#elif defined(CONFIG_ENV_ADDR_REDUND)
+#error Cannot use CONFIG_ENV_ADDR_REDUND without CONFIG_CMD_ENV & CONFIG_CMD_FLASH
#endif
-#if defined(CFG_ENV_SIZE_REDUND) && (CFG_ENV_SIZE_REDUND < CFG_ENV_SIZE)
-#error CFG_ENV_SIZE_REDUND should not be less then CFG_ENV_SIZE
+#if defined(CONFIG_ENV_SIZE_REDUND) && (CONFIG_ENV_SIZE_REDUND < CONFIG_ENV_SIZE)
+#error CONFIG_ENV_SIZE_REDUND should not be less then CONFIG_ENV_SIZE
#endif
#ifdef CONFIG_INFERNO
-# ifdef CFG_ENV_ADDR_REDUND
-#error CFG_ENV_ADDR_REDUND is not implemented for CONFIG_INFERNO
+# ifdef CONFIG_ENV_ADDR_REDUND
+#error CONFIG_ENV_ADDR_REDUND is not implemented for CONFIG_INFERNO
# endif
#endif
@@ -62,28 +59,28 @@ env_t *env_ptr = (env_t *)(&environment[0]);
#ifdef CMD_SAVEENV
/* static env_t *flash_addr = (env_t *)(&environment[0]);-broken on ARM-wd-*/
-static env_t *flash_addr = (env_t *)CFG_ENV_ADDR;
+static env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;
#endif
#else /* ! ENV_IS_EMBEDDED */
-env_t *env_ptr = (env_t *)CFG_ENV_ADDR;
+env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
#ifdef CMD_SAVEENV
-static env_t *flash_addr = (env_t *)CFG_ENV_ADDR;
+static env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;
#endif
#endif /* ENV_IS_EMBEDDED */
-#ifdef CFG_ENV_ADDR_REDUND
-static env_t *flash_addr_new = (env_t *)CFG_ENV_ADDR_REDUND;
+#ifdef CONFIG_ENV_ADDR_REDUND
+static env_t *flash_addr_new = (env_t *)CONFIG_ENV_ADDR_REDUND;
-/* CFG_ENV_ADDR is supposed to be on sector boundary */
-static ulong end_addr = CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1;
-static ulong end_addr_new = CFG_ENV_ADDR_REDUND + CFG_ENV_SECT_SIZE - 1;
+/* CONFIG_ENV_ADDR is supposed to be on sector boundary */
+static ulong end_addr = CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1;
+static ulong end_addr_new = CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1;
#define ACTIVE_FLAG 1
#define OBSOLETE_FLAG 0
-#endif /* CFG_ENV_ADDR_REDUND */
+#endif /* CONFIG_ENV_ADDR_REDUND */
extern uchar default_environment[];
extern int default_environment_size;
@@ -94,7 +91,7 @@ uchar env_get_char_spec (int index)
return ( *((uchar *)(gd->env_addr + index)) );
}
-#ifdef CFG_ENV_ADDR_REDUND
+#ifdef CONFIG_ENV_ADDR_REDUND
int env_init(void)
{
@@ -145,7 +142,7 @@ int saveenv(void)
char *saved_data = NULL;
int rc = 1;
char flag = OBSOLETE_FLAG, new_flag = ACTIVE_FLAG;
-#if CFG_ENV_SECT_SIZE > CFG_ENV_SIZE
+#if CONFIG_ENV_SECT_SIZE > CONFIG_ENV_SIZE
ulong up_data = 0;
#endif
@@ -163,8 +160,8 @@ int saveenv(void)
goto Done;
}
-#if CFG_ENV_SECT_SIZE > CFG_ENV_SIZE
- up_data = (end_addr_new + 1 - ((long)flash_addr_new + CFG_ENV_SIZE));
+#if CONFIG_ENV_SECT_SIZE > CONFIG_ENV_SIZE
+ up_data = (end_addr_new + 1 - ((long)flash_addr_new + CONFIG_ENV_SIZE));
debug ("Data to save 0x%x\n", up_data);
if (up_data) {
if ((saved_data = malloc(up_data)) == NULL) {
@@ -173,9 +170,9 @@ int saveenv(void)
goto Done;
}
memcpy(saved_data,
- (void *)((long)flash_addr_new + CFG_ENV_SIZE), up_data);
+ (void *)((long)flash_addr_new + CONFIG_ENV_SIZE), up_data);
debug ("Data (start 0x%x, len 0x%x) saved at 0x%x\n",
- (long)flash_addr_new + CFG_ENV_SIZE,
+ (long)flash_addr_new + CONFIG_ENV_SIZE,
up_data, saved_data);
}
#endif
@@ -209,12 +206,12 @@ int saveenv(void)
}
puts ("done\n");
-#if CFG_ENV_SECT_SIZE > CFG_ENV_SIZE
+#if CONFIG_ENV_SECT_SIZE > CONFIG_ENV_SIZE
if (up_data) { /* restore the rest of sector */
debug ("Restoring the rest of data to 0x%x len 0x%x\n",
- (long)flash_addr_new + CFG_ENV_SIZE, up_data);
+ (long)flash_addr_new + CONFIG_ENV_SIZE, up_data);
if (flash_write(saved_data,
- (long)flash_addr_new + CFG_ENV_SIZE,
+ (long)flash_addr_new + CONFIG_ENV_SIZE,
up_data)) {
flash_perror(rc);
goto Done;
@@ -245,7 +242,7 @@ Done:
}
#endif /* CMD_SAVEENV */
-#else /* ! CFG_ENV_ADDR_REDUND */
+#else /* ! CONFIG_ENV_ADDR_REDUND */
int env_init(void)
{
@@ -267,36 +264,36 @@ int saveenv(void)
int len, rc;
ulong end_addr;
ulong flash_sect_addr;
-#if defined(CFG_ENV_SECT_SIZE) && (CFG_ENV_SECT_SIZE > CFG_ENV_SIZE)
+#if defined(CONFIG_ENV_SECT_SIZE) && (CONFIG_ENV_SECT_SIZE > CONFIG_ENV_SIZE)
ulong flash_offset;
- uchar env_buffer[CFG_ENV_SECT_SIZE];
+ uchar env_buffer[CONFIG_ENV_SECT_SIZE];
#else
uchar *env_buffer = (uchar *)env_ptr;
-#endif /* CFG_ENV_SECT_SIZE */
+#endif /* CONFIG_ENV_SECT_SIZE */
int rcode = 0;
-#if defined(CFG_ENV_SECT_SIZE) && (CFG_ENV_SECT_SIZE > CFG_ENV_SIZE)
+#if defined(CONFIG_ENV_SECT_SIZE) && (CONFIG_ENV_SECT_SIZE > CONFIG_ENV_SIZE)
- flash_offset = ((ulong)flash_addr) & (CFG_ENV_SECT_SIZE-1);
- flash_sect_addr = ((ulong)flash_addr) & ~(CFG_ENV_SECT_SIZE-1);
+ flash_offset = ((ulong)flash_addr) & (CONFIG_ENV_SECT_SIZE-1);
+ flash_sect_addr = ((ulong)flash_addr) & ~(CONFIG_ENV_SECT_SIZE-1);
debug ( "copy old content: "
"sect_addr: %08lX env_addr: %08lX offset: %08lX\n",
flash_sect_addr, (ulong)flash_addr, flash_offset);
/* copy old contents to temporary buffer */
- memcpy (env_buffer, (void *)flash_sect_addr, CFG_ENV_SECT_SIZE);
+ memcpy (env_buffer, (void *)flash_sect_addr, CONFIG_ENV_SECT_SIZE);
/* copy current environment to temporary buffer */
memcpy ((uchar *)((unsigned long)env_buffer + flash_offset),
env_ptr,
- CFG_ENV_SIZE);
+ CONFIG_ENV_SIZE);
- len = CFG_ENV_SECT_SIZE;
+ len = CONFIG_ENV_SECT_SIZE;
#else
flash_sect_addr = (ulong)flash_addr;
- len = CFG_ENV_SIZE;
-#endif /* CFG_ENV_SECT_SIZE */
+ len = CONFIG_ENV_SIZE;
+#endif /* CONFIG_ENV_SECT_SIZE */
#ifndef CONFIG_INFERNO
end_addr = flash_sect_addr + len - 1;
@@ -332,12 +329,12 @@ int saveenv(void)
#endif /* CMD_SAVEENV */
-#endif /* CFG_ENV_ADDR_REDUND */
+#endif /* CONFIG_ENV_ADDR_REDUND */
void env_relocate_spec (void)
{
-#if !defined(ENV_IS_EMBEDDED) || defined(CFG_ENV_ADDR_REDUND)
-#ifdef CFG_ENV_ADDR_REDUND
+#if !defined(ENV_IS_EMBEDDED) || defined(CONFIG_ENV_ADDR_REDUND)
+#ifdef CONFIG_ENV_ADDR_REDUND
if (gd->env_addr != (ulong)&(flash_addr->data)) {
env_t * etmp = flash_addr;
ulong ltmp = end_addr;
@@ -377,11 +374,9 @@ void env_relocate_spec (void)
if (gd->env_valid == 2)
puts ("*** Warning - some problems detected "
"reading environment; recovered successfully\n\n");
-#endif /* CFG_ENV_ADDR_REDUND */
+#endif /* CONFIG_ENV_ADDR_REDUND */
#ifdef CMD_SAVEENV
- memcpy (env_ptr, (void*)flash_addr, CFG_ENV_SIZE);
+ memcpy (env_ptr, (void*)flash_addr, CONFIG_ENV_SIZE);
#endif
-#endif /* ! ENV_IS_EMBEDDED || CFG_ENV_ADDR_REDUND */
+#endif /* ! ENV_IS_EMBEDDED || CONFIG_ENV_ADDR_REDUND */
}
-
-#endif /* CFG_ENV_IS_IN_FLASH */
diff --git a/common/env_nand.c b/common/env_nand.c
index a8f0de7..8af9e74 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -33,9 +33,6 @@
/* #define DEBUG */
#include <common.h>
-
-#if defined(CFG_ENV_IS_IN_NAND) /* Environment is in Nand Flash */
-
#include <command.h>
#include <environment.h>
#include <linux/stddef.h>
@@ -44,20 +41,20 @@
#if defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND)
#define CMD_SAVEENV
-#elif defined(CFG_ENV_OFFSET_REDUND)
-#error Cannot use CFG_ENV_OFFSET_REDUND without CONFIG_CMD_ENV & CONFIG_CMD_NAND
+#elif defined(CONFIG_ENV_OFFSET_REDUND)
+#error Cannot use CONFIG_ENV_OFFSET_REDUND without CONFIG_CMD_ENV & CONFIG_CMD_NAND
#endif
-#if defined(CFG_ENV_SIZE_REDUND) && (CFG_ENV_SIZE_REDUND != CFG_ENV_SIZE)
-#error CFG_ENV_SIZE_REDUND should be the same as CFG_ENV_SIZE
+#if defined(CONFIG_ENV_SIZE_REDUND) && (CONFIG_ENV_SIZE_REDUND != CONFIG_ENV_SIZE)
+#error CONFIG_ENV_SIZE_REDUND should be the same as CONFIG_ENV_SIZE
#endif
#ifdef CONFIG_INFERNO
#error CONFIG_INFERNO not supported yet
#endif
-#ifndef CFG_ENV_RANGE
-#define CFG_ENV_RANGE CFG_ENV_SIZE
+#ifndef CONFIG_ENV_RANGE
+#define CONFIG_ENV_RANGE CONFIG_ENV_SIZE
#endif
int nand_legacy_rw (struct nand_chip* nand, int cmd,
@@ -110,10 +107,10 @@ int env_init(void)
int crc1_ok = 0, crc2_ok = 0;
env_t *tmp_env1, *tmp_env2;
- total = CFG_ENV_SIZE;
+ total = CONFIG_ENV_SIZE;
tmp_env1 = env_ptr;
- tmp_env2 = (env_t *)((ulong)env_ptr + CFG_ENV_SIZE);
+ tmp_env2 = (env_t *)((ulong)env_ptr + CONFIG_ENV_SIZE);
crc1_ok = (crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc);
crc2_ok = (crc32(0, tmp_env2->data, ENV_SIZE) == tmp_env2->crc);
@@ -157,16 +154,16 @@ int env_init(void)
*/
int writeenv(size_t offset, u_char *buf)
{
- size_t end = offset + CFG_ENV_RANGE;
+ size_t end = offset + CONFIG_ENV_RANGE;
size_t amount_saved = 0;
size_t blocksize, len;
u_char *char_ptr;
blocksize = nand_info[0].erasesize;
- len = min(blocksize, CFG_ENV_SIZE);
+ len = min(blocksize, CONFIG_ENV_SIZE);
- while (amount_saved < CFG_ENV_SIZE && offset < end) {
+ while (amount_saved < CONFIG_ENV_SIZE && offset < end) {
if (nand_block_isbad(&nand_info[0], offset)) {
offset += blocksize;
} else {
@@ -178,12 +175,12 @@ int writeenv(size_t offset, u_char *buf)
amount_saved += len;
}
}
- if (amount_saved != CFG_ENV_SIZE)
+ if (amount_saved != CONFIG_ENV_SIZE)
return 1;
return 0;
}
-#ifdef CFG_ENV_OFFSET_REDUND
+#ifdef CONFIG_ENV_OFFSET_REDUND
int saveenv(void)
{
size_t total;
@@ -191,31 +188,31 @@ int saveenv(void)
nand_erase_options_t nand_erase_options;
env_ptr->flags++;
- total = CFG_ENV_SIZE;
+ total = CONFIG_ENV_SIZE;
- nand_erase_options.length = CFG_ENV_RANGE;
+ nand_erase_options.length = CONFIG_ENV_RANGE;
nand_erase_options.quiet = 0;
nand_erase_options.jffs2 = 0;
nand_erase_options.scrub = 0;
- if (CFG_ENV_RANGE < CFG_ENV_SIZE)
+ if (CONFIG_ENV_RANGE < CONFIG_ENV_SIZE)
return 1;
if(gd->env_valid == 1) {
puts ("Erasing redundant Nand...\n");
- nand_erase_options.offset = CFG_ENV_OFFSET_REDUND;
+ nand_erase_options.offset = CONFIG_ENV_OFFSET_REDUND;
if (nand_erase_opts(&nand_info[0], &nand_erase_options))
return 1;
puts ("Writing to redundant Nand... ");
- ret = writeenv(CFG_ENV_OFFSET_REDUND, (u_char *) env_ptr);
+ ret = writeenv(CONFIG_ENV_OFFSET_REDUND, (u_char *) env_ptr);
} else {
puts ("Erasing Nand...\n");
- nand_erase_options.offset = CFG_ENV_OFFSET;
+ nand_erase_options.offset = CONFIG_ENV_OFFSET;
if (nand_erase_opts(&nand_info[0], &nand_erase_options))
return 1;
puts ("Writing to Nand... ");
- ret = writeenv(CFG_ENV_OFFSET, (u_char *) env_ptr);
+ ret = writeenv(CONFIG_ENV_OFFSET, (u_char *) env_ptr);
}
if (ret) {
puts("FAILED!\n");
@@ -226,28 +223,28 @@ int saveenv(void)
gd->env_valid = (gd->env_valid == 2 ? 1 : 2);
return ret;
}
-#else /* ! CFG_ENV_OFFSET_REDUND */
+#else /* ! CONFIG_ENV_OFFSET_REDUND */
int saveenv(void)
{
size_t total;
int ret = 0;
nand_erase_options_t nand_erase_options;
- nand_erase_options.length = CFG_ENV_RANGE;
+ nand_erase_options.length = CONFIG_ENV_RANGE;
nand_erase_options.quiet = 0;
nand_erase_options.jffs2 = 0;
nand_erase_options.scrub = 0;
- nand_erase_options.offset = CFG_ENV_OFFSET;
+ nand_erase_options.offset = CONFIG_ENV_OFFSET;
- if (CFG_ENV_RANGE < CFG_ENV_SIZE)
+ if (CONFIG_ENV_RANGE < CONFIG_ENV_SIZE)
return 1;
puts ("Erasing Nand...\n");
if (nand_erase_opts(&nand_info[0], &nand_erase_options))
return 1;
puts ("Writing to Nand... ");
- total = CFG_ENV_SIZE;
- if (writeenv(CFG_ENV_OFFSET, (u_char *) env_ptr)) {
+ total = CONFIG_ENV_SIZE;
+ if (writeenv(CONFIG_ENV_OFFSET, (u_char *) env_ptr)) {
puts("FAILED!\n");
return 1;
}
@@ -255,21 +252,21 @@ int saveenv(void)
puts ("done\n");
return ret;
}
-#endif /* CFG_ENV_OFFSET_REDUND */
+#endif /* CONFIG_ENV_OFFSET_REDUND */
#endif /* CMD_SAVEENV */
int readenv (size_t offset, u_char * buf)
{
- size_t end = offset + CFG_ENV_RANGE;
+ size_t end = offset + CONFIG_ENV_RANGE;
size_t amount_loaded = 0;
size_t blocksize, len;
u_char *char_ptr;
blocksize = nand_info[0].erasesize;
- len = min(blocksize, CFG_ENV_SIZE);
+ len = min(blocksize, CONFIG_ENV_SIZE);
- while (amount_loaded < CFG_ENV_SIZE && offset < end) {
+ while (amount_loaded < CONFIG_ENV_SIZE && offset < end) {
if (nand_block_isbad(&nand_info[0], offset)) {
offset += blocksize;
} else {
@@ -280,13 +277,13 @@ int readenv (size_t offset, u_char * buf)
amount_loaded += len;
}
}
- if (amount_loaded != CFG_ENV_SIZE)
+ if (amount_loaded != CONFIG_ENV_SIZE)
return 1;
return 0;
}
-#ifdef CFG_ENV_OFFSET_REDUND
+#ifdef CONFIG_ENV_OFFSET_REDUND
void env_relocate_spec (void)
{
#if !defined(ENV_IS_EMBEDDED)
@@ -294,14 +291,14 @@ void env_relocate_spec (void)
int crc1_ok = 0, crc2_ok = 0;
env_t *tmp_env1, *tmp_env2;
- total = CFG_ENV_SIZE;
+ total = CONFIG_ENV_SIZE;
- tmp_env1 = (env_t *) malloc(CFG_ENV_SIZE);
- tmp_env2 = (env_t *) malloc(CFG_ENV_SIZE);
+ tmp_env1 = (env_t *) malloc(CONFIG_ENV_SIZE);
+ tmp_env2 = (env_t *) malloc(CONFIG_ENV_SIZE);
- if (readenv(CFG_ENV_OFFSET, (u_char *) tmp_env1))
+ if (readenv(CONFIG_ENV_OFFSET, (u_char *) tmp_env1))
puts("No Valid Environment Area Found\n");
- if (readenv(CFG_ENV_OFFSET_REDUND, (u_char *) tmp_env2))
+ if (readenv(CONFIG_ENV_OFFSET_REDUND, (u_char *) tmp_env2))
puts("No Valid Reundant Environment Area Found\n");
crc1_ok = (crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc);
@@ -339,7 +336,7 @@ void env_relocate_spec (void)
#endif /* ! ENV_IS_EMBEDDED */
}
-#else /* ! CFG_ENV_OFFSET_REDUND */
+#else /* ! CONFIG_ENV_OFFSET_REDUND */
/*
* The legacy NAND code saved the environment in the first NAND device i.e.,
* nand_dev_desc + 0. This is also the behaviour using the new NAND code.
@@ -349,7 +346,7 @@ void env_relocate_spec (void)
#if !defined(ENV_IS_EMBEDDED)
int ret;
- ret = readenv(CFG_ENV_OFFSET, (u_char *) env_ptr);
+ ret = readenv(CONFIG_ENV_OFFSET, (u_char *) env_ptr);
if (ret)
return use_default();
@@ -357,7 +354,7 @@ void env_relocate_spec (void)
return use_default();
#endif /* ! ENV_IS_EMBEDDED */
}
-#endif /* CFG_ENV_OFFSET_REDUND */
+#endif /* CONFIG_ENV_OFFSET_REDUND */
#if !defined(ENV_IS_EMBEDDED)
static void use_default()
@@ -366,5 +363,3 @@ static void use_default()
set_default_env();
}
#endif
-
-#endif /* CFG_ENV_IS_IN_NAND */
diff --git a/common/env_nowhere.c b/common/env_nowhere.c
index 17ecc77..78e8f8e 100644
--- a/common/env_nowhere.c
+++ b/common/env_nowhere.c
@@ -25,9 +25,6 @@
*/
#include <common.h>
-
-#if defined(CFG_ENV_IS_NOWHERE) /* Environment is nowhere */
-
#include <command.h>
#include <environment.h>
#include <linux/stddef.h>
@@ -61,5 +58,3 @@ int env_init(void)
return (0);
}
-
-#endif /* CFG_ENV_IS_NOWHERE) */
diff --git a/common/env_nvram.c b/common/env_nvram.c
index fa77719..a8b7959 100644
--- a/common/env_nvram.c
+++ b/common/env_nvram.c
@@ -41,21 +41,18 @@
*/
#include <common.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#ifdef CFG_ENV_IS_IN_NVRAM /* Environment is in NVRAM */
-
#include <command.h>
#include <environment.h>
#include <linux/stddef.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#ifdef CFG_NVRAM_ACCESS_ROUTINE
extern void *nvram_read(void *dest, const long src, size_t count);
extern void nvram_write(long dest, const void *src, size_t count);
env_t *env_ptr = NULL;
#else
-env_t *env_ptr = (env_t *)CFG_ENV_ADDR;
+env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
#endif
char * env_name_spec = "NVRAM";
@@ -69,7 +66,7 @@ uchar env_get_char_spec (int index)
#ifdef CFG_NVRAM_ACCESS_ROUTINE
uchar c;
- nvram_read(&c, CFG_ENV_ADDR+index, 1);
+ nvram_read(&c, CONFIG_ENV_ADDR+index, 1);
return c;
#else
@@ -86,7 +83,7 @@ uchar env_get_char_spec (int index)
#ifdef CFG_NVRAM_ACCESS_ROUTINE
uchar c;
- nvram_read(&c, CFG_ENV_ADDR+index, 1);
+ nvram_read(&c, CONFIG_ENV_ADDR+index, 1);
return c;
#else
@@ -98,9 +95,9 @@ uchar env_get_char_spec (int index)
void env_relocate_spec (void)
{
#if defined(CFG_NVRAM_ACCESS_ROUTINE)
- nvram_read(env_ptr, CFG_ENV_ADDR, CFG_ENV_SIZE);
+ nvram_read(env_ptr, CONFIG_ENV_ADDR, CONFIG_ENV_SIZE);
#else
- memcpy (env_ptr, (void*)CFG_ENV_ADDR, CFG_ENV_SIZE);
+ memcpy (env_ptr, (void*)CONFIG_ENV_ADDR, CONFIG_ENV_SIZE);
#endif
}
@@ -111,9 +108,9 @@ int saveenv (void)
enable_nvram();
#endif
#ifdef CFG_NVRAM_ACCESS_ROUTINE
- nvram_write(CFG_ENV_ADDR, env_ptr, CFG_ENV_SIZE);
+ nvram_write(CONFIG_ENV_ADDR, env_ptr, CONFIG_ENV_SIZE);
#else
- if (memcpy ((char *)CFG_ENV_ADDR, env_ptr, CFG_ENV_SIZE) == NULL)
+ if (memcpy ((char *)CONFIG_ENV_ADDR, env_ptr, CONFIG_ENV_SIZE) == NULL)
rcode = 1 ;
#endif
#ifdef CONFIG_AMIGAONEG3SE
@@ -137,11 +134,11 @@ int env_init (void)
#if defined(CFG_NVRAM_ACCESS_ROUTINE)
ulong crc;
uchar data[ENV_SIZE];
- nvram_read (&crc, CFG_ENV_ADDR, sizeof(ulong));
- nvram_read (data, CFG_ENV_ADDR+sizeof(ulong), ENV_SIZE);
+ nvram_read (&crc, CONFIG_ENV_ADDR, sizeof(ulong));
+ nvram_read (data, CONFIG_ENV_ADDR+sizeof(ulong), ENV_SIZE);
if (crc32(0, data, ENV_SIZE) == crc) {
- gd->env_addr = (ulong)CFG_ENV_ADDR + sizeof(long);
+ gd->env_addr = (ulong)CONFIG_ENV_ADDR + sizeof(long);
#else
if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
gd->env_addr = (ulong)&(env_ptr->data);
@@ -156,5 +153,3 @@ int env_init (void)
#endif
return (0);
}
-
-#endif /* CFG_ENV_IS_IN_NVRAM */
diff --git a/common/env_onenand.c b/common/env_onenand.c
index d5c907c..3c65b3e 100644
--- a/common/env_onenand.c
+++ b/common/env_onenand.c
@@ -22,9 +22,6 @@
*/
#include <common.h>
-
-#if defined(CFG_ENV_IS_IN_ONENAND) /* Environment is in OneNAND */
-
#include <command.h>
#include <environment.h>
#include <linux/stddef.h>
@@ -65,7 +62,7 @@ void env_relocate_spec(void)
int use_default = 0;
size_t retlen;
- env_addr = CFG_ENV_ADDR;
+ env_addr = CONFIG_ENV_ADDR;
/* Check OneNAND exist */
if (onenand_mtd.writesize)
@@ -92,13 +89,13 @@ void env_relocate_spec(void)
int saveenv(void)
{
- unsigned long env_addr = CFG_ENV_ADDR;
+ unsigned long env_addr = CONFIG_ENV_ADDR;
struct erase_info instr = {
.callback = NULL,
};
size_t retlen;
- instr.len = CFG_ENV_SIZE;
+ instr.len = CONFIG_ENV_SIZE;
instr.addr = env_addr;
if (onenand_erase(&onenand_mtd, &instr)) {
printf("OneNAND: erase failed at 0x%08lx\n", env_addr);
@@ -126,5 +123,3 @@ int env_init(void)
return 0;
}
-
-#endif /* CFG_ENV_IS_IN_ONENAND */
diff --git a/common/env_sf.c b/common/env_sf.c
index 9077d78..1bbf93f 100644
--- a/common/env_sf.c
+++ b/common/env_sf.c
@@ -26,23 +26,20 @@
* MA 02111-1307 USA
*/
#include <common.h>
-
-#ifdef CFG_ENV_IS_IN_SPI_FLASH
-
#include <environment.h>
#include <spi_flash.h>
-#ifndef CFG_ENV_SPI_BUS
-# define CFG_ENV_SPI_BUS 0
+#ifndef CONFIG_ENV_SPI_BUS
+# define CONFIG_ENV_SPI_BUS 0
#endif
-#ifndef CFG_ENV_SPI_CS
-# define CFG_ENV_SPI_CS 0
+#ifndef CONFIG_ENV_SPI_CS
+# define CONFIG_ENV_SPI_CS 0
#endif
-#ifndef CFG_ENV_SPI_MAX_HZ
-# define CFG_ENV_SPI_MAX_HZ 1000000
+#ifndef CONFIG_ENV_SPI_MAX_HZ
+# define CONFIG_ENV_SPI_MAX_HZ 1000000
#endif
-#ifndef CFG_ENV_SPI_MODE
-# define CFG_ENV_SPI_MODE SPI_MODE_3
+#ifndef CONFIG_ENV_SPI_MODE
+# define CONFIG_ENV_SPI_MODE SPI_MODE_3
#endif
DECLARE_GLOBAL_DATA_PTR;
@@ -70,18 +67,18 @@ int saveenv(void)
return 1;
}
- if (CFG_ENV_SIZE > CFG_ENV_SECT_SIZE) {
- sector = CFG_ENV_SIZE / CFG_ENV_SECT_SIZE;
- if (CFG_ENV_SIZE % CFG_ENV_SECT_SIZE)
+ if (CONFIG_ENV_SIZE > CONFIG_ENV_SECT_SIZE) {
+ sector = CONFIG_ENV_SIZE / CONFIG_ENV_SECT_SIZE;
+ if (CONFIG_ENV_SIZE % CONFIG_ENV_SECT_SIZE)
sector++;
}
puts("Erasing SPI flash...");
- if (spi_flash_erase(env_flash, CFG_ENV_OFFSET, sector * CFG_ENV_SECT_SIZE))
+ if (spi_flash_erase(env_flash, CONFIG_ENV_OFFSET, sector * CONFIG_ENV_SECT_SIZE))
return 1;
puts("Writing to SPI flash...");
- if (spi_flash_write(env_flash, CFG_ENV_OFFSET, CFG_ENV_SIZE, env_ptr))
+ if (spi_flash_write(env_flash, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, env_ptr))
return 1;
puts("done\n");
@@ -92,12 +89,12 @@ void env_relocate_spec(void)
{
int ret;
- env_flash = spi_flash_probe(CFG_ENV_SPI_BUS, CFG_ENV_SPI_CS,
- CFG_ENV_SPI_MAX_HZ, CFG_ENV_SPI_MODE);
+ env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS,
+ CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
if (!env_flash)
goto err_probe;
- ret = spi_flash_read(env_flash, CFG_ENV_OFFSET, CFG_ENV_SIZE, env_ptr);
+ ret = spi_flash_read(env_flash, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, env_ptr);
if (ret)
goto err_read;
@@ -115,7 +112,7 @@ err_probe:
err_crc:
puts("*** Warning - bad CRC, using default environment\n\n");
- if (default_environment_size > CFG_ENV_SIZE) {
+ if (default_environment_size > CONFIG_ENV_SIZE) {
gd->env_valid = 0;
puts("*** Error - default environment is too large\n\n");
return;
@@ -135,5 +132,3 @@ int env_init(void)
return 0;
}
-
-#endif /* CFG_ENV_IS_IN_SPI_FLASH */