linux/drivers/memstick/host/r592.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2010 - Maxim Levitsky
 * driver for Ricoh memstick readers
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/freezer.h>
#include <linux/jiffies.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/pci_ids.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/kthread.h>
#include <linux/sched.h>
#include <linux/highmem.h>
#include <asm/byteorder.h>
#include <linux/swab.h>
#include "r592.h"

static bool r592_enable_dma =;
static int debug;

static const char *tpc_names[] =;

/**
 * memstick_debug_get_tpc_name - debug helper that returns string for
 * a TPC number
 */
static __maybe_unused const char *memstick_debug_get_tpc_name(int tpc)
{}

/* Read a register*/
static inline u32 r592_read_reg(struct r592_device *dev, int address)
{}

/* Write a register */
static inline void r592_write_reg(struct r592_device *dev,
							int address, u32 value)
{}

/* Reads a big endian DWORD register */
static inline u32 r592_read_reg_raw_be(struct r592_device *dev, int address)
{}

/* Writes a big endian DWORD register */
static inline void r592_write_reg_raw_be(struct r592_device *dev,
							int address, u32 value)
{}

/* Set specific bits in a register (little endian) */
static inline void r592_set_reg_mask(struct r592_device *dev,
							int address, u32 mask)
{}

/* Clear specific bits in a register (little endian) */
static inline void r592_clear_reg_mask(struct r592_device *dev,
						int address, u32 mask)
{}


/* Wait for status bits while checking for errors */
static int r592_wait_status(struct r592_device *dev, u32 mask, u32 wanted_mask)
{}


/* Enable/disable device */
static int r592_enable_device(struct r592_device *dev, bool enable)
{}

/* Set serial/parallel mode */
static int r592_set_mode(struct r592_device *dev, bool parallel_mode)
{}

/* Perform a controller reset without powering down the card */
static void r592_host_reset(struct r592_device *dev)
{}

#ifdef CONFIG_PM_SLEEP
/* Disable all hardware interrupts */
static void r592_clear_interrupts(struct r592_device *dev)
{}
#endif

/* Tests if there is an CRC error */
static int r592_test_io_error(struct r592_device *dev)
{}

/* Ensure that FIFO is ready for use */
static int r592_test_fifo_empty(struct r592_device *dev)
{}

/* Activates the DMA transfer from to FIFO */
static void r592_start_dma(struct r592_device *dev, bool is_write)
{}

/* Cleanups DMA related settings */
static void r592_stop_dma(struct r592_device *dev, int error)
{}

/* Test if hardware supports DMA */
static void r592_check_dma(struct r592_device *dev)
{}

/* Transfers fifo contents in/out using DMA */
static int r592_transfer_fifo_dma(struct r592_device *dev)
{}

/*
 * Writes the FIFO in 4 byte chunks.
 * If length isn't 4 byte aligned, rest of the data if put to a fifo
 * to be written later
 * Use r592_flush_fifo_write to flush that fifo when writing for the
 * last time
 */
static void r592_write_fifo_pio(struct r592_device *dev,
					unsigned char *buffer, int len)
{}

/* Flushes the temporary FIFO used to make aligned DWORD writes */
static void r592_flush_fifo_write(struct r592_device *dev)
{}

/*
 * Read a fifo in 4 bytes chunks.
 * If input doesn't fit the buffer, it places bytes of last dword in spill
 * buffer, so that they don't get lost on last read, just throw these away.
 */
static void r592_read_fifo_pio(struct r592_device *dev,
						unsigned char *buffer, int len)
{}

/* Transfers actual data using PIO. */
static int r592_transfer_fifo_pio(struct r592_device *dev)
{}

/* Executes one TPC (data is read/written from small or large fifo) */
static void r592_execute_tpc(struct r592_device *dev)
{}

/* Main request processing thread */
static int r592_process_thread(void *data)
{}

/* Reprogram chip to detect change in card state */
/* eg, if card is detected, arm it to detect removal, and vice versa */
static void r592_update_card_detect(struct r592_device *dev)
{}

/* Timer routine that fires 1 second after last card detection event, */
static void r592_detect_timer(struct timer_list *t)
{}

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

/* External inteface: set settings */
static int r592_set_param(struct memstick_host *host,
			enum memstick_param param, int value)
{}

/* External interface: submit requests */
static void r592_submit_req(struct memstick_host *host)
{}

static const struct pci_device_id r592_pci_id_tbl[] =;

/* Main entry */
static int r592_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{}

static void r592_remove(struct pci_dev *pdev)
{}

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

static int r592_resume(struct device *core_dev)
{}
#endif

static SIMPLE_DEV_PM_OPS(r592_pm_ops, r592_suspend, r592_resume);

MODULE_DEVICE_TABLE(pci, r592_pci_id_tbl);

static struct pci_driver r592_pci_driver =;

module_pci_driver();

module_param_named(enable_dma, r592_enable_dma, bool, S_IRUGO);
MODULE_PARM_DESC();
module_param(debug, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();

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