Applied to u-boot-spi/master -- Thanks, Jagan.
On Mon, Oct 7, 2013 at 7:47 PM, Jagannadha Sutradharudu Teki <jagannadha.sutradharudu-t...@xilinx.com> wrote: > - 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 <jaga...@xilinx.com> > --- > Changes for v3: > - Remove exctra added "update.txt" file > Changes for v2: > - Ramtron: spi_flash_internal.h -> sf_internal.h > > drivers/mtd/spi/ramtron.c | 4 +--- > drivers/mtd/spi/sf_internal.h | 8 ++++---- > drivers/mtd/spi/sf_probe.c | 7 ++++--- > include/spi.h | 22 +++++++++++----------- > include/spi_flash.h | 4 ++-- > 5 files changed, 22 insertions(+), 23 deletions(-) > > diff --git a/drivers/mtd/spi/ramtron.c b/drivers/mtd/spi/ramtron.c > index c9701d0..7367e7a 100644 > --- a/drivers/mtd/spi/ramtron.c > +++ b/drivers/mtd/spi/ramtron.c > @@ -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); > diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h > index 29a14f4..12d02f9 100644 > --- a/drivers/mtd/spi/sf_internal.h > +++ b/drivers/mtd/spi/sf_internal.h > @@ -13,7 +13,7 @@ > #define SPI_FLASH_16MB_BOUN 0x1000000 > > /* SECT flags */ > -#define SECT_4K (1 << 1) > +#define SECT_4K (1 << 1) > #define SECT_32K (1 << 2) > #define E_FSR (1 << 3) > > @@ -29,8 +29,8 @@ > #define CMD_WRITE_DISABLE 0x04 > #define CMD_READ_STATUS 0x05 > #define CMD_WRITE_ENABLE 0x06 > -#define CMD_READ_CONFIG 0x35 > -#define CMD_FLAG_STATUS 0x70 > +#define CMD_READ_CONFIG 0x35 > +#define CMD_FLAG_STATUS 0x70 > > /* Read commands */ > #define CMD_READ_ARRAY_SLOW 0x03 > @@ -57,7 +57,7 @@ > /* SST specific */ > #ifdef CONFIG_SPI_FLASH_SST > # define SST_WP 0x01 /* Supports AAI word program > */ > -# define CMD_SST_BP 0x02 /* Byte Program */ > +# define CMD_SST_BP 0x02 /* Byte Program */ > # define CMD_SST_AAI_WP 0xAD /* Auto Address Incr Word > Program */ > > int sst_write_wp(struct spi_flash *flash, u32 offset, size_t len, > diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c > index 6aa7086..4251b1b 100644 > --- a/drivers/mtd/spi/sf_probe.c > +++ b/drivers/mtd/spi/sf_probe.c > @@ -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 > > + /* Configure the BAR - discover bank cmds and read current bank */ > #ifdef CONFIG_SPI_FLASH_BAR > - /* Configure the BAR - discover bank cmds and read current bank */ > u8 curr_bank = 0; > if (flash->size > SPI_FLASH_16MB_BOUN) { > flash->bank_read_cmd = (idcode[0] == 0x01) ? > diff --git a/include/spi.h b/include/spi.h > index c2086fc..5164d43 100644 > --- a/include/spi.h > +++ b/include/spi.h > @@ -25,24 +25,24 @@ > #define SPI_PREAMBLE 0x80 /* Skip preamble > bytes */ > > /* SPI transfer flags */ > -#define SPI_XFER_BEGIN 0x01 /* Assert CS before transfer > */ > -#define SPI_XFER_END 0x02 /* Deassert CS after transfer > */ > -#define SPI_XFER_MMAP 0x08 /* Memory Mapped start */ > -#define SPI_XFER_MMAP_END 0x10 /* Memory Mapped End */ > +#define SPI_XFER_BEGIN 0x01 /* Assert CS before transfer */ > +#define SPI_XFER_END 0x02 /* Deassert CS after transfer */ > +#define SPI_XFER_MMAP 0x08 /* Memory Mapped start */ > +#define SPI_XFER_MMAP_END 0x10 /* Memory Mapped End */ > > /* Header byte that marks the start of the message */ > -#define SPI_PREAMBLE_END_BYTE 0xec > +#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 > - * be written at once, excluding command bytes. > + * @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; > diff --git a/include/spi_flash.h b/include/spi_flash.h > index b7cce12..1ff5af4 100644 > --- a/include/spi_flash.h > +++ b/include/spi_flash.h > @@ -27,13 +27,13 @@ > * @size: Total flash size > * @page_size: Write (page) size > * @sector_size: Sector size > - * @erase_size: Erase size > + * @erase_size: Erase size > * @bank_read_cmd: Bank read cmd > * @bank_write_cmd: Bank write cmd > * @bank_curr: Current flash bank > * @poll_cmd: Poll cmd - for flash erase/program > * @erase_cmd: Erase cmd 4K, 32K, 64K > - * @memory_map: Address of read-only SPI flash access > + * @memory_map: Address of read-only SPI flash access > * @read: Flash read ops: Read len bytes at offset into buf > * Supported cmds: Fast Array Read > * @write: Flash write ops: Write len bytes from buf into offeset > -- > 1.8.3 > > > _______________________________________________ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot -- Thanks, Jagan. -------- Jagannadha Sutradharudu Teki, E: jagannadh.t...@gmail.com, P: +91-9676773388 Engineer - System Software Hacker U-boot - SPI Custodian and Zynq APSOC Ln: http://www.linkedin.com/in/jaganteki _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot