linux/drivers/mmc/host/usdhi6rol0.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2013-2014 Renesas Electronics Europe Ltd.
 * Author: Guennadi Liakhovetski <[email protected]>
 */

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/dmaengine.h>
#include <linux/highmem.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/log2.h>
#include <linux/mmc/host.h>
#include <linux/mmc/mmc.h>
#include <linux/mmc/sd.h>
#include <linux/mmc/sdio.h>
#include <linux/module.h>
#include <linux/pagemap.h>
#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
#include <linux/scatterlist.h>
#include <linux/string.h>
#include <linux/time.h>
#include <linux/virtio.h>
#include <linux/workqueue.h>

#define USDHI6_SD_CMD
#define USDHI6_SD_PORT_SEL
#define USDHI6_SD_ARG
#define USDHI6_SD_STOP
#define USDHI6_SD_SECCNT
#define USDHI6_SD_RSP10
#define USDHI6_SD_RSP32
#define USDHI6_SD_RSP54
#define USDHI6_SD_RSP76
#define USDHI6_SD_INFO1
#define USDHI6_SD_INFO2
#define USDHI6_SD_INFO1_MASK
#define USDHI6_SD_INFO2_MASK
#define USDHI6_SD_CLK_CTRL
#define USDHI6_SD_SIZE
#define USDHI6_SD_OPTION
#define USDHI6_SD_ERR_STS1
#define USDHI6_SD_ERR_STS2
#define USDHI6_SD_BUF0
#define USDHI6_SDIO_MODE
#define USDHI6_SDIO_INFO1
#define USDHI6_SDIO_INFO1_MASK
#define USDHI6_CC_EXT_MODE
#define USDHI6_SOFT_RST
#define USDHI6_VERSION
#define USDHI6_HOST_MODE
#define USDHI6_SDIF_MODE

#define USDHI6_SD_CMD_APP
#define USDHI6_SD_CMD_MODE_RSP_AUTO
#define USDHI6_SD_CMD_MODE_RSP_NONE
#define USDHI6_SD_CMD_MODE_RSP_R1
#define USDHI6_SD_CMD_MODE_RSP_R1B
#define USDHI6_SD_CMD_MODE_RSP_R2
#define USDHI6_SD_CMD_MODE_RSP_R3
#define USDHI6_SD_CMD_DATA
#define USDHI6_SD_CMD_READ
#define USDHI6_SD_CMD_MULTI
#define USDHI6_SD_CMD_CMD12_AUTO_OFF

#define USDHI6_CC_EXT_MODE_SDRW

#define USDHI6_SD_INFO1_RSP_END
#define USDHI6_SD_INFO1_ACCESS_END
#define USDHI6_SD_INFO1_CARD_OUT
#define USDHI6_SD_INFO1_CARD_IN
#define USDHI6_SD_INFO1_CD
#define USDHI6_SD_INFO1_WP
#define USDHI6_SD_INFO1_D3_CARD_OUT
#define USDHI6_SD_INFO1_D3_CARD_IN

#define USDHI6_SD_INFO2_CMD_ERR
#define USDHI6_SD_INFO2_CRC_ERR
#define USDHI6_SD_INFO2_END_ERR
#define USDHI6_SD_INFO2_TOUT
#define USDHI6_SD_INFO2_IWA_ERR
#define USDHI6_SD_INFO2_IRA_ERR
#define USDHI6_SD_INFO2_RSP_TOUT
#define USDHI6_SD_INFO2_SDDAT0
#define USDHI6_SD_INFO2_BRE
#define USDHI6_SD_INFO2_BWE
#define USDHI6_SD_INFO2_SCLKDIVEN
#define USDHI6_SD_INFO2_CBSY
#define USDHI6_SD_INFO2_ILA

#define USDHI6_SD_INFO1_CARD_INSERT
#define USDHI6_SD_INFO1_CARD_EJECT
#define USDHI6_SD_INFO1_CARD
#define USDHI6_SD_INFO1_CARD_CD

#define USDHI6_SD_INFO2_ERR

#define USDHI6_SD_INFO1_IRQ

#define USDHI6_SD_INFO2_IRQ

#define USDHI6_SD_CLK_CTRL_SCLKEN

#define USDHI6_SD_STOP_STP
#define USDHI6_SD_STOP_SEC

#define USDHI6_SDIO_INFO1_IOIRQ
#define USDHI6_SDIO_INFO1_EXPUB52
#define USDHI6_SDIO_INFO1_EXWT

#define USDHI6_SD_ERR_STS1_CRC_NO_ERROR

#define USDHI6_SOFT_RST_RESERVED
#define USDHI6_SOFT_RST_RESET

#define USDHI6_SD_OPTION_TIMEOUT_SHIFT
#define USDHI6_SD_OPTION_TIMEOUT_MASK
#define USDHI6_SD_OPTION_WIDTH_1

#define USDHI6_SD_PORT_SEL_PORTS_SHIFT

#define USDHI6_SD_CLK_CTRL_DIV_MASK

#define USDHI6_SDIO_INFO1_IRQ

#define USDHI6_MIN_DMA

#define USDHI6_REQ_TIMEOUT_MS

enum usdhi6_wait_for {};

struct usdhi6_page {};

struct usdhi6_host {};

/*			I/O primitives					*/

static void usdhi6_write(struct usdhi6_host *host, u32 reg, u32 data)
{}

static void usdhi6_write16(struct usdhi6_host *host, u32 reg, u16 data)
{}

static u32 usdhi6_read(struct usdhi6_host *host, u32 reg)
{}

static u16 usdhi6_read16(struct usdhi6_host *host, u32 reg)
{}

static void usdhi6_irq_enable(struct usdhi6_host *host, u32 info1, u32 info2)
{}

static void usdhi6_wait_for_resp(struct usdhi6_host *host)
{}

static void usdhi6_wait_for_brwe(struct usdhi6_host *host, bool read)
{}

static void usdhi6_only_cd(struct usdhi6_host *host)
{}

static void usdhi6_mask_all(struct usdhi6_host *host)
{}

static int usdhi6_error_code(struct usdhi6_host *host)
{}

/*			Scatter-Gather management			*/

/*
 * In PIO mode we have to map each page separately, using kmap(). That way
 * adjacent pages are mapped to non-adjacent virtual addresses. That's why we
 * have to use a bounce buffer for blocks, crossing page boundaries. Such blocks
 * have been observed with an SDIO WiFi card (b43 driver).
 */
static void usdhi6_blk_bounce(struct usdhi6_host *host,
			      struct scatterlist *sg)
{}

/* Only called for multiple block IO */
static void usdhi6_sg_prep(struct usdhi6_host *host)
{}

/* Map the first page in an SG segment: common for multiple and single block IO */
static void *usdhi6_sg_map(struct usdhi6_host *host)
{}

/* Unmap the current page: common for multiple and single block IO */
static void usdhi6_sg_unmap(struct usdhi6_host *host, bool force)
{}

/* Called from MMC_WRITE_MULTIPLE_BLOCK or MMC_READ_MULTIPLE_BLOCK */
static void usdhi6_sg_advance(struct usdhi6_host *host)
{}

/*			DMA handling					*/

static void usdhi6_dma_release(struct usdhi6_host *host)
{}

static void usdhi6_dma_stop_unmap(struct usdhi6_host *host)
{}

static void usdhi6_dma_complete(void *arg)
{}

static int usdhi6_dma_setup(struct usdhi6_host *host, struct dma_chan *chan,
			    enum dma_transfer_direction dir)
{}

static int usdhi6_dma_start(struct usdhi6_host *host)
{}

static void usdhi6_dma_kill(struct usdhi6_host *host)
{}

static void usdhi6_dma_check_error(struct usdhi6_host *host)
{}

static void usdhi6_dma_kick(struct usdhi6_host *host)
{}

static void usdhi6_dma_request(struct usdhi6_host *host, phys_addr_t start)
{}

/*			API helpers					*/

static void usdhi6_clk_set(struct usdhi6_host *host, struct mmc_ios *ios)
{}

static void usdhi6_set_power(struct usdhi6_host *host, struct mmc_ios *ios)
{}

static int usdhi6_reset(struct usdhi6_host *host)
{}

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

/* This is data timeout. Response timeout is fixed to 640 clock cycles */
static void usdhi6_timeout_set(struct usdhi6_host *host)
{}

static void usdhi6_request_done(struct usdhi6_host *host)
{}

static int usdhi6_cmd_flags(struct usdhi6_host *host)
{}

static int usdhi6_rq_start(struct usdhi6_host *host)
{}

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

static int usdhi6_get_cd(struct mmc_host *mmc)
{}

static int usdhi6_get_ro(struct mmc_host *mmc)
{}

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

static int usdhi6_set_pinstates(struct usdhi6_host *host, int voltage)
{}

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

static int usdhi6_card_busy(struct mmc_host *mmc)
{}

static const struct mmc_host_ops usdhi6_ops =;

/*			State machine handlers				*/

static void usdhi6_resp_cmd12(struct usdhi6_host *host)
{}

static void usdhi6_resp_read(struct usdhi6_host *host)
{}

static int usdhi6_blk_read(struct usdhi6_host *host)
{}

static int usdhi6_blk_write(struct usdhi6_host *host)
{}

static int usdhi6_stop_cmd(struct usdhi6_host *host)
{}

static bool usdhi6_end_cmd(struct usdhi6_host *host)
{}

static bool usdhi6_read_block(struct usdhi6_host *host)
{}

static bool usdhi6_mread_block(struct usdhi6_host *host)
{}

static bool usdhi6_write_block(struct usdhi6_host *host)
{}

static bool usdhi6_mwrite_block(struct usdhi6_host *host)
{}

/*			Interrupt & timeout handlers			*/

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

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

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

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

/*
 * Actually this should not be needed, if the built-in timeout works reliably in
 * the both PIO cases and DMA never fails. But if DMA does fail, a timeout
 * handler might be the only way to catch the error.
 */
static void usdhi6_timeout_work(struct work_struct *work)
{}

/*			 Probe / release				*/

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

static int usdhi6_probe(struct platform_device *pdev)
{}

static void usdhi6_remove(struct platform_device *pdev)
{}

static struct platform_driver usdhi6_driver =;

module_platform_driver();

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