From owner-p4-projects@FreeBSD.ORG Fri Apr 28 22:56: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 D9C7F16A40E; Fri, 28 Apr 2006 22:56:02 +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 9AA9116A400 for ; Fri, 28 Apr 2006 22:56:02 +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 4794643D45 for ; Fri, 28 Apr 2006 22:56:02 +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 k3SMu2Lf035332 for ; Fri, 28 Apr 2006 22:56:02 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k3SMu155035328 for perforce@freebsd.org; Fri, 28 Apr 2006 22:56:01 GMT (envelope-from imp@freebsd.org) Date: Fri, 28 Apr 2006 22:56:01 GMT Message-Id: <200604282256.k3SMu155035328@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 96335 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: Fri, 28 Apr 2006 22:56:03 -0000 http://perforce.freebsd.org/chv.cgi?CH=96335 Change 96335 by imp@imp_hammer on 2006/04/28 22:55:10 Move delay to its own function so fpga can use it Make fpga loading work. cleanup spi support Affected files ... .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/Makefile#13 edit .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/delay.c#1 add .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/lib.h#9 edit .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/spi_flash.c#8 edit Differences ... ==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/Makefile#13 (text+ko) ==== @@ -4,7 +4,7 @@ LIB= at91 INTERNALLIB= -SRCS=at91rm9200_lowlevel.c eeprom.c emac.c getc.c \ +SRCS=at91rm9200_lowlevel.c delay.c eeprom.c emac.c fpga.c getc.c \ p_string.c putchar.c printf.c reset.c spi_flash.c xmodem.c NO_MAN= ==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/lib.h#9 (text) ==== @@ -43,4 +43,7 @@ /* Reboot! Reset! */ void reset(void); +/* Delay us */ +void Delay(int us); + #endif ==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/spi_flash.c#8 (text+ko) ==== @@ -31,17 +31,6 @@ static spiCommand_t spi_command; static char tx_commandBuffer[8], rx_commandBuffer[8]; - -static void -Delay(void) -{ - unsigned later; - - later = (AT91C_BASE_ST->ST_CRTR + 23) & AT91C_ST_CRTV; - while (later != AT91C_BASE_ST->ST_CRTR) - continue; -} - /* * .KB_C_FN_DEFINITION_START * void SendCommand(spiCommand_t *pCommand) @@ -71,7 +60,7 @@ // wait for completion while (!((v = pSPI->SPI_SR) & AT91C_SPI_SPENDRX)) - Delay(); + Delay(70); } @@ -148,7 +137,6 @@ char *src_addr, unsigned size) { - printf("PA %x BA %x Size %u\r\n", pageAddress, byteAddress, size); p_memset(tx_commandBuffer, 0, 8); tx_commandBuffer[0] = PROGRAM_THROUGH_BUFFER; // tx_commandBuffer[0] = 0x84; // write buffer 1 @@ -195,10 +183,8 @@ // determine byte address byteAddress = flash_addr % FLASH_PAGE_SIZE; - printf("Flash addr %x PA %x BA %x\r\n", flash_addr, pageAddress, byteAddress); p_memset(tx_commandBuffer, 0, 8); tx_commandBuffer[0] = CONTINUOUS_ARRAY_READ_HF; -// tx_commandBuffer[0] = 0xD4; // read buffer 1 tx_commandBuffer[1] = ((pageAddress >> 5) & 0xFF); tx_commandBuffer[2] = ((pageAddress << 3) & 0xF8) | ((byteAddress >> 8) & 0x7);