Date: Wed, 3 May 2006 23:16:45 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 96632 for review Message-ID: <200605032316.k43NGjNK027637@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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) ====
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605032316.k43NGjNK027637>