From owner-p4-projects@FreeBSD.ORG Wed May 3 23:16:46 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 A4C0516A405; Wed, 3 May 2006 23:16:46 +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 7EDCE16A401 for ; Wed, 3 May 2006 23:16:46 +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 31AF143D45 for ; Wed, 3 May 2006 23:16:46 +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 k43NGkUW027643 for ; Wed, 3 May 2006 23:16:46 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k43NGjNK027637 for perforce@freebsd.org; Wed, 3 May 2006 23:16:45 GMT (envelope-from imp@freebsd.org) Date: Wed, 3 May 2006 23:16:45 GMT Message-Id: <200605032316.k43NGjNK027637@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 96632 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 23:16:47 -0000 http://perforce.freebsd.org/chv.cgi?CH=96632 Change 96632 by imp@imp_hammer on 2006/05/03 23:16:16 We need to read the pages from the flash one page at a time. Now FPGA loads on reset *AND* power cycles Affected files ... .. //depot/projects/arm/src/sys/boot/arm/at91/bootspi/loader_prompt.c#5 edit .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/fpga.c#3 edit .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/fpga.h#3 edit Differences ... ==== //depot/projects/arm/src/sys/boot/arm/at91/bootspi/loader_prompt.c#5 (text+ko) ==== @@ -87,11 +87,15 @@ void fpga_load(void) { - int len; + int len, off, i, offset; char *addr = (char *)SDRAM_BASE + (1 << 20); /* Load to base + 1MB */ len = 212608; - SPI_ReadFlash(15 * FLASH_PAGE_SIZE, addr, len); + offset = 15 * FLASH_PAGE_SIZE; + for (i = 0; i < len; i+= FLASH_PAGE_SIZE) { + off = i + offset; + SPI_ReadFlash(off, addr + i, FLASH_PAGE_SIZE); + } printf("Loading %u bytes into the FPGA...\r\n", len); fpga_init(&main_fpga); fpga_clear(&main_fpga); @@ -210,11 +214,9 @@ printf("\r\nDownloaded %u bytes.\r\n", len); p_memcpy(addr3, addr, (len + FLASH_PAGE_SIZE - 1) / FLASH_PAGE_SIZE * FLASH_PAGE_SIZE); - printf("Writing %u bytes to flash at %u\r\n", len, offset); for (i = 0; i < len; i+= FLASH_PAGE_SIZE) { for (j = 0; j < 10; j++) { - off = i + offset * FLASH_PAGE_SIZE; - printf("%u/%u\r", off, len + offset); + off = i + offset; SPI_WriteFlash(off, addr + i, FLASH_PAGE_SIZE); SPI_ReadFlash(off, addr2 + i, FLASH_PAGE_SIZE); if (p_memcmp(addr3 + i, addr2 + i, FLASH_PAGE_SIZE) == 0) @@ -403,7 +405,7 @@ case COMMAND_REPLACE_FPGA_VIA_XMODEM: printf("Updating FPGA image\r\n"); - UpdateFlash(15); + UpdateFlash(15 * FLASH_PAGE_SIZE); break; case COMMAND_REPLACE_FLASH_VIA_XMODEM: printf("Updating FLASH image\r\n"); ==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/fpga.c#3 (text+ko) ==== @@ -52,7 +52,7 @@ fpga->fpga_prog_n_pio->PIO_CODR = fpga->fpga_prog_n_mask; Delay(1); fpga->fpga_prog_n_pio->PIO_SODR = fpga->fpga_prog_n_mask; - Delay(2000); + Delay(4000); } void ==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/fpga.h#3 (text+ko) ====