MFp4: Make boot2 work on Kwikbyte KB9202 boards.

This commit is contained in:
Warner Losh 2006-11-09 20:07:26 +00:00
parent c2c2926f9e
commit e2a7a4c11c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=164134
4 changed files with 67 additions and 10 deletions

View File

@ -1,16 +1,22 @@
# $FreeBSD$
.PATH: ${.CURDIR}/../bootspi
.PATH: ${.CURDIR}/../libat91
P=boot2
FILES=${P}
SRCS=arm_init.S boot2.c kb920x_board.c ee.c
SRCS=arm_init.S boot2.c ${BOOT_FLAVOR}_board.c
NO_MAN=
LDFLAGS=-e 0 -T ${.CURDIR}/../linker.cfg
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
.include <bsd.prog.mk>
.if ${BOOT_FLAVOR} == "tsc"
SRCS+=ee.c
.endif
.if ${BOOT_FLAVOR} == "kb920x"
CFLAGS+=-DBOOT_IIC
.endif
CFLAGS+= \
-I${.CURDIR}/../bootspi \
-I${.CURDIR}/../../../common \

View File

@ -0,0 +1,28 @@
/*-
* Copyright (c) 2006 M. Warner Losh. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
void Update(void);
void board_init(void);

View File

@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$");
#include "lib.h"
#include "sd-card.h"
#include "ee.h"
#include "board.h"
#define RBX_ASKNAME 0x0 /* -a */
#define RBX_SINGLE 0x1 /* -s */
@ -66,7 +67,7 @@ __FBSDID("$FreeBSD$");
#define PATH_CONFIG "/boot.config"
//#define PATH_KERNEL "/boot/kernel/kernel"
#define PATH_KERNEL "/kernel.gz.tramp"
#define PATH_KERNEL "/boot/kernel/kernel.gz.tramp"
#define NOPT 5
@ -141,9 +142,6 @@ getstr(int c)
}
}
// Each board has to provide one of these.
void board_init(void);
int
main(void)
{

View File

@ -1,3 +1,28 @@
/*-
* Copyright (c) 2006 M. Warner Losh. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@ -5,7 +30,7 @@ __FBSDID("$FreeBSD$");
#include "emac.h"
#include "lib.h"
#include "ee.h"
#include "board.h.h"
extern unsigned char mac[];
@ -14,10 +39,10 @@ MacFromEE()
{
uint32_t sig;
sig = 0;
EERead(12 * 1024, (uint8_t *)&sig, sizeof(sig));
ReadEEPROM(12 * 1024, (uint8_t *)&sig, sizeof(sig));
if (sig != 0xaa55aa55)
return;
EERead(12 * 1024 + 4, mac, 6);
ReadEEPROM(12 * 1024 + 4, mac, 6);
printf("MAC %x:%x:%x:%x:%x:%x\n", mac[0],
mac[1], mac[2], mac[3], mac[4], mac[5]);
}
@ -30,6 +55,6 @@ Update(void)
void
board_init(void)
{
EEInit();
InitEEPROM();
MacFromEE();
}