linux/drivers/mmc/host/sdhci-pci-core.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*  linux/drivers/mmc/host/sdhci-pci.c - SDHCI on PCI bus interface
 *
 *  Copyright (C) 2005-2008 Pierre Ossman, All Rights Reserved.
 *
 * Thanks to the following companies for their support:
 *
 *     - JMicron (hardware and technical support)
 */

#include <linux/bitfield.h>
#include <linux/string.h>
#include <linux/delay.h>
#include <linux/highmem.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/slab.h>
#include <linux/device.h>
#include <linux/scatterlist.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/gpio.h>
#include <linux/pm_runtime.h>
#include <linux/pm_qos.h>
#include <linux/debugfs.h>
#include <linux/acpi.h>
#include <linux/dmi.h>

#include <linux/mmc/host.h>
#include <linux/mmc/mmc.h>
#include <linux/mmc/slot-gpio.h>

#ifdef CONFIG_X86
#include <asm/iosf_mbi.h>
#endif

#include "cqhci.h"

#include "sdhci.h"
#include "sdhci-cqhci.h"
#include "sdhci-pci.h"

static void sdhci_pci_hw_reset(struct sdhci_host *host);

#ifdef CONFIG_PM_SLEEP
static int sdhci_pci_init_wakeup(struct sdhci_pci_chip *chip)
{}

static int sdhci_pci_suspend_host(struct sdhci_pci_chip *chip)
{}

int sdhci_pci_resume_host(struct sdhci_pci_chip *chip)
{}

static int sdhci_cqhci_suspend(struct sdhci_pci_chip *chip)
{}

static int sdhci_cqhci_resume(struct sdhci_pci_chip *chip)
{}
#endif

#ifdef CONFIG_PM
static int sdhci_pci_runtime_suspend_host(struct sdhci_pci_chip *chip)
{}

static int sdhci_pci_runtime_resume_host(struct sdhci_pci_chip *chip)
{}

static int sdhci_cqhci_runtime_suspend(struct sdhci_pci_chip *chip)
{}

static int sdhci_cqhci_runtime_resume(struct sdhci_pci_chip *chip)
{}
#endif

static u32 sdhci_cqhci_irq(struct sdhci_host *host, u32 intmask)
{}

static void sdhci_pci_dumpregs(struct mmc_host *mmc)
{}

/*****************************************************************************\
 *                                                                           *
 * Hardware specific quirk handling                                          *
 *                                                                           *
\*****************************************************************************/

static int ricoh_probe(struct sdhci_pci_chip *chip)
{}

static int ricoh_mmc_probe_slot(struct sdhci_pci_slot *slot)
{}

#ifdef CONFIG_PM_SLEEP
static int ricoh_mmc_resume(struct sdhci_pci_chip *chip)
{}
#endif

static const struct sdhci_pci_fixes sdhci_ricoh =;

static const struct sdhci_pci_fixes sdhci_ricoh_mmc =;

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

static int ene_714_probe_slot(struct sdhci_pci_slot *slot)
{}

static const struct sdhci_pci_fixes sdhci_ene_712 =;

static const struct sdhci_pci_fixes sdhci_ene_714 =;

static const struct sdhci_pci_fixes sdhci_cafe =;

static const struct sdhci_pci_fixes sdhci_intel_qrk =;

static int mrst_hc_probe_slot(struct sdhci_pci_slot *slot)
{}

/*
 * ADMA operation is disabled for Moorestown platform due to
 * hardware bugs.
 */
static int mrst_hc_probe(struct sdhci_pci_chip *chip)
{}

static int pch_hc_probe_slot(struct sdhci_pci_slot *slot)
{}

static int mfd_emmc_probe_slot(struct sdhci_pci_slot *slot)
{}

static int mfd_sdio_probe_slot(struct sdhci_pci_slot *slot)
{}

static const struct sdhci_pci_fixes sdhci_intel_mrst_hc0 =;

static const struct sdhci_pci_fixes sdhci_intel_mrst_hc1_hc2 =;

static const struct sdhci_pci_fixes sdhci_intel_mfd_sd =;

static const struct sdhci_pci_fixes sdhci_intel_mfd_sdio =;

static const struct sdhci_pci_fixes sdhci_intel_mfd_emmc =;

static const struct sdhci_pci_fixes sdhci_intel_pch_sdio =;

#ifdef CONFIG_X86

#define BYT_IOSF_SCCEP
#define BYT_IOSF_OCP_NETCTRL0
#define BYT_IOSF_OCP_TIMEOUT_BASE

static void byt_ocp_setting(struct pci_dev *pdev)
{}

#else

static inline void byt_ocp_setting(struct pci_dev *pdev)
{
}

#endif

enum {};

struct intel_host {};

static const guid_t intel_dsm_guid =;

static int __intel_dsm(struct intel_host *intel_host, struct device *dev,
		       unsigned int fn, u32 *result)
{}

static int intel_dsm(struct intel_host *intel_host, struct device *dev,
		     unsigned int fn, u32 *result)
{}

static void intel_dsm_init(struct intel_host *intel_host, struct device *dev,
			   struct mmc_host *mmc)
{}

static void sdhci_pci_int_hw_reset(struct sdhci_host *host)
{}

static int intel_select_drive_strength(struct mmc_card *card,
				       unsigned int max_dtr, int host_drv,
				       int card_drv, int *drv_type)
{}

static int bxt_get_cd(struct mmc_host *mmc)
{}

static int mrfld_get_cd(struct mmc_host *mmc)
{}

#define SDHCI_INTEL_PWR_TIMEOUT_CNT
#define SDHCI_INTEL_PWR_TIMEOUT_UDELAY

static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode,
				  unsigned short vdd)
{}

static void sdhci_intel_set_uhs_signaling(struct sdhci_host *host,
					  unsigned int timing)
{}

#define INTEL_HS400_ES_REG
#define INTEL_HS400_ES_BIT

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

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

static const struct sdhci_ops sdhci_intel_byt_ops =;

static const struct sdhci_ops sdhci_intel_glk_ops =;

static void byt_read_dsm(struct sdhci_pci_slot *slot)
{}

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

#define INTEL_ACTIVELTR
#define INTEL_IDLELTR

#define INTEL_LTR_REQ
#define INTEL_LTR_SCALE_MASK
#define INTEL_LTR_SCALE_1US
#define INTEL_LTR_SCALE_32US
#define INTEL_LTR_VALUE_MASK

static void intel_cache_ltr(struct sdhci_pci_slot *slot)
{}

static void intel_ltr_set(struct device *dev, s32 val)
{}

static bool intel_use_ltr(struct sdhci_pci_chip *chip)
{}

static void intel_ltr_expose(struct sdhci_pci_chip *chip)
{}

static void intel_ltr_hide(struct sdhci_pci_chip *chip)
{}

static void byt_probe_slot(struct sdhci_pci_slot *slot)
{}

static void byt_add_debugfs(struct sdhci_pci_slot *slot)
{}

static int byt_add_host(struct sdhci_pci_slot *slot)
{}

static void byt_remove_slot(struct sdhci_pci_slot *slot, int dead)
{}

static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot)
{}

static bool glk_broken_cqhci(struct sdhci_pci_slot *slot)
{}

static bool jsl_broken_hs400es(struct sdhci_pci_slot *slot)
{}

static int glk_emmc_probe_slot(struct sdhci_pci_slot *slot)
{}

static const struct cqhci_host_ops glk_cqhci_ops =;

static int glk_emmc_add_host(struct sdhci_pci_slot *slot)
{}

#ifdef CONFIG_PM
#define GLK_RX_CTRL1
#define GLK_TUN_VAL
#define GLK_PATH_PLL
#define GLK_DLY
/* Workaround firmware failing to restore the tuning value */
static void glk_rpm_retune_wa(struct sdhci_pci_chip *chip, bool susp)
{}

static void glk_rpm_retune_chk(struct sdhci_pci_chip *chip, bool susp)
{}

static int glk_runtime_suspend(struct sdhci_pci_chip *chip)
{}

static int glk_runtime_resume(struct sdhci_pci_chip *chip)
{}
#endif

#ifdef CONFIG_ACPI
static int ni_set_max_freq(struct sdhci_pci_slot *slot)
{}
#else
static inline int ni_set_max_freq(struct sdhci_pci_slot *slot)
{
	return 0;
}
#endif

static int ni_byt_sdio_probe_slot(struct sdhci_pci_slot *slot)
{}

static int byt_sdio_probe_slot(struct sdhci_pci_slot *slot)
{}

static void byt_needs_pwr_off(struct sdhci_pci_slot *slot)
{}

static int byt_sd_probe_slot(struct sdhci_pci_slot *slot)
{}

#ifdef CONFIG_PM_SLEEP

static int byt_resume(struct sdhci_pci_chip *chip)
{}

#endif

#ifdef CONFIG_PM

static int byt_runtime_resume(struct sdhci_pci_chip *chip)
{}

#endif

static const struct sdhci_pci_fixes sdhci_intel_byt_emmc =;

static const struct sdhci_pci_fixes sdhci_intel_glk_emmc =;

static const struct sdhci_pci_fixes sdhci_ni_byt_sdio =;

static const struct sdhci_pci_fixes sdhci_intel_byt_sdio =;

static const struct sdhci_pci_fixes sdhci_intel_byt_sd =;

/* Define Host controllers for Intel Merrifield platform */
#define INTEL_MRFLD_EMMC_0
#define INTEL_MRFLD_EMMC_1
#define INTEL_MRFLD_SD
#define INTEL_MRFLD_SDIO

#ifdef CONFIG_ACPI
static void intel_mrfld_mmc_fix_up_power_slot(struct sdhci_pci_slot *slot)
{}
#else
static inline void intel_mrfld_mmc_fix_up_power_slot(struct sdhci_pci_slot *slot) {}
#endif

static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot)
{}

static const struct sdhci_pci_fixes sdhci_intel_mrfld_mmc =;

#define JMB388_SAMPLE_COUNT

static int jmicron_jmb388_get_ro(struct mmc_host *mmc)
{}

static int jmicron_pmos(struct sdhci_pci_chip *chip, int on)
{}

static int jmicron_probe(struct sdhci_pci_chip *chip)
{}

static void jmicron_enable_mmc(struct sdhci_host *host, int on)
{}

static int jmicron_probe_slot(struct sdhci_pci_slot *slot)
{}

static void jmicron_remove_slot(struct sdhci_pci_slot *slot, int dead)
{}

#ifdef CONFIG_PM_SLEEP
static int jmicron_suspend(struct sdhci_pci_chip *chip)
{}

static int jmicron_resume(struct sdhci_pci_chip *chip)
{}
#endif

static const struct sdhci_pci_fixes sdhci_jmicron =;

/* SysKonnect CardBus2SDIO extra registers */
#define SYSKT_CTRL
#define SYSKT_RDFIFO_STAT
#define SYSKT_WRFIFO_STAT
#define SYSKT_POWER_DATA
#define SYSKT_POWER_330
#define SYSKT_POWER_300
#define SYSKT_POWER_184
#define SYSKT_POWER_CMD
#define SYSKT_POWER_START
#define SYSKT_POWER_STATUS
#define SYSKT_POWER_STATUS_OK
#define SYSKT_BOARD_REV
#define SYSKT_CHIP_REV
#define SYSKT_CONF_DATA
#define SYSKT_CONF_DATA_1V8
#define SYSKT_CONF_DATA_2V5
#define SYSKT_CONF_DATA_3V3

static int syskt_probe(struct sdhci_pci_chip *chip)
{}

static int syskt_probe_slot(struct sdhci_pci_slot *slot)
{}

static const struct sdhci_pci_fixes sdhci_syskt =;

static int via_probe(struct sdhci_pci_chip *chip)
{}

static const struct sdhci_pci_fixes sdhci_via =;

static int rtsx_probe_slot(struct sdhci_pci_slot *slot)
{}

static const struct sdhci_pci_fixes sdhci_rtsx =;

/*AMD chipset generation*/
enum amd_chipset_gen {};

/* AMD registers */
#define AMD_SD_AUTO_PATTERN
#define AMD_MSLEEP_DURATION
#define AMD_SD_MISC_CONTROL
#define AMD_MAX_TUNE_VALUE
#define AMD_AUTO_TUNE_SEL
#define AMD_FIFO_PTR
#define AMD_BIT_MASK

static void amd_tuning_reset(struct sdhci_host *host)
{}

static void amd_config_tuning_phase(struct pci_dev *pdev, u8 phase)
{}

static void amd_enable_manual_tuning(struct pci_dev *pdev)
{}

static int amd_execute_tuning_hs200(struct sdhci_host *host, u32 opcode)
{}

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

static int amd_probe_slot(struct sdhci_pci_slot *slot)
{}

static int amd_probe(struct sdhci_pci_chip *chip)
{}

static u32 sdhci_read_present_state(struct sdhci_host *host)
{}

static void amd_sdhci_reset(struct sdhci_host *host, u8 mask)
{}

static const struct sdhci_ops amd_sdhci_pci_ops =;

static const struct sdhci_pci_fixes sdhci_amd =;

static const struct pci_device_id pci_ids[] =;

MODULE_DEVICE_TABLE(pci, pci_ids);

/*****************************************************************************\
 *                                                                           *
 * SDHCI core callbacks                                                      *
 *                                                                           *
\*****************************************************************************/

int sdhci_pci_enable_dma(struct sdhci_host *host)
{}

static void sdhci_pci_hw_reset(struct sdhci_host *host)
{}

static const struct sdhci_ops sdhci_pci_ops =;

/*****************************************************************************\
 *                                                                           *
 * Suspend/resume                                                            *
 *                                                                           *
\*****************************************************************************/

#ifdef CONFIG_PM_SLEEP
static int sdhci_pci_suspend(struct device *dev)
{}

static int sdhci_pci_resume(struct device *dev)
{}
#endif

#ifdef CONFIG_PM
static int sdhci_pci_runtime_suspend(struct device *dev)
{}

static int sdhci_pci_runtime_resume(struct device *dev)
{}
#endif

static const struct dev_pm_ops sdhci_pci_pm_ops =;

/*****************************************************************************\
 *                                                                           *
 * Device probing/removal                                                    *
 *                                                                           *
\*****************************************************************************/

static struct sdhci_pci_slot *sdhci_pci_probe_slot(
	struct pci_dev *pdev, struct sdhci_pci_chip *chip, int first_bar,
	int slotno)
{}

static void sdhci_pci_remove_slot(struct sdhci_pci_slot *slot)
{}

static void sdhci_pci_runtime_pm_allow(struct device *dev)
{}

static void sdhci_pci_runtime_pm_forbid(struct device *dev)
{}

static int sdhci_pci_probe(struct pci_dev *pdev,
				     const struct pci_device_id *ent)
{}

static void sdhci_pci_remove(struct pci_dev *pdev)
{}

static struct pci_driver sdhci_driver =;

module_pci_driver();

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