diff options
-rw-r--r-- | drivers/mtd/devices/st_spi_fsm.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 9467585fcfda..2740ae195ef5 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c | |||
@@ -222,6 +222,18 @@ struct stfsm_seq { | |||
222 | uint32_t seq_cfg; | 222 | uint32_t seq_cfg; |
223 | } __packed __aligned(4); | 223 | } __packed __aligned(4); |
224 | 224 | ||
225 | /* Parameters to configure a READ or WRITE FSM sequence */ | ||
226 | struct seq_rw_config { | ||
227 | uint32_t flags; /* flags to support config */ | ||
228 | uint8_t cmd; /* FLASH command */ | ||
229 | int write; /* Write Sequence */ | ||
230 | uint8_t addr_pads; /* No. of addr pads (MODE & DUMMY) */ | ||
231 | uint8_t data_pads; /* No. of data pads */ | ||
232 | uint8_t mode_data; /* MODE data */ | ||
233 | uint8_t mode_cycles; /* No. of MODE cycles */ | ||
234 | uint8_t dummy_cycles; /* No. of DUMMY cycles */ | ||
235 | }; | ||
236 | |||
225 | /* SPI Flash Device Table */ | 237 | /* SPI Flash Device Table */ |
226 | struct flash_info { | 238 | struct flash_info { |
227 | char *name; | 239 | char *name; |
@@ -462,6 +474,21 @@ static void stfsm_read_fifo(struct stfsm *fsm, uint32_t *buf, | |||
462 | } | 474 | } |
463 | } | 475 | } |
464 | 476 | ||
477 | /* Search for preferred configuration based on available flags */ | ||
478 | static struct seq_rw_config * | ||
479 | stfsm_search_seq_rw_configs(struct stfsm *fsm, | ||
480 | struct seq_rw_config cfgs[]) | ||
481 | { | ||
482 | struct seq_rw_config *config; | ||
483 | int flags = fsm->info->flags; | ||
484 | |||
485 | for (config = cfgs; config->cmd != 0; config++) | ||
486 | if ((config->flags & flags) == config->flags) | ||
487 | return config; | ||
488 | |||
489 | return NULL; | ||
490 | } | ||
491 | |||
465 | static void stfsm_read_jedec(struct stfsm *fsm, uint8_t *const jedec) | 492 | static void stfsm_read_jedec(struct stfsm *fsm, uint8_t *const jedec) |
466 | { | 493 | { |
467 | const struct stfsm_seq *seq = &stfsm_seq_read_jedec; | 494 | const struct stfsm_seq *seq = &stfsm_seq_read_jedec; |