Lines Matching +full:nand +full:- +full:int +full:- +full:base

1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2016-2017 Micron Technology, Inc.
16 #include <linux/mtd/nand.h>
18 #include <linux/spi/spi-mem.h>
22 #include <spi-mem.h>
23 #include <linux/mtd/nand.h>
27 * Standard SPI NAND flash operations
121 * Standard SPI NAND flash commands
152 * struct spinand_id - SPI NAND id structure
157 * struct_spinand_id->data contains all bytes returned after a READ_ID command,
160 * struct_manufacurer_ops->detect().
164 int len;
168 * struct manufacurer_ops - SPI NAND manufacturer specific operations
169 * @detect: detect a SPI NAND device. Every time a SPI NAND device is probed
170 * the core calls the struct_manufacurer_ops->detect() hook of each
173 * in struct_spinand_device->id matches the manufacturer whose
174 * ->detect() hook has been called. Should return 1 if there's a
177 * that properties of the NAND chip (spinand->base.memorg and
178 * spinand->base.eccreq) have been filled
179 * @init: initialize a SPI NAND device
180 * @cleanup: cleanup a SPI NAND device
182 * Each SPI NAND manufacturer driver should implement this interface so that
183 * NAND chips coming from this vendor can be detected and initialized properly.
186 int (*detect)(struct spinand_device *spinand);
187 int (*init)(struct spinand_device *spinand);
192 * struct spinand_manufacturer - SPI NAND manufacturer instance
203 /* SPI NAND manufacturers */
210 * struct spinand_op_variants - SPI NAND operation variants
214 * Some operations like read-from-cache/write-to-cache have several variants
222 unsigned int nops;
233 * spinand_ecc_info - description of the on-die ECC implemented by a SPI NAND
237 * -EBADMSG if there are uncorrectable errors. I can also return
240 * @ooblayout: the OOB layout used by the on-die ECC implementation
243 int (*get_status)(struct spinand_device *spinand, u8 status);
250 * struct spinand_info - Structure used to describe SPI NAND chips
253 * @flags: OR-ing of the SPINAND_XXX flags
256 * @eccinfo: on-die ECC info
258 * @op_variants.read_cache: variants of the read-cache operation
259 * @op_variants.write_cache: variants of the write-cache operation
260 * @op_variants.update_cache: variants of the update-cache operation
262 * multi-die chips
264 * Each SPI NAND manufacturer driver should have a spinand_info table
279 int (*select_target)(struct spinand_device *spinand,
280 unsigned int target);
312 * struct spinand_device - SPI NAND device instance
313 * @base: NAND device instance
315 * @lock: lock used to serialize accesses to the NAND
316 * @id: NAND ID as returned by READ_ID
317 * @flags: NAND flags
326 * @eccinfo: on-die ECC information
331 * because the spi-mem interface explicitly requests that buffers
332 * passed in spi_mem_op be DMA-able, so we can't based the bufs on
334 * @manufacturer: SPI NAND manufacturer information
338 struct nand_device base; member
354 int (*select_target)(struct spinand_device *spinand,
355 unsigned int target);
356 unsigned int cur_target;
369 * mtd_to_spinand() - Get the SPI NAND device attached to an MTD instance
372 * Return: the SPI NAND device attached to @mtd.
376 return container_of(mtd_to_nanddev(mtd), struct spinand_device, base); in mtd_to_spinand()
380 * spinand_to_mtd() - Get the MTD device embedded in a SPI NAND device
381 * @spinand: SPI NAND device
387 return nanddev_to_mtd(&spinand->base); in spinand_to_mtd()
391 * nand_to_spinand() - Get the SPI NAND device embedding an NAND object
392 * @nand: NAND object
394 * Return: the SPI NAND device embedding @nand.
396 static inline struct spinand_device *nand_to_spinand(struct nand_device *nand) in nand_to_spinand() argument
398 return container_of(nand, struct spinand_device, base); in nand_to_spinand()
402 * spinand_to_nand() - Get the NAND device embedded in a SPI NAND object
403 * @spinand: SPI NAND device
405 * Return: the NAND device embedded in @spinand.
410 return &spinand->base; in spinand_to_nand()
414 * spinand_set_of_node - Attach a DT node to a SPI NAND device
415 * @spinand: SPI NAND device
418 * Attach a DT node to a SPI NAND device.
423 nanddev_set_of_node(&spinand->base, np); in spinand_set_of_node()
426 int spinand_match_and_init(struct spinand_device *dev,
428 unsigned int table_size, u8 devid);
430 int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val);
431 int spinand_select_target(struct spinand_device *spinand, unsigned int target);