Commit 7c174401a2607924bbe186d2b62bf1f325cbf24d
1 parent
e28661b642
Exists in
smarc-imx-l5.0.0_1.0.0-ga
MLK-9636 QuadSPI: add 4k erase support
OPCODE_BE_4K is supported. To qspi flashes which support 4k sector erase, spi framework will use OPCODE_BE_4K command. Thus add this support to let uboot can erase such qspi flashes. Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Showing 1 changed file with 13 additions and 1 deletions Side-by-side Diff
drivers/spi/fsl_qspi.c
... | ... | @@ -179,6 +179,7 @@ |
179 | 179 | #define SEQID_WRSR 8 |
180 | 180 | #define SEQID_RDCR 9 |
181 | 181 | #define SEQID_DDR_QUAD_READ 10 |
182 | +#define SEQID_BE_4K 11 | |
182 | 183 | |
183 | 184 | /* Flash opcodes. */ |
184 | 185 | #define OPCODE_WREN 0x06 /* Write enable */ |
... | ... | @@ -368,6 +369,15 @@ |
368 | 369 | writel(LUT0(JMP_ON_CS, PAD1, 0), |
369 | 370 | base + QUADSPI_LUT(lut_base + 2)); |
370 | 371 | |
372 | + /* SUB SECTOR 4K ERASE */ | |
373 | + lut_base = SEQID_BE_4K * 4; | |
374 | + cmd = OPCODE_BE_4K; | |
375 | + addrlen = ADDR24BIT; | |
376 | + | |
377 | + writel(LUT0(CMD, PAD1, cmd) | LUT1(ADDR, PAD1, addrlen), | |
378 | + base + QUADSPI_LUT(lut_base)); | |
379 | + | |
380 | + | |
371 | 381 | fsl_qspi_lock_lut(q); |
372 | 382 | } |
373 | 383 | |
... | ... | @@ -577,6 +587,8 @@ |
577 | 587 | return SEQID_RDCR; |
578 | 588 | case OPCODE_DDR_QUAD_READ: |
579 | 589 | return SEQID_DDR_QUAD_READ; |
590 | + case OPCODE_BE_4K: | |
591 | + return SEQID_BE_4K; | |
580 | 592 | default: |
581 | 593 | break; |
582 | 594 | } |
... | ... | @@ -670,7 +682,7 @@ |
670 | 682 | /* restore the MCR */ |
671 | 683 | writel(reg, base + QUADSPI_MCR); |
672 | 684 | |
673 | - if (OPCODE_SE == cmd || OPCODE_PP == cmd) | |
685 | + if ((OPCODE_SE == cmd) || (OPCODE_PP == cmd) || (OPCODE_BE_4K == cmd)) | |
674 | 686 | fsl_qspi_invalid(q); |
675 | 687 | return err; |
676 | 688 | } |