linux/drivers/mmc/host/dw_mmc.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Synopsys DesignWare Multimedia Card Interface driver
 *  (Based on NXP driver for lpc 31xx)
 *
 * Copyright (C) 2009 NXP Semiconductors
 * Copyright (C) 2009, 2010 Imagination Technologies Ltd.
 */

#include <linux/blkdev.h>
#include <linux/clk.h>
#include <linux/debugfs.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/iopoll.h>
#include <linux/ioport.h>
#include <linux/ktime.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/prandom.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/stat.h>
#include <linux/delay.h>
#include <linux/irq.h>
#include <linux/mmc/card.h>
#include <linux/mmc/host.h>
#include <linux/mmc/mmc.h>
#include <linux/mmc/sd.h>
#include <linux/mmc/sdio.h>
#include <linux/bitops.h>
#include <linux/regulator/consumer.h>
#include <linux/of.h>
#include <linux/mmc/slot-gpio.h>

#include "dw_mmc.h"

/* Common flag combinations */
#define DW_MCI_DATA_ERROR_FLAGS
#define DW_MCI_CMD_ERROR_FLAGS
#define DW_MCI_ERROR_FLAGS
#define DW_MCI_SEND_STATUS
#define DW_MCI_RECV_STATUS
#define DW_MCI_DMA_THRESHOLD

#define DW_MCI_FREQ_MAX
#define DW_MCI_FREQ_MIN

#define IDMAC_INT_CLR

#define DESC_RING_BUF_SZ

struct idmac_desc_64addr {};

struct idmac_desc {};

/* Each descriptor can transfer up to 4KB of data in chained mode */
#define DW_MCI_DESC_DATA_LENGTH

#if defined(CONFIG_DEBUG_FS)
static int dw_mci_req_show(struct seq_file *s, void *v)
{}
DEFINE_SHOW_ATTRIBUTE();

static int dw_mci_regs_show(struct seq_file *s, void *v)
{}
DEFINE_SHOW_ATTRIBUTE();

static void dw_mci_init_debugfs(struct dw_mci_slot *slot)
{}
#endif /* defined(CONFIG_DEBUG_FS) */

static bool dw_mci_ctrl_reset(struct dw_mci *host, u32 reset)
{}

static void dw_mci_wait_while_busy(struct dw_mci *host, u32 cmd_flags)
{}

static void mci_send_cmd(struct dw_mci_slot *slot, u32 cmd, u32 arg)
{}

static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd)
{}

static u32 dw_mci_prep_stop_abort(struct dw_mci *host, struct mmc_command *cmd)
{}

static inline void dw_mci_set_cto(struct dw_mci *host)
{}

static void dw_mci_start_command(struct dw_mci *host,
				 struct mmc_command *cmd, u32 cmd_flags)
{}

static inline void send_stop_abort(struct dw_mci *host, struct mmc_data *data)
{}

/* DMA interface functions */
static void dw_mci_stop_dma(struct dw_mci *host)
{}

static void dw_mci_dma_cleanup(struct dw_mci *host)
{}

static void dw_mci_idmac_reset(struct dw_mci *host)
{}

static void dw_mci_idmac_stop_dma(struct dw_mci *host)
{}

static void dw_mci_dmac_complete_dma(void *arg)
{}

static int dw_mci_idmac_init(struct dw_mci *host)
{}

static inline int dw_mci_prepare_desc64(struct dw_mci *host,
					 struct mmc_data *data,
					 unsigned int sg_len)
{}


static inline int dw_mci_prepare_desc32(struct dw_mci *host,
					 struct mmc_data *data,
					 unsigned int sg_len)
{}

static int dw_mci_idmac_start_dma(struct dw_mci *host, unsigned int sg_len)
{}

static const struct dw_mci_dma_ops dw_mci_idmac_ops =;

static void dw_mci_edmac_stop_dma(struct dw_mci *host)
{}

static int dw_mci_edmac_start_dma(struct dw_mci *host,
					    unsigned int sg_len)
{}

static int dw_mci_edmac_init(struct dw_mci *host)
{}

static void dw_mci_edmac_exit(struct dw_mci *host)
{}

static const struct dw_mci_dma_ops dw_mci_edmac_ops =;

static int dw_mci_pre_dma_transfer(struct dw_mci *host,
				   struct mmc_data *data,
				   int cookie)
{}

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

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

static int dw_mci_get_cd(struct mmc_host *mmc)
{}

static void dw_mci_adjust_fifoth(struct dw_mci *host, struct mmc_data *data)
{}

static void dw_mci_ctrl_thld(struct dw_mci *host, struct mmc_data *data)
{}

static int dw_mci_submit_data_dma(struct dw_mci *host, struct mmc_data *data)
{}

static void dw_mci_submit_data(struct dw_mci *host, struct mmc_data *data)
{}

static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit)
{}

static void dw_mci_set_data_timeout(struct dw_mci *host,
				    unsigned int timeout_ns)
{}

static void __dw_mci_start_request(struct dw_mci *host,
				   struct dw_mci_slot *slot,
				   struct mmc_command *cmd)
{}

static void dw_mci_start_request(struct dw_mci *host,
				 struct dw_mci_slot *slot)
{}

/* must be called with host->lock held */
static void dw_mci_queue_request(struct dw_mci *host, struct dw_mci_slot *slot,
				 struct mmc_request *mrq)
{}

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

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

static int dw_mci_card_busy(struct mmc_host *mmc)
{}

static int dw_mci_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios)
{}

static int dw_mci_get_ro(struct mmc_host *mmc)
{}

static void dw_mci_hw_reset(struct mmc_host *mmc)
{}

static void dw_mci_prepare_sdio_irq(struct dw_mci_slot *slot, bool prepare)
{}

static void __dw_mci_enable_sdio_irq(struct dw_mci_slot *slot, int enb)
{}

static void dw_mci_enable_sdio_irq(struct mmc_host *mmc, int enb)
{}

static void dw_mci_ack_sdio_irq(struct mmc_host *mmc)
{}

static int dw_mci_execute_tuning(struct mmc_host *mmc, u32 opcode)
{}

static int dw_mci_prepare_hs400_tuning(struct mmc_host *mmc,
				       struct mmc_ios *ios)
{}

static bool dw_mci_reset(struct dw_mci *host)
{}

static const struct mmc_host_ops dw_mci_ops =;

#ifdef CONFIG_FAULT_INJECTION
static enum hrtimer_restart dw_mci_fault_timer(struct hrtimer *t)
{}

static void dw_mci_start_fault_timer(struct dw_mci *host)
{}

static void dw_mci_stop_fault_timer(struct dw_mci *host)
{}

static void dw_mci_init_fault(struct dw_mci *host)
{}
#else
static void dw_mci_init_fault(struct dw_mci *host)
{
}

static void dw_mci_start_fault_timer(struct dw_mci *host)
{
}

static void dw_mci_stop_fault_timer(struct dw_mci *host)
{
}
#endif

static void dw_mci_request_end(struct dw_mci *host, struct mmc_request *mrq)
	__releases(&host->lock)
	__acquires(&host->lock)
{}

static int dw_mci_command_complete(struct dw_mci *host, struct mmc_command *cmd)
{}

static int dw_mci_data_complete(struct dw_mci *host, struct mmc_data *data)
{}

static void dw_mci_set_drto(struct dw_mci *host)
{}

static bool dw_mci_clear_pending_cmd_complete(struct dw_mci *host)
{}

static bool dw_mci_clear_pending_data_complete(struct dw_mci *host)
{}

static void dw_mci_work_func(struct work_struct *t)
{}

/* push final bytes to part_buf, only use during push */
static void dw_mci_set_part_bytes(struct dw_mci *host, void *buf, int cnt)
{}

/* append bytes to part_buf, only use during push */
static int dw_mci_push_part_bytes(struct dw_mci *host, void *buf, int cnt)
{}

/* pull first bytes from part_buf, only use during pull */
static int dw_mci_pull_part_bytes(struct dw_mci *host, void *buf, int cnt)
{}

/* pull final bytes from the part_buf, assuming it's just been filled */
static void dw_mci_pull_final_bytes(struct dw_mci *host, void *buf, int cnt)
{}

static void dw_mci_push_data16(struct dw_mci *host, void *buf, int cnt)
{}

static void dw_mci_pull_data16(struct dw_mci *host, void *buf, int cnt)
{}

static void dw_mci_push_data32(struct dw_mci *host, void *buf, int cnt)
{}

static void dw_mci_pull_data32(struct dw_mci *host, void *buf, int cnt)
{}

static void dw_mci_push_data64(struct dw_mci *host, void *buf, int cnt)
{}

static void dw_mci_pull_data64(struct dw_mci *host, void *buf, int cnt)
{}

static void dw_mci_pull_data(struct dw_mci *host, void *buf, int cnt)
{}

static void dw_mci_read_data_pio(struct dw_mci *host, bool dto)
{}

static void dw_mci_write_data_pio(struct dw_mci *host)
{}

static void dw_mci_cmd_interrupt(struct dw_mci *host, u32 status)
{}

static void dw_mci_handle_cd(struct dw_mci *host)
{}

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

static int dw_mci_init_slot_caps(struct dw_mci_slot *slot)
{}

static int dw_mci_init_slot(struct dw_mci *host)
{}

static void dw_mci_cleanup_slot(struct dw_mci_slot *slot)
{}

static void dw_mci_init_dma(struct dw_mci *host)
{}

static void dw_mci_cmd11_timer(struct timer_list *t)
{}

static void dw_mci_cto_timer(struct timer_list *t)
{}

static void dw_mci_dto_timer(struct timer_list *t)
{}

#ifdef CONFIG_OF
static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
{}

#else /* CONFIG_OF */
static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
{
	return ERR_PTR(-EINVAL);
}
#endif /* CONFIG_OF */

static void dw_mci_enable_cd(struct dw_mci *host)
{}

int dw_mci_probe(struct dw_mci *host)
{}
EXPORT_SYMBOL();

void dw_mci_remove(struct dw_mci *host)
{}
EXPORT_SYMBOL();



#ifdef CONFIG_PM
int dw_mci_runtime_suspend(struct device *dev)
{}
EXPORT_SYMBOL();

int dw_mci_runtime_resume(struct device *dev)
{}
EXPORT_SYMBOL();
#endif /* CONFIG_PM */

static int __init dw_mci_init(void)
{}

static void __exit dw_mci_exit(void)
{}

module_init();
module_exit(dw_mci_exit);

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