Commit ce22b922dd1fdd3f6cb25660e6e845d4f1cb4f70
1 parent
2f24223ae1
Exists in
master
and in
53 other branches
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>
Showing 5 changed files with 22 additions and 23 deletions Side-by-side Diff
drivers/mtd/spi/ramtron.c
... | ... | @@ -36,7 +36,7 @@ |
36 | 36 | #include <common.h> |
37 | 37 | #include <malloc.h> |
38 | 38 | #include <spi_flash.h> |
39 | -#include "spi_flash_internal.h" | |
39 | +#include "sf_internal.h" | |
40 | 40 | |
41 | 41 | /* |
42 | 42 | * Properties of supported FRAMs |
... | ... | @@ -383,8 +383,6 @@ |
383 | 383 | printf("SF: Detected %s with page size ", flash->name); |
384 | 384 | print_size(flash->sector_size, ", total "); |
385 | 385 | print_size(flash->size, ""); |
386 | - if (flash->memory_map) | |
387 | - printf(", mapped at %p", flash->memory_map); | |
388 | 386 | puts("\n"); |
389 | 387 | |
390 | 388 | spi_release_bus(spi); |
drivers/mtd/spi/sf_internal.h
... | ... | @@ -13,7 +13,7 @@ |
13 | 13 | #define SPI_FLASH_16MB_BOUN 0x1000000 |
14 | 14 | |
15 | 15 | /* SECT flags */ |
16 | -#define SECT_4K (1 << 1) | |
16 | +#define SECT_4K (1 << 1) | |
17 | 17 | #define SECT_32K (1 << 2) |
18 | 18 | #define E_FSR (1 << 3) |
19 | 19 | |
... | ... | @@ -29,8 +29,8 @@ |
29 | 29 | #define CMD_WRITE_DISABLE 0x04 |
30 | 30 | #define CMD_READ_STATUS 0x05 |
31 | 31 | #define CMD_WRITE_ENABLE 0x06 |
32 | -#define CMD_READ_CONFIG 0x35 | |
33 | -#define CMD_FLAG_STATUS 0x70 | |
32 | +#define CMD_READ_CONFIG 0x35 | |
33 | +#define CMD_FLAG_STATUS 0x70 | |
34 | 34 | |
35 | 35 | /* Read commands */ |
36 | 36 | #define CMD_READ_ARRAY_SLOW 0x03 |
... | ... | @@ -57,7 +57,7 @@ |
57 | 57 | /* SST specific */ |
58 | 58 | #ifdef CONFIG_SPI_FLASH_SST |
59 | 59 | # define SST_WP 0x01 /* Supports AAI word program */ |
60 | -# define CMD_SST_BP 0x02 /* Byte Program */ | |
60 | +# define CMD_SST_BP 0x02 /* Byte Program */ | |
61 | 61 | # define CMD_SST_AAI_WP 0xAD /* Auto Address Incr Word Program */ |
62 | 62 | |
63 | 63 | int sst_write_wp(struct spi_flash *flash, u32 offset, size_t len, |
drivers/mtd/spi/sf_probe.c
... | ... | @@ -152,7 +152,8 @@ |
152 | 152 | */ |
153 | 153 | }; |
154 | 154 | |
155 | -struct spi_flash *spi_flash_validate_params(struct spi_slave *spi, u8 *idcode) | |
155 | +static struct spi_flash *spi_flash_validate_params(struct spi_slave *spi, | |
156 | + u8 *idcode) | |
156 | 157 | { |
157 | 158 | const struct spi_flash_params *params; |
158 | 159 | struct spi_flash *flash; |
... | ... | @@ -189,6 +190,7 @@ |
189 | 190 | |
190 | 191 | flash->spi = spi; |
191 | 192 | flash->name = params->name; |
193 | + flash->memory_map = spi->memory_map; | |
192 | 194 | |
193 | 195 | /* Assign spi_flash ops */ |
194 | 196 | flash->write = spi_flash_cmd_write_ops; |
... | ... | @@ -203,7 +205,6 @@ |
203 | 205 | flash->page_size = (ext_jedec == 0x4d00) ? 512 : 256; |
204 | 206 | flash->sector_size = params->sector_size; |
205 | 207 | flash->size = flash->sector_size * params->nr_sectors; |
206 | - flash->memory_map = spi->memory_map; | |
207 | 208 | |
208 | 209 | /* Compute erase sector and command */ |
209 | 210 | if (params->flags & SECT_4K) { |
210 | 211 | |
... | ... | @@ -224,8 +225,8 @@ |
224 | 225 | flash->poll_cmd = CMD_FLAG_STATUS; |
225 | 226 | #endif |
226 | 227 | |
228 | + /* Configure the BAR - discover bank cmds and read current bank */ | |
227 | 229 | #ifdef CONFIG_SPI_FLASH_BAR |
228 | - /* Configure the BAR - discover bank cmds and read current bank */ | |
229 | 230 | u8 curr_bank = 0; |
230 | 231 | if (flash->size > SPI_FLASH_16MB_BOUN) { |
231 | 232 | flash->bank_read_cmd = (idcode[0] == 0x01) ? |
include/spi.h
... | ... | @@ -25,24 +25,24 @@ |
25 | 25 | #define SPI_PREAMBLE 0x80 /* Skip preamble bytes */ |
26 | 26 | |
27 | 27 | /* SPI transfer flags */ |
28 | -#define SPI_XFER_BEGIN 0x01 /* Assert CS before transfer */ | |
29 | -#define SPI_XFER_END 0x02 /* Deassert CS after transfer */ | |
30 | -#define SPI_XFER_MMAP 0x08 /* Memory Mapped start */ | |
31 | -#define SPI_XFER_MMAP_END 0x10 /* Memory Mapped End */ | |
28 | +#define SPI_XFER_BEGIN 0x01 /* Assert CS before transfer */ | |
29 | +#define SPI_XFER_END 0x02 /* Deassert CS after transfer */ | |
30 | +#define SPI_XFER_MMAP 0x08 /* Memory Mapped start */ | |
31 | +#define SPI_XFER_MMAP_END 0x10 /* Memory Mapped End */ | |
32 | 32 | |
33 | 33 | /* Header byte that marks the start of the message */ |
34 | -#define SPI_PREAMBLE_END_BYTE 0xec | |
34 | +#define SPI_PREAMBLE_END_BYTE 0xec | |
35 | 35 | |
36 | 36 | /** |
37 | - * struct spi_slave: Representation of a SPI slave, | |
38 | - * i.e. what we're communicating with. | |
37 | + * struct spi_slave - Representation of a SPI slave | |
39 | 38 | * |
40 | 39 | * Drivers are expected to extend this with controller-specific data. |
41 | 40 | * |
42 | - * bus: ID of the bus that the slave is attached to. | |
43 | - * cs: ID of the chip select connected to the slave. | |
44 | - * max_write_size: If non-zero, the maximum number of bytes which can | |
45 | - * be written at once, excluding command bytes. | |
41 | + * @bus: ID of the bus that the slave is attached to. | |
42 | + * @cs: ID of the chip select connected to the slave. | |
43 | + * @max_write_size: If non-zero, the maximum number of bytes which can | |
44 | + * be written at once, excluding command bytes. | |
45 | + * @memory_map: Address of read-only SPI flash access. | |
46 | 46 | */ |
47 | 47 | struct spi_slave { |
48 | 48 | unsigned int bus; |
include/spi_flash.h
... | ... | @@ -27,13 +27,13 @@ |
27 | 27 | * @size: Total flash size |
28 | 28 | * @page_size: Write (page) size |
29 | 29 | * @sector_size: Sector size |
30 | - * @erase_size: Erase size | |
30 | + * @erase_size: Erase size | |
31 | 31 | * @bank_read_cmd: Bank read cmd |
32 | 32 | * @bank_write_cmd: Bank write cmd |
33 | 33 | * @bank_curr: Current flash bank |
34 | 34 | * @poll_cmd: Poll cmd - for flash erase/program |
35 | 35 | * @erase_cmd: Erase cmd 4K, 32K, 64K |
36 | - * @memory_map: Address of read-only SPI flash access | |
36 | + * @memory_map: Address of read-only SPI flash access | |
37 | 37 | * @read: Flash read ops: Read len bytes at offset into buf |
38 | 38 | * Supported cmds: Fast Array Read |
39 | 39 | * @write: Flash write ops: Write len bytes from buf into offeset |