mirror of
https://github.com/xboot/xfel.git
synced 2024-11-23 17:53:31 +08:00
[spinor]add spinor_global_unlock for spi nor flash
This commit is contained in:
parent
0b1ca5d03a
commit
b49c4897f8
79
spinor.c
79
spinor.c
@ -322,7 +322,32 @@ static int spinor_helper_init(struct xfel_ctx_t * ctx, struct spinor_pdata_t * p
|
||||
|
||||
/* spi select */
|
||||
cbuf[clen++] = SPI_CMD_SELECT;
|
||||
/* write status */
|
||||
/* global block/sector unlock */
|
||||
cbuf[clen++] = SPI_CMD_FAST;
|
||||
cbuf[clen++] = 1;
|
||||
cbuf[clen++] = 0x98;
|
||||
/* spi deselect */
|
||||
cbuf[clen++] = SPI_CMD_DESELECT;
|
||||
|
||||
/* spi select */
|
||||
cbuf[clen++] = SPI_CMD_SELECT;
|
||||
/* wait busy */
|
||||
cbuf[clen++] = SPI_CMD_SPINOR_WAIT;
|
||||
/* spi deselect */
|
||||
cbuf[clen++] = SPI_CMD_DESELECT;
|
||||
|
||||
/* spi select */
|
||||
cbuf[clen++] = SPI_CMD_SELECT;
|
||||
/* write enable */
|
||||
cbuf[clen++] = SPI_CMD_FAST;
|
||||
cbuf[clen++] = 1;
|
||||
cbuf[clen++] = pdat->info.opcode_write_enable;
|
||||
/* spi deselect */
|
||||
cbuf[clen++] = SPI_CMD_DESELECT;
|
||||
|
||||
/* spi select */
|
||||
cbuf[clen++] = SPI_CMD_SELECT;
|
||||
/* write status 1 */
|
||||
cbuf[clen++] = SPI_CMD_FAST;
|
||||
cbuf[clen++] = 2;
|
||||
cbuf[clen++] = OPCODE_WRSR;
|
||||
@ -337,6 +362,58 @@ static int spinor_helper_init(struct xfel_ctx_t * ctx, struct spinor_pdata_t * p
|
||||
/* spi deselect */
|
||||
cbuf[clen++] = SPI_CMD_DESELECT;
|
||||
|
||||
/* spi select */
|
||||
cbuf[clen++] = SPI_CMD_SELECT;
|
||||
/* write enable */
|
||||
cbuf[clen++] = SPI_CMD_FAST;
|
||||
cbuf[clen++] = 1;
|
||||
cbuf[clen++] = pdat->info.opcode_write_enable;
|
||||
/* spi deselect */
|
||||
cbuf[clen++] = SPI_CMD_DESELECT;
|
||||
|
||||
/* spi select */
|
||||
cbuf[clen++] = SPI_CMD_SELECT;
|
||||
/* write status 2 */
|
||||
cbuf[clen++] = SPI_CMD_FAST;
|
||||
cbuf[clen++] = 2;
|
||||
cbuf[clen++] = 0x31;
|
||||
cbuf[clen++] = 0;
|
||||
/* spi deselect */
|
||||
cbuf[clen++] = SPI_CMD_DESELECT;
|
||||
|
||||
/* spi select */
|
||||
cbuf[clen++] = SPI_CMD_SELECT;
|
||||
/* wait busy */
|
||||
cbuf[clen++] = SPI_CMD_SPINOR_WAIT;
|
||||
/* spi deselect */
|
||||
cbuf[clen++] = SPI_CMD_DESELECT;
|
||||
|
||||
/* spi select */
|
||||
cbuf[clen++] = SPI_CMD_SELECT;
|
||||
/* write enable */
|
||||
cbuf[clen++] = SPI_CMD_FAST;
|
||||
cbuf[clen++] = 1;
|
||||
cbuf[clen++] = pdat->info.opcode_write_enable;
|
||||
/* spi deselect */
|
||||
cbuf[clen++] = SPI_CMD_DESELECT;
|
||||
|
||||
/* spi select */
|
||||
cbuf[clen++] = SPI_CMD_SELECT;
|
||||
/* write status 3 */
|
||||
cbuf[clen++] = SPI_CMD_FAST;
|
||||
cbuf[clen++] = 2;
|
||||
cbuf[clen++] = 0x11;
|
||||
cbuf[clen++] = 0;
|
||||
/* spi deselect */
|
||||
cbuf[clen++] = SPI_CMD_DESELECT;
|
||||
|
||||
/* spi select */
|
||||
cbuf[clen++] = SPI_CMD_SELECT;
|
||||
/* wait busy */
|
||||
cbuf[clen++] = SPI_CMD_SPINOR_WAIT;
|
||||
/* spi deselect */
|
||||
cbuf[clen++] = SPI_CMD_DESELECT;
|
||||
|
||||
if(pdat->info.address_length == 4)
|
||||
{
|
||||
/* spi select */
|
||||
|
Loading…
Reference in New Issue
Block a user