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

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright © 2009 - Maxim Levitsky
 * driver for Ricoh xD readers
 */

#define DRV_NAME
#define pr_fmt(fmt)

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/jiffies.h>
#include <linux/workqueue.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/pci_ids.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <asm/byteorder.h>
#include <linux/sched.h>
#include "sm_common.h"
#include "r852.h"


static bool r852_enable_dma =;
module_param(r852_enable_dma, bool, S_IRUGO);
MODULE_PARM_DESC();

static int debug;
module_param(debug, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();

/* read register */
static inline uint8_t r852_read_reg(struct r852_device *dev, int address)
{}

/* write register */
static inline void r852_write_reg(struct r852_device *dev,
						int address, uint8_t value)
{}


/* read dword sized register */
static inline uint32_t r852_read_reg_dword(struct r852_device *dev, int address)
{}

/* write dword sized register */
static inline void r852_write_reg_dword(struct r852_device *dev,
							int address, uint32_t value)
{}

/* returns pointer to our private structure */
static inline struct r852_device *r852_get_dev(struct mtd_info *mtd)
{}


/* check if controller supports dma */
static void r852_dma_test(struct r852_device *dev)
{}

/*
 * Enable dma. Enables ether first or second stage of the DMA,
 * Expects dev->dma_dir and dev->dma_state be set
 */
static void r852_dma_enable(struct r852_device *dev)
{}

/*
 * Disable dma, called from the interrupt handler, which specifies
 * success of the operation via 'error' argument
 */
static void r852_dma_done(struct r852_device *dev, int error)
{}

/*
 * Wait, till dma is done, which includes both phases of it
 */
static int r852_dma_wait(struct r852_device *dev)
{}

/*
 * Read/Write one page using dma. Only pages can be read (512 bytes)
*/
static void r852_do_dma(struct r852_device *dev, uint8_t *buf, int do_read)
{}

/*
 * Program data lines of the nand chip to send data to it
 */
static void r852_write_buf(struct nand_chip *chip, const uint8_t *buf, int len)
{}

/*
 * Read data lines of the nand chip to retrieve data
 */
static void r852_read_buf(struct nand_chip *chip, uint8_t *buf, int len)
{}

/*
 * Read one byte from nand chip
 */
static uint8_t r852_read_byte(struct nand_chip *chip)
{}

/*
 * Control several chip lines & send commands
 */
static void r852_cmdctl(struct nand_chip *chip, int dat, unsigned int ctrl)
{}

/*
 * Wait till card is ready.
 * based on nand_wait, but returns errors on DMA error
 */
static int r852_wait(struct nand_chip *chip)
{}

/*
 * Check if card is ready
 */

static int r852_ready(struct nand_chip *chip)
{}


/*
 * Set ECC engine mode
*/

static void r852_ecc_hwctl(struct nand_chip *chip, int mode)
{}

/*
 * Calculate ECC, only used for writes
 */

static int r852_ecc_calculate(struct nand_chip *chip, const uint8_t *dat,
			      uint8_t *ecc_code)
{}

/*
 * Correct the data using ECC, hw did almost everything for us
 */

static int r852_ecc_correct(struct nand_chip *chip, uint8_t *dat,
			    uint8_t *read_ecc, uint8_t *calc_ecc)
{}

/*
 * This is copy of nand_read_oob_std
 * nand_read_oob_syndrome assumes we can send column address - we can't
 */
static int r852_read_oob(struct nand_chip *chip, int page)
{}

/*
 * Start the nand engine
 */

static void r852_engine_enable(struct r852_device *dev)
{}


/*
 * Stop the nand engine
 */

static void r852_engine_disable(struct r852_device *dev)
{}

/*
 * Test if card is present
 */

static void r852_card_update_present(struct r852_device *dev)
{}

/*
 * Update card detection IRQ state according to current card state
 * which is read in r852_card_update_present
 */
static void r852_update_card_detect(struct r852_device *dev)
{}

static ssize_t media_type_show(struct device *sys_dev,
			       struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(media_type);


/* Detect properties of card in slot */
static void r852_update_media_status(struct r852_device *dev)
{}

/*
 * Register the nand device
 * Called when the card is detected
 */
static int r852_register_nand_device(struct r852_device *dev)
{}

/*
 * Unregister the card
 */

static void r852_unregister_nand_device(struct r852_device *dev)
{}

/* Card state updater */
static void r852_card_detect_work(struct work_struct *work)
{}

/* Ack + disable IRQ generation */
static void r852_disable_irqs(struct r852_device *dev)
{}

/* Interrupt handler */
static irqreturn_t r852_irq(int irq, void *data)
{}

static int r852_attach_chip(struct nand_chip *chip)
{}

static const struct nand_controller_ops r852_ops =;

static int  r852_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
{}

static void r852_remove(struct pci_dev *pci_dev)
{}

static void r852_shutdown(struct pci_dev *pci_dev)
{}

#ifdef CONFIG_PM_SLEEP
static int r852_suspend(struct device *device)
{}

static int r852_resume(struct device *device)
{}
#endif

static const struct pci_device_id r852_pci_id_tbl[] =;

MODULE_DEVICE_TABLE(pci, r852_pci_id_tbl);

static SIMPLE_DEV_PM_OPS(r852_pm_ops, r852_suspend, r852_resume);

static struct pci_driver r852_pci_driver =;

module_pci_driver();

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