linux/drivers/mmc/host/bcm2835.c

// SPDX-License-Identifier: GPL-2.0
/*
 * bcm2835 sdhost driver.
 *
 * The 2835 has two SD controllers: The Arasan sdhci controller
 * (supported by the iproc driver) and a custom sdhost controller
 * (supported by this driver).
 *
 * The sdhci controller supports both sdcard and sdio.  The sdhost
 * controller supports the sdcard only, but has better performance.
 * Also note that the rpi3 has sdio wifi, so driving the sdcard with
 * the sdhost controller allows to use the sdhci controller for wifi
 * support.
 *
 * The configuration is done by devicetree via pin muxing.  Both
 * SD controller are available on the same pins (2 pin groups = pin 22
 * to 27 + pin 48 to 53).  So it's possible to use both SD controllers
 * at the same time with different pin groups.
 *
 * Author:      Phil Elwell <[email protected]>
 *              Copyright (C) 2015-2016 Raspberry Pi (Trading) Ltd.
 *
 * Based on
 *  mmc-bcm2835.c by Gellert Weisz
 * which is, in turn, based on
 *  sdhci-bcm2708.c by Broadcom
 *  sdhci-bcm2835.c by Stephen Warren and Oleksandr Tymoshenko
 *  sdhci.c and sdhci-pci.c by Pierre Ossman
 */
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/dmaengine.h>
#include <linux/dma-mapping.h>
#include <linux/err.h>
#include <linux/highmem.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/platform_device.h>
#include <linux/scatterlist.h>
#include <linux/time.h>
#include <linux/workqueue.h>

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

#define SDCMD
#define SDARG
#define SDTOUT
#define SDCDIV
#define SDRSP0
#define SDRSP1
#define SDRSP2
#define SDRSP3
#define SDHSTS
#define SDVDD
#define SDEDM
#define SDHCFG
#define SDHBCT
#define SDDATA
#define SDHBLC

#define SDCMD_NEW_FLAG
#define SDCMD_FAIL_FLAG
#define SDCMD_BUSYWAIT
#define SDCMD_NO_RESPONSE
#define SDCMD_LONG_RESPONSE
#define SDCMD_WRITE_CMD
#define SDCMD_READ_CMD
#define SDCMD_CMD_MASK

#define SDCDIV_MAX_CDIV

#define SDHSTS_BUSY_IRPT
#define SDHSTS_BLOCK_IRPT
#define SDHSTS_SDIO_IRPT
#define SDHSTS_REW_TIME_OUT
#define SDHSTS_CMD_TIME_OUT
#define SDHSTS_CRC16_ERROR
#define SDHSTS_CRC7_ERROR
#define SDHSTS_FIFO_ERROR
/* Reserved */
/* Reserved */
#define SDHSTS_DATA_FLAG

#define SDHSTS_TRANSFER_ERROR_MASK

#define SDHSTS_ERROR_MASK

#define SDHCFG_BUSY_IRPT_EN
#define SDHCFG_BLOCK_IRPT_EN
#define SDHCFG_SDIO_IRPT_EN
#define SDHCFG_DATA_IRPT_EN
#define SDHCFG_SLOW_CARD
#define SDHCFG_WIDE_EXT_BUS
#define SDHCFG_WIDE_INT_BUS
#define SDHCFG_REL_CMD_LINE

#define SDVDD_POWER_OFF
#define SDVDD_POWER_ON

#define SDEDM_FORCE_DATA_MODE
#define SDEDM_CLOCK_PULSE
#define SDEDM_BYPASS

#define SDEDM_WRITE_THRESHOLD_SHIFT
#define SDEDM_READ_THRESHOLD_SHIFT
#define SDEDM_THRESHOLD_MASK

#define SDEDM_FSM_MASK
#define SDEDM_FSM_IDENTMODE
#define SDEDM_FSM_DATAMODE
#define SDEDM_FSM_READDATA
#define SDEDM_FSM_WRITEDATA
#define SDEDM_FSM_READWAIT
#define SDEDM_FSM_READCRC
#define SDEDM_FSM_WRITECRC
#define SDEDM_FSM_WRITEWAIT1
#define SDEDM_FSM_POWERDOWN
#define SDEDM_FSM_POWERUP
#define SDEDM_FSM_WRITESTART1
#define SDEDM_FSM_WRITESTART2
#define SDEDM_FSM_GENPULSES
#define SDEDM_FSM_WRITEWAIT2
#define SDEDM_FSM_STARTPOWDOWN

#define SDDATA_FIFO_WORDS

#define FIFO_READ_THRESHOLD
#define FIFO_WRITE_THRESHOLD
#define SDDATA_FIFO_PIO_BURST

#define PIO_THRESHOLD

struct bcm2835_host {};

static void bcm2835_dumpcmd(struct bcm2835_host *host, struct mmc_command *cmd,
			    const char *label)
{}

static void bcm2835_dumpregs(struct bcm2835_host *host)
{}

static void bcm2835_reset_internal(struct bcm2835_host *host)
{}

static void bcm2835_reset(struct mmc_host *mmc)
{}

static void bcm2835_finish_command(struct bcm2835_host *host);

static void bcm2835_wait_transfer_complete(struct bcm2835_host *host)
{}

static void bcm2835_dma_complete(void *param)
{}

static void bcm2835_transfer_block_pio(struct bcm2835_host *host, bool is_read)
{}

static void bcm2835_transfer_pio(struct bcm2835_host *host)
{}

static
void bcm2835_prepare_dma(struct bcm2835_host *host, struct mmc_data *data)
{}

static void bcm2835_start_dma(struct bcm2835_host *host)
{}

static void bcm2835_set_transfer_irqs(struct bcm2835_host *host)
{}

static
void bcm2835_prepare_data(struct bcm2835_host *host, struct mmc_command *cmd)
{}

static u32 bcm2835_read_wait_sdcmd(struct bcm2835_host *host, u32 max_ms)
{}

static void bcm2835_finish_request(struct bcm2835_host *host)
{}

static
bool bcm2835_send_command(struct bcm2835_host *host, struct mmc_command *cmd)
{}

static void bcm2835_transfer_complete(struct bcm2835_host *host)
{}

static void bcm2835_finish_data(struct bcm2835_host *host)
{}

static void bcm2835_finish_command(struct bcm2835_host *host)
{}

static void bcm2835_timeout(struct work_struct *work)
{}

static bool bcm2835_check_cmd_error(struct bcm2835_host *host, u32 intmask)
{}

static void bcm2835_check_data_error(struct bcm2835_host *host, u32 intmask)
{}

static void bcm2835_busy_irq(struct bcm2835_host *host)
{}

static void bcm2835_data_irq(struct bcm2835_host *host, u32 intmask)
{}

static void bcm2835_data_threaded_irq(struct bcm2835_host *host)
{}

static void bcm2835_block_irq(struct bcm2835_host *host)
{}

static irqreturn_t bcm2835_irq(int irq, void *dev_id)
{}

static irqreturn_t bcm2835_threaded_irq(int irq, void *dev_id)
{}

static void bcm2835_dma_complete_work(struct work_struct *work)
{}

static void bcm2835_set_clock(struct bcm2835_host *host, unsigned int clock)
{}

static void bcm2835_request(struct mmc_host *mmc, struct mmc_request *mrq)
{}

static void bcm2835_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
{}

static const struct mmc_host_ops bcm2835_ops =;

static int bcm2835_add_host(struct bcm2835_host *host)
{}

static int bcm2835_probe(struct platform_device *pdev)
{}

static void bcm2835_remove(struct platform_device *pdev)
{}

static const struct of_device_id bcm2835_match[] =;
MODULE_DEVICE_TABLE(of, bcm2835_match);

static struct platform_driver bcm2835_driver =;
module_platform_driver();

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