From owner-p4-projects@FreeBSD.ORG Sat Oct 7 16:56:45 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 ADB5216A417; Sat, 7 Oct 2006 16:56:45 +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 624C416A416 for ; Sat, 7 Oct 2006 16:56:45 +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 34B6443D91 for ; Sat, 7 Oct 2006 16:56:32 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k97GuWBd024739 for ; Sat, 7 Oct 2006 16:56:32 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k97GuWB4024723 for perforce@freebsd.org; Sat, 7 Oct 2006 16:56:32 GMT (envelope-from imp@freebsd.org) Date: Sat, 7 Oct 2006 16:56:32 GMT Message-Id: <200610071656.k97GuWB4024723@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 107429 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: Sat, 07 Oct 2006 16:56:45 -0000 http://perforce.freebsd.org/chv.cgi?CH=107429 Change 107429 by imp@imp_lighthouse on 2006/10/07 16:55:56 Kill some stuff Affected files ... .. //depot/projects/arm/src/sys/dev/flash/at45d.c#7 edit Differences ... ==== //depot/projects/arm/src/sys/dev/flash/at45d.c#7 (text+ko) ==== @@ -78,103 +78,7 @@ #define MANUFACTURER_ID 0x9F #if 0 -/****************************************************************************** - * - * Filename: spi_flash.c - * - * Instantiation of SPI flash control routines supporting AT45DB161B - * - * Revision information: - * - * 17JAN2005 kb_admin initial creation - * adapted from external sources - * tested for basic operation only!!! - * - * BEGIN_KBDD_BLOCK - * No warranty, expressed or implied, is included with this software. It is - * provided "AS IS" and no warranty of any kind including statutory or aspects - * relating to merchantability or fitness for any purpose is provided. All - * intellectual property rights of others is maintained with the respective - * owners. This software is not copyrighted and is intended for reference - * only. - * END_BLOCK - *****************************************************************************/ - -#include "at91rm9200.h" -#include "spi_flash.h" -#include "lib.h" - -/*********************** PRIVATE FUNCTIONS/DATA ******************************/ - - -static spiCommand_t spi_command; -static char tx_commandBuffer[8], rx_commandBuffer[8]; - -/* - * .KB_C_FN_DEFINITION_START - * void SendCommand(spiCommand_t *pCommand) - * Private function sends 8-bit value to the device and returns the 8-bit - * value in response. - * .KB_C_FN_DEFINITION_END - */ -static void -SendCommand(spiCommand_t *pCommand) -{ - AT91PS_SPI pSPI = AT91C_BASE_SPI; - - pSPI->SPI_PTCR = AT91C_PDC_TXTDIS | AT91C_PDC_RXTDIS; - - pSPI->SPI_RPR = (unsigned)pCommand->rx_cmd; - pSPI->SPI_RCR = pCommand->rx_cmd_size; - pSPI->SPI_TPR = (unsigned)pCommand->tx_cmd; - pSPI->SPI_TCR = pCommand->tx_cmd_size; - pSPI->SPI_TNPR = (unsigned)pCommand->tx_data; - pSPI->SPI_TNCR = pCommand->tx_data_size; - pSPI->SPI_RNPR = (unsigned)pCommand->rx_data; - pSPI->SPI_RNCR = pCommand->rx_data_size; - - pSPI->SPI_PTCR = AT91C_PDC_TXTEN | AT91C_PDC_RXTEN; - - // wait for completion - while (!(pSPI->SPI_SR & AT91C_SPI_SPENDRX)) - Delay(700); -} - - -/* - * .KB_C_FN_DEFINITION_START - * char GetFlashStatus(void) - * Private function to return device status. - * .KB_C_FN_DEFINITION_END - */ -static char -GetFlashStatus(void) -{ - p_memset((char *)&spi_command, 0, sizeof(spi_command)); - p_memset(tx_commandBuffer, 0, 8); - tx_commandBuffer[0] = STATUS_REGISTER_READ; - p_memset(rx_commandBuffer, 0, 8); - spi_command.tx_cmd = tx_commandBuffer; - spi_command.rx_cmd = rx_commandBuffer; - spi_command.rx_cmd_size = 2; - spi_command.tx_cmd_size = 2; - SendCommand(&spi_command); - return (rx_commandBuffer[1]); -} - -/* - * .KB_C_FN_DEFINITION_START - * void WaitForDeviceReady(void) - * Private function to poll until the device is ready for next operation. - * .KB_C_FN_DEFINITION_END - */ -static void -WaitForDeviceReady(void) -{ - while (!(GetFlashStatus() & 0x80)) ; -} - /*************************** GLOBAL FUNCTIONS ********************************/ @@ -411,10 +315,12 @@ } while (bp == NULL); bioq_remove(&sc->bio_queue, bp); AT45D_UNLOCK(sc); + // XXX need to make the read/write request, maybe even + // XXX breaking things down into smaller blocks. + biodone(bp); } } - static devclass_t at45d_devclass; static device_method_t at45d_methods[] = {