Lines Matching full:nor
3 * SPI NOR driver for NXP SPI Flash Interface (SPIFI)
18 #include <linux/mtd/spi-nor.h>
58 struct spi_nor nor; member
125 static int nxp_spifi_read_reg(struct spi_nor *nor, u8 opcode, u8 *buf, in nxp_spifi_read_reg() argument
128 struct nxp_spifi *spifi = nor->priv; in nxp_spifi_read_reg()
148 static int nxp_spifi_write_reg(struct spi_nor *nor, u8 opcode, const u8 *buf, in nxp_spifi_write_reg() argument
151 struct nxp_spifi *spifi = nor->priv; in nxp_spifi_write_reg()
172 static ssize_t nxp_spifi_read(struct spi_nor *nor, loff_t from, size_t len, in nxp_spifi_read() argument
175 struct nxp_spifi *spifi = nor->priv; in nxp_spifi_read()
187 static ssize_t nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len, in nxp_spifi_write() argument
190 struct nxp_spifi *spifi = nor->priv; in nxp_spifi_write()
204 SPIFI_CMD_OPCODE(nor->program_opcode) | in nxp_spifi_write()
205 SPIFI_CMD_FRAMEFORM(spifi->nor.addr_nbytes + 1); in nxp_spifi_write()
218 static int nxp_spifi_erase(struct spi_nor *nor, loff_t offs) in nxp_spifi_erase() argument
220 struct nxp_spifi *spifi = nor->priv; in nxp_spifi_erase()
231 SPIFI_CMD_OPCODE(nor->erase_opcode) | in nxp_spifi_erase()
232 SPIFI_CMD_FRAMEFORM(spifi->nor.addr_nbytes + 1); in nxp_spifi_erase()
240 switch (spifi->nor.read_proto) { in nxp_spifi_setup_memory_cmd()
254 if (spifi->nor.addr_nbytes < 1 || spifi->nor.addr_nbytes > 4) in nxp_spifi_setup_memory_cmd()
257 spifi->mcmd |= SPIFI_CMD_OPCODE(spifi->nor.read_opcode) | in nxp_spifi_setup_memory_cmd()
258 SPIFI_CMD_INTLEN(spifi->nor.read_dummy / 8) | in nxp_spifi_setup_memory_cmd()
259 SPIFI_CMD_FRAMEFORM(spifi->nor.addr_nbytes + 1); in nxp_spifi_setup_memory_cmd()
264 static void nxp_spifi_dummy_id_read(struct spi_nor *nor) in nxp_spifi_dummy_id_read() argument
267 nor->controller_ops->read_reg(nor, SPINOR_OP_RDID, id, in nxp_spifi_dummy_id_read()
342 spifi->nor.dev = spifi->dev; in nxp_spifi_setup_flash()
343 spi_nor_set_flash_node(&spifi->nor, np); in nxp_spifi_setup_flash()
344 spifi->nor.priv = spifi; in nxp_spifi_setup_flash()
345 spifi->nor.controller_ops = &nxp_spifi_controller_ops; in nxp_spifi_setup_flash()
356 nxp_spifi_dummy_id_read(&spifi->nor); in nxp_spifi_setup_flash()
358 ret = spi_nor_scan(&spifi->nor, NULL, &hwcaps); in nxp_spifi_setup_flash()
370 ret = mtd_device_register(&spifi->nor.mtd, NULL, 0); in nxp_spifi_setup_flash()
438 mtd_device_unregister(&spifi->nor.mtd); in nxp_spifi_remove()