linux/drivers/mtd/nand/raw/meson_nand.c

// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Amlogic Meson Nand Flash Controller Driver
 *
 * Copyright (c) 2018 Amlogic, inc.
 * Author: Liang Yang <[email protected]>
 */

#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/interrupt.h>
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/mtd/rawnand.h>
#include <linux/mtd/mtd.h>
#include <linux/mfd/syscon.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/iopoll.h>
#include <linux/of.h>
#include <linux/sched/task_stack.h>

#define NFC_REG_CMD
#define NFC_CMD_IDLE
#define NFC_CMD_CLE
#define NFC_CMD_ALE
#define NFC_CMD_ADL
#define NFC_CMD_ADH
#define NFC_CMD_AIL
#define NFC_CMD_AIH
#define NFC_CMD_SEED
#define NFC_CMD_M2N
#define NFC_CMD_N2M
#define NFC_CMD_RB
#define NFC_CMD_SCRAMBLER_ENABLE
#define NFC_CMD_SCRAMBLER_DISABLE
#define NFC_CMD_SHORTMODE_ENABLE
#define NFC_CMD_SHORTMODE_DISABLE
#define NFC_CMD_RB_INT
#define NFC_CMD_RB_INT_NO_PIN

#define NFC_CMD_GET_SIZE(x)

#define NFC_REG_CFG
#define NFC_REG_DADR
#define NFC_REG_IADR
#define NFC_REG_BUF
#define NFC_REG_INFO
#define NFC_REG_DC
#define NFC_REG_ADR
#define NFC_REG_DL
#define NFC_REG_DH
#define NFC_REG_CADR
#define NFC_REG_SADR
#define NFC_REG_PINS
#define NFC_REG_VER

#define NFC_RB_IRQ_EN

#define CLK_DIV_SHIFT
#define CLK_DIV_WIDTH

#define CMDRWGEN(cmd_dir, ran, bch, short_mode, page_size, pages)

#define GENCMDDADDRL(adl, addr)
#define GENCMDDADDRH(adh, addr)
#define GENCMDIADDRL(ail, addr)
#define GENCMDIADDRH(aih, addr)

#define DMA_DIR(dir)
#define DMA_ADDR_ALIGN

#define NFC_SHORT_MODE_ECC_SZ

#define ECC_CHECK_RETURN_FF

#define NAND_CE0
#define NAND_CE1

#define DMA_BUSY_TIMEOUT
#define CMD_FIFO_EMPTY_TIMEOUT

#define MAX_CE_NUM

/* eMMC clock register, misc control */
#define CLK_SELECT_NAND
#define CLK_ALWAYS_ON_NAND
#define CLK_SELECT_FIX_PLL2

#define NFC_CLK_CYCLE

/* nand flash controller delay 3 ns */
#define NFC_DEFAULT_DELAY

#define ROW_ADDER(page, index)
#define MAX_CYCLE_ADDRS
#define DIRREAD
#define DIRWRITE

#define ECC_PARITY_BCH8_512B
#define ECC_COMPLETE
#define ECC_ERR_CNT(x)
#define ECC_ZERO_CNT(x)
#define ECC_UNCORRECTABLE

#define PER_INFO_BYTE

#define NFC_CMD_RAW_LEN

#define NFC_COLUMN_ADDR_0
#define NFC_COLUMN_ADDR_1

struct meson_nfc_nand_chip {};

struct meson_nand_ecc {};

struct meson_nfc_data {};

struct meson_nfc_param {};

struct nand_rw_cmd {};

struct nand_timing {};

struct meson_nfc {};

enum {};

#define MESON_ECC_DATA(b, s, sz)

static struct meson_nand_ecc meson_ecc[] =;

static int meson_nand_calc_ecc_bytes(int step_size, int strength)
{}

NAND_ECC_CAPS_SINGLE();

static const int axg_stepinfo_strengths[] =;

static const struct nand_ecc_step_info axg_stepinfo[] =;

static const struct nand_ecc_caps meson_axg_ecc_caps =;

static struct meson_nfc_nand_chip *to_meson_nand(struct nand_chip *nand)
{}

static void meson_nfc_select_chip(struct nand_chip *nand, int chip)
{}

static void meson_nfc_cmd_idle(struct meson_nfc *nfc, u32 time)
{}

static void meson_nfc_cmd_seed(struct meson_nfc *nfc, u32 seed)
{}

static int meson_nfc_is_boot_page(struct nand_chip *nand, int page)
{}

static void meson_nfc_cmd_access(struct nand_chip *nand, int raw, bool dir, int page)
{}

static void meson_nfc_drain_cmd(struct meson_nfc *nfc)
{}

static int meson_nfc_wait_cmd_finish(struct meson_nfc *nfc,
				     unsigned int timeout_ms)
{}

static int meson_nfc_wait_dma_finish(struct meson_nfc *nfc)
{}

static u8 *meson_nfc_oob_ptr(struct nand_chip *nand, int i)
{}

static u8 *meson_nfc_data_ptr(struct nand_chip *nand, int i)
{}

static void meson_nfc_get_data_oob(struct nand_chip *nand,
				   u8 *buf, u8 *oobbuf)
{}

static void meson_nfc_set_data_oob(struct nand_chip *nand,
				   const u8 *buf, u8 *oobbuf)
{}

static int meson_nfc_wait_no_rb_pin(struct nand_chip *nand, int timeout_ms,
				    bool need_cmd_read0)
{}

static int meson_nfc_wait_rb_pin(struct meson_nfc *nfc, int timeout_ms)
{}

static int meson_nfc_queue_rb(struct nand_chip *nand, int timeout_ms,
			      bool need_cmd_read0)
{}

static void meson_nfc_set_user_byte(struct nand_chip *nand, u8 *oob_buf)
{}

static void meson_nfc_get_user_byte(struct nand_chip *nand, u8 *oob_buf)
{}

static int meson_nfc_ecc_correct(struct nand_chip *nand, u32 *bitflips,
				 u64 *correct_bitmap)
{}

static int meson_nfc_dma_buffer_setup(struct nand_chip *nand, void *databuf,
				      int datalen, void *infobuf, int infolen,
				      enum dma_data_direction dir)
{}

static void meson_nfc_dma_buffer_release(struct nand_chip *nand,
					 int datalen, int infolen,
					 enum dma_data_direction dir)
{}

static int meson_nfc_read_buf(struct nand_chip *nand, u8 *buf, int len)
{}

static int meson_nfc_write_buf(struct nand_chip *nand, u8 *buf, int len)
{}

static int meson_nfc_rw_cmd_prepare_and_execute(struct nand_chip *nand,
						int page, bool in)
{}

static int meson_nfc_write_page_sub(struct nand_chip *nand,
				    int page, int raw)
{}

static int meson_nfc_write_page_raw(struct nand_chip *nand, const u8 *buf,
				    int oob_required, int page)
{}

static int meson_nfc_write_page_hwecc(struct nand_chip *nand,
				      const u8 *buf, int oob_required, int page)
{}

static void meson_nfc_check_ecc_pages_valid(struct meson_nfc *nfc,
					    struct nand_chip *nand, int raw)
{}

static int meson_nfc_read_page_sub(struct nand_chip *nand,
				   int page, int raw)
{}

static int meson_nfc_read_page_raw(struct nand_chip *nand, u8 *buf,
				   int oob_required, int page)
{}

static int meson_nfc_read_page_hwecc(struct nand_chip *nand, u8 *buf,
				     int oob_required, int page)
{}

static int meson_nfc_read_oob_raw(struct nand_chip *nand, int page)
{}

static int meson_nfc_read_oob(struct nand_chip *nand, int page)
{}

static bool meson_nfc_is_buffer_dma_safe(const void *buffer)
{}

static void *
meson_nand_op_get_dma_safe_input_buf(const struct nand_op_instr *instr)
{}

static void
meson_nand_op_put_dma_safe_input_buf(const struct nand_op_instr *instr,
				     void *buf)
{}

static void *
meson_nand_op_get_dma_safe_output_buf(const struct nand_op_instr *instr)
{}

static void
meson_nand_op_put_dma_safe_output_buf(const struct nand_op_instr *instr,
				      const void *buf)
{}

static int meson_nfc_check_op(struct nand_chip *chip,
			      const struct nand_operation *op)
{}

static int meson_nfc_exec_op(struct nand_chip *nand,
			     const struct nand_operation *op, bool check_only)
{}

static int meson_ooblayout_ecc(struct mtd_info *mtd, int section,
			       struct mtd_oob_region *oobregion)
{}

static int meson_ooblayout_free(struct mtd_info *mtd, int section,
				struct mtd_oob_region *oobregion)
{}

static const struct mtd_ooblayout_ops meson_ooblayout_ops =;

static int meson_nfc_clk_init(struct meson_nfc *nfc)
{}

static void meson_nfc_disable_clk(struct meson_nfc *nfc)
{}

static void meson_nfc_free_buffer(struct nand_chip *nand)
{}

static int meson_chip_buffer_init(struct nand_chip *nand)
{}

static
int meson_nfc_setup_interface(struct nand_chip *nand, int csline,
			      const struct nand_interface_config *conf)
{}

static int meson_nand_bch_mode(struct nand_chip *nand)
{}

static void meson_nand_detach_chip(struct nand_chip *nand)
{}

static int meson_nand_attach_chip(struct nand_chip *nand)
{}

static const struct nand_controller_ops meson_nand_controller_ops =;

static int
meson_nfc_nand_chip_init(struct device *dev,
			 struct meson_nfc *nfc, struct device_node *np)
{}

static void meson_nfc_nand_chips_cleanup(struct meson_nfc *nfc)
{}

static int meson_nfc_nand_chips_init(struct device *dev,
				     struct meson_nfc *nfc)
{}

static irqreturn_t meson_nfc_irq(int irq, void *id)
{}

static const struct meson_nfc_data meson_gxl_data =;

static const struct meson_nfc_data meson_axg_data =;

static const struct of_device_id meson_nfc_id_table[] =;
MODULE_DEVICE_TABLE(of, meson_nfc_id_table);

static int meson_nfc_probe(struct platform_device *pdev)
{}

static void meson_nfc_remove(struct platform_device *pdev)
{}

static struct platform_driver meson_nfc_driver =;
module_platform_driver();

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