Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 May 2007 23:13:30 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 119941 for review
Message-ID:  <200705162313.l4GNDU0X060665@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=119941

Change 119941 by imp@imp_lighthouse on 2007/05/16 23:13:28

	Revert.

Affected files ...

.. //depot/projects/arm/src/sys/boot/arm/at91/boot2/tsc_board.c#9 edit

Differences ...

==== //depot/projects/arm/src/sys/boot/arm/at91/boot2/tsc_board.c#9 (text+ko) ====

@@ -11,6 +11,10 @@
 
 unsigned char mac[6] = { 0x42, 0x53, 0x44, 0, 0, 1 };
 
+#define KLUDGE_STRAP
+#define TSC_FPGA
+
+#ifdef TSC_FPGA
 #include "at91rm9200.h"
 #include "spi_flash.h"
 #include "fpga.h"
@@ -34,7 +38,6 @@
 	int len, off, i, offset;
 	char *addr = buffer;
 
-	printf("Loading fpga...");
 	len = FPGA_LEN;
 	offset = FPGA_OFFSET;
 	for (i = 0; i < len; i+= FLASH_PAGE_SIZE) {
@@ -45,40 +48,92 @@
 	fpga_clear(&main_fpga);
 	fpga_write_bytes(&main_fpga, addr, len);
 	fpga_done(&main_fpga);
-	printf("done\n");
 }
+#endif
 
 static void
 MacFromEE()
 {	
+#if 0
 	uint32_t sig;
+#ifdef KLUDGE_STRAP
+	uint8_t euid64[8] = { 0x00, 0x30, 0x96, 0x20,
+			      0x00, 0x00, 0x00, 0x03 };
+#endif
 
+#ifdef KLUDGE_STRAP
+	printf("writing...\n");
+	sig = 0xaa55aa55;
+	EEWrite(0, (uint8_t *)&sig, sizeof(sig));
+	printf("euid64\n");
+	EEWrite(48, euid64, sizeof(euid64));
+	printf("done\n");
+#endif
 	sig = 0;
 	EERead(0, (uint8_t *)&sig, sizeof(sig));
 	if (sig != 0xaa55aa55)
 		return;
 	EERead(48, mac, 3);
 	EERead(48+5, mac+3, 3);
+#else
+	mac[0] = 0;
+	mac[1] = 0x30;
+	mac[2] = 0x96;
+	mac[3] = 0;
+	mac[4] = 0;
+	mac[5] = 3;
+#endif
 	printf("MAC %x:%x:%x:%x:%x:%x\n", mac[0],
 	  mac[1], mac[2], mac[3], mac[4], mac[5]);
 }
 
+#ifdef XMODEM_DL
+#define FLASH_OFFSET (0 * FLASH_PAGE_SIZE)
+#define FPGA_OFFSET  (15 * FLASH_PAGE_SIZE)
+#define FPGA_LEN     (212608)
+#define KERNEL_OFFSET (220 * FLASH_PAGE_SIZE)
+#define KERNEL_LEN (6 * 1024 * FLASH_PAGE_SIZE)
+
+static void
+UpdateFlash(int offset)
+{
+	char *addr = (char *)0x20000000 + (1 << 20); /* Load to base + 1MB */
+	int len, i, off;
+
+	while ((len = xmodem_rx(addr)) == -1)
+		continue;
+	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);
+	}
+}
 void
 Update(void)
 {
+	UpdateFlash(FLASH_OFFSET);
 }
 
+#else
+void
+Update(void)
+{
+}
+#endif
+
 void
 board_init(void)
 {
-	while (!sdcard_init())
-		printf("Probing for SD card...\n");
-	SPI_InitFlash();
-	fpga_load();
-	EEInit();
-	MacFromEE();
-	EMAC_Init();
-	EMAC_SetMACAddress(mac);
+#ifdef TSC_FPGA
+    SPI_InitFlash();
+    fpga_load();
+#endif
+    EEInit();
+    MacFromEE();
+    EMAC_Init();
+    sdcard_init();
+    EMAC_SetMACAddress(mac);
+
 }
 
 #include "../bootspi/ee.c"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705162313.l4GNDU0X060665>