#include <linux/clk.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/interrupt.h>
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/types.h>
#include <linux/mmc/host.h>
#include <linux/mmc/mmc.h>
#include <linux/mmc/sdio.h>
#include <linux/mmc/slot-gpio.h>
#include "meson-mx-sdhc.h"
#define MESON_SDHC_NUM_BULK_CLKS …
#define MESON_SDHC_MAX_BLK_SIZE …
#define MESON_SDHC_NUM_TUNING_TRIES …
#define MESON_SDHC_WAIT_CMD_READY_SLEEP_US …
#define MESON_SDHC_WAIT_CMD_READY_TIMEOUT_US …
#define MESON_SDHC_WAIT_BEFORE_SEND_SLEEP_US …
#define MESON_SDHC_WAIT_BEFORE_SEND_TIMEOUT_US …
struct meson_mx_sdhc_data { … };
struct meson_mx_sdhc_host { … };
static const struct regmap_config meson_mx_sdhc_regmap_config = …;
static void meson_mx_sdhc_reset(struct meson_mx_sdhc_host *host)
{ … }
static void meson_mx_sdhc_clear_fifo(struct mmc_host *mmc)
{ … }
static void meson_mx_sdhc_wait_cmd_ready(struct mmc_host *mmc)
{ … }
static void meson_mx_sdhc_start_cmd(struct mmc_host *mmc,
struct mmc_command *cmd)
{ … }
static void meson_mx_sdhc_disable_clks(struct mmc_host *mmc)
{ … }
static int meson_mx_sdhc_enable_clks(struct mmc_host *mmc)
{ … }
static int meson_mx_sdhc_set_clk(struct mmc_host *mmc, struct mmc_ios *ios)
{ … }
static void meson_mx_sdhc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
{ … }
static int meson_mx_sdhc_map_dma(struct mmc_host *mmc, struct mmc_request *mrq)
{ … }
static void meson_mx_sdhc_request(struct mmc_host *mmc, struct mmc_request *mrq)
{ … }
static int meson_mx_sdhc_card_busy(struct mmc_host *mmc)
{ … }
static bool meson_mx_sdhc_tuning_point_matches(struct mmc_host *mmc,
u32 opcode)
{ … }
static int meson_mx_sdhc_execute_tuning(struct mmc_host *mmc, u32 opcode)
{ … }
static const struct mmc_host_ops meson_mx_sdhc_ops = …;
static void meson_mx_sdhc_request_done(struct meson_mx_sdhc_host *host)
{ … }
static u32 meson_mx_sdhc_read_response(struct meson_mx_sdhc_host *host, u8 idx)
{ … }
static irqreturn_t meson_mx_sdhc_irq(int irq, void *data)
{ … }
static irqreturn_t meson_mx_sdhc_irq_thread(int irq, void *irq_data)
{ … }
static void meson_mx_sdhc_init_hw_meson8(struct mmc_host *mmc)
{
struct meson_mx_sdhc_host *host = mmc_priv(mmc);
regmap_write(host->regmap, MESON_SDHC_MISC,
FIELD_PREP(MESON_SDHC_MISC_TXSTART_THRES, 7) |
FIELD_PREP(MESON_SDHC_MISC_WCRC_ERR_PATT, 5) |
FIELD_PREP(MESON_SDHC_MISC_WCRC_OK_PATT, 2));
regmap_write(host->regmap, MESON_SDHC_ENHC,
FIELD_PREP(MESON_SDHC_ENHC_RXFIFO_TH, 63) |
MESON_SDHC_ENHC_MESON6_DMA_WR_RESP |
FIELD_PREP(MESON_SDHC_ENHC_MESON6_RX_TIMEOUT, 255) |
FIELD_PREP(MESON_SDHC_ENHC_SDIO_IRQ_PERIOD, 12));
};
static void meson_mx_sdhc_set_pdma_meson8(struct mmc_host *mmc)
{ … }
static void meson_mx_sdhc_wait_before_send_meson8(struct mmc_host *mmc)
{ … }
static void meson_mx_sdhc_init_hw_meson8m2(struct mmc_host *mmc)
{ … }
static void meson_mx_sdhc_set_pdma_meson8m2(struct mmc_host *mmc)
{ … }
static void meson_mx_sdhc_init_hw(struct mmc_host *mmc)
{ … }
static void meason_mx_mmc_free_host(void *data)
{ … }
static int meson_mx_sdhc_probe(struct platform_device *pdev)
{ … }
static void meson_mx_sdhc_remove(struct platform_device *pdev)
{ … }
static const struct meson_mx_sdhc_data meson_mx_sdhc_data_meson8 = …;
static const struct meson_mx_sdhc_data meson_mx_sdhc_data_meson8m2 = …;
static const struct of_device_id meson_mx_sdhc_of_match[] = …;
MODULE_DEVICE_TABLE(of, meson_mx_sdhc_of_match);
static struct platform_driver meson_mx_sdhc_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;