From owner-p4-projects@FreeBSD.ORG Wed May 3 22:44:03 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9B8FF16A40B; Wed, 3 May 2006 22:44:03 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 60D5716A405 for ; Wed, 3 May 2006 22:44:03 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2500043D45 for ; Wed, 3 May 2006 22:44:03 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k43Mi3CS010414 for ; Wed, 3 May 2006 22:44:03 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k43Mi2Js010411 for perforce@freebsd.org; Wed, 3 May 2006 22:44:02 GMT (envelope-from imp@freebsd.org) Date: Wed, 3 May 2006 22:44:02 GMT Message-Id: <200605032244.k43Mi2Js010411@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 96629 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2006 22:44:03 -0000 http://perforce.freebsd.org/chv.cgi?CH=96629 Change 96629 by imp@imp_hammer on 2006/05/03 22:43:41 Load a few more bytes into the FPGA... They seem to be needed, even though they are effectively random... Allow loading fpga via Xmodem for testing. # We still have 1.7k left, but I suspect that will fill soon... Affected files ... .. //depot/projects/arm/src/sys/boot/arm/at91/bootspi/loader_prompt.c#4 edit .. //depot/projects/arm/src/sys/boot/arm/at91/bootspi/loader_prompt.h#4 edit .. //depot/projects/arm/src/sys/boot/arm/at91/bootspi/main.c#7 edit Differences ... ==== //depot/projects/arm/src/sys/boot/arm/at91/bootspi/loader_prompt.c#4 (text+ko) ==== @@ -23,6 +23,7 @@ *****************************************************************************/ #include "at91rm9200_lowlevel.h" +#include "at91rm9200.h" #include "p_string.h" #include "eeprom.h" #ifdef SUPPORT_TAG_LIST @@ -33,6 +34,7 @@ #include "env_vars.h" #include "lib.h" #include "spi_flash.h" +#include "fpga.h" /******************************* GLOBALS *************************************/ @@ -65,11 +67,39 @@ {COMMAND_RESET, "R"}, {COMMAND_REPLACE_FLASH_VIA_XMODEM, "I"}, {COMMAND_REPLACE_FPGA_VIA_XMODEM, "F"}, + {COMMAND_PROGRAM_FPGA_VIA_XMODEM, "f"}, {COMMAND_FINAL_FLAG, 0} }; static unsigned tagAddress; +#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; + char *addr = (char *)SDRAM_BASE + (1 << 20); /* Load to base + 1MB */ + + len = 212608; + 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 * unsigned BuildIP(void) @@ -195,6 +225,21 @@ } } +static void +ProgramFpga(void) +{ + char *addr = (char *)SDRAM_BASE + (1 << 20); /* Load to base + 1MB */ + int len; + + while ((len = xmodem_rx(addr)) == -1) + continue; + 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); +} + /* * .KB_C_FN_DEFINITION_START * void ParseCommand(char *) @@ -364,6 +409,8 @@ printf("Updating FLASH image\r\n"); UpdateFlash(0); break; + case COMMAND_PROGRAM_FPGA_VIA_XMODEM: + ProgramFpga(); default: break; } ==== //depot/projects/arm/src/sys/boot/arm/at91/bootspi/loader_prompt.h#4 (text+ko) ==== @@ -43,6 +43,7 @@ COMMAND_RESET, COMMAND_REPLACE_FLASH_VIA_XMODEM, COMMAND_REPLACE_FPGA_VIA_XMODEM, + COMMAND_PROGRAM_FPGA_VIA_XMODEM, COMMAND_FINAL_FLAG } e_cmd_t; @@ -54,5 +55,6 @@ void EnterInteractiveBootloader(int(*inputFunction)(int)); void Bootloader(int(*inputFunction)(int)); +void fpga_load(void); #endif /* _LOADER_PROMPT_H_ */ ==== //depot/projects/arm/src/sys/boot/arm/at91/bootspi/main.c#7 (text+ko) ==== @@ -41,32 +41,6 @@ #include "emac.h" #include "lib.h" #include "spi_flash.h" -#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 -}; - -static void -fpga_load(void) -{ - int len; - char *addr = (char *)SDRAM_BASE + (1 << 20); /* Load to base + 1MB */ - - 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 int main(void)