diff options
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/devices/st_spi_fsm.c | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 9db564106e3e..dc9412a93abd 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c | |||
@@ -341,6 +341,7 @@ struct flash_info { | |||
341 | static int stfsm_n25q_config(struct stfsm *fsm); | 341 | static int stfsm_n25q_config(struct stfsm *fsm); |
342 | static int stfsm_mx25_config(struct stfsm *fsm); | 342 | static int stfsm_mx25_config(struct stfsm *fsm); |
343 | static int stfsm_s25fl_config(struct stfsm *fsm); | 343 | static int stfsm_s25fl_config(struct stfsm *fsm); |
344 | static int stfsm_w25q_config(struct stfsm *fsm); | ||
344 | 345 | ||
345 | static struct flash_info flash_types[] = { | 346 | static struct flash_info flash_types[] = { |
346 | /* | 347 | /* |
@@ -446,10 +447,14 @@ static struct flash_info flash_types[] = { | |||
446 | FLASH_FLAG_READ_1_1_4 | \ | 447 | FLASH_FLAG_READ_1_1_4 | \ |
447 | FLASH_FLAG_READ_1_4_4 | \ | 448 | FLASH_FLAG_READ_1_4_4 | \ |
448 | FLASH_FLAG_WRITE_1_1_4) | 449 | FLASH_FLAG_WRITE_1_1_4) |
449 | { "w25q80", 0xef4014, 0, 64 * 1024, 16, W25Q_FLAG, 80, NULL }, | 450 | { "w25q80", 0xef4014, 0, 64 * 1024, 16, W25Q_FLAG, 80, |
450 | { "w25q16", 0xef4015, 0, 64 * 1024, 32, W25Q_FLAG, 80, NULL }, | 451 | stfsm_w25q_config }, |
451 | { "w25q32", 0xef4016, 0, 64 * 1024, 64, W25Q_FLAG, 80, NULL }, | 452 | { "w25q16", 0xef4015, 0, 64 * 1024, 32, W25Q_FLAG, 80, |
452 | { "w25q64", 0xef4017, 0, 64 * 1024, 128, W25Q_FLAG, 80, NULL }, | 453 | stfsm_w25q_config }, |
454 | { "w25q32", 0xef4016, 0, 64 * 1024, 64, W25Q_FLAG, 80, | ||
455 | stfsm_w25q_config }, | ||
456 | { "w25q64", 0xef4017, 0, 64 * 1024, 128, W25Q_FLAG, 80, | ||
457 | stfsm_w25q_config }, | ||
453 | 458 | ||
454 | /* Sentinel */ | 459 | /* Sentinel */ |
455 | { NULL, 0x000000, 0, 0, 0, 0, 0, NULL }, | 460 | { NULL, 0x000000, 0, 0, 0, 0, 0, NULL }, |
@@ -577,6 +582,11 @@ static struct seq_rw_config stfsm_s25fl_write4_configs[] = { | |||
577 | {0x00, 0, 0, 0, 0, 0x00, 0, 0}, | 582 | {0x00, 0, 0, 0, 0, 0x00, 0, 0}, |
578 | }; | 583 | }; |
579 | 584 | ||
585 | /* | ||
586 | * [W25Qxxx] Configuration | ||
587 | */ | ||
588 | #define W25Q_STATUS_QE (0x1 << 9) | ||
589 | |||
580 | static struct stfsm_seq stfsm_seq_read; /* Dynamically populated */ | 590 | static struct stfsm_seq stfsm_seq_read; /* Dynamically populated */ |
581 | static struct stfsm_seq stfsm_seq_write; /* Dynamically populated */ | 591 | static struct stfsm_seq stfsm_seq_write; /* Dynamically populated */ |
582 | static struct stfsm_seq stfsm_seq_en_32bit_addr;/* Dynamically populated */ | 592 | static struct stfsm_seq stfsm_seq_en_32bit_addr;/* Dynamically populated */ |
@@ -1443,6 +1453,35 @@ static int stfsm_s25fl_config(struct stfsm *fsm) | |||
1443 | return 0; | 1453 | return 0; |
1444 | } | 1454 | } |
1445 | 1455 | ||
1456 | static int stfsm_w25q_config(struct stfsm *fsm) | ||
1457 | { | ||
1458 | uint32_t data_pads; | ||
1459 | uint16_t sta_wr; | ||
1460 | uint8_t sta1, sta2; | ||
1461 | int ret; | ||
1462 | |||
1463 | ret = stfsm_prepare_rwe_seqs_default(fsm); | ||
1464 | if (ret) | ||
1465 | return ret; | ||
1466 | |||
1467 | /* If using QUAD mode, set QE STATUS bit */ | ||
1468 | data_pads = ((stfsm_seq_read.seq_cfg >> 16) & 0x3) + 1; | ||
1469 | if (data_pads == 4) { | ||
1470 | stfsm_read_status(fsm, FLASH_CMD_RDSR, &sta1); | ||
1471 | stfsm_read_status(fsm, FLASH_CMD_RDSR2, &sta2); | ||
1472 | |||
1473 | sta_wr = ((uint16_t)sta2 << 8) | sta1; | ||
1474 | |||
1475 | sta_wr |= W25Q_STATUS_QE; | ||
1476 | |||
1477 | stfsm_write_status(fsm, sta_wr, 2); | ||
1478 | |||
1479 | stfsm_wait_busy(fsm); | ||
1480 | } | ||
1481 | |||
1482 | return 0; | ||
1483 | } | ||
1484 | |||
1446 | static int stfsm_read(struct stfsm *fsm, uint8_t *buf, uint32_t size, | 1485 | static int stfsm_read(struct stfsm *fsm, uint8_t *buf, uint32_t size, |
1447 | uint32_t offset) | 1486 | uint32_t offset) |
1448 | { | 1487 | { |