Date: Sat, 7 Oct 2006 16:56:32 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 107429 for review Message-ID: <200610071656.k97GuWB4024723@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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[] = {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610071656.k97GuWB4024723>