diff options
Diffstat (limited to 'board')
-rw-r--r-- | board/kup/common/kup.c | 11 | ||||
-rw-r--r-- | board/kup/common/load_sernum_ethaddr.c | 94 | ||||
-rw-r--r-- | board/kup/kup4k/Makefile | 2 | ||||
-rw-r--r-- | board/kup/kup4k/kup4k.c | 5 | ||||
-rw-r--r-- | board/kup/kup4x/Makefile | 2 | ||||
-rw-r--r-- | board/kup/kup4x/kup4x.c | 6 |
6 files changed, 113 insertions, 7 deletions
diff --git a/board/kup/common/kup.c b/board/kup/common/kup.c index 69ffa2c..d018e3c 100644 --- a/board/kup/common/kup.c +++ b/board/kup/common/kup.c @@ -70,3 +70,14 @@ void poweron_key (void) else setenv ("key1", "on"); } + +#ifdef CONFIG_POST +/* + * Returns 1 if keys pressed to start the power-on long-running tests + * Called from board_init_f(). + */ +int post_hotkeys_pressed (void) +{ + return (0); +} +#endif diff --git a/board/kup/common/load_sernum_ethaddr.c b/board/kup/common/load_sernum_ethaddr.c new file mode 100644 index 0000000..39ee124 --- /dev/null +++ b/board/kup/common/load_sernum_ethaddr.c @@ -0,0 +1,94 @@ +/* + * (C) Copyright 2000-2004 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <mpc8xx.h> + +/*----------------------------------------------------------------------- + * Process Hardware Information Block: + * + * If we boot on a system fresh from factory, check if the Hardware + * Information Block exists and save the information it contains. + * + * The KUP Hardware Information Block is defined as + * follows: + * - located in first flash bank + * - starts at offset CFG_HWINFO_OFFSET + * - size CFG_HWINFO_SIZE + * + * Internal structure: + * - sequence of ASCII character lines + * - fields separated by <CR><LF> + * - last field terminated by NUL character (0x00) + * + * Fields in Hardware Information Block: + * 1) Module Type + * 2) MAC Address + * 3) .... + */ + + +#define ETHADDR_TOKEN "ethaddr=" +#define LCD_TOKEN "lcd=" + +void load_sernum_ethaddr (void) +{ + unsigned char *hwi; + unsigned char *var; + unsigned char hwi_stack[CFG_HWINFO_SIZE]; + unsigned char *p; + + hwi = (unsigned char *) (CFG_FLASH_BASE + CFG_HWINFO_OFFSET); + if (*((unsigned long *) hwi) != (unsigned long) CFG_HWINFO_MAGIC) { + printf ("HardwareInfo not found!\n"); + return; + } + memcpy (hwi_stack, hwi, CFG_HWINFO_SIZE); + + /* + ** ethaddr + */ + var = strstr (hwi_stack, ETHADDR_TOKEN); + if (var) { + var += sizeof (ETHADDR_TOKEN) - 1; + p = strchr (var, '\r'); + if (p < hwi + CFG_HWINFO_SIZE) { + *p = '\0'; + setenv ("ethaddr", var); + *p = '\r'; + } + } + /* + ** lcd + */ + var = strstr (hwi_stack, LCD_TOKEN); + if (var) { + var += sizeof (LCD_TOKEN) - 1; + p = strchr (var, '\r'); + if (p < hwi + CFG_HWINFO_SIZE) { + *p = '\0'; + setenv ("lcd", var); + *p = '\r'; + } + } +} diff --git a/board/kup/kup4k/Makefile b/board/kup/kup4k/Makefile index 5732044..62d289b 100644 --- a/board/kup/kup4k/Makefile +++ b/board/kup/kup4k/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = lib$(BOARD).a -OBJS = $(BOARD).o ../common/flash.o ../common/kup.o +OBJS = $(BOARD).o ../common/flash.o ../common/kup.o ../common/load_sernum_ethaddr.o $(LIB): .depend $(OBJS) $(AR) crv $@ $(OBJS) diff --git a/board/kup/kup4k/kup4k.c b/board/kup/kup4k/kup4k.c index 8bed3d5..c352c8b 100644 --- a/board/kup/kup4k/kup4k.c +++ b/board/kup/kup4k/kup4k.c @@ -129,11 +129,11 @@ int checkboard (void) */ immap->im_memctl.memc_or4 = 0xFFFF8926; immap->im_memctl.memc_br4 = 0x90000401; - + __asm__ ("eieio"); latch=(uchar *)0x90000200; rev = (*latch & 0xF8) >> 3; mod=(*latch & 0x03); - printf ("Board: KUP4K Rev %d.%d SN: %s\n",rev,mod,getenv("ethaddr")); + printf ("Board: KUP4K Rev %d.%d\n",rev,mod); return (0); } @@ -346,6 +346,7 @@ void lcd_logo (bd_t * bd) */ memctl->memc_or5 = 0xFFC007F0; /* 4 MB 17 WS or externel TA */ memctl->memc_br5 = 0x80080801; /* Start at 0x80080000 */ + __asm__ ("eieio"); fb_info.VmemAddr = (unsigned char *) (S1D_PHYSICAL_VMEM_ADDR); fb_info.RegAddr = (unsigned char *) (S1D_PHYSICAL_REG_ADDR); diff --git a/board/kup/kup4x/Makefile b/board/kup/kup4x/Makefile index 5732044..62d289b 100644 --- a/board/kup/kup4x/Makefile +++ b/board/kup/kup4x/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = lib$(BOARD).a -OBJS = $(BOARD).o ../common/flash.o ../common/kup.o +OBJS = $(BOARD).o ../common/flash.o ../common/kup.o ../common/load_sernum_ethaddr.o $(LIB): .depend $(OBJS) $(AR) crv $@ $(OBJS) diff --git a/board/kup/kup4x/kup4x.c b/board/kup/kup4x/kup4x.c index 53342e9..cd9ed13 100644 --- a/board/kup/kup4x/kup4x.c +++ b/board/kup/kup4x/kup4x.c @@ -24,6 +24,7 @@ #include <common.h> #include <mpc8xx.h> +#include <post.h> #include "../common/kup.h" #ifdef CONFIG_KUP4K_LOGO /* #include "s1d13706.h" */ @@ -123,12 +124,11 @@ int checkboard (void) */ memctl->memc_or4 = 0xFFFF8926; memctl->memc_br4 = 0x90000401; - + __asm__ ("eieio"); latch = (volatile uchar *) 0x90000200; rev = (*latch & 0xF8) >> 3; mod = (*latch & 0x03); - printf ("Board: KUP4X Rev %d.%d SN: %s\n", rev, mod, - getenv ("ethaddr")); + printf ("Board: KUP4X Rev %d.%d\n",rev,mod); return (0); } |