linux/drivers/mmc/core/sd.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 *  linux/drivers/mmc/core/sd.c
 *
 *  Copyright (C) 2003-2004 Russell King, All Rights Reserved.
 *  SD support Copyright (C) 2004 Ian Molton, All Rights Reserved.
 *  Copyright (C) 2005-2007 Pierre Ossman, All Rights Reserved.
 */

#include <linux/err.h>
#include <linux/sizes.h>
#include <linux/slab.h>
#include <linux/stat.h>
#include <linux/pm_runtime.h>
#include <linux/random.h>
#include <linux/scatterlist.h>
#include <linux/sysfs.h>

#include <linux/mmc/host.h>
#include <linux/mmc/card.h>
#include <linux/mmc/mmc.h>
#include <linux/mmc/sd.h>

#include "core.h"
#include "card.h"
#include "host.h"
#include "bus.h"
#include "mmc_ops.h"
#include "quirks.h"
#include "sd.h"
#include "sd_ops.h"

static const unsigned int tran_exp[] =;

static const unsigned char tran_mant[] =;

static const unsigned int taac_exp[] =;

static const unsigned int taac_mant[] =;

static const unsigned int sd_au_size[] =;

#define SD_POWEROFF_NOTIFY_TIMEOUT_MS
#define SD_WRITE_EXTR_SINGLE_TIMEOUT_MS

struct sd_busy_data {};

/*
 * Given the decoded CSD structure, decode the raw CID to our CID structure.
 */
void mmc_decode_cid(struct mmc_card *card)
{}

/*
 * Given a 128-bit response, decode to our card CSD structure.
 */
static int mmc_decode_csd(struct mmc_card *card)
{}

/*
 * Given a 64-bit response, decode to our card SCR structure.
 */
static int mmc_decode_scr(struct mmc_card *card)
{}

/*
 * Fetch and process SD Status register.
 */
static int mmc_read_ssr(struct mmc_card *card)
{}

/*
 * Fetches and decodes switch information
 */
static int mmc_read_switch(struct mmc_card *card)
{}

/*
 * Test if the card supports high-speed mode and, if so, switch to it.
 */
int mmc_sd_switch_hs(struct mmc_card *card)
{}

static int sd_select_driver_type(struct mmc_card *card, u8 *status)
{}

static void sd_update_bus_speed_mode(struct mmc_card *card)
{}

static int sd_set_bus_speed_mode(struct mmc_card *card, u8 *status)
{}

/* Get host's max current setting at its current voltage */
static u32 sd_get_host_max_current(struct mmc_host *host)
{}

static int sd_set_current_limit(struct mmc_card *card, u8 *status)
{}

/*
 * UHS-I specific initialization procedure
 */
static int mmc_sd_init_uhs_card(struct mmc_card *card)
{}

MMC_DEV_ATTR();
MMC_DEV_ATTR();
MMC_DEV_ATTR();
MMC_DEV_ATTR();
MMC_DEV_ATTR();
MMC_DEV_ATTR();
MMC_DEV_ATTR();
MMC_DEV_ATTR();
MMC_DEV_ATTR();
MMC_DEV_ATTR();
MMC_DEV_ATTR();
MMC_DEV_ATTR();
MMC_DEV_ATTR();
MMC_DEV_ATTR();
MMC_DEV_ATTR();


static ssize_t mmc_dsr_show(struct device *dev, struct device_attribute *attr,
			    char *buf)
{}

static DEVICE_ATTR(dsr, S_IRUGO, mmc_dsr_show, NULL);

MMC_DEV_ATTR();
MMC_DEV_ATTR();
MMC_DEV_ATTR();

#define sdio_info_attr(num)

sdio_info_attr();
sdio_info_attr();
sdio_info_attr();
sdio_info_attr();

static struct attribute *sd_std_attrs[] =;

static umode_t sd_std_is_visible(struct kobject *kobj, struct attribute *attr,
				 int index)
{}

static const struct attribute_group sd_std_group =;
__ATTRIBUTE_GROUPS();

const struct device_type sd_type =;

/*
 * Fetch CID from card.
 */
int mmc_sd_get_cid(struct mmc_host *host, u32 ocr, u32 *cid, u32 *rocr)
{}

int mmc_sd_get_csd(struct mmc_card *card)
{}

static int mmc_sd_get_ro(struct mmc_host *host)
{}

int mmc_sd_setup_card(struct mmc_host *host, struct mmc_card *card,
	bool reinit)
{}

unsigned mmc_sd_get_max_clock(struct mmc_card *card)
{}

static bool mmc_sd_card_using_v18(struct mmc_card *card)
{}

static int sd_write_ext_reg(struct mmc_card *card, u8 fno, u8 page, u16 offset,
			    u8 reg_data)
{}

static int sd_read_ext_reg(struct mmc_card *card, u8 fno, u8 page,
			   u16 offset, u16 len, u8 *reg_buf)
{}

static int sd_parse_ext_reg_power(struct mmc_card *card, u8 fno, u8 page,
				  u16 offset)
{}

static int sd_parse_ext_reg_perf(struct mmc_card *card, u8 fno, u8 page,
				 u16 offset)
{}

static int sd_parse_ext_reg(struct mmc_card *card, u8 *gen_info_buf,
			    u16 *next_ext_addr)
{}

static int sd_read_ext_regs(struct mmc_card *card)
{}

static bool sd_cache_enabled(struct mmc_host *host)
{}

static int sd_flush_cache(struct mmc_host *host)
{}

static int sd_enable_cache(struct mmc_card *card)
{}

/*
 * Handle the detection and initialisation of a card.
 *
 * In the case of a resume, "oldcard" will contain the card
 * we're trying to reinitialise.
 */
static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
	struct mmc_card *oldcard)
{}

/*
 * Host is being removed. Free up the current card.
 */
static void mmc_sd_remove(struct mmc_host *host)
{}

/*
 * Card detection - card is alive.
 */
static int mmc_sd_alive(struct mmc_host *host)
{}

/*
 * Card detection callback from host.
 */
static void mmc_sd_detect(struct mmc_host *host)
{}

static int sd_can_poweroff_notify(struct mmc_card *card)
{}

static int sd_busy_poweroff_notify_cb(void *cb_data, bool *busy)
{}

static int sd_poweroff_notify(struct mmc_card *card)
{}

static int _mmc_sd_suspend(struct mmc_host *host)
{}

/*
 * Callback for suspend
 */
static int mmc_sd_suspend(struct mmc_host *host)
{}

/*
 * This function tries to determine if the same card is still present
 * and, if so, restore all state to it.
 */
static int _mmc_sd_resume(struct mmc_host *host)
{}

/*
 * Callback for resume
 */
static int mmc_sd_resume(struct mmc_host *host)
{}

/*
 * Callback for runtime_suspend.
 */
static int mmc_sd_runtime_suspend(struct mmc_host *host)
{}

/*
 * Callback for runtime_resume.
 */
static int mmc_sd_runtime_resume(struct mmc_host *host)
{}

static int mmc_sd_hw_reset(struct mmc_host *host)
{}

static const struct mmc_bus_ops mmc_sd_ops =;

/*
 * Starting point for SD card init.
 */
int mmc_attach_sd(struct mmc_host *host)
{}