linux/drivers/mtd/nand/spi/core.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2016-2017 Micron Technology, Inc.
 *
 * Authors:
 *	Peter Pan <[email protected]>
 *	Boris Brezillon <[email protected]>
 */

#define pr_fmt(fmt)

#include <linux/device.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mtd/spinand.h>
#include <linux/of.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi-mem.h>

static int spinand_read_reg_op(struct spinand_device *spinand, u8 reg, u8 *val)
{}

static int spinand_write_reg_op(struct spinand_device *spinand, u8 reg, u8 val)
{}

static int spinand_read_status(struct spinand_device *spinand, u8 *status)
{}

static int spinand_get_cfg(struct spinand_device *spinand, u8 *cfg)
{}

static int spinand_set_cfg(struct spinand_device *spinand, u8 cfg)
{}

/**
 * spinand_upd_cfg() - Update the configuration register
 * @spinand: the spinand device
 * @mask: the mask encoding the bits to update in the config reg
 * @val: the new value to apply
 *
 * Update the configuration register.
 *
 * Return: 0 on success, a negative error code otherwise.
 */
int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val)
{}

/**
 * spinand_select_target() - Select a specific NAND target/die
 * @spinand: the spinand device
 * @target: the target/die to select
 *
 * Select a new target/die. If chip only has one die, this function is a NOOP.
 *
 * Return: 0 on success, a negative error code otherwise.
 */
int spinand_select_target(struct spinand_device *spinand, unsigned int target)
{}

static int spinand_read_cfg(struct spinand_device *spinand)
{}

static int spinand_init_cfg_cache(struct spinand_device *spinand)
{}

static int spinand_init_quad_enable(struct spinand_device *spinand)
{}

static int spinand_ecc_enable(struct spinand_device *spinand,
			      bool enable)
{}

static int spinand_check_ecc_status(struct spinand_device *spinand, u8 status)
{}

static int spinand_noecc_ooblayout_ecc(struct mtd_info *mtd, int section,
				       struct mtd_oob_region *region)
{}

static int spinand_noecc_ooblayout_free(struct mtd_info *mtd, int section,
					struct mtd_oob_region *region)
{}

static const struct mtd_ooblayout_ops spinand_noecc_ooblayout =;

static int spinand_ondie_ecc_init_ctx(struct nand_device *nand)
{}

static void spinand_ondie_ecc_cleanup_ctx(struct nand_device *nand)
{}

static int spinand_ondie_ecc_prepare_io_req(struct nand_device *nand,
					    struct nand_page_io_req *req)
{}

static int spinand_ondie_ecc_finish_io_req(struct nand_device *nand,
					   struct nand_page_io_req *req)
{}

static struct nand_ecc_engine_ops spinand_ondie_ecc_engine_ops =;

static struct nand_ecc_engine spinand_ondie_ecc_engine =;

static void spinand_ondie_ecc_save_status(struct nand_device *nand, u8 status)
{}

static int spinand_write_enable_op(struct spinand_device *spinand)
{}

static int spinand_load_page_op(struct spinand_device *spinand,
				const struct nand_page_io_req *req)
{}

static int spinand_read_from_cache_op(struct spinand_device *spinand,
				      const struct nand_page_io_req *req)
{}

static int spinand_write_to_cache_op(struct spinand_device *spinand,
				     const struct nand_page_io_req *req)
{}

static int spinand_program_op(struct spinand_device *spinand,
			      const struct nand_page_io_req *req)
{}

static int spinand_erase_op(struct spinand_device *spinand,
			    const struct nand_pos *pos)
{}

static int spinand_wait(struct spinand_device *spinand,
			unsigned long initial_delay_us,
			unsigned long poll_delay_us,
			u8 *s)
{}

static int spinand_read_id_op(struct spinand_device *spinand, u8 naddr,
			      u8 ndummy, u8 *buf)
{}

static int spinand_reset_op(struct spinand_device *spinand)
{}

static int spinand_lock_block(struct spinand_device *spinand, u8 lock)
{}

static int spinand_read_page(struct spinand_device *spinand,
			     const struct nand_page_io_req *req)
{}

static int spinand_write_page(struct spinand_device *spinand,
			      const struct nand_page_io_req *req)
{}

static int spinand_mtd_read(struct mtd_info *mtd, loff_t from,
			    struct mtd_oob_ops *ops)
{}

static int spinand_mtd_write(struct mtd_info *mtd, loff_t to,
			     struct mtd_oob_ops *ops)
{}

static bool spinand_isbad(struct nand_device *nand, const struct nand_pos *pos)
{}

static int spinand_mtd_block_isbad(struct mtd_info *mtd, loff_t offs)
{}

static int spinand_markbad(struct nand_device *nand, const struct nand_pos *pos)
{}

static int spinand_mtd_block_markbad(struct mtd_info *mtd, loff_t offs)
{}

static int spinand_erase(struct nand_device *nand, const struct nand_pos *pos)
{}

static int spinand_mtd_erase(struct mtd_info *mtd,
			     struct erase_info *einfo)
{}

static int spinand_mtd_block_isreserved(struct mtd_info *mtd, loff_t offs)
{}

static int spinand_create_dirmap(struct spinand_device *spinand,
				 unsigned int plane)
{}

static int spinand_create_dirmaps(struct spinand_device *spinand)
{}

static const struct nand_ops spinand_ops =;

static const struct spinand_manufacturer *spinand_manufacturers[] =;

static int spinand_manufacturer_match(struct spinand_device *spinand,
				      enum spinand_readid_method rdid_method)
{}

static int spinand_id_detect(struct spinand_device *spinand)
{}

static int spinand_manufacturer_init(struct spinand_device *spinand)
{}

static void spinand_manufacturer_cleanup(struct spinand_device *spinand)
{}

static const struct spi_mem_op *
spinand_select_op_variant(struct spinand_device *spinand,
			  const struct spinand_op_variants *variants)
{}

/**
 * spinand_match_and_init() - Try to find a match between a device ID and an
 *			      entry in a spinand_info table
 * @spinand: SPI NAND object
 * @table: SPI NAND device description table
 * @table_size: size of the device description table
 * @rdid_method: read id method to match
 *
 * Match between a device ID retrieved through the READ_ID command and an
 * entry in the SPI NAND description table. If a match is found, the spinand
 * object will be initialized with information provided by the matching
 * spinand_info entry.
 *
 * Return: 0 on success, a negative error code otherwise.
 */
int spinand_match_and_init(struct spinand_device *spinand,
			   const struct spinand_info *table,
			   unsigned int table_size,
			   enum spinand_readid_method rdid_method)
{}

static int spinand_detect(struct spinand_device *spinand)
{}

static int spinand_init_flash(struct spinand_device *spinand)
{}

static void spinand_mtd_resume(struct mtd_info *mtd)
{}

static int spinand_init(struct spinand_device *spinand)
{}

static void spinand_cleanup(struct spinand_device *spinand)
{}

static int spinand_probe(struct spi_mem *mem)
{}

static int spinand_remove(struct spi_mem *mem)
{}

static const struct spi_device_id spinand_ids[] =;
MODULE_DEVICE_TABLE(spi, spinand_ids);

#ifdef CONFIG_OF
static const struct of_device_id spinand_of_ids[] =;
MODULE_DEVICE_TABLE(of, spinand_of_ids);
#endif

static struct spi_mem_driver spinand_drv =;
module_spi_mem_driver();

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();