nor 365 arch/mips/include/asm/stackframe.h nor v1, $0, v1 nor 403 arch/mips/include/asm/stackframe.h nor v1, $0, v1 nor 100 drivers/mtd/spi-nor/aspeed-smc.c struct spi_nor nor; nor 277 drivers/mtd/spi-nor/aspeed-smc.c static void aspeed_smc_start_user(struct spi_nor *nor) nor 279 drivers/mtd/spi-nor/aspeed-smc.c struct aspeed_smc_chip *chip = nor->priv; nor 296 drivers/mtd/spi-nor/aspeed-smc.c static void aspeed_smc_stop_user(struct spi_nor *nor) nor 298 drivers/mtd/spi-nor/aspeed-smc.c struct aspeed_smc_chip *chip = nor->priv; nor 308 drivers/mtd/spi-nor/aspeed-smc.c static int aspeed_smc_prep(struct spi_nor *nor, enum spi_nor_ops ops) nor 310 drivers/mtd/spi-nor/aspeed-smc.c struct aspeed_smc_chip *chip = nor->priv; nor 316 drivers/mtd/spi-nor/aspeed-smc.c static void aspeed_smc_unprep(struct spi_nor *nor, enum spi_nor_ops ops) nor 318 drivers/mtd/spi-nor/aspeed-smc.c struct aspeed_smc_chip *chip = nor->priv; nor 323 drivers/mtd/spi-nor/aspeed-smc.c static int aspeed_smc_read_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len) nor 325 drivers/mtd/spi-nor/aspeed-smc.c struct aspeed_smc_chip *chip = nor->priv; nor 327 drivers/mtd/spi-nor/aspeed-smc.c aspeed_smc_start_user(nor); nor 330 drivers/mtd/spi-nor/aspeed-smc.c aspeed_smc_stop_user(nor); nor 334 drivers/mtd/spi-nor/aspeed-smc.c static int aspeed_smc_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, nor 337 drivers/mtd/spi-nor/aspeed-smc.c struct aspeed_smc_chip *chip = nor->priv; nor 339 drivers/mtd/spi-nor/aspeed-smc.c aspeed_smc_start_user(nor); nor 342 drivers/mtd/spi-nor/aspeed-smc.c aspeed_smc_stop_user(nor); nor 346 drivers/mtd/spi-nor/aspeed-smc.c static void aspeed_smc_send_cmd_addr(struct spi_nor *nor, u8 cmd, u32 addr) nor 348 drivers/mtd/spi-nor/aspeed-smc.c struct aspeed_smc_chip *chip = nor->priv; nor 352 drivers/mtd/spi-nor/aspeed-smc.c switch (nor->addr_width) { nor 355 drivers/mtd/spi-nor/aspeed-smc.c nor->addr_width); nor 372 drivers/mtd/spi-nor/aspeed-smc.c static ssize_t aspeed_smc_read_user(struct spi_nor *nor, loff_t from, nor 375 drivers/mtd/spi-nor/aspeed-smc.c struct aspeed_smc_chip *chip = nor->priv; nor 379 drivers/mtd/spi-nor/aspeed-smc.c aspeed_smc_start_user(nor); nor 380 drivers/mtd/spi-nor/aspeed-smc.c aspeed_smc_send_cmd_addr(nor, nor->read_opcode, from); nor 381 drivers/mtd/spi-nor/aspeed-smc.c for (i = 0; i < chip->nor.read_dummy / 8; i++) nor 385 drivers/mtd/spi-nor/aspeed-smc.c aspeed_smc_stop_user(nor); nor 389 drivers/mtd/spi-nor/aspeed-smc.c static ssize_t aspeed_smc_write_user(struct spi_nor *nor, loff_t to, nor 392 drivers/mtd/spi-nor/aspeed-smc.c struct aspeed_smc_chip *chip = nor->priv; nor 394 drivers/mtd/spi-nor/aspeed-smc.c aspeed_smc_start_user(nor); nor 395 drivers/mtd/spi-nor/aspeed-smc.c aspeed_smc_send_cmd_addr(nor, nor->program_opcode, to); nor 397 drivers/mtd/spi-nor/aspeed-smc.c aspeed_smc_stop_user(nor); nor 409 drivers/mtd/spi-nor/aspeed-smc.c mtd_device_unregister(&chip->nor.mtd); nor 488 drivers/mtd/spi-nor/aspeed-smc.c dev_warn(chip->nor.dev, "CE%d window resized to %dMB", nor 502 drivers/mtd/spi-nor/aspeed-smc.c dev_err(chip->nor.dev, "CE%d window invalid", cs); nor 509 drivers/mtd/spi-nor/aspeed-smc.c dev_info(chip->nor.dev, "CE%d window [ 0x%.8x - 0x%.8x ] %dMB", nor 527 drivers/mtd/spi-nor/aspeed-smc.c u32 size = chip->nor.mtd.size; nor 553 drivers/mtd/spi-nor/aspeed-smc.c dev_info(chip->nor.dev, nor 587 drivers/mtd/spi-nor/aspeed-smc.c if (size < chip->nor.mtd.size) nor 588 drivers/mtd/spi-nor/aspeed-smc.c dev_warn(chip->nor.dev, nor 590 drivers/mtd/spi-nor/aspeed-smc.c chip->cs, (u32)chip->nor.mtd.size >> 20); nor 667 drivers/mtd/spi-nor/aspeed-smc.c dev_warn(chip->nor.dev, "CE%d window closed", chip->cs); nor 711 drivers/mtd/spi-nor/aspeed-smc.c if (chip->nor.addr_width == 4 && info->set_4b) nor 721 drivers/mtd/spi-nor/aspeed-smc.c chip->nor.program_opcode << CONTROL_COMMAND_SHIFT | nor 731 drivers/mtd/spi-nor/aspeed-smc.c if (chip->nor.read_proto == SNOR_PROTO_1_1_1) { nor 732 drivers/mtd/spi-nor/aspeed-smc.c if (chip->nor.read_dummy == 0) nor 737 drivers/mtd/spi-nor/aspeed-smc.c dev_err(chip->nor.dev, "unsupported SPI read mode\n"); nor 742 drivers/mtd/spi-nor/aspeed-smc.c CONTROL_IO_DUMMY_SET(chip->nor.read_dummy / 8); nor 765 drivers/mtd/spi-nor/aspeed-smc.c struct spi_nor *nor; nor 787 drivers/mtd/spi-nor/aspeed-smc.c cs, dev_name(controller->chips[cs]->nor.dev)); nor 802 drivers/mtd/spi-nor/aspeed-smc.c nor = &chip->nor; nor 803 drivers/mtd/spi-nor/aspeed-smc.c mtd = &nor->mtd; nor 805 drivers/mtd/spi-nor/aspeed-smc.c nor->dev = dev; nor 806 drivers/mtd/spi-nor/aspeed-smc.c nor->priv = chip; nor 807 drivers/mtd/spi-nor/aspeed-smc.c spi_nor_set_flash_node(nor, child); nor 808 drivers/mtd/spi-nor/aspeed-smc.c nor->read = aspeed_smc_read_user; nor 809 drivers/mtd/spi-nor/aspeed-smc.c nor->write = aspeed_smc_write_user; nor 810 drivers/mtd/spi-nor/aspeed-smc.c nor->read_reg = aspeed_smc_read_reg; nor 811 drivers/mtd/spi-nor/aspeed-smc.c nor->write_reg = aspeed_smc_write_reg; nor 812 drivers/mtd/spi-nor/aspeed-smc.c nor->prepare = aspeed_smc_prep; nor 813 drivers/mtd/spi-nor/aspeed-smc.c nor->unprepare = aspeed_smc_unprep; nor 824 drivers/mtd/spi-nor/aspeed-smc.c ret = spi_nor_scan(nor, NULL, &hwcaps); nor 47 drivers/mtd/spi-nor/cadence-quadspi.c struct spi_nor nor; nor 288 drivers/mtd/spi-nor/cadence-quadspi.c static unsigned int cqspi_calc_rdreg(struct spi_nor *nor, const u8 opcode) nor 290 drivers/mtd/spi-nor/cadence-quadspi.c struct cqspi_flash_pdata *f_pdata = nor->priv; nor 357 drivers/mtd/spi-nor/cadence-quadspi.c static int cqspi_command_read(struct spi_nor *nor, nor 361 drivers/mtd/spi-nor/cadence-quadspi.c struct cqspi_flash_pdata *f_pdata = nor->priv; nor 370 drivers/mtd/spi-nor/cadence-quadspi.c dev_err(nor->dev, "Invalid input argument, len %d rxbuf 0x%p\n", nor 377 drivers/mtd/spi-nor/cadence-quadspi.c rdreg = cqspi_calc_rdreg(nor, txbuf[0]); nor 406 drivers/mtd/spi-nor/cadence-quadspi.c static int cqspi_command_write(struct spi_nor *nor, const u8 opcode, nor 409 drivers/mtd/spi-nor/cadence-quadspi.c struct cqspi_flash_pdata *f_pdata = nor->priv; nor 418 drivers/mtd/spi-nor/cadence-quadspi.c dev_err(nor->dev, nor 446 drivers/mtd/spi-nor/cadence-quadspi.c static int cqspi_command_write_addr(struct spi_nor *nor, nor 449 drivers/mtd/spi-nor/cadence-quadspi.c struct cqspi_flash_pdata *f_pdata = nor->priv; nor 456 drivers/mtd/spi-nor/cadence-quadspi.c reg |= ((nor->addr_width - 1) & CQSPI_REG_CMDCTRL_ADD_BYTES_MASK) nor 464 drivers/mtd/spi-nor/cadence-quadspi.c static int cqspi_read_setup(struct spi_nor *nor) nor 466 drivers/mtd/spi-nor/cadence-quadspi.c struct cqspi_flash_pdata *f_pdata = nor->priv; nor 472 drivers/mtd/spi-nor/cadence-quadspi.c reg = nor->read_opcode << CQSPI_REG_RD_INSTR_OPCODE_LSB; nor 473 drivers/mtd/spi-nor/cadence-quadspi.c reg |= cqspi_calc_rdreg(nor, nor->read_opcode); nor 476 drivers/mtd/spi-nor/cadence-quadspi.c dummy_clk = nor->read_dummy; nor 499 drivers/mtd/spi-nor/cadence-quadspi.c reg |= (nor->addr_width - 1); nor 504 drivers/mtd/spi-nor/cadence-quadspi.c static int cqspi_indirect_read_execute(struct spi_nor *nor, u8 *rxbuf, nor 507 drivers/mtd/spi-nor/cadence-quadspi.c struct cqspi_flash_pdata *f_pdata = nor->priv; nor 537 drivers/mtd/spi-nor/cadence-quadspi.c dev_err(nor->dev, "Indirect read timeout, no bytes\n"); nor 573 drivers/mtd/spi-nor/cadence-quadspi.c dev_err(nor->dev, nor 596 drivers/mtd/spi-nor/cadence-quadspi.c static int cqspi_write_setup(struct spi_nor *nor) nor 599 drivers/mtd/spi-nor/cadence-quadspi.c struct cqspi_flash_pdata *f_pdata = nor->priv; nor 604 drivers/mtd/spi-nor/cadence-quadspi.c reg = nor->program_opcode << CQSPI_REG_WR_INSTR_OPCODE_LSB; nor 606 drivers/mtd/spi-nor/cadence-quadspi.c reg = cqspi_calc_rdreg(nor, nor->program_opcode); nor 611 drivers/mtd/spi-nor/cadence-quadspi.c reg |= (nor->addr_width - 1); nor 616 drivers/mtd/spi-nor/cadence-quadspi.c static int cqspi_indirect_write_execute(struct spi_nor *nor, loff_t to_addr, nor 619 drivers/mtd/spi-nor/cadence-quadspi.c const unsigned int page_size = nor->page_size; nor 620 drivers/mtd/spi-nor/cadence-quadspi.c struct cqspi_flash_pdata *f_pdata = nor->priv; nor 669 drivers/mtd/spi-nor/cadence-quadspi.c dev_err(nor->dev, "Indirect write timeout\n"); nor 684 drivers/mtd/spi-nor/cadence-quadspi.c dev_err(nor->dev, nor 709 drivers/mtd/spi-nor/cadence-quadspi.c static void cqspi_chipselect(struct spi_nor *nor) nor 711 drivers/mtd/spi-nor/cadence-quadspi.c struct cqspi_flash_pdata *f_pdata = nor->priv; nor 739 drivers/mtd/spi-nor/cadence-quadspi.c static void cqspi_configure_cs_and_sizes(struct spi_nor *nor) nor 741 drivers/mtd/spi-nor/cadence-quadspi.c struct cqspi_flash_pdata *f_pdata = nor->priv; nor 751 drivers/mtd/spi-nor/cadence-quadspi.c reg |= (nor->page_size << CQSPI_REG_SIZE_PAGE_LSB); nor 752 drivers/mtd/spi-nor/cadence-quadspi.c reg |= (ilog2(nor->mtd.erasesize) << CQSPI_REG_SIZE_BLOCK_LSB); nor 753 drivers/mtd/spi-nor/cadence-quadspi.c reg |= (nor->addr_width - 1); nor 757 drivers/mtd/spi-nor/cadence-quadspi.c cqspi_chipselect(nor); nor 760 drivers/mtd/spi-nor/cadence-quadspi.c cqspi->current_page_size = nor->page_size; nor 761 drivers/mtd/spi-nor/cadence-quadspi.c cqspi->current_erase_size = nor->mtd.erasesize; nor 762 drivers/mtd/spi-nor/cadence-quadspi.c cqspi->current_addr_width = nor->addr_width; nor 776 drivers/mtd/spi-nor/cadence-quadspi.c static void cqspi_delay(struct spi_nor *nor) nor 778 drivers/mtd/spi-nor/cadence-quadspi.c struct cqspi_flash_pdata *f_pdata = nor->priv; nor 862 drivers/mtd/spi-nor/cadence-quadspi.c static void cqspi_configure(struct spi_nor *nor) nor 864 drivers/mtd/spi-nor/cadence-quadspi.c struct cqspi_flash_pdata *f_pdata = nor->priv; nor 870 drivers/mtd/spi-nor/cadence-quadspi.c if ((cqspi->current_page_size != nor->page_size) || nor 871 drivers/mtd/spi-nor/cadence-quadspi.c (cqspi->current_erase_size != nor->mtd.erasesize) || nor 872 drivers/mtd/spi-nor/cadence-quadspi.c (cqspi->current_addr_width != nor->addr_width)) nor 881 drivers/mtd/spi-nor/cadence-quadspi.c cqspi_configure_cs_and_sizes(nor); nor 888 drivers/mtd/spi-nor/cadence-quadspi.c cqspi_delay(nor); nor 897 drivers/mtd/spi-nor/cadence-quadspi.c static int cqspi_set_protocol(struct spi_nor *nor, const int read) nor 899 drivers/mtd/spi-nor/cadence-quadspi.c struct cqspi_flash_pdata *f_pdata = nor->priv; nor 906 drivers/mtd/spi-nor/cadence-quadspi.c switch (nor->read_proto) { nor 924 drivers/mtd/spi-nor/cadence-quadspi.c cqspi_configure(nor); nor 929 drivers/mtd/spi-nor/cadence-quadspi.c static ssize_t cqspi_write(struct spi_nor *nor, loff_t to, nor 932 drivers/mtd/spi-nor/cadence-quadspi.c struct cqspi_flash_pdata *f_pdata = nor->priv; nor 936 drivers/mtd/spi-nor/cadence-quadspi.c ret = cqspi_set_protocol(nor, 0); nor 940 drivers/mtd/spi-nor/cadence-quadspi.c ret = cqspi_write_setup(nor); nor 948 drivers/mtd/spi-nor/cadence-quadspi.c ret = cqspi_indirect_write_execute(nor, to, buf, len); nor 963 drivers/mtd/spi-nor/cadence-quadspi.c static int cqspi_direct_read_execute(struct spi_nor *nor, u_char *buf, nor 966 drivers/mtd/spi-nor/cadence-quadspi.c struct cqspi_flash_pdata *f_pdata = nor->priv; nor 980 drivers/mtd/spi-nor/cadence-quadspi.c dma_dst = dma_map_single(nor->dev, buf, len, DMA_FROM_DEVICE); nor 981 drivers/mtd/spi-nor/cadence-quadspi.c if (dma_mapping_error(nor->dev, dma_dst)) { nor 982 drivers/mtd/spi-nor/cadence-quadspi.c dev_err(nor->dev, "dma mapping failed\n"); nor 988 drivers/mtd/spi-nor/cadence-quadspi.c dev_err(nor->dev, "device_prep_dma_memcpy error\n"); nor 1000 drivers/mtd/spi-nor/cadence-quadspi.c dev_err(nor->dev, "dma_submit_error %d\n", cookie); nor 1009 drivers/mtd/spi-nor/cadence-quadspi.c dev_err(nor->dev, "DMA wait_for_completion_timeout\n"); nor 1015 drivers/mtd/spi-nor/cadence-quadspi.c dma_unmap_single(nor->dev, dma_dst, len, DMA_FROM_DEVICE); nor 1020 drivers/mtd/spi-nor/cadence-quadspi.c static ssize_t cqspi_read(struct spi_nor *nor, loff_t from, nor 1023 drivers/mtd/spi-nor/cadence-quadspi.c struct cqspi_flash_pdata *f_pdata = nor->priv; nor 1026 drivers/mtd/spi-nor/cadence-quadspi.c ret = cqspi_set_protocol(nor, 1); nor 1030 drivers/mtd/spi-nor/cadence-quadspi.c ret = cqspi_read_setup(nor); nor 1035 drivers/mtd/spi-nor/cadence-quadspi.c ret = cqspi_direct_read_execute(nor, buf, from, len); nor 1037 drivers/mtd/spi-nor/cadence-quadspi.c ret = cqspi_indirect_read_execute(nor, buf, from, len); nor 1044 drivers/mtd/spi-nor/cadence-quadspi.c static int cqspi_erase(struct spi_nor *nor, loff_t offs) nor 1048 drivers/mtd/spi-nor/cadence-quadspi.c ret = cqspi_set_protocol(nor, 0); nor 1053 drivers/mtd/spi-nor/cadence-quadspi.c ret = nor->write_reg(nor, SPINOR_OP_WREN, NULL, 0); nor 1058 drivers/mtd/spi-nor/cadence-quadspi.c ret = cqspi_command_write_addr(nor, nor->erase_opcode, offs); nor 1065 drivers/mtd/spi-nor/cadence-quadspi.c static int cqspi_prep(struct spi_nor *nor, enum spi_nor_ops ops) nor 1067 drivers/mtd/spi-nor/cadence-quadspi.c struct cqspi_flash_pdata *f_pdata = nor->priv; nor 1075 drivers/mtd/spi-nor/cadence-quadspi.c static void cqspi_unprep(struct spi_nor *nor, enum spi_nor_ops ops) nor 1077 drivers/mtd/spi-nor/cadence-quadspi.c struct cqspi_flash_pdata *f_pdata = nor->priv; nor 1083 drivers/mtd/spi-nor/cadence-quadspi.c static int cqspi_read_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len) nor 1087 drivers/mtd/spi-nor/cadence-quadspi.c ret = cqspi_set_protocol(nor, 0); nor 1089 drivers/mtd/spi-nor/cadence-quadspi.c ret = cqspi_command_read(nor, &opcode, 1, buf, len); nor 1094 drivers/mtd/spi-nor/cadence-quadspi.c static int cqspi_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len) nor 1098 drivers/mtd/spi-nor/cadence-quadspi.c ret = cqspi_set_protocol(nor, 0); nor 1100 drivers/mtd/spi-nor/cadence-quadspi.c ret = cqspi_command_write(nor, opcode, buf, len); nor 1226 drivers/mtd/spi-nor/cadence-quadspi.c struct spi_nor *nor; nor 1260 drivers/mtd/spi-nor/cadence-quadspi.c nor = &f_pdata->nor; nor 1261 drivers/mtd/spi-nor/cadence-quadspi.c mtd = &nor->mtd; nor 1263 drivers/mtd/spi-nor/cadence-quadspi.c mtd->priv = nor; nor 1265 drivers/mtd/spi-nor/cadence-quadspi.c nor->dev = dev; nor 1266 drivers/mtd/spi-nor/cadence-quadspi.c spi_nor_set_flash_node(nor, np); nor 1267 drivers/mtd/spi-nor/cadence-quadspi.c nor->priv = f_pdata; nor 1269 drivers/mtd/spi-nor/cadence-quadspi.c nor->read_reg = cqspi_read_reg; nor 1270 drivers/mtd/spi-nor/cadence-quadspi.c nor->write_reg = cqspi_write_reg; nor 1271 drivers/mtd/spi-nor/cadence-quadspi.c nor->read = cqspi_read; nor 1272 drivers/mtd/spi-nor/cadence-quadspi.c nor->write = cqspi_write; nor 1273 drivers/mtd/spi-nor/cadence-quadspi.c nor->erase = cqspi_erase; nor 1274 drivers/mtd/spi-nor/cadence-quadspi.c nor->prepare = cqspi_prep; nor 1275 drivers/mtd/spi-nor/cadence-quadspi.c nor->unprepare = cqspi_unprep; nor 1284 drivers/mtd/spi-nor/cadence-quadspi.c ret = spi_nor_scan(nor, NULL, &hwcaps); nor 1296 drivers/mtd/spi-nor/cadence-quadspi.c dev_dbg(nor->dev, "using direct mode for %s\n", nor 1309 drivers/mtd/spi-nor/cadence-quadspi.c mtd_device_unregister(&cqspi->f_pdata[i].nor.mtd); nor 1448 drivers/mtd/spi-nor/cadence-quadspi.c mtd_device_unregister(&cqspi->f_pdata[i].nor.mtd); nor 99 drivers/mtd/spi-nor/hisi-sfc.c struct spi_nor *nor[HIFMC_MAX_CHIP_NUM]; nor 147 drivers/mtd/spi-nor/hisi-sfc.c static int hisi_spi_nor_prep(struct spi_nor *nor, enum spi_nor_ops ops) nor 149 drivers/mtd/spi-nor/hisi-sfc.c struct hifmc_priv *priv = nor->priv; nor 170 drivers/mtd/spi-nor/hisi-sfc.c static void hisi_spi_nor_unprep(struct spi_nor *nor, enum spi_nor_ops ops) nor 172 drivers/mtd/spi-nor/hisi-sfc.c struct hifmc_priv *priv = nor->priv; nor 179 drivers/mtd/spi-nor/hisi-sfc.c static int hisi_spi_nor_op_reg(struct spi_nor *nor, nor 182 drivers/mtd/spi-nor/hisi-sfc.c struct hifmc_priv *priv = nor->priv; nor 202 drivers/mtd/spi-nor/hisi-sfc.c static int hisi_spi_nor_read_reg(struct spi_nor *nor, u8 opcode, u8 *buf, nor 205 drivers/mtd/spi-nor/hisi-sfc.c struct hifmc_priv *priv = nor->priv; nor 209 drivers/mtd/spi-nor/hisi-sfc.c ret = hisi_spi_nor_op_reg(nor, opcode, len, FMC_OP_READ_DATA_EN); nor 217 drivers/mtd/spi-nor/hisi-sfc.c static int hisi_spi_nor_write_reg(struct spi_nor *nor, u8 opcode, nor 220 drivers/mtd/spi-nor/hisi-sfc.c struct hifmc_priv *priv = nor->priv; nor 226 drivers/mtd/spi-nor/hisi-sfc.c return hisi_spi_nor_op_reg(nor, opcode, len, FMC_OP_WRITE_DATA_EN); nor 229 drivers/mtd/spi-nor/hisi-sfc.c static int hisi_spi_nor_dma_transfer(struct spi_nor *nor, loff_t start_off, nor 232 drivers/mtd/spi-nor/hisi-sfc.c struct hifmc_priv *priv = nor->priv; nor 240 drivers/mtd/spi-nor/hisi-sfc.c reg |= (nor->addr_width == 4) ? SPI_NOR_ADDR_MODE_4BYTES nor 250 drivers/mtd/spi-nor/hisi-sfc.c if_type = hisi_spi_nor_get_if_type(nor->read_proto); nor 252 drivers/mtd/spi-nor/hisi-sfc.c if_type = hisi_spi_nor_get_if_type(nor->write_proto); nor 255 drivers/mtd/spi-nor/hisi-sfc.c reg |= OP_CFG_DUMMY_NUM(nor->read_dummy >> 3); nor 261 drivers/mtd/spi-nor/hisi-sfc.c ? OP_CTRL_RD_OPCODE(nor->read_opcode) nor 262 drivers/mtd/spi-nor/hisi-sfc.c : OP_CTRL_WR_OPCODE(nor->program_opcode); nor 268 drivers/mtd/spi-nor/hisi-sfc.c static ssize_t hisi_spi_nor_read(struct spi_nor *nor, loff_t from, size_t len, nor 271 drivers/mtd/spi-nor/hisi-sfc.c struct hifmc_priv *priv = nor->priv; nor 279 drivers/mtd/spi-nor/hisi-sfc.c ret = hisi_spi_nor_dma_transfer(nor, nor 282 drivers/mtd/spi-nor/hisi-sfc.c dev_warn(nor->dev, "DMA read timeout\n"); nor 291 drivers/mtd/spi-nor/hisi-sfc.c static ssize_t hisi_spi_nor_write(struct spi_nor *nor, loff_t to, nor 294 drivers/mtd/spi-nor/hisi-sfc.c struct hifmc_priv *priv = nor->priv; nor 303 drivers/mtd/spi-nor/hisi-sfc.c ret = hisi_spi_nor_dma_transfer(nor, nor 306 drivers/mtd/spi-nor/hisi-sfc.c dev_warn(nor->dev, "DMA write timeout\n"); nor 328 drivers/mtd/spi-nor/hisi-sfc.c struct spi_nor *nor; nor 333 drivers/mtd/spi-nor/hisi-sfc.c nor = devm_kzalloc(dev, sizeof(*nor), GFP_KERNEL); nor 334 drivers/mtd/spi-nor/hisi-sfc.c if (!nor) nor 337 drivers/mtd/spi-nor/hisi-sfc.c nor->dev = dev; nor 338 drivers/mtd/spi-nor/hisi-sfc.c spi_nor_set_flash_node(nor, np); nor 359 drivers/mtd/spi-nor/hisi-sfc.c nor->priv = priv; nor 361 drivers/mtd/spi-nor/hisi-sfc.c nor->prepare = hisi_spi_nor_prep; nor 362 drivers/mtd/spi-nor/hisi-sfc.c nor->unprepare = hisi_spi_nor_unprep; nor 363 drivers/mtd/spi-nor/hisi-sfc.c nor->read_reg = hisi_spi_nor_read_reg; nor 364 drivers/mtd/spi-nor/hisi-sfc.c nor->write_reg = hisi_spi_nor_write_reg; nor 365 drivers/mtd/spi-nor/hisi-sfc.c nor->read = hisi_spi_nor_read; nor 366 drivers/mtd/spi-nor/hisi-sfc.c nor->write = hisi_spi_nor_write; nor 367 drivers/mtd/spi-nor/hisi-sfc.c nor->erase = NULL; nor 368 drivers/mtd/spi-nor/hisi-sfc.c ret = spi_nor_scan(nor, NULL, &hwcaps); nor 372 drivers/mtd/spi-nor/hisi-sfc.c mtd = &nor->mtd; nor 378 drivers/mtd/spi-nor/hisi-sfc.c host->nor[host->num_chip] = nor; nor 388 drivers/mtd/spi-nor/hisi-sfc.c mtd_device_unregister(&host->nor[i]->mtd); nor 143 drivers/mtd/spi-nor/intel-spi.c struct spi_nor nor; nor 538 drivers/mtd/spi-nor/intel-spi.c static int intel_spi_read_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len) nor 540 drivers/mtd/spi-nor/intel-spi.c struct intel_spi *ispi = nor->priv; nor 558 drivers/mtd/spi-nor/intel-spi.c static int intel_spi_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len) nor 560 drivers/mtd/spi-nor/intel-spi.c struct intel_spi *ispi = nor->priv; nor 606 drivers/mtd/spi-nor/intel-spi.c static ssize_t intel_spi_read(struct spi_nor *nor, loff_t from, size_t len, nor 609 drivers/mtd/spi-nor/intel-spi.c struct intel_spi *ispi = nor->priv; nor 621 drivers/mtd/spi-nor/intel-spi.c switch (nor->read_opcode) { nor 677 drivers/mtd/spi-nor/intel-spi.c static ssize_t intel_spi_write(struct spi_nor *nor, loff_t to, size_t len, nor 680 drivers/mtd/spi-nor/intel-spi.c struct intel_spi *ispi = nor->priv; nor 740 drivers/mtd/spi-nor/intel-spi.c static int intel_spi_erase(struct spi_nor *nor, loff_t offs) nor 742 drivers/mtd/spi-nor/intel-spi.c size_t erase_size, len = nor->mtd.erasesize; nor 743 drivers/mtd/spi-nor/intel-spi.c struct intel_spi *ispi = nor->priv; nor 760 drivers/mtd/spi-nor/intel-spi.c ret = intel_spi_sw_cycle(ispi, nor->erase_opcode, nor 898 drivers/mtd/spi-nor/intel-spi.c ispi->nor.dev = ispi->dev; nor 899 drivers/mtd/spi-nor/intel-spi.c ispi->nor.priv = ispi; nor 900 drivers/mtd/spi-nor/intel-spi.c ispi->nor.read_reg = intel_spi_read_reg; nor 901 drivers/mtd/spi-nor/intel-spi.c ispi->nor.write_reg = intel_spi_write_reg; nor 902 drivers/mtd/spi-nor/intel-spi.c ispi->nor.read = intel_spi_read; nor 903 drivers/mtd/spi-nor/intel-spi.c ispi->nor.write = intel_spi_write; nor 904 drivers/mtd/spi-nor/intel-spi.c ispi->nor.erase = intel_spi_erase; nor 906 drivers/mtd/spi-nor/intel-spi.c ret = spi_nor_scan(&ispi->nor, NULL, &hwcaps); nor 916 drivers/mtd/spi-nor/intel-spi.c ispi->nor.mtd.flags &= ~MTD_WRITEABLE; nor 918 drivers/mtd/spi-nor/intel-spi.c ret = mtd_device_register(&ispi->nor.mtd, &part, 1); nor 928 drivers/mtd/spi-nor/intel-spi.c return mtd_device_unregister(&ispi->nor.mtd); nor 106 drivers/mtd/spi-nor/mtk-quadspi.c struct spi_nor nor; nor 115 drivers/mtd/spi-nor/mtk-quadspi.c struct spi_nor *nor = &mtk_nor->nor; nor 117 drivers/mtd/spi-nor/mtk-quadspi.c switch (nor->read_proto) { nor 119 drivers/mtd/spi-nor/mtk-quadspi.c writeb(nor->read_opcode, mtk_nor->base + nor 125 drivers/mtd/spi-nor/mtk-quadspi.c writeb(nor->read_opcode, mtk_nor->base + nor 131 drivers/mtd/spi-nor/mtk-quadspi.c writeb(nor->read_opcode, mtk_nor->base + nor 229 drivers/mtd/spi-nor/mtk-quadspi.c struct spi_nor *nor = &mtk_nor->nor; nor 233 drivers/mtd/spi-nor/mtk-quadspi.c switch (nor->addr_width) { nor 242 drivers/mtd/spi-nor/mtk-quadspi.c nor->addr_width); nor 263 drivers/mtd/spi-nor/mtk-quadspi.c static ssize_t mtk_nor_read(struct spi_nor *nor, loff_t from, size_t length, nor 269 drivers/mtd/spi-nor/mtk-quadspi.c struct mtk_nor *mtk_nor = nor->priv; nor 317 drivers/mtd/spi-nor/mtk-quadspi.c static ssize_t mtk_nor_write(struct spi_nor *nor, loff_t to, size_t len, nor 321 drivers/mtd/spi-nor/mtk-quadspi.c struct mtk_nor *mtk_nor = nor->priv; nor 357 drivers/mtd/spi-nor/mtk-quadspi.c static int mtk_nor_read_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len) nor 360 drivers/mtd/spi-nor/mtk-quadspi.c struct mtk_nor *mtk_nor = nor->priv; nor 379 drivers/mtd/spi-nor/mtk-quadspi.c static int mtk_nor_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, nor 383 drivers/mtd/spi-nor/mtk-quadspi.c struct mtk_nor *mtk_nor = nor->priv; nor 432 drivers/mtd/spi-nor/mtk-quadspi.c struct spi_nor *nor; nor 437 drivers/mtd/spi-nor/mtk-quadspi.c nor = &mtk_nor->nor; nor 438 drivers/mtd/spi-nor/mtk-quadspi.c nor->dev = mtk_nor->dev; nor 439 drivers/mtd/spi-nor/mtk-quadspi.c nor->priv = mtk_nor; nor 440 drivers/mtd/spi-nor/mtk-quadspi.c spi_nor_set_flash_node(nor, flash_node); nor 443 drivers/mtd/spi-nor/mtk-quadspi.c nor->read = mtk_nor_read; nor 444 drivers/mtd/spi-nor/mtk-quadspi.c nor->read_reg = mtk_nor_read_reg; nor 445 drivers/mtd/spi-nor/mtk-quadspi.c nor->write = mtk_nor_write; nor 446 drivers/mtd/spi-nor/mtk-quadspi.c nor->write_reg = mtk_nor_write_reg; nor 447 drivers/mtd/spi-nor/mtk-quadspi.c nor->mtd.name = "mtk_nor"; nor 449 drivers/mtd/spi-nor/mtk-quadspi.c ret = spi_nor_scan(nor, NULL, &hwcaps); nor 453 drivers/mtd/spi-nor/mtk-quadspi.c return mtd_device_register(&nor->mtd, NULL, 0); nor 59 drivers/mtd/spi-nor/nxp-spifi.c struct spi_nor nor; nor 126 drivers/mtd/spi-nor/nxp-spifi.c static int nxp_spifi_read_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len) nor 128 drivers/mtd/spi-nor/nxp-spifi.c struct nxp_spifi *spifi = nor->priv; nor 148 drivers/mtd/spi-nor/nxp-spifi.c static int nxp_spifi_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len) nor 150 drivers/mtd/spi-nor/nxp-spifi.c struct nxp_spifi *spifi = nor->priv; nor 171 drivers/mtd/spi-nor/nxp-spifi.c static ssize_t nxp_spifi_read(struct spi_nor *nor, loff_t from, size_t len, nor 174 drivers/mtd/spi-nor/nxp-spifi.c struct nxp_spifi *spifi = nor->priv; nor 186 drivers/mtd/spi-nor/nxp-spifi.c static ssize_t nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len, nor 189 drivers/mtd/spi-nor/nxp-spifi.c struct nxp_spifi *spifi = nor->priv; nor 203 drivers/mtd/spi-nor/nxp-spifi.c SPIFI_CMD_OPCODE(nor->program_opcode) | nor 204 drivers/mtd/spi-nor/nxp-spifi.c SPIFI_CMD_FRAMEFORM(spifi->nor.addr_width + 1); nor 217 drivers/mtd/spi-nor/nxp-spifi.c static int nxp_spifi_erase(struct spi_nor *nor, loff_t offs) nor 219 drivers/mtd/spi-nor/nxp-spifi.c struct nxp_spifi *spifi = nor->priv; nor 230 drivers/mtd/spi-nor/nxp-spifi.c SPIFI_CMD_OPCODE(nor->erase_opcode) | nor 231 drivers/mtd/spi-nor/nxp-spifi.c SPIFI_CMD_FRAMEFORM(spifi->nor.addr_width + 1); nor 239 drivers/mtd/spi-nor/nxp-spifi.c switch (spifi->nor.read_proto) { nor 253 drivers/mtd/spi-nor/nxp-spifi.c if (spifi->nor.addr_width < 1 || spifi->nor.addr_width > 4) nor 256 drivers/mtd/spi-nor/nxp-spifi.c spifi->mcmd |= SPIFI_CMD_OPCODE(spifi->nor.read_opcode) | nor 257 drivers/mtd/spi-nor/nxp-spifi.c SPIFI_CMD_INTLEN(spifi->nor.read_dummy / 8) | nor 258 drivers/mtd/spi-nor/nxp-spifi.c SPIFI_CMD_FRAMEFORM(spifi->nor.addr_width + 1); nor 263 drivers/mtd/spi-nor/nxp-spifi.c static void nxp_spifi_dummy_id_read(struct spi_nor *nor) nor 266 drivers/mtd/spi-nor/nxp-spifi.c nor->read_reg(nor, SPINOR_OP_RDID, id, SPI_NOR_MAX_ID_LEN); nor 332 drivers/mtd/spi-nor/nxp-spifi.c spifi->nor.dev = spifi->dev; nor 333 drivers/mtd/spi-nor/nxp-spifi.c spi_nor_set_flash_node(&spifi->nor, np); nor 334 drivers/mtd/spi-nor/nxp-spifi.c spifi->nor.priv = spifi; nor 335 drivers/mtd/spi-nor/nxp-spifi.c spifi->nor.read = nxp_spifi_read; nor 336 drivers/mtd/spi-nor/nxp-spifi.c spifi->nor.write = nxp_spifi_write; nor 337 drivers/mtd/spi-nor/nxp-spifi.c spifi->nor.erase = nxp_spifi_erase; nor 338 drivers/mtd/spi-nor/nxp-spifi.c spifi->nor.read_reg = nxp_spifi_read_reg; nor 339 drivers/mtd/spi-nor/nxp-spifi.c spifi->nor.write_reg = nxp_spifi_write_reg; nor 350 drivers/mtd/spi-nor/nxp-spifi.c nxp_spifi_dummy_id_read(&spifi->nor); nor 352 drivers/mtd/spi-nor/nxp-spifi.c ret = spi_nor_scan(&spifi->nor, NULL, &hwcaps); nor 364 drivers/mtd/spi-nor/nxp-spifi.c ret = mtd_device_register(&spifi->nor.mtd, NULL, 0); nor 454 drivers/mtd/spi-nor/nxp-spifi.c mtd_device_unregister(&spifi->nor.mtd); nor 171 drivers/mtd/spi-nor/spi-nor.c void (*default_init)(struct spi_nor *nor); nor 172 drivers/mtd/spi-nor/spi-nor.c int (*post_bfpt)(struct spi_nor *nor, nor 176 drivers/mtd/spi-nor/spi-nor.c void (*post_sfdp)(struct spi_nor *nor); nor 251 drivers/mtd/spi-nor/spi-nor.c static ssize_t spi_nor_spimem_xfer_data(struct spi_nor *nor, nor 268 drivers/mtd/spi-nor/spi-nor.c if (op->data.nbytes > nor->bouncebuf_size) nor 269 drivers/mtd/spi-nor/spi-nor.c op->data.nbytes = nor->bouncebuf_size; nor 273 drivers/mtd/spi-nor/spi-nor.c op->data.buf.in = nor->bouncebuf; nor 275 drivers/mtd/spi-nor/spi-nor.c op->data.buf.out = nor->bouncebuf; nor 276 drivers/mtd/spi-nor/spi-nor.c memcpy(nor->bouncebuf, buf, nor 281 drivers/mtd/spi-nor/spi-nor.c ret = spi_mem_adjust_op_size(nor->spimem, op); nor 285 drivers/mtd/spi-nor/spi-nor.c ret = spi_mem_exec_op(nor->spimem, op); nor 290 drivers/mtd/spi-nor/spi-nor.c memcpy(rdbuf, nor->bouncebuf, op->data.nbytes); nor 305 drivers/mtd/spi-nor/spi-nor.c static ssize_t spi_nor_spimem_read_data(struct spi_nor *nor, loff_t from, nor 309 drivers/mtd/spi-nor/spi-nor.c SPI_MEM_OP(SPI_MEM_OP_CMD(nor->read_opcode, 1), nor 310 drivers/mtd/spi-nor/spi-nor.c SPI_MEM_OP_ADDR(nor->addr_width, from, 1), nor 311 drivers/mtd/spi-nor/spi-nor.c SPI_MEM_OP_DUMMY(nor->read_dummy, 1), nor 315 drivers/mtd/spi-nor/spi-nor.c op.cmd.buswidth = spi_nor_get_protocol_inst_nbits(nor->read_proto); nor 316 drivers/mtd/spi-nor/spi-nor.c op.addr.buswidth = spi_nor_get_protocol_addr_nbits(nor->read_proto); nor 318 drivers/mtd/spi-nor/spi-nor.c op.data.buswidth = spi_nor_get_protocol_data_nbits(nor->read_proto); nor 321 drivers/mtd/spi-nor/spi-nor.c op.dummy.nbytes = (nor->read_dummy * op.dummy.buswidth) / 8; nor 323 drivers/mtd/spi-nor/spi-nor.c return spi_nor_spimem_xfer_data(nor, &op); nor 335 drivers/mtd/spi-nor/spi-nor.c static ssize_t spi_nor_read_data(struct spi_nor *nor, loff_t from, size_t len, nor 338 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) nor 339 drivers/mtd/spi-nor/spi-nor.c return spi_nor_spimem_read_data(nor, from, len, buf); nor 341 drivers/mtd/spi-nor/spi-nor.c return nor->read(nor, from, len, buf); nor 354 drivers/mtd/spi-nor/spi-nor.c static ssize_t spi_nor_spimem_write_data(struct spi_nor *nor, loff_t to, nor 358 drivers/mtd/spi-nor/spi-nor.c SPI_MEM_OP(SPI_MEM_OP_CMD(nor->program_opcode, 1), nor 359 drivers/mtd/spi-nor/spi-nor.c SPI_MEM_OP_ADDR(nor->addr_width, to, 1), nor 363 drivers/mtd/spi-nor/spi-nor.c op.cmd.buswidth = spi_nor_get_protocol_inst_nbits(nor->write_proto); nor 364 drivers/mtd/spi-nor/spi-nor.c op.addr.buswidth = spi_nor_get_protocol_addr_nbits(nor->write_proto); nor 365 drivers/mtd/spi-nor/spi-nor.c op.data.buswidth = spi_nor_get_protocol_data_nbits(nor->write_proto); nor 367 drivers/mtd/spi-nor/spi-nor.c if (nor->program_opcode == SPINOR_OP_AAI_WP && nor->sst_write_second) nor 370 drivers/mtd/spi-nor/spi-nor.c return spi_nor_spimem_xfer_data(nor, &op); nor 382 drivers/mtd/spi-nor/spi-nor.c static ssize_t spi_nor_write_data(struct spi_nor *nor, loff_t to, size_t len, nor 385 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) nor 386 drivers/mtd/spi-nor/spi-nor.c return spi_nor_spimem_write_data(nor, to, len, buf); nor 388 drivers/mtd/spi-nor/spi-nor.c return nor->write(nor, to, len, buf); nor 396 drivers/mtd/spi-nor/spi-nor.c static int read_sr(struct spi_nor *nor) nor 400 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) { nor 405 drivers/mtd/spi-nor/spi-nor.c SPI_MEM_OP_DATA_IN(1, nor->bouncebuf, 1)); nor 407 drivers/mtd/spi-nor/spi-nor.c ret = spi_mem_exec_op(nor->spimem, &op); nor 409 drivers/mtd/spi-nor/spi-nor.c ret = nor->read_reg(nor, SPINOR_OP_RDSR, nor->bouncebuf, 1); nor 417 drivers/mtd/spi-nor/spi-nor.c return nor->bouncebuf[0]; nor 425 drivers/mtd/spi-nor/spi-nor.c static int read_fsr(struct spi_nor *nor) nor 429 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) { nor 434 drivers/mtd/spi-nor/spi-nor.c SPI_MEM_OP_DATA_IN(1, nor->bouncebuf, 1)); nor 436 drivers/mtd/spi-nor/spi-nor.c ret = spi_mem_exec_op(nor->spimem, &op); nor 438 drivers/mtd/spi-nor/spi-nor.c ret = nor->read_reg(nor, SPINOR_OP_RDFSR, nor->bouncebuf, 1); nor 446 drivers/mtd/spi-nor/spi-nor.c return nor->bouncebuf[0]; nor 454 drivers/mtd/spi-nor/spi-nor.c static int read_cr(struct spi_nor *nor) nor 458 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) { nor 463 drivers/mtd/spi-nor/spi-nor.c SPI_MEM_OP_DATA_IN(1, nor->bouncebuf, 1)); nor 465 drivers/mtd/spi-nor/spi-nor.c ret = spi_mem_exec_op(nor->spimem, &op); nor 467 drivers/mtd/spi-nor/spi-nor.c ret = nor->read_reg(nor, SPINOR_OP_RDCR, nor->bouncebuf, 1); nor 471 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "error %d reading CR\n", ret); nor 475 drivers/mtd/spi-nor/spi-nor.c return nor->bouncebuf[0]; nor 482 drivers/mtd/spi-nor/spi-nor.c static int write_sr(struct spi_nor *nor, u8 val) nor 484 drivers/mtd/spi-nor/spi-nor.c nor->bouncebuf[0] = val; nor 485 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) { nor 490 drivers/mtd/spi-nor/spi-nor.c SPI_MEM_OP_DATA_OUT(1, nor->bouncebuf, 1)); nor 492 drivers/mtd/spi-nor/spi-nor.c return spi_mem_exec_op(nor->spimem, &op); nor 495 drivers/mtd/spi-nor/spi-nor.c return nor->write_reg(nor, SPINOR_OP_WRSR, nor->bouncebuf, 1); nor 502 drivers/mtd/spi-nor/spi-nor.c static int write_enable(struct spi_nor *nor) nor 504 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) { nor 511 drivers/mtd/spi-nor/spi-nor.c return spi_mem_exec_op(nor->spimem, &op); nor 514 drivers/mtd/spi-nor/spi-nor.c return nor->write_reg(nor, SPINOR_OP_WREN, NULL, 0); nor 520 drivers/mtd/spi-nor/spi-nor.c static int write_disable(struct spi_nor *nor) nor 522 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) { nor 529 drivers/mtd/spi-nor/spi-nor.c return spi_mem_exec_op(nor->spimem, &op); nor 532 drivers/mtd/spi-nor/spi-nor.c return nor->write_reg(nor, SPINOR_OP_WRDI, NULL, 0); nor 600 drivers/mtd/spi-nor/spi-nor.c static void spi_nor_set_4byte_opcodes(struct spi_nor *nor) nor 602 drivers/mtd/spi-nor/spi-nor.c nor->read_opcode = spi_nor_convert_3to4_read(nor->read_opcode); nor 603 drivers/mtd/spi-nor/spi-nor.c nor->program_opcode = spi_nor_convert_3to4_program(nor->program_opcode); nor 604 drivers/mtd/spi-nor/spi-nor.c nor->erase_opcode = spi_nor_convert_3to4_erase(nor->erase_opcode); nor 606 drivers/mtd/spi-nor/spi-nor.c if (!spi_nor_has_uniform_erase(nor)) { nor 607 drivers/mtd/spi-nor/spi-nor.c struct spi_nor_erase_map *map = &nor->params.erase_map; nor 619 drivers/mtd/spi-nor/spi-nor.c static int macronix_set_4byte(struct spi_nor *nor, bool enable) nor 621 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) { nor 631 drivers/mtd/spi-nor/spi-nor.c return spi_mem_exec_op(nor->spimem, &op); nor 634 drivers/mtd/spi-nor/spi-nor.c return nor->write_reg(nor, enable ? SPINOR_OP_EN4B : SPINOR_OP_EX4B, nor 638 drivers/mtd/spi-nor/spi-nor.c static int st_micron_set_4byte(struct spi_nor *nor, bool enable) nor 642 drivers/mtd/spi-nor/spi-nor.c write_enable(nor); nor 643 drivers/mtd/spi-nor/spi-nor.c ret = macronix_set_4byte(nor, enable); nor 644 drivers/mtd/spi-nor/spi-nor.c write_disable(nor); nor 649 drivers/mtd/spi-nor/spi-nor.c static int spansion_set_4byte(struct spi_nor *nor, bool enable) nor 651 drivers/mtd/spi-nor/spi-nor.c nor->bouncebuf[0] = enable << 7; nor 653 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) { nor 658 drivers/mtd/spi-nor/spi-nor.c SPI_MEM_OP_DATA_OUT(1, nor->bouncebuf, 1)); nor 660 drivers/mtd/spi-nor/spi-nor.c return spi_mem_exec_op(nor->spimem, &op); nor 663 drivers/mtd/spi-nor/spi-nor.c return nor->write_reg(nor, SPINOR_OP_BRWR, nor->bouncebuf, 1); nor 666 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_write_ear(struct spi_nor *nor, u8 ear) nor 668 drivers/mtd/spi-nor/spi-nor.c nor->bouncebuf[0] = ear; nor 670 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) { nor 675 drivers/mtd/spi-nor/spi-nor.c SPI_MEM_OP_DATA_OUT(1, nor->bouncebuf, 1)); nor 677 drivers/mtd/spi-nor/spi-nor.c return spi_mem_exec_op(nor->spimem, &op); nor 680 drivers/mtd/spi-nor/spi-nor.c return nor->write_reg(nor, SPINOR_OP_WREAR, nor->bouncebuf, 1); nor 683 drivers/mtd/spi-nor/spi-nor.c static int winbond_set_4byte(struct spi_nor *nor, bool enable) nor 687 drivers/mtd/spi-nor/spi-nor.c ret = macronix_set_4byte(nor, enable); nor 696 drivers/mtd/spi-nor/spi-nor.c write_enable(nor); nor 697 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_write_ear(nor, 0); nor 698 drivers/mtd/spi-nor/spi-nor.c write_disable(nor); nor 703 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_xread_sr(struct spi_nor *nor, u8 *sr) nor 705 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) { nor 712 drivers/mtd/spi-nor/spi-nor.c return spi_mem_exec_op(nor->spimem, &op); nor 715 drivers/mtd/spi-nor/spi-nor.c return nor->read_reg(nor, SPINOR_OP_XRDSR, sr, 1); nor 718 drivers/mtd/spi-nor/spi-nor.c static int s3an_sr_ready(struct spi_nor *nor) nor 722 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_xread_sr(nor, nor->bouncebuf); nor 724 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "error %d reading XRDSR\n", (int) ret); nor 728 drivers/mtd/spi-nor/spi-nor.c return !!(nor->bouncebuf[0] & XSR_RDY); nor 731 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_clear_sr(struct spi_nor *nor) nor 733 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) { nor 740 drivers/mtd/spi-nor/spi-nor.c return spi_mem_exec_op(nor->spimem, &op); nor 743 drivers/mtd/spi-nor/spi-nor.c return nor->write_reg(nor, SPINOR_OP_CLSR, NULL, 0); nor 746 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_sr_ready(struct spi_nor *nor) nor 748 drivers/mtd/spi-nor/spi-nor.c int sr = read_sr(nor); nor 752 drivers/mtd/spi-nor/spi-nor.c if (nor->flags & SNOR_F_USE_CLSR && sr & (SR_E_ERR | SR_P_ERR)) { nor 754 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "Erase Error occurred\n"); nor 756 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "Programming Error occurred\n"); nor 758 drivers/mtd/spi-nor/spi-nor.c spi_nor_clear_sr(nor); nor 765 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_clear_fsr(struct spi_nor *nor) nor 767 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) { nor 774 drivers/mtd/spi-nor/spi-nor.c return spi_mem_exec_op(nor->spimem, &op); nor 777 drivers/mtd/spi-nor/spi-nor.c return nor->write_reg(nor, SPINOR_OP_CLFSR, NULL, 0); nor 780 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_fsr_ready(struct spi_nor *nor) nor 782 drivers/mtd/spi-nor/spi-nor.c int fsr = read_fsr(nor); nor 788 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "Erase operation failed.\n"); nor 790 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "Program operation failed.\n"); nor 793 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, nor 796 drivers/mtd/spi-nor/spi-nor.c spi_nor_clear_fsr(nor); nor 803 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_ready(struct spi_nor *nor) nor 807 drivers/mtd/spi-nor/spi-nor.c if (nor->flags & SNOR_F_READY_XSR_RDY) nor 808 drivers/mtd/spi-nor/spi-nor.c sr = s3an_sr_ready(nor); nor 810 drivers/mtd/spi-nor/spi-nor.c sr = spi_nor_sr_ready(nor); nor 813 drivers/mtd/spi-nor/spi-nor.c fsr = nor->flags & SNOR_F_USE_FSR ? spi_nor_fsr_ready(nor) : 1; nor 823 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_wait_till_ready_with_timeout(struct spi_nor *nor, nor 835 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_ready(nor); nor 844 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "flash operation timed out\n"); nor 849 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_wait_till_ready(struct spi_nor *nor) nor 851 drivers/mtd/spi-nor/spi-nor.c return spi_nor_wait_till_ready_with_timeout(nor, nor 860 drivers/mtd/spi-nor/spi-nor.c static int erase_chip(struct spi_nor *nor) nor 862 drivers/mtd/spi-nor/spi-nor.c dev_dbg(nor->dev, " %lldKiB\n", (long long)(nor->mtd.size >> 10)); nor 864 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) { nor 871 drivers/mtd/spi-nor/spi-nor.c return spi_mem_exec_op(nor->spimem, &op); nor 874 drivers/mtd/spi-nor/spi-nor.c return nor->write_reg(nor, SPINOR_OP_CHIP_ERASE, NULL, 0); nor 877 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_lock_and_prep(struct spi_nor *nor, enum spi_nor_ops ops) nor 881 drivers/mtd/spi-nor/spi-nor.c mutex_lock(&nor->lock); nor 883 drivers/mtd/spi-nor/spi-nor.c if (nor->prepare) { nor 884 drivers/mtd/spi-nor/spi-nor.c ret = nor->prepare(nor, ops); nor 886 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "failed in the preparation.\n"); nor 887 drivers/mtd/spi-nor/spi-nor.c mutex_unlock(&nor->lock); nor 894 drivers/mtd/spi-nor/spi-nor.c static void spi_nor_unlock_and_unprep(struct spi_nor *nor, enum spi_nor_ops ops) nor 896 drivers/mtd/spi-nor/spi-nor.c if (nor->unprepare) nor 897 drivers/mtd/spi-nor/spi-nor.c nor->unprepare(nor, ops); nor 898 drivers/mtd/spi-nor/spi-nor.c mutex_unlock(&nor->lock); nor 910 drivers/mtd/spi-nor/spi-nor.c static u32 s3an_convert_addr(struct spi_nor *nor, u32 addr) nor 914 drivers/mtd/spi-nor/spi-nor.c offset = addr % nor->page_size; nor 915 drivers/mtd/spi-nor/spi-nor.c page = addr / nor->page_size; nor 916 drivers/mtd/spi-nor/spi-nor.c page <<= (nor->page_size > 512) ? 10 : 9; nor 921 drivers/mtd/spi-nor/spi-nor.c static u32 spi_nor_convert_addr(struct spi_nor *nor, loff_t addr) nor 923 drivers/mtd/spi-nor/spi-nor.c if (!nor->params.convert_addr) nor 926 drivers/mtd/spi-nor/spi-nor.c return nor->params.convert_addr(nor, addr); nor 932 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_erase_sector(struct spi_nor *nor, u32 addr) nor 936 drivers/mtd/spi-nor/spi-nor.c addr = spi_nor_convert_addr(nor, addr); nor 938 drivers/mtd/spi-nor/spi-nor.c if (nor->erase) nor 939 drivers/mtd/spi-nor/spi-nor.c return nor->erase(nor, addr); nor 941 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) { nor 943 drivers/mtd/spi-nor/spi-nor.c SPI_MEM_OP(SPI_MEM_OP_CMD(nor->erase_opcode, 1), nor 944 drivers/mtd/spi-nor/spi-nor.c SPI_MEM_OP_ADDR(nor->addr_width, addr, 1), nor 948 drivers/mtd/spi-nor/spi-nor.c return spi_mem_exec_op(nor->spimem, &op); nor 955 drivers/mtd/spi-nor/spi-nor.c for (i = nor->addr_width - 1; i >= 0; i--) { nor 956 drivers/mtd/spi-nor/spi-nor.c nor->bouncebuf[i] = addr & 0xff; nor 960 drivers/mtd/spi-nor/spi-nor.c return nor->write_reg(nor, nor->erase_opcode, nor->bouncebuf, nor 961 drivers/mtd/spi-nor/spi-nor.c nor->addr_width); nor 1132 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_init_erase_cmd_list(struct spi_nor *nor, nor 1136 drivers/mtd/spi-nor/spi-nor.c const struct spi_nor_erase_map *map = &nor->params.erase_map; nor 1198 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_erase_multi_sectors(struct spi_nor *nor, u64 addr, u32 len) nor 1204 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_init_erase_cmd_list(nor, &erase_list, addr, len); nor 1209 drivers/mtd/spi-nor/spi-nor.c nor->erase_opcode = cmd->opcode; nor 1211 drivers/mtd/spi-nor/spi-nor.c write_enable(nor); nor 1213 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_erase_sector(nor, addr); nor 1220 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_wait_till_ready(nor); nor 1241 drivers/mtd/spi-nor/spi-nor.c struct spi_nor *nor = mtd_to_spi_nor(mtd); nor 1246 drivers/mtd/spi-nor/spi-nor.c dev_dbg(nor->dev, "at 0x%llx, len %lld\n", (long long)instr->addr, nor 1249 drivers/mtd/spi-nor/spi-nor.c if (spi_nor_has_uniform_erase(nor)) { nor 1258 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_ERASE); nor 1263 drivers/mtd/spi-nor/spi-nor.c if (len == mtd->size && !(nor->flags & SNOR_F_NO_OP_CHIP_ERASE)) { nor 1266 drivers/mtd/spi-nor/spi-nor.c write_enable(nor); nor 1268 drivers/mtd/spi-nor/spi-nor.c if (erase_chip(nor)) { nor 1282 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_wait_till_ready_with_timeout(nor, timeout); nor 1292 drivers/mtd/spi-nor/spi-nor.c } else if (spi_nor_has_uniform_erase(nor)) { nor 1294 drivers/mtd/spi-nor/spi-nor.c write_enable(nor); nor 1296 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_erase_sector(nor, addr); nor 1303 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_wait_till_ready(nor); nor 1310 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_erase_multi_sectors(nor, addr, len); nor 1315 drivers/mtd/spi-nor/spi-nor.c write_disable(nor); nor 1318 drivers/mtd/spi-nor/spi-nor.c spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_ERASE); nor 1324 drivers/mtd/spi-nor/spi-nor.c static int write_sr_and_check(struct spi_nor *nor, u8 status_new, u8 mask) nor 1328 drivers/mtd/spi-nor/spi-nor.c write_enable(nor); nor 1329 drivers/mtd/spi-nor/spi-nor.c ret = write_sr(nor, status_new); nor 1333 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_wait_till_ready(nor); nor 1337 drivers/mtd/spi-nor/spi-nor.c ret = read_sr(nor); nor 1344 drivers/mtd/spi-nor/spi-nor.c static void stm_get_locked_range(struct spi_nor *nor, u8 sr, loff_t *ofs, nor 1347 drivers/mtd/spi-nor/spi-nor.c struct mtd_info *mtd = &nor->mtd; nor 1359 drivers/mtd/spi-nor/spi-nor.c if (nor->flags & SNOR_F_HAS_SR_TB && sr & SR_TB) nor 1370 drivers/mtd/spi-nor/spi-nor.c static int stm_check_lock_status_sr(struct spi_nor *nor, loff_t ofs, uint64_t len, nor 1379 drivers/mtd/spi-nor/spi-nor.c stm_get_locked_range(nor, sr, &lock_offs, &lock_len); nor 1389 drivers/mtd/spi-nor/spi-nor.c static int stm_is_locked_sr(struct spi_nor *nor, loff_t ofs, uint64_t len, nor 1392 drivers/mtd/spi-nor/spi-nor.c return stm_check_lock_status_sr(nor, ofs, len, sr, true); nor 1395 drivers/mtd/spi-nor/spi-nor.c static int stm_is_unlocked_sr(struct spi_nor *nor, loff_t ofs, uint64_t len, nor 1398 drivers/mtd/spi-nor/spi-nor.c return stm_check_lock_status_sr(nor, ofs, len, sr, false); nor 1433 drivers/mtd/spi-nor/spi-nor.c static int stm_lock(struct spi_nor *nor, loff_t ofs, uint64_t len) nor 1435 drivers/mtd/spi-nor/spi-nor.c struct mtd_info *mtd = &nor->mtd; nor 1440 drivers/mtd/spi-nor/spi-nor.c bool can_be_top = true, can_be_bottom = nor->flags & SNOR_F_HAS_SR_TB; nor 1443 drivers/mtd/spi-nor/spi-nor.c status_old = read_sr(nor); nor 1448 drivers/mtd/spi-nor/spi-nor.c if (stm_is_locked_sr(nor, ofs, len, status_old)) nor 1452 drivers/mtd/spi-nor/spi-nor.c if (!stm_is_locked_sr(nor, 0, ofs, status_old)) nor 1456 drivers/mtd/spi-nor/spi-nor.c if (!stm_is_locked_sr(nor, ofs + len, mtd->size - (ofs + len), nor 1505 drivers/mtd/spi-nor/spi-nor.c return write_sr_and_check(nor, status_new, mask); nor 1513 drivers/mtd/spi-nor/spi-nor.c static int stm_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len) nor 1515 drivers/mtd/spi-nor/spi-nor.c struct mtd_info *mtd = &nor->mtd; nor 1520 drivers/mtd/spi-nor/spi-nor.c bool can_be_top = true, can_be_bottom = nor->flags & SNOR_F_HAS_SR_TB; nor 1523 drivers/mtd/spi-nor/spi-nor.c status_old = read_sr(nor); nor 1528 drivers/mtd/spi-nor/spi-nor.c if (stm_is_unlocked_sr(nor, ofs, len, status_old)) nor 1532 drivers/mtd/spi-nor/spi-nor.c if (!stm_is_unlocked_sr(nor, 0, ofs, status_old)) nor 1536 drivers/mtd/spi-nor/spi-nor.c if (!stm_is_unlocked_sr(nor, ofs + len, mtd->size - (ofs + len), nor 1588 drivers/mtd/spi-nor/spi-nor.c return write_sr_and_check(nor, status_new, mask); nor 1598 drivers/mtd/spi-nor/spi-nor.c static int stm_is_locked(struct spi_nor *nor, loff_t ofs, uint64_t len) nor 1602 drivers/mtd/spi-nor/spi-nor.c status = read_sr(nor); nor 1606 drivers/mtd/spi-nor/spi-nor.c return stm_is_locked_sr(nor, ofs, len, status); nor 1617 drivers/mtd/spi-nor/spi-nor.c struct spi_nor *nor = mtd_to_spi_nor(mtd); nor 1620 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_LOCK); nor 1624 drivers/mtd/spi-nor/spi-nor.c ret = nor->params.locking_ops->lock(nor, ofs, len); nor 1626 drivers/mtd/spi-nor/spi-nor.c spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_UNLOCK); nor 1632 drivers/mtd/spi-nor/spi-nor.c struct spi_nor *nor = mtd_to_spi_nor(mtd); nor 1635 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_UNLOCK); nor 1639 drivers/mtd/spi-nor/spi-nor.c ret = nor->params.locking_ops->unlock(nor, ofs, len); nor 1641 drivers/mtd/spi-nor/spi-nor.c spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_LOCK); nor 1647 drivers/mtd/spi-nor/spi-nor.c struct spi_nor *nor = mtd_to_spi_nor(mtd); nor 1650 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_UNLOCK); nor 1654 drivers/mtd/spi-nor/spi-nor.c ret = nor->params.locking_ops->is_locked(nor, ofs, len); nor 1656 drivers/mtd/spi-nor/spi-nor.c spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_LOCK); nor 1666 drivers/mtd/spi-nor/spi-nor.c static int write_sr_cr(struct spi_nor *nor, u8 *sr_cr) nor 1670 drivers/mtd/spi-nor/spi-nor.c write_enable(nor); nor 1672 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) { nor 1679 drivers/mtd/spi-nor/spi-nor.c ret = spi_mem_exec_op(nor->spimem, &op); nor 1681 drivers/mtd/spi-nor/spi-nor.c ret = nor->write_reg(nor, SPINOR_OP_WRSR, sr_cr, 2); nor 1685 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, nor 1690 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_wait_till_ready(nor); nor 1692 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, nor 1710 drivers/mtd/spi-nor/spi-nor.c static int macronix_quad_enable(struct spi_nor *nor) nor 1714 drivers/mtd/spi-nor/spi-nor.c val = read_sr(nor); nor 1720 drivers/mtd/spi-nor/spi-nor.c write_enable(nor); nor 1722 drivers/mtd/spi-nor/spi-nor.c write_sr(nor, val | SR_QUAD_EN_MX); nor 1724 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_wait_till_ready(nor); nor 1728 drivers/mtd/spi-nor/spi-nor.c ret = read_sr(nor); nor 1730 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "Macronix Quad bit not set\n"); nor 1760 drivers/mtd/spi-nor/spi-nor.c static int spansion_quad_enable(struct spi_nor *nor) nor 1762 drivers/mtd/spi-nor/spi-nor.c u8 *sr_cr = nor->bouncebuf; nor 1767 drivers/mtd/spi-nor/spi-nor.c ret = write_sr_cr(nor, sr_cr); nor 1772 drivers/mtd/spi-nor/spi-nor.c ret = read_cr(nor); nor 1774 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "Spansion Quad bit not set\n"); nor 1794 drivers/mtd/spi-nor/spi-nor.c static int spansion_no_read_cr_quad_enable(struct spi_nor *nor) nor 1796 drivers/mtd/spi-nor/spi-nor.c u8 *sr_cr = nor->bouncebuf; nor 1800 drivers/mtd/spi-nor/spi-nor.c ret = read_sr(nor); nor 1802 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "error while reading status register\n"); nor 1808 drivers/mtd/spi-nor/spi-nor.c return write_sr_cr(nor, sr_cr); nor 1824 drivers/mtd/spi-nor/spi-nor.c static int spansion_read_cr_quad_enable(struct spi_nor *nor) nor 1826 drivers/mtd/spi-nor/spi-nor.c struct device *dev = nor->dev; nor 1827 drivers/mtd/spi-nor/spi-nor.c u8 *sr_cr = nor->bouncebuf; nor 1831 drivers/mtd/spi-nor/spi-nor.c ret = read_cr(nor); nor 1843 drivers/mtd/spi-nor/spi-nor.c ret = read_sr(nor); nor 1850 drivers/mtd/spi-nor/spi-nor.c ret = write_sr_cr(nor, sr_cr); nor 1855 drivers/mtd/spi-nor/spi-nor.c ret = read_cr(nor); nor 1857 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "Spansion Quad bit not set\n"); nor 1864 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_write_sr2(struct spi_nor *nor, u8 *sr2) nor 1866 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) { nor 1873 drivers/mtd/spi-nor/spi-nor.c return spi_mem_exec_op(nor->spimem, &op); nor 1876 drivers/mtd/spi-nor/spi-nor.c return nor->write_reg(nor, SPINOR_OP_WRSR2, sr2, 1); nor 1879 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_read_sr2(struct spi_nor *nor, u8 *sr2) nor 1881 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) { nor 1888 drivers/mtd/spi-nor/spi-nor.c return spi_mem_exec_op(nor->spimem, &op); nor 1891 drivers/mtd/spi-nor/spi-nor.c return nor->read_reg(nor, SPINOR_OP_RDSR2, sr2, 1); nor 1906 drivers/mtd/spi-nor/spi-nor.c static int sr2_bit7_quad_enable(struct spi_nor *nor) nor 1908 drivers/mtd/spi-nor/spi-nor.c u8 *sr2 = nor->bouncebuf; nor 1912 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_read_sr2(nor, sr2); nor 1921 drivers/mtd/spi-nor/spi-nor.c write_enable(nor); nor 1923 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_write_sr2(nor, sr2); nor 1925 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "error while writing status register 2\n"); nor 1929 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_wait_till_ready(nor); nor 1931 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "timeout while writing status register 2\n"); nor 1936 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_read_sr2(nor, sr2); nor 1938 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "SR2 Quad bit not set\n"); nor 1954 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_clear_sr_bp(struct spi_nor *nor) nor 1959 drivers/mtd/spi-nor/spi-nor.c ret = read_sr(nor); nor 1961 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "error while reading status register\n"); nor 1965 drivers/mtd/spi-nor/spi-nor.c write_enable(nor); nor 1967 drivers/mtd/spi-nor/spi-nor.c ret = write_sr(nor, ret & ~mask); nor 1969 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "write to status register failed\n"); nor 1973 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_wait_till_ready(nor); nor 1975 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "timeout while writing status register\n"); nor 1992 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_spansion_clear_sr_bp(struct spi_nor *nor) nor 1996 drivers/mtd/spi-nor/spi-nor.c u8 *sr_cr = nor->bouncebuf; nor 1999 drivers/mtd/spi-nor/spi-nor.c ret = read_cr(nor); nor 2001 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, nor 2013 drivers/mtd/spi-nor/spi-nor.c ret = read_sr(nor); nor 2015 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, nor 2021 drivers/mtd/spi-nor/spi-nor.c ret = write_sr_cr(nor, sr_cr); nor 2023 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "16-bit write register failed\n"); nor 2031 drivers/mtd/spi-nor/spi-nor.c return spi_nor_clear_sr_bp(nor); nor 2085 drivers/mtd/spi-nor/spi-nor.c is25lp256_post_bfpt_fixups(struct spi_nor *nor, nor 2097 drivers/mtd/spi-nor/spi-nor.c nor->addr_width = 4; nor 2107 drivers/mtd/spi-nor/spi-nor.c mx25l25635_post_bfpt_fixups(struct spi_nor *nor, nor 2122 drivers/mtd/spi-nor/spi-nor.c nor->flags |= SNOR_F_4B_OPCODES; nor 2131 drivers/mtd/spi-nor/spi-nor.c static void gd25q256_default_init(struct spi_nor *nor) nor 2139 drivers/mtd/spi-nor/spi-nor.c nor->params.quad_enable = macronix_quad_enable; nor 2509 drivers/mtd/spi-nor/spi-nor.c static const struct flash_info *spi_nor_read_id(struct spi_nor *nor) nor 2512 drivers/mtd/spi-nor/spi-nor.c u8 *id = nor->bouncebuf; nor 2515 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) { nor 2522 drivers/mtd/spi-nor/spi-nor.c tmp = spi_mem_exec_op(nor->spimem, &op); nor 2524 drivers/mtd/spi-nor/spi-nor.c tmp = nor->read_reg(nor, SPINOR_OP_RDID, id, nor 2528 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "error %d reading JEDEC ID\n", tmp); nor 2539 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "unrecognized JEDEC id bytes: %*ph\n", nor 2547 drivers/mtd/spi-nor/spi-nor.c struct spi_nor *nor = mtd_to_spi_nor(mtd); nor 2550 drivers/mtd/spi-nor/spi-nor.c dev_dbg(nor->dev, "from 0x%08x, len %zd\n", (u32)from, len); nor 2552 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_READ); nor 2559 drivers/mtd/spi-nor/spi-nor.c addr = spi_nor_convert_addr(nor, addr); nor 2561 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_read_data(nor, addr, len, buf); nor 2579 drivers/mtd/spi-nor/spi-nor.c spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ); nor 2586 drivers/mtd/spi-nor/spi-nor.c struct spi_nor *nor = mtd_to_spi_nor(mtd); nor 2590 drivers/mtd/spi-nor/spi-nor.c dev_dbg(nor->dev, "to 0x%08x, len %zd\n", (u32)to, len); nor 2592 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_WRITE); nor 2596 drivers/mtd/spi-nor/spi-nor.c write_enable(nor); nor 2598 drivers/mtd/spi-nor/spi-nor.c nor->sst_write_second = false; nor 2603 drivers/mtd/spi-nor/spi-nor.c nor->program_opcode = SPINOR_OP_BP; nor 2606 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_write_data(nor, to, 1, buf); nor 2611 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_wait_till_ready(nor); nor 2619 drivers/mtd/spi-nor/spi-nor.c nor->program_opcode = SPINOR_OP_AAI_WP; nor 2622 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_write_data(nor, to, 2, buf + actual); nor 2627 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_wait_till_ready(nor); nor 2631 drivers/mtd/spi-nor/spi-nor.c nor->sst_write_second = true; nor 2633 drivers/mtd/spi-nor/spi-nor.c nor->sst_write_second = false; nor 2635 drivers/mtd/spi-nor/spi-nor.c write_disable(nor); nor 2636 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_wait_till_ready(nor); nor 2642 drivers/mtd/spi-nor/spi-nor.c write_enable(nor); nor 2644 drivers/mtd/spi-nor/spi-nor.c nor->program_opcode = SPINOR_OP_BP; nor 2645 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_write_data(nor, to, 1, buf + actual); nor 2650 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_wait_till_ready(nor); nor 2653 drivers/mtd/spi-nor/spi-nor.c write_disable(nor); nor 2658 drivers/mtd/spi-nor/spi-nor.c spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE); nor 2670 drivers/mtd/spi-nor/spi-nor.c struct spi_nor *nor = mtd_to_spi_nor(mtd); nor 2674 drivers/mtd/spi-nor/spi-nor.c dev_dbg(nor->dev, "to 0x%08x, len %zd\n", (u32)to, len); nor 2676 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_WRITE); nor 2692 drivers/mtd/spi-nor/spi-nor.c if (hweight32(nor->page_size) == 1) { nor 2693 drivers/mtd/spi-nor/spi-nor.c page_offset = addr & (nor->page_size - 1); nor 2697 drivers/mtd/spi-nor/spi-nor.c page_offset = do_div(aux, nor->page_size); nor 2701 drivers/mtd/spi-nor/spi-nor.c nor->page_size - page_offset, len - i); nor 2703 drivers/mtd/spi-nor/spi-nor.c addr = spi_nor_convert_addr(nor, addr); nor 2705 drivers/mtd/spi-nor/spi-nor.c write_enable(nor); nor 2706 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_write_data(nor, addr, page_remain, buf + i); nor 2711 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_wait_till_ready(nor); nor 2719 drivers/mtd/spi-nor/spi-nor.c spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE); nor 2723 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_check(struct spi_nor *nor) nor 2725 drivers/mtd/spi-nor/spi-nor.c if (!nor->dev || nor 2726 drivers/mtd/spi-nor/spi-nor.c (!nor->spimem && nor 2727 drivers/mtd/spi-nor/spi-nor.c (!nor->read || !nor->write || !nor->read_reg || nor 2728 drivers/mtd/spi-nor/spi-nor.c !nor->write_reg))) { nor 2736 drivers/mtd/spi-nor/spi-nor.c static int s3an_nor_setup(struct spi_nor *nor, nor 2741 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_xread_sr(nor, nor->bouncebuf); nor 2743 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "error %d reading XRDSR\n", (int) ret); nor 2747 drivers/mtd/spi-nor/spi-nor.c nor->erase_opcode = SPINOR_OP_XSE; nor 2748 drivers/mtd/spi-nor/spi-nor.c nor->program_opcode = SPINOR_OP_XPP; nor 2749 drivers/mtd/spi-nor/spi-nor.c nor->read_opcode = SPINOR_OP_READ; nor 2750 drivers/mtd/spi-nor/spi-nor.c nor->flags |= SNOR_F_NO_OP_CHIP_ERASE; nor 2763 drivers/mtd/spi-nor/spi-nor.c if (nor->bouncebuf[0] & XSR_PAGESIZE) { nor 2765 drivers/mtd/spi-nor/spi-nor.c nor->page_size = (nor->page_size == 264) ? 256 : 512; nor 2766 drivers/mtd/spi-nor/spi-nor.c nor->mtd.writebufsize = nor->page_size; nor 2767 drivers/mtd/spi-nor/spi-nor.c nor->mtd.size = 8 * nor->page_size * nor->info->n_sectors; nor 2768 drivers/mtd/spi-nor/spi-nor.c nor->mtd.erasesize = 8 * nor->page_size; nor 2771 drivers/mtd/spi-nor/spi-nor.c nor->params.convert_addr = s3an_convert_addr; nor 2772 drivers/mtd/spi-nor/spi-nor.c nor->mtd.erasesize = nor->info->sector_size; nor 2867 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_read_raw(struct spi_nor *nor, u32 addr, size_t len, u8 *buf) nor 2872 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_read_data(nor, addr, len, buf); nor 2898 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_read_sfdp(struct spi_nor *nor, u32 addr, nor 2904 drivers/mtd/spi-nor/spi-nor.c read_opcode = nor->read_opcode; nor 2905 drivers/mtd/spi-nor/spi-nor.c addr_width = nor->addr_width; nor 2906 drivers/mtd/spi-nor/spi-nor.c read_dummy = nor->read_dummy; nor 2908 drivers/mtd/spi-nor/spi-nor.c nor->read_opcode = SPINOR_OP_RDSFDP; nor 2909 drivers/mtd/spi-nor/spi-nor.c nor->addr_width = 3; nor 2910 drivers/mtd/spi-nor/spi-nor.c nor->read_dummy = 8; nor 2912 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_read_raw(nor, addr, len, buf); nor 2914 drivers/mtd/spi-nor/spi-nor.c nor->read_opcode = read_opcode; nor 2915 drivers/mtd/spi-nor/spi-nor.c nor->addr_width = addr_width; nor 2916 drivers/mtd/spi-nor/spi-nor.c nor->read_dummy = read_dummy; nor 2929 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_spimem_check_op(struct spi_nor *nor, nor 2939 drivers/mtd/spi-nor/spi-nor.c if (!spi_mem_supports_op(nor->spimem, op)) { nor 2940 drivers/mtd/spi-nor/spi-nor.c if (nor->mtd.size > SZ_16M) nor 2945 drivers/mtd/spi-nor/spi-nor.c if (!spi_mem_supports_op(nor->spimem, op)) nor 2960 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_spimem_check_readop(struct spi_nor *nor, nor 2975 drivers/mtd/spi-nor/spi-nor.c return spi_nor_spimem_check_op(nor, &op); nor 2986 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_spimem_check_pp(struct spi_nor *nor, nor 2998 drivers/mtd/spi-nor/spi-nor.c return spi_nor_spimem_check_op(nor, &op); nor 3009 drivers/mtd/spi-nor/spi-nor.c spi_nor_spimem_adjust_hwcaps(struct spi_nor *nor, u32 *hwcaps) nor 3011 drivers/mtd/spi-nor/spi-nor.c struct spi_nor_flash_parameter *params = &nor->params; nor 3028 drivers/mtd/spi-nor/spi-nor.c spi_nor_spimem_check_readop(nor, ¶ms->reads[rdidx])) nor 3035 drivers/mtd/spi-nor/spi-nor.c if (spi_nor_spimem_check_pp(nor, nor 3054 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_read_sfdp_dma_unsafe(struct spi_nor *nor, u32 addr, nor 3064 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_read_sfdp(nor, addr, len, dma_safe_buf); nor 3313 drivers/mtd/spi-nor/spi-nor.c spi_nor_post_bfpt_fixups(struct spi_nor *nor, nor 3318 drivers/mtd/spi-nor/spi-nor.c if (nor->info->fixups && nor->info->fixups->post_bfpt) nor 3319 drivers/mtd/spi-nor/spi-nor.c return nor->info->fixups->post_bfpt(nor, bfpt_header, bfpt, nor 3355 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_parse_bfpt(struct spi_nor *nor, nor 3377 drivers/mtd/spi-nor/spi-nor.c err = spi_nor_read_sfdp_dma_unsafe(nor, addr, len, &bfpt); nor 3388 drivers/mtd/spi-nor/spi-nor.c nor->addr_width = 3; nor 3392 drivers/mtd/spi-nor/spi-nor.c nor->addr_width = 4; nor 3477 drivers/mtd/spi-nor/spi-nor.c return spi_nor_post_bfpt_fixups(nor, bfpt_header, &bfpt, nor 3513 drivers/mtd/spi-nor/spi-nor.c return spi_nor_post_bfpt_fixups(nor, bfpt_header, &bfpt, params); nor 3568 drivers/mtd/spi-nor/spi-nor.c static u8 spi_nor_smpt_addr_width(const struct spi_nor *nor, const u32 settings) nor 3580 drivers/mtd/spi-nor/spi-nor.c return nor->addr_width; nor 3592 drivers/mtd/spi-nor/spi-nor.c static u8 spi_nor_smpt_read_dummy(const struct spi_nor *nor, const u32 settings) nor 3597 drivers/mtd/spi-nor/spi-nor.c return nor->read_dummy; nor 3609 drivers/mtd/spi-nor/spi-nor.c static const u32 *spi_nor_get_map_in_use(struct spi_nor *nor, const u32 *smpt, nor 3625 drivers/mtd/spi-nor/spi-nor.c addr_width = nor->addr_width; nor 3626 drivers/mtd/spi-nor/spi-nor.c read_dummy = nor->read_dummy; nor 3627 drivers/mtd/spi-nor/spi-nor.c read_opcode = nor->read_opcode; nor 3636 drivers/mtd/spi-nor/spi-nor.c nor->addr_width = spi_nor_smpt_addr_width(nor, smpt[i]); nor 3637 drivers/mtd/spi-nor/spi-nor.c nor->read_dummy = spi_nor_smpt_read_dummy(nor, smpt[i]); nor 3638 drivers/mtd/spi-nor/spi-nor.c nor->read_opcode = SMPT_CMD_OPCODE(smpt[i]); nor 3641 drivers/mtd/spi-nor/spi-nor.c err = spi_nor_read_raw(nor, addr, 1, buf); nor 3683 drivers/mtd/spi-nor/spi-nor.c nor->addr_width = addr_width; nor 3684 drivers/mtd/spi-nor/spi-nor.c nor->read_dummy = read_dummy; nor 3685 drivers/mtd/spi-nor/spi-nor.c nor->read_opcode = read_opcode; nor 3722 drivers/mtd/spi-nor/spi-nor.c spi_nor_init_non_uniform_erase_map(struct spi_nor *nor, nor 3740 drivers/mtd/spi-nor/spi-nor.c region = devm_kcalloc(nor->dev, region_count, sizeof(*region), nor 3814 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_parse_smpt(struct spi_nor *nor, nor 3831 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_read_sfdp(nor, addr, len, smpt); nor 3839 drivers/mtd/spi-nor/spi-nor.c sector_map = spi_nor_get_map_in_use(nor, smpt, smpt_header->length); nor 3845 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_init_non_uniform_erase_map(nor, params, sector_map); nor 3878 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_parse_4bait(struct spi_nor *nor, nor 3925 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_read_sfdp(nor, addr, len, dwords); nor 4032 drivers/mtd/spi-nor/spi-nor.c nor->addr_width = 4; nor 4033 drivers/mtd/spi-nor/spi-nor.c nor->flags |= SNOR_F_4B_OPCODES | SNOR_F_HAS_4BAIT; nor 4055 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_parse_sfdp(struct spi_nor *nor, nor 4061 drivers/mtd/spi-nor/spi-nor.c struct device *dev = nor->dev; nor 4066 drivers/mtd/spi-nor/spi-nor.c err = spi_nor_read_sfdp_dma_unsafe(nor, 0, sizeof(header), &header); nor 4102 drivers/mtd/spi-nor/spi-nor.c err = spi_nor_read_sfdp(nor, sizeof(header), nor 4125 drivers/mtd/spi-nor/spi-nor.c err = spi_nor_parse_bfpt(nor, bfpt_header, params); nor 4135 drivers/mtd/spi-nor/spi-nor.c err = spi_nor_parse_smpt(nor, param_header, params); nor 4139 drivers/mtd/spi-nor/spi-nor.c err = spi_nor_parse_4bait(nor, param_header, params); nor 4164 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_select_read(struct spi_nor *nor, nor 4177 drivers/mtd/spi-nor/spi-nor.c read = &nor->params.reads[cmd]; nor 4178 drivers/mtd/spi-nor/spi-nor.c nor->read_opcode = read->opcode; nor 4179 drivers/mtd/spi-nor/spi-nor.c nor->read_proto = read->proto; nor 4191 drivers/mtd/spi-nor/spi-nor.c nor->read_dummy = read->num_mode_clocks + read->num_wait_states; nor 4195 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_select_pp(struct spi_nor *nor, nor 4208 drivers/mtd/spi-nor/spi-nor.c pp = &nor->params.page_programs[cmd]; nor 4209 drivers/mtd/spi-nor/spi-nor.c nor->program_opcode = pp->opcode; nor 4210 drivers/mtd/spi-nor/spi-nor.c nor->write_proto = pp->proto; nor 4267 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_select_erase(struct spi_nor *nor) nor 4269 drivers/mtd/spi-nor/spi-nor.c struct spi_nor_erase_map *map = &nor->params.erase_map; nor 4271 drivers/mtd/spi-nor/spi-nor.c struct mtd_info *mtd = &nor->mtd; nor 4272 drivers/mtd/spi-nor/spi-nor.c u32 wanted_size = nor->info->sector_size; nor 4288 drivers/mtd/spi-nor/spi-nor.c if (spi_nor_has_uniform_erase(nor)) { nor 4292 drivers/mtd/spi-nor/spi-nor.c nor->erase_opcode = erase->opcode; nor 4315 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_default_setup(struct spi_nor *nor, nor 4318 drivers/mtd/spi-nor/spi-nor.c struct spi_nor_flash_parameter *params = &nor->params; nor 4328 drivers/mtd/spi-nor/spi-nor.c if (nor->spimem) { nor 4334 drivers/mtd/spi-nor/spi-nor.c spi_nor_spimem_adjust_hwcaps(nor, &shared_mask); nor 4343 drivers/mtd/spi-nor/spi-nor.c dev_dbg(nor->dev, nor 4350 drivers/mtd/spi-nor/spi-nor.c err = spi_nor_select_read(nor, shared_mask); nor 4352 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, nor 4358 drivers/mtd/spi-nor/spi-nor.c err = spi_nor_select_pp(nor, shared_mask); nor 4360 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, nor 4366 drivers/mtd/spi-nor/spi-nor.c err = spi_nor_select_erase(nor); nor 4368 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, nor 4376 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_setup(struct spi_nor *nor, nor 4379 drivers/mtd/spi-nor/spi-nor.c if (!nor->params.setup) nor 4382 drivers/mtd/spi-nor/spi-nor.c return nor->params.setup(nor, hwcaps); nor 4385 drivers/mtd/spi-nor/spi-nor.c static void macronix_set_default_init(struct spi_nor *nor) nor 4387 drivers/mtd/spi-nor/spi-nor.c nor->params.quad_enable = macronix_quad_enable; nor 4388 drivers/mtd/spi-nor/spi-nor.c nor->params.set_4byte = macronix_set_4byte; nor 4391 drivers/mtd/spi-nor/spi-nor.c static void st_micron_set_default_init(struct spi_nor *nor) nor 4393 drivers/mtd/spi-nor/spi-nor.c nor->flags |= SNOR_F_HAS_LOCK; nor 4394 drivers/mtd/spi-nor/spi-nor.c nor->params.quad_enable = NULL; nor 4395 drivers/mtd/spi-nor/spi-nor.c nor->params.set_4byte = st_micron_set_4byte; nor 4398 drivers/mtd/spi-nor/spi-nor.c static void winbond_set_default_init(struct spi_nor *nor) nor 4400 drivers/mtd/spi-nor/spi-nor.c nor->params.set_4byte = winbond_set_4byte; nor 4408 drivers/mtd/spi-nor/spi-nor.c static void spi_nor_manufacturer_init_params(struct spi_nor *nor) nor 4411 drivers/mtd/spi-nor/spi-nor.c switch (JEDEC_MFR(nor->info)) { nor 4413 drivers/mtd/spi-nor/spi-nor.c macronix_set_default_init(nor); nor 4418 drivers/mtd/spi-nor/spi-nor.c st_micron_set_default_init(nor); nor 4422 drivers/mtd/spi-nor/spi-nor.c winbond_set_default_init(nor); nor 4429 drivers/mtd/spi-nor/spi-nor.c if (nor->info->fixups && nor->info->fixups->default_init) nor 4430 drivers/mtd/spi-nor/spi-nor.c nor->info->fixups->default_init(nor); nor 4441 drivers/mtd/spi-nor/spi-nor.c static void spi_nor_sfdp_init_params(struct spi_nor *nor) nor 4445 drivers/mtd/spi-nor/spi-nor.c memcpy(&sfdp_params, &nor->params, sizeof(sfdp_params)); nor 4447 drivers/mtd/spi-nor/spi-nor.c if (spi_nor_parse_sfdp(nor, &sfdp_params)) { nor 4448 drivers/mtd/spi-nor/spi-nor.c nor->addr_width = 0; nor 4449 drivers/mtd/spi-nor/spi-nor.c nor->flags &= ~SNOR_F_4B_OPCODES; nor 4451 drivers/mtd/spi-nor/spi-nor.c memcpy(&nor->params, &sfdp_params, sizeof(nor->params)); nor 4460 drivers/mtd/spi-nor/spi-nor.c static void spi_nor_info_init_params(struct spi_nor *nor) nor 4462 drivers/mtd/spi-nor/spi-nor.c struct spi_nor_flash_parameter *params = &nor->params; nor 4464 drivers/mtd/spi-nor/spi-nor.c const struct flash_info *info = nor->info; nor 4465 drivers/mtd/spi-nor/spi-nor.c struct device_node *np = spi_nor_get_flash_node(nor); nor 4546 drivers/mtd/spi-nor/spi-nor.c static void spansion_post_sfdp_fixups(struct spi_nor *nor) nor 4548 drivers/mtd/spi-nor/spi-nor.c if (nor->params.size <= SZ_16M) nor 4551 drivers/mtd/spi-nor/spi-nor.c nor->flags |= SNOR_F_4B_OPCODES; nor 4553 drivers/mtd/spi-nor/spi-nor.c nor->erase_opcode = SPINOR_OP_SE; nor 4554 drivers/mtd/spi-nor/spi-nor.c nor->mtd.erasesize = nor->info->sector_size; nor 4557 drivers/mtd/spi-nor/spi-nor.c static void s3an_post_sfdp_fixups(struct spi_nor *nor) nor 4559 drivers/mtd/spi-nor/spi-nor.c nor->params.setup = s3an_nor_setup; nor 4572 drivers/mtd/spi-nor/spi-nor.c static void spi_nor_post_sfdp_fixups(struct spi_nor *nor) nor 4574 drivers/mtd/spi-nor/spi-nor.c switch (JEDEC_MFR(nor->info)) { nor 4576 drivers/mtd/spi-nor/spi-nor.c spansion_post_sfdp_fixups(nor); nor 4583 drivers/mtd/spi-nor/spi-nor.c if (nor->info->flags & SPI_S3AN) nor 4584 drivers/mtd/spi-nor/spi-nor.c s3an_post_sfdp_fixups(nor); nor 4586 drivers/mtd/spi-nor/spi-nor.c if (nor->info->fixups && nor->info->fixups->post_sfdp) nor 4587 drivers/mtd/spi-nor/spi-nor.c nor->info->fixups->post_sfdp(nor); nor 4597 drivers/mtd/spi-nor/spi-nor.c static void spi_nor_late_init_params(struct spi_nor *nor) nor 4603 drivers/mtd/spi-nor/spi-nor.c if (nor->flags & SNOR_F_HAS_LOCK && !nor->params.locking_ops) nor 4604 drivers/mtd/spi-nor/spi-nor.c nor->params.locking_ops = &stm_locking_ops; nor 4644 drivers/mtd/spi-nor/spi-nor.c static void spi_nor_init_params(struct spi_nor *nor) nor 4646 drivers/mtd/spi-nor/spi-nor.c spi_nor_info_init_params(nor); nor 4648 drivers/mtd/spi-nor/spi-nor.c spi_nor_manufacturer_init_params(nor); nor 4650 drivers/mtd/spi-nor/spi-nor.c if ((nor->info->flags & (SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ)) && nor 4651 drivers/mtd/spi-nor/spi-nor.c !(nor->info->flags & SPI_NOR_SKIP_SFDP)) nor 4652 drivers/mtd/spi-nor/spi-nor.c spi_nor_sfdp_init_params(nor); nor 4654 drivers/mtd/spi-nor/spi-nor.c spi_nor_post_sfdp_fixups(nor); nor 4656 drivers/mtd/spi-nor/spi-nor.c spi_nor_late_init_params(nor); nor 4665 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_quad_enable(struct spi_nor *nor) nor 4667 drivers/mtd/spi-nor/spi-nor.c if (!nor->params.quad_enable) nor 4670 drivers/mtd/spi-nor/spi-nor.c if (!(spi_nor_get_protocol_width(nor->read_proto) == 4 || nor 4671 drivers/mtd/spi-nor/spi-nor.c spi_nor_get_protocol_width(nor->write_proto) == 4)) nor 4674 drivers/mtd/spi-nor/spi-nor.c return nor->params.quad_enable(nor); nor 4677 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_init(struct spi_nor *nor) nor 4681 drivers/mtd/spi-nor/spi-nor.c if (nor->clear_sr_bp) { nor 4682 drivers/mtd/spi-nor/spi-nor.c if (nor->params.quad_enable == spansion_quad_enable) nor 4683 drivers/mtd/spi-nor/spi-nor.c nor->clear_sr_bp = spi_nor_spansion_clear_sr_bp; nor 4685 drivers/mtd/spi-nor/spi-nor.c err = nor->clear_sr_bp(nor); nor 4687 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, nor 4693 drivers/mtd/spi-nor/spi-nor.c err = spi_nor_quad_enable(nor); nor 4695 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "quad mode not supported\n"); nor 4699 drivers/mtd/spi-nor/spi-nor.c if (nor->addr_width == 4 && !(nor->flags & SNOR_F_4B_OPCODES)) { nor 4707 drivers/mtd/spi-nor/spi-nor.c WARN_ONCE(nor->flags & SNOR_F_BROKEN_RESET, nor 4709 drivers/mtd/spi-nor/spi-nor.c nor->params.set_4byte(nor, true); nor 4718 drivers/mtd/spi-nor/spi-nor.c struct spi_nor *nor = mtd_to_spi_nor(mtd); nor 4719 drivers/mtd/spi-nor/spi-nor.c struct device *dev = nor->dev; nor 4723 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_init(nor); nor 4728 drivers/mtd/spi-nor/spi-nor.c void spi_nor_restore(struct spi_nor *nor) nor 4731 drivers/mtd/spi-nor/spi-nor.c if (nor->addr_width == 4 && !(nor->flags & SNOR_F_4B_OPCODES) && nor 4732 drivers/mtd/spi-nor/spi-nor.c nor->flags & SNOR_F_BROKEN_RESET) nor 4733 drivers/mtd/spi-nor/spi-nor.c nor->params.set_4byte(nor, false); nor 4749 drivers/mtd/spi-nor/spi-nor.c static int spi_nor_set_addr_width(struct spi_nor *nor) nor 4751 drivers/mtd/spi-nor/spi-nor.c if (nor->addr_width) { nor 4753 drivers/mtd/spi-nor/spi-nor.c } else if (nor->info->addr_width) { nor 4754 drivers/mtd/spi-nor/spi-nor.c nor->addr_width = nor->info->addr_width; nor 4755 drivers/mtd/spi-nor/spi-nor.c } else if (nor->mtd.size > 0x1000000) { nor 4757 drivers/mtd/spi-nor/spi-nor.c nor->addr_width = 4; nor 4759 drivers/mtd/spi-nor/spi-nor.c nor->addr_width = 3; nor 4762 drivers/mtd/spi-nor/spi-nor.c if (nor->addr_width > SPI_NOR_MAX_ADDR_WIDTH) { nor 4763 drivers/mtd/spi-nor/spi-nor.c dev_err(nor->dev, "address width is too large: %u\n", nor 4764 drivers/mtd/spi-nor/spi-nor.c nor->addr_width); nor 4769 drivers/mtd/spi-nor/spi-nor.c if (nor->addr_width == 4 && nor->flags & SNOR_F_4B_OPCODES && nor 4770 drivers/mtd/spi-nor/spi-nor.c !(nor->flags & SNOR_F_HAS_4BAIT)) nor 4771 drivers/mtd/spi-nor/spi-nor.c spi_nor_set_4byte_opcodes(nor); nor 4776 drivers/mtd/spi-nor/spi-nor.c static void spi_nor_debugfs_init(struct spi_nor *nor, nor 4779 drivers/mtd/spi-nor/spi-nor.c struct mtd_info *mtd = &nor->mtd; nor 4782 drivers/mtd/spi-nor/spi-nor.c mtd->dbg.partid = devm_kasprintf(nor->dev, GFP_KERNEL, "spi-nor:%*phN", nor 4786 drivers/mtd/spi-nor/spi-nor.c static const struct flash_info *spi_nor_get_flash_info(struct spi_nor *nor, nor 4795 drivers/mtd/spi-nor/spi-nor.c info = spi_nor_read_id(nor); nor 4806 drivers/mtd/spi-nor/spi-nor.c jinfo = spi_nor_read_id(nor); nor 4817 drivers/mtd/spi-nor/spi-nor.c dev_warn(nor->dev, "found %s, expected %s\n", nor 4826 drivers/mtd/spi-nor/spi-nor.c int spi_nor_scan(struct spi_nor *nor, const char *name, nor 4830 drivers/mtd/spi-nor/spi-nor.c struct device *dev = nor->dev; nor 4831 drivers/mtd/spi-nor/spi-nor.c struct mtd_info *mtd = &nor->mtd; nor 4832 drivers/mtd/spi-nor/spi-nor.c struct device_node *np = spi_nor_get_flash_node(nor); nor 4833 drivers/mtd/spi-nor/spi-nor.c struct spi_nor_flash_parameter *params = &nor->params; nor 4837 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_check(nor); nor 4842 drivers/mtd/spi-nor/spi-nor.c nor->reg_proto = SNOR_PROTO_1_1_1; nor 4843 drivers/mtd/spi-nor/spi-nor.c nor->read_proto = SNOR_PROTO_1_1_1; nor 4844 drivers/mtd/spi-nor/spi-nor.c nor->write_proto = SNOR_PROTO_1_1_1; nor 4854 drivers/mtd/spi-nor/spi-nor.c nor->bouncebuf_size = PAGE_SIZE; nor 4855 drivers/mtd/spi-nor/spi-nor.c nor->bouncebuf = devm_kmalloc(dev, nor->bouncebuf_size, nor 4857 drivers/mtd/spi-nor/spi-nor.c if (!nor->bouncebuf) nor 4860 drivers/mtd/spi-nor/spi-nor.c info = spi_nor_get_flash_info(nor, name); nor 4864 drivers/mtd/spi-nor/spi-nor.c nor->info = info; nor 4866 drivers/mtd/spi-nor/spi-nor.c spi_nor_debugfs_init(nor, info); nor 4868 drivers/mtd/spi-nor/spi-nor.c mutex_init(&nor->lock); nor 4876 drivers/mtd/spi-nor/spi-nor.c nor->flags |= SNOR_F_READY_XSR_RDY; nor 4879 drivers/mtd/spi-nor/spi-nor.c nor->flags |= SNOR_F_HAS_LOCK; nor 4885 drivers/mtd/spi-nor/spi-nor.c if (JEDEC_MFR(nor->info) == SNOR_MFR_ATMEL || nor 4886 drivers/mtd/spi-nor/spi-nor.c JEDEC_MFR(nor->info) == SNOR_MFR_INTEL || nor 4887 drivers/mtd/spi-nor/spi-nor.c JEDEC_MFR(nor->info) == SNOR_MFR_SST || nor 4888 drivers/mtd/spi-nor/spi-nor.c nor->info->flags & SPI_NOR_HAS_LOCK) nor 4889 drivers/mtd/spi-nor/spi-nor.c nor->clear_sr_bp = spi_nor_clear_sr_bp; nor 4892 drivers/mtd/spi-nor/spi-nor.c spi_nor_init_params(nor); nor 4896 drivers/mtd/spi-nor/spi-nor.c mtd->priv = nor; nor 4905 drivers/mtd/spi-nor/spi-nor.c if (nor->params.locking_ops) { nor 4918 drivers/mtd/spi-nor/spi-nor.c nor->flags |= SNOR_F_USE_FSR; nor 4920 drivers/mtd/spi-nor/spi-nor.c nor->flags |= SNOR_F_HAS_SR_TB; nor 4922 drivers/mtd/spi-nor/spi-nor.c nor->flags |= SNOR_F_NO_OP_CHIP_ERASE; nor 4924 drivers/mtd/spi-nor/spi-nor.c nor->flags |= SNOR_F_USE_CLSR; nor 4930 drivers/mtd/spi-nor/spi-nor.c nor->page_size = params->page_size; nor 4931 drivers/mtd/spi-nor/spi-nor.c mtd->writebufsize = nor->page_size; nor 4934 drivers/mtd/spi-nor/spi-nor.c nor->flags |= SNOR_F_BROKEN_RESET; nor 4942 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_setup(nor, hwcaps); nor 4947 drivers/mtd/spi-nor/spi-nor.c nor->flags |= SNOR_F_4B_OPCODES; nor 4949 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_set_addr_width(nor); nor 4954 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_init(nor); nor 4985 drivers/mtd/spi-nor/spi-nor.c struct spi_nor *nor; nor 4994 drivers/mtd/spi-nor/spi-nor.c nor = devm_kzalloc(&spi->dev, sizeof(*nor), GFP_KERNEL); nor 4995 drivers/mtd/spi-nor/spi-nor.c if (!nor) nor 4998 drivers/mtd/spi-nor/spi-nor.c nor->spimem = spimem; nor 4999 drivers/mtd/spi-nor/spi-nor.c nor->dev = &spi->dev; nor 5000 drivers/mtd/spi-nor/spi-nor.c spi_nor_set_flash_node(nor, spi->dev.of_node); nor 5002 drivers/mtd/spi-nor/spi-nor.c spi_mem_set_drvdata(spimem, nor); nor 5005 drivers/mtd/spi-nor/spi-nor.c nor->mtd.name = data->name; nor 5007 drivers/mtd/spi-nor/spi-nor.c if (!nor->mtd.name) nor 5008 drivers/mtd/spi-nor/spi-nor.c nor->mtd.name = spi_mem_get_name(spimem); nor 5023 drivers/mtd/spi-nor/spi-nor.c ret = spi_nor_scan(nor, flash_name, &hwcaps); nor 5032 drivers/mtd/spi-nor/spi-nor.c if (nor->page_size > PAGE_SIZE) { nor 5033 drivers/mtd/spi-nor/spi-nor.c nor->bouncebuf_size = nor->page_size; nor 5034 drivers/mtd/spi-nor/spi-nor.c devm_kfree(nor->dev, nor->bouncebuf); nor 5035 drivers/mtd/spi-nor/spi-nor.c nor->bouncebuf = devm_kmalloc(nor->dev, nor 5036 drivers/mtd/spi-nor/spi-nor.c nor->bouncebuf_size, nor 5038 drivers/mtd/spi-nor/spi-nor.c if (!nor->bouncebuf) nor 5042 drivers/mtd/spi-nor/spi-nor.c return mtd_device_register(&nor->mtd, data ? data->parts : NULL, nor 5048 drivers/mtd/spi-nor/spi-nor.c struct spi_nor *nor = spi_mem_get_drvdata(spimem); nor 5050 drivers/mtd/spi-nor/spi-nor.c spi_nor_restore(nor); nor 5053 drivers/mtd/spi-nor/spi-nor.c return mtd_device_unregister(&nor->mtd); nor 5058 drivers/mtd/spi-nor/spi-nor.c struct spi_nor *nor = spi_mem_get_drvdata(spimem); nor 5060 drivers/mtd/spi-nor/spi-nor.c spi_nor_restore(nor); nor 1545 drivers/pinctrl/actions/pinctrl-s700.c [S700_MUX_NOR] = FUNCTION(nor), nor 492 drivers/pinctrl/bcm/pinctrl-ns2-mux.c NS2_PIN_FUNCTION(nor), nor 961 drivers/pinctrl/meson/pinctrl-meson-axg.c FUNCTION(nor), nor 1254 drivers/pinctrl/meson/pinctrl-meson-g12a.c FUNCTION(nor), nor 771 drivers/pinctrl/meson/pinctrl-meson-gxbb.c FUNCTION(nor), nor 743 drivers/pinctrl/meson/pinctrl-meson-gxl.c FUNCTION(nor), nor 1042 drivers/pinctrl/meson/pinctrl-meson8.c FUNCTION(nor), nor 887 drivers/pinctrl/meson/pinctrl-meson8b.c FUNCTION(nor), nor 475 include/linux/mtd/spi-nor.h int (*lock)(struct spi_nor *nor, loff_t ofs, uint64_t len); nor 476 include/linux/mtd/spi-nor.h int (*unlock)(struct spi_nor *nor, loff_t ofs, uint64_t len); nor 477 include/linux/mtd/spi-nor.h int (*is_locked)(struct spi_nor *nor, loff_t ofs, uint64_t len); nor 517 include/linux/mtd/spi-nor.h int (*quad_enable)(struct spi_nor *nor); nor 518 include/linux/mtd/spi-nor.h int (*set_4byte)(struct spi_nor *nor, bool enable); nor 519 include/linux/mtd/spi-nor.h u32 (*convert_addr)(struct spi_nor *nor, u32 addr); nor 520 include/linux/mtd/spi-nor.h int (*setup)(struct spi_nor *nor, const struct spi_nor_hwcaps *hwcaps); nor 591 include/linux/mtd/spi-nor.h int (*prepare)(struct spi_nor *nor, enum spi_nor_ops ops); nor 592 include/linux/mtd/spi-nor.h void (*unprepare)(struct spi_nor *nor, enum spi_nor_ops ops); nor 593 include/linux/mtd/spi-nor.h int (*read_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len); nor 594 include/linux/mtd/spi-nor.h int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len); nor 596 include/linux/mtd/spi-nor.h ssize_t (*read)(struct spi_nor *nor, loff_t from, nor 598 include/linux/mtd/spi-nor.h ssize_t (*write)(struct spi_nor *nor, loff_t to, nor 600 include/linux/mtd/spi-nor.h int (*erase)(struct spi_nor *nor, loff_t offs); nor 602 include/linux/mtd/spi-nor.h int (*clear_sr_bp)(struct spi_nor *nor); nor 632 include/linux/mtd/spi-nor.h static bool __maybe_unused spi_nor_has_uniform_erase(const struct spi_nor *nor) nor 634 include/linux/mtd/spi-nor.h return !!nor->params.erase_map.uniform_erase_type; nor 637 include/linux/mtd/spi-nor.h static inline void spi_nor_set_flash_node(struct spi_nor *nor, nor 640 include/linux/mtd/spi-nor.h mtd_set_of_node(&nor->mtd, np); nor 643 include/linux/mtd/spi-nor.h static inline struct device_node *spi_nor_get_flash_node(struct spi_nor *nor) nor 645 include/linux/mtd/spi-nor.h return mtd_get_of_node(&nor->mtd); nor 662 include/linux/mtd/spi-nor.h int spi_nor_scan(struct spi_nor *nor, const char *name, nor 669 include/linux/mtd/spi-nor.h void spi_nor_restore(struct spi_nor *nor);