summaryrefslogtreecommitdiffstats
path: root/sys/boot/arm/at91
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2006-10-21 22:44:26 +0000
committerimp <imp@FreeBSD.org>2006-10-21 22:44:26 +0000
commit42aaacd5963155b4a4c142aa1e15e3e6b0531f76 (patch)
tree1b56f3bd59804c8cccf867fda1140d06f93cdef3 /sys/boot/arm/at91
parent824e6015c6b776e76be94918e8a5a6257aa800c9 (diff)
downloadFreeBSD-src-42aaacd5963155b4a4c142aa1e15e3e6b0531f76.zip
FreeBSD-src-42aaacd5963155b4a4c142aa1e15e3e6b0531f76.tar.gz
MFp4: Update to smaller code footprint.
Diffstat (limited to 'sys/boot/arm/at91')
-rw-r--r--sys/boot/arm/at91/bootspi/Makefile2
-rw-r--r--sys/boot/arm/at91/bootspi/arm_init.S6
-rw-r--r--sys/boot/arm/at91/bootspi/env_vars.c4
-rw-r--r--sys/boot/arm/at91/bootspi/loader_prompt.c65
-rw-r--r--sys/boot/arm/at91/bootspi/main.c7
5 files changed, 67 insertions, 17 deletions
diff --git a/sys/boot/arm/at91/bootspi/Makefile b/sys/boot/arm/at91/bootspi/Makefile
index 9205e29..517ac68 100644
--- a/sys/boot/arm/at91/bootspi/Makefile
+++ b/sys/boot/arm/at91/bootspi/Makefile
@@ -2,7 +2,7 @@
P=bootspi
FILES=${P}
-SRCS=arm_init.S main.c loader_prompt.c env_vars.c
+SRCS=arm_init.S main.c loader_prompt.c env_vars.c ee.c
NO_MAN=
LDFLAGS=-e 0 -T ${.CURDIR}/../linker.cfg
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
diff --git a/sys/boot/arm/at91/bootspi/arm_init.S b/sys/boot/arm/at91/bootspi/arm_init.S
index 499bd8b..cc6f8df 100644
--- a/sys/boot/arm/at91/bootspi/arm_init.S
+++ b/sys/boot/arm/at91/bootspi/arm_init.S
@@ -59,7 +59,11 @@ pabtvec:
dabtvec:
B dabtvec @; Data Abort
rsvdvec:
+#ifdef BOOT_IIC
+ .long 12 << 10 @; 12k from iic part
+#else
.long ((1056 << 17) | (13 << 13) | (12 * 2))
+#endif
irqvec:
ldr pc, [pc,#-0xF20] @; IRQ : read the AIC
fiqvec:
@@ -109,7 +113,7 @@ BootCommandSection:
.string "e 0x10000000 "
.string " "
#else
-#if 0
+#if 1
.string "Bootloader for KB9202 Evaluation Board."
.string "m 42 53 44 0 0 1 "
.string "ip 206 168 13 194 "
diff --git a/sys/boot/arm/at91/bootspi/env_vars.c b/sys/boot/arm/at91/bootspi/env_vars.c
index 94b1fbd..7ab250e 100644
--- a/sys/boot/arm/at91/bootspi/env_vars.c
+++ b/sys/boot/arm/at91/bootspi/env_vars.c
@@ -82,7 +82,7 @@ DumpBootCommands(void)
int i;
for (i = 0; boot_commands[i][0]; i++)
- printf("0x%x : %s[E]\r\n", i, boot_commands[i]);
+ printf("0x%x : %s[E]\n", i, boot_commands[i]);
}
@@ -125,6 +125,6 @@ ExecuteEnvironmentFunctions(void)
currentOffset = 0;
DumpBootCommands();
- printf("Autoboot...\r\n");
+ printf("Autoboot...\n");
Bootloader(ReadCharFromEnvironment);
}
diff --git a/sys/boot/arm/at91/bootspi/loader_prompt.c b/sys/boot/arm/at91/bootspi/loader_prompt.c
index a947261..41c419e 100644
--- a/sys/boot/arm/at91/bootspi/loader_prompt.c
+++ b/sys/boot/arm/at91/bootspi/loader_prompt.c
@@ -29,6 +29,8 @@
#include "env_vars.h"
#include "lib.h"
#include "spi_flash.h"
+#include "fpga.h"
+#include "ee.h"
/******************************* GLOBALS *************************************/
@@ -65,6 +67,36 @@ static const command_entry_t CommandTable[] = {
{COMMAND_FINAL_FLAG, 0}
};
+#ifdef TSC_FPGA
+#include "fpga.h"
+
+const struct fpga main_fpga =
+{
+ AT91C_BASE_PIOB, AT91C_PIO_PB0,
+ AT91C_BASE_PIOC, AT91C_PIO_PC11,
+ AT91C_BASE_PIOB, AT91C_PIO_PB2,
+ AT91C_BASE_PIOC, AT91C_PIO_PC12
+};
+
+void
+fpga_load(void)
+{
+ int len, off, i, offset;
+ char *addr = (char *)SDRAM_BASE + (1 << 20); /* Load to base + 1MB */
+
+ len = FPGA_LEN;
+ offset = FPGA_OFFSET;
+ for (i = 0; i < len; i+= FLASH_PAGE_SIZE) {
+ off = i + offset;
+ SPI_ReadFlash(off, addr + i, FLASH_PAGE_SIZE);
+ }
+ fpga_init(&main_fpga);
+ fpga_clear(&main_fpga);
+ fpga_write_bytes(&main_fpga, addr, len);
+ fpga_done(&main_fpga);
+}
+#endif
+
/*
* .KB_C_FN_DEFINITION_START
* unsigned BuildIP(void)
@@ -93,7 +125,7 @@ StringToCommand(char *cPtr)
int i;
for (i = 0; CommandTable[i].command != COMMAND_FINAL_FLAG; ++i)
- if (!p_strcmp(CommandTable[i].c_string, cPtr))
+ if (!strcmp(CommandTable[i].c_string, cPtr))
return (CommandTable[i].command);
return (COMMAND_INVALID);
@@ -150,7 +182,7 @@ UpdateEEProm(int eeaddr)
while ((len = xmodem_rx(addr)) == -1)
continue;
- printf("\r\nDownloaded %u bytes.\r\n", len);
+ printf("\nDownloaded %u bytes.\n", len);
WriteEEPROM(eeaddr, 0, addr, len);
}
#endif
@@ -163,7 +195,7 @@ UpdateFlash(int offset)
while ((len = xmodem_rx(addr)) == -1)
continue;
- printf("\r\nDownloaded %u bytes.\r\n", len);
+ printf("\nDownloaded %u bytes.\n", len);
for (i = 0; i < len; i+= FLASH_PAGE_SIZE) {
off = i + offset;
SPI_WriteFlash(off, addr + i, FLASH_PAGE_SIZE);
@@ -270,29 +302,38 @@ ParseCommand(char *buffer)
break;
case COMMAND_RESET:
- printf("Reset\r\n");
+ printf("Reset\n");
reset();
while (1) continue;
break;
case COMMAND_REPLACE_KERNEL_VIA_XMODEM:
- printf("Updating KERNEL image\r\n");
+ printf("Updating KERNEL image\n");
UpdateFlash(KERNEL_OFFSET);
break;
case COMMAND_REPLACE_FPGA_VIA_XMODEM:
- printf("Updating FPGA image\r\n");
+ printf("Updating FPGA image\n");
UpdateFlash(FPGA_OFFSET);
break;
case COMMAND_REPLACE_FLASH_VIA_XMODEM:
- printf("Updating FLASH image\r\n");
+ printf("Updating FLASH image\n");
UpdateFlash(FLASH_OFFSET);
break;
+ case COMMAND_REPLACE_ID_EEPROM:
+ {
+ char buf[25];
+ printf("Testing Config EEPROM\n");
+ EEWrite(0, "This is a test", 15);
+ EERead(0, buf, 15);
+ printf("Found '%s'\n", buf);
+ break;
+ }
default:
break;
}
- printf("\r\n");
+ printf("\n");
}
@@ -301,7 +342,7 @@ ParseCommand(char *buffer)
* void ServicePrompt(char)
* This private function process each character checking for valid commands.
* This function is only executed if the character is considered valid.
- * Each command is terminated with NULL (0) or '\r'.
+ * Each command is terminated with NULL (0) or ''.
* .KB_C_FN_DEFINITION_END
*/
static void
@@ -323,11 +364,11 @@ ServicePrompt(char p_char)
putchar(p_char);
}
if (!p_char) {
- printf("\r\n");
+ printf("\n");
ParseCommand(inputBuffer);
p_memset(inputBuffer, 0, MAX_INPUT_SIZE);
buffCount = 0;
- printf("\r\n>");
+ printf("\n>");
}
}
@@ -352,7 +393,7 @@ Bootloader(int(*inputFunction)(int))
p_memset((void*)inputBuffer, 0, sizeof(inputBuffer));
buffCount = 0;
- printf("\r\n>");
+ printf("\n>");
while (1)
if ((ch = ((*inputFunction)(0))) > 0)
diff --git a/sys/boot/arm/at91/bootspi/main.c b/sys/boot/arm/at91/bootspi/main.c
index 1a39f72..c15dabc 100644
--- a/sys/boot/arm/at91/bootspi/main.c
+++ b/sys/boot/arm/at91/bootspi/main.c
@@ -41,12 +41,17 @@
#include "emac.h"
#include "lib.h"
#include "spi_flash.h"
+#include "ee.h"
int
main(void)
{
- printf("\r\nBoot\r\n");
+ printf("\nBoot\n");
+ EEInit();
SPI_InitFlash();
+#ifdef TSC_FPGA
+ fpga_load();
+#endif
EMAC_Init();
LoadBootCommands();
if (getc(1) == -1) {
OpenPOWER on IntegriCloud