Commit b902e07cea51e33fbe36453f7b1412dd7bbe760f
1 parent
056fbc73d5
Exists in
master
and in
50 other branches
sf: Add CONFIG_SF_DUAL_FLASH
This config will use for defining greater than single flash support. currently - DUAL_STACKED and DUAL_PARALLEL. Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
Showing 4 changed files with 20 additions and 5 deletions Side-by-side Diff
README
... | ... | @@ -2756,6 +2756,12 @@ |
2756 | 2756 | Define this option to use the Bank addr/Extended addr |
2757 | 2757 | support on SPI flashes which has size > 16Mbytes. |
2758 | 2758 | |
2759 | + CONFIG_SF_DUAL_FLASH Dual flash memories | |
2760 | + | |
2761 | + Define this option to use dual flash support where two flash | |
2762 | + memories can be connected with a given cs line. | |
2763 | + currently Xilinx Zynq qspi support these type of connections. | |
2764 | + | |
2759 | 2765 | - SystemACE Support: |
2760 | 2766 | CONFIG_SYSTEMACE |
2761 | 2767 |
drivers/mtd/spi/sf.c
drivers/mtd/spi/sf_ops.c
... | ... | @@ -131,6 +131,7 @@ |
131 | 131 | } |
132 | 132 | #endif |
133 | 133 | |
134 | +#ifdef CONFIG_SF_DUAL_FLASH | |
134 | 135 | static void spi_flash_dual_flash(struct spi_flash *flash, u32 *addr) |
135 | 136 | { |
136 | 137 | switch (flash->dual_flash) { |
... | ... | @@ -150,6 +151,7 @@ |
150 | 151 | break; |
151 | 152 | } |
152 | 153 | } |
154 | +#endif | |
153 | 155 | |
154 | 156 | int spi_flash_cmd_wait_ready(struct spi_flash *flash, unsigned long timeout) |
155 | 157 | { |
156 | 158 | |
... | ... | @@ -167,9 +169,10 @@ |
167 | 169 | check_status = poll_bit; |
168 | 170 | } |
169 | 171 | |
172 | +#ifdef CONFIG_SF_DUAL_FLASH | |
170 | 173 | if (spi->flags & SPI_XFER_U_PAGE) |
171 | 174 | flags |= SPI_XFER_U_PAGE; |
172 | - | |
175 | +#endif | |
173 | 176 | ret = spi_xfer(spi, 8, &cmd, NULL, flags); |
174 | 177 | if (ret) { |
175 | 178 | debug("SF: fail to read %s status register\n", |
176 | 179 | |
... | ... | @@ -257,9 +260,10 @@ |
257 | 260 | while (len) { |
258 | 261 | erase_addr = offset; |
259 | 262 | |
263 | +#ifdef CONFIG_SF_DUAL_FLASH | |
260 | 264 | if (flash->dual_flash > SF_SINGLE_FLASH) |
261 | 265 | spi_flash_dual_flash(flash, &erase_addr); |
262 | - | |
266 | +#endif | |
263 | 267 | #ifdef CONFIG_SPI_FLASH_BAR |
264 | 268 | ret = spi_flash_bank(flash, erase_addr); |
265 | 269 | if (ret < 0) |
266 | 270 | |
... | ... | @@ -298,9 +302,10 @@ |
298 | 302 | for (actual = 0; actual < len; actual += chunk_len) { |
299 | 303 | write_addr = offset; |
300 | 304 | |
305 | +#ifdef CONFIG_SF_DUAL_FLASH | |
301 | 306 | if (flash->dual_flash > SF_SINGLE_FLASH) |
302 | 307 | spi_flash_dual_flash(flash, &write_addr); |
303 | - | |
308 | +#endif | |
304 | 309 | #ifdef CONFIG_SPI_FLASH_BAR |
305 | 310 | ret = spi_flash_bank(flash, write_addr); |
306 | 311 | if (ret < 0) |
307 | 312 | |
... | ... | @@ -383,9 +388,10 @@ |
383 | 388 | while (len) { |
384 | 389 | read_addr = offset; |
385 | 390 | |
391 | +#ifdef CONFIG_SF_DUAL_FLASH | |
386 | 392 | if (flash->dual_flash > SF_SINGLE_FLASH) |
387 | 393 | spi_flash_dual_flash(flash, &read_addr); |
388 | - | |
394 | +#endif | |
389 | 395 | #ifdef CONFIG_SPI_FLASH_BAR |
390 | 396 | bank_sel = spi_flash_bank(flash, read_addr); |
391 | 397 | if (bank_sel < 0) |
drivers/mtd/spi/sf_probe.c
... | ... | @@ -150,8 +150,10 @@ |
150 | 150 | flash->page_size = ((ext_jedec == 0x4d00) ? 512 : 256) << flash->shift; |
151 | 151 | flash->sector_size = params->sector_size << flash->shift; |
152 | 152 | flash->size = flash->sector_size * params->nr_sectors << flash->shift; |
153 | +#ifdef CONFIG_SF_DUAL_FLASH | |
153 | 154 | if (flash->dual_flash & SF_DUAL_STACKED_FLASH) |
154 | 155 | flash->size <<= 1; |
156 | +#endif | |
155 | 157 | |
156 | 158 | /* Compute erase sector and command */ |
157 | 159 | if (params->flags & SECT_4K) { |