#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 …
#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[] = …;
#define cafe_dev_dbg(dev, args...) …
#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)
{ … }
static int cafe_nand_read_oob(struct nand_chip *chip, int page)
{ … }
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 = …;
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)
{ … }
static unsigned short gf64_mul(u8 a, u8 b)
{ … }
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(…) …;