Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: drivers/mtd/spi/winbond.c

Issue 4182008: SPI: flash: winbond: add Winbond W25Q32BV support (4MB SPI flash) (Closed) Base URL: http://git.chromium.org/git/u-boot
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2008, Network Appliance Inc. 2 * Copyright 2008, Network Appliance Inc.
3 * Author: Jason McMullan <mcmullan <at> netapp.com> 3 * Author: Jason McMullan <mcmullan <at> netapp.com>
4 * Licensed under the GPL-2 or later. 4 * Licensed under the GPL-2 or later.
5 */ 5 */
6 6
7 #include <common.h> 7 #include <common.h>
8 #include <malloc.h> 8 #include <malloc.h>
9 #include <spi_flash.h> 9 #include <spi_flash.h>
10 10
(...skipping 16 matching lines...) Expand all
27 #define WINBOND_ID_W25X10A 0x3011 27 #define WINBOND_ID_W25X10A 0x3011
28 #define WINBOND_ID_W25X20A 0x3012 28 #define WINBOND_ID_W25X20A 0x3012
29 #define WINBOND_ID_W25X40A 0x3013 29 #define WINBOND_ID_W25X40A 0x3013
30 #define WINBOND_ID_W25X80A 0x3014 30 #define WINBOND_ID_W25X80A 0x3014
31 31
32 #define WINBOND_ID_W25X16 0x3015 32 #define WINBOND_ID_W25X16 0x3015
33 #define WINBOND_ID_W25X32 0x3016 33 #define WINBOND_ID_W25X32 0x3016
34 #define WINBOND_ID_W25X64 0x3017 34 #define WINBOND_ID_W25X64 0x3017
35 35
36 #define WINBOND_ID_W25Q16B 0x4015 36 #define WINBOND_ID_W25Q16B 0x4015
37 #define WINBOND_ID_W25Q32B 0x4016
37 38
38 #define WINBOND_SR_WIP (1 << 0) /* Write-in-Progress */ 39 #define WINBOND_SR_WIP (1 << 0) /* Write-in-Progress */
39 40
40 struct winbond_spi_flash_params { 41 struct winbond_spi_flash_params {
41 uint16_t id; 42 uint16_t id;
42 /* Log2 of page size in power-of-two mode */ 43 /* Log2 of page size in power-of-two mode */
43 uint8_t l2_page_size; 44 uint8_t l2_page_size;
44 uint16_t pages_per_sector; 45 uint16_t pages_per_sector;
45 uint16_t sectors_per_block; 46 uint16_t sectors_per_block;
46 uint8_t nr_blocks; 47 uint8_t nr_blocks;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 .name = "W25X64", 118 .name = "W25X64",
118 }, 119 },
119 { 120 {
120 .id = WINBOND_ID_W25Q16B, 121 .id = WINBOND_ID_W25Q16B,
121 .l2_page_size = 8, 122 .l2_page_size = 8,
122 .pages_per_sector = 16, 123 .pages_per_sector = 16,
123 .sectors_per_block = 16, 124 .sectors_per_block = 16,
124 .nr_blocks = 32, 125 .nr_blocks = 32,
125 .name = "W25Q16B", 126 .name = "W25Q16B",
126 }, 127 },
128 {
129 .id = WINBOND_ID_W25Q32B,
130 .l2_page_size = 8,
131 .pages_per_sector = 16,
132 .sectors_per_block = 16,
133 .nr_blocks = 64,
134 .name = "W25Q32B",
135 },
127 136
128 }; 137 };
129 138
130 static int winbond_wait_ready(struct spi_flash *flash, unsigned long timeout) 139 static int winbond_wait_ready(struct spi_flash *flash, unsigned long timeout)
131 { 140 {
132 struct spi_slave *spi = flash->spi; 141 struct spi_slave *spi = flash->spi;
133 unsigned long timebase; 142 unsigned long timebase;
134 int ret; 143 int ret;
135 u8 status; 144 u8 status;
136 u8 cmd[4] = { CMD_W25_RDSR, 0xff, 0xff, 0xff }; 145 u8 cmd[4] = { CMD_W25_RDSR, 0xff, 0xff, 0xff };
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 #endif 398 #endif
390 stm->flash.size = page_size * params->pages_per_sector 399 stm->flash.size = page_size * params->pages_per_sector
391 * params->sectors_per_block 400 * params->sectors_per_block
392 * params->nr_blocks; 401 * params->nr_blocks;
393 402
394 debug("SF: Detected %s with page size %lu, total %lu bytes\n", 403 debug("SF: Detected %s with page size %lu, total %lu bytes\n",
395 params->name, page_size, stm->flash.size); 404 params->name, page_size, stm->flash.size);
396 405
397 return &stm->flash; 406 return &stm->flash;
398 } 407 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698