static int mtk_qspi_execute_cmd(struct mtk_qspi_priv *priv, u8 cmd) { u8 tmp; u8 val = cmd & ~MTK_QSPI_AUTOINC; writeb(cmd, &priv->regs->cmd); return readb_poll_timeout(&priv->regs->cmd, tmp, !(val & tmp), MTK_QSPI_CMD_POLLINGREG_US); }
static int nxp_spifi_wait_for_cmd(struct nxp_spifi *spifi) { u8 stat; int ret; ret = readb_poll_timeout(spifi->io_base + SPIFI_STAT, stat, !(stat & SPIFI_STAT_CMD), 10, 30); if (ret) dev_warn(spifi->dev, "command timed out\n"); return ret; }
static int nxp_spifi_reset(struct nxp_spifi *spifi) { u8 stat; int ret; writel(SPIFI_STAT_RESET, spifi->io_base + SPIFI_STAT); ret = readb_poll_timeout(spifi->io_base + SPIFI_STAT, stat, !(stat & SPIFI_STAT_RESET), 10, 30); if (ret) dev_warn(spifi->dev, "state reset timed out\n"); return ret; }
static int nxp_spifi_set_memory_mode_on(struct nxp_spifi *spifi) { u8 stat; int ret; if (spifi->memory_mode) return 0; writel(spifi->mcmd, spifi->io_base + SPIFI_MCMD); ret = readb_poll_timeout(spifi->io_base + SPIFI_STAT, stat, stat & SPIFI_STAT_MCINIT, 10, 30); if (ret) dev_err(spifi->dev, "unable to enter memory mode\n"); else spifi->memory_mode = true; return ret; }