#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/highmem.h>
#include <linux/iopoll.h>
#include <linux/mmc/host.h>
#include <linux/mmc/mmc.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include "sdhci-pltfm.h"
#include "mmc_hsq.h"
#define SDHCI_SPRD_ARG2_STUFF …
#define SDHCI_SPRD_REG_32_DLL_CFG …
#define SDHCI_SPRD_DLL_ALL_CPST_EN …
#define SDHCI_SPRD_DLL_EN …
#define SDHCI_SPRD_DLL_SEARCH_MODE …
#define SDHCI_SPRD_DLL_INIT_COUNT …
#define SDHCI_SPRD_DLL_PHASE_INTERNAL …
#define SDHCI_SPRD_REG_32_DLL_DLY …
#define SDHCI_SPRD_REG_32_DLL_DLY_OFFSET …
#define SDHCIBSPRD_IT_WR_DLY_INV …
#define SDHCI_SPRD_BIT_CMD_DLY_INV …
#define SDHCI_SPRD_BIT_POSRD_DLY_INV …
#define SDHCI_SPRD_BIT_NEGRD_DLY_INV …
#define SDHCI_SPRD_REG_32_DLL_STS0 …
#define SDHCI_SPRD_DLL_LOCKED …
#define SDHCI_SPRD_REG_32_BUSY_POSI …
#define SDHCI_SPRD_BIT_OUTR_CLK_AUTO_EN …
#define SDHCI_SPRD_BIT_INNR_CLK_AUTO_EN …
#define SDHCI_SPRD_REG_DEBOUNCE …
#define SDHCI_SPRD_BIT_DLL_BAK …
#define SDHCI_SPRD_BIT_DLL_VAL …
#define SDHCI_SPRD_INT_SIGNAL_MASK …
#define SDHCI_SPRD_CTRL_HS200 …
#define SDHCI_SPRD_CTRL_HS400 …
#define SDHCI_SPRD_CTRL_HS400ES …
#define SDHCI_HW_RESET_CARD …
#define SDHCI_SPRD_MAX_CUR …
#define SDHCI_SPRD_CLK_MAX_DIV …
#define SDHCI_SPRD_CLK_DEF_RATE …
#define SDHCI_SPRD_PHY_DLL_CLK …
#define SDHCI_SPRD_MAX_RANGE …
#define SDHCI_SPRD_CMD_DLY_MASK …
#define SDHCI_SPRD_POSRD_DLY_MASK …
#define SDHCI_SPRD_CPST_EN …
struct sdhci_sprd_host { … };
enum sdhci_sprd_tuning_type { … };
struct sdhci_sprd_phy_cfg { … };
static const struct sdhci_sprd_phy_cfg sdhci_sprd_phy_cfgs[] = …;
#define TO_SPRD_HOST(host) …
static void sdhci_sprd_init_config(struct sdhci_host *host)
{ … }
static inline u32 sdhci_sprd_readl(struct sdhci_host *host, int reg)
{ … }
static inline void sdhci_sprd_writel(struct sdhci_host *host, u32 val, int reg)
{ … }
static inline void sdhci_sprd_writew(struct sdhci_host *host, u16 val, int reg)
{ … }
static inline void sdhci_sprd_writeb(struct sdhci_host *host, u8 val, int reg)
{ … }
static inline void sdhci_sprd_sd_clk_off(struct sdhci_host *host)
{ … }
static inline void sdhci_sprd_sd_clk_on(struct sdhci_host *host)
{ … }
static inline void
sdhci_sprd_set_dll_invert(struct sdhci_host *host, u32 mask, bool en)
{ … }
static inline u32 sdhci_sprd_calc_div(u32 base_clk, u32 clk)
{ … }
static inline void _sdhci_sprd_set_clock(struct sdhci_host *host,
unsigned int clk)
{ … }
static void sdhci_sprd_enable_phy_dll(struct sdhci_host *host)
{ … }
static void sdhci_sprd_set_clock(struct sdhci_host *host, unsigned int clock)
{ … }
static unsigned int sdhci_sprd_get_max_clock(struct sdhci_host *host)
{ … }
static unsigned int sdhci_sprd_get_min_clock(struct sdhci_host *host)
{ … }
static void sdhci_sprd_set_uhs_signaling(struct sdhci_host *host,
unsigned int timing)
{ … }
static void sdhci_sprd_hw_reset(struct sdhci_host *host)
{ … }
static unsigned int sdhci_sprd_get_max_timeout_count(struct sdhci_host *host)
{ … }
static unsigned int sdhci_sprd_get_ro(struct sdhci_host *host)
{ … }
static void sdhci_sprd_request_done(struct sdhci_host *host,
struct mmc_request *mrq)
{ … }
static void sdhci_sprd_set_power(struct sdhci_host *host, unsigned char mode,
unsigned short vdd)
{ … }
static const struct sdhci_ops sdhci_sprd_ops = …;
static void sdhci_sprd_check_auto_cmd23(struct mmc_host *mmc,
struct mmc_request *mrq)
{ … }
static void sdhci_sprd_request(struct mmc_host *mmc, struct mmc_request *mrq)
{ … }
static int sdhci_sprd_request_atomic(struct mmc_host *mmc,
struct mmc_request *mrq)
{ … }
static int sdhci_sprd_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios)
{ … }
static void sdhci_sprd_hs400_enhanced_strobe(struct mmc_host *mmc,
struct mmc_ios *ios)
{ … }
static int mmc_send_tuning_cmd(struct mmc_card *card)
{ … }
static int mmc_send_tuning_data(struct mmc_card *card)
{ … }
static int sdhci_sprd_get_best_clk_sample(struct mmc_host *mmc, u8 *value)
{ … }
static int sdhci_sprd_tuning(struct mmc_host *mmc, struct mmc_card *card,
enum sdhci_sprd_tuning_type type)
{ … }
static int sdhci_sprd_prepare_sd_hs_cmd_tuning(struct mmc_host *mmc, struct mmc_card *card)
{ … }
static int sdhci_sprd_execute_sd_hs_data_tuning(struct mmc_host *mmc, struct mmc_card *card)
{ … }
static void sdhci_sprd_phy_param_parse(struct sdhci_sprd_host *sprd_host,
struct device_node *np)
{ … }
static const struct sdhci_pltfm_data sdhci_sprd_pdata = …;
static int sdhci_sprd_probe(struct platform_device *pdev)
{ … }
static void sdhci_sprd_remove(struct platform_device *pdev)
{ … }
static const struct of_device_id sdhci_sprd_of_match[] = …;
MODULE_DEVICE_TABLE(of, sdhci_sprd_of_match);
#ifdef CONFIG_PM
static int sdhci_sprd_runtime_suspend(struct device *dev)
{ … }
static int sdhci_sprd_runtime_resume(struct device *dev)
{ … }
#endif
static const struct dev_pm_ops sdhci_sprd_pm_ops = …;
static struct platform_driver sdhci_sprd_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS(…) …;