ipq: spi: Increased performance of spi erase

When 4K sector size support is enabled for spi, always
4K sector erase command is passed for all the erase operations.
To increase the performance, 64K erase command is
passed to the command buffer based on length and offset.

Change-Id: Ia762d192ba5d424f0ba3538fff8aff4954050bf7
Signed-off-by: Balaji Jagadeesan <bjagadee@codeaurora.org>
This commit is contained in:
Balaji Jagadeesan 2018-03-02 15:09:13 +05:30 committed by Gerrit - the friendly Code Review server
parent 318f41e4e4
commit a47b19fc2b
2 changed files with 10 additions and 0 deletions

View file

@ -47,6 +47,7 @@ enum {
E_FSR = 1 << 2,
SST_WR = 1 << 3,
WR_QPP = 1 << 4,
SECT_64K = 1 << 5,
};
enum spi_nor_option_flags {

View file

@ -16,6 +16,7 @@
#include <spi.h>
#include <spi_flash.h>
#include <linux/log2.h>
#include <linux/sizes.h>
#include "sf_internal.h"
@ -370,6 +371,12 @@ int spi_flash_cmd_erase_ops(struct spi_flash *flash, u32 offset, size_t len)
}
cmd[0] = flash->erase_cmd;
if (!(offset % SZ_64K || len % SZ_64K) && (flash->flags & SECT_64K)) {
erase_size = SZ_64K;
cmd[0] = CMD_ERASE_64K;
}
while (len) {
erase_addr = offset;
@ -1078,6 +1085,8 @@ int spi_flash_scan(struct spi_flash *flash)
if (params->flags & SECT_4K) {
flash->erase_cmd = CMD_ERASE_4K;
flash->erase_size = 4096 << flash->shift;
if (flash->sector_size == SZ_64K)
flash->flags |= SECT_64K;
} else if (params->flags & SECT_32K) {
flash->erase_cmd = CMD_ERASE_32K;
flash->erase_size = 32768 << flash->shift;