linux/drivers/mmc/host/tmio_mmc.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Driver for the MMC / SD / SDIO cell found in:
 *
 * TC6393XB TC6391XB TC6387XB T7L66XB ASIC3
 *
 * Copyright (C) 2015-19 Renesas Electronics Corporation
 * Copyright (C) 2016-19 Sang Engineering, Wolfram Sang
 * Copyright (C) 2016-17 Horms Solutions, Simon Horman
 * Copyright (C) 2007 Ian Molton
 * Copyright (C) 2004 Ian Molton
 */

#ifndef TMIO_MMC_H
#define TMIO_MMC_H

#include <linux/dmaengine.h>
#include <linux/highmem.h>
#include <linux/mutex.h>
#include <linux/pagemap.h>
#include <linux/scatterlist.h>
#include <linux/spinlock.h>
#include <linux/interrupt.h>
#include <linux/workqueue.h>

#define CTL_SD_CMD
#define CTL_ARG_REG
#define CTL_STOP_INTERNAL_ACTION
#define CTL_XFER_BLK_COUNT
#define CTL_RESPONSE
/* driver merges STATUS and following STATUS2 */
#define CTL_STATUS
/* driver merges IRQ_MASK and following IRQ_MASK2 */
#define CTL_IRQ_MASK
#define CTL_SD_CARD_CLK_CTL
#define CTL_SD_XFER_LEN
#define CTL_SD_MEM_CARD_OPT
#define CTL_SD_ERROR_DETAIL_STATUS
#define CTL_SD_DATA_PORT
#define CTL_TRANSACTION_CTL
#define CTL_SDIO_STATUS
#define CTL_SDIO_IRQ_MASK
#define CTL_DMA_ENABLE
#define CTL_RESET_SD
#define CTL_VERSION
#define CTL_SDIF_MODE

/* Definitions for values the CTL_STOP_INTERNAL_ACTION register can take */
#define TMIO_STOP_STP
#define TMIO_STOP_SEC

/* Definitions for values the CTL_STATUS register can take */
#define TMIO_STAT_CMDRESPEND
#define TMIO_STAT_DATAEND
#define TMIO_STAT_CARD_REMOVE
#define TMIO_STAT_CARD_INSERT
#define TMIO_STAT_SIGSTATE
#define TMIO_STAT_WRPROTECT
#define TMIO_STAT_CARD_REMOVE_A
#define TMIO_STAT_CARD_INSERT_A
#define TMIO_STAT_SIGSTATE_A

/* These belong technically to CTL_STATUS2, but the driver merges them */
#define TMIO_STAT_CMD_IDX_ERR
#define TMIO_STAT_CRCFAIL
#define TMIO_STAT_STOPBIT_ERR
#define TMIO_STAT_DATATIMEOUT
#define TMIO_STAT_RXOVERFLOW
#define TMIO_STAT_TXUNDERRUN
#define TMIO_STAT_CMDTIMEOUT
#define TMIO_STAT_DAT0
#define TMIO_STAT_RXRDY
#define TMIO_STAT_TXRQ
#define TMIO_STAT_ALWAYS_SET_27
#define TMIO_STAT_ILL_FUNC
#define TMIO_STAT_SCLKDIVEN
#define TMIO_STAT_CMD_BUSY
#define TMIO_STAT_ILL_ACCESS

/* Definitions for values the CTL_SD_CARD_CLK_CTL register can take */
#define CLK_CTL_DIV_MASK
#define CLK_CTL_SCLKEN

/* Definitions for values the CTL_SD_MEM_CARD_OPT register can take */
#define CARD_OPT_TOP_MASK
#define CARD_OPT_TOP_SHIFT
#define CARD_OPT_EXTOP
#define CARD_OPT_WIDTH8
#define CARD_OPT_ALWAYS1
#define CARD_OPT_WIDTH

/* Definitions for values the CTL_SDIO_STATUS register can take */
#define TMIO_SDIO_STAT_IOIRQ
#define TMIO_SDIO_STAT_EXPUB52
#define TMIO_SDIO_STAT_EXWT
#define TMIO_SDIO_MASK_ALL

#define TMIO_SDIO_SETBITS_MASK

/* Definitions for values the CTL_DMA_ENABLE register can take */
#define DMA_ENABLE_DMASDRW

/* Definitions for values the CTL_SDIF_MODE register can take */
#define SDIF_MODE_HS400

/* Define some IRQ masks */
/* This is the mask used at reset by the chip */
#define TMIO_MASK_ALL
#define TMIO_MASK_ALL_RCAR2
#define TMIO_MASK_READOP
#define TMIO_MASK_WRITEOP
#define TMIO_MASK_CMD
#define TMIO_MASK_IRQ

#define TMIO_MAX_BLK_SIZE

struct tmio_mmc_data;
struct tmio_mmc_host;

struct tmio_mmc_dma_ops {};

struct tmio_mmc_host {};

struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev,
					  struct tmio_mmc_data *pdata);
void tmio_mmc_host_free(struct tmio_mmc_host *host);
int tmio_mmc_host_probe(struct tmio_mmc_host *host);
void tmio_mmc_host_remove(struct tmio_mmc_host *host);
void tmio_mmc_do_data_irq(struct tmio_mmc_host *host);

void tmio_mmc_enable_mmc_irqs(struct tmio_mmc_host *host, u32 i);
void tmio_mmc_disable_mmc_irqs(struct tmio_mmc_host *host, u32 i);
irqreturn_t tmio_mmc_irq(int irq, void *devid);

#ifdef CONFIG_PM
int tmio_mmc_host_runtime_suspend(struct device *dev);
int tmio_mmc_host_runtime_resume(struct device *dev);
#endif

static inline u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr)
{}

static inline void sd_ctrl_read16_rep(struct tmio_mmc_host *host, int addr,
				      u16 *buf, int count)
{}

static inline u32 sd_ctrl_read16_and_16_as_32(struct tmio_mmc_host *host,
					      int addr)
{}

static inline void sd_ctrl_read32_rep(struct tmio_mmc_host *host, int addr,
				      u32 *buf, int count)
{}

static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr,
				   u16 val)
{}

static inline void sd_ctrl_write16_rep(struct tmio_mmc_host *host, int addr,
				       u16 *buf, int count)
{}

static inline void sd_ctrl_write32_as_16_and_16(struct tmio_mmc_host *host,
						int addr, u32 val)
{}

static inline void sd_ctrl_write32(struct tmio_mmc_host *host, int addr, u32 val)
{}

static inline void sd_ctrl_write32_rep(struct tmio_mmc_host *host, int addr,
				       const u32 *buf, int count)
{}

#endif