linux/drivers/mmc/host/renesas_sdhi_core.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Renesas SDHI
 *
 * 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) 2009 Magnus Damm
 *
 * Based on "Compaq ASIC3 support":
 *
 * Copyright 2001 Compaq Computer Corporation.
 * Copyright 2004-2005 Phil Blundell
 * Copyright 2007-2008 OpenedHand Ltd.
 *
 * Authors: Phil Blundell <[email protected]>,
 *	    Samuel Ortiz <[email protected]>
 *
 */

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/mmc/host.h>
#include <linux/mmc/mmc.h>
#include <linux/mmc/slot-gpio.h>
#include <linux/module.h>
#include <linux/pinctrl/consumer.h>
#include <linux/pinctrl/pinctrl-state.h>
#include <linux/platform_data/tmio.h>
#include <linux/platform_device.h>
#include <linux/pm_domain.h>
#include <linux/regulator/consumer.h>
#include <linux/reset.h>
#include <linux/sh_dma.h>
#include <linux/slab.h>

#include "renesas_sdhi.h"
#include "tmio_mmc.h"

#define CTL_HOST_MODE
#define HOST_MODE_GEN2_SDR50_WMODE
#define HOST_MODE_GEN2_SDR104_WMODE
#define HOST_MODE_GEN3_WMODE
#define HOST_MODE_GEN3_BUSWIDTH

#define HOST_MODE_GEN3_16BIT
#define HOST_MODE_GEN3_32BIT
#define HOST_MODE_GEN3_64BIT

#define SDHI_VER_GEN2_SDR50
#define SDHI_VER_RZ_A1
/* very old datasheets said 0x490c for SDR104, too. They are wrong! */
#define SDHI_VER_GEN2_SDR104
#define SDHI_VER_GEN3_SD
#define SDHI_VER_GEN3_SDMMC

#define SDHI_GEN3_MMC0_ADDR

static void renesas_sdhi_sdbuf_width(struct tmio_mmc_host *host, int width)
{}

static int renesas_sdhi_clk_enable(struct tmio_mmc_host *host)
{}

static unsigned int renesas_sdhi_clk_update(struct tmio_mmc_host *host,
					    unsigned int wanted_clock)
{}

static void renesas_sdhi_set_clock(struct tmio_mmc_host *host,
				   unsigned int new_clock)
{}

static void renesas_sdhi_clk_disable(struct tmio_mmc_host *host)
{}

static int renesas_sdhi_card_busy(struct mmc_host *mmc)
{}

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

/* SCC registers */
#define SH_MOBILE_SDHI_SCC_DTCNTL
#define SH_MOBILE_SDHI_SCC_TAPSET
#define SH_MOBILE_SDHI_SCC_DT2FF
#define SH_MOBILE_SDHI_SCC_CKSEL
#define SH_MOBILE_SDHI_SCC_RVSCNTL
#define SH_MOBILE_SDHI_SCC_RVSREQ
#define SH_MOBILE_SDHI_SCC_SMPCMP
#define SH_MOBILE_SDHI_SCC_TMPPORT2
#define SH_MOBILE_SDHI_SCC_TMPPORT3
#define SH_MOBILE_SDHI_SCC_TMPPORT4
#define SH_MOBILE_SDHI_SCC_TMPPORT5
#define SH_MOBILE_SDHI_SCC_TMPPORT6
#define SH_MOBILE_SDHI_SCC_TMPPORT7

#define SH_MOBILE_SDHI_SCC_DTCNTL_TAPEN
#define SH_MOBILE_SDHI_SCC_DTCNTL_TAPNUM_SHIFT
#define SH_MOBILE_SDHI_SCC_DTCNTL_TAPNUM_MASK

#define SH_MOBILE_SDHI_SCC_CKSEL_DTSEL

#define SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN

#define SH_MOBILE_SDHI_SCC_RVSREQ_REQTAPDOWN
#define SH_MOBILE_SDHI_SCC_RVSREQ_REQTAPUP
#define SH_MOBILE_SDHI_SCC_RVSREQ_RVSERR

#define SH_MOBILE_SDHI_SCC_SMPCMP_CMD_REQDOWN
#define SH_MOBILE_SDHI_SCC_SMPCMP_CMD_REQUP
#define SH_MOBILE_SDHI_SCC_SMPCMP_CMD_ERR

#define SH_MOBILE_SDHI_SCC_TMPPORT2_HS400OSEL
#define SH_MOBILE_SDHI_SCC_TMPPORT2_HS400EN

/* Definitions for values the SH_MOBILE_SDHI_SCC_TMPPORT4 register */
#define SH_MOBILE_SDHI_SCC_TMPPORT4_DLL_ACC_START

/* Definitions for values the SH_MOBILE_SDHI_SCC_TMPPORT5 register */
#define SH_MOBILE_SDHI_SCC_TMPPORT5_DLL_RW_SEL_R
#define SH_MOBILE_SDHI_SCC_TMPPORT5_DLL_RW_SEL_W
#define SH_MOBILE_SDHI_SCC_TMPPORT5_DLL_ADR_MASK

/* Definitions for values the SH_MOBILE_SDHI_SCC register */
#define SH_MOBILE_SDHI_SCC_TMPPORT_DISABLE_WP_CODE
#define SH_MOBILE_SDHI_SCC_TMPPORT_CALIB_CODE_MASK
#define SH_MOBILE_SDHI_SCC_TMPPORT_MANUAL_MODE

static inline u32 sd_scc_read32(struct tmio_mmc_host *host,
				struct renesas_sdhi *priv, int addr)
{}

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

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

static void renesas_sdhi_hs400_complete(struct mmc_host *mmc)
{}

static void renesas_sdhi_disable_scc(struct mmc_host *mmc)
{}

static u32 sd_scc_tmpport_read32(struct tmio_mmc_host *host,
				 struct renesas_sdhi *priv, u32 addr)
{}

static void sd_scc_tmpport_write32(struct tmio_mmc_host *host,
				   struct renesas_sdhi *priv, u32 addr, u32 val)
{}

static void renesas_sdhi_adjust_hs400_mode_enable(struct tmio_mmc_host *host)
{}

static void renesas_sdhi_adjust_hs400_mode_disable(struct tmio_mmc_host *host)
{}

static void renesas_sdhi_reset_hs400_mode(struct tmio_mmc_host *host,
					  struct renesas_sdhi *priv)
{}

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

static void renesas_sdhi_scc_reset(struct tmio_mmc_host *host, struct renesas_sdhi *priv)
{}

/* only populated for TMIO_MMC_MIN_RCAR2 */
static void renesas_sdhi_reset(struct tmio_mmc_host *host, bool preserve)
{}

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

#define SH_MOBILE_SDHI_MIN_TAP_ROW

static int renesas_sdhi_select_tuning(struct tmio_mmc_host *host)
{}

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

static bool renesas_sdhi_manual_correction(struct tmio_mmc_host *host, bool use_4tap)
{}

static bool renesas_sdhi_auto_correction(struct tmio_mmc_host *host)
{}

static bool renesas_sdhi_check_scc_error(struct tmio_mmc_host *host,
					 struct mmc_request *mrq)
{}

static int renesas_sdhi_wait_idle(struct tmio_mmc_host *host, u32 bit)
{}

static int renesas_sdhi_write16_hook(struct tmio_mmc_host *host, int addr)
{}

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

static void renesas_sdhi_fixup_request(struct tmio_mmc_host *host, struct mmc_request *mrq)
{}
static void renesas_sdhi_enable_dma(struct tmio_mmc_host *host, bool enable)
{}

int renesas_sdhi_probe(struct platform_device *pdev,
		       const struct tmio_mmc_dma_ops *dma_ops,
		       const struct renesas_sdhi_of_data *of_data,
		       const struct renesas_sdhi_quirks *quirks)
{}
EXPORT_SYMBOL_GPL();

void renesas_sdhi_remove(struct platform_device *pdev)
{}
EXPORT_SYMBOL_GPL();

MODULE_DESCRIPTION();
MODULE_LICENSE();