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.
15 #include <linux/mtd/nand.h>
17 #include <linux/spi/spi-mem.h>
20 * Standard SPI NAND flash operations
144 * Standard SPI NAND flash commands
197 * struct spinand_id - SPI NAND id structure
204 int len;
214 * struct spinand_devid - SPI NAND device id structure
222 * read_id opcode + 1-byte address.
233 * struct manufacurer_ops - SPI NAND manufacturer specific operations
234 * @init: initialize a SPI NAND device
235 * @cleanup: cleanup a SPI NAND device
237 * Each SPI NAND manufacturer driver should implement this interface so that
238 * NAND chips coming from this vendor can be initialized properly.
241 int (*init)(struct spinand_device *spinand);
246 * struct spinand_manufacturer - SPI NAND manufacturer instance
262 /* SPI NAND manufacturers */
273 * struct spinand_op_variants - SPI NAND operation variants
277 * Some operations like read-from-cache/write-to-cache have several variants
285 unsigned int nops;
296 * spinand_ecc_info - description of the on-die ECC implemented by a SPI NAND
300 * -EBADMSG if there are uncorrectable errors. I can also return
303 * @ooblayout: the OOB layout used by the on-die ECC implementation
306 int (*get_status)(struct spinand_device *spinand, u8 status);
314 * struct spinand_ondie_ecc_conf - private SPI-NAND on-die ECC engine structure
316 * ->get_status() is not populated by the spinand device.
323 * struct spinand_info - Structure used to describe SPI NAND chips
326 * @flags: OR-ing of the SPINAND_XXX flags
329 * @eccinfo: on-die ECC info
331 * @op_variants.read_cache: variants of the read-cache operation
332 * @op_variants.write_cache: variants of the write-cache operation
333 * @op_variants.update_cache: variants of the update-cache operation
335 * multi-die chips
337 * Each SPI NAND manufacturer driver should have a spinand_info table
352 int (*select_target)(struct spinand_device *spinand,
353 unsigned int target);
399 * struct spinand_device - SPI NAND device instance
400 * @base: NAND device instance
402 * @lock: lock used to serialize accesses to the NAND
403 * @id: NAND ID as returned by READ_ID
404 * @flags: NAND flags
413 * @eccinfo: on-die ECC information
418 * because the spi-mem interface explicitly requests that buffers
419 * passed in spi_mem_op be DMA-able, so we can't based the bufs on
421 * @manufacturer: SPI NAND manufacturer information
425 struct nand_device base; member
439 int (*select_target)(struct spinand_device *spinand,
440 unsigned int target);
441 unsigned int cur_target;
454 * mtd_to_spinand() - Get the SPI NAND device attached to an MTD instance
457 * Return: the SPI NAND device attached to @mtd.
461 return container_of(mtd_to_nanddev(mtd), struct spinand_device, base); in mtd_to_spinand()
465 * spinand_to_mtd() - Get the MTD device embedded in a SPI NAND device
466 * @spinand: SPI NAND device
472 return nanddev_to_mtd(&spinand->base); in spinand_to_mtd()
476 * nand_to_spinand() - Get the SPI NAND device embedding an NAND object
477 * @nand: NAND object
479 * Return: the SPI NAND device embedding @nand.
481 static inline struct spinand_device *nand_to_spinand(struct nand_device *nand) in nand_to_spinand() argument
483 return container_of(nand, struct spinand_device, base); in nand_to_spinand()
487 * spinand_to_nand() - Get the NAND device embedded in a SPI NAND object
488 * @spinand: SPI NAND device
490 * Return: the NAND device embedded in @spinand.
495 return &spinand->base; in spinand_to_nand()
499 * spinand_set_of_node - Attach a DT node to a SPI NAND device
500 * @spinand: SPI NAND device
503 * Attach a DT node to a SPI NAND device.
508 nanddev_set_of_node(&spinand->base, np); in spinand_set_of_node()
511 int spinand_match_and_init(struct spinand_device *spinand,
513 unsigned int table_size,
516 int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val);
517 int spinand_select_target(struct spinand_device *spinand, unsigned int target);