Lines Matching refs:fsm
316 static int stfsm_n25q_config(struct stfsm *fsm);
317 static int stfsm_mx25_config(struct stfsm *fsm);
318 static int stfsm_s25fl_config(struct stfsm *fsm);
319 static int stfsm_w25q_config(struct stfsm *fsm);
707 static inline int stfsm_is_idle(struct stfsm *fsm) in stfsm_is_idle() argument
709 return readl(fsm->base + SPI_FAST_SEQ_STA) & 0x10; in stfsm_is_idle()
712 static inline uint32_t stfsm_fifo_available(struct stfsm *fsm) in stfsm_fifo_available() argument
714 return (readl(fsm->base + SPI_FAST_SEQ_STA) >> 5) & 0x7f; in stfsm_fifo_available()
717 static inline void stfsm_load_seq(struct stfsm *fsm, in stfsm_load_seq() argument
720 void __iomem *dst = fsm->base + SPI_FAST_SEQ_TRANSFER_SIZE; in stfsm_load_seq()
724 BUG_ON(!stfsm_is_idle(fsm)); in stfsm_load_seq()
733 static void stfsm_wait_seq(struct stfsm *fsm) in stfsm_wait_seq() argument
744 if (stfsm_is_idle(fsm)) in stfsm_wait_seq()
750 dev_err(fsm->dev, "timeout on sequence completion\n"); in stfsm_wait_seq()
753 static void stfsm_read_fifo(struct stfsm *fsm, uint32_t *buf, uint32_t size) in stfsm_read_fifo() argument
759 dev_dbg(fsm->dev, "Reading %d bytes from FIFO\n", size); in stfsm_read_fifo()
765 avail = stfsm_fifo_available(fsm); in stfsm_read_fifo()
773 readsl(fsm->base + SPI_FAST_SEQ_DATA_REG, buf, words); in stfsm_read_fifo()
804 static void stfsm_clear_fifo(struct stfsm *fsm) in stfsm_clear_fifo() argument
810 words = stfsm_fifo_available(fsm); in stfsm_clear_fifo()
813 readl(fsm->base + SPI_FAST_SEQ_DATA_REG); in stfsm_clear_fifo()
814 dev_dbg(fsm->dev, "cleared %d words from FIFO\n", words); in stfsm_clear_fifo()
823 stfsm_load_seq(fsm, seq); in stfsm_clear_fifo()
824 stfsm_wait_seq(fsm); in stfsm_clear_fifo()
825 words = stfsm_fifo_available(fsm); in stfsm_clear_fifo()
830 dev_err(fsm->dev, "failed to clear bytes from the data FIFO\n"); in stfsm_clear_fifo()
835 readl(fsm->base + SPI_FAST_SEQ_DATA_REG); in stfsm_clear_fifo()
837 dev_dbg(fsm->dev, "cleared %d byte(s) from the data FIFO\n", 4 - i); in stfsm_clear_fifo()
840 static int stfsm_write_fifo(struct stfsm *fsm, const uint32_t *buf, in stfsm_write_fifo() argument
845 dev_dbg(fsm->dev, "writing %d bytes to FIFO\n", size); in stfsm_write_fifo()
849 writesl(fsm->base + SPI_FAST_SEQ_DATA_REG, buf, words); in stfsm_write_fifo()
854 static int stfsm_enter_32bit_addr(struct stfsm *fsm, int enter) in stfsm_enter_32bit_addr() argument
856 struct stfsm_seq *seq = &fsm->stfsm_seq_en_32bit_addr; in stfsm_enter_32bit_addr()
864 stfsm_load_seq(fsm, seq); in stfsm_enter_32bit_addr()
866 stfsm_wait_seq(fsm); in stfsm_enter_32bit_addr()
871 static uint8_t stfsm_wait_busy(struct stfsm *fsm) in stfsm_wait_busy() argument
884 stfsm_load_seq(fsm, seq); in stfsm_wait_busy()
894 stfsm_wait_seq(fsm); in stfsm_wait_busy()
896 stfsm_read_fifo(fsm, &status, 4); in stfsm_wait_busy()
901 if ((fsm->configuration & CFG_S25FL_CHECK_ERROR_FLAGS) && in stfsm_wait_busy()
908 writel(seq->seq_cfg, fsm->base + SPI_FAST_SEQ_CFG); in stfsm_wait_busy()
913 dev_err(fsm->dev, "timeout on wait_busy\n"); in stfsm_wait_busy()
918 static int stfsm_read_status(struct stfsm *fsm, uint8_t cmd, in stfsm_read_status() argument
926 dev_dbg(fsm->dev, "read 'status' register [0x%02x], %d byte(s)\n", in stfsm_read_status()
934 stfsm_load_seq(fsm, seq); in stfsm_read_status()
936 stfsm_read_fifo(fsm, &tmp, 4); in stfsm_read_status()
941 stfsm_wait_seq(fsm); in stfsm_read_status()
946 static int stfsm_write_status(struct stfsm *fsm, uint8_t cmd, in stfsm_write_status() argument
951 dev_dbg(fsm->dev, in stfsm_write_status()
963 stfsm_load_seq(fsm, seq); in stfsm_write_status()
965 stfsm_wait_seq(fsm); in stfsm_write_status()
968 stfsm_wait_busy(fsm); in stfsm_write_status()
993 static bool stfsm_can_handle_soc_reset(struct stfsm *fsm) in stfsm_can_handle_soc_reset() argument
996 if (fsm->reset_signal && fsm->info->flags & FLASH_FLAG_RESET) in stfsm_can_handle_soc_reset()
1000 if (fsm->reset_por) in stfsm_can_handle_soc_reset()
1008 static void stfsm_prepare_erasesec_seq(struct stfsm *fsm, in stfsm_prepare_erasesec_seq() argument
1011 int addr1_cycles = fsm->info->flags & FLASH_FLAG_32BIT_ADDR ? 16 : 8; in stfsm_prepare_erasesec_seq()
1022 stfsm_search_seq_rw_configs(struct stfsm *fsm, in stfsm_search_seq_rw_configs() argument
1026 int flags = fsm->info->flags; in stfsm_search_seq_rw_configs()
1036 static void stfsm_prepare_rw_seq(struct stfsm *fsm, in stfsm_prepare_rw_seq() argument
1058 addr1_cycles = (fsm->info->flags & FLASH_FLAG_32BIT_ADDR) ? 16 : 8; in stfsm_prepare_rw_seq()
1104 static int stfsm_search_prepare_rw_seq(struct stfsm *fsm, in stfsm_search_prepare_rw_seq() argument
1110 config = stfsm_search_seq_rw_configs(fsm, cfgs); in stfsm_search_prepare_rw_seq()
1112 dev_err(fsm->dev, "failed to find suitable config\n"); in stfsm_search_prepare_rw_seq()
1116 stfsm_prepare_rw_seq(fsm, seq, config); in stfsm_search_prepare_rw_seq()
1122 static int stfsm_prepare_rwe_seqs_default(struct stfsm *fsm) in stfsm_prepare_rwe_seqs_default() argument
1124 uint32_t flags = fsm->info->flags; in stfsm_prepare_rwe_seqs_default()
1128 ret = stfsm_search_prepare_rw_seq(fsm, &fsm->stfsm_seq_read, in stfsm_prepare_rwe_seqs_default()
1131 dev_err(fsm->dev, in stfsm_prepare_rwe_seqs_default()
1138 ret = stfsm_search_prepare_rw_seq(fsm, &fsm->stfsm_seq_write, in stfsm_prepare_rwe_seqs_default()
1141 dev_err(fsm->dev, in stfsm_prepare_rwe_seqs_default()
1148 stfsm_prepare_erasesec_seq(fsm, &stfsm_seq_erase_sector); in stfsm_prepare_rwe_seqs_default()
1153 static int stfsm_mx25_config(struct stfsm *fsm) in stfsm_mx25_config() argument
1155 uint32_t flags = fsm->info->flags; in stfsm_mx25_config()
1164 ret = stfsm_prepare_rwe_seqs_default(fsm); in stfsm_mx25_config()
1173 stfsm_mx25_en_32bit_addr_seq(&fsm->stfsm_seq_en_32bit_addr); in stfsm_mx25_config()
1175 soc_reset = stfsm_can_handle_soc_reset(fsm); in stfsm_mx25_config()
1176 if (soc_reset || !fsm->booted_from_spi) in stfsm_mx25_config()
1179 stfsm_enter_32bit_addr(fsm, 1); in stfsm_mx25_config()
1184 fsm->configuration = (CFG_READ_TOGGLE_32BIT_ADDR | in stfsm_mx25_config()
1190 stfsm_read_status(fsm, SPINOR_OP_RDSR, &sta, 1); in stfsm_mx25_config()
1191 data_pads = ((fsm->stfsm_seq_read.seq_cfg >> 16) & 0x3) + 1; in stfsm_mx25_config()
1197 stfsm_write_status(fsm, SPINOR_OP_WRSR, sta, 1, 1); in stfsm_mx25_config()
1204 stfsm_write_status(fsm, SPINOR_OP_WRSR, sta, 1, 1); in stfsm_mx25_config()
1211 static int stfsm_n25q_config(struct stfsm *fsm) in stfsm_n25q_config() argument
1213 uint32_t flags = fsm->info->flags; in stfsm_n25q_config()
1220 ret = stfsm_search_prepare_rw_seq(fsm, &fsm->stfsm_seq_read, in stfsm_n25q_config()
1223 ret = stfsm_search_prepare_rw_seq(fsm, &fsm->stfsm_seq_read, in stfsm_n25q_config()
1226 dev_err(fsm->dev, in stfsm_n25q_config()
1233 ret = stfsm_search_prepare_rw_seq(fsm, &fsm->stfsm_seq_write, in stfsm_n25q_config()
1236 dev_err(fsm->dev, in stfsm_n25q_config()
1243 stfsm_prepare_erasesec_seq(fsm, &stfsm_seq_erase_sector); in stfsm_n25q_config()
1247 stfsm_n25q_en_32bit_addr_seq(&fsm->stfsm_seq_en_32bit_addr); in stfsm_n25q_config()
1249 soc_reset = stfsm_can_handle_soc_reset(fsm); in stfsm_n25q_config()
1250 if (soc_reset || !fsm->booted_from_spi) { in stfsm_n25q_config()
1255 stfsm_enter_32bit_addr(fsm, 1); in stfsm_n25q_config()
1261 fsm->configuration = (CFG_WRITE_TOGGLE_32BIT_ADDR | in stfsm_n25q_config()
1271 stfsm_write_status(fsm, N25Q_CMD_WRVCR, vcr, 1, 0); in stfsm_n25q_config()
1289 static void stfsm_s25fl_read_dyb(struct stfsm *fsm, uint32_t offs, uint8_t *dby) in stfsm_s25fl_read_dyb() argument
1316 stfsm_load_seq(fsm, &seq); in stfsm_s25fl_read_dyb()
1318 stfsm_read_fifo(fsm, &tmp, 4); in stfsm_s25fl_read_dyb()
1322 stfsm_wait_seq(fsm); in stfsm_s25fl_read_dyb()
1325 static void stfsm_s25fl_write_dyb(struct stfsm *fsm, uint32_t offs, uint8_t dby) in stfsm_s25fl_write_dyb() argument
1354 stfsm_load_seq(fsm, &seq); in stfsm_s25fl_write_dyb()
1355 stfsm_wait_seq(fsm); in stfsm_s25fl_write_dyb()
1357 stfsm_wait_busy(fsm); in stfsm_s25fl_write_dyb()
1360 static int stfsm_s25fl_clear_status_reg(struct stfsm *fsm) in stfsm_s25fl_clear_status_reg() argument
1384 stfsm_load_seq(fsm, &seq); in stfsm_s25fl_clear_status_reg()
1386 stfsm_wait_seq(fsm); in stfsm_s25fl_clear_status_reg()
1391 static int stfsm_s25fl_config(struct stfsm *fsm) in stfsm_s25fl_config() argument
1393 struct flash_info *info = fsm->info; in stfsm_s25fl_config()
1407 ret = stfsm_search_prepare_rw_seq(fsm, &fsm->stfsm_seq_read, in stfsm_s25fl_config()
1412 ret = stfsm_search_prepare_rw_seq(fsm, &fsm->stfsm_seq_write, in stfsm_s25fl_config()
1421 ret = stfsm_prepare_rwe_seqs_default(fsm); in stfsm_s25fl_config()
1434 stfsm_s25fl_read_dyb(fsm, offs, &dyb); in stfsm_s25fl_config()
1436 stfsm_s25fl_write_dyb(fsm, offs, 0xff); in stfsm_s25fl_config()
1448 stfsm_read_status(fsm, SPINOR_OP_RDSR2, &cr1, 1); in stfsm_s25fl_config()
1449 data_pads = ((fsm->stfsm_seq_read.seq_cfg >> 16) & 0x3) + 1; in stfsm_s25fl_config()
1466 stfsm_read_status(fsm, SPINOR_OP_RDSR, &sr1, 1); in stfsm_s25fl_config()
1468 stfsm_write_status(fsm, SPINOR_OP_WRSR, sta_wr, 2, 1); in stfsm_s25fl_config()
1475 fsm->configuration |= CFG_S25FL_CHECK_ERROR_FLAGS; in stfsm_s25fl_config()
1480 static int stfsm_w25q_config(struct stfsm *fsm) in stfsm_w25q_config() argument
1488 ret = stfsm_prepare_rwe_seqs_default(fsm); in stfsm_w25q_config()
1493 stfsm_read_status(fsm, SPINOR_OP_RDSR2, &sr2, 1); in stfsm_w25q_config()
1494 data_pads = ((fsm->stfsm_seq_read.seq_cfg >> 16) & 0x3) + 1; in stfsm_w25q_config()
1510 stfsm_read_status(fsm, SPINOR_OP_RDSR, &sr1, 1); in stfsm_w25q_config()
1512 stfsm_write_status(fsm, SPINOR_OP_WRSR, sr_wr, 2, 1); in stfsm_w25q_config()
1518 static int stfsm_read(struct stfsm *fsm, uint8_t *buf, uint32_t size, in stfsm_read() argument
1521 struct stfsm_seq *seq = &fsm->stfsm_seq_read; in stfsm_read()
1531 dev_dbg(fsm->dev, "reading %d bytes from 0x%08x\n", size, offset); in stfsm_read()
1534 if (fsm->configuration & CFG_READ_TOGGLE_32BIT_ADDR) in stfsm_read()
1535 stfsm_enter_32bit_addr(fsm, 1); in stfsm_read()
1553 stfsm_load_seq(fsm, seq); in stfsm_read()
1556 stfsm_read_fifo(fsm, (uint32_t *)p, size_lb); in stfsm_read()
1559 stfsm_read_fifo(fsm, tmp, read_mask + 1); in stfsm_read()
1568 stfsm_wait_seq(fsm); in stfsm_read()
1570 stfsm_clear_fifo(fsm); in stfsm_read()
1573 if (fsm->configuration & CFG_READ_TOGGLE_32BIT_ADDR) in stfsm_read()
1574 stfsm_enter_32bit_addr(fsm, 0); in stfsm_read()
1579 static int stfsm_write(struct stfsm *fsm, const uint8_t *buf, in stfsm_write() argument
1582 struct stfsm_seq *seq = &fsm->stfsm_seq_write; in stfsm_write()
1595 dev_dbg(fsm->dev, "writing %d bytes to 0x%08x\n", size, offset); in stfsm_write()
1598 if (fsm->configuration & CFG_WRITE_TOGGLE_32BIT_ADDR) in stfsm_write()
1599 stfsm_enter_32bit_addr(fsm, 1); in stfsm_write()
1625 writel(0x00040000, fsm->base + SPI_FAST_SEQ_CFG); in stfsm_write()
1631 if (fsm->fifo_dir_delay == 0) in stfsm_write()
1632 readl(fsm->base + SPI_FAST_SEQ_CFG); in stfsm_write()
1634 udelay(fsm->fifo_dir_delay); in stfsm_write()
1639 stfsm_write_fifo(fsm, (uint32_t *)p, size_lb); in stfsm_write()
1649 stfsm_write_fifo(fsm, tmp, write_mask + 1); in stfsm_write()
1653 stfsm_load_seq(fsm, seq); in stfsm_write()
1656 stfsm_wait_seq(fsm); in stfsm_write()
1659 ret = stfsm_wait_busy(fsm); in stfsm_write()
1660 if (ret && fsm->configuration & CFG_S25FL_CHECK_ERROR_FLAGS) in stfsm_write()
1661 stfsm_s25fl_clear_status_reg(fsm); in stfsm_write()
1664 if (fsm->configuration & CFG_WRITE_TOGGLE_32BIT_ADDR) in stfsm_write()
1665 stfsm_enter_32bit_addr(fsm, 0); in stfsm_write()
1677 struct stfsm *fsm = dev_get_drvdata(mtd->dev.parent); in stfsm_mtd_read() local
1680 dev_dbg(fsm->dev, "%s from 0x%08x, len %zd\n", in stfsm_mtd_read()
1683 mutex_lock(&fsm->lock); in stfsm_mtd_read()
1688 stfsm_read(fsm, buf, bytes, from); in stfsm_mtd_read()
1697 mutex_unlock(&fsm->lock); in stfsm_mtd_read()
1702 static int stfsm_erase_sector(struct stfsm *fsm, uint32_t offset) in stfsm_erase_sector() argument
1707 dev_dbg(fsm->dev, "erasing sector at 0x%08x\n", offset); in stfsm_erase_sector()
1710 if (fsm->configuration & CFG_ERASESEC_TOGGLE_32BIT_ADDR) in stfsm_erase_sector()
1711 stfsm_enter_32bit_addr(fsm, 1); in stfsm_erase_sector()
1716 stfsm_load_seq(fsm, seq); in stfsm_erase_sector()
1718 stfsm_wait_seq(fsm); in stfsm_erase_sector()
1721 ret = stfsm_wait_busy(fsm); in stfsm_erase_sector()
1722 if (ret && fsm->configuration & CFG_S25FL_CHECK_ERROR_FLAGS) in stfsm_erase_sector()
1723 stfsm_s25fl_clear_status_reg(fsm); in stfsm_erase_sector()
1726 if (fsm->configuration & CFG_ERASESEC_TOGGLE_32BIT_ADDR) in stfsm_erase_sector()
1727 stfsm_enter_32bit_addr(fsm, 0); in stfsm_erase_sector()
1732 static int stfsm_erase_chip(struct stfsm *fsm) in stfsm_erase_chip() argument
1736 dev_dbg(fsm->dev, "erasing chip\n"); in stfsm_erase_chip()
1738 stfsm_load_seq(fsm, seq); in stfsm_erase_chip()
1740 stfsm_wait_seq(fsm); in stfsm_erase_chip()
1742 return stfsm_wait_busy(fsm); in stfsm_erase_chip()
1753 struct stfsm *fsm = dev_get_drvdata(mtd->dev.parent); in stfsm_mtd_write() local
1760 dev_dbg(fsm->dev, "%s to 0x%08x, len %zd\n", __func__, (u32)to, len); in stfsm_mtd_write()
1765 mutex_lock(&fsm->lock); in stfsm_mtd_write()
1771 ret = stfsm_write(fsm, b, bytes, to); in stfsm_mtd_write()
1787 mutex_unlock(&fsm->lock); in stfsm_mtd_write()
1798 struct stfsm *fsm = dev_get_drvdata(mtd->dev.parent); in stfsm_mtd_erase() local
1802 dev_dbg(fsm->dev, "%s at 0x%llx, len %lld\n", __func__, in stfsm_mtd_erase()
1808 mutex_lock(&fsm->lock); in stfsm_mtd_erase()
1812 ret = stfsm_erase_chip(fsm); in stfsm_mtd_erase()
1817 ret = stfsm_erase_sector(fsm, addr); in stfsm_mtd_erase()
1826 mutex_unlock(&fsm->lock); in stfsm_mtd_erase()
1835 mutex_unlock(&fsm->lock); in stfsm_mtd_erase()
1840 static void stfsm_read_jedec(struct stfsm *fsm, uint8_t *jedec) in stfsm_read_jedec() argument
1845 stfsm_load_seq(fsm, seq); in stfsm_read_jedec()
1847 stfsm_read_fifo(fsm, tmp, 8); in stfsm_read_jedec()
1851 stfsm_wait_seq(fsm); in stfsm_read_jedec()
1854 static struct flash_info *stfsm_jedec_probe(struct stfsm *fsm) in stfsm_jedec_probe() argument
1861 stfsm_read_jedec(fsm, id); in stfsm_jedec_probe()
1871 dev_dbg(fsm->dev, "JEDEC = 0x%08x [%02x %02x %02x %02x %02x]\n", in stfsm_jedec_probe()
1881 dev_err(fsm->dev, "Unrecognized JEDEC id %06x\n", jedec); in stfsm_jedec_probe()
1886 static int stfsm_set_mode(struct stfsm *fsm, uint32_t mode) in stfsm_set_mode() argument
1892 ret = readl(fsm->base + SPI_STA_MODE_CHANGE); in stfsm_set_mode()
1901 writel(mode, fsm->base + SPI_MODESELECT); in stfsm_set_mode()
1906 static void stfsm_set_freq(struct stfsm *fsm, uint32_t spi_freq) in stfsm_set_freq() argument
1911 emi_freq = clk_get_rate(fsm->clk); in stfsm_set_freq()
1930 fsm->fifo_dir_delay = 0; in stfsm_set_freq()
1932 fsm->fifo_dir_delay = 1; in stfsm_set_freq()
1934 fsm->fifo_dir_delay = DIV_ROUND_UP(clk_div, 10); in stfsm_set_freq()
1936 dev_dbg(fsm->dev, "emi_clk = %uHZ, spi_freq = %uHZ, clk_div = %u\n", in stfsm_set_freq()
1939 writel(clk_div, fsm->base + SPI_CLOCKDIV); in stfsm_set_freq()
1942 static int stfsm_init(struct stfsm *fsm) in stfsm_init() argument
1947 writel(SEQ_CFG_SWRESET, fsm->base + SPI_FAST_SEQ_CFG); in stfsm_init()
1949 writel(0, fsm->base + SPI_FAST_SEQ_CFG); in stfsm_init()
1952 stfsm_set_freq(fsm, STFSM_FLASH_SAFE_FREQ); in stfsm_init()
1955 ret = stfsm_set_mode(fsm, SPI_MODESELECT_FSM); in stfsm_init()
1964 fsm->base + SPI_CONFIGDATA); in stfsm_init()
1965 writel(STFSM_DEFAULT_WR_TIME, fsm->base + SPI_STATUS_WR_TIME_REG); in stfsm_init()
1972 writel(0x00000001, fsm->base + SPI_PROGRAM_ERASE_TIME); in stfsm_init()
1975 stfsm_clear_fifo(fsm); in stfsm_init()
1982 struct stfsm *fsm = platform_get_drvdata(pdev); in stfsm_fetch_platform_configs() local
1991 fsm->booted_from_spi = true; in stfsm_fetch_platform_configs()
1997 fsm->reset_signal = of_property_read_bool(np, "st,reset-signal"); in stfsm_fetch_platform_configs()
1999 fsm->reset_por = of_property_read_bool(np, "st,reset-por"); in stfsm_fetch_platform_configs()
2016 fsm->booted_from_spi = false; in stfsm_fetch_platform_configs()
2030 struct stfsm *fsm; in stfsm_probe() local
2038 fsm = devm_kzalloc(&pdev->dev, sizeof(*fsm), GFP_KERNEL); in stfsm_probe()
2039 if (!fsm) in stfsm_probe()
2042 fsm->dev = &pdev->dev; in stfsm_probe()
2044 platform_set_drvdata(pdev, fsm); in stfsm_probe()
2052 fsm->base = devm_ioremap_resource(&pdev->dev, res); in stfsm_probe()
2053 if (IS_ERR(fsm->base)) { in stfsm_probe()
2056 return PTR_ERR(fsm->base); in stfsm_probe()
2059 fsm->clk = devm_clk_get(&pdev->dev, NULL); in stfsm_probe()
2060 if (IS_ERR(fsm->clk)) { in stfsm_probe()
2061 dev_err(fsm->dev, "Couldn't find EMI clock.\n"); in stfsm_probe()
2062 return PTR_ERR(fsm->clk); in stfsm_probe()
2065 ret = clk_prepare_enable(fsm->clk); in stfsm_probe()
2067 dev_err(fsm->dev, "Failed to enable EMI clock.\n"); in stfsm_probe()
2071 mutex_init(&fsm->lock); in stfsm_probe()
2073 ret = stfsm_init(fsm); in stfsm_probe()
2082 info = stfsm_jedec_probe(fsm); in stfsm_probe()
2085 fsm->info = info; in stfsm_probe()
2096 ret = info->config(fsm); in stfsm_probe()
2100 ret = stfsm_prepare_rwe_seqs_default(fsm); in stfsm_probe()
2105 fsm->mtd.name = info->name; in stfsm_probe()
2106 fsm->mtd.dev.parent = &pdev->dev; in stfsm_probe()
2107 mtd_set_of_node(&fsm->mtd, np); in stfsm_probe()
2108 fsm->mtd.type = MTD_NORFLASH; in stfsm_probe()
2109 fsm->mtd.writesize = 4; in stfsm_probe()
2110 fsm->mtd.writebufsize = fsm->mtd.writesize; in stfsm_probe()
2111 fsm->mtd.flags = MTD_CAP_NORFLASH; in stfsm_probe()
2112 fsm->mtd.size = info->sector_size * info->n_sectors; in stfsm_probe()
2113 fsm->mtd.erasesize = info->sector_size; in stfsm_probe()
2115 fsm->mtd._read = stfsm_mtd_read; in stfsm_probe()
2116 fsm->mtd._write = stfsm_mtd_write; in stfsm_probe()
2117 fsm->mtd._erase = stfsm_mtd_erase; in stfsm_probe()
2123 (long long)fsm->mtd.size, (long long)(fsm->mtd.size >> 20), in stfsm_probe()
2124 fsm->mtd.erasesize, (fsm->mtd.erasesize >> 10)); in stfsm_probe()
2126 return mtd_device_register(&fsm->mtd, NULL, 0); in stfsm_probe()
2131 struct stfsm *fsm = platform_get_drvdata(pdev); in stfsm_remove() local
2133 return mtd_device_unregister(&fsm->mtd); in stfsm_remove()
2139 struct stfsm *fsm = dev_get_drvdata(dev); in stfsmfsm_suspend() local
2141 clk_disable_unprepare(fsm->clk); in stfsmfsm_suspend()
2148 struct stfsm *fsm = dev_get_drvdata(dev); in stfsmfsm_resume() local
2150 clk_prepare_enable(fsm->clk); in stfsmfsm_resume()