2019-05-27 09:55:01 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2006-12-25 00:46:55 +03:00
|
|
|
/*
|
2007-07-11 22:04:50 +04:00
|
|
|
* linux/drivers/mmc/core/sd_ops.h
|
2006-12-25 00:46:55 +03:00
|
|
|
*
|
|
|
|
* Copyright 2006-2007 Pierre Ossman
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _MMC_SD_OPS_H
|
|
|
|
#define _MMC_SD_OPS_H
|
|
|
|
|
2017-01-13 16:14:07 +03:00
|
|
|
#include <linux/types.h>
|
|
|
|
|
|
|
|
struct mmc_card;
|
|
|
|
struct mmc_host;
|
|
|
|
|
2006-12-25 00:46:55 +03:00
|
|
|
int mmc_app_set_bus_width(struct mmc_card *card, int width);
|
|
|
|
int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr);
|
|
|
|
int mmc_send_if_cond(struct mmc_host *host, u32 ocr);
|
mmc: core: Initial support for SD express card/host
In the SD specification v7.10 the SD express card has been added. This new
type of removable SD card, can be managed via a PCIe/NVMe based interface,
while also allowing backwards compatibility towards the legacy SD
interface.
To keep the backwards compatibility, it's required to start the
initialization through the legacy SD interface. If it turns out that the
mmc host and the SD card, both supports the PCIe/NVMe interface, then a
switch should be allowed.
Therefore, let's introduce some basic support for this type of SD cards to
the mmc core. The mmc host, should set MMC_CAP2_SD_EXP if it supports this
interface and MMC_CAP2_SD_EXP_1_2V, if also 1.2V is supported, as to inform
the core about it.
To deal with the switch to the PCIe/NVMe interface, the mmc host is
required to implement a new host ops, ->init_sd_express(). Based on the
initial communication between the host and the card, host->ios.timing is
set to either MMC_TIMING_SD_EXP or MMC_TIMING_SD_EXP_1_2V, depending on if
1.2V is supported or not. In this way, the mmc host can check these values
in its ->init_sd_express() ops, to know how to proceed with the handover.
Note that, to manage card insert/removal, the mmc core sticks with using
the ->get_cd() callback, which means it's the host's responsibility to make
sure it provides valid data, even if the card may be managed by PCIe/NVMe
at the moment. As long as the card seems to be present, the mmc core keeps
the card powered on.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Rui Feng <rui_feng@realsil.com.cn>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/1603936636-3126-1-git-send-email-rui_feng@realsil.com.cn
2020-10-29 04:57:16 +03:00
|
|
|
int mmc_send_if_cond_pcie(struct mmc_host *host, u32 ocr);
|
2006-12-25 00:46:55 +03:00
|
|
|
int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca);
|
2017-04-02 23:56:03 +03:00
|
|
|
int mmc_app_send_scr(struct mmc_card *card);
|
2006-12-25 00:46:55 +03:00
|
|
|
int mmc_sd_switch(struct mmc_card *card, int mode, int group,
|
|
|
|
u8 value, u8 *resp);
|
mmc: add erase, secure erase, trim and secure trim operations
SD/MMC cards tend to support an erase operation. In addition, eMMC v4.4
cards can support secure erase, trim and secure trim operations that are
all variants of the basic erase command.
SD/MMC device attributes "erase_size" and "preferred_erase_size" have been
added.
"erase_size" is the minimum size, in bytes, of an erase operation. For
MMC, "erase_size" is the erase group size reported by the card. Note that
"erase_size" does not apply to trim or secure trim operations where the
minimum size is always one 512 byte sector. For SD, "erase_size" is 512
if the card is block-addressed, 0 otherwise.
SD/MMC cards can erase an arbitrarily large area up to and
including the whole card. When erasing a large area it may
be desirable to do it in smaller chunks for three reasons:
1. A single erase command will make all other I/O on the card
wait. This is not a problem if the whole card is being erased, but
erasing one partition will make I/O for another partition on the
same card wait for the duration of the erase - which could be a
several minutes.
2. To be able to inform the user of erase progress.
3. The erase timeout becomes too large to be very useful.
Because the erase timeout contains a margin which is multiplied by
the size of the erase area, the value can end up being several
minutes for large areas.
"erase_size" is not the most efficient unit to erase (especially for SD
where it is just one sector), hence "preferred_erase_size" provides a good
chunk size for erasing large areas.
For MMC, "preferred_erase_size" is the high-capacity erase size if a card
specifies one, otherwise it is based on the capacity of the card.
For SD, "preferred_erase_size" is the allocation unit size specified by
the card.
"preferred_erase_size" is in bytes.
Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Acked-by: Jens Axboe <axboe@kernel.dk>
Cc: Kyungmin Park <kmpark@infradead.org>
Cc: Madhusudhan Chikkature <madhu.cr@ti.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ben Gardiner <bengardiner@nanometrics.ca>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-08-12 01:17:46 +04:00
|
|
|
int mmc_app_sd_status(struct mmc_card *card, void *ssr);
|
2017-01-13 16:14:08 +03:00
|
|
|
int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card);
|
2006-12-25 00:46:55 +03:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|