linux/drivers/mmc/host/wbsd.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  linux/drivers/mmc/host/wbsd.c - Winbond W83L51xD SD/MMC driver
 *
 *  Copyright (C) 2004-2007 Pierre Ossman, All Rights Reserved.
 *
 * Warning!
 *
 * Changes to the FIFO system should be done with extreme care since
 * the hardware is full of bugs related to the FIFO. Known issues are:
 *
 * - FIFO size field in FSR is always zero.
 *
 * - FIFO interrupts tend not to work as they should. Interrupts are
 *   triggered only for full/empty events, not for threshold values.
 *
 * - On APIC systems the FIFO empty interrupt is sometimes lost.
 */

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/dma-mapping.h>
#include <linux/delay.h>
#include <linux/pnp.h>
#include <linux/highmem.h>
#include <linux/mmc/host.h>
#include <linux/mmc/mmc.h>
#include <linux/mmc/sd.h>
#include <linux/scatterlist.h>
#include <linux/slab.h>

#include <asm/io.h>
#include <asm/dma.h>

#include "wbsd.h"

#define DRIVER_NAME

#define DBG(x...)
#define DBGF(f, x...)

/*
 * Device resources
 */

#ifdef CONFIG_PNP

static const struct pnp_device_id pnp_dev_table[] =;

MODULE_DEVICE_TABLE(pnp, pnp_dev_table);

#endif /* CONFIG_PNP */

static const int config_ports[] =;
static const int unlock_codes[] =;

static const int valid_ids[] =;

#ifdef CONFIG_PNP
static unsigned int param_nopnp =;
#else
static const unsigned int param_nopnp = 1;
#endif
static unsigned int param_io =;
static unsigned int param_irq =;
static int param_dma =;

/*
 * Basic functions
 */

static inline void wbsd_unlock_config(struct wbsd_host *host)
{}

static inline void wbsd_lock_config(struct wbsd_host *host)
{}

static inline void wbsd_write_config(struct wbsd_host *host, u8 reg, u8 value)
{}

static inline u8 wbsd_read_config(struct wbsd_host *host, u8 reg)
{}

static inline void wbsd_write_index(struct wbsd_host *host, u8 index, u8 value)
{}

static inline u8 wbsd_read_index(struct wbsd_host *host, u8 index)
{}

/*
 * Common routines
 */

static void wbsd_init_device(struct wbsd_host *host)
{}

static void wbsd_reset(struct wbsd_host *host)
{}

static void wbsd_request_end(struct wbsd_host *host, struct mmc_request *mrq)
{}

/*
 * Scatter/gather functions
 */

static inline void wbsd_init_sg(struct wbsd_host *host, struct mmc_data *data)
{}

static inline int wbsd_next_sg(struct wbsd_host *host)
{}

static inline char *wbsd_map_sg(struct wbsd_host *host)
{}

static inline void wbsd_sg_to_dma(struct wbsd_host *host, struct mmc_data *data)
{}

static inline void wbsd_dma_to_sg(struct wbsd_host *host, struct mmc_data *data)
{}

/*
 * Command handling
 */

static inline void wbsd_get_short_reply(struct wbsd_host *host,
					struct mmc_command *cmd)
{}

static inline void wbsd_get_long_reply(struct wbsd_host *host,
	struct mmc_command *cmd)
{}

static void wbsd_send_command(struct wbsd_host *host, struct mmc_command *cmd)
{}

/*
 * Data functions
 */

static void wbsd_empty_fifo(struct wbsd_host *host)
{}

static void wbsd_fill_fifo(struct wbsd_host *host)
{}

static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data)
{}

static void wbsd_finish_data(struct wbsd_host *host, struct mmc_data *data)
{}

/*****************************************************************************\
 *                                                                           *
 * MMC layer callbacks                                                       *
 *                                                                           *
\*****************************************************************************/

static void wbsd_request(struct mmc_host *mmc, struct mmc_request *mrq)
{}

static void wbsd_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
{}

static int wbsd_get_ro(struct mmc_host *mmc)
{}

static const struct mmc_host_ops wbsd_ops =;

/*****************************************************************************\
 *                                                                           *
 * Interrupt handling                                                        *
 *                                                                           *
\*****************************************************************************/

/*
 * Helper function to reset detection ignore
 */

static void wbsd_reset_ignore(struct timer_list *t)
{}

/*
 * BH Works
 */

static inline struct mmc_data *wbsd_get_data(struct wbsd_host *host)
{}

static void wbsd_card_bh_work(struct work_struct *t)
{}

static void wbsd_fifo_bh_work(struct work_struct *t)
{}

static void wbsd_crc_bh_work(struct work_struct *t)
{}

static void wbsd_timeout_bh_work(struct work_struct *t)
{}

static void wbsd_finish_bh_work(struct work_struct *t)
{}

/*
 * Interrupt handling
 */

static irqreturn_t wbsd_irq(int irq, void *dev_id)
{}

/*****************************************************************************\
 *                                                                           *
 * Device initialisation and shutdown                                        *
 *                                                                           *
\*****************************************************************************/

/*
 * Allocate/free MMC structure.
 */

static int wbsd_alloc_mmc(struct device *dev)
{}

static void wbsd_free_mmc(struct device *dev)
{}

/*
 * Scan for known chip id:s
 */

static int wbsd_scan(struct wbsd_host *host)
{}

/*
 * Allocate/free io port ranges
 */

static int wbsd_request_region(struct wbsd_host *host, int base)
{}

static void wbsd_release_regions(struct wbsd_host *host)
{}

/*
 * Allocate/free DMA port and buffer
 */

static void wbsd_request_dma(struct wbsd_host *host, int dma)
{}

static void wbsd_release_dma(struct wbsd_host *host)
{}

/*
 * Allocate/free IRQ.
 */

static int wbsd_request_irq(struct wbsd_host *host, int irq)
{}

static void  wbsd_release_irq(struct wbsd_host *host)
{}

/*
 * Allocate all resources for the host.
 */

static int wbsd_request_resources(struct wbsd_host *host,
	int base, int irq, int dma)
{}

/*
 * Release all resources for the host.
 */

static void wbsd_release_resources(struct wbsd_host *host)
{}

/*
 * Configure the resources the chip should use.
 */

static void wbsd_chip_config(struct wbsd_host *host)
{}

/*
 * Check that configured resources are correct.
 */

static int wbsd_chip_validate(struct wbsd_host *host)
{}

/*
 * Powers down the SD function
 */

static void wbsd_chip_poweroff(struct wbsd_host *host)
{}

/*****************************************************************************\
 *                                                                           *
 * Devices setup and shutdown                                                *
 *                                                                           *
\*****************************************************************************/

static int wbsd_init(struct device *dev, int base, int irq, int dma,
	int pnp)
{}

static void wbsd_shutdown(struct device *dev, int pnp)
{}

/*
 * Non-PnP
 */

static int wbsd_probe(struct platform_device *dev)
{}

static void wbsd_remove(struct platform_device *dev)
{}

/*
 * PnP
 */

#ifdef CONFIG_PNP

static int
wbsd_pnp_probe(struct pnp_dev *pnpdev, const struct pnp_device_id *dev_id)
{}

static void wbsd_pnp_remove(struct pnp_dev *dev)
{}

#endif /* CONFIG_PNP */

/*
 * Power management
 */

#ifdef CONFIG_PM

static int wbsd_platform_suspend(struct platform_device *dev,
				 pm_message_t state)
{}

static int wbsd_platform_resume(struct platform_device *dev)
{}

#ifdef CONFIG_PNP

static int wbsd_pnp_suspend(struct pnp_dev *pnp_dev, pm_message_t state)
{}

static int wbsd_pnp_resume(struct pnp_dev *pnp_dev)
{}

#endif /* CONFIG_PNP */

#else /* CONFIG_PM */

#define wbsd_platform_suspend
#define wbsd_platform_resume

#define wbsd_pnp_suspend
#define wbsd_pnp_resume

#endif /* CONFIG_PM */

static struct platform_device *wbsd_device;

static struct platform_driver wbsd_driver =;

#ifdef CONFIG_PNP

static struct pnp_driver wbsd_pnp_driver =;

#endif /* CONFIG_PNP */

/*
 * Module loading/unloading
 */

static int __init wbsd_drv_init(void)
{}

static void __exit wbsd_drv_exit(void)
{}

module_init();
module_exit(wbsd_drv_exit);
#ifdef CONFIG_PNP
module_param_hw_named(nopnp, param_nopnp, uint, other, 0444);
#endif
module_param_hw_named(io, param_io, uint, ioport, 0444);
module_param_hw_named(irq, param_irq, uint, irq, 0444);
module_param_hw_named(dma, param_dma, int, dma, 0444);

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

#ifdef CONFIG_PNP
MODULE_PARM_DESC();
#endif
MODULE_PARM_DESC();
MODULE_PARM_DESC();
MODULE_PARM_DESC();