Lines Matching refs:ct

64 int fl_read_stat(struct spi_flash_ctrl *ct, uint8_t *stat)  in fl_read_stat()  argument
66 return ct->cmd_rd(ct, CMD_RDSR, false, 0, stat, 1); in fl_read_stat()
69 static void fl_micron_status(struct spi_flash_ctrl *ct) in fl_micron_status() argument
78 ct->cmd_rd(ct, CMD_MIC_RDFLST, false, 0, &flst, 1); in fl_micron_status()
82 int fl_sync_wait_idle(struct spi_flash_ctrl *ct) in fl_sync_wait_idle() argument
89 rc = fl_read_stat(ct, &stat); in fl_sync_wait_idle()
92 if (ct->finfo->flags & FL_MICRON_BUGS) in fl_sync_wait_idle()
93 fl_micron_status(ct); in fl_sync_wait_idle()
101 int fl_wren(struct spi_flash_ctrl *ct) in fl_wren() argument
108 rc = ct->cmd_wr(ct, CMD_WREN, false, 0, NULL, 0); in fl_wren()
110 rc = fl_read_stat(ct, &stat); in fl_wren()
114 rc = fl_sync_wait_idle(ct); in fl_wren()
128 struct spi_flash_ctrl *ct = c->ctrl; in flash_read() local
137 if ((!c->mode_4b || ct->set_4b) && ct->read) in flash_read()
138 return ct->read(ct, pos, buf, len); in flash_read()
141 if (!ct->cmd_rd) in flash_read()
143 return ct->cmd_rd(ct, CMD_READ, true, pos, buf, len); in flash_read()
232 struct spi_flash_ctrl *ct = c->ctrl; in flash_erase() local
249 if (ct->erase) in flash_erase()
250 return ct->erase(ct, dst, size); in flash_erase()
258 rc = fl_wren(ct); in flash_erase()
263 rc = ct->cmd_wr(ct, cmd, true, dst, NULL, 0); in flash_erase()
268 rc = fl_sync_wait_idle(ct); in flash_erase()
280 struct spi_flash_ctrl *ct = c->ctrl; in flash_erase_chip() local
290 if (ct->erase) in flash_erase_chip()
291 return ct->erase(ct, 0, 0xffffffff); in flash_erase_chip()
293 rc = fl_wren(ct); in flash_erase_chip()
297 rc = ct->cmd_wr(ct, CMD_CE, false, 0, NULL, 0); in flash_erase_chip()
299 rc = ct->cmd_wr(ct, CMD_MIC_BULK_ERASE, false, 0, NULL, 0); in flash_erase_chip()
304 return fl_sync_wait_idle(ct); in flash_erase_chip()
310 struct spi_flash_ctrl *ct = c->ctrl; in fl_wpage() local
316 rc = fl_wren(ct); in fl_wpage()
319 rc = ct->cmd_wr(ct, CMD_PP, true, dst, src, size); in fl_wpage()
324 return fl_sync_wait_idle(ct); in fl_wpage()
331 struct spi_flash_ctrl *ct = c->ctrl; in flash_write() local
349 if ((!c->mode_4b || ct->set_4b) && ct->write) { in flash_write()
350 rc = ct->write(ct, dst, src, size); in flash_write()
357 if (!ct->cmd_wr) in flash_write()
581 static int fl_chip_id(struct spi_flash_ctrl *ct, uint8_t *id_buf, in fl_chip_id() argument
588 rc = fl_read_stat(ct, &stat); in fl_chip_id()
595 rc = fl_sync_wait_idle(ct); in fl_chip_id()
602 rc = ct->cmd_rd(ct, CMD_RDID, false, 0, id_buf, 3); in fl_chip_id()
612 struct spi_flash_ctrl *ct = c->ctrl; in flash_identify() local
619 if (ct->chip_id) { in flash_identify()
622 rc = ct->chip_id(ct, id, &id_size); in flash_identify()
624 rc = fl_chip_id(ct, id, &id_size); in flash_identify()
649 ct->finfo = &c->info; in flash_identify()
655 if (ct->setup) { in flash_identify()
656 rc = ct->setup(ct, &c->tsize); in flash_identify()
682 struct spi_flash_ctrl *ct = c->ctrl; in flash_set_4b() local
686 if (!ct->cmd_wr) in flash_set_4b()
690 rc = fl_wren(ct); in flash_set_4b()
697 return ct->cmd_wr(ct, enable ? CMD_EN4B : CMD_EX4B, false, 0, NULL, 0); in flash_set_4b()
702 struct spi_flash_ctrl *ct = c->ctrl; in flash_force_4b_mode() local
710 if (enable_4b && !((c->info.flags & FL_CAN_4B) && ct->set_4b)) in flash_force_4b_mode()
716 if (ct->cmd_wr) { in flash_force_4b_mode()
723 if (ct->set_4b) in flash_force_4b_mode()
724 rc = ct->set_4b(ct, enable_4b); in flash_force_4b_mode()
730 struct spi_flash_ctrl *ct = c->ctrl; in flash_configure() local
744 if (ct->cmd_wr) { in flash_configure()
754 if (ct->set_4b) { in flash_configure()
756 rc = ct->set_4b(ct, true); in flash_configure()
778 if (ct->set_4b) { in flash_configure()
780 rc = ct->set_4b(ct, false); in flash_configure()