linux/drivers/mmc/host/tmio_mmc_core.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Driver for the MMC / SD / SDIO IP found in:
 *
 * TC6393XB, TC6391XB, TC6387XB, T7L66XB, ASIC3, SH-Mobile SoCs
 *
 * Copyright (C) 2015-19 Renesas Electronics Corporation
 * Copyright (C) 2016-19 Sang Engineering, Wolfram Sang
 * Copyright (C) 2017 Horms Solutions, Simon Horman
 * Copyright (C) 2011 Guennadi Liakhovetski
 * Copyright (C) 2007 Ian Molton
 * Copyright (C) 2004 Ian Molton
 *
 * This driver draws mainly on scattered spec sheets, Reverse engineering
 * of the toshiba e800  SD driver and some parts of the 2.4 ASIC3 driver (4 bit
 * support). (Further 4 bit support from a later datasheet).
 *
 * TODO:
 *   Investigate using a workqueue for PIO transfers
 *   Eliminate FIXMEs
 *   Better Power management
 *   Handle MMC errors better
 *   double buffer support
 *
 */

#include <linux/delay.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/highmem.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/mmc/card.h>
#include <linux/mmc/host.h>
#include <linux/mmc/mmc.h>
#include <linux/mmc/slot-gpio.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/pagemap.h>
#include <linux/platform_data/tmio.h>
#include <linux/platform_device.h>
#include <linux/pm_qos.h>
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
#include <linux/mmc/sdio.h>
#include <linux/scatterlist.h>
#include <linux/sizes.h>
#include <linux/spinlock.h>
#include <linux/workqueue.h>

#include "tmio_mmc.h"

static inline void tmio_mmc_start_dma(struct tmio_mmc_host *host,
				      struct mmc_data *data)
{}

static inline void tmio_mmc_end_dma(struct tmio_mmc_host *host)
{}

static inline void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
{}

static inline void tmio_mmc_request_dma(struct tmio_mmc_host *host,
					struct tmio_mmc_data *pdata)
{}

static inline void tmio_mmc_release_dma(struct tmio_mmc_host *host)
{}

static inline void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
{}

static inline void tmio_mmc_dataend_dma(struct tmio_mmc_host *host)
{}

void tmio_mmc_enable_mmc_irqs(struct tmio_mmc_host *host, u32 i)
{}
EXPORT_SYMBOL_GPL();

void tmio_mmc_disable_mmc_irqs(struct tmio_mmc_host *host, u32 i)
{}
EXPORT_SYMBOL_GPL();

static void tmio_mmc_ack_mmc_irqs(struct tmio_mmc_host *host, u32 i)
{}

static void tmio_mmc_init_sg(struct tmio_mmc_host *host, struct mmc_data *data)
{}

static int tmio_mmc_next_sg(struct tmio_mmc_host *host)
{}

#define CMDREQ_TIMEOUT

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

static void tmio_mmc_set_bus_width(struct tmio_mmc_host *host,
				   unsigned char bus_width)
{}

static void tmio_mmc_reset(struct tmio_mmc_host *host, bool preserve)
{}

static void tmio_mmc_reset_work(struct work_struct *work)
{}

/* These are the bitmasks the tmio chip requires to implement the MMC response
 * types. Note that R1 and R6 are the same in this scheme. */
#define APP_CMD
#define RESP_NONE
#define RESP_R1
#define RESP_R1B
#define RESP_R2
#define RESP_R3
#define DATA_PRESENT
#define TRANSFER_READ
#define TRANSFER_MULTI
#define SECURITY_CMD
#define NO_CMD12_ISSUE

static int tmio_mmc_start_command(struct tmio_mmc_host *host,
				  struct mmc_command *cmd)
{}

static void tmio_mmc_transfer_data(struct tmio_mmc_host *host,
				   unsigned short *buf,
				   unsigned int count)
{}

/*
 * This chip always returns (at least?) as much data as you ask for.
 * I'm unsure what happens if you ask for less than a block. This should be
 * looked into to ensure that a funny length read doesn't hose the controller.
 */
static void tmio_mmc_pio_irq(struct tmio_mmc_host *host)
{}

static void tmio_mmc_check_bounce_buffer(struct tmio_mmc_host *host)
{}

/* needs to be called with host->lock held */
void tmio_mmc_do_data_irq(struct tmio_mmc_host *host)
{}
EXPORT_SYMBOL_GPL();

static void tmio_mmc_data_irq(struct tmio_mmc_host *host, unsigned int stat)
{}

static void tmio_mmc_cmd_irq(struct tmio_mmc_host *host, unsigned int stat)
{}

static bool __tmio_mmc_card_detect_irq(struct tmio_mmc_host *host,
				       int ireg, int status)
{}

static bool __tmio_mmc_sdcard_irq(struct tmio_mmc_host *host, int ireg,
				  int status)
{}

static bool __tmio_mmc_sdio_irq(struct tmio_mmc_host *host)
{}

irqreturn_t tmio_mmc_irq(int irq, void *devid)
{}
EXPORT_SYMBOL_GPL();

static int tmio_mmc_start_data(struct tmio_mmc_host *host,
			       struct mmc_data *data)
{}

static void tmio_process_mrq(struct tmio_mmc_host *host,
			     struct mmc_request *mrq)
{}

/* Process requests from the MMC layer */
static void tmio_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
{}

static void tmio_mmc_finish_request(struct tmio_mmc_host *host)
{}

static void tmio_mmc_done_work(struct work_struct *work)
{}

static void tmio_mmc_power_on(struct tmio_mmc_host *host, unsigned short vdd)
{}

static void tmio_mmc_power_off(struct tmio_mmc_host *host)
{}

static unsigned int tmio_mmc_get_timeout_cycles(struct tmio_mmc_host *host)
{}

static void tmio_mmc_max_busy_timeout(struct tmio_mmc_host *host)
{}

/* Set MMC clock / power.
 * Note: This controller uses a simple divider scheme therefore it cannot
 * run a MMC card at full speed (20MHz). The max clock is 24MHz on SD, but as
 * MMC wont run that fast, it has to be clocked at 12MHz which is the next
 * slowest setting.
 */
static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
{}

static int tmio_mmc_get_ro(struct mmc_host *mmc)
{}

static int tmio_mmc_get_cd(struct mmc_host *mmc)
{}

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

static struct mmc_host_ops tmio_mmc_ops =;

static int tmio_mmc_init_ocr(struct tmio_mmc_host *host)
{}

static void tmio_mmc_of_parse(struct platform_device *pdev,
			      struct mmc_host *mmc)
{}

struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev,
					  struct tmio_mmc_data *pdata)
{}
EXPORT_SYMBOL_GPL();

void tmio_mmc_host_free(struct tmio_mmc_host *host)
{}
EXPORT_SYMBOL_GPL();

int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
{}
EXPORT_SYMBOL_GPL();

void tmio_mmc_host_remove(struct tmio_mmc_host *host)
{}
EXPORT_SYMBOL_GPL();

#ifdef CONFIG_PM
static int tmio_mmc_clk_enable(struct tmio_mmc_host *host)
{}

static void tmio_mmc_clk_disable(struct tmio_mmc_host *host)
{}

int tmio_mmc_host_runtime_suspend(struct device *dev)
{}
EXPORT_SYMBOL_GPL();

int tmio_mmc_host_runtime_resume(struct device *dev)
{}
EXPORT_SYMBOL_GPL();
#endif

MODULE_DESCRIPTION();
MODULE_LICENSE();