PERFORCE change 96617 for review

Warner Losh imp at FreeBSD.org
Wed May 3 21:18:38 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=96617

Change 96617 by imp at imp_hammer on 2006/05/03 21:17:55

	12k images, allow FPGA burning (note: we have to load the FPGA image
	from the SPI part).

Affected files ...

.. //depot/projects/arm/src/sys/boot/arm/at91/Makefile.inc#14 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootspi/Makefile#8 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootspi/loader_prompt.c#2 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootspi/loader_prompt.h#2 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootspi/main.c#5 edit

Differences ...

==== //depot/projects/arm/src/sys/boot/arm/at91/Makefile.inc#14 (text+ko) ====

@@ -20,7 +20,7 @@
 .if defined(P)
 ${P}:	${P}.out
 	objcopy -S -O binary ${P}.out ${.TARGET}
-	@set -- `ls -l ${.TARGET}`; x=$$((8192-$$5)); \
+	@set -- `ls -l ${.TARGET}`; x=$$((12288-$$5)); \
 	    echo "$$x bytes available"; test $$x -ge 0
 
 ${P}.out: ${OBJS}
@@ -35,4 +35,10 @@
 MK_TAG_LIST:=no
 .endif
 
+.if defined(WITHOUT_FPGA)
+MK_FPGA:=no
+.else
+MK_FPGA:=yes
+.endif
+
 .endif

==== //depot/projects/arm/src/sys/boot/arm/at91/bootspi/Makefile#8 (text+ko) ====

@@ -8,3 +8,12 @@
 OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
 
 .include <bsd.prog.mk>
+
+.if ${MK_TAG_LIST} != "no"
+CFLAGS += -I${.CURDIR}/.. -DSUPPORT_TAG_LIST
+SRCS+=tag_list.c
+.endif
+
+.if ${MK_FPGA} != "no"
+CFLAGS += -DTSC_FPGA
+.endif

==== //depot/projects/arm/src/sys/boot/arm/at91/bootspi/loader_prompt.c#2 (text+ko) ====


==== //depot/projects/arm/src/sys/boot/arm/at91/bootspi/loader_prompt.h#2 (text+ko) ====


==== //depot/projects/arm/src/sys/boot/arm/at91/bootspi/main.c#5 (text+ko) ====

@@ -1,57 +1,85 @@
-/*******************************************************************************
+/*-
+ * Copyright (c) 2006 M. Warner Losh.  All rights reserved.
  *
- * Filename: main.c
+ * 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.
  *
- * Basic entry points for top-level functions
+ * 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.
  *
- * Revision information:
+ * This software is derived from software provided by kwikbyte without
+ * copyright as follows:
  *
- * 20AUG2004	kb_admin	initial creation
- * 12JAN2005	kb_admin	cosmetic changes
- * 29APR2005	kb_admin	modified boot delay
- *
- * BEGIN_KBDD_BLOCK
  * No warranty, expressed or implied, is included with this software.  It is
  * provided "AS IS" and no warranty of any kind including statutory or aspects
  * relating to merchantability or fitness for any purpose is provided.  All
  * intellectual property rights of others is maintained with the respective
  * owners.  This software is not copyrighted and is intended for reference
  * only.
- * END_BLOCK
  *
- * $FreeBSD: src/sys/boot/arm/at91/bootspi/main.c,v 1.1 2006/04/19 17:16:48 imp Exp $
- ******************************************************************************/
+ * $FreeBSD$
+ */
 
 #include "env_vars.h"
+#include "at91rm9200.h"
 #include "at91rm9200_lowlevel.h"
 #include "loader_prompt.h"
 #include "emac.h"
 #include "lib.h"
+#ifdef TSC_FPGA
+#include "spi_flash.h"
+#include "fpga.h"
+
+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
+};
+
+static void
+fpga_load(void)
+{
+	int len;
+	char *addr = (char *)SDRAM_BASE + (1 << 20); /* Load to base + 1MB */
+
+	SPI_InitFlash();
+	len = 212482;
+	SPI_ReadFlash(15 * FLASH_PAGE_SIZE, addr, len);
+	printf("Loading %u bytes into the FPGA...\r\n", len);
+	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
- * int main(void)
- *  This global function waits at least one second, but not more than two 
- * seconds, for input from the serial port.  If no response is recognized,
- * it acts according to the parameters specified by the environment.  For 
- * example, the function might boot an operating system.  Do not return
- * from this function.
- * .KB_C_FN_DEFINITION_END
- */
 int
 main(void)
 {
-
+#ifdef TSC_FPGA
+	fpga_load();
+#endif
 	EMAC_Init();
-
 	LoadBootCommands();
-
 	printf("\r\nSPI Boot loader.\r\nAutoboot...\r\n");
-
 	if (getc(1) == -1)
 		ExecuteEnvironmentFunctions();
-
 	Bootloader(0);
-
 	return (1);
 }


More information about the p4-projects mailing list