rename CFG_ macros to CONFIG_SYS

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
diff --git a/common/ACEX1K.c b/common/ACEX1K.c
index 53677b8..3f79677 100644
--- a/common/ACEX1K.c
+++ b/common/ACEX1K.c
@@ -44,8 +44,8 @@
 #define CONFIG_FPGA_DELAY()
 #endif
 
-#ifndef CFG_FPGA_WAIT
-#define CFG_FPGA_WAIT CFG_HZ/10		/* 100 ms */
+#ifndef CONFIG_SYS_FPGA_WAIT
+#define CONFIG_SYS_FPGA_WAIT CONFIG_SYS_HZ/10		/* 100 ms */
 #endif
 
 static int ACEX1K_ps_load( Altera_desc *desc, void *buf, size_t bsize );
@@ -154,7 +154,7 @@
 				"done:\t0x%p\n\n",
 				__FUNCTION__, &fn, fn, fn->config, fn->status,
 				fn->clk, fn->data, fn->done);
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		printf ("Loading FPGA Device %d...", cookie);
 #endif
 
@@ -185,7 +185,7 @@
 		ts = get_timer (0);		/* get current time */
 		do {
 			CONFIG_FPGA_DELAY ();
-			if (get_timer (ts) > CFG_FPGA_WAIT) {	/* check the time */
+			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {	/* check the time */
 				puts ("** Timeout waiting for STATUS to go high.\n");
 				(*fn->abort) (cookie);
 				return FPGA_FAIL;
@@ -199,7 +199,7 @@
 		/* Load the data */
 		while (bytecount < bsize) {
 			unsigned char val=0;
-#ifdef CFG_FPGA_CHECK_CTRLC
+#ifdef CONFIG_SYS_FPGA_CHECK_CTRLC
 			if (ctrlc ()) {
 				(*fn->abort) (cookie);
 				return FPGA_FAIL;
@@ -230,7 +230,7 @@
 				i --;
 			} while (i > 0);
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 			if (bytecount % (bsize / 40) == 0)
 				putc ('.');		/* let them know we are alive */
 #endif
@@ -238,7 +238,7 @@
 
 		CONFIG_FPGA_DELAY ();
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		putc (' ');			/* terminate the dotted line */
 #endif
 
@@ -265,7 +265,7 @@
 
 	ret_val = FPGA_SUCCESS;
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		if (ret_val == FPGA_SUCCESS) {
 			puts ("Done.\n");
 		}
diff --git a/common/cmd_autoscript.c b/common/cmd_autoscript.c
index 0439da2..4517ac8 100644
--- a/common/cmd_autoscript.c
+++ b/common/cmd_autoscript.c
@@ -43,7 +43,7 @@
 #if defined(CONFIG_8xx)
 #include <mpc8xx.h>
 #endif
-#ifdef CFG_HUSH_PARSER
+#ifdef CONFIG_SYS_HUSH_PARSER
 #include <hush.h>
 #endif
 
@@ -164,7 +164,7 @@
 	memmove (cmd, (char *)data, len);
 	*(cmd + len) = 0;
 
-#ifdef CFG_HUSH_PARSER /*?? */
+#ifdef CONFIG_SYS_HUSH_PARSER /*?? */
 	rcode = parse_string_outer (cmd, FLAG_PARSE_SEMICOLON);
 #else
 	{
@@ -211,7 +211,7 @@
 
 	/* Find script image */
 	if (argc < 2) {
-		addr = CFG_LOAD_ADDR;
+		addr = CONFIG_SYS_LOAD_ADDR;
 		debug ("*  autoscr: default load address = 0x%08lx\n", addr);
 #if defined(CONFIG_FIT)
 	} else if (fit_parse_subimage (argv[1], load_addr, &addr, &fit_uname)) {
diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index 5018930..6675241 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -178,7 +178,7 @@
 	print_num ("flash size",	(ulong)bd->bi_flashsize);
 	print_num ("flash offset",	(ulong)bd->bi_flashoffset);
 
-#if defined(CFG_SRAM_BASE)
+#if defined(CONFIG_SYS_SRAM_BASE)
 	print_num ("sram start",	(ulong)bd->bi_sramstart);
 	print_num ("sram size",		(ulong)bd->bi_sramsize);
 #endif
@@ -207,7 +207,7 @@
 	print_num ("flash start    ",	(ulong)bd->bi_flashstart);
 	print_num ("flash size     ",	(ulong)bd->bi_flashsize);
 	print_num ("flash offset   ",	(ulong)bd->bi_flashoffset);
-#if defined(CFG_SRAM_BASE)
+#if defined(CONFIG_SYS_SRAM_BASE)
 	print_num ("sram start     ",	(ulong)bd->bi_sramstart);
 	print_num ("sram size      ",	(ulong)bd->bi_sramsize);
 #endif
@@ -237,18 +237,18 @@
 	print_num("memstart               ", bd->bi_memstart);
 	print_lnum("memsize                ", bd->bi_memsize);
 	print_num("flashstart             ", bd->bi_flashstart);
-	print_num("CFG_MONITOR_BASE       ", CFG_MONITOR_BASE);
+	print_num("CONFIG_SYS_MONITOR_BASE       ", CONFIG_SYS_MONITOR_BASE);
 	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,
-	       CFG_MALLOC_LEN);
-	printf("CFG_INIT_SP_OFFSET     = 0x%lx (%d)\n", CFG_INIT_SP_OFFSET,
-	       CFG_STACK_SIZE);
-	printf("CFG_PROM_OFFSET        = 0x%lx (%d)\n", CFG_PROM_OFFSET,
-	       CFG_PROM_SIZE);
-	printf("CFG_GBL_DATA_OFFSET    = 0x%lx (%d)\n", CFG_GBL_DATA_OFFSET,
-	       CFG_GBL_DATA_SIZE);
+	printf("CONFIG_SYS_RELOC_MONITOR_BASE = 0x%lx (%d)\n", CONFIG_SYS_RELOC_MONITOR_BASE,
+	       CONFIG_SYS_MONITOR_LEN);
+	printf("CONFIG_SYS_MALLOC_BASE        = 0x%lx (%d)\n", CONFIG_SYS_MALLOC_BASE,
+	       CONFIG_SYS_MALLOC_LEN);
+	printf("CONFIG_SYS_INIT_SP_OFFSET     = 0x%lx (%d)\n", CONFIG_SYS_INIT_SP_OFFSET,
+	       CONFIG_SYS_STACK_SIZE);
+	printf("CONFIG_SYS_PROM_OFFSET        = 0x%lx (%d)\n", CONFIG_SYS_PROM_OFFSET,
+	       CONFIG_SYS_PROM_SIZE);
+	printf("CONFIG_SYS_GBL_DATA_OFFSET    = 0x%lx (%d)\n", CONFIG_SYS_GBL_DATA_OFFSET,
+	       CONFIG_SYS_GBL_DATA_SIZE);
 
 #if defined(CONFIG_CMD_NET)
 	puts("ethaddr                =");
@@ -276,11 +276,11 @@
 	print_num ("flashstart",	(ulong)bd->bi_flashstart);
 	print_num ("flashsize",		(ulong)bd->bi_flashsize);
 	print_num ("flashoffset",	(ulong)bd->bi_flashoffset);
-#if defined(CFG_INIT_RAM_ADDR)
+#if defined(CONFIG_SYS_INIT_RAM_ADDR)
 	print_num ("sramstart",		(ulong)bd->bi_sramstart);
 	print_num ("sramsize",		(ulong)bd->bi_sramsize);
 #endif
-#if defined(CFG_MBAR)
+#if defined(CONFIG_SYS_MBAR)
 	print_num ("mbar",		bd->bi_mbar_base);
 #endif
 	print_str ("busfreq",		strmhz(buf, bd->bi_busfreq));
diff --git a/common/cmd_bedbug.c b/common/cmd_bedbug.c
index 94f7e08..3e597f9 100644
--- a/common/cmd_bedbug.c
+++ b/common/cmd_bedbug.c
@@ -218,7 +218,7 @@
 	int flag;		/* Command flags          */
 	int rc = 0;		/* Result from run_command */
 	char prompt_str[20];	/* Prompt string          */
-	static char lastcommand[CFG_CBSIZE] = { 0 };	/* previous command */
+	static char lastcommand[CONFIG_SYS_CBSIZE] = { 0 };	/* previous command */
 	/* -------------------------------------------------- */
 
 	if (bug_ctx.clear)
diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c
index 197e5e8..bc08b26 100644
--- a/common/cmd_bmp.c
+++ b/common/cmd_bmp.c
@@ -55,19 +55,19 @@
 	/*
 	 * Decompress bmp image
 	 */
-	len = CFG_VIDEO_LOGO_MAX_SIZE;
-	dst = malloc(CFG_VIDEO_LOGO_MAX_SIZE);
+	len = CONFIG_SYS_VIDEO_LOGO_MAX_SIZE;
+	dst = malloc(CONFIG_SYS_VIDEO_LOGO_MAX_SIZE);
 	if (dst == NULL) {
 		puts("Error: malloc in gunzip failed!\n");
 		return NULL;
 	}
-	if (gunzip(dst, CFG_VIDEO_LOGO_MAX_SIZE, (uchar *)addr, &len) != 0) {
+	if (gunzip(dst, CONFIG_SYS_VIDEO_LOGO_MAX_SIZE, (uchar *)addr, &len) != 0) {
 		free(dst);
 		return NULL;
 	}
-	if (len == CFG_VIDEO_LOGO_MAX_SIZE)
+	if (len == CONFIG_SYS_VIDEO_LOGO_MAX_SIZE)
 		puts("Image could be truncated"
-				" (increase CFG_VIDEO_LOGO_MAX_SIZE)!\n");
+				" (increase CONFIG_SYS_VIDEO_LOGO_MAX_SIZE)!\n");
 
 	bmp = dst;
 
diff --git a/common/cmd_boot.c b/common/cmd_boot.c
index d83f5af..6024ffe 100644
--- a/common/cmd_boot.c
+++ b/common/cmd_boot.c
@@ -63,7 +63,7 @@
 /* -------------------------------------------------------------------- */
 
 U_BOOT_CMD(
-	go, CFG_MAXARGS, 1,	do_go,
+	go, CONFIG_SYS_MAXARGS, 1,	do_go,
 	"go      - start application at address 'addr'\n",
 	"addr [arg ...]\n    - start application at address 'addr'\n"
 	"      passing 'arg' as arguments\n"
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 897e9f6..2a9c59f 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -40,7 +40,7 @@
 #include <usb.h>
 #endif
 
-#ifdef CFG_HUSH_PARSER
+#ifdef CONFIG_SYS_HUSH_PARSER
 #include <hush.h>
 #endif
 
@@ -60,8 +60,8 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 extern int gunzip (void *dst, int dstlen, unsigned char *src, unsigned long *lenp);
-#ifndef CFG_BOOTM_LEN
-#define CFG_BOOTM_LEN	0x800000	/* use 8MByte as default max gunzip size */
+#ifndef CONFIG_SYS_BOOTM_LEN
+#define CONFIG_SYS_BOOTM_LEN	0x800000	/* use 8MByte as default max gunzip size */
 #endif
 
 #ifdef CONFIG_BZIP2
@@ -119,7 +119,7 @@
 static boot_os_fn do_bootm_integrity;
 #endif
 
-ulong load_addr = CFG_LOAD_ADDR;	/* Default Load Address */
+ulong load_addr = CONFIG_SYS_LOAD_ADDR;	/* Default Load Address */
 static bootm_headers_t images;		/* pointers to os/initrd/fdt images */
 
 void __board_lmb_reserve(struct lmb *lmb)
@@ -289,7 +289,7 @@
 	ulong blob_end = os.end;
 	ulong image_start = os.image_start;
 	ulong image_len = os.image_len;
-	uint unc_len = CFG_BOOTM_LEN;
+	uint unc_len = CONFIG_SYS_BOOTM_LEN;
 
 	const char *type_name = genimg_get_type_name (os.type);
 
@@ -329,7 +329,7 @@
 		 */
 		int i = BZ2_bzBuffToBuffDecompress ((char*)load,
 					&unc_len, (char *)image_start, image_len,
-					CFG_MALLOC_LEN < (4096 * 1024), 0);
+					CONFIG_SYS_MALLOC_LEN < (4096 * 1024), 0);
 		if (i != BZ_OK) {
 			printf ("BUNZIP2: uncompress or overwrite error %d "
 				"- must RESET board to recover\n", i);
@@ -762,7 +762,7 @@
 }
 
 U_BOOT_CMD(
-	bootm,	CFG_MAXARGS,	1,	do_bootm,
+	bootm,	CONFIG_SYS_MAXARGS,	1,	do_bootm,
 	"bootm   - boot application image from memory\n",
 	"[addr [arg ...]]\n    - boot application image stored in memory\n"
 	"\tpassing arguments 'arg ...'; when booting a Linux kernel,\n"
@@ -792,7 +792,7 @@
 {
 	int rcode = 0;
 
-#ifndef CFG_HUSH_PARSER
+#ifndef CONFIG_SYS_HUSH_PARSER
 	if (run_command (getenv ("bootcmd"), flag) < 0)
 		rcode = 1;
 #else
@@ -896,7 +896,7 @@
 }
 
 U_BOOT_CMD(
-	iminfo,	CFG_MAXARGS,	1,	do_iminfo,
+	iminfo,	CONFIG_SYS_MAXARGS,	1,	do_iminfo,
 	"iminfo  - print header information for application image\n",
 	"addr [addr ...]\n"
 	"    - print header information for application image starting at\n"
@@ -917,7 +917,7 @@
 	void *hdr;
 
 	for (i = 0, info = &flash_info[0];
-		i < CFG_MAX_FLASH_BANKS; ++i, ++info) {
+		i < CONFIG_SYS_MAX_FLASH_BANKS; ++i, ++info) {
 
 		if (info->flash_id == FLASH_UNKNOWN)
 			goto next_bank;
diff --git a/common/cmd_date.c b/common/cmd_date.c
index d6cd565..b4d9649 100644
--- a/common/cmd_date.c
+++ b/common/cmd_date.c
@@ -47,7 +47,7 @@
 
 	/* switch to correct I2C bus */
 	old_bus = I2C_GET_BUS();
-	I2C_SET_BUS(CFG_RTC_BUS_NUM);
+	I2C_SET_BUS(CONFIG_SYS_RTC_BUS_NUM);
 
 	switch (argc) {
 	case 2:			/* set date & time */
diff --git a/common/cmd_diag.c b/common/cmd_diag.c
index 82d5ad3..13d4225 100644
--- a/common/cmd_diag.c
+++ b/common/cmd_diag.c
@@ -65,7 +65,7 @@
 /***************************************************/
 
 U_BOOT_CMD(
-	diag,	CFG_MAXARGS,	0,	do_diag,
+	diag,	CONFIG_SYS_MAXARGS,	0,	do_diag,
 	"diag    - perform board diagnostics\n",
 	     "    - print list of available tests\n"
 	"diag [test1 [test2]]\n"
diff --git a/common/cmd_display.c b/common/cmd_display.c
index a29345c..982e09d 100644
--- a/common/cmd_display.c
+++ b/common/cmd_display.c
@@ -36,7 +36,7 @@
 	int pos;
 
 	/* Clear display */
-	*((volatile char*)(CFG_DISP_CWORD)) = CWORD_CLEAR;
+	*((volatile char*)(CONFIG_SYS_DISP_CWORD)) = CWORD_CLEAR;
 	udelay(1000 * CLEAR_DELAY);
 
 	if (argc < 2)
@@ -46,14 +46,14 @@
 		char *p = argv[i], c;
 
 		if (i > 1) {
-			*((volatile uchar *) (CFG_DISP_CHR_RAM + pos++)) = ' ';
+			*((volatile uchar *) (CONFIG_SYS_DISP_CHR_RAM + pos++)) = ' ';
 #ifdef DEBUG_DISP
 			putc(' ');
 #endif
 		}
 
 		while ((c = *p++) != '\0' && pos < DISP_SIZE) {
-			*((volatile uchar *) (CFG_DISP_CHR_RAM + pos++)) = c;
+			*((volatile uchar *) (CONFIG_SYS_DISP_CHR_RAM + pos++)) = c;
 #ifdef DEBUG_DISP
 			putc(c);
 #endif
@@ -70,7 +70,7 @@
 /***************************************************/
 
 U_BOOT_CMD(
-	display,	CFG_MAXARGS,	1,	do_display,
+	display,	CONFIG_SYS_MAXARGS,	1,	do_display,
 	"display- display string on dot matrix display\n",
 	"[<string>]\n"
 	"    - with <string> argument: display <string> on dot matrix display\n"
diff --git a/common/cmd_doc.c b/common/cmd_doc.c
index a55ca41..02502cc 100644
--- a/common/cmd_doc.c
+++ b/common/cmd_doc.c
@@ -20,19 +20,19 @@
  * TODO: must be implemented and tested by someone with HW
  */
 #if 0
-#ifdef CFG_DOC_SUPPORT_2000
+#ifdef CONFIG_SYS_DOC_SUPPORT_2000
 #define DoC_is_2000(doc) (doc->ChipID == DOC_ChipID_Doc2k)
 #else
 #define DoC_is_2000(doc) (0)
 #endif
 
-#ifdef CFG_DOC_SUPPORT_MILLENNIUM
+#ifdef CONFIG_SYS_DOC_SUPPORT_MILLENNIUM
 #define DoC_is_Millennium(doc) (doc->ChipID == DOC_ChipID_DocMil)
 #else
 #define DoC_is_Millennium(doc) (0)
 #endif
 
-/* CFG_DOC_PASSIVE_PROBE:
+/* CONFIG_SYS_DOC_PASSIVE_PROBE:
    In order to ensure that the BIOS checksum is correct at boot time, and
    hence that the onboard BIOS extension gets executed, the DiskOnChip
    goes into reset mode when it is read sequentially: all registers
@@ -48,7 +48,7 @@
    the machine.
 
    If you have this problem, uncomment the following line:
-#define CFG_DOC_PASSIVE_PROBE
+#define CONFIG_SYS_DOC_PASSIVE_PROBE
 */
 
 #undef	DOC_DEBUG
@@ -56,7 +56,7 @@
 #undef	PSYCHO_DEBUG
 #undef	NFTL_DEBUG
 
-static struct DiskOnChip doc_dev_desc[CFG_MAX_DOC_DEVICE];
+static struct DiskOnChip doc_dev_desc[CONFIG_SYS_MAX_DOC_DEVICE];
 
 /* Current DOC Device	*/
 static int curr_device = -1;
@@ -104,7 +104,7 @@
 
 		putc ('\n');
 
-		for (i=0; i<CFG_MAX_DOC_DEVICE; ++i) {
+		for (i=0; i<CONFIG_SYS_MAX_DOC_DEVICE; ++i) {
 			if(doc_dev_desc[i].ChipID == DOC_ChipID_UNKNOWN)
 				continue; /* list only known devices */
 			printf ("Device %d: ", i);
@@ -113,7 +113,7 @@
 		return 0;
 
 	} else if (strcmp(argv[1],"device") == 0) {
-		if ((curr_device < 0) || (curr_device >= CFG_MAX_DOC_DEVICE)) {
+		if ((curr_device < 0) || (curr_device >= CONFIG_SYS_MAX_DOC_DEVICE)) {
 			puts ("\nno devices available\n");
 			return 1;
 		}
@@ -128,7 +128,7 @@
 		int dev = (int)simple_strtoul(argv[2], NULL, 10);
 
 		printf ("\nDevice %d: ", dev);
-		if (dev >= CFG_MAX_DOC_DEVICE) {
+		if (dev >= CONFIG_SYS_MAX_DOC_DEVICE) {
 			puts ("unknown device\n");
 			return 1;
 		}
@@ -218,7 +218,7 @@
 	show_boot_progress (34);
 	switch (argc) {
 	case 1:
-		addr = CFG_LOAD_ADDR;
+		addr = CONFIG_SYS_LOAD_ADDR;
 		boot_device = getenv ("bootdevice");
 		break;
 	case 2:
@@ -250,7 +250,7 @@
 
 	dev = simple_strtoul(boot_device, &ep, 16);
 
-	if ((dev >= CFG_MAX_DOC_DEVICE) ||
+	if ((dev >= CONFIG_SYS_MAX_DOC_DEVICE) ||
 	    (doc_dev_desc[dev].ChipID == DOC_ChipID_UNKNOWN)) {
 		printf ("\n** Device %d not available\n", dev);
 		show_boot_progress (-37);
@@ -439,7 +439,7 @@
 
 	/* Out-of-line routine to wait for chip response */
 	while (!(ReadDOC(docptr, CDSNControl) & CDSN_CTRL_FR_B)) {
-#ifdef CFG_DOC_SHORT_TIMEOUT
+#ifdef CONFIG_SYS_DOC_SHORT_TIMEOUT
 		/* it seems that after a certain time the DoC deasserts
 		 * the CDSN_CTRL_FR_B although it is not ready...
 		 * using a short timout solve this (timer increments every ms) */
@@ -1525,12 +1525,12 @@
 
 	/* Routine copied from the Linux DOC driver */
 
-#ifdef CFG_DOCPROBE_55AA
+#ifdef CONFIG_SYS_DOCPROBE_55AA
 	/* Check for 0x55 0xAA signature at beginning of window,
 	   this is no longer true once we remove the IPL (for Millennium */
 	if (ReadDOC(window, Sig1) != 0x55 || ReadDOC(window, Sig2) != 0xaa)
 		return 0;
-#endif /* CFG_DOCPROBE_55AA */
+#endif /* CONFIG_SYS_DOCPROBE_55AA */
 
 #ifndef DOC_PASSIVE_PROBE
 	/* It's not possible to cleanly detect the DiskOnChip - the
@@ -1574,7 +1574,7 @@
 		break;
 
 	default:
-#ifndef CFG_DOCPROBE_55AA
+#ifndef CONFIG_SYS_DOCPROBE_55AA
 /*
  * if the ID isn't the DoC2000 or DoCMillenium ID, so we can assume
  * the DOC is missing
@@ -1609,7 +1609,7 @@
 
 	if ((ChipID = doccheck(physadr, physadr))) {
 
-		for (i=0; i<CFG_MAX_DOC_DEVICE; i++) {
+		for (i=0; i<CONFIG_SYS_MAX_DOC_DEVICE; i++) {
 			if (doc_dev_desc[i].ChipID == DOC_ChipID_UNKNOWN) {
 				this = doc_dev_desc + i;
 				break;
diff --git a/common/cmd_dtt.c b/common/cmd_dtt.c
index 956dc69..c5b1d4d 100644
--- a/common/cmd_dtt.c
+++ b/common/cmd_dtt.c
@@ -36,7 +36,7 @@
 
 	/* switch to correct I2C bus */
 	old_bus = I2C_GET_BUS();
-	I2C_SET_BUS(CFG_DTT_BUS_NUM);
+	I2C_SET_BUS(CONFIG_SYS_DTT_BUS_NUM);
 
 	/*
 	 * Loop through sensors, read
diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c
index 44d44fe..2451bef 100644
--- a/common/cmd_eeprom.c
+++ b/common/cmd_eeprom.c
@@ -32,8 +32,8 @@
  * Use the following configuration options to ensure no unneeded performance
  * degradation (typical for EEPROM) is incured for FRAM memory:
  *
- * #define CFG_I2C_FRAM
- * #undef CFG_EEPROM_PAGE_WRITE_DELAY_MS
+ * #define CONFIG_SYS_I2C_FRAM
+ * #undef CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS
  *
  */
 
@@ -47,12 +47,12 @@
 			  uchar *buffer, unsigned cnt);
 extern int  eeprom_write (unsigned dev_addr, unsigned offset,
 			  uchar *buffer, unsigned cnt);
-#if defined(CFG_EEPROM_WREN)
+#if defined(CONFIG_SYS_EEPROM_WREN)
 extern int eeprom_write_enable (unsigned dev_addr, int state);
 #endif
 
 
-#if defined(CFG_EEPROM_X40430)
+#if defined(CONFIG_SYS_EEPROM_X40430)
 	/* Maximum number of times to poll for acknowledge after write */
 #define MAX_ACKNOWLEDGE_POLLS	10
 #endif
@@ -65,7 +65,7 @@
 	const char *const fmt =
 		"\nEEPROM @0x%lX %s: addr %08lx  off %04lx  count %ld ... ";
 
-#if defined(CFG_I2C_MULTI_EEPROMS)
+#if defined(CONFIG_SYS_I2C_MULTI_EEPROMS)
 	if (argc == 6) {
 		ulong dev_addr = simple_strtoul (argv[2], NULL, 16);
 		ulong addr = simple_strtoul (argv[3], NULL, 16);
@@ -73,11 +73,11 @@
 		ulong cnt  = simple_strtoul (argv[5], NULL, 16);
 #else
 	if (argc == 5) {
-		ulong dev_addr = CFG_DEF_EEPROM_ADDR;
+		ulong dev_addr = CONFIG_SYS_DEF_EEPROM_ADDR;
 		ulong addr = simple_strtoul (argv[2], NULL, 16);
 		ulong off  = simple_strtoul (argv[3], NULL, 16);
 		ulong cnt  = simple_strtoul (argv[4], NULL, 16);
-#endif /* CFG_I2C_MULTI_EEPROMS */
+#endif /* CONFIG_SYS_I2C_MULTI_EEPROMS */
 
 # ifndef CONFIG_SPI
 		eeprom_init ();
@@ -111,16 +111,16 @@
 
 /*-----------------------------------------------------------------------
  *
- * for CFG_I2C_EEPROM_ADDR_LEN == 2 (16-bit EEPROM address) offset is
+ * for CONFIG_SYS_I2C_EEPROM_ADDR_LEN == 2 (16-bit EEPROM address) offset is
  *   0x000nxxxx for EEPROM address selectors at n, offset xxxx in EEPROM.
  *
- * for CFG_I2C_EEPROM_ADDR_LEN == 1 (8-bit EEPROM page address) offset is
+ * for CONFIG_SYS_I2C_EEPROM_ADDR_LEN == 1 (8-bit EEPROM page address) offset is
  *   0x00000nxx for EEPROM address selectors and page number at n.
  */
 
 #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
+#if !defined(CONFIG_SYS_I2C_EEPROM_ADDR_LEN) || CONFIG_SYS_I2C_EEPROM_ADDR_LEN < 1 || CONFIG_SYS_I2C_EEPROM_ADDR_LEN > 2
+#error CONFIG_SYS_I2C_EEPROM_ADDR_LEN must be 1 or 2
 #endif
 #endif
 
@@ -136,11 +136,11 @@
 	 */
 	while (offset < end) {
 		unsigned alen, len;
-#if !defined(CFG_I2C_FRAM)
+#if !defined(CONFIG_SYS_I2C_FRAM)
 		unsigned maxlen;
 #endif
 
-#if CFG_I2C_EEPROM_ADDR_LEN == 1 && !defined(CONFIG_SPI_X)
+#if CONFIG_SYS_I2C_EEPROM_ADDR_LEN == 1 && !defined(CONFIG_SPI_X)
 		uchar addr[2];
 
 		blk_off = offset & 0xFF;	/* block offset */
@@ -157,7 +157,7 @@
 		addr[1] = offset >>  8;		/* upper address octet */
 		addr[2] = blk_off;		/* lower address octet */
 		alen	= 3;
-#endif	/* CFG_I2C_EEPROM_ADDR_LEN, CONFIG_SPI_X */
+#endif	/* CONFIG_SYS_I2C_EEPROM_ADDR_LEN, CONFIG_SPI_X */
 
 		addr[0] |= dev_addr;		/* insert device address */
 
@@ -168,7 +168,7 @@
 		 * bytes that can be ccessed with the single read or write
 		 * operation.
 		 */
-#if !defined(CFG_I2C_FRAM)
+#if !defined(CONFIG_SYS_I2C_FRAM)
 		maxlen = 0x100 - blk_off;
 		if (maxlen > I2C_RXTX_LEN)
 			maxlen = I2C_RXTX_LEN;
@@ -191,10 +191,10 @@
 
 /*-----------------------------------------------------------------------
  *
- * for CFG_I2C_EEPROM_ADDR_LEN == 2 (16-bit EEPROM address) offset is
+ * for CONFIG_SYS_I2C_EEPROM_ADDR_LEN == 2 (16-bit EEPROM address) offset is
  *   0x000nxxxx for EEPROM address selectors at n, offset xxxx in EEPROM.
  *
- * for CFG_I2C_EEPROM_ADDR_LEN == 1 (8-bit EEPROM page address) offset is
+ * for CONFIG_SYS_I2C_EEPROM_ADDR_LEN == 1 (8-bit EEPROM page address) offset is
  *   0x00000nxx for EEPROM address selectors and page number at n.
  */
 
@@ -204,7 +204,7 @@
 	unsigned blk_off;
 	int rcode = 0;
 
-#if defined(CFG_EEPROM_X40430)
+#if defined(CONFIG_SYS_EEPROM_X40430)
 	uchar	contr_r_addr[2];
 	uchar	addr_void[2];
 	uchar	contr_reg[2];
@@ -212,7 +212,7 @@
 	int	i;
 #endif
 
-#if defined(CFG_EEPROM_WREN)
+#if defined(CONFIG_SYS_EEPROM_WREN)
 	eeprom_write_enable (dev_addr,1);
 #endif
 	/* Write data until done or would cross a write page boundary.
@@ -222,11 +222,11 @@
 
 	while (offset < end) {
 		unsigned alen, len;
-#if !defined(CFG_I2C_FRAM)
+#if !defined(CONFIG_SYS_I2C_FRAM)
 		unsigned maxlen;
 #endif
 
-#if CFG_I2C_EEPROM_ADDR_LEN == 1 && !defined(CONFIG_SPI_X)
+#if CONFIG_SYS_I2C_EEPROM_ADDR_LEN == 1 && !defined(CONFIG_SPI_X)
 		uchar addr[2];
 
 		blk_off = offset & 0xFF;	/* block offset */
@@ -243,7 +243,7 @@
 		addr[1] = offset >>  8;		/* upper address octet */
 		addr[2] = blk_off;		/* lower address octet */
 		alen	= 3;
-#endif	/* CFG_I2C_EEPROM_ADDR_LEN, CONFIG_SPI_X */
+#endif	/* CONFIG_SYS_I2C_EEPROM_ADDR_LEN, CONFIG_SPI_X */
 
 		addr[0] |= dev_addr;		/* insert device address */
 
@@ -254,11 +254,11 @@
 		 * bytes that can be ccessed with the single read or write
 		 * operation.
 		 */
-#if !defined(CFG_I2C_FRAM)
+#if !defined(CONFIG_SYS_I2C_FRAM)
 
-#if defined(CFG_EEPROM_PAGE_WRITE_BITS)
+#if defined(CONFIG_SYS_EEPROM_PAGE_WRITE_BITS)
 
-#define	EEPROM_PAGE_SIZE	(1 << CFG_EEPROM_PAGE_WRITE_BITS)
+#define	EEPROM_PAGE_SIZE	(1 << CONFIG_SYS_EEPROM_PAGE_WRITE_BITS)
 #define	EEPROM_PAGE_OFFSET(x)	((x) & (EEPROM_PAGE_SIZE - 1))
 
 		maxlen = EEPROM_PAGE_SIZE - EEPROM_PAGE_OFFSET(blk_off);
@@ -275,7 +275,7 @@
 #ifdef CONFIG_SPI
 		spi_write (addr, alen, buffer, len);
 #else
-#if defined(CFG_EEPROM_X40430)
+#if defined(CONFIG_SYS_EEPROM_X40430)
 		/* Get the value of the control register.
 		 * Set current address (internal pointer in the x40430)
 		 * to 0x1ff.
@@ -284,9 +284,9 @@
 		contr_r_addr[1] = 0xff;
 		addr_void[0]    = 0;
 		addr_void[1]    = addr[1];
-#ifdef CFG_I2C_EEPROM_ADDR
-		contr_r_addr[0] |= CFG_I2C_EEPROM_ADDR;
-		addr_void[0]    |= CFG_I2C_EEPROM_ADDR;
+#ifdef CONFIG_SYS_I2C_EEPROM_ADDR
+		contr_r_addr[0] |= CONFIG_SYS_I2C_EEPROM_ADDR;
+		addr_void[0]    |= CONFIG_SYS_I2C_EEPROM_ADDR;
 #endif
 		contr_reg[0] = 0xff;
 		if (i2c_read (contr_r_addr[0], contr_r_addr[1], 1, contr_reg, 1) != 0) {
@@ -334,8 +334,8 @@
 			for (i = 0; i < MAX_ACKNOWLEDGE_POLLS; i++) {
 				if (i2c_read (addr_void[0], addr_void[1], 1, contr_reg, 1) == 0)
 					break;	/* got ack */
-#if defined(CFG_EEPROM_PAGE_WRITE_DELAY_MS)
-				udelay(CFG_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
+#if defined(CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS)
+				udelay(CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
 #endif
 			}
 			if (i == MAX_ACKNOWLEDGE_POLLS) {
@@ -364,11 +364,11 @@
 		buffer += len;
 		offset += len;
 
-#if defined(CFG_EEPROM_PAGE_WRITE_DELAY_MS)
-		udelay(CFG_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
+#if defined(CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS)
+		udelay(CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
 #endif
 	}
-#if defined(CFG_EEPROM_WREN)
+#if defined(CONFIG_SYS_EEPROM_WREN)
 	eeprom_write_enable (dev_addr,0);
 #endif
 	return rcode;
@@ -382,11 +382,11 @@
 
 	/* Probe the chip address
 	 */
-#if CFG_I2C_EEPROM_ADDR_LEN == 1 && !defined(CONFIG_SPI_X)
+#if CONFIG_SYS_I2C_EEPROM_ADDR_LEN == 1 && !defined(CONFIG_SPI_X)
 	chip = offset >> 8;		/* block number */
 #else
 	chip = offset >> 16;		/* block number */
-#endif	/* CFG_I2C_EEPROM_ADDR_LEN, CONFIG_SPI_X */
+#endif	/* CONFIG_SYS_I2C_EEPROM_ADDR_LEN, CONFIG_SPI_X */
 
 	chip |= dev_addr;		/* insert device address */
 
@@ -397,12 +397,12 @@
 /*-----------------------------------------------------------------------
  * Set default values
  */
-#ifndef	CFG_I2C_SPEED
-#define	CFG_I2C_SPEED	50000
+#ifndef	CONFIG_SYS_I2C_SPEED
+#define	CONFIG_SYS_I2C_SPEED	50000
 #endif
 
-#ifndef	CFG_I2C_SLAVE
-#define	CFG_I2C_SLAVE	0xFE
+#ifndef	CONFIG_SYS_I2C_SLAVE
+#define	CONFIG_SYS_I2C_SLAVE	0xFE
 #endif
 
 void eeprom_init  (void)
@@ -412,7 +412,7 @@
 #endif
 #if defined(CONFIG_HARD_I2C) || \
     defined(CONFIG_SOFT_I2C)
-	i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
+	i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
 #endif
 }
 /*-----------------------------------------------------------------------
@@ -422,7 +422,7 @@
 
 #if defined(CONFIG_CMD_EEPROM)
 
-#ifdef CFG_I2C_MULTI_EEPROMS
+#ifdef CONFIG_SYS_I2C_MULTI_EEPROMS
 U_BOOT_CMD(
 	eeprom,	6,	1,	do_eeprom,
 	"eeprom  - EEPROM sub-system\n",
@@ -438,6 +438,6 @@
 	"eeprom write addr off cnt\n"
 	"       - read/write `cnt' bytes at EEPROM offset `off'\n"
 );
-#endif /* CFG_I2C_MULTI_EEPROMS */
+#endif /* CONFIG_SYS_I2C_MULTI_EEPROMS */
 
 #endif
diff --git a/common/cmd_elf.c b/common/cmd_elf.c
index 62e5e76..3ebb6d9 100644
--- a/common/cmd_elf.c
+++ b/common/cmd_elf.c
@@ -19,7 +19,7 @@
 #include <net.h>
 #include <elf.h>
 
-#if defined(CONFIG_WALNUT) || defined(CFG_VXWORKS_MAC_PTR)
+#if defined(CONFIG_WALNUT) || defined(CONFIG_SYS_VXWORKS_MAC_PTR)
 DECLARE_GLOBAL_DATA_PTR;
 #endif
 
@@ -135,10 +135,10 @@
 	 */
 
 #if defined(CONFIG_WALNUT)
-	tmp = (char *) CFG_NVRAM_BASE_ADDR + 0x500;
+	tmp = (char *) CONFIG_SYS_NVRAM_BASE_ADDR + 0x500;
 	memcpy ((char *) tmp, (char *) &gd->bd->bi_enetaddr[3], 3);
-#elif defined(CFG_VXWORKS_MAC_PTR)
-	tmp = (char *) CFG_VXWORKS_MAC_PTR;
+#elif defined(CONFIG_SYS_VXWORKS_MAC_PTR)
+	tmp = (char *) CONFIG_SYS_VXWORKS_MAC_PTR;
 	memcpy ((char *) tmp, (char *) &gd->bd->bi_enetaddr[0], 6);
 #else
 	puts ("## Ethernet MAC address not copied to NV RAM\n");
diff --git a/common/cmd_ext2.c b/common/cmd_ext2.c
index cfd4f64..9c43792 100644
--- a/common/cmd_ext2.c
+++ b/common/cmd_ext2.c
@@ -142,7 +142,7 @@
 		if (addr_str != NULL) {
 			addr = simple_strtoul (addr_str, NULL, 16);
 		} else {
-			addr = CFG_LOAD_ADDR;
+			addr = CONFIG_SYS_LOAD_ADDR;
 		}
 		filename = getenv ("bootfile");
 		count = 0;
diff --git a/common/cmd_fat.c b/common/cmd_fat.c
index 9576cdf..ebe9e09 100644
--- a/common/cmd_fat.c
+++ b/common/cmd_fat.c
@@ -188,7 +188,7 @@
 	unsigned char *part_table;
 	unsigned char buffer[ATA_BLOCKSIZE];
 
-	for (i = 0; i < CFG_IDE_MAXDEVICE; i++) {
+	for (i = 0; i < CONFIG_SYS_IDE_MAXDEVICE; i++) {
 		dev_desc = ide_get_dev (i);
 		if (!dev_desc) {
 			debug ("couldn't get ide device!\n");
diff --git a/common/cmd_fdc.c b/common/cmd_fdc.c
index b663d60..d995ff2 100644
--- a/common/cmd_fdc.c
+++ b/common/cmd_fdc.c
@@ -170,17 +170,17 @@
 static FDC_COMMAND_STRUCT cmd; /* global command struct */
 
 /* If the boot drive number is undefined, we assume it's drive 0             */
-#ifndef CFG_FDC_DRIVE_NUMBER
-#define CFG_FDC_DRIVE_NUMBER 0
+#ifndef CONFIG_SYS_FDC_DRIVE_NUMBER
+#define CONFIG_SYS_FDC_DRIVE_NUMBER 0
 #endif
 
 /* Hardware access */
-#ifndef CFG_ISA_IO_STRIDE
-#define CFG_ISA_IO_STRIDE 1
+#ifndef CONFIG_SYS_ISA_IO_STRIDE
+#define CONFIG_SYS_ISA_IO_STRIDE 1
 #endif
 
-#ifndef CFG_ISA_IO_OFFSET
-#define CFG_ISA_IO_OFFSET 0
+#ifndef CONFIG_SYS_ISA_IO_OFFSET
+#define CONFIG_SYS_ISA_IO_OFFSET 0
 #endif
 
 
@@ -213,9 +213,9 @@
 unsigned char read_fdc_reg(unsigned int addr)
 {
 	volatile unsigned char *val =
-		(volatile unsigned char *)(CFG_ISA_IO_BASE_ADDRESS +
-					   (addr * CFG_ISA_IO_STRIDE) +
-					   CFG_ISA_IO_OFFSET);
+		(volatile unsigned char *)(CONFIG_SYS_ISA_IO_BASE_ADDRESS +
+					   (addr * CONFIG_SYS_ISA_IO_STRIDE) +
+					   CONFIG_SYS_ISA_IO_OFFSET);
 
 	return val [0];
 }
@@ -224,9 +224,9 @@
 void write_fdc_reg(unsigned int addr, unsigned char val)
 {
 	volatile unsigned char *tmp =
-		(volatile unsigned char *)(CFG_ISA_IO_BASE_ADDRESS +
-					   (addr * CFG_ISA_IO_STRIDE) +
-					   CFG_ISA_IO_OFFSET);
+		(volatile unsigned char *)(CONFIG_SYS_ISA_IO_BASE_ADDRESS +
+					   (addr * CONFIG_SYS_ISA_IO_STRIDE) +
+					   CONFIG_SYS_ISA_IO_OFFSET);
 	tmp[0]=val;
 }
 
@@ -652,7 +652,7 @@
 	i8259_unmask_irq(6);
 #endif
 
-#ifdef CFG_FDC_HW_INIT
+#ifdef CONFIG_SYS_FDC_HW_INIT
 	fdc_hw_init ();
 #endif
 	/* first, we reset the FDC via the DOR */
@@ -789,12 +789,12 @@
 
 	switch (argc) {
 	case 1:
-		addr = CFG_LOAD_ADDR;
-		boot_drive=CFG_FDC_DRIVE_NUMBER;
+		addr = CONFIG_SYS_LOAD_ADDR;
+		boot_drive=CONFIG_SYS_FDC_DRIVE_NUMBER;
 		break;
 	case 2:
 		addr = simple_strtoul(argv[1], NULL, 16);
-		boot_drive=CFG_FDC_DRIVE_NUMBER;
+		boot_drive=CONFIG_SYS_FDC_DRIVE_NUMBER;
 		break;
 	case 3:
 		addr = simple_strtoul(argv[1], NULL, 16);
diff --git a/common/cmd_fdos.c b/common/cmd_fdos.c
index b3dbd19..aa13b52 100644
--- a/common/cmd_fdos.c
+++ b/common/cmd_fdos.c
@@ -42,7 +42,7 @@
     int size;
     int rcode = 0;
     char buf [12];
-    int drive = CFG_FDC_DRIVE_NUMBER;
+    int drive = CONFIG_SYS_FDC_DRIVE_NUMBER;
 
     /* pre-set load_addr */
     if ((ep = getenv("loadaddr")) != NULL) {
@@ -118,7 +118,7 @@
 int do_fdosls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
     char *path = "";
-    int drive = CFG_FDC_DRIVE_NUMBER;
+    int drive = CONFIG_SYS_FDC_DRIVE_NUMBER;
 
     switch (argc) {
     case 1:
diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index 288a5c4..4274a77 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -364,7 +364,7 @@
 	} else if (strncmp(argv[1], "me", 2) == 0) {
 		uint64_t addr, size;
 		int err;
-#ifdef CFG_64BIT_STRTOUL
+#ifdef CONFIG_SYS_64BIT_STRTOUL
 			addr = simple_strtoull(argv[2], NULL, 16);
 			size = simple_strtoull(argv[3], NULL, 16);
 #else
@@ -402,7 +402,7 @@
 		} else if (argv[2][0] == 'a') {
 			uint64_t addr, size;
 			int err;
-#ifdef CFG_64BIT_STRTOUL
+#ifdef CONFIG_SYS_64BIT_STRTOUL
 			addr = simple_strtoull(argv[3], NULL, 16);
 			size = simple_strtoull(argv[4], NULL, 16);
 #else
diff --git a/common/cmd_flash.c b/common/cmd_flash.c
index 29e5b6d9..93eefa9 100644
--- a/common/cmd_flash.c
+++ b/common/cmd_flash.c
@@ -41,7 +41,7 @@
 		u8 *part_num, struct part_info **part);
 #endif
 
-#ifndef CFG_NO_FLASH
+#ifndef CONFIG_SYS_NO_FLASH
 extern flash_info_t flash_info[];	/* info for FLASH chips */
 
 /*
@@ -76,7 +76,7 @@
 
 	bank = simple_strtoul (str, &ep, 10);
 	if (ep == str || *ep != '\0' ||
-		bank < 1 || bank > CFG_MAX_FLASH_BANKS ||
+		bank < 1 || bank > CONFIG_SYS_MAX_FLASH_BANKS ||
 		(fp = &flash_info[bank - 1])->flash_id == FLASH_UNKNOWN)
 		return -1;
 
@@ -116,7 +116,7 @@
 
 	/* find the end addr of the sector where the *addr is */
 	found = 0;
-	for (bank = 0; bank < CFG_MAX_FLASH_BANKS && !found; ++bank) {
+	for (bank = 0; bank < CONFIG_SYS_MAX_FLASH_BANKS && !found; ++bank) {
 		info = &flash_info[bank];
 		for (i = 0; i < info->sector_count && !found; ++i) {
 			/* get the end address of the sector */
@@ -214,13 +214,13 @@
 
 	*s_count = 0;
 
-	for (bank=0; bank < CFG_MAX_FLASH_BANKS; ++bank) {
+	for (bank=0; bank < CONFIG_SYS_MAX_FLASH_BANKS; ++bank) {
 		s_first[bank] = -1;	/* first sector to erase	*/
 		s_last [bank] = -1;	/* last  sector to erase	*/
 	}
 
 	for (bank=0,info = &flash_info[0];
-	     (bank < CFG_MAX_FLASH_BANKS) && (addr_first <= addr_last);
+	     (bank < CONFIG_SYS_MAX_FLASH_BANKS) && (addr_first <= addr_last);
 	     ++bank, ++info) {
 		ulong b_end;
 		int sect;
@@ -285,11 +285,11 @@
 
 	return rcode;
 }
-#endif /* CFG_NO_FLASH */
+#endif /* CONFIG_SYS_NO_FLASH */
 
 int do_flinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
-#ifndef CFG_NO_FLASH
+#ifndef CONFIG_SYS_NO_FLASH
 	ulong bank;
 #endif
 
@@ -297,9 +297,9 @@
 	dataflash_print_info();
 #endif
 
-#ifndef CFG_NO_FLASH
+#ifndef CONFIG_SYS_NO_FLASH
 	if (argc == 1) {	/* print info for all FLASH banks */
-		for (bank=0; bank <CFG_MAX_FLASH_BANKS; ++bank) {
+		for (bank=0; bank <CONFIG_SYS_MAX_FLASH_BANKS; ++bank) {
 			printf ("\nBank # %ld: ", bank+1);
 
 			flash_print_info (&flash_info[bank]);
@@ -308,20 +308,20 @@
 	}
 
 	bank = simple_strtoul(argv[1], NULL, 16);
-	if ((bank < 1) || (bank > CFG_MAX_FLASH_BANKS)) {
+	if ((bank < 1) || (bank > CONFIG_SYS_MAX_FLASH_BANKS)) {
 		printf ("Only FLASH Banks # 1 ... # %d supported\n",
-			CFG_MAX_FLASH_BANKS);
+			CONFIG_SYS_MAX_FLASH_BANKS);
 		return 1;
 	}
 	printf ("\nBank # %ld: ", bank);
 	flash_print_info (&flash_info[bank-1]);
-#endif /* CFG_NO_FLASH */
+#endif /* CONFIG_SYS_NO_FLASH */
 	return 0;
 }
 
 int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
-#ifndef CFG_NO_FLASH
+#ifndef CONFIG_SYS_NO_FLASH
 	flash_info_t *info;
 	ulong bank, addr_first, addr_last;
 	int n, sect_first, sect_last;
@@ -338,7 +338,7 @@
 	}
 
 	if (strcmp(argv[1], "all") == 0) {
-		for (bank=1; bank<=CFG_MAX_FLASH_BANKS; ++bank) {
+		for (bank=1; bank<=CONFIG_SYS_MAX_FLASH_BANKS; ++bank) {
 			printf ("Erase Flash Bank # %ld ", bank);
 			info = &flash_info[bank-1];
 			rcode = flash_erase (info, 0, info->sector_count-1);
@@ -390,9 +390,9 @@
 
 	if (strcmp(argv[1], "bank") == 0) {
 		bank = simple_strtoul(argv[2], NULL, 16);
-		if ((bank < 1) || (bank > CFG_MAX_FLASH_BANKS)) {
+		if ((bank < 1) || (bank > CONFIG_SYS_MAX_FLASH_BANKS)) {
 			printf ("Only FLASH Banks # 1 ... # %d supported\n",
-				CFG_MAX_FLASH_BANKS);
+				CONFIG_SYS_MAX_FLASH_BANKS);
 			return 1;
 		}
 		printf ("Erase Flash Bank # %ld ", bank);
@@ -415,18 +415,18 @@
 	return rcode;
 #else
 	return 0;
-#endif /* CFG_NO_FLASH */
+#endif /* CONFIG_SYS_NO_FLASH */
 }
 
-#ifndef CFG_NO_FLASH
+#ifndef CONFIG_SYS_NO_FLASH
 int flash_sect_erase (ulong addr_first, ulong addr_last)
 {
 	flash_info_t *info;
 	ulong bank;
-#ifdef CFG_MAX_FLASH_BANKS_DETECT
-	int s_first[CFG_MAX_FLASH_BANKS_DETECT], s_last[CFG_MAX_FLASH_BANKS_DETECT];
+#ifdef CONFIG_SYS_MAX_FLASH_BANKS_DETECT
+	int s_first[CONFIG_SYS_MAX_FLASH_BANKS_DETECT], s_last[CONFIG_SYS_MAX_FLASH_BANKS_DETECT];
 #else
-	int s_first[CFG_MAX_FLASH_BANKS], s_last[CFG_MAX_FLASH_BANKS];
+	int s_first[CONFIG_SYS_MAX_FLASH_BANKS], s_last[CONFIG_SYS_MAX_FLASH_BANKS];
 #endif
 	int erased = 0;
 	int planned;
@@ -437,7 +437,7 @@
 
 	if (planned && (rcode == 0)) {
 		for (bank=0,info = &flash_info[0];
-		     (bank < CFG_MAX_FLASH_BANKS) && (rcode == 0);
+		     (bank < CONFIG_SYS_MAX_FLASH_BANKS) && (rcode == 0);
 		     ++bank, ++info) {
 			if (s_first[bank]>=0) {
 				erased += s_last[bank] - s_first[bank] + 1;
@@ -459,15 +459,15 @@
 	}
 	return rcode;
 }
-#endif /* CFG_NO_FLASH */
+#endif /* CONFIG_SYS_NO_FLASH */
 
 int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
-#ifndef CFG_NO_FLASH
+#ifndef CONFIG_SYS_NO_FLASH
 	flash_info_t *info;
 	ulong bank;
 	int i, n, sect_first, sect_last;
-#endif /* CFG_NO_FLASH */
+#endif /* CONFIG_SYS_NO_FLASH */
 	ulong addr_first, addr_last;
 	int p;
 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
@@ -512,9 +512,9 @@
 	}
 #endif
 
-#ifndef CFG_NO_FLASH
+#ifndef CONFIG_SYS_NO_FLASH
 	if (strcmp(argv[2], "all") == 0) {
-		for (bank=1; bank<=CFG_MAX_FLASH_BANKS; ++bank) {
+		for (bank=1; bank<=CONFIG_SYS_MAX_FLASH_BANKS; ++bank) {
 			info = &flash_info[bank-1];
 			if (info->flash_id == FLASH_UNKNOWN) {
 				continue;
@@ -523,17 +523,17 @@
 				p ? "" : "Un-", bank);
 
 			for (i=0; i<info->sector_count; ++i) {
-#if defined(CFG_FLASH_PROTECTION)
+#if defined(CONFIG_SYS_FLASH_PROTECTION)
 				if (flash_real_protect(info, i, p))
 					rcode = 1;
 				putc ('.');
 #else
 				info->protect[i] = p;
-#endif	/* CFG_FLASH_PROTECTION */
+#endif	/* CONFIG_SYS_FLASH_PROTECTION */
 			}
-#if defined(CFG_FLASH_PROTECTION)
+#if defined(CONFIG_SYS_FLASH_PROTECTION)
 			if (!rcode) puts (" done\n");
-#endif	/* CFG_FLASH_PROTECTION */
+#endif	/* CONFIG_SYS_FLASH_PROTECTION */
 		}
 		return rcode;
 	}
@@ -547,18 +547,18 @@
 			p ? "" : "Un-", sect_first, sect_last,
 			(info-flash_info)+1);
 		for (i = sect_first; i <= sect_last; i++) {
-#if defined(CFG_FLASH_PROTECTION)
+#if defined(CONFIG_SYS_FLASH_PROTECTION)
 			if (flash_real_protect(info, i, p))
 				rcode =  1;
 			putc ('.');
 #else
 			info->protect[i] = p;
-#endif	/* CFG_FLASH_PROTECTION */
+#endif	/* CONFIG_SYS_FLASH_PROTECTION */
 		}
 
-#if defined(CFG_FLASH_PROTECTION)
+#if defined(CONFIG_SYS_FLASH_PROTECTION)
 		if (!rcode) puts (" done\n");
-#endif	/* CFG_FLASH_PROTECTION */
+#endif	/* CONFIG_SYS_FLASH_PROTECTION */
 
 		return rcode;
 	}
@@ -597,9 +597,9 @@
 
 	if (strcmp(argv[2], "bank") == 0) {
 		bank = simple_strtoul(argv[3], NULL, 16);
-		if ((bank < 1) || (bank > CFG_MAX_FLASH_BANKS)) {
+		if ((bank < 1) || (bank > CONFIG_SYS_MAX_FLASH_BANKS)) {
 			printf ("Only FLASH Banks # 1 ... # %d supported\n",
-				CFG_MAX_FLASH_BANKS);
+				CONFIG_SYS_MAX_FLASH_BANKS);
 			return 1;
 		}
 		printf ("%sProtect Flash Bank # %ld\n",
@@ -611,18 +611,18 @@
 			return 1;
 		}
 		for (i=0; i<info->sector_count; ++i) {
-#if defined(CFG_FLASH_PROTECTION)
+#if defined(CONFIG_SYS_FLASH_PROTECTION)
 			if (flash_real_protect(info, i, p))
 				rcode =  1;
 			putc ('.');
 #else
 			info->protect[i] = p;
-#endif	/* CFG_FLASH_PROTECTION */
+#endif	/* CONFIG_SYS_FLASH_PROTECTION */
 		}
 
-#if defined(CFG_FLASH_PROTECTION)
+#if defined(CONFIG_SYS_FLASH_PROTECTION)
 		if (!rcode) puts (" done\n");
-#endif	/* CFG_FLASH_PROTECTION */
+#endif	/* CONFIG_SYS_FLASH_PROTECTION */
 
 		return rcode;
 	}
@@ -637,19 +637,19 @@
 		return 1;
 	}
 	rcode = flash_sect_protect (p, addr_first, addr_last);
-#endif /* CFG_NO_FLASH */
+#endif /* CONFIG_SYS_NO_FLASH */
 	return rcode;
 }
 
-#ifndef CFG_NO_FLASH
+#ifndef CONFIG_SYS_NO_FLASH
 int flash_sect_protect (int p, ulong addr_first, ulong addr_last)
 {
 	flash_info_t *info;
 	ulong bank;
-#ifdef CFG_MAX_FLASH_BANKS_DETECT
-	int s_first[CFG_MAX_FLASH_BANKS_DETECT], s_last[CFG_MAX_FLASH_BANKS_DETECT];
+#ifdef CONFIG_SYS_MAX_FLASH_BANKS_DETECT
+	int s_first[CONFIG_SYS_MAX_FLASH_BANKS_DETECT], s_last[CONFIG_SYS_MAX_FLASH_BANKS_DETECT];
 #else
-	int s_first[CFG_MAX_FLASH_BANKS], s_last[CFG_MAX_FLASH_BANKS];
+	int s_first[CONFIG_SYS_MAX_FLASH_BANKS], s_last[CONFIG_SYS_MAX_FLASH_BANKS];
 #endif
 	int protected, i;
 	int planned;
@@ -660,7 +660,7 @@
 	protected = 0;
 
 	if (planned && (rcode == 0)) {
-		for (bank=0,info = &flash_info[0]; bank < CFG_MAX_FLASH_BANKS; ++bank, ++info) {
+		for (bank=0,info = &flash_info[0]; bank < CONFIG_SYS_MAX_FLASH_BANKS; ++bank, ++info) {
 			if (info->flash_id == FLASH_UNKNOWN) {
 				continue;
 			}
@@ -671,19 +671,19 @@
 					s_first[bank], s_last[bank], bank+1);
 				protected += s_last[bank] - s_first[bank] + 1;
 				for (i=s_first[bank]; i<=s_last[bank]; ++i) {
-#if defined(CFG_FLASH_PROTECTION)
+#if defined(CONFIG_SYS_FLASH_PROTECTION)
 					if (flash_real_protect(info, i, p))
 						rcode = 1;
 					putc ('.');
 #else
 					info->protect[i] = p;
-#endif	/* CFG_FLASH_PROTECTION */
+#endif	/* CONFIG_SYS_FLASH_PROTECTION */
 				}
 			}
 		}
-#if defined(CFG_FLASH_PROTECTION)
+#if defined(CONFIG_SYS_FLASH_PROTECTION)
 		puts (" done\n");
-#endif	/* CFG_FLASH_PROTECTION */
+#endif	/* CONFIG_SYS_FLASH_PROTECTION */
 
 		printf ("%sProtected %d sectors\n",
 			p ? "" : "Un-", protected);
@@ -694,7 +694,7 @@
 	}
 	return rcode;
 }
-#endif /* CFG_NO_FLASH */
+#endif /* CONFIG_SYS_NO_FLASH */
 
 
 /**************************************************/
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
index 8d287fe..84ecf49 100644
--- a/common/cmd_i2c.c
+++ b/common/cmd_i2c.c
@@ -65,7 +65,7 @@
  *   significant 1, 2, or 3 bits of address into the chip address byte.
  *   This effectively makes one chip (logically) look like 2, 4, or
  *   8 chips.  This is handled (awkwardly) by #defining
- *   CFG_I2C_EEPROM_ADDR_OVERFLOW and using the .1 modifier on the
+ *   CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW and using the .1 modifier on the
  *   {addr} field (since .1 is the default, it doesn't actually have to
  *   be specified).  Examples: given a memory chip at I2C chip address
  *   0x50, the following would happen...
@@ -105,19 +105,19 @@
  * When multiple buses are present, the list is an array of bus-address
  * pairs.  The following macros take care of this */
 
-#if defined(CFG_I2C_NOPROBES)
+#if defined(CONFIG_SYS_I2C_NOPROBES)
 #if defined(CONFIG_I2C_MULTI_BUS)
 static struct
 {
 	uchar	bus;
 	uchar	addr;
-} i2c_no_probes[] = CFG_I2C_NOPROBES;
+} i2c_no_probes[] = CONFIG_SYS_I2C_NOPROBES;
 #define GET_BUS_NUM	i2c_get_bus_num()
 #define COMPARE_BUS(b,i)	(i2c_no_probes[(i)].bus == (b))
 #define COMPARE_ADDR(a,i)	(i2c_no_probes[(i)].addr == (a))
 #define NO_PROBE_ADDR(i)	i2c_no_probes[(i)].addr
 #else		/* single bus */
-static uchar i2c_no_probes[] = CFG_I2C_NOPROBES;
+static uchar i2c_no_probes[] = CONFIG_SYS_I2C_NOPROBES;
 #define GET_BUS_NUM	0
 #define COMPARE_BUS(b,i)	((b) == 0)	/* Make compiler happy */
 #define COMPARE_ADDR(a,i)	(i2c_no_probes[(i)] == (a))
@@ -129,7 +129,7 @@
 
 #if defined(CONFIG_I2C_MUX)
 static I2C_MUX_DEVICE	*i2c_mux_devices = NULL;
-static	int	i2c_mux_busid = CFG_MAX_I2C_BUS;
+static	int	i2c_mux_busid = CONFIG_SYS_MAX_I2C_BUS;
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -323,7 +323,7 @@
 /*
  * No write delay with FRAM devices.
  */
-#if !defined(CFG_I2C_FRAM)
+#if !defined(CONFIG_SYS_I2C_FRAM)
 		udelay(11000);
 #endif
 
@@ -529,8 +529,8 @@
 #endif
 				if (i2c_write(chip, addr, alen, (uchar *)&data, size) != 0)
 					puts ("Error writing the chip.\n");
-#ifdef CFG_EEPROM_PAGE_WRITE_DELAY_MS
-				udelay(CFG_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
+#ifdef CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS
+				udelay(CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
 #endif
 				if (incrflag)
 					addr += size;
@@ -552,14 +552,14 @@
 int do_i2c_probe (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	int j;
-#if defined(CFG_I2C_NOPROBES)
+#if defined(CONFIG_SYS_I2C_NOPROBES)
 	int k, skip;
 	uchar bus = GET_BUS_NUM;
 #endif	/* NOPROBES */
 
 	puts ("Valid chip addresses:");
 	for (j = 0; j < 128; j++) {
-#if defined(CFG_I2C_NOPROBES)
+#if defined(CONFIG_SYS_I2C_NOPROBES)
 		skip = 0;
 		for (k=0; k < NUM_ELEMENTS_NOPROBE; k++) {
 			if (COMPARE_BUS(bus, k) && COMPARE_ADDR(j, k)) {
@@ -575,7 +575,7 @@
 	}
 	putc ('\n');
 
-#if defined(CFG_I2C_NOPROBES)
+#if defined(CONFIG_SYS_I2C_NOPROBES)
 	puts ("Excluded chip addresses:");
 	for (k=0; k < NUM_ELEMENTS_NOPROBE; k++) {
 		if (COMPARE_BUS(bus,k))
@@ -1194,7 +1194,7 @@
 #if defined(CONFIG_I2C_CMD_TREE)
 int do_i2c_reset(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 {
-	i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
+	i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
 	return 0;
 }
 
@@ -1573,8 +1573,8 @@
 
 	if ((gd->flags & GD_FLG_RELOC) != GD_FLG_RELOC) {
 		/* select Default Mux Bus */
-#if defined(CFG_I2C_IVM_BUS)
-		i2c_mux_ident_muxstring_f ((uchar *)CFG_I2C_IVM_BUS);
+#if defined(CONFIG_SYS_I2C_IVM_BUS)
+		i2c_mux_ident_muxstring_f ((uchar *)CONFIG_SYS_I2C_IVM_BUS);
 #else
 		{
 		unsigned char *buf;
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 2fcaff8..2564c2b 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -92,10 +92,10 @@
 
 static pio_config_t pio_config_clk [IDE_MAX_PIO_MODE+1];
 
-#ifndef	CFG_PIO_MODE
-#define	CFG_PIO_MODE	0		/* use a relaxed default */
+#ifndef	CONFIG_SYS_PIO_MODE
+#define	CONFIG_SYS_PIO_MODE	0		/* use a relaxed default */
 #endif
-static int pio_mode = CFG_PIO_MODE;
+static int pio_mode = CONFIG_SYS_PIO_MODE;
 
 /* Make clock cycles and always round up */
 
@@ -109,23 +109,23 @@
 static int curr_device = -1;
 
 /* Current offset for IDE0 / IDE1 bus access	*/
-ulong ide_bus_offset[CFG_IDE_MAXBUS] = {
-#if defined(CFG_ATA_IDE0_OFFSET)
-	CFG_ATA_IDE0_OFFSET,
+ulong ide_bus_offset[CONFIG_SYS_IDE_MAXBUS] = {
+#if defined(CONFIG_SYS_ATA_IDE0_OFFSET)
+	CONFIG_SYS_ATA_IDE0_OFFSET,
 #endif
-#if defined(CFG_ATA_IDE1_OFFSET) && (CFG_IDE_MAXBUS > 1)
-	CFG_ATA_IDE1_OFFSET,
+#if defined(CONFIG_SYS_ATA_IDE1_OFFSET) && (CONFIG_SYS_IDE_MAXBUS > 1)
+	CONFIG_SYS_ATA_IDE1_OFFSET,
 #endif
 };
 
 
 #ifndef CONFIG_AMIGAONEG3SE
-static int ide_bus_ok[CFG_IDE_MAXBUS];
+static int ide_bus_ok[CONFIG_SYS_IDE_MAXBUS];
 #else
-static int ide_bus_ok[CFG_IDE_MAXBUS] = {0,};
+static int ide_bus_ok[CONFIG_SYS_IDE_MAXBUS] = {0,};
 #endif
 
-block_dev_desc_t ide_dev_desc[CFG_IDE_MAXDEVICE];
+block_dev_desc_t ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE];
 /* ------------------------------------------------------------------------- */
 
 #ifdef CONFIG_IDE_LED
@@ -165,8 +165,8 @@
 static void output_data(int dev, ulong *sect_buf, int words);
 static void ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len);
 
-#ifndef CFG_ATA_PORT_ADDR
-#define CFG_ATA_PORT_ADDR(port) (port)
+#ifndef CONFIG_SYS_ATA_PORT_ADDR
+#define CONFIG_SYS_ATA_PORT_ADDR(port) (port)
 #endif
 
 #ifdef CONFIG_ATAPI
@@ -205,7 +205,7 @@
 
 		putc ('\n');
 
-		for (i=0; i<CFG_IDE_MAXDEVICE; ++i) {
+		for (i=0; i<CONFIG_SYS_IDE_MAXDEVICE; ++i) {
 			if (ide_dev_desc[i].type==DEV_TYPE_UNKNOWN)
 				continue; /* list only known devices */
 			printf ("IDE device %d: ", i);
@@ -214,7 +214,7 @@
 		return 0;
 
 	} else if (strncmp(argv[1],"dev",3) == 0) {
-		if ((curr_device < 0) || (curr_device >= CFG_IDE_MAXDEVICE)) {
+		if ((curr_device < 0) || (curr_device >= CONFIG_SYS_IDE_MAXDEVICE)) {
 			puts ("\nno IDE devices available\n");
 			return 1;
 		}
@@ -224,7 +224,7 @@
 	} else if (strncmp(argv[1],"part",4) == 0) {
 		int dev, ok;
 
-		for (ok=0, dev=0; dev<CFG_IDE_MAXDEVICE; ++dev) {
+		for (ok=0, dev=0; dev<CONFIG_SYS_IDE_MAXDEVICE; ++dev) {
 			if (ide_dev_desc[dev].part_type!=PART_TYPE_UNKNOWN) {
 				++ok;
 				if (dev)
@@ -245,7 +245,7 @@
 		int dev = (int)simple_strtoul(argv[2], NULL, 10);
 
 		printf ("\nIDE device %d: ", dev);
-		if (dev >= CFG_IDE_MAXDEVICE) {
+		if (dev >= CONFIG_SYS_IDE_MAXDEVICE) {
 			puts ("unknown device\n");
 			return 1;
 		}
@@ -296,7 +296,7 @@
 		ulong addr = simple_strtoul(argv[2], NULL, 16);
 		ulong cnt  = simple_strtoul(argv[4], NULL, 16);
 		ulong n;
-#ifdef CFG_64BIT_LBA
+#ifdef CONFIG_SYS_64BIT_LBA
 		lbaint_t blk  = simple_strtoull(argv[3], NULL, 16);
 
 		printf ("\nIDE read: device %d block # %qd, count %ld ... ",
@@ -325,7 +325,7 @@
 		ulong addr = simple_strtoul(argv[2], NULL, 16);
 		ulong cnt  = simple_strtoul(argv[4], NULL, 16);
 		ulong n;
-#ifdef CFG_64BIT_LBA
+#ifdef CONFIG_SYS_64BIT_LBA
 		lbaint_t blk  = simple_strtoull(argv[3], NULL, 16);
 
 		printf ("\nIDE write: device %d block # %qd, count %ld ... ",
@@ -371,7 +371,7 @@
 	show_boot_progress (41);
 	switch (argc) {
 	case 1:
-		addr = CFG_LOAD_ADDR;
+		addr = CONFIG_SYS_LOAD_ADDR;
 		boot_device = getenv ("bootdevice");
 		break;
 	case 2:
@@ -525,8 +525,8 @@
 __ide_outb(int dev, int port, unsigned char val)
 {
 	debug ("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n",
-		dev, port, val, (ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port)));
-	outb(val, (ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port)));
+		dev, port, val, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
+	outb(val, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
 }
 void inline ide_outb (int dev, int port, unsigned char val)
 		__attribute__((weak, alias("__ide_outb")));
@@ -535,9 +535,9 @@
 __ide_inb(int dev, int port)
 {
 	uchar val;
-	val = inb((ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port)));
+	val = inb((ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
 	debug ("ide_inb (dev= %d, port= 0x%x) : @ 0x%08lx -> 0x%02x\n",
-		dev, port, (ATA_CURR_BASE(dev)+CFG_ATA_PORT_ADDR(port)), val);
+		dev, port, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)), val);
 	return val;
 }
 unsigned char inline ide_inb(int dev, int port)
@@ -557,7 +557,7 @@
 {
 
 #ifdef CONFIG_IDE_8xx_DIRECT
-	volatile immap_t *immr = (immap_t *)CFG_IMMR;
+	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 	volatile pcmconf8xx_t *pcmp = &(immr->im_pcmcia);
 #endif
 	unsigned char c;
@@ -639,17 +639,17 @@
 	 * According to spec, this can take up to 31 seconds!
 	 */
 #ifndef CONFIG_AMIGAONEG3SE
-	for (bus=0; bus<CFG_IDE_MAXBUS; ++bus) {
-		int dev = bus * (CFG_IDE_MAXDEVICE / CFG_IDE_MAXBUS);
+	for (bus=0; bus<CONFIG_SYS_IDE_MAXBUS; ++bus) {
+		int dev = bus * (CONFIG_SYS_IDE_MAXDEVICE / CONFIG_SYS_IDE_MAXBUS);
 #else
 	s = getenv("ide_maxbus");
 	if (s)
 		max_bus_scan = simple_strtol(s, NULL, 10);
 	else
-		max_bus_scan = CFG_IDE_MAXBUS;
+		max_bus_scan = CONFIG_SYS_IDE_MAXBUS;
 
 	for (bus=0; bus<max_bus_scan; ++bus) {
-		int dev = bus * (CFG_IDE_MAXDEVICE / max_bus_scan);
+		int dev = bus * (CONFIG_SYS_IDE_MAXDEVICE / max_bus_scan);
 #endif
 
 #ifdef CONFIG_IDE_8xx_PCCARD
@@ -722,7 +722,7 @@
 	ide_led ((LED_IDE1 | LED_IDE2), 0);	/* LED's off	*/
 
 	curr_device = -1;
-	for (i=0; i<CFG_IDE_MAXDEVICE; ++i) {
+	for (i=0; i<CONFIG_SYS_IDE_MAXDEVICE; ++i) {
 #ifdef CONFIG_IDE_LED
 		int led = (IDE_BUS(i) == 0) ? LED_IDE1 : LED_IDE2;
 #endif
@@ -753,7 +753,7 @@
 
 block_dev_desc_t * ide_get_dev(int dev)
 {
-	return (dev < CFG_IDE_MAXDEVICE) ? &ide_dev_desc[dev] : NULL;
+	return (dev < CONFIG_SYS_IDE_MAXDEVICE) ? &ide_dev_desc[dev] : NULL;
 }
 
 
@@ -762,7 +762,7 @@
 static void
 set_pcmcia_timing (int pmode)
 {
-	volatile immap_t *immr = (immap_t *)CFG_IMMR;
+	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 	volatile pcmconf8xx_t *pcmp = &(immr->im_pcmcia);
 	ulong timings;
 
@@ -775,33 +775,33 @@
 
 	/* IDE 0
 	 */
-	pcmp->pcmc_pbr0 = CFG_PCMCIA_PBR0;
-	pcmp->pcmc_por0 = CFG_PCMCIA_POR0
-#if (CFG_PCMCIA_POR0 != 0)
+	pcmp->pcmc_pbr0 = CONFIG_SYS_PCMCIA_PBR0;
+	pcmp->pcmc_por0 = CONFIG_SYS_PCMCIA_POR0
+#if (CONFIG_SYS_PCMCIA_POR0 != 0)
 			| timings
 #endif
 			;
 	debug ("PBR0: %08x  POR0: %08x\n", pcmp->pcmc_pbr0, pcmp->pcmc_por0);
 
-	pcmp->pcmc_pbr1 = CFG_PCMCIA_PBR1;
-	pcmp->pcmc_por1 = CFG_PCMCIA_POR1
-#if (CFG_PCMCIA_POR1 != 0)
+	pcmp->pcmc_pbr1 = CONFIG_SYS_PCMCIA_PBR1;
+	pcmp->pcmc_por1 = CONFIG_SYS_PCMCIA_POR1
+#if (CONFIG_SYS_PCMCIA_POR1 != 0)
 			| timings
 #endif
 			;
 	debug ("PBR1: %08x  POR1: %08x\n", pcmp->pcmc_pbr1, pcmp->pcmc_por1);
 
-	pcmp->pcmc_pbr2 = CFG_PCMCIA_PBR2;
-	pcmp->pcmc_por2 = CFG_PCMCIA_POR2
-#if (CFG_PCMCIA_POR2 != 0)
+	pcmp->pcmc_pbr2 = CONFIG_SYS_PCMCIA_PBR2;
+	pcmp->pcmc_por2 = CONFIG_SYS_PCMCIA_POR2
+#if (CONFIG_SYS_PCMCIA_POR2 != 0)
 			| timings
 #endif
 			;
 	debug ("PBR2: %08x  POR2: %08x\n", pcmp->pcmc_pbr2, pcmp->pcmc_por2);
 
-	pcmp->pcmc_pbr3 = CFG_PCMCIA_PBR3;
-	pcmp->pcmc_por3 = CFG_PCMCIA_POR3
-#if (CFG_PCMCIA_POR3 != 0)
+	pcmp->pcmc_pbr3 = CONFIG_SYS_PCMCIA_PBR3;
+	pcmp->pcmc_por3 = CONFIG_SYS_PCMCIA_POR3
+#if (CONFIG_SYS_PCMCIA_POR3 != 0)
 			| timings
 #endif
 			;
@@ -809,33 +809,33 @@
 
 	/* IDE 1
 	 */
-	pcmp->pcmc_pbr4 = CFG_PCMCIA_PBR4;
-	pcmp->pcmc_por4 = CFG_PCMCIA_POR4
-#if (CFG_PCMCIA_POR4 != 0)
+	pcmp->pcmc_pbr4 = CONFIG_SYS_PCMCIA_PBR4;
+	pcmp->pcmc_por4 = CONFIG_SYS_PCMCIA_POR4
+#if (CONFIG_SYS_PCMCIA_POR4 != 0)
 			| timings
 #endif
 			;
 	debug ("PBR4: %08x  POR4: %08x\n", pcmp->pcmc_pbr4, pcmp->pcmc_por4);
 
-	pcmp->pcmc_pbr5 = CFG_PCMCIA_PBR5;
-	pcmp->pcmc_por5 = CFG_PCMCIA_POR5
-#if (CFG_PCMCIA_POR5 != 0)
+	pcmp->pcmc_pbr5 = CONFIG_SYS_PCMCIA_PBR5;
+	pcmp->pcmc_por5 = CONFIG_SYS_PCMCIA_POR5
+#if (CONFIG_SYS_PCMCIA_POR5 != 0)
 			| timings
 #endif
 			;
 	debug ("PBR5: %08x  POR5: %08x\n", pcmp->pcmc_pbr5, pcmp->pcmc_por5);
 
-	pcmp->pcmc_pbr6 = CFG_PCMCIA_PBR6;
-	pcmp->pcmc_por6 = CFG_PCMCIA_POR6
-#if (CFG_PCMCIA_POR6 != 0)
+	pcmp->pcmc_pbr6 = CONFIG_SYS_PCMCIA_PBR6;
+	pcmp->pcmc_por6 = CONFIG_SYS_PCMCIA_POR6
+#if (CONFIG_SYS_PCMCIA_POR6 != 0)
 			| timings
 #endif
 			;
 	debug ("PBR6: %08x  POR6: %08x\n", pcmp->pcmc_pbr6, pcmp->pcmc_por6);
 
-	pcmp->pcmc_pbr7 = CFG_PCMCIA_PBR7;
-	pcmp->pcmc_por7 = CFG_PCMCIA_POR7
-#if (CFG_PCMCIA_POR7 != 0)
+	pcmp->pcmc_pbr7 = CONFIG_SYS_PCMCIA_PBR7;
+	pcmp->pcmc_por7 = CONFIG_SYS_PCMCIA_POR7
+#if (CONFIG_SYS_PCMCIA_POR7 != 0)
 			| timings
 #endif
 			;
@@ -1079,7 +1079,7 @@
 	if (s) {
 		max_bus_scan = simple_strtol(s, NULL, 10);
 	} else {
-		max_bus_scan = CFG_IDE_MAXBUS;
+		max_bus_scan = CONFIG_SYS_IDE_MAXBUS;
 	}
 	if (device >= max_bus_scan*2) {
 		dev_desc->type=DEV_TYPE_UNKNOWN;
@@ -1359,7 +1359,7 @@
 			/* write high bits */
 			ide_outb (device, ATA_SECT_CNT, 0);
 			ide_outb (device, ATA_LBA_LOW,	(blknr >> 24) & 0xFF);
-#ifdef CFG_64BIT_LBA
+#ifdef CONFIG_SYS_64BIT_LBA
 			ide_outb (device, ATA_LBA_MID,	(blknr >> 32) & 0xFF);
 			ide_outb (device, ATA_LBA_HIGH, (blknr >> 40) & 0xFF);
 #else
@@ -1397,7 +1397,7 @@
 		}
 
 		if ((c&(ATA_STAT_DRQ|ATA_STAT_BUSY|ATA_STAT_ERR)) != ATA_STAT_DRQ) {
-#if defined(CFG_64BIT_LBA) && defined(CFG_64BIT_VSPRINTF)
+#if defined(CONFIG_SYS_64BIT_LBA) && defined(CONFIG_SYS_64BIT_VSPRINTF)
 			printf ("Error (no IRQ) dev %d blk %qd: status 0x%02x\n",
 				device, blknr, c);
 #else
@@ -1454,7 +1454,7 @@
 			/* write high bits */
 			ide_outb (device, ATA_SECT_CNT, 0);
 			ide_outb (device, ATA_LBA_LOW,	(blknr >> 24) & 0xFF);
-#ifdef CFG_64BIT_LBA
+#ifdef CONFIG_SYS_64BIT_LBA
 			ide_outb (device, ATA_LBA_MID,	(blknr >> 32) & 0xFF);
 			ide_outb (device, ATA_LBA_HIGH, (blknr >> 40) & 0xFF);
 #else
@@ -1487,7 +1487,7 @@
 		c = ide_wait (device, IDE_TIME_OUT);	/* can't take over 500 ms */
 
 		if ((c&(ATA_STAT_DRQ|ATA_STAT_BUSY|ATA_STAT_ERR)) != ATA_STAT_DRQ) {
-#if defined(CFG_64BIT_LBA) && defined(CFG_64BIT_VSPRINTF)
+#if defined(CONFIG_SYS_64BIT_LBA) && defined(CONFIG_SYS_64BIT_VSPRINTF)
 			printf ("Error (no IRQ) dev %d blk %qd: status 0x%02x\n",
 				device, blknr, c);
 #else
@@ -1567,15 +1567,15 @@
 
 static void ide_reset (void)
 {
-#if defined(CFG_PB_12V_ENABLE) || defined(CFG_PB_IDE_MOTOR)
-	volatile immap_t *immr = (immap_t *)CFG_IMMR;
+#if defined(CONFIG_SYS_PB_12V_ENABLE) || defined(CONFIG_SYS_PB_IDE_MOTOR)
+	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 #endif
 	int i;
 
 	curr_device = -1;
-	for (i=0; i<CFG_IDE_MAXBUS; ++i)
+	for (i=0; i<CONFIG_SYS_IDE_MAXBUS; ++i)
 		ide_bus_ok[i] = 0;
-	for (i=0; i<CFG_IDE_MAXDEVICE; ++i)
+	for (i=0; i<CONFIG_SYS_IDE_MAXDEVICE; ++i)
 		ide_dev_desc[i].type = DEV_TYPE_UNKNOWN;
 
 	ide_set_reset (1); /* assert reset */
@@ -1585,11 +1585,11 @@
 
 	WATCHDOG_RESET();
 
-#ifdef CFG_PB_12V_ENABLE
-	immr->im_cpm.cp_pbdat &= ~(CFG_PB_12V_ENABLE);	/* 12V Enable output OFF */
-	immr->im_cpm.cp_pbpar &= ~(CFG_PB_12V_ENABLE);
-	immr->im_cpm.cp_pbodr &= ~(CFG_PB_12V_ENABLE);
-	immr->im_cpm.cp_pbdir |=   CFG_PB_12V_ENABLE;
+#ifdef CONFIG_SYS_PB_12V_ENABLE
+	immr->im_cpm.cp_pbdat &= ~(CONFIG_SYS_PB_12V_ENABLE);	/* 12V Enable output OFF */
+	immr->im_cpm.cp_pbpar &= ~(CONFIG_SYS_PB_12V_ENABLE);
+	immr->im_cpm.cp_pbodr &= ~(CONFIG_SYS_PB_12V_ENABLE);
+	immr->im_cpm.cp_pbdir |=   CONFIG_SYS_PB_12V_ENABLE;
 
 	/* wait 500 ms for the voltage to stabilize
 	 */
@@ -1597,19 +1597,19 @@
 		udelay (1000);
 	}
 
-	immr->im_cpm.cp_pbdat |=   CFG_PB_12V_ENABLE;	/* 12V Enable output ON */
-#endif	/* CFG_PB_12V_ENABLE */
+	immr->im_cpm.cp_pbdat |=   CONFIG_SYS_PB_12V_ENABLE;	/* 12V Enable output ON */
+#endif	/* CONFIG_SYS_PB_12V_ENABLE */
 
-#ifdef CFG_PB_IDE_MOTOR
+#ifdef CONFIG_SYS_PB_IDE_MOTOR
 	/* configure IDE Motor voltage monitor pin as input */
-	immr->im_cpm.cp_pbpar &= ~(CFG_PB_IDE_MOTOR);
-	immr->im_cpm.cp_pbodr &= ~(CFG_PB_IDE_MOTOR);
-	immr->im_cpm.cp_pbdir &= ~(CFG_PB_IDE_MOTOR);
+	immr->im_cpm.cp_pbpar &= ~(CONFIG_SYS_PB_IDE_MOTOR);
+	immr->im_cpm.cp_pbodr &= ~(CONFIG_SYS_PB_IDE_MOTOR);
+	immr->im_cpm.cp_pbdir &= ~(CONFIG_SYS_PB_IDE_MOTOR);
 
 	/* wait up to 1 s for the motor voltage to stabilize
 	 */
 	for (i=0; i<1000; ++i) {
-		if ((immr->im_cpm.cp_pbdat & CFG_PB_IDE_MOTOR) != 0) {
+		if ((immr->im_cpm.cp_pbdat & CONFIG_SYS_PB_IDE_MOTOR) != 0) {
 			break;
 		}
 		udelay (1000);
@@ -1626,7 +1626,7 @@
 #  endif
 # endif	/* CONFIG_STATUS_LED */
 	}
-#endif	/* CFG_PB_IDE_MOTOR */
+#endif	/* CONFIG_SYS_PB_IDE_MOTOR */
 
 	WATCHDOG_RESET();
 
diff --git a/common/cmd_immap.c b/common/cmd_immap.c
index d758269..13ad94e 100644
--- a/common/cmd_immap.c
+++ b/common/cmd_immap.c
@@ -52,7 +52,7 @@
 int
 do_siuinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
-	volatile immap_t *immap = (immap_t *) CFG_IMMR;
+	volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
 
 #if defined(CONFIG_8xx)
 	volatile sysconf8xx_t *sc = &immap->im_siu_conf;
@@ -83,7 +83,7 @@
 int
 do_memcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
-	volatile immap_t *immap = (immap_t *) CFG_IMMR;
+	volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
 
 #if defined(CONFIG_8xx)
 	volatile memctl8xx_t *memctl = &immap->im_memctl;
@@ -151,7 +151,7 @@
 int
 do_carinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
-	volatile immap_t *immap = (immap_t *) CFG_IMMR;
+	volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
 
 #if defined(CONFIG_8xx)
 	volatile car8xx_t *car = &immap->im_clkrst;
@@ -235,7 +235,7 @@
 int
 do_iopinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
-	volatile immap_t *immap = (immap_t *) CFG_IMMR;
+	volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
 
 #if defined(CONFIG_8xx)
 	volatile iop8xx_t *iop = &immap->im_ioport;
@@ -500,7 +500,7 @@
 int
 do_brginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
-	volatile immap_t *immap = (immap_t *) CFG_IMMR;
+	volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
 
 #if defined(CONFIG_8xx)
 	volatile cpm8xx_t *cp = &immap->im_cpm;
@@ -524,7 +524,7 @@
 int
 do_i2cinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
-	volatile immap_t *immap = (immap_t *) CFG_IMMR;
+	volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
 
 #if defined(CONFIG_8xx)
 	volatile i2c8xx_t *i2c = &immap->im_i2c;
diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c
index c6920c9..791a572 100644
--- a/common/cmd_jffs2.c
+++ b/common/cmd_jffs2.c
@@ -772,7 +772,7 @@
 {
 	if (type == MTD_DEV_TYPE_NOR) {
 #if defined(CONFIG_CMD_FLASH)
-		if (num < CFG_MAX_FLASH_BANKS) {
+		if (num < CONFIG_SYS_MAX_FLASH_BANKS) {
 			extern flash_info_t flash_info[];
 			*size = flash_info[num].size;
 
@@ -780,24 +780,24 @@
 		}
 
 		printf("no such FLASH device: %s%d (valid range 0 ... %d\n",
-				MTD_DEV_TYPE(type), num, CFG_MAX_FLASH_BANKS - 1);
+				MTD_DEV_TYPE(type), num, CONFIG_SYS_MAX_FLASH_BANKS - 1);
 #else
 		printf("support for FLASH devices not present\n");
 #endif
 	} else if (type == MTD_DEV_TYPE_NAND) {
 #if defined(CONFIG_JFFS2_NAND) && defined(CONFIG_CMD_NAND)
-		if (num < CFG_MAX_NAND_DEVICE) {
+		if (num < CONFIG_SYS_MAX_NAND_DEVICE) {
 #ifndef CONFIG_NAND_LEGACY
 			*size = nand_info[num].size;
 #else
-			extern struct nand_chip nand_dev_desc[CFG_MAX_NAND_DEVICE];
+			extern struct nand_chip nand_dev_desc[CONFIG_SYS_MAX_NAND_DEVICE];
 			*size = nand_dev_desc[num].totlen;
 #endif
 			return 0;
 		}
 
 		printf("no such NAND device: %s%d (valid range 0 ... %d)\n",
-				MTD_DEV_TYPE(type), num, CFG_MAX_NAND_DEVICE - 1);
+				MTD_DEV_TYPE(type), num, CONFIG_SYS_MAX_NAND_DEVICE - 1);
 #else
 		printf("support for NAND devices not present\n");
 #endif
diff --git a/common/cmd_load.c b/common/cmd_load.c
index 1351fe2..65a4d69 100644
--- a/common/cmd_load.c
+++ b/common/cmd_load.c
@@ -58,7 +58,7 @@
 	int i;
 	char *env_echo;
 	int rcode = 0;
-#ifdef	CFG_LOADS_BAUD_CHANGE
+#ifdef	CONFIG_SYS_LOADS_BAUD_CHANGE
 	int load_baudrate, current_baudrate;
 
 	load_baudrate = current_baudrate = gd->baudrate;
@@ -70,7 +70,7 @@
 		do_echo = 0;
 	}
 
-#ifdef	CFG_LOADS_BAUD_CHANGE
+#ifdef	CONFIG_SYS_LOADS_BAUD_CHANGE
 	if (argc >= 2) {
 		offset = simple_strtol(argv[1], NULL, 16);
 	}
@@ -93,11 +93,11 @@
 				break;
 		}
 	}
-#else	/* ! CFG_LOADS_BAUD_CHANGE */
+#else	/* ! CONFIG_SYS_LOADS_BAUD_CHANGE */
 	if (argc == 2) {
 		offset = simple_strtol(argv[1], NULL, 16);
 	}
-#endif	/* CFG_LOADS_BAUD_CHANGE */
+#endif	/* CONFIG_SYS_LOADS_BAUD_CHANGE */
 
 	printf ("## Ready for S-Record download ...\n");
 
@@ -123,7 +123,7 @@
 		load_addr = addr;
 	}
 
-#ifdef	CFG_LOADS_BAUD_CHANGE
+#ifdef	CONFIG_SYS_LOADS_BAUD_CHANGE
 	if (load_baudrate != current_baudrate) {
 		printf ("## Switch baudrate to %d bps and press ESC ...\n",
 			current_baudrate);
@@ -167,7 +167,7 @@
 		case SREC_DATA3:
 		case SREC_DATA4:
 		    store_addr = addr + offset;
-#ifndef CFG_NO_FLASH
+#ifndef CONFIG_SYS_NO_FLASH
 		    if (addr2info(store_addr)) {
 			int rc;
 
@@ -259,7 +259,7 @@
 {
 	ulong offset = 0;
 	ulong size   = 0;
-#ifdef	CFG_LOADS_BAUD_CHANGE
+#ifdef	CONFIG_SYS_LOADS_BAUD_CHANGE
 	int save_baudrate, current_baudrate;
 
 	save_baudrate = current_baudrate = gd->baudrate;
@@ -268,7 +268,7 @@
 	if (argc >= 2) {
 		offset = simple_strtoul(argv[1], NULL, 16);
 	}
-#ifdef	CFG_LOADS_BAUD_CHANGE
+#ifdef	CONFIG_SYS_LOADS_BAUD_CHANGE
 	if (argc >= 3) {
 		size = simple_strtoul(argv[2], NULL, 16);
 	}
@@ -291,11 +291,11 @@
 				break;
 		}
 	}
-#else	/* ! CFG_LOADS_BAUD_CHANGE */
+#else	/* ! CONFIG_SYS_LOADS_BAUD_CHANGE */
 	if (argc == 3) {
 		size = simple_strtoul(argv[2], NULL, 16);
 	}
-#endif	/* CFG_LOADS_BAUD_CHANGE */
+#endif	/* CONFIG_SYS_LOADS_BAUD_CHANGE */
 
 	printf ("## Ready for S-Record upload, press ENTER to proceed ...\n");
 	for (;;) {
@@ -307,7 +307,7 @@
 	} else {
 		printf ("## S-Record upload complete\n");
 	}
-#ifdef	CFG_LOADS_BAUD_CHANGE
+#ifdef	CONFIG_SYS_LOADS_BAUD_CHANGE
 	if (save_baudrate != current_baudrate) {
 		printf ("## Switch baudrate to %d bps and press ESC ...\n",
 			(int)current_baudrate);
@@ -441,8 +441,8 @@
 	int rcode = 0;
 	char *s;
 
-	/* pre-set offset from CFG_LOAD_ADDR */
-	offset = CFG_LOAD_ADDR;
+	/* pre-set offset from CONFIG_SYS_LOAD_ADDR */
+	offset = CONFIG_SYS_LOAD_ADDR;
 
 	/* pre-set offset from $loadaddr */
 	if ((s = getenv("loadaddr")) != NULL) {
@@ -1001,7 +1001,7 @@
 			store_addr = addr + offset;
 			size += res;
 			addr += res;
-#ifndef CFG_NO_FLASH
+#ifndef CONFIG_SYS_NO_FLASH
 			if (addr2info (store_addr)) {
 				int rc;
 
@@ -1042,7 +1042,7 @@
 
 #if defined(CONFIG_CMD_LOADS)
 
-#ifdef	CFG_LOADS_BAUD_CHANGE
+#ifdef	CONFIG_SYS_LOADS_BAUD_CHANGE
 U_BOOT_CMD(
 	loads, 3, 0,	do_load_serial,
 	"loads   - load S-Record file over serial line\n",
@@ -1051,14 +1051,14 @@
 	" with offset 'off' and baudrate 'baud'\n"
 );
 
-#else	/* ! CFG_LOADS_BAUD_CHANGE */
+#else	/* ! CONFIG_SYS_LOADS_BAUD_CHANGE */
 U_BOOT_CMD(
 	loads, 2, 0,	do_load_serial,
 	"loads   - load S-Record file over serial line\n",
 	"[ off ]\n"
 	"    - load S-Record file over serial line with offset 'off'\n"
 );
-#endif	/* CFG_LOADS_BAUD_CHANGE */
+#endif	/* CONFIG_SYS_LOADS_BAUD_CHANGE */
 
 /*
  * SAVES always requires LOADS support, but not vice versa
@@ -1066,7 +1066,7 @@
 
 
 #if defined(CONFIG_CMD_SAVES)
-#ifdef	CFG_LOADS_BAUD_CHANGE
+#ifdef	CONFIG_SYS_LOADS_BAUD_CHANGE
 U_BOOT_CMD(
 	saves, 4, 0,	do_save_serial,
 	"saves   - save S-Record file over serial line\n",
@@ -1074,14 +1074,14 @@
 	"    - save S-Record file over serial line"
 	" with offset 'off', size 'size' and baudrate 'baud'\n"
 );
-#else	/* ! CFG_LOADS_BAUD_CHANGE */
+#else	/* ! CONFIG_SYS_LOADS_BAUD_CHANGE */
 U_BOOT_CMD(
 	saves, 3, 0,	do_save_serial,
 	"saves   - save S-Record file over serial line\n",
 	"[ off ] [size]\n"
 	"    - save S-Record file over serial line with offset 'off' and size 'size'\n"
 );
-#endif	/* CFG_LOADS_BAUD_CHANGE */
+#endif	/* CONFIG_SYS_LOADS_BAUD_CHANGE */
 #endif
 #endif
 
diff --git a/common/cmd_log.c b/common/cmd_log.c
index fdcc575..febdb90 100644
--- a/common/cmd_log.c
+++ b/common/cmd_log.c
@@ -68,7 +68,7 @@
 
 unsigned long __logbuffer_base(void)
 {
-	return CFG_SDRAM_BASE + gd->bd->bi_memsize - LOGBUFF_LEN;
+	return CONFIG_SYS_SDRAM_BASE + gd->bd->bi_memsize - LOGBUFF_LEN;
 }
 unsigned long logbuffer_base (void) __attribute__((weak, alias("__logbuffer_base")));
 
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index 07b08fb..d7666c2 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -383,7 +383,7 @@
 		return 1;
 	}
 
-#ifndef CFG_NO_FLASH
+#ifndef CONFIG_SYS_NO_FLASH
 	/* check if we are copying to Flash */
 	if ( (addr2info(dest) != NULL)
 #ifdef CONFIG_HAS_DATAFLASH
@@ -463,7 +463,7 @@
 
 	/* Check if we are copying from DataFlash to RAM */
 	if (addr_dataflash(addr) && !addr_dataflash(dest)
-#ifndef CFG_NO_FLASH
+#ifndef CONFIG_SYS_NO_FLASH
 				 && (addr2info(dest) == NULL)
 #endif
 	   ){
@@ -663,7 +663,7 @@
 
 /*
  * Perform a memory test. A more complete alternative test can be
- * configured using CFG_ALT_MEMTEST. The complete test loops until
+ * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until
  * interrupted by ctrl-c or by a failure of one of the sub-tests.
  */
 int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
@@ -673,7 +673,7 @@
 	ulong	readback;
 	int     rcode = 0;
 
-#if defined(CFG_ALT_MEMTEST)
+#if defined(CONFIG_SYS_ALT_MEMTEST)
 	vu_long	len;
 	vu_long	offset;
 	vu_long	test_offset;
@@ -681,8 +681,8 @@
 	vu_long	temp;
 	vu_long	anti_pattern;
 	vu_long	num_words;
-#if defined(CFG_MEMTEST_SCRATCH)
-	vu_long *dummy = (vu_long*)CFG_MEMTEST_SCRATCH;
+#if defined(CONFIG_SYS_MEMTEST_SCRATCH)
+	vu_long *dummy = (vu_long*)CONFIG_SYS_MEMTEST_SCRATCH;
 #else
 	vu_long *dummy = 0;	/* yes, this is address 0x0, not NULL */
 #endif
@@ -707,13 +707,13 @@
 	if (argc > 1) {
 		start = (ulong *)simple_strtoul(argv[1], NULL, 16);
 	} else {
-		start = (ulong *)CFG_MEMTEST_START;
+		start = (ulong *)CONFIG_SYS_MEMTEST_START;
 	}
 
 	if (argc > 2) {
 		end = (ulong *)simple_strtoul(argv[2], NULL, 16);
 	} else {
-		end = (ulong *)(CFG_MEMTEST_END);
+		end = (ulong *)(CONFIG_SYS_MEMTEST_END);
 	}
 
 	if (argc > 3) {
@@ -722,7 +722,7 @@
 		pattern = 0;
 	}
 
-#if defined(CFG_ALT_MEMTEST)
+#if defined(CONFIG_SYS_ALT_MEMTEST)
 	printf ("Testing %08x ... %08x:\n", (uint)start, (uint)end);
 	PRINTF("%s:%d: start 0x%p end 0x%p\n",
 		__FUNCTION__, __LINE__, start, end);
diff --git a/common/cmd_misc.c b/common/cmd_misc.c
index 126b538..3ea8ee0 100644
--- a/common/cmd_misc.c
+++ b/common/cmd_misc.c
@@ -37,7 +37,7 @@
 		return 1;
 	}
 
-	delay = simple_strtoul(argv[1], NULL, 10) * CFG_HZ;
+	delay = simple_strtoul(argv[1], NULL, 10) * CONFIG_SYS_HZ;
 
 	while (get_timer(start) < delay) {
 		if (ctrlc ()) {
diff --git a/common/cmd_mp.c b/common/cmd_mp.c
index c8444fb..f3a7f49 100644
--- a/common/cmd_mp.c
+++ b/common/cmd_mp.c
@@ -82,7 +82,7 @@
 #endif
 
 U_BOOT_CMD(
-	cpu, CFG_MAXARGS, 1, cpu_cmd,
+	cpu, CONFIG_SYS_MAXARGS, 1, cpu_cmd,
 	"cpu     - Multiprocessor CPU boot manipulation and release\n",
 	    "<num> reset                 - Reset cpu <num>\n"
 	"cpu <num> status                - Status of cpu <num>\n"
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index b94a2bf..ea43f4f 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -171,8 +171,8 @@
 	size_t size;
 	char *cmd, *s;
 	nand_info_t *nand;
-#ifdef CFG_NAND_QUIET
-	int quiet = CFG_NAND_QUIET;
+#ifdef CONFIG_SYS_NAND_QUIET
+	int quiet = CONFIG_SYS_NAND_QUIET;
 #else
 	int quiet = 0;
 #endif
@@ -190,7 +190,7 @@
 	if (strcmp(cmd, "info") == 0) {
 
 		putc('\n');
-		for (i = 0; i < CFG_MAX_NAND_DEVICE; i++) {
+		for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++) {
 			if (nand_info[i].name)
 				printf("Device %d: %s, sector size %u KiB\n",
 				       i, nand_info[i].name,
@@ -203,7 +203,7 @@
 
 		if (argc < 3) {
 			if ((nand_curr_device < 0) ||
-			    (nand_curr_device >= CFG_MAX_NAND_DEVICE))
+			    (nand_curr_device >= CONFIG_SYS_MAX_NAND_DEVICE))
 				puts("\nno devices available\n");
 			else
 				printf("\nDevice %d: %s\n", nand_curr_device,
@@ -211,7 +211,7 @@
 			return 0;
 		}
 		dev = (int)simple_strtoul(argv[2], NULL, 10);
-		if (dev < 0 || dev >= CFG_MAX_NAND_DEVICE || !nand_info[dev].name) {
+		if (dev < 0 || dev >= CONFIG_SYS_MAX_NAND_DEVICE || !nand_info[dev].name) {
 			puts("No such device\n");
 			return 1;
 		}
@@ -219,7 +219,7 @@
 		puts("... is now current device\n");
 		nand_curr_device = dev;
 
-#ifdef CFG_NAND_SELECT_DEVICE
+#ifdef CONFIG_SYS_NAND_SELECT_DEVICE
 		/*
 		 * Select the chip in the board/cpu specific driver
 		 */
@@ -238,7 +238,7 @@
 		goto usage;
 
 	/* the following commands operate on the current device */
-	if (nand_curr_device < 0 || nand_curr_device >= CFG_MAX_NAND_DEVICE ||
+	if (nand_curr_device < 0 || nand_curr_device >= CONFIG_SYS_MAX_NAND_DEVICE ||
 	    !nand_info[nand_curr_device].name) {
 		puts("\nno devices available\n");
 		return 1;
@@ -606,7 +606,7 @@
 			if (argc == 3)
 				addr = simple_strtoul(argv[1], NULL, 16);
 			else
-				addr = CFG_LOAD_ADDR;
+				addr = CONFIG_SYS_LOAD_ADDR;
 			return nand_load_image(cmdtp, &nand_info[dev->id->num],
 					       part->offset, addr, argv[0]);
 		}
@@ -616,7 +616,7 @@
 	show_boot_progress(52);
 	switch (argc) {
 	case 1:
-		addr = CFG_LOAD_ADDR;
+		addr = CONFIG_SYS_LOAD_ADDR;
 		boot_device = getenv("bootdevice");
 		break;
 	case 2:
@@ -651,7 +651,7 @@
 
 	idx = simple_strtoul(boot_device, NULL, 16);
 
-	if (idx < 0 || idx >= CFG_MAX_NAND_DEVICE || !nand_info[idx].name) {
+	if (idx < 0 || idx >= CONFIG_SYS_MAX_NAND_DEVICE || !nand_info[idx].name) {
 		printf("\n** Device %d not available\n", idx);
 		show_boot_progress(-55);
 		return 1;
@@ -728,7 +728,7 @@
 /*
  * Imports from nand_legacy.c
  */
-extern struct nand_chip nand_dev_desc[CFG_MAX_NAND_DEVICE];
+extern struct nand_chip nand_dev_desc[CONFIG_SYS_MAX_NAND_DEVICE];
 extern int curr_device;
 extern int nand_legacy_erase(struct nand_chip *nand, size_t ofs,
 			    size_t len, int clean);
@@ -757,7 +757,7 @@
 
 			putc ('\n');
 
-			for (i = 0; i < CFG_MAX_NAND_DEVICE; ++i) {
+			for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; ++i) {
 				if (nand_dev_desc[i].ChipID ==
 				    NAND_ChipID_UNKNOWN)
 					continue;	/* list only known devices */
@@ -768,7 +768,7 @@
 
 		} else if (strcmp (argv[1], "device") == 0) {
 			if ((curr_device < 0)
-			    || (curr_device >= CFG_MAX_NAND_DEVICE)) {
+			    || (curr_device >= CONFIG_SYS_MAX_NAND_DEVICE)) {
 				puts ("\nno devices available\n");
 				return 1;
 			}
@@ -778,7 +778,7 @@
 
 		} else if (strcmp (argv[1], "bad") == 0) {
 			if ((curr_device < 0)
-			    || (curr_device >= CFG_MAX_NAND_DEVICE)) {
+			    || (curr_device >= CONFIG_SYS_MAX_NAND_DEVICE)) {
 				puts ("\nno devices available\n");
 				return 1;
 			}
@@ -794,7 +794,7 @@
 			int dev = (int) simple_strtoul (argv[2], NULL, 10);
 
 			printf ("\nDevice %d: ", dev);
-			if (dev >= CFG_MAX_NAND_DEVICE) {
+			if (dev >= CONFIG_SYS_MAX_NAND_DEVICE) {
 				puts ("unknown device\n");
 				return 1;
 			}
@@ -866,7 +866,7 @@
 			else if (cmdtail && !strcmp (cmdtail, ".e"))
 				cmd |= NANDRW_JFFS2;	/* skip bad blocks */
 #endif
-#ifdef CFG_NAND_SKIP_BAD_DOT_I
+#ifdef CONFIG_SYS_NAND_SKIP_BAD_DOT_I
 			/* need ".i" same as ".jffs2s" for compatibility with older units (esd) */
 			/* ".i" for image -> read skips bad block (no 0xff) */
 			else if (cmdtail && !strcmp (cmdtail, ".i")) {
@@ -874,7 +874,7 @@
 				if (cmd & NANDRW_READ)
 					cmd |= NANDRW_JFFS2_SKIP;	/* skip bad blocks (on read too) */
 			}
-#endif /* CFG_NAND_SKIP_BAD_DOT_I */
+#endif /* CONFIG_SYS_NAND_SKIP_BAD_DOT_I */
 			else if (cmdtail) {
 				printf ("Usage:\n%s\n", cmdtp->usage);
 				return 1;
@@ -952,7 +952,7 @@
 	show_boot_progress (52);
 	switch (argc) {
 	case 1:
-		addr = CFG_LOAD_ADDR;
+		addr = CONFIG_SYS_LOAD_ADDR;
 		boot_device = getenv ("bootdevice");
 		break;
 	case 2:
@@ -984,7 +984,7 @@
 
 	dev = simple_strtoul(boot_device, &ep, 16);
 
-	if ((dev >= CFG_MAX_NAND_DEVICE) ||
+	if ((dev >= CONFIG_SYS_MAX_NAND_DEVICE) ||
 	    (nand_dev_desc[dev].ChipID == NAND_ChipID_UNKNOWN)) {
 		printf ("\n** Device %d not available\n", dev);
 		show_boot_progress (-55);
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 637d6c9..d280cb0 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -72,7 +72,7 @@
 /*
  * Table with supported baudrates (defined in config_xyz.h)
  */
-static const unsigned long baudrate_table[] = CFG_BAUDRATE_TABLE;
+static const unsigned long baudrate_table[] = CONFIG_SYS_BAUDRATE_TABLE;
 #define	N_BAUDRATES (sizeof(baudrate_table) / sizeof(baudrate_table[0]))
 
 
@@ -416,9 +416,9 @@
 #if defined(CONFIG_CMD_ASKENV)
 int do_askenv ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
-	extern char console_buffer[CFG_CBSIZE];
-	char message[CFG_CBSIZE];
-	int size = CFG_CBSIZE - 1;
+	extern char console_buffer[CONFIG_SYS_CBSIZE];
+	char message[CONFIG_SYS_CBSIZE];
+	int size = CONFIG_SYS_CBSIZE - 1;
 	int len;
 	char *local_args[4];
 
@@ -464,8 +464,8 @@
 		break;
 	}
 
-	if (size >= CFG_CBSIZE)
-		size = CFG_CBSIZE - 1;
+	if (size >= CONFIG_SYS_CBSIZE)
+		size = CONFIG_SYS_CBSIZE - 1;
 
 	if (size <= 0)
 		return 1;
@@ -580,7 +580,7 @@
 /**************************************************/
 
 U_BOOT_CMD(
-	printenv, CFG_MAXARGS, 1,	do_printenv,
+	printenv, CONFIG_SYS_MAXARGS, 1,	do_printenv,
 	"printenv- print environment variables\n",
 	"\n    - print values of all environment variables\n"
 	"printenv name ...\n"
@@ -588,7 +588,7 @@
 );
 
 U_BOOT_CMD(
-	setenv, CFG_MAXARGS, 0,	do_setenv,
+	setenv, CONFIG_SYS_MAXARGS, 0,	do_setenv,
 	"setenv  - set environment variables\n",
 	"name value ...\n"
 	"    - set environment variable 'name' to 'value ...'\n"
@@ -612,7 +612,7 @@
 #if defined(CONFIG_CMD_ASKENV)
 
 U_BOOT_CMD(
-	askenv,	CFG_MAXARGS,	1,	do_askenv,
+	askenv,	CONFIG_SYS_MAXARGS,	1,	do_askenv,
 	"askenv  - get environment variables from stdin\n",
 	"name [message] [size]\n"
 	"    - get environment variable 'name' from stdin (max 'size' chars)\n"
@@ -629,7 +629,7 @@
 #if defined(CONFIG_CMD_RUN)
 int do_run (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 U_BOOT_CMD(
-	run,	CFG_MAXARGS,	1,	do_run,
+	run,	CONFIG_SYS_MAXARGS,	1,	do_run,
 	"run     - run commands in an environment variable\n",
 	"var [...]\n"
 	"    - run the commands in the environment variable(s) 'var'\n"
diff --git a/common/cmd_pci.c b/common/cmd_pci.c
index b2aa833..67ff2fb 100644
--- a/common/cmd_pci.c
+++ b/common/cmd_pci.c
@@ -48,7 +48,7 @@
  * Subroutine:  pciinfo
  *
  * Description: Show information about devices on PCI bus.
- *				Depending on the define CFG_SHORT_PCI_LISTING
+ *				Depending on the define CONFIG_SYS_SHORT_PCI_LISTING
  *				the output will be more or less exhaustive.
  *
  * Inputs:	bus_no		the number of the bus to be scanned.
diff --git a/common/cmd_pcmcia.c b/common/cmd_pcmcia.c
index dcd07c0..23fad3b 100644
--- a/common/cmd_pcmcia.c
+++ b/common/cmd_pcmcia.c
@@ -278,8 +278,8 @@
 	int found = 0;
 	int i;
 
-	addr = (volatile uchar *)(CFG_PCMCIA_MEM_ADDR +
-				  CFG_PCMCIA_MEM_SIZE * (slot * 4));
+	addr = (volatile uchar *)(CONFIG_SYS_PCMCIA_MEM_ADDR +
+				  CONFIG_SYS_PCMCIA_MEM_SIZE * (slot * 4));
 	debug ("PCMCIA MEM: %08lX\n", (ulong)addr);
 
 	start = p = (volatile uchar *) addr;
diff --git a/common/cmd_reginfo.c b/common/cmd_reginfo.c
index c0a1459..4c8e61a 100644
--- a/common/cmd_reginfo.c
+++ b/common/cmd_reginfo.c
@@ -38,7 +38,7 @@
 int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 #if defined(CONFIG_8xx)
-	volatile immap_t     *immap  = (immap_t *)CFG_IMMR;
+	volatile immap_t     *immap  = (immap_t *)CONFIG_SYS_IMMR;
 	volatile memctl8xx_t *memctl = &immap->im_memctl;
 	volatile sysconf8xx_t *sysconf = &immap->im_siu_conf;
 	volatile sit8xx_t *timers = &immap->im_sit;
@@ -244,7 +244,7 @@
 	puts ("\n\n");
 #elif defined(CONFIG_5xx)
 
-	volatile immap_t	*immap  = (immap_t *)CFG_IMMR;
+	volatile immap_t	*immap  = (immap_t *)CONFIG_SYS_IMMR;
 	volatile memctl5xx_t	*memctl = &immap->im_memctl;
 	volatile sysconf5xx_t	*sysconf = &immap->im_siu_conf;
 	volatile sit5xx_t	*timers = &immap->im_sit;
@@ -279,7 +279,7 @@
 
 #elif defined(CONFIG_MPC5200)
 	puts ("\nMPC5200 registers\n");
-	printf ("MBAR=%08x\n", CFG_MBAR);
+	printf ("MBAR=%08x\n", CONFIG_SYS_MBAR);
 	puts ("Memory map registers\n");
 	printf ("\tCS0: start %08lX\tstop %08lX\tconfig %08lX\ten %d\n",
 		*(volatile ulong*)MPC5XXX_CS0_START,
diff --git a/common/cmd_reiser.c b/common/cmd_reiser.c
index b7395d7..4f4117e 100644
--- a/common/cmd_reiser.c
+++ b/common/cmd_reiser.c
@@ -128,7 +128,7 @@
 		if (addr_str != NULL) {
 			addr = simple_strtoul (addr_str, NULL, 16);
 		} else {
-			addr = CFG_LOAD_ADDR;
+			addr = CONFIG_SYS_LOAD_ADDR;
 		}
 		filename = getenv ("bootfile");
 		count = 0;
diff --git a/common/cmd_sata.c b/common/cmd_sata.c
index 79c2495..dd6f1d9 100644
--- a/common/cmd_sata.c
+++ b/common/cmd_sata.c
@@ -29,14 +29,14 @@
 #include <sata.h>
 
 int curr_device = -1;
-block_dev_desc_t sata_dev_desc[CFG_SATA_MAX_DEVICE];
+block_dev_desc_t sata_dev_desc[CONFIG_SYS_SATA_MAX_DEVICE];
 
 int sata_initialize(void)
 {
 	int rc;
 	int i;
 
-	for (i = 0; i < CFG_SATA_MAX_DEVICE; i++) {
+	for (i = 0; i < CONFIG_SYS_SATA_MAX_DEVICE; i++) {
 		memset(&sata_dev_desc[i], 0, sizeof(struct block_dev_desc));
 		sata_dev_desc[i].if_type = IF_TYPE_SATA;
 		sata_dev_desc[i].dev = i;
@@ -58,7 +58,7 @@
 
 block_dev_desc_t *sata_get_dev(int dev)
 {
-	return (dev < CFG_SATA_MAX_DEVICE) ? &sata_dev_desc[dev] : NULL;
+	return (dev < CONFIG_SYS_SATA_MAX_DEVICE) ? &sata_dev_desc[dev] : NULL;
 }
 
 int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
@@ -74,7 +74,7 @@
 		if (strncmp(argv[1],"inf", 3) == 0) {
 			int i;
 			putc('\n');
-			for (i = 0; i < CFG_SATA_MAX_DEVICE; ++i) {
+			for (i = 0; i < CONFIG_SYS_SATA_MAX_DEVICE; ++i) {
 				if (sata_dev_desc[i].type == DEV_TYPE_UNKNOWN)
 					continue;
 				printf ("SATA device %d: ", i);
@@ -82,7 +82,7 @@
 			}
 			return 0;
 		} else if (strncmp(argv[1],"dev", 3) == 0) {
-			if ((curr_device < 0) || (curr_device >= CFG_SATA_MAX_DEVICE)) {
+			if ((curr_device < 0) || (curr_device >= CONFIG_SYS_SATA_MAX_DEVICE)) {
 				puts("\nno SATA devices available\n");
 				return 1;
 			}
@@ -92,7 +92,7 @@
 		} else if (strncmp(argv[1],"part",4) == 0) {
 			int dev, ok;
 
-			for (ok = 0, dev = 0; dev < CFG_SATA_MAX_DEVICE; ++dev) {
+			for (ok = 0, dev = 0; dev < CONFIG_SYS_SATA_MAX_DEVICE; ++dev) {
 				if (sata_dev_desc[dev].part_type != PART_TYPE_UNKNOWN) {
 					++ok;
 					if (dev)
@@ -113,7 +113,7 @@
 			int dev = (int)simple_strtoul(argv[2], NULL, 10);
 
 			printf("\nSATA device %d: ", dev);
-			if (dev >= CFG_SATA_MAX_DEVICE) {
+			if (dev >= CONFIG_SYS_SATA_MAX_DEVICE) {
 				puts ("unknown device\n");
 				return 1;
 			}
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
index f357465..066fd80 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -59,7 +59,7 @@
 
 static int scsi_curr_dev; /* current device */
 
-static block_dev_desc_t scsi_dev_desc[CFG_SCSI_MAX_DEVICE];
+static block_dev_desc_t scsi_dev_desc[CONFIG_SYS_SCSI_MAX_DEVICE];
 
 /********************************************************************************
  *  forward declerations of some Setup Routines
@@ -88,7 +88,7 @@
 	if(mode==1) {
 		printf("scanning bus for devices...\n");
 	}
-	for(i=0;i<CFG_SCSI_MAX_DEVICE;i++) {
+	for(i=0;i<CONFIG_SYS_SCSI_MAX_DEVICE;i++) {
 		scsi_dev_desc[i].target=0xff;
 		scsi_dev_desc[i].lun=0xff;
 		scsi_dev_desc[i].lba=0;
@@ -104,9 +104,9 @@
 		scsi_dev_desc[i].block_read=scsi_read;
 	}
 	scsi_max_devs=0;
-	for(i=0;i<CFG_SCSI_MAX_SCSI_ID;i++) {
+	for(i=0;i<CONFIG_SYS_SCSI_MAX_SCSI_ID;i++) {
 		pccb->target=i;
-		for(lun=0;lun<CFG_SCSI_MAX_LUN;lun++) {
+		for(lun=0;lun<CONFIG_SYS_SCSI_MAX_LUN;lun++) {
 			pccb->lun=lun;
 			pccb->pdata=(unsigned char *)&tempbuff;
 			pccb->datalen=512;
@@ -195,7 +195,7 @@
 
 block_dev_desc_t * scsi_get_dev(int dev)
 {
-	return (dev < CFG_SCSI_MAX_DEVICE) ? &scsi_dev_desc[dev] : NULL;
+	return (dev < CONFIG_SYS_SCSI_MAX_DEVICE) ? &scsi_dev_desc[dev] : NULL;
 }
 
 
@@ -217,7 +217,7 @@
 
 	switch (argc) {
 	case 1:
-		addr = CFG_LOAD_ADDR;
+		addr = CONFIG_SYS_LOAD_ADDR;
 		boot_device = getenv ("bootdevice");
 		break;
 	case 2:
@@ -356,7 +356,7 @@
 			}
 			if (strncmp(argv[1],"inf",3) == 0) {
 				int i;
-				for (i=0; i<CFG_SCSI_MAX_DEVICE; ++i) {
+				for (i=0; i<CONFIG_SYS_SCSI_MAX_DEVICE; ++i) {
 					if(scsi_dev_desc[i].type==DEV_TYPE_UNKNOWN)
 						continue; /* list only known devices */
 					printf ("SCSI dev. %d:  ", i);
@@ -365,7 +365,7 @@
 				return 0;
 			}
 			if (strncmp(argv[1],"dev",3) == 0) {
-				if ((scsi_curr_dev < 0) || (scsi_curr_dev >= CFG_SCSI_MAX_DEVICE)) {
+				if ((scsi_curr_dev < 0) || (scsi_curr_dev >= CONFIG_SYS_SCSI_MAX_DEVICE)) {
 					printf("\nno SCSI devices available\n");
 					return 1;
 				}
@@ -379,7 +379,7 @@
 			}
 			if (strncmp(argv[1],"part",4) == 0) {
 				int dev, ok;
-				for (ok=0, dev=0; dev<CFG_SCSI_MAX_DEVICE; ++dev) {
+				for (ok=0, dev=0; dev<CONFIG_SYS_SCSI_MAX_DEVICE; ++dev) {
 					if (scsi_dev_desc[dev].type!=DEV_TYPE_UNKNOWN) {
 						ok++;
 						if (dev)
@@ -398,7 +398,7 @@
 			if (strncmp(argv[1],"dev",3) == 0) {
 				int dev = (int)simple_strtoul(argv[2], NULL, 10);
 				printf ("\nSCSI device %d: ", dev);
-				if (dev >= CFG_SCSI_MAX_DEVICE) {
+				if (dev >= CONFIG_SYS_SCSI_MAX_DEVICE) {
 					printf("unknown device\n");
 					return 1;
 				}
diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index c62ca97..99e551f 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -321,7 +321,7 @@
 
 	switch (argc) {
 	case 1:
-		addr = CFG_LOAD_ADDR;
+		addr = CONFIG_SYS_LOAD_ADDR;
 		boot_device = getenv ("bootdevice");
 		break;
 	case 2:
diff --git a/common/command.c b/common/command.c
index fc9d79c..a4a978c 100644
--- a/common/command.c
+++ b/common/command.c
@@ -70,7 +70,7 @@
 }
 
 U_BOOT_CMD(
-	echo,	CFG_MAXARGS,	1,	do_echo,
+	echo,	CONFIG_SYS_MAXARGS,	1,	do_echo,
 	"echo    - echo args to console\n",
 	"[args..]\n"
 	"    - echo args to console; \\c suppresses newline\n"
@@ -78,7 +78,7 @@
 
 #endif
 
-#ifdef CFG_HUSH_PARSER
+#ifdef CONFIG_SYS_HUSH_PARSER
 
 int
 do_test (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
@@ -202,7 +202,7 @@
 }
 
 U_BOOT_CMD(
-	test,	CFG_MAXARGS,	1,	do_test,
+	test,	CONFIG_SYS_MAXARGS,	1,	do_test,
 	"test    - minimal test like /bin/sh\n",
 	"[args..]\n"
 	"    - test functionality\n"
@@ -286,7 +286,7 @@
 	 */
 	for (i = 1; i < argc; ++i) {
 		if ((cmdtp = find_cmd (argv[i])) != NULL) {
-#ifdef	CFG_LONGHELP
+#ifdef	CONFIG_SYS_LONGHELP
 			/* found - print (long) help info */
 			puts (cmdtp->name);
 			putc (' ');
@@ -300,7 +300,7 @@
 #else	/* no long help available */
 			if (cmdtp->usage)
 				puts (cmdtp->usage);
-#endif	/* CFG_LONGHELP */
+#endif	/* CONFIG_SYS_LONGHELP */
 		} else {
 			printf ("Unknown command '%s' - try 'help'"
 				" without arguments for list of all"
@@ -314,7 +314,7 @@
 
 
 U_BOOT_CMD(
-	help,	CFG_MAXARGS,	1,	do_help,
+	help,	CONFIG_SYS_MAXARGS,	1,	do_help,
 	"help    - print online help\n",
 	"[command ...]\n"
 	"    - show help information (for 'command')\n"
@@ -325,18 +325,18 @@
 );
 
 /* This do not ust the U_BOOT_CMD macro as ? can't be used in symbol names */
-#ifdef  CFG_LONGHELP
+#ifdef  CONFIG_SYS_LONGHELP
 cmd_tbl_t __u_boot_cmd_question_mark Struct_Section = {
-	"?",	CFG_MAXARGS,	1,	do_help,
+	"?",	CONFIG_SYS_MAXARGS,	1,	do_help,
 	"?       - alias for 'help'\n",
 	NULL
 };
 #else
 cmd_tbl_t __u_boot_cmd_question_mark Struct_Section = {
-	"?",	CFG_MAXARGS,	1,	do_help,
+	"?",	CONFIG_SYS_MAXARGS,	1,	do_help,
 	"?       - alias for 'help'\n"
 };
-#endif /* CFG_LONGHELP */
+#endif /* CONFIG_SYS_LONGHELP */
 
 /***************************************************************************
  * find command table entry for a command
@@ -570,12 +570,12 @@
 	return len;
 }
 
-static char tmp_buf[CFG_CBSIZE];	/* copy of console I/O buffer	*/
+static char tmp_buf[CONFIG_SYS_CBSIZE];	/* copy of console I/O buffer	*/
 
 int cmd_auto_complete(const char *const prompt, char *buf, int *np, int *colp)
 {
 	int n = *np, col = *colp;
-	char *argv[CFG_MAXARGS + 1];		/* NULL terminated	*/
+	char *argv[CONFIG_SYS_MAXARGS + 1];		/* NULL terminated	*/
 	char *cmdv[20];
 	char *s, *t;
 	const char *sep;
@@ -583,7 +583,7 @@
 	int cnt;
 	char last_char;
 
-	if (strcmp(prompt, CFG_PROMPT) != 0)
+	if (strcmp(prompt, CONFIG_SYS_PROMPT) != 0)
 		return 0;	/* not in normal console */
 
 	cnt = strlen(buf);
@@ -631,7 +631,7 @@
 	if (s != NULL) {
 		k = len + seplen;
 		/* make sure it fits */
-		if (n + k >= CFG_CBSIZE - 2) {
+		if (n + k >= CONFIG_SYS_CBSIZE - 2) {
 			putc('\a');
 			return 1;
 		}
diff --git a/common/console.c b/common/console.c
index 56d9118..6f0846f 100644
--- a/common/console.c
+++ b/common/console.c
@@ -33,20 +33,20 @@
 int console_changed = 0;
 #endif
 
-#ifdef CFG_CONSOLE_IS_IN_ENV
+#ifdef CONFIG_SYS_CONSOLE_IS_IN_ENV
 /*
  * if overwrite_console returns 1, the stdin, stderr and stdout
  * are switched to the serial port, else the settings in the
  * environment are used
  */
-#ifdef CFG_CONSOLE_OVERWRITE_ROUTINE
+#ifdef CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
 extern int overwrite_console (void);
 #define OVERWRITE_CONSOLE overwrite_console ()
 #else
 #define OVERWRITE_CONSOLE 0
-#endif /* CFG_CONSOLE_OVERWRITE_ROUTINE */
+#endif /* CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE */
 
-#endif /* CFG_CONSOLE_IS_IN_ENV */
+#endif /* CONFIG_SYS_CONSOLE_IS_IN_ENV */
 
 static int console_setfile (int file, device_t * dev)
 {
@@ -99,7 +99,7 @@
 {
 	va_list args;
 	uint i;
-	char printbuffer[CFG_PBSIZE];
+	char printbuffer[CONFIG_SYS_PBSIZE];
 
 	va_start (args, fmt);
 
@@ -144,7 +144,7 @@
 {
 	va_list args;
 	uint i;
-	char printbuffer[CFG_PBSIZE];
+	char printbuffer[CONFIG_SYS_PBSIZE];
 
 	va_start (args, fmt);
 
@@ -238,7 +238,7 @@
 {
 	va_list args;
 	uint i;
-	char printbuffer[CFG_PBSIZE];
+	char printbuffer[CONFIG_SYS_PBSIZE];
 
 	va_start (args, fmt);
 
@@ -255,7 +255,7 @@
 void vprintf (const char *fmt, va_list args)
 {
 	uint i;
-	char printbuffer[CFG_PBSIZE];
+	char printbuffer[CONFIG_SYS_PBSIZE];
 
 	/* For this to work, printbuffer must be larger than
 	 * anything we ever want to print.
@@ -314,7 +314,7 @@
 {
 	va_list	args;
 	uint	i;
-	char	printbuffer[CFG_PBSIZE];
+	char	printbuffer[CONFIG_SYS_PBSIZE];
 
 	if (!once) {
 		memset(screen, 0, sizeof(screen));
@@ -398,15 +398,15 @@
 	return (0);
 }
 
-#ifdef CFG_CONSOLE_IS_IN_ENV
+#ifdef CONFIG_SYS_CONSOLE_IS_IN_ENV
 /* Called after the relocation - use desired console functions */
 int console_init_r (void)
 {
 	char *stdinname, *stdoutname, *stderrname;
 	device_t *inputdev = NULL, *outputdev = NULL, *errdev = NULL;
-#ifdef CFG_CONSOLE_ENV_OVERWRITE
+#ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 	int i;
-#endif /* CFG_CONSOLE_ENV_OVERWRITE */
+#endif /* CONFIG_SYS_CONSOLE_ENV_OVERWRITE */
 
 	/* set default handlers at first */
 	gd->jt[XF_getc] = serial_getc;
@@ -449,7 +449,7 @@
 
 	gd->flags |= GD_FLG_DEVINIT;	/* device initialization completed */
 
-#ifndef CFG_CONSOLE_INFO_QUIET
+#ifndef CONFIG_SYS_CONSOLE_INFO_QUIET
 	/* Print information */
 	puts ("In:    ");
 	if (stdio_devices[stdin] == NULL) {
@@ -471,14 +471,14 @@
 	} else {
 		printf ("%s\n", stdio_devices[stderr]->name);
 	}
-#endif /* CFG_CONSOLE_INFO_QUIET */
+#endif /* CONFIG_SYS_CONSOLE_INFO_QUIET */
 
-#ifdef CFG_CONSOLE_ENV_OVERWRITE
+#ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 	/* set the environment variables (will overwrite previous env settings) */
 	for (i = 0; i < 3; i++) {
 		setenv (stdio_names[i], stdio_devices[i]->name);
 	}
-#endif /* CFG_CONSOLE_ENV_OVERWRITE */
+#endif /* CONFIG_SYS_CONSOLE_ENV_OVERWRITE */
 
 #if 0
 	/* If nothing usable installed, use only the initial console */
@@ -488,7 +488,7 @@
 	return (0);
 }
 
-#else /* CFG_CONSOLE_IS_IN_ENV */
+#else /* CONFIG_SYS_CONSOLE_IS_IN_ENV */
 
 /* Called after the relocation - use desired console functions */
 int console_init_r (void)
@@ -533,7 +533,7 @@
 
 	gd->flags |= GD_FLG_DEVINIT;	/* device initialization completed */
 
-#ifndef CFG_CONSOLE_INFO_QUIET
+#ifndef CONFIG_SYS_CONSOLE_INFO_QUIET
 	/* Print information */
 	puts ("In:    ");
 	if (stdio_devices[stdin] == NULL) {
@@ -555,7 +555,7 @@
 	} else {
 		printf ("%s\n", stdio_devices[stderr]->name);
 	}
-#endif /* CFG_CONSOLE_INFO_QUIET */
+#endif /* CONFIG_SYS_CONSOLE_INFO_QUIET */
 
 	/* Setting environment variables */
 	for (i = 0; i < 3; i++) {
@@ -571,4 +571,4 @@
 	return (0);
 }
 
-#endif /* CFG_CONSOLE_IS_IN_ENV */
+#endif /* CONFIG_SYS_CONSOLE_IS_IN_ENV */
diff --git a/common/cyclon2.c b/common/cyclon2.c
index 479bebb..3ed64b2 100644
--- a/common/cyclon2.c
+++ b/common/cyclon2.c
@@ -43,8 +43,8 @@
 #define CONFIG_FPGA_DELAY()
 #endif
 
-#ifndef CFG_FPGA_WAIT
-#define CFG_FPGA_WAIT CFG_HZ/10		/* 100 ms */
+#ifndef CONFIG_SYS_FPGA_WAIT
+#define CONFIG_SYS_FPGA_WAIT CONFIG_SYS_HZ/10		/* 100 ms */
 #endif
 
 static int CYC2_ps_load( Altera_desc *desc, void *buf, size_t bsize );
@@ -147,7 +147,7 @@
 				"done:\t0x%p\n\n",
 				__FUNCTION__, &fn, fn, fn->config, fn->status,
 				fn->write, fn->done);
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		printf ("Loading FPGA Device %d...", cookie);
 #endif
 
@@ -167,7 +167,7 @@
 		ts = get_timer (0);		/* get current time */
 		do {
 			CONFIG_FPGA_DELAY ();
-			if (get_timer (ts) > CFG_FPGA_WAIT) {	/* check the time */
+			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {	/* check the time */
 				puts ("** Timeout waiting for STATUS to go high.\n");
 				(*fn->abort) (cookie);
 				return FPGA_FAIL;
@@ -183,13 +183,13 @@
 			(*fn->abort) (cookie);
 			return FPGA_FAIL;
 		}
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		puts(" OK? ...");
 #endif
 
 		CONFIG_FPGA_DELAY ();
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		putc (' ');			/* terminate the dotted line */
 #endif
 
@@ -202,13 +202,13 @@
 		(*fn->abort) (cookie);
 		return (FPGA_FAIL);
 	}
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 	puts(" OK\n");
 #endif
 
 	ret_val = FPGA_SUCCESS;
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 	if (ret_val == FPGA_SUCCESS) {
 		puts ("Done.\n");
 	}
diff --git a/common/devices.c b/common/devices.c
index 7d0ac2e..ce3b7a0 100644
--- a/common/devices.c
+++ b/common/devices.c
@@ -40,12 +40,12 @@
 device_t *stdio_devices[] = { NULL, NULL, NULL };
 char *stdio_names[MAX_FILES] = { "stdin", "stdout", "stderr" };
 
-#if defined(CONFIG_SPLASH_SCREEN) && !defined(CFG_DEVICE_NULLDEV)
-#define	CFG_DEVICE_NULLDEV	1
+#if defined(CONFIG_SPLASH_SCREEN) && !defined(CONFIG_SYS_DEVICE_NULLDEV)
+#define	CONFIG_SYS_DEVICE_NULLDEV	1
 #endif
 
 
-#ifdef CFG_DEVICE_NULLDEV
+#ifdef CONFIG_SYS_DEVICE_NULLDEV
 void nulldev_putc(const char c)
 {
 	/* nulldev is empty! */
@@ -90,7 +90,7 @@
 
 	device_register (&dev);
 
-#ifdef CFG_DEVICE_NULLDEV
+#ifdef CONFIG_SYS_DEVICE_NULLDEV
 	memset (&dev, 0, sizeof (dev));
 
 	strcpy (dev.name, "nulldev");
@@ -162,7 +162,7 @@
 /* deregister the device "devname".
  * returns 0 if success, -1 if device is assigned and 1 if devname not found
  */
-#ifdef	CFG_DEVICE_DEREGISTER
+#ifdef	CONFIG_SYS_DEVICE_DEREGISTER
 int device_deregister(char *devname)
 {
 	int l;
@@ -197,7 +197,7 @@
 	}
 	return 0;
 }
-#endif	/* CFG_DEVICE_DEREGISTER */
+#endif	/* CONFIG_SYS_DEVICE_DEREGISTER */
 
 int devices_init (void)
 {
@@ -216,7 +216,7 @@
 	INIT_LIST_HEAD(&(devs.list));
 
 #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
-	i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
+	i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
 #endif
 #ifdef CONFIG_LCD
 	drv_lcd_init ();
diff --git a/common/env_common.c b/common/env_common.c
index 0fee3af..6be3bb0 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -103,8 +103,8 @@
 #ifdef	CONFIG_SERVERIP
 	"serverip="	MK_STR(CONFIG_SERVERIP)		"\0"
 #endif
-#ifdef	CFG_AUTOLOAD
-	"autoload="	CFG_AUTOLOAD			"\0"
+#ifdef	CONFIG_SYS_AUTOLOAD
+	"autoload="	CONFIG_SYS_AUTOLOAD			"\0"
 #endif
 #ifdef	CONFIG_PREBOOT
 	"preboot="	CONFIG_PREBOOT			"\0"
@@ -220,7 +220,7 @@
 	memset(env_ptr, 0, sizeof(env_t));
 	memcpy(env_ptr->data, default_environment,
 	       sizeof(default_environment));
-#ifdef CFG_REDUNDAND_ENVIRONMENT
+#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
 	env_ptr->flags = 0xFF;
 #endif
 	env_crc_update ();
diff --git a/common/env_eeprom.c b/common/env_eeprom.c
index 1f0f413..1578d61 100644
--- a/common/env_eeprom.c
+++ b/common/env_eeprom.c
@@ -39,7 +39,7 @@
 {
 	uchar c;
 
-	eeprom_read (CFG_DEF_EEPROM_ADDR,
+	eeprom_read (CONFIG_SYS_DEF_EEPROM_ADDR,
 		     CONFIG_ENV_OFFSET+index+offsetof(env_t,data),
 		     &c, 1);
 
@@ -48,7 +48,7 @@
 
 void env_relocate_spec (void)
 {
-	eeprom_read (CFG_DEF_EEPROM_ADDR,
+	eeprom_read (CONFIG_SYS_DEF_EEPROM_ADDR,
 		     CONFIG_ENV_OFFSET,
 		     (uchar*)env_ptr,
 		     CONFIG_ENV_SIZE);
@@ -56,7 +56,7 @@
 
 int saveenv(void)
 {
-	return eeprom_write (CFG_DEF_EEPROM_ADDR,
+	return eeprom_write (CONFIG_SYS_DEF_EEPROM_ADDR,
 			     CONFIG_ENV_OFFSET,
 			     (uchar *)env_ptr,
 			     CONFIG_ENV_SIZE);
@@ -77,7 +77,7 @@
 	eeprom_init ();	/* prepare for EEPROM read/write */
 
 	/* read old CRC */
-	eeprom_read (CFG_DEF_EEPROM_ADDR,
+	eeprom_read (CONFIG_SYS_DEF_EEPROM_ADDR,
 		     CONFIG_ENV_OFFSET+offsetof(env_t,crc),
 		     (uchar *)&crc, sizeof(ulong));
 
@@ -87,7 +87,7 @@
 	while (len > 0) {
 		int n = (len > sizeof(buf)) ? sizeof(buf) : len;
 
-		eeprom_read (CFG_DEF_EEPROM_ADDR, CONFIG_ENV_OFFSET+off, buf, n);
+		eeprom_read (CONFIG_SYS_DEF_EEPROM_ADDR, CONFIG_ENV_OFFSET+off, buf, n);
 		new = crc32 (new, buf, n);
 		len -= n;
 		off += n;
diff --git a/common/env_embedded.c b/common/env_embedded.c
index e79f843..ae6cac4 100644
--- a/common/env_embedded.c
+++ b/common/env_embedded.c
@@ -51,7 +51,7 @@
  * a seperate section.  Note that ENV_CRC is only defined when building
  * U-Boot itself.
  */
-#if (defined(CFG_USE_PPCENV) || defined(CONFIG_NAND_U_BOOT)) && \
+#if (defined(CONFIG_SYS_USE_PPCENV) || defined(CONFIG_NAND_U_BOOT)) && \
      defined(ENV_CRC) /* Environment embedded in U-Boot .ppcenv section */
 /* XXX - This only works with GNU C */
 #  define __PPCENV__ __attribute__ ((section(".ppcenv")))
@@ -98,7 +98,7 @@
 
 env_t environment __PPCENV__ = {
 	ENV_CRC,	/* CRC Sum */
-#ifdef CFG_REDUNDAND_ENVIRONMENT
+#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
 	1,		/* Flags: valid */
 #endif
 	{
@@ -150,8 +150,8 @@
 #ifdef	CONFIG_SERVERIP
 	"serverip="	MK_STR(CONFIG_SERVERIP)		"\0"
 #endif
-#ifdef	CFG_AUTOLOAD
-	"autoload="	CFG_AUTOLOAD			"\0"
+#ifdef	CONFIG_SYS_AUTOLOAD
+	"autoload="	CONFIG_SYS_AUTOLOAD			"\0"
 #endif
 #ifdef	CONFIG_ROOTPATH
 	"rootpath="	MK_STR(CONFIG_ROOTPATH)		"\0"
diff --git a/common/env_nvram.c b/common/env_nvram.c
index a8b7959..562edd0 100644
--- a/common/env_nvram.c
+++ b/common/env_nvram.c
@@ -35,7 +35,7 @@
  * space using its address and data registers. To enable usage of
  * NVRAM in those cases I invented the functions 'nvram_read()' and
  * 'nvram_write()', which will be activated upon the configuration
- * #define CFG_NVRAM_ACCESS_ROUTINE. Note, that those functions are
+ * #define CONFIG_SYS_NVRAM_ACCESS_ROUTINE. Note, that those functions are
  * strongly dependent on the used HW, and must be redefined for each
  * board that wants to use them.
  */
@@ -47,7 +47,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifdef CFG_NVRAM_ACCESS_ROUTINE
+#ifdef CONFIG_SYS_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;
@@ -63,7 +63,7 @@
 #ifdef CONFIG_AMIGAONEG3SE
 uchar env_get_char_spec (int index)
 {
-#ifdef CFG_NVRAM_ACCESS_ROUTINE
+#ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
 	uchar c;
 
 	nvram_read(&c, CONFIG_ENV_ADDR+index, 1);
@@ -80,7 +80,7 @@
 #else
 uchar env_get_char_spec (int index)
 {
-#ifdef CFG_NVRAM_ACCESS_ROUTINE
+#ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
 	uchar c;
 
 	nvram_read(&c, CONFIG_ENV_ADDR+index, 1);
@@ -94,7 +94,7 @@
 
 void env_relocate_spec (void)
 {
-#if defined(CFG_NVRAM_ACCESS_ROUTINE)
+#if defined(CONFIG_SYS_NVRAM_ACCESS_ROUTINE)
 	nvram_read(env_ptr, CONFIG_ENV_ADDR, CONFIG_ENV_SIZE);
 #else
 	memcpy (env_ptr, (void*)CONFIG_ENV_ADDR, CONFIG_ENV_SIZE);
@@ -107,7 +107,7 @@
 #ifdef CONFIG_AMIGAONEG3SE
 	enable_nvram();
 #endif
-#ifdef CFG_NVRAM_ACCESS_ROUTINE
+#ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
 	nvram_write(CONFIG_ENV_ADDR, env_ptr, CONFIG_ENV_SIZE);
 #else
 	if (memcpy ((char *)CONFIG_ENV_ADDR, env_ptr, CONFIG_ENV_SIZE) == NULL)
@@ -131,7 +131,7 @@
 #ifdef CONFIG_AMIGAONEG3SE
 	enable_nvram();
 #endif
-#if defined(CFG_NVRAM_ACCESS_ROUTINE)
+#if defined(CONFIG_SYS_NVRAM_ACCESS_ROUTINE)
 	ulong crc;
 	uchar data[ENV_SIZE];
 	nvram_read (&crc, CONFIG_ENV_ADDR, sizeof(ulong));
diff --git a/common/flash.c b/common/flash.c
index fe39d55..eb4b2f5 100644
--- a/common/flash.c
+++ b/common/flash.c
@@ -26,7 +26,7 @@
 #include <common.h>
 #include <flash.h>
 
-#if !defined(CFG_NO_FLASH)
+#if !defined(CONFIG_SYS_NO_FLASH)
 
 extern flash_info_t  flash_info[]; /* info for FLASH chips */
 
@@ -75,19 +75,19 @@
 		 */
 		if (from <= end && to >= info->start[i]) {
 			if (flag & FLAG_PROTECT_CLEAR) {
-#if defined(CFG_FLASH_PROTECTION)
+#if defined(CONFIG_SYS_FLASH_PROTECTION)
 				flash_real_protect(info, i, 0);
 #else
 				info->protect[i] = 0;
-#endif	/* CFG_FLASH_PROTECTION */
+#endif	/* CONFIG_SYS_FLASH_PROTECTION */
 				debug ("protect off %d\n", i);
 			}
 			else if (flag & FLAG_PROTECT_SET) {
-#if defined(CFG_FLASH_PROTECTION)
+#if defined(CONFIG_SYS_FLASH_PROTECTION)
 				flash_real_protect(info, i, 1);
 #else
 				info->protect[i] = 1;
-#endif	/* CFG_FLASH_PROTECTION */
+#endif	/* CONFIG_SYS_FLASH_PROTECTION */
 				debug ("protect on %d\n", i);
 			}
 		}
@@ -104,7 +104,7 @@
 	flash_info_t *info;
 	int i;
 
-	for (i=0, info = &flash_info[0]; i<CFG_MAX_FLASH_BANKS; ++i, ++info) {
+	for (i=0, info = &flash_info[0]; i<CONFIG_SYS_MAX_FLASH_BANKS; ++i, ++info) {
 		if (info->flash_id != FLASH_UNKNOWN &&
 		    addr >= info->start[0] &&
 		    /* WARNING - The '- 1' is needed if the flash
@@ -225,4 +225,4 @@
 
 /*-----------------------------------------------------------------------
  */
-#endif /* !CFG_NO_FLASH */
+#endif /* !CONFIG_SYS_NO_FLASH */
diff --git a/common/hush.c b/common/hush.c
index 67bed39..9aef6e4 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -96,7 +96,7 @@
 /*cmd_boot.c*/
 extern int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);      /* do_bootd */
 #endif
-#ifdef CFG_HUSH_PARSER
+#ifdef CONFIG_SYS_HUSH_PARSER
 #ifndef __U_BOOT__
 #include <ctype.h>     /* isalpha, isdigit */
 #include <unistd.h>    /* getpid */
@@ -1019,9 +1019,9 @@
 	fflush(stdout);
 	i->p = the_command;
 #else
-	extern char console_buffer[CFG_CBSIZE];
+	extern char console_buffer[CONFIG_SYS_CBSIZE];
 	int n;
-	static char the_command[CFG_CBSIZE];
+	static char the_command[CONFIG_SYS_CBSIZE];
 
 #ifdef CONFIG_BOOT_RETRY_TIME
 #  ifdef CONFIG_RESET_TO_RETRY
@@ -1033,9 +1033,9 @@
 #endif
 	i->__promptme = 1;
 	if (i->promptmode == 1) {
-		n = readline(CFG_PROMPT);
+		n = readline(CONFIG_SYS_PROMPT);
 	} else {
-		n = readline(CFG_PROMPT_HUSH_PS2);
+		n = readline(CONFIG_SYS_PROMPT_HUSH_PS2);
 	}
 #ifdef CONFIG_BOOT_RETRY_TIME
 	if (n == -2) {
@@ -1075,7 +1075,7 @@
 	else {
 		if (console_buffer[0] != '\n') {
 			if (strlen(the_command) + strlen(console_buffer)
-			    < CFG_CBSIZE) {
+			    < CONFIG_SYS_CBSIZE) {
 				n = strlen(the_command);
 				the_command[n-1] = ' ';
 				strcpy(&the_command[n],console_buffer);
@@ -3624,7 +3624,7 @@
 }
 
 U_BOOT_CMD(
-	showvar, CFG_MAXARGS, 1,	do_showvar,
+	showvar, CONFIG_SYS_MAXARGS, 1,	do_showvar,
 	"showvar- print local hushshell variables\n",
 	"\n    - print values of all hushshell variables\n"
 	"showvar name ...\n"
@@ -3632,5 +3632,5 @@
 );
 
 #endif
-#endif /* CFG_HUSH_PARSER */
+#endif /* CONFIG_SYS_HUSH_PARSER */
 /****************************************************************************/
diff --git a/common/image.c b/common/image.c
index 0b7bd8d..866edf6 100644
--- a/common/image.c
+++ b/common/image.c
@@ -426,8 +426,8 @@
 		return tmp;
 	}
 
-#if defined(CFG_SDRAM_BASE)
-	return CFG_SDRAM_BASE;
+#if defined(CONFIG_SYS_SDRAM_BASE)
+	return CONFIG_SYS_SDRAM_BASE;
 #elif defined(CONFIG_ARM)
 	return gd->bd->bi_dram[0].start;
 #else
@@ -440,7 +440,7 @@
 	char *s = getenv ("bootm_size");
 	if (s) {
 		phys_size_t tmp;
-#ifdef CFG_64BIT_STRTOUL
+#ifdef CONFIG_SYS_64BIT_STRTOUL
 		tmp = (phys_size_t)simple_strtoull (s, NULL, 16);
 #else
 		tmp = (phys_size_t)simple_strtoul (s, NULL, 16);
@@ -663,7 +663,7 @@
 
 	if (addr_dataflash (img_addr)){
 		/* ger RAM address */
-		ram_addr = CFG_LOAD_ADDR;
+		ram_addr = CONFIG_SYS_LOAD_ADDR;
 
 		/* get header size */
 		h_size = image_get_header_size ();
@@ -1154,8 +1154,8 @@
 }
 #endif /* CONFIG_FIT */
 
-#ifndef CFG_FDT_PAD
-#define CFG_FDT_PAD 0x3000
+#ifndef CONFIG_SYS_FDT_PAD
+#define CONFIG_SYS_FDT_PAD 0x3000
 #endif
 
 /**
@@ -1190,7 +1190,7 @@
 		goto error;
 	}
 
-#ifndef CFG_NO_FLASH
+#ifndef CONFIG_SYS_NO_FLASH
 	/* move the blob if it is in flash (set relocate) */
 	if (addr2info ((ulong)fdt_blob) != NULL)
 		relocate = 1;
@@ -1202,8 +1202,8 @@
 	if (fdt_blob < (char *)bootmap_base)
 		relocate = 1;
 
-	if ((fdt_blob + *of_size + CFG_FDT_PAD) >=
-			((char *)CFG_BOOTMAPSZ + bootmap_base))
+	if ((fdt_blob + *of_size + CONFIG_SYS_FDT_PAD) >=
+			((char *)CONFIG_SYS_BOOTMAPSZ + bootmap_base))
 		relocate = 1;
 
 	/* move flattend device tree if needed */
@@ -1213,9 +1213,9 @@
 
 		/* position on a 4K boundary before the alloc_current */
 		/* Pad the FDT by a specified amount */
-		of_len = *of_size + CFG_FDT_PAD;
+		of_len = *of_size + CONFIG_SYS_FDT_PAD;
 		of_start = (unsigned long)lmb_alloc_base(lmb, of_len, 0x1000,
-				(CFG_BOOTMAPSZ + bootmap_base));
+				(CONFIG_SYS_BOOTMAPSZ + bootmap_base));
 
 		if (of_start == 0) {
 			puts("device tree - allocation error\n");
@@ -1240,7 +1240,7 @@
 		*of_size = of_len;
 	} else {
 		*of_flat_tree = fdt_blob;
-		of_len = (CFG_BOOTMAPSZ + bootmap_base) - (ulong)fdt_blob;
+		of_len = (CONFIG_SYS_BOOTMAPSZ + bootmap_base) - (ulong)fdt_blob;
 		lmb_reserve(lmb, (ulong)fdt_blob, of_len);
 		fdt_set_totalsize(*of_flat_tree, of_len);
 
@@ -1598,8 +1598,8 @@
 	char *cmdline;
 	char *s;
 
-	cmdline = (char *)(ulong)lmb_alloc_base(lmb, CFG_BARGSIZE, 0xf,
-					 CFG_BOOTMAPSZ + bootmap_base);
+	cmdline = (char *)(ulong)lmb_alloc_base(lmb, CONFIG_SYS_BARGSIZE, 0xf,
+					 CONFIG_SYS_BOOTMAPSZ + bootmap_base);
 
 	if (cmdline == NULL)
 		return -1;
@@ -1635,7 +1635,7 @@
 int boot_get_kbd (struct lmb *lmb, bd_t **kbd, ulong bootmap_base)
 {
 	*kbd = (bd_t *)(ulong)lmb_alloc_base(lmb, sizeof(bd_t), 0xf,
-				      CFG_BOOTMAPSZ + bootmap_base);
+				      CONFIG_SYS_BOOTMAPSZ + bootmap_base);
 	if (*kbd == NULL)
 		return -1;
 
diff --git a/common/kgdb.c b/common/kgdb.c
index b14898b..adc15dd 100644
--- a/common/kgdb.c
+++ b/common/kgdb.c
@@ -574,7 +574,7 @@
 }
 
 U_BOOT_CMD(
-	kgdb, CFG_MAXARGS, 1,	do_kgdb,
+	kgdb, CONFIG_SYS_MAXARGS, 1,	do_kgdb,
 	"kgdb    - enter gdb remote debug mode\n",
 	"[arg0 arg1 .. argN]\n"
 	"    - executes a breakpoint so that kgdb mode is\n"
diff --git a/common/lcd.c b/common/lcd.c
index 25f8664..d104b26 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -386,13 +386,13 @@
 	lcd_setcolreg  (CONSOLE_COLOR_WHITE,	0xFF, 0xFF, 0xFF);
 #endif
 
-#ifndef CFG_WHITE_ON_BLACK
+#ifndef CONFIG_SYS_WHITE_ON_BLACK
 	lcd_setfgcolor (CONSOLE_COLOR_BLACK);
 	lcd_setbgcolor (CONSOLE_COLOR_WHITE);
 #else
 	lcd_setfgcolor (CONSOLE_COLOR_WHITE);
 	lcd_setbgcolor (CONSOLE_COLOR_BLACK);
-#endif	/* CFG_WHITE_ON_BLACK */
+#endif	/* CONFIG_SYS_WHITE_ON_BLACK */
 
 #ifdef	LCD_TEST_PATTERN
 	test_pattern();
@@ -531,7 +531,7 @@
 #if defined(CONFIG_PXA250)
 	struct pxafb_info *fbi = &panel_info.pxa;
 #elif defined(CONFIG_MPC823)
-	volatile immap_t *immr = (immap_t *) CFG_IMMR;
+	volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
 	volatile cpm8xx_t *cp = &(immr->im_cpm);
 #endif
 
@@ -571,7 +571,7 @@
 			*(cmap + BMP_LOGO_OFFSET) = lut_entry;
 			cmap++;
 #else /* !CONFIG_ATMEL_LCD */
-#ifdef  CFG_INVERT_COLORS
+#ifdef  CONFIG_SYS_INVERT_COLORS
 			*cmap++ = 0xffff - colreg;
 #else
 			*cmap++ = colreg;
@@ -627,7 +627,7 @@
 #if defined(CONFIG_PXA250)
 	struct pxafb_info *fbi = &panel_info.pxa;
 #elif defined(CONFIG_MPC823)
-	volatile immap_t *immr = (immap_t *) CFG_IMMR;
+	volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
 	volatile cpm8xx_t *cp = &(immr->im_cpm);
 #endif
 
@@ -681,7 +681,7 @@
 				( ((cte.red)   << 8) & 0xf800) |
 				( ((cte.green) << 3) & 0x07e0) |
 				( ((cte.blue)  >> 3) & 0x001f) ;
-#ifdef CFG_INVERT_COLORS
+#ifdef CONFIG_SYS_INVERT_COLORS
 			*cmap = 0xffff - colreg;
 #else
 			*cmap = colreg;
@@ -845,7 +845,7 @@
 	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
 		dram_size += gd->bd->bi_dram[i].size;
 	nand_size = 0;
-	for (i = 0; i < CFG_MAX_NAND_DEVICE; i++)
+	for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)
 		nand_size += nand_info[i].size;
 	sprintf (info, "  %ld MB SDRAM, %ld MB NAND",
 		dram_size >> 20,
diff --git a/common/main.c b/common/main.c
index 9a9fc9d..a999a5d 100644
--- a/common/main.c
+++ b/common/main.c
@@ -34,7 +34,7 @@
 #include <malloc.h>		/* for free() prototype */
 #endif
 
-#ifdef CFG_HUSH_PARSER
+#ifdef CONFIG_SYS_HUSH_PARSER
 #include <hush.h>
 #endif
 
@@ -68,7 +68,7 @@
 
 #undef DEBUG_PARSER
 
-char        console_buffer[CFG_CBSIZE];		/* console I/O buffer	*/
+char        console_buffer[CONFIG_SYS_CBSIZE];		/* console I/O buffer	*/
 
 static char * delete_char (char *buffer, char *p, int *colp, int *np, int plen);
 static char erase_seq[] = "\b \b";		/* erase sequence	*/
@@ -272,8 +272,8 @@
 
 void main_loop (void)
 {
-#ifndef CFG_HUSH_PARSER
-	static char lastcommand[CFG_CBSIZE] = { 0, };
+#ifndef CONFIG_SYS_HUSH_PARSER
+	static char lastcommand[CONFIG_SYS_CBSIZE] = { 0, };
 	int len;
 	int rc = 1;
 	int flag;
@@ -337,7 +337,7 @@
 	}
 #endif /* CONFIG_VERSION_VARIABLE */
 
-#ifdef CFG_HUSH_PARSER
+#ifdef CONFIG_SYS_HUSH_PARSER
 	u_boot_hush_start ();
 #endif
 
@@ -355,7 +355,7 @@
 		int prev = disable_ctrlc(1);	/* disable Control C checking */
 # endif
 
-# ifndef CFG_HUSH_PARSER
+# ifndef CONFIG_SYS_HUSH_PARSER
 		run_command (p, 0);
 # else
 		parse_string_outer(p, FLAG_PARSE_SEMICOLON |
@@ -401,7 +401,7 @@
 		int prev = disable_ctrlc(1);	/* disable Control C checking */
 # endif
 
-# ifndef CFG_HUSH_PARSER
+# ifndef CONFIG_SYS_HUSH_PARSER
 		run_command (s, 0);
 # else
 		parse_string_outer(s, FLAG_PARSE_SEMICOLON |
@@ -417,7 +417,7 @@
 	if (menukey == CONFIG_MENUKEY) {
 	    s = getenv("menucmd");
 	    if (s) {
-# ifndef CFG_HUSH_PARSER
+# ifndef CONFIG_SYS_HUSH_PARSER
 		run_command (s, 0);
 # else
 		parse_string_outer(s, FLAG_PARSE_SEMICOLON |
@@ -438,7 +438,7 @@
 	/*
 	 * Main Loop for Monitor Command Processing
 	 */
-#ifdef CFG_HUSH_PARSER
+#ifdef CONFIG_SYS_HUSH_PARSER
 	parse_file_outer();
 	/* This point is never reached */
 	for (;;);
@@ -452,7 +452,7 @@
 			reset_cmd_timeout();
 		}
 #endif
-		len = readline (CFG_PROMPT);
+		len = readline (CONFIG_SYS_PROMPT);
 
 		flag = 0;	/* assume no special flags for now */
 		if (len > 0)
@@ -483,7 +483,7 @@
 			lastcommand[0] = 0;
 		}
 	}
-#endif /*CFG_HUSH_PARSER*/
+#endif /*CONFIG_SYS_HUSH_PARSER*/
 }
 
 #ifdef CONFIG_BOOT_RETRY_TIME
@@ -1042,7 +1042,7 @@
 			/*
 			 * Must be a normal character then
 			 */
-			if (n < CFG_CBSIZE-2) {
+			if (n < CONFIG_SYS_CBSIZE-2) {
 				if (c == '\t') {	/* expand TABs		*/
 #ifdef CONFIG_AUTO_COMPLETE
 					/* if auto completion triggered just continue */
@@ -1111,7 +1111,7 @@
 #ifdef DEBUG_PARSER
 	printf ("parse_line: \"%s\"\n", line);
 #endif
-	while (nargs < CFG_MAXARGS) {
+	while (nargs < CONFIG_SYS_MAXARGS) {
 
 		/* skip any white space */
 		while ((*line == ' ') || (*line == '\t')) {
@@ -1144,7 +1144,7 @@
 		*line++ = '\0';		/* terminate current arg	 */
 	}
 
-	printf ("** Too many args (max. %d) **\n", CFG_MAXARGS);
+	printf ("** Too many args (max. %d) **\n", CONFIG_SYS_MAXARGS);
 
 #ifdef DEBUG_PARSER
 	printf ("parse_line: nargs=%d\n", nargs);
@@ -1159,7 +1159,7 @@
 	char c, prev;
 	const char *varname_start = NULL;
 	int inputcnt = strlen (input);
-	int outputcnt = CFG_CBSIZE;
+	int outputcnt = CONFIG_SYS_CBSIZE;
 	int state = 0;		/* 0 = waiting for '$'  */
 
 	/* 1 = waiting for '(' or '{' */
@@ -1219,7 +1219,7 @@
 		case 2:	/* Waiting for )        */
 			if (c == ')' || c == '}') {
 				int i;
-				char envname[CFG_CBSIZE], *envval;
+				char envname[CONFIG_SYS_CBSIZE], *envval;
 				int envcnt = input - varname_start - 1;	/* Varname # of chars */
 
 				/* Get the varname */
@@ -1270,7 +1270,7 @@
  *	0  - command executed but not repeatable, interrupted commands are
  *	     always considered not repeatable
  *	-1 - not executed (unrecognized, bootd recursion or too many args)
- *           (If cmd is NULL or "" or longer than CFG_CBSIZE-1 it is
+ *           (If cmd is NULL or "" or longer than CONFIG_SYS_CBSIZE-1 it is
  *           considered unrecognized)
  *
  * WARNING:
@@ -1284,12 +1284,12 @@
 int run_command (const char *cmd, int flag)
 {
 	cmd_tbl_t *cmdtp;
-	char cmdbuf[CFG_CBSIZE];	/* working copy of cmd		*/
+	char cmdbuf[CONFIG_SYS_CBSIZE];	/* working copy of cmd		*/
 	char *token;			/* start of token in cmdbuf	*/
 	char *sep;			/* end of token (separator) in cmdbuf */
-	char finaltoken[CFG_CBSIZE];
+	char finaltoken[CONFIG_SYS_CBSIZE];
 	char *str = cmdbuf;
-	char *argv[CFG_MAXARGS + 1];	/* NULL terminated	*/
+	char *argv[CONFIG_SYS_MAXARGS + 1];	/* NULL terminated	*/
 	int argc, inquotes;
 	int repeatable = 1;
 	int rc = 0;
@@ -1306,7 +1306,7 @@
 		return -1;	/* empty command */
 	}
 
-	if (strlen(cmd) >= CFG_CBSIZE) {
+	if (strlen(cmd) >= CONFIG_SYS_CBSIZE) {
 		puts ("## Command too long!\n");
 		return -1;
 	}
@@ -1425,7 +1425,7 @@
 			printf ("## Error: \"%s\" not defined\n", argv[i]);
 			return 1;
 		}
-#ifndef CFG_HUSH_PARSER
+#ifndef CONFIG_SYS_HUSH_PARSER
 		if (run_command (arg, flag) == -1)
 			return 1;
 #else
diff --git a/common/miiphyutil.c b/common/miiphyutil.c
index 5ef4a33..66fd9ca 100644
--- a/common/miiphyutil.c
+++ b/common/miiphyutil.c
@@ -462,7 +462,7 @@
 #endif
 }
 
-#ifdef CFG_FAULT_ECHO_LINK_DOWN
+#ifdef CONFIG_SYS_FAULT_ECHO_LINK_DOWN
 /*****************************************************************************
  *
  * Determine link status
diff --git a/common/serial.c b/common/serial.c
index bfda7ca..b38d1e7 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -43,7 +43,7 @@
 #elif defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_440) \
    || defined(CONFIG_405EP) || defined(CONFIG_405EZ) || defined(CONFIG_405EX) \
    || defined(CONFIG_MPC5xxx)
-#if defined(CONFIG_CONS_INDEX) && defined(CFG_NS16550_SERIAL)
+#if defined(CONFIG_CONS_INDEX) && defined(CONFIG_SYS_NS16550_SERIAL)
 #if (CONFIG_CONS_INDEX==1)
 	return &eserial1_device;
 #elif (CONFIG_CONS_INDEX==2)
@@ -110,20 +110,20 @@
 	serial_register(&serial1_device);
 #endif
 
-#if defined(CFG_NS16550_SERIAL)
-#if defined(CFG_NS16550_COM1)
+#if defined(CONFIG_SYS_NS16550_SERIAL)
+#if defined(CONFIG_SYS_NS16550_COM1)
 	serial_register(&eserial1_device);
 #endif
-#if defined(CFG_NS16550_COM2)
+#if defined(CONFIG_SYS_NS16550_COM2)
 	serial_register(&eserial2_device);
 #endif
-#if defined(CFG_NS16550_COM3)
+#if defined(CONFIG_SYS_NS16550_COM3)
 	serial_register(&eserial3_device);
 #endif
-#if defined(CFG_NS16550_COM4)
+#if defined(CONFIG_SYS_NS16550_COM4)
 	serial_register(&eserial4_device);
 #endif
-#endif /* CFG_NS16550_SERIAL */
+#endif /* CONFIG_SYS_NS16550_SERIAL */
 #if defined (CONFIG_FFUART)
 	serial_register(&serial_ffuart_device);
 #endif
diff --git a/common/spartan2.c b/common/spartan2.c
index ebac388..f5ba7fc 100644
--- a/common/spartan2.c
+++ b/common/spartan2.c
@@ -32,8 +32,8 @@
 #define PRINTF(fmt,args...)
 #endif
 
-#undef CFG_FPGA_CHECK_BUSY
-#undef CFG_FPGA_PROG_FEEDBACK
+#undef CONFIG_SYS_FPGA_CHECK_BUSY
+#undef CONFIG_SYS_FPGA_PROG_FEEDBACK
 
 /* Note: The assumption is that we cannot possibly run fast enough to
  * overrun the device (the Slave Parallel mode can free run at 50MHz).
@@ -44,8 +44,8 @@
 #define CONFIG_FPGA_DELAY()
 #endif
 
-#ifndef CFG_FPGA_WAIT
-#define CFG_FPGA_WAIT CFG_HZ/100	/* 10 ms */
+#ifndef CONFIG_SYS_FPGA_WAIT
+#define CONFIG_SYS_FPGA_WAIT CONFIG_SYS_HZ/100	/* 10 ms */
 #endif
 
 static int Spartan2_sp_load( Xilinx_desc *desc, void *buf, size_t bsize );
@@ -180,7 +180,7 @@
 		 * Continuous Data Loading in Slave Parallel Mode for
 		 * the Spartan-II Family.
 		 */
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		printf ("Loading FPGA Device %d...\n", cookie);
 #endif
 		/*
@@ -201,7 +201,7 @@
 		/* Now wait for INIT and BUSY to go high */
 		do {
 			CONFIG_FPGA_DELAY ();
-			if (get_timer (ts) > CFG_FPGA_WAIT) {	/* check the time */
+			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {	/* check the time */
 				puts ("** Timeout waiting for INIT to clear.\n");
 				(*fn->abort) (cookie);	/* abort the burn */
 				return FPGA_FAIL;
@@ -223,7 +223,7 @@
 			CONFIG_FPGA_DELAY ();
 			(*fn->clk) (TRUE, TRUE, cookie);	/* Assert the clock pin */
 
-#ifdef CFG_FPGA_CHECK_BUSY
+#ifdef CONFIG_SYS_FPGA_CHECK_BUSY
 			ts = get_timer (0);	/* get current time */
 			while ((*fn->busy) (cookie)) {
 				/* XXX - we should have a check in here somewhere to
@@ -234,7 +234,7 @@
 				CONFIG_FPGA_DELAY ();
 				(*fn->clk) (TRUE, TRUE, cookie);	/* Assert the clock pin */
 
-				if (get_timer (ts) > CFG_FPGA_WAIT) {	/* check the time */
+				if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {	/* check the time */
 					puts ("** Timeout waiting for BUSY to clear.\n");
 					(*fn->abort) (cookie);	/* abort the burn */
 					return FPGA_FAIL;
@@ -242,7 +242,7 @@
 			}
 #endif
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 			if (bytecount % (bsize / 40) == 0)
 				putc ('.');		/* let them know we are alive */
 #endif
@@ -252,7 +252,7 @@
 		(*fn->cs) (FALSE, TRUE, cookie);	/* Deassert the chip select */
 		(*fn->wr) (FALSE, TRUE, cookie);	/* Deassert the write pin */
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		putc ('\n');			/* terminate the dotted line */
 #endif
 
@@ -268,7 +268,7 @@
 			CONFIG_FPGA_DELAY ();
 			(*fn->clk) (TRUE, TRUE, cookie);	/* Assert the clock pin */
 
-			if (get_timer (ts) > CFG_FPGA_WAIT) {	/* check the time */
+			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {	/* check the time */
 				puts ("** Timeout waiting for DONE to clear.\n");
 				(*fn->abort) (cookie);	/* abort the burn */
 				ret_val = FPGA_FAIL;
@@ -277,7 +277,7 @@
 		}
 
 		if (ret_val == FPGA_SUCCESS) {
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 			puts ("Done.\n");
 #endif
 		}
@@ -289,7 +289,7 @@
 		}
 
 		else {
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 			puts ("Fail.\n");
 #endif
 		}
@@ -323,7 +323,7 @@
 			(*fn->clk) (FALSE, TRUE, cookie);	/* Deassert the clock pin */
 			(*fn->clk) (TRUE, TRUE, cookie);	/* Assert the clock pin */
 			(*fn->rdata) (&(data[bytecount++]), cookie);	/* read the data */
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 			if (bytecount % (bsize / 40) == 0)
 				putc ('.');		/* let them know we are alive */
 #endif
@@ -333,7 +333,7 @@
 		(*fn->clk) (FALSE, TRUE, cookie);	/* Deassert the clock pin */
 		(*fn->clk) (TRUE, TRUE, cookie);	/* Assert the clock pin */
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		putc ('\n');			/* terminate the dotted line */
 #endif
 		puts ("Done.\n");
@@ -460,7 +460,7 @@
 				"done:\t0x%p\n\n",
 				__FUNCTION__, &fn, fn, fn->pgm, fn->init,
 				fn->clk, fn->wr, fn->done);
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		printf ("Loading FPGA Device %d...\n", cookie);
 #endif
 
@@ -478,7 +478,7 @@
 		ts = get_timer (0);		/* get current time */
 		do {
 			CONFIG_FPGA_DELAY ();
-			if (get_timer (ts) > CFG_FPGA_WAIT) {	/* check the time */
+			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {	/* check the time */
 				puts ("** Timeout waiting for INIT to start.\n");
 				return FPGA_FAIL;
 			}
@@ -492,7 +492,7 @@
 		/* Now wait for INIT to go high */
 		do {
 			CONFIG_FPGA_DELAY ();
-			if (get_timer (ts) > CFG_FPGA_WAIT) {	/* check the time */
+			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {	/* check the time */
 				puts ("** Timeout waiting for INIT to clear.\n");
 				return FPGA_FAIL;
 			}
@@ -523,7 +523,7 @@
 				i --;
 			} while (i > 0);
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 			if (bytecount % (bsize / 40) == 0)
 				putc ('.');		/* let them know we are alive */
 #endif
@@ -531,7 +531,7 @@
 
 		CONFIG_FPGA_DELAY ();
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		putc ('\n');			/* terminate the dotted line */
 #endif
 
@@ -551,7 +551,7 @@
 
 			putc ('*');
 
-			if (get_timer (ts) > CFG_FPGA_WAIT) {	/* check the time */
+			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {	/* check the time */
 				puts ("** Timeout waiting for DONE to clear.\n");
 				ret_val = FPGA_FAIL;
 				break;
@@ -566,7 +566,7 @@
 			(*fn->post) (cookie);
 		}
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		if (ret_val == FPGA_SUCCESS) {
 			puts ("Done.\n");
 		}
diff --git a/common/spartan3.c b/common/spartan3.c
index 8f1ab80..9ce41f1 100644
--- a/common/spartan3.c
+++ b/common/spartan3.c
@@ -37,8 +37,8 @@
 #define PRINTF(fmt,args...)
 #endif
 
-#undef CFG_FPGA_CHECK_BUSY
-#undef CFG_FPGA_PROG_FEEDBACK
+#undef CONFIG_SYS_FPGA_CHECK_BUSY
+#undef CONFIG_SYS_FPGA_PROG_FEEDBACK
 
 /* Note: The assumption is that we cannot possibly run fast enough to
  * overrun the device (the Slave Parallel mode can free run at 50MHz).
@@ -49,8 +49,8 @@
 #define CONFIG_FPGA_DELAY()
 #endif
 
-#ifndef CFG_FPGA_WAIT
-#define CFG_FPGA_WAIT CFG_HZ/100	/* 10 ms */
+#ifndef CONFIG_SYS_FPGA_WAIT
+#define CONFIG_SYS_FPGA_WAIT CONFIG_SYS_HZ/100	/* 10 ms */
 #endif
 
 static int Spartan3_sp_load( Xilinx_desc *desc, void *buf, size_t bsize );
@@ -185,7 +185,7 @@
 		 * Continuous Data Loading in Slave Parallel Mode for
 		 * the Spartan-II Family.
 		 */
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		printf ("Loading FPGA Device %d...\n", cookie);
 #endif
 		/*
@@ -206,7 +206,7 @@
 		/* Now wait for INIT and BUSY to go high */
 		do {
 			CONFIG_FPGA_DELAY ();
-			if (get_timer (ts) > CFG_FPGA_WAIT) {	/* check the time */
+			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {	/* check the time */
 				puts ("** Timeout waiting for INIT to clear.\n");
 				(*fn->abort) (cookie);	/* abort the burn */
 				return FPGA_FAIL;
@@ -228,7 +228,7 @@
 			CONFIG_FPGA_DELAY ();
 			(*fn->clk) (TRUE, TRUE, cookie);	/* Assert the clock pin */
 
-#ifdef CFG_FPGA_CHECK_BUSY
+#ifdef CONFIG_SYS_FPGA_CHECK_BUSY
 			ts = get_timer (0);	/* get current time */
 			while ((*fn->busy) (cookie)) {
 				/* XXX - we should have a check in here somewhere to
@@ -239,7 +239,7 @@
 				CONFIG_FPGA_DELAY ();
 				(*fn->clk) (TRUE, TRUE, cookie);	/* Assert the clock pin */
 
-				if (get_timer (ts) > CFG_FPGA_WAIT) {	/* check the time */
+				if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {	/* check the time */
 					puts ("** Timeout waiting for BUSY to clear.\n");
 					(*fn->abort) (cookie);	/* abort the burn */
 					return FPGA_FAIL;
@@ -247,7 +247,7 @@
 			}
 #endif
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 			if (bytecount % (bsize / 40) == 0)
 				putc ('.');		/* let them know we are alive */
 #endif
@@ -257,7 +257,7 @@
 		(*fn->cs) (FALSE, TRUE, cookie);	/* Deassert the chip select */
 		(*fn->wr) (FALSE, TRUE, cookie);	/* Deassert the write pin */
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		putc ('\n');			/* terminate the dotted line */
 #endif
 
@@ -273,7 +273,7 @@
 			CONFIG_FPGA_DELAY ();
 			(*fn->clk) (TRUE, TRUE, cookie);	/* Assert the clock pin */
 
-			if (get_timer (ts) > CFG_FPGA_WAIT) {	/* check the time */
+			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {	/* check the time */
 				puts ("** Timeout waiting for DONE to clear.\n");
 				(*fn->abort) (cookie);	/* abort the burn */
 				ret_val = FPGA_FAIL;
@@ -282,7 +282,7 @@
 		}
 
 		if (ret_val == FPGA_SUCCESS) {
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 			puts ("Done.\n");
 #endif
 		}
@@ -294,7 +294,7 @@
 		}
 
 		else {
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 			puts ("Fail.\n");
 #endif
 		}
@@ -328,7 +328,7 @@
 			(*fn->clk) (FALSE, TRUE, cookie);	/* Deassert the clock pin */
 			(*fn->clk) (TRUE, TRUE, cookie);	/* Assert the clock pin */
 			(*fn->rdata) (&(data[bytecount++]), cookie);	/* read the data */
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 			if (bytecount % (bsize / 40) == 0)
 				putc ('.');		/* let them know we are alive */
 #endif
@@ -338,7 +338,7 @@
 		(*fn->clk) (FALSE, TRUE, cookie);	/* Deassert the clock pin */
 		(*fn->clk) (TRUE, TRUE, cookie);	/* Assert the clock pin */
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		putc ('\n');			/* terminate the dotted line */
 #endif
 		puts ("Done.\n");
@@ -465,7 +465,7 @@
 				"done:\t0x%p\n\n",
 				__FUNCTION__, &fn, fn, fn->pgm, fn->init,
 				fn->clk, fn->wr, fn->done);
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		printf ("Loading FPGA Device %d...\n", cookie);
 #endif
 
@@ -483,7 +483,7 @@
 		ts = get_timer (0);		/* get current time */
 		do {
 			CONFIG_FPGA_DELAY ();
-			if (get_timer (ts) > CFG_FPGA_WAIT) {	/* check the time */
+			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {	/* check the time */
 				puts ("** Timeout waiting for INIT to start.\n");
 				return FPGA_FAIL;
 			}
@@ -497,7 +497,7 @@
 		/* Now wait for INIT to go high */
 		do {
 			CONFIG_FPGA_DELAY ();
-			if (get_timer (ts) > CFG_FPGA_WAIT) {	/* check the time */
+			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {	/* check the time */
 				puts ("** Timeout waiting for INIT to clear.\n");
 				return FPGA_FAIL;
 			}
@@ -528,7 +528,7 @@
 				i --;
 			} while (i > 0);
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 			if (bytecount % (bsize / 40) == 0)
 				putc ('.');		/* let them know we are alive */
 #endif
@@ -536,7 +536,7 @@
 
 		CONFIG_FPGA_DELAY ();
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		putc ('\n');			/* terminate the dotted line */
 #endif
 
@@ -556,7 +556,7 @@
 
 			putc ('*');
 
-			if (get_timer (ts) > CFG_FPGA_WAIT) {	/* check the time */
+			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) {	/* check the time */
 				puts ("** Timeout waiting for DONE to clear.\n");
 				ret_val = FPGA_FAIL;
 				break;
@@ -571,7 +571,7 @@
 			(*fn->post) (cookie);
 		}
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		if (ret_val == FPGA_SUCCESS) {
 			puts ("Done.\n");
 		}
diff --git a/common/update.c b/common/update.c
index 938cc06..7528474 100644
--- a/common/update.c
+++ b/common/update.c
@@ -30,8 +30,8 @@
 #error "CONFIG_FIT and CONFIG_OF_LIBFDT are required for auto-update feature"
 #endif
 
-#if defined(CFG_NO_FLASH)
-#error "CFG_NO_FLASH defined, but FLASH is required for auto-update feature"
+#if defined(CONFIG_SYS_NO_FLASH)
+#error "CONFIG_SYS_NO_FLASH defined, but FLASH is required for auto-update feature"
 #endif
 
 #include <command.h>
@@ -120,12 +120,12 @@
 
 	if (prot == 0) {
 		saved_prot_info =
-			calloc(CFG_MAX_FLASH_BANKS * CFG_MAX_FLASH_SECT, 1);
+			calloc(CONFIG_SYS_MAX_FLASH_BANKS * CONFIG_SYS_MAX_FLASH_SECT, 1);
 		if (!saved_prot_info)
 			return 1;
 	}
 
-	for (bank = 0; bank < CFG_MAX_FLASH_BANKS; ++bank) {
+	for (bank = 0; bank < CONFIG_SYS_MAX_FLASH_BANKS; ++bank) {
 		cnt = 0;
 		info = &flash_info[bank];
 
@@ -134,7 +134,7 @@
 			return 0;
 
 		/* Point to current bank protection information */
-		sp_info_ptr = saved_prot_info + (bank * CFG_MAX_FLASH_SECT);
+		sp_info_ptr = saved_prot_info + (bank * CONFIG_SYS_MAX_FLASH_SECT);
 
 		/*
 		 * Adjust addr_first or addr_last if we are on bank boundary.
@@ -159,7 +159,7 @@
 
 			/* Protect/unprotect sectors */
 			if (sp_info_ptr[i] == 1) {
-#if defined(CFG_FLASH_PROTECTION)
+#if defined(CONFIG_SYS_FLASH_PROTECTION)
 				if (flash_real_protect(info, i, prot))
 					return 1;
 #else
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 920bb0f..cf14560 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -36,7 +36,7 @@
  * are switched to the serial port, else the settings in the
  * environment are used
  */
-#ifdef CFG_CONSOLE_OVERWRITE_ROUTINE
+#ifdef CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
 extern int overwrite_console (void);
 #else
 int overwrite_console (void)
@@ -120,7 +120,7 @@
 /* test if a character is in the queue */
 static int usb_kbd_testc(void)
 {
-#ifdef CFG_USB_EVENT_POLL
+#ifdef CONFIG_SYS_USB_EVENT_POLL
 	usb_event_poll();
 #endif
 	if(usb_in_pointer==usb_out_pointer)
@@ -133,7 +133,7 @@
 {
 	char c;
 	while(usb_in_pointer==usb_out_pointer) {
-#ifdef CFG_USB_EVENT_POLL
+#ifdef CONFIG_SYS_USB_EVENT_POLL
 		usb_event_poll();
 #endif
 	}
diff --git a/common/virtex2.c b/common/virtex2.c
index 52da1b2..50d0921 100644
--- a/common/virtex2.c
+++ b/common/virtex2.c
@@ -43,34 +43,34 @@
 
 /*
  * If the SelectMap interface can be overrun by the processor, define
- * CFG_FPGA_CHECK_BUSY and/or CONFIG_FPGA_DELAY in the board configuration
+ * CONFIG_SYS_FPGA_CHECK_BUSY and/or CONFIG_FPGA_DELAY in the board configuration
  * file and add board-specific support for checking BUSY status. By default,
  * assume that the SelectMap interface cannot be overrun.
  */
-#ifndef CFG_FPGA_CHECK_BUSY
-#undef CFG_FPGA_CHECK_BUSY
+#ifndef CONFIG_SYS_FPGA_CHECK_BUSY
+#undef CONFIG_SYS_FPGA_CHECK_BUSY
 #endif
 
 #ifndef CONFIG_FPGA_DELAY
 #define CONFIG_FPGA_DELAY()
 #endif
 
-#ifndef CFG_FPGA_PROG_FEEDBACK
-#define CFG_FPGA_PROG_FEEDBACK
+#ifndef CONFIG_SYS_FPGA_PROG_FEEDBACK
+#define CONFIG_SYS_FPGA_PROG_FEEDBACK
 #endif
 
 /*
  * Don't allow config cycle to be interrupted
  */
-#ifndef CFG_FPGA_CHECK_CTRLC
-#undef CFG_FPGA_CHECK_CTRLC
+#ifndef CONFIG_SYS_FPGA_CHECK_CTRLC
+#undef CONFIG_SYS_FPGA_CHECK_CTRLC
 #endif
 
 /*
  * Check for errors during configuration by default
  */
-#ifndef CFG_FPGA_CHECK_ERROR
-#define CFG_FPGA_CHECK_ERROR
+#ifndef CONFIG_SYS_FPGA_CHECK_ERROR
+#define CONFIG_SYS_FPGA_CHECK_ERROR
 #endif
 
 /*
@@ -81,8 +81,8 @@
  * which yields 11.44 mS.  So let's make it bigger in order to handle
  * an XC2V1000, if anyone can ever get ahold of one.
  */
-#ifndef CFG_FPGA_WAIT_INIT
-#define CFG_FPGA_WAIT_INIT	CFG_HZ/2	/* 500 ms */
+#ifndef CONFIG_SYS_FPGA_WAIT_INIT
+#define CONFIG_SYS_FPGA_WAIT_INIT	CONFIG_SYS_HZ/2	/* 500 ms */
 #endif
 
 /*
@@ -90,15 +90,15 @@
  * This is normally not necessary since for most reasonable configuration
  * clock frequencies (i.e. 66 MHz or less), BUSY monitoring is unnecessary.
  */
-#ifndef CFG_FPGA_WAIT_BUSY
-#define CFG_FPGA_WAIT_BUSY	CFG_HZ/200	/* 5 ms*/
+#ifndef CONFIG_SYS_FPGA_WAIT_BUSY
+#define CONFIG_SYS_FPGA_WAIT_BUSY	CONFIG_SYS_HZ/200	/* 5 ms*/
 #endif
 
 /* Default timeout for waiting for FPGA to enter operational mode after
  * configuration data has been written.
  */
-#ifndef	CFG_FPGA_WAIT_CONFIG
-#define CFG_FPGA_WAIT_CONFIG	CFG_HZ/5	/* 200 ms */
+#ifndef	CONFIG_SYS_FPGA_WAIT_CONFIG
+#define CONFIG_SYS_FPGA_WAIT_CONFIG	CONFIG_SYS_HZ/5	/* 200 ms */
 #endif
 
 static int Virtex2_ssm_load (Xilinx_desc * desc, void *buf, size_t bsize);
@@ -232,7 +232,7 @@
 				fn->clk, fn->cs, fn->wr, fn->rdata, fn->wdata,
 				fn->busy, fn->abort, fn->post);
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		printf ("Initializing FPGA Device %d...\n", cookie);
 #endif
 		/*
@@ -252,10 +252,10 @@
 		udelay (10);
 		ts = get_timer (0);
 		do {
-			if (get_timer (ts) > CFG_FPGA_WAIT_INIT) {
+			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT_INIT) {
 				printf ("%s:%d: ** Timeout after %d ticks waiting for INIT"
 						" to assert.\n", __FUNCTION__, __LINE__,
-						CFG_FPGA_WAIT_INIT);
+						CONFIG_SYS_FPGA_WAIT_INIT);
 				(*fn->abort) (cookie);
 				return FPGA_FAIL;
 			}
@@ -271,10 +271,10 @@
 		ts = get_timer (0);
 		do {
 			CONFIG_FPGA_DELAY ();
-			if (get_timer (ts) > CFG_FPGA_WAIT_INIT) {
+			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT_INIT) {
 				printf ("%s:%d: ** Timeout after %d ticks waiting for INIT"
 						" to deassert.\n", __FUNCTION__, __LINE__,
-						CFG_FPGA_WAIT_INIT);
+						CONFIG_SYS_FPGA_WAIT_INIT);
 				(*fn->abort) (cookie);
 				return FPGA_FAIL;
 			}
@@ -289,7 +289,7 @@
 		 * Load the data byte by byte
 		 */
 		while (bytecount < bsize) {
-#ifdef CFG_FPGA_CHECK_CTRLC
+#ifdef CONFIG_SYS_FPGA_CHECK_CTRLC
 			if (ctrlc ()) {
 				(*fn->abort) (cookie);
 				return FPGA_FAIL;
@@ -302,7 +302,7 @@
 			    break;
 			}
 
-#ifdef CFG_FPGA_CHECK_ERROR
+#ifdef CONFIG_SYS_FPGA_CHECK_ERROR
 			if ((*fn->init) (cookie)) {
 				printf ("\n%s:%d:  ** Error: INIT asserted during"
 						" configuration\n", __FUNCTION__, __LINE__);
@@ -323,20 +323,20 @@
 			CONFIG_FPGA_DELAY ();
 			(*fn->clk) (TRUE, TRUE, cookie);
 
-#ifdef CFG_FPGA_CHECK_BUSY
+#ifdef CONFIG_SYS_FPGA_CHECK_BUSY
 			ts = get_timer (0);
 			while ((*fn->busy) (cookie)) {
-				if (get_timer (ts) > CFG_FPGA_WAIT_BUSY) {
+				if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT_BUSY) {
 					printf ("%s:%d: ** Timeout after %d ticks waiting for"
 							" BUSY to deassert\n",
-							__FUNCTION__, __LINE__, CFG_FPGA_WAIT_BUSY);
+							__FUNCTION__, __LINE__, CONFIG_SYS_FPGA_WAIT_BUSY);
 					(*fn->abort) (cookie);
 					return FPGA_FAIL;
 				}
 			}
 #endif
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 			if (bytecount % (bsize / 40) == 0)
 				putc ('.');
 #endif
@@ -349,7 +349,7 @@
 		(*fn->cs) (FALSE, TRUE, cookie);
 		(*fn->wr) (FALSE, TRUE, cookie);
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		putc ('\n');
 #endif
 
@@ -360,10 +360,10 @@
 		ts = get_timer (0);
 		ret_val = FPGA_SUCCESS;
 		while (((*fn->done) (cookie) == FPGA_FAIL) || (*fn->init) (cookie)) {
-			if (get_timer (ts) > CFG_FPGA_WAIT_CONFIG) {
+			if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT_CONFIG) {
 				printf ("%s:%d: ** Timeout after %d ticks waiting for DONE to"
 						"assert and INIT to deassert\n",
-						__FUNCTION__, __LINE__, CFG_FPGA_WAIT_CONFIG);
+						__FUNCTION__, __LINE__, CONFIG_SYS_FPGA_WAIT_CONFIG);
 				(*fn->abort) (cookie);
 				ret_val = FPGA_FAIL;
 				break;
@@ -371,7 +371,7 @@
 		}
 
 		if (ret_val == FPGA_SUCCESS) {
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 			printf ("Initialization of FPGA device %d complete\n", cookie);
 #endif
 			/*
@@ -381,7 +381,7 @@
 				(*fn->post) (cookie);
 			}
 		} else {
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 			printf ("** Initialization of FPGA device %d FAILED\n",
 					cookie);
 #endif
@@ -412,7 +412,7 @@
 		(*fn->clk) (TRUE, TRUE, cookie);
 
 		while (bytecount < bsize) {
-#ifdef CFG_FPGA_CHECK_CTRLC
+#ifdef CONFIG_SYS_FPGA_CHECK_CTRLC
 			if (ctrlc ()) {
 				(*fn->abort) (cookie);
 				return FPGA_FAIL;
@@ -424,7 +424,7 @@
 			(*fn->clk) (FALSE, TRUE, cookie);
 			(*fn->clk) (TRUE, TRUE, cookie);
 			(*fn->rdata) (&(data[bytecount++]), cookie);
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 			if (bytecount % (bsize / 40) == 0)
 				putc ('.');
 #endif
@@ -437,7 +437,7 @@
 		(*fn->clk) (FALSE, TRUE, cookie);
 		(*fn->clk) (TRUE, TRUE, cookie);
 
-#ifdef CFG_FPGA_PROG_FEEDBACK
+#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
 		putc ('\n');
 #endif
 		puts ("Done.\n");