PERFORCE change 105703 for review
Warner Losh
imp at FreeBSD.org
Tue Sep 5 22:34:45 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=105703
Change 105703 by imp at imp_lighthouse on 2006/09/05 22:34:21
Load that thar FPGA
Affected files ...
.. //depot/projects/arm/src/sys/boot/arm/at91/boot2/boot2.c#11 edit
Differences ...
==== //depot/projects/arm/src/sys/boot/arm/at91/boot2/boot2.c#11 (text+ko) ====
@@ -186,6 +186,47 @@
}
}
+#ifdef BOOT_TSC
+#define TSC_FPGA
+#endif
+
+#ifdef TSC_FPGA
+#include "at91rm9200.h"
+#include "spi_flash.h"
+#include "fpga.h"
+
+#define FPGA_OFFSET (15 * FLASH_PAGE_SIZE)
+#define FPGA_LEN (212608)
+
+char buffer[FPGA_LEN];
+
+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 = buffer;
+
+ 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
+
int
main(void)
{
@@ -195,6 +236,12 @@
if (kname[0])
printf("bss not zero\r\n");
+#ifdef TSC_FPGA
+ SPI_InitFlash();
+ printf("Loading FPGA...");
+ fpga_load();
+ printf("done\r\n");
+#endif
EMAC_Init();
sdcard_init();
EMAC_SetMACAddress(mac);
More information about the p4-projects
mailing list