sf: Minor cleanups

- Add spaces, tabs
- Commenting.
- Rearrange code.
- Add static qualifier for missing func.
- Remove memory_map from ramtron.c
- Ramtron: spi_flash_internal.h -> sf_internal.h

Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
This commit is contained in:
Jagannadha Sutradharudu Teki 2013-10-07 19:34:56 +05:30
parent 2f24223ae1
commit ce22b922dd
5 changed files with 22 additions and 23 deletions

View file

@ -36,7 +36,7 @@
#include <common.h>
#include <malloc.h>
#include <spi_flash.h>
#include "spi_flash_internal.h"
#include "sf_internal.h"
/*
* Properties of supported FRAMs
@ -383,8 +383,6 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
printf("SF: Detected %s with page size ", flash->name);
print_size(flash->sector_size, ", total ");
print_size(flash->size, "");
if (flash->memory_map)
printf(", mapped at %p", flash->memory_map);
puts("\n");
spi_release_bus(spi);

View file

@ -152,7 +152,8 @@ static const struct spi_flash_params spi_flash_params_table[] = {
*/
};
struct spi_flash *spi_flash_validate_params(struct spi_slave *spi, u8 *idcode)
static struct spi_flash *spi_flash_validate_params(struct spi_slave *spi,
u8 *idcode)
{
const struct spi_flash_params *params;
struct spi_flash *flash;
@ -189,6 +190,7 @@ struct spi_flash *spi_flash_validate_params(struct spi_slave *spi, u8 *idcode)
flash->spi = spi;
flash->name = params->name;
flash->memory_map = spi->memory_map;
/* Assign spi_flash ops */
flash->write = spi_flash_cmd_write_ops;
@ -203,7 +205,6 @@ struct spi_flash *spi_flash_validate_params(struct spi_slave *spi, u8 *idcode)
flash->page_size = (ext_jedec == 0x4d00) ? 512 : 256;
flash->sector_size = params->sector_size;
flash->size = flash->sector_size * params->nr_sectors;
flash->memory_map = spi->memory_map;
/* Compute erase sector and command */
if (params->flags & SECT_4K) {
@ -224,8 +225,8 @@ struct spi_flash *spi_flash_validate_params(struct spi_slave *spi, u8 *idcode)
flash->poll_cmd = CMD_FLAG_STATUS;
#endif
#ifdef CONFIG_SPI_FLASH_BAR
/* Configure the BAR - discover bank cmds and read current bank */
#ifdef CONFIG_SPI_FLASH_BAR
u8 curr_bank = 0;
if (flash->size > SPI_FLASH_16MB_BOUN) {
flash->bank_read_cmd = (idcode[0] == 0x01) ?

View file

@ -34,15 +34,15 @@
#define SPI_PREAMBLE_END_BYTE 0xec
/**
* struct spi_slave: Representation of a SPI slave,
* i.e. what we're communicating with.
* struct spi_slave - Representation of a SPI slave
*
* Drivers are expected to extend this with controller-specific data.
*
* bus: ID of the bus that the slave is attached to.
* cs: ID of the chip select connected to the slave.
* max_write_size: If non-zero, the maximum number of bytes which can
* @bus: ID of the bus that the slave is attached to.
* @cs: ID of the chip select connected to the slave.
* @max_write_size: If non-zero, the maximum number of bytes which can
* be written at once, excluding command bytes.
* @memory_map: Address of read-only SPI flash access.
*/
struct spi_slave {
unsigned int bus;