linux/drivers/mmc/host/omap_hsmmc.c

/*
 * drivers/mmc/host/omap_hsmmc.c
 *
 * Driver for OMAP2430/3430 MMC controller.
 *
 * Copyright (C) 2007 Texas Instruments.
 *
 * Authors:
 *	Syed Mohammed Khasim	<[email protected]>
 *	Madhusudhan		<[email protected]>
 *	Mohit Jalori		<[email protected]>
 *
 * This file is licensed under the terms of the GNU General Public License
 * version 2. This program is licensed "as is" without any warranty of any
 * kind, whether express or implied.
 */

#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/debugfs.h>
#include <linux/dmaengine.h>
#include <linux/seq_file.h>
#include <linux/sizes.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/platform_device.h>
#include <linux/timer.h>
#include <linux/clk.h>
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/of_device.h>
#include <linux/mmc/host.h>
#include <linux/mmc/core.h>
#include <linux/mmc/mmc.h>
#include <linux/mmc/slot-gpio.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/regulator/consumer.h>
#include <linux/pinctrl/consumer.h>
#include <linux/pm_runtime.h>
#include <linux/pm_wakeirq.h>
#include <linux/platform_data/hsmmc-omap.h>

/* OMAP HSMMC Host Controller Registers */
#define OMAP_HSMMC_SYSSTATUS
#define OMAP_HSMMC_CON
#define OMAP_HSMMC_SDMASA
#define OMAP_HSMMC_BLK
#define OMAP_HSMMC_ARG
#define OMAP_HSMMC_CMD
#define OMAP_HSMMC_RSP10
#define OMAP_HSMMC_RSP32
#define OMAP_HSMMC_RSP54
#define OMAP_HSMMC_RSP76
#define OMAP_HSMMC_DATA
#define OMAP_HSMMC_PSTATE
#define OMAP_HSMMC_HCTL
#define OMAP_HSMMC_SYSCTL
#define OMAP_HSMMC_STAT
#define OMAP_HSMMC_IE
#define OMAP_HSMMC_ISE
#define OMAP_HSMMC_AC12
#define OMAP_HSMMC_CAPA

#define VS18
#define VS30
#define HSS
#define SDVS18
#define SDVS30
#define SDVS33
#define SDVS_MASK
#define SDVSCLR
#define SDVSDET
#define AUTOIDLE
#define SDBP
#define DTO
#define ICE
#define ICS
#define CEN
#define CLKD_MAX
#define CLKD_MASK
#define CLKD_SHIFT
#define DTO_MASK
#define DTO_SHIFT
#define INIT_STREAM
#define ACEN_ACMD23
#define DP_SELECT
#define DDIR
#define DMAE
#define MSBS
#define BCE
#define FOUR_BIT
#define HSPE
#define IWE
#define DDR
#define CLKEXTFREE
#define CTPL
#define DW8
#define OD
#define STAT_CLEAR
#define INIT_STREAM_CMD
#define DUAL_VOLT_OCR_BIT
#define SRC
#define SRD
#define SOFTRESET

/* PSTATE */
#define DLEV_DAT(x)

/* Interrupt masks for IE and ISE register */
#define CC_EN
#define TC_EN
#define BWR_EN
#define BRR_EN
#define CIRQ_EN
#define ERR_EN
#define CTO_EN
#define CCRC_EN
#define CEB_EN
#define CIE_EN
#define DTO_EN
#define DCRC_EN
#define DEB_EN
#define ACE_EN
#define CERR_EN
#define BADA_EN

#define INT_EN_MASK

#define CNI
#define ACIE
#define ACEB
#define ACCE
#define ACTO
#define ACNE

#define MMC_AUTOSUSPEND_DELAY
#define MMC_TIMEOUT_MS
#define MMC_TIMEOUT_US
#define OMAP_MMC_MIN_CLOCK
#define OMAP_MMC_MAX_CLOCK
#define DRIVER_NAME

/*
 * One controller can have multiple slots, like on some omap boards using
 * omap.c controller driver. Luckily this is not currently done on any known
 * omap_hsmmc.c device.
 */
#define mmc_pdata(host)

/*
 * MMC Host controller read/write API's
 */
#define OMAP_HSMMC_READ(base, reg)

#define OMAP_HSMMC_WRITE(base, reg, val)

struct omap_hsmmc_next {};

struct omap_hsmmc_host {};

struct omap_mmc_of_data {};

static void omap_hsmmc_start_dma_transfer(struct omap_hsmmc_host *host);

static int omap_hsmmc_enable_supply(struct mmc_host *mmc)
{}

static int omap_hsmmc_disable_supply(struct mmc_host *mmc)
{}

static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on)
{}

static int omap_hsmmc_set_power(struct omap_hsmmc_host *host, int power_on)
{}

static int omap_hsmmc_disable_boot_regulator(struct regulator *reg)
{}

static int omap_hsmmc_disable_boot_regulators(struct omap_hsmmc_host *host)
{}

static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
{}

/*
 * Start clock to the card
 */
static void omap_hsmmc_start_clock(struct omap_hsmmc_host *host)
{}

/*
 * Stop clock to the card
 */
static void omap_hsmmc_stop_clock(struct omap_hsmmc_host *host)
{}

static void omap_hsmmc_enable_irq(struct omap_hsmmc_host *host,
				  struct mmc_command *cmd)
{}

static void omap_hsmmc_disable_irq(struct omap_hsmmc_host *host)
{}

/* Calculate divisor for the given clock frequency */
static u16 calc_divisor(struct omap_hsmmc_host *host, struct mmc_ios *ios)
{}

static void omap_hsmmc_set_clock(struct omap_hsmmc_host *host)
{}

static void omap_hsmmc_set_bus_width(struct omap_hsmmc_host *host)
{}

static void omap_hsmmc_set_bus_mode(struct omap_hsmmc_host *host)
{}

#ifdef CONFIG_PM

/*
 * Restore the MMC host context, if it was lost as result of a
 * power state change.
 */
static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host)
{}

/*
 * Save the MMC host context (store the number of power state changes so far).
 */
static void omap_hsmmc_context_save(struct omap_hsmmc_host *host)
{}

#else

static void omap_hsmmc_context_save(struct omap_hsmmc_host *host)
{
}

#endif

/*
 * Send init stream sequence to card
 * before sending IDLE command
 */
static void send_init_stream(struct omap_hsmmc_host *host)
{}

static ssize_t
omap_hsmmc_show_slot_name(struct device *dev, struct device_attribute *attr,
			char *buf)
{}

static DEVICE_ATTR(slot_name, S_IRUGO, omap_hsmmc_show_slot_name, NULL);

/*
 * Configure the response type and send the cmd.
 */
static void
omap_hsmmc_start_command(struct omap_hsmmc_host *host, struct mmc_command *cmd,
	struct mmc_data *data)
{}

static struct dma_chan *omap_hsmmc_get_dma_chan(struct omap_hsmmc_host *host,
	struct mmc_data *data)
{}

static void omap_hsmmc_request_done(struct omap_hsmmc_host *host, struct mmc_request *mrq)
{}

/*
 * Notify the transfer complete to MMC core
 */
static void
omap_hsmmc_xfer_done(struct omap_hsmmc_host *host, struct mmc_data *data)
{}

/*
 * Notify the core about command completion
 */
static void
omap_hsmmc_cmd_done(struct omap_hsmmc_host *host, struct mmc_command *cmd)
{}

/*
 * DMA clean up for command errors
 */
static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno)
{}

/*
 * Readable error output
 */
#ifdef CONFIG_MMC_DEBUG
static void omap_hsmmc_dbg_report_irq(struct omap_hsmmc_host *host, u32 status)
{}
#else
static inline void omap_hsmmc_dbg_report_irq(struct omap_hsmmc_host *host,
					     u32 status)
{
}
#endif  /* CONFIG_MMC_DEBUG */

/*
 * MMC controller internal state machines reset
 *
 * Used to reset command or data internal state machines, using respectively
 *  SRC or SRD bit of SYSCTL register
 * Can be called from interrupt context
 */
static inline void omap_hsmmc_reset_controller_fsm(struct omap_hsmmc_host *host,
						   unsigned long bit)
{}

static void hsmmc_command_incomplete(struct omap_hsmmc_host *host,
					int err, int end_cmd)
{}

static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, int status)
{}

/*
 * MMC controller IRQ handler
 */
static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id)
{}

static void set_sd_bus_power(struct omap_hsmmc_host *host)
{}

/*
 * Switch MMC interface voltage ... only relevant for MMC1.
 *
 * MMC2 and MMC3 use fixed 1.8V levels, and maybe a transceiver.
 * The MMC2 transceiver controls are used instead of DAT4..DAT7.
 * Some chips, like eMMC ones, use internal transceivers.
 */
static int omap_hsmmc_switch_opcond(struct omap_hsmmc_host *host, int vdd)
{}

static void omap_hsmmc_dma_callback(void *param)
{}

static int omap_hsmmc_pre_dma_transfer(struct omap_hsmmc_host *host,
				       struct mmc_data *data,
				       struct omap_hsmmc_next *next,
				       struct dma_chan *chan)
{}

/*
 * Routine to configure and start DMA for the MMC card
 */
static int omap_hsmmc_setup_dma_transfer(struct omap_hsmmc_host *host,
					struct mmc_request *req)
{}

static void set_data_timeout(struct omap_hsmmc_host *host,
			     unsigned long long timeout_ns,
			     unsigned int timeout_clks)
{}

static void omap_hsmmc_start_dma_transfer(struct omap_hsmmc_host *host)
{}

/*
 * Configure block length for MMC/SD cards and initiate the transfer.
 */
static int
omap_hsmmc_prepare_data(struct omap_hsmmc_host *host, struct mmc_request *req)
{}

static void omap_hsmmc_post_req(struct mmc_host *mmc, struct mmc_request *mrq,
				int err)
{}

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

/*
 * Request function. for read/write operation
 */
static void omap_hsmmc_request(struct mmc_host *mmc, struct mmc_request *req)
{}

/* Routine to configure clock values. Exposed API to core */
static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
{}

static void omap_hsmmc_enable_sdio_irq(struct mmc_host *mmc, int enable)
{}

static int omap_hsmmc_configure_wake_irq(struct omap_hsmmc_host *host)
{}

static void omap_hsmmc_conf_bus_power(struct omap_hsmmc_host *host)
{}

static int omap_hsmmc_multi_io_quirk(struct mmc_card *card,
				     unsigned int direction, int blk_size)
{}

static struct mmc_host_ops omap_hsmmc_ops =;

#ifdef CONFIG_DEBUG_FS

static int mmc_regs_show(struct seq_file *s, void *data)
{}

DEFINE_SHOW_ATTRIBUTE();

static void omap_hsmmc_debugfs(struct mmc_host *mmc)
{}

#else

static void omap_hsmmc_debugfs(struct mmc_host *mmc)
{
}

#endif

#ifdef CONFIG_OF
static const struct omap_mmc_of_data omap3_pre_es3_mmc_of_data =;

static const struct omap_mmc_of_data omap4_mmc_of_data =;
static const struct omap_mmc_of_data am33xx_mmc_of_data =;

static const struct of_device_id omap_mmc_of_match[] =;
MODULE_DEVICE_TABLE(of, omap_mmc_of_match);

static struct omap_hsmmc_platform_data *of_get_hsmmc_pdata(struct device *dev)
{}
#else
static inline struct omap_hsmmc_platform_data
			*of_get_hsmmc_pdata(struct device *dev)
{
	return ERR_PTR(-EINVAL);
}
#endif

static int omap_hsmmc_probe(struct platform_device *pdev)
{}

static void omap_hsmmc_remove(struct platform_device *pdev)
{}

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

/* Routine to resume the MMC device */
static int omap_hsmmc_resume(struct device *dev)
{}
#endif

#ifdef CONFIG_PM
static int omap_hsmmc_runtime_suspend(struct device *dev)
{}

static int omap_hsmmc_runtime_resume(struct device *dev)
{}
#endif

static const struct dev_pm_ops omap_hsmmc_dev_pm_ops =;

static struct platform_driver omap_hsmmc_driver =;

module_platform_driver();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_ALIAS();
MODULE_AUTHOR();