#include <linux/bitfield.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/clk.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/pm_qos.h>
#include <linux/mmc/host.h>
#include <linux/mmc/mmc.h>
#include <linux/mmc/sdio.h>
#include <linux/mmc/slot-gpio.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pinctrl/consumer.h>
#include <linux/pm_runtime.h>
#include "sdhci-cqhci.h"
#include "sdhci-pltfm.h"
#include "sdhci-esdhc.h"
#include "cqhci.h"
#define ESDHC_SYS_CTRL_DTOCV_MASK …
#define ESDHC_CTRL_D3CD …
#define ESDHC_BURST_LEN_EN_INCR …
#define ESDHC_VENDOR_SPEC …
#define ESDHC_VENDOR_SPEC_SDIO_QUIRK …
#define ESDHC_VENDOR_SPEC_VSELECT …
#define ESDHC_VENDOR_SPEC_FRC_SDCLK_ON …
#define ESDHC_DEBUG_SEL_AND_STATUS_REG …
#define ESDHC_DEBUG_SEL_REG …
#define ESDHC_DEBUG_SEL_MASK …
#define ESDHC_DEBUG_SEL_CMD_STATE …
#define ESDHC_DEBUG_SEL_DATA_STATE …
#define ESDHC_DEBUG_SEL_TRANS_STATE …
#define ESDHC_DEBUG_SEL_DMA_STATE …
#define ESDHC_DEBUG_SEL_ADMA_STATE …
#define ESDHC_DEBUG_SEL_FIFO_STATE …
#define ESDHC_DEBUG_SEL_ASYNC_FIFO_STATE …
#define ESDHC_WTMK_LVL …
#define ESDHC_WTMK_DEFAULT_VAL …
#define ESDHC_WTMK_LVL_RD_WML_MASK …
#define ESDHC_WTMK_LVL_RD_WML_SHIFT …
#define ESDHC_WTMK_LVL_WR_WML_MASK …
#define ESDHC_WTMK_LVL_WR_WML_SHIFT …
#define ESDHC_WTMK_LVL_WML_VAL_DEF …
#define ESDHC_WTMK_LVL_WML_VAL_MAX …
#define ESDHC_MIX_CTRL …
#define ESDHC_MIX_CTRL_DDREN …
#define ESDHC_MIX_CTRL_AC23EN …
#define ESDHC_MIX_CTRL_EXE_TUNE …
#define ESDHC_MIX_CTRL_SMPCLK_SEL …
#define ESDHC_MIX_CTRL_AUTO_TUNE_EN …
#define ESDHC_MIX_CTRL_FBCLK_SEL …
#define ESDHC_MIX_CTRL_HS400_EN …
#define ESDHC_MIX_CTRL_HS400_ES_EN …
#define ESDHC_MIX_CTRL_SDHCI_MASK …
#define ESDHC_MIX_CTRL_TUNING_MASK …
#define ESDHC_DLL_CTRL …
#define ESDHC_DLL_OVERRIDE_VAL_SHIFT …
#define ESDHC_DLL_OVERRIDE_EN_SHIFT …
#define ESDHC_TUNE_CTRL_STATUS …
#define ESDHC_TUNE_CTRL_STEP …
#define ESDHC_TUNE_CTRL_MIN …
#define ESDHC_TUNE_CTRL_MAX …
#define ESDHC_STROBE_DLL_CTRL …
#define ESDHC_STROBE_DLL_CTRL_ENABLE …
#define ESDHC_STROBE_DLL_CTRL_RESET …
#define ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_DEFAULT …
#define ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_SHIFT …
#define ESDHC_STROBE_DLL_CTRL_SLV_UPDATE_INT_DEFAULT …
#define ESDHC_STROBE_DLL_STATUS …
#define ESDHC_STROBE_DLL_STS_REF_LOCK …
#define ESDHC_STROBE_DLL_STS_SLV_LOCK …
#define ESDHC_VEND_SPEC2 …
#define ESDHC_VEND_SPEC2_EN_BUSY_IRQ …
#define ESDHC_VEND_SPEC2_AUTO_TUNE_8BIT_EN …
#define ESDHC_VEND_SPEC2_AUTO_TUNE_4BIT_EN …
#define ESDHC_VEND_SPEC2_AUTO_TUNE_1BIT_EN …
#define ESDHC_VEND_SPEC2_AUTO_TUNE_CMD_EN …
#define ESDHC_VEND_SPEC2_AUTO_TUNE_MODE_MASK …
#define ESDHC_TUNING_CTRL …
#define ESDHC_STD_TUNING_EN …
#define ESDHC_TUNING_START_TAP_DEFAULT …
#define ESDHC_TUNING_START_TAP_MASK …
#define ESDHC_TUNING_CMD_CRC_CHECK_DISABLE …
#define ESDHC_TUNING_STEP_DEFAULT …
#define ESDHC_TUNING_STEP_MASK …
#define ESDHC_TUNING_STEP_SHIFT …
#define ESDHC_PINCTRL_STATE_100MHZ …
#define ESDHC_PINCTRL_STATE_200MHZ …
#define ESDHC_CTRL_4BITBUS …
#define ESDHC_CTRL_8BITBUS …
#define ESDHC_CTRL_BUSWIDTH_MASK …
#define USDHC_GET_BUSWIDTH(c) …
#define ESDHC_INT_VENDOR_SPEC_DMA_ERR …
#define ESDHC_CQHCI_ADDR_OFFSET …
#define ESDHC_FLAG_MULTIBLK_NO_INT …
#define ESDHC_FLAG_USDHC …
#define ESDHC_FLAG_MAN_TUNING …
#define ESDHC_FLAG_STD_TUNING …
#define ESDHC_FLAG_HAVE_CAP1 …
#define ESDHC_FLAG_ERR004536 …
#define ESDHC_FLAG_HS200 …
#define ESDHC_FLAG_HS400 …
#define ESDHC_FLAG_ERR010450 …
#define ESDHC_FLAG_HS400_ES …
#define ESDHC_FLAG_CQHCI …
#define ESDHC_FLAG_PMQOS …
#define ESDHC_FLAG_STATE_LOST_IN_LPMODE …
#define ESDHC_FLAG_CLK_RATE_LOST_IN_PM_RUNTIME …
#define ESDHC_FLAG_BROKEN_AUTO_CMD23 …
#define ESDHC_FLAG_SKIP_ERR004536 …
#define ESDHC_FLAG_SKIP_CD_WAKE …
enum wp_types { … };
enum cd_types { … };
struct esdhc_platform_data { … };
struct esdhc_soc_data { … };
static const struct esdhc_soc_data esdhc_imx25_data = …;
static const struct esdhc_soc_data esdhc_imx35_data = …;
static const struct esdhc_soc_data esdhc_imx51_data = …;
static const struct esdhc_soc_data esdhc_imx53_data = …;
static const struct esdhc_soc_data usdhc_imx6q_data = …;
static const struct esdhc_soc_data usdhc_imx6sl_data = …;
static const struct esdhc_soc_data usdhc_imx6sll_data = …;
static const struct esdhc_soc_data usdhc_imx6sx_data = …;
static const struct esdhc_soc_data usdhc_imx6ull_data = …;
static const struct esdhc_soc_data usdhc_imx7d_data = …;
static struct esdhc_soc_data usdhc_s32g2_data = …;
static struct esdhc_soc_data usdhc_imx7ulp_data = …;
static struct esdhc_soc_data usdhc_imxrt1050_data = …;
static struct esdhc_soc_data usdhc_imx8qxp_data = …;
static struct esdhc_soc_data usdhc_imx8mm_data = …;
struct pltfm_imx_data { … };
static const struct of_device_id imx_esdhc_dt_ids[] = …;
MODULE_DEVICE_TABLE(of, imx_esdhc_dt_ids);
static inline int is_imx25_esdhc(struct pltfm_imx_data *data)
{ … }
static inline int is_imx53_esdhc(struct pltfm_imx_data *data)
{ … }
static inline int esdhc_is_usdhc(struct pltfm_imx_data *data)
{ … }
static inline void esdhc_clrset_le(struct sdhci_host *host, u32 mask, u32 val, int reg)
{ … }
#define DRIVER_NAME …
#define ESDHC_IMX_DUMP(f, x...) …
static void esdhc_dump_debug_regs(struct sdhci_host *host)
{ … }
static inline void esdhc_wait_for_card_clock_gate_off(struct sdhci_host *host)
{ … }
static inline void usdhc_auto_tuning_mode_sel_and_en(struct sdhci_host *host)
{ … }
static u32 esdhc_readl_le(struct sdhci_host *host, int reg)
{ … }
static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
{ … }
static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
{ … }
static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg)
{ … }
static u8 esdhc_readb_le(struct sdhci_host *host, int reg)
{ … }
static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
{ … }
static unsigned int esdhc_pltfm_get_max_clock(struct sdhci_host *host)
{ … }
static unsigned int esdhc_pltfm_get_min_clock(struct sdhci_host *host)
{ … }
static inline void esdhc_pltfm_set_clock(struct sdhci_host *host,
unsigned int clock)
{ … }
static unsigned int esdhc_pltfm_get_ro(struct sdhci_host *host)
{ … }
static void esdhc_pltfm_set_bus_width(struct sdhci_host *host, int width)
{ … }
static void esdhc_reset_tuning(struct sdhci_host *host)
{ … }
static void usdhc_init_card(struct mmc_host *mmc, struct mmc_card *card)
{ … }
static int usdhc_execute_tuning(struct mmc_host *mmc, u32 opcode)
{ … }
static void esdhc_prepare_tuning(struct sdhci_host *host, u32 val)
{ … }
static void esdhc_post_tuning(struct sdhci_host *host)
{ … }
static int esdhc_executing_tuning(struct sdhci_host *host, u32 opcode)
{ … }
static void esdhc_hs400_enhanced_strobe(struct mmc_host *mmc, struct mmc_ios *ios)
{ … }
static int esdhc_change_pinstate(struct sdhci_host *host,
unsigned int uhs)
{ … }
static void esdhc_set_strobe_dll(struct sdhci_host *host)
{ … }
static void esdhc_set_uhs_signaling(struct sdhci_host *host, unsigned timing)
{ … }
static void esdhc_reset(struct sdhci_host *host, u8 mask)
{ … }
static unsigned int esdhc_get_max_timeout_count(struct sdhci_host *host)
{ … }
static void esdhc_set_timeout(struct sdhci_host *host, struct mmc_command *cmd)
{ … }
static u32 esdhc_cqhci_irq(struct sdhci_host *host, u32 intmask)
{ … }
static struct sdhci_ops sdhci_esdhc_ops = …;
static const struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = …;
static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host)
{ … }
static void esdhc_cqe_enable(struct mmc_host *mmc)
{ … }
static void esdhc_sdhci_dumpregs(struct mmc_host *mmc)
{ … }
static const struct cqhci_host_ops esdhc_cqhci_ops = …;
static int
sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
struct sdhci_host *host,
struct pltfm_imx_data *imx_data)
{ … }
static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
{ … }
static void sdhci_esdhc_imx_remove(struct platform_device *pdev)
{ … }
#ifdef CONFIG_PM_SLEEP
static int sdhci_esdhc_suspend(struct device *dev)
{ … }
static int sdhci_esdhc_resume(struct device *dev)
{ … }
#endif
#ifdef CONFIG_PM
static int sdhci_esdhc_runtime_suspend(struct device *dev)
{ … }
static int sdhci_esdhc_runtime_resume(struct device *dev)
{ … }
#endif
static const struct dev_pm_ops sdhci_esdhc_pmops = …;
static struct platform_driver sdhci_esdhc_imx_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;