linux/drivers/mmc/host/sdhci-s3c.c

// SPDX-License-Identifier: GPL-2.0-only
/* linux/drivers/mmc/host/sdhci-s3c.c
 *
 * Copyright 2008 Openmoko Inc.
 * Copyright 2008 Simtec Electronics
 *      Ben Dooks <[email protected]>
 *      http://armlinux.simtec.co.uk/
 *
 * SDHCI (HSMMC) support for Samsung SoC
 */

#include <linux/spinlock.h>
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/platform_device.h>
#include <linux/platform_data/mmc-sdhci-s3c.h>
#include <linux/slab.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>

#include <linux/mmc/host.h>

#include "sdhci.h"

#define MAX_BUS_CLK

#define S3C_SDHCI_CONTROL2
#define S3C_SDHCI_CONTROL3
#define S3C64XX_SDHCI_CONTROL4

#define S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR
#define S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK
#define S3C_SDHCI_CTRL2_CDINVRXD3
#define S3C_SDHCI_CTRL2_SLCARDOUT

#define S3C_SDHCI_CTRL2_FLTCLKSEL_MASK
#define S3C_SDHCI_CTRL2_FLTCLKSEL_SHIFT
#define S3C_SDHCI_CTRL2_FLTCLKSEL(_x)

#define S3C_SDHCI_CTRL2_LVLDAT_MASK
#define S3C_SDHCI_CTRL2_LVLDAT_SHIFT
#define S3C_SDHCI_CTRL2_LVLDAT(_x)

#define S3C_SDHCI_CTRL2_ENFBCLKTX
#define S3C_SDHCI_CTRL2_ENFBCLKRX
#define S3C_SDHCI_CTRL2_SDCDSEL
#define S3C_SDHCI_CTRL2_SDSIGPC
#define S3C_SDHCI_CTRL2_ENBUSYCHKTXSTART

#define S3C_SDHCI_CTRL2_DFCNT_MASK
#define S3C_SDHCI_CTRL2_DFCNT_SHIFT
#define S3C_SDHCI_CTRL2_DFCNT_NONE
#define S3C_SDHCI_CTRL2_DFCNT_4SDCLK
#define S3C_SDHCI_CTRL2_DFCNT_16SDCLK
#define S3C_SDHCI_CTRL2_DFCNT_64SDCLK

#define S3C_SDHCI_CTRL2_ENCLKOUTHOLD
#define S3C_SDHCI_CTRL2_RWAITMODE
#define S3C_SDHCI_CTRL2_DISBUFRD

#define S3C_SDHCI_CTRL2_SELBASECLK_MASK
#define S3C_SDHCI_CTRL2_SELBASECLK_SHIFT
#define S3C_SDHCI_CTRL2_PWRSYNC
#define S3C_SDHCI_CTRL2_ENCLKOUTMSKCON
#define S3C_SDHCI_CTRL2_HWINITFIN

#define S3C_SDHCI_CTRL3_FCSEL3
#define S3C_SDHCI_CTRL3_FCSEL2
#define S3C_SDHCI_CTRL3_FCSEL1
#define S3C_SDHCI_CTRL3_FCSEL0

#define S3C_SDHCI_CTRL3_FIA3_MASK
#define S3C_SDHCI_CTRL3_FIA3_SHIFT
#define S3C_SDHCI_CTRL3_FIA3(_x)

#define S3C_SDHCI_CTRL3_FIA2_MASK
#define S3C_SDHCI_CTRL3_FIA2_SHIFT
#define S3C_SDHCI_CTRL3_FIA2(_x)

#define S3C_SDHCI_CTRL3_FIA1_MASK
#define S3C_SDHCI_CTRL3_FIA1_SHIFT
#define S3C_SDHCI_CTRL3_FIA1(_x)

#define S3C_SDHCI_CTRL3_FIA0_MASK
#define S3C_SDHCI_CTRL3_FIA0_SHIFT
#define S3C_SDHCI_CTRL3_FIA0(_x)

#define S3C64XX_SDHCI_CONTROL4_DRIVE_MASK
#define S3C64XX_SDHCI_CONTROL4_DRIVE_SHIFT
#define S3C64XX_SDHCI_CONTROL4_DRIVE_2mA
#define S3C64XX_SDHCI_CONTROL4_DRIVE_4mA
#define S3C64XX_SDHCI_CONTROL4_DRIVE_7mA
#define S3C64XX_SDHCI_CONTROL4_DRIVE_9mA

#define S3C64XX_SDHCI_CONTROL4_BUSY

/**
 * struct sdhci_s3c - S3C SDHCI instance
 * @host: The SDHCI host created
 * @pdev: The platform device we where created from.
 * @ioarea: The resource created when we claimed the IO area.
 * @pdata: The platform data for this controller.
 * @cur_clk: The index of the current bus clock.
 * @ext_cd_irq: External card detect interrupt.
 * @clk_io: The clock for the internal bus interface.
 * @clk_rates: Clock frequencies.
 * @clk_bus: The clocks that are available for the SD/MMC bus clock.
 * @no_divider: No or non-standard internal clock divider.
 */
struct sdhci_s3c {};

/**
 * struct sdhci_s3c_drv_data - S3C SDHCI platform specific driver data
 * @sdhci_quirks: sdhci host specific quirks.
 * @no_divider: no or non-standard internal clock divider.
 * @ops: sdhci_ops to use for this variant
 *
 * Specifies platform specific configuration of sdhci controller.
 * Note: A structure for driver specific platform data is used for future
 * expansion of its usage.
 */
struct sdhci_s3c_drv_data {};

static inline struct sdhci_s3c *to_s3c(struct sdhci_host *host)
{}

/**
 * sdhci_s3c_get_max_clk - callback to get maximum clock frequency.
 * @host: The SDHCI host instance.
 *
 * Callback to return the maximum clock rate acheivable by the controller.
*/
static unsigned int sdhci_s3c_get_max_clk(struct sdhci_host *host)
{}

/**
 * sdhci_s3c_consider_clock - consider one the bus clocks for current setting
 * @ourhost: Our SDHCI instance.
 * @src: The source clock index.
 * @wanted: The clock frequency wanted.
 */
static unsigned int sdhci_s3c_consider_clock(struct sdhci_s3c *ourhost,
					     unsigned int src,
					     unsigned int wanted)
{}

/**
 * sdhci_s3c_set_clock - callback on clock change
 * @host: The SDHCI host being changed
 * @clock: The clock rate being requested.
 *
 * When the card's clock is going to be changed, look at the new frequency
 * and find the best clock source to go with it.
*/
static void sdhci_s3c_set_clock(struct sdhci_host *host, unsigned int clock)
{}

/**
 * sdhci_s3c_get_min_clock - callback to get minimal supported clock value
 * @host: The SDHCI host being queried
 *
 * To init mmc host properly a minimal clock value is needed. For high system
 * bus clock's values the standard formula gives values out of allowed range.
 * The clock still can be set to lower values, if clock source other then
 * system bus is selected.
*/
static unsigned int sdhci_s3c_get_min_clock(struct sdhci_host *host)
{}

/* sdhci_cmu_get_max_clk - callback to get maximum clock frequency.*/
static unsigned int sdhci_cmu_get_max_clock(struct sdhci_host *host)
{}

/* sdhci_cmu_get_min_clock - callback to get minimal supported clock value. */
static unsigned int sdhci_cmu_get_min_clock(struct sdhci_host *host)
{}

/* sdhci_cmu_set_clock - callback on clock change.*/
static void sdhci_cmu_set_clock(struct sdhci_host *host, unsigned int clock)
{}

static const struct sdhci_ops sdhci_s3c_ops_s3c6410 =;

static const struct sdhci_ops sdhci_s3c_ops_exynos4 __maybe_unused =;

#ifdef CONFIG_OF
static int sdhci_s3c_parse_dt(struct device *dev,
		struct sdhci_host *host, struct s3c_sdhci_platdata *pdata)
{}
#else
static int sdhci_s3c_parse_dt(struct device *dev,
		struct sdhci_host *host, struct s3c_sdhci_platdata *pdata)
{
	return -EINVAL;
}
#endif

static inline const struct sdhci_s3c_drv_data *sdhci_s3c_get_driver_data(
			struct platform_device *pdev)
{}

static int sdhci_s3c_probe(struct platform_device *pdev)
{}

static void sdhci_s3c_remove(struct platform_device *pdev)
{}

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

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

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

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

static const struct dev_pm_ops sdhci_s3c_pmops =;

static const struct platform_device_id sdhci_s3c_driver_ids[] =;
MODULE_DEVICE_TABLE(platform, sdhci_s3c_driver_ids);

#ifdef CONFIG_OF
static const struct sdhci_s3c_drv_data exynos4_sdhci_drv_data =;

static const struct of_device_id sdhci_s3c_dt_match[] =;
MODULE_DEVICE_TABLE(of, sdhci_s3c_dt_match);
#endif

static struct platform_driver sdhci_s3c_driver =;

module_platform_driver();

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