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

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Driver for One Laptop Per Child ‘CAFÉ’ controller, aka Marvell 88ALP01
 *
 * The data sheet for this device can be found at:
 *    http://wiki.laptop.org/go/Datasheets 
 *
 * Copyright © 2006 Red Hat, Inc.
 * Copyright © 2006 David Woodhouse <dwmw2@infradead.org>
 */

#define DEBUG

#include <linux/device.h>
#undef DEBUG
#include <linux/mtd/mtd.h>
#include <linux/mtd/rawnand.h>
#include <linux/mtd/partitions.h>
#include <linux/rslib.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/dma-mapping.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <asm/io.h>

#define CAFE_NAND_CTRL1
#define CAFE_NAND_CTRL2
#define CAFE_NAND_CTRL3
#define CAFE_NAND_STATUS
#define CAFE_NAND_IRQ
#define CAFE_NAND_IRQ_MASK
#define CAFE_NAND_DATA_LEN
#define CAFE_NAND_ADDR1
#define CAFE_NAND_ADDR2
#define CAFE_NAND_TIMING1
#define CAFE_NAND_TIMING2
#define CAFE_NAND_TIMING3
#define CAFE_NAND_NONMEM
#define CAFE_NAND_ECC_RESULT
#define CAFE_NAND_DMA_CTRL
#define CAFE_NAND_DMA_ADDR0
#define CAFE_NAND_DMA_ADDR1
#define CAFE_NAND_ECC_SYN01
#define CAFE_NAND_ECC_SYN23
#define CAFE_NAND_ECC_SYN45
#define CAFE_NAND_ECC_SYN67
#define CAFE_NAND_READ_DATA
#define CAFE_NAND_WRITE_DATA

#define CAFE_GLOBAL_CTRL
#define CAFE_GLOBAL_IRQ
#define CAFE_GLOBAL_IRQ_MASK
#define CAFE_NAND_RESET

/* Missing from the datasheet: bit 19 of CTRL1 sets CE0 vs. CE1 */
#define CTRL1_CHIPSELECT

struct cafe_priv {};

static int usedma =;
module_param(usedma, int, 0644);

static int skipbbt =;
module_param(skipbbt, int, 0644);

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

static int regdebug =;
module_param(regdebug, int, 0644);

static int checkecc =;
module_param(checkecc, int, 0644);

static unsigned int numtimings;
static int timing[3];
module_param_array();

static const char *part_probes[] =;

/* Hrm. Why isn't this already conditional on something in the struct device? */
#define cafe_dev_dbg(dev, args...)

/* Make it easier to switch to PIO if we need to */
#define cafe_readl(cafe, addr)
#define cafe_writel(cafe, datum, addr)

static int cafe_device_ready(struct nand_chip *chip)
{}


static void cafe_write_buf(struct nand_chip *chip, const uint8_t *buf, int len)
{}

static void cafe_read_buf(struct nand_chip *chip, uint8_t *buf, int len)
{}

static uint8_t cafe_read_byte(struct nand_chip *chip)
{}

static void cafe_nand_cmdfunc(struct nand_chip *chip, unsigned command,
			      int column, int page_addr)
{}

static void cafe_select_chip(struct nand_chip *chip, int chipnr)
{}

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

static int cafe_nand_write_oob(struct nand_chip *chip, int page)
{}

/* Don't use -- use nand_read_oob_std for now */
static int cafe_nand_read_oob(struct nand_chip *chip, int page)
{}
/**
 * cafe_nand_read_page - [REPLACEABLE] hardware ecc syndrome based page read
 * @chip:	nand chip info structure
 * @buf:	buffer to store read data
 * @oob_required:	caller expects OOB data read to chip->oob_poi
 * @page:	page number to read
 *
 * The hw generator calculates the error syndrome automatically. Therefore
 * we need a special oob layout and handling.
 */
static int cafe_nand_read_page(struct nand_chip *chip, uint8_t *buf,
			       int oob_required, int page)
{}

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

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

static const struct mtd_ooblayout_ops cafe_ooblayout_ops =;

/* Ick. The BBT code really ought to be able to work this bit out
   for itself from the above, at least for the 2KiB case */
static uint8_t cafe_bbt_pattern_2048[] =;
static uint8_t cafe_mirror_pattern_2048[] =;

static uint8_t cafe_bbt_pattern_512[] =;
static uint8_t cafe_mirror_pattern_512[] =;


static struct nand_bbt_descr cafe_bbt_main_descr_2048 =;

static struct nand_bbt_descr cafe_bbt_mirror_descr_2048 =;

static struct nand_bbt_descr cafe_bbt_main_descr_512 =;

static struct nand_bbt_descr cafe_bbt_mirror_descr_512 =;


static int cafe_nand_write_page_lowlevel(struct nand_chip *chip,
					 const uint8_t *buf, int oob_required,
					 int page)
{}

/* F_2[X]/(X**6+X+1)  */
static unsigned short gf64_mul(u8 a, u8 b)
{}

/* F_64[X]/(X**2+X+A**-1) with A the generator of F_64[X]  */
static u16 gf4096_mul(u16 a, u16 b)
{}

static int cafe_mul(int x)
{}

static int cafe_nand_attach_chip(struct nand_chip *chip)
{}

static void cafe_nand_detach_chip(struct nand_chip *chip)
{}

static const struct nand_controller_ops cafe_nand_controller_ops =;

static int cafe_nand_probe(struct pci_dev *pdev,
				     const struct pci_device_id *ent)
{}

static void cafe_nand_remove(struct pci_dev *pdev)
{}

static const struct pci_device_id cafe_nand_tbl[] =;

MODULE_DEVICE_TABLE(pci, cafe_nand_tbl);

static int cafe_nand_resume(struct pci_dev *pdev)
{}

static struct pci_driver cafe_nand_pci_driver =;

module_pci_driver();

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