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

// SPDX-License-Identifier: GPL-2.0-only
/*
 * (C) 2003 Red Hat, Inc.
 * (C) 2004 Dan Brown <[email protected]>
 * (C) 2004 Kalev Lember <[email protected]>
 *
 * Author: David Woodhouse <[email protected]>
 * Additional Diskonchip 2000 and Millennium support by Dan Brown <[email protected]>
 * Diskonchip Millennium Plus support by Kalev Lember <[email protected]>
 *
 * Error correction code lifted from the old docecc code
 * Author: Fabrice Bellard ([email protected])
 * Copyright (C) 2000 Netgem S.A.
 * converted to the generic Reed-Solomon library by Thomas Gleixner <[email protected]>
 *
 * Interface to generic NAND code for M-Systems DiskOnChip devices
 */

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/rslib.h>
#include <linux/moduleparam.h>
#include <linux/slab.h>
#include <linux/io.h>

#include <linux/mtd/mtd.h>
#include <linux/mtd/rawnand.h>
#include <linux/mtd/doc2000.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/inftl.h>
#include <linux/module.h>

/* Where to look for the devices? */
#ifndef CONFIG_MTD_NAND_DISKONCHIP_PROBE_ADDRESS
#define CONFIG_MTD_NAND_DISKONCHIP_PROBE_ADDRESS
#endif

static unsigned long doc_locations[] __initdata =;

static struct mtd_info *doclist =;

struct doc_priv {};

/* This is the ecc value computed by the HW ecc generator upon writing an empty
   page, one with all 0xff for data. */
static u_char empty_write_ecc[6] =;

#define INFTL_BBT_RESERVED_BLOCKS

#define DoC_is_MillenniumPlus(doc)
#define DoC_is_Millennium(doc)
#define DoC_is_2000(doc)

static int debug =;
module_param(debug, int, 0);

static int try_dword =;
module_param(try_dword, int, 0);

static int no_ecc_failures =;
module_param(no_ecc_failures, int, 0);

static int no_autopart =;
module_param(no_autopart, int, 0);

static int show_firmware_partition =;
module_param(show_firmware_partition, int, 0);

#ifdef CONFIG_MTD_NAND_DISKONCHIP_BBTWRITE
static int inftl_bbt_write =;
#else
static int inftl_bbt_write = 0;
#endif
module_param(inftl_bbt_write, int, 0);

static unsigned long doc_config_location =;
module_param(doc_config_location, ulong, 0);
MODULE_PARM_DESC();

/* Sector size for HW ECC */
#define SECTOR_SIZE
/* The sector bytes are packed into NB_DATA 10 bit words */
#define NB_DATA
/* Number of roots */
#define NROOTS
/* First consective root */
#define FCR
/* Number of symbols */
#define NN

/*
 * The HW decoder in the DoC ASIC's provides us a error syndrome,
 * which we must convert to a standard syndrome usable by the generic
 * Reed-Solomon library code.
 *
 * Fabrice Bellard figured this out in the old docecc code. I added
 * some comments, improved a minor bit and converted it to make use
 * of the generic Reed-Solomon library. tglx
 */
static int doc_ecc_decode(struct rs_control *rs, uint8_t *data, uint8_t *ecc)
{}

static void DoC_Delay(struct doc_priv *doc, unsigned short cycles)
{}

#define CDSN_CTRL_FR_B_MASK

/* DOC_WaitReady: Wait for RDY line to be asserted by the flash chip */
static int _DoC_WaitReady(struct doc_priv *doc)
{}

static inline int DoC_WaitReady(struct doc_priv *doc)
{}

static void doc2000_write_byte(struct nand_chip *this, u_char datum)
{}

static void doc2000_writebuf(struct nand_chip *this, const u_char *buf,
			     int len)
{}

static void doc2000_readbuf(struct nand_chip *this, u_char *buf, int len)
{}

/*
 * We need our own readid() here because it's called before the NAND chip
 * has been initialized, and calling nand_op_readid() would lead to a NULL
 * pointer exception when dereferencing the NAND timings.
 */
static void doc200x_readid(struct nand_chip *this, unsigned int cs, u8 *id)
{}

static uint16_t __init doc200x_ident_chip(struct mtd_info *mtd, int nr)
{}

static void __init doc2000_count_chips(struct mtd_info *mtd)
{}

static void doc2001_write_byte(struct nand_chip *this, u_char datum)
{}

static void doc2001_writebuf(struct nand_chip *this, const u_char *buf, int len)
{}

static void doc2001_readbuf(struct nand_chip *this, u_char *buf, int len)
{}

static void doc2001plus_writebuf(struct nand_chip *this, const u_char *buf, int len)
{}

static void doc2001plus_readbuf(struct nand_chip *this, u_char *buf, int len)
{}

static void doc200x_write_control(struct doc_priv *doc, u8 value)
{}

static void doc200x_exec_instr(struct nand_chip *this,
			       const struct nand_op_instr *instr)
{}

static int doc200x_exec_op(struct nand_chip *this,
			   const struct nand_operation *op,
			   bool check_only)
{}

static void doc2001plus_write_pipe_term(struct doc_priv *doc)
{}

static void doc2001plus_exec_instr(struct nand_chip *this,
				   const struct nand_op_instr *instr)
{}

static int doc2001plus_exec_op(struct nand_chip *this,
			       const struct nand_operation *op,
			       bool check_only)
{}

static void doc200x_enable_hwecc(struct nand_chip *this, int mode)
{}

static void doc2001plus_enable_hwecc(struct nand_chip *this, int mode)
{}

/* This code is only called on write */
static int doc200x_calculate_ecc(struct nand_chip *this, const u_char *dat,
				 unsigned char *ecc_code)
{}

static int doc200x_correct_data(struct nand_chip *this, u_char *dat,
				u_char *read_ecc, u_char *isnull)
{}

//u_char mydatabuf[528];

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

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

static const struct mtd_ooblayout_ops doc200x_ooblayout_ops =;

/* Find the (I)NFTL Media Header, and optionally also the mirror media header.
   On successful return, buf will contain a copy of the media header for
   further processing.  id is the string to scan for, and will presumably be
   either "ANAND" or "BNAND".  If findmirror=1, also look for the mirror media
   header.  The page #s of the found media headers are placed in mh0_page and
   mh1_page in the DOC private structure. */
static int __init find_media_headers(struct mtd_info *mtd, u_char *buf, const char *id, int findmirror)
{}

static inline int __init nftl_partscan(struct mtd_info *mtd, struct mtd_partition *parts)
{}

/* This is a stripped-down copy of the code in inftlmount.c */
static inline int __init inftl_partscan(struct mtd_info *mtd, struct mtd_partition *parts)
{}

static int __init nftl_scan_bbt(struct mtd_info *mtd)
{}

static int __init inftl_scan_bbt(struct mtd_info *mtd)
{}

static inline int __init doc2000_init(struct mtd_info *mtd)
{}

static inline int __init doc2001_init(struct mtd_info *mtd)
{}

static inline int __init doc2001plus_init(struct mtd_info *mtd)
{}

static int doc200x_attach_chip(struct nand_chip *chip)
{}

static const struct nand_controller_ops doc200x_ops =;

static const struct nand_controller_ops doc2001plus_ops =;

static int __init doc_probe(unsigned long physadr)
{}

static void release_nanddoc(void)
{}

static int __init init_nanddoc(void)
{}

static void __exit cleanup_nanddoc(void)
{}

module_init();
module_exit(cleanup_nanddoc);

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