2006-12-25 05:46:55 +08:00
|
|
|
/*
|
2007-07-12 02:04:50 +08:00
|
|
|
* linux/drivers/mmc/core/mmc_ops.h
|
2006-12-25 05:46:55 +08:00
|
|
|
*
|
|
|
|
* Copyright 2006-2007 Pierre Ossman
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or (at
|
|
|
|
* your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _MMC_MMC_OPS_H
|
|
|
|
#define _MMC_MMC_OPS_H
|
|
|
|
|
2017-01-13 21:14:07 +08:00
|
|
|
#include <linux/types.h>
|
|
|
|
|
|
|
|
struct mmc_host;
|
|
|
|
struct mmc_card;
|
|
|
|
|
2006-12-25 05:46:55 +08:00
|
|
|
int mmc_select_card(struct mmc_card *card);
|
|
|
|
int mmc_deselect_cards(struct mmc_host *host);
|
2014-08-19 16:45:51 +08:00
|
|
|
int mmc_set_dsr(struct mmc_host *host);
|
2006-12-25 05:46:55 +08:00
|
|
|
int mmc_go_idle(struct mmc_host *host);
|
|
|
|
int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr);
|
|
|
|
int mmc_set_relative_addr(struct mmc_card *card);
|
|
|
|
int mmc_send_csd(struct mmc_card *card, u32 *csd);
|
2017-05-22 16:23:58 +08:00
|
|
|
int __mmc_send_status(struct mmc_card *card, u32 *status, unsigned int retries);
|
2006-12-25 05:46:55 +08:00
|
|
|
int mmc_send_status(struct mmc_card *card, u32 *status);
|
MMC core learns about SPI
Teach the MMC/SD/SDIO core about using SPI mode.
- Use mmc_host_is_spi() so enumeration works through SPI signaling
and protocols, not just the native versions.
- Provide the SPI response type flags with each request issued,
including requests from the new lock/unlock code.
- Understand that cmd->resp[0] and mmc_get_status() results for SPI
return different values than for "native" MMC/SD protocol; this
affects resetting, checking card lock status, and some others.
- Understand that some commands act a bit differently ... notably:
* OP_COND command doesn't return the OCR
* APP_CMD status doesn't have an R1_APP_CMD analogue
Those changes required some new and updated primitives:
- Provide utilities to access two SPI-only requests, and one
request that wasn't previously needed:
* mmc_spi_read_ocr() ... SPI only
* mmc_spi_set_crc() ... SPI only (override by module parm)
* mmc_send_cid() ... for use without broadcast mode
- Updated internal routines:
* Previous mmc_send_csd() modified into mmc_send_cxd_native();
it uses native "R2" responses, which include 16 bytes of data.
* Previous mmc_send_ext_csd() becomes new mmc_send_cxd_data()
helper for command-and-data access
* Bugfix to that mmc_send_cxd_data() code: dma-to-stack is
unsafe/nonportable, so kmalloc a bounce buffer instead.
- Modified mmc_send_ext_csd() now uses mmc_send_cxd_data() helper
- Modified mmc_send_csd(), and new mmc_spi_send_cid(), routines use
those helper routines based on whether they're native or SPI
The newest categories of cards supported by the MMC stack aren't expected
to work yet with SPI: MMC or SD cards with over 4GB data, and SDIO.
All those cards support SPI mode, so eventually they should work too.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-08-09 00:11:32 +08:00
|
|
|
int mmc_send_cid(struct mmc_host *host, u32 *cid);
|
|
|
|
int mmc_spi_read_ocr(struct mmc_host *host, int highcap, u32 *ocrp);
|
|
|
|
int mmc_spi_set_crc(struct mmc_host *host, int use_crc);
|
2010-12-15 15:14:24 +08:00
|
|
|
int mmc_bus_test(struct mmc_card *card, u8 bus_width);
|
2017-01-13 21:14:08 +08:00
|
|
|
int mmc_interrupt_hpi(struct mmc_card *card);
|
2014-10-20 17:33:53 +08:00
|
|
|
int mmc_can_ext_csd(struct mmc_card *card);
|
2017-01-13 21:14:08 +08:00
|
|
|
int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd);
|
2016-10-19 17:04:42 +08:00
|
|
|
int mmc_switch_status(struct mmc_card *card);
|
2016-12-02 19:16:35 +08:00
|
|
|
int __mmc_switch_status(struct mmc_card *card, bool crc_err_fatal);
|
2015-09-15 21:19:45 +08:00
|
|
|
int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
|
mmc: core: Enable __mmc_switch() to change bus speed timing for the host
In cases when a speed mode change is requested for mmc cards, a CMD6 is
sent by calling __mmc_switch() during the card initialization. The CMD6
leads to the card entering a busy period. When that is completed, the host
must parse the CMD6 status to find out whether the change of the speed mode
succeeded.
To enable the mmc core to poll the card by using CMD13 to find out when the
busy period is completed, it's reasonable to make sure polling is done by
having the mmc host and the mmc card, being configured to operate at the
same selected bus speed timing.
Therefore, let's extend __mmc_switch() to take yet another parameter, which
allow its callers to update the bus speed timing of the mmc host. In this
way, __mmc_switch() also becomes capable of reading and validating the CMD6
status by sending a CMD13, in cases when that's desired.
If __mmc_switch() encounters a failure, we make sure to restores the old
bus speed timing for the mmc host, before propagating the error code.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
2016-11-10 00:33:36 +08:00
|
|
|
unsigned int timeout_ms, unsigned char timing,
|
|
|
|
bool use_busy_signal, bool send_status, bool retry_crc_err);
|
2017-01-13 21:14:08 +08:00
|
|
|
int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
|
|
|
|
unsigned int timeout_ms);
|
2018-12-11 00:52:40 +08:00
|
|
|
void mmc_run_bkops(struct mmc_card *card);
|
2017-01-13 21:14:08 +08:00
|
|
|
int mmc_flush_cache(struct mmc_card *card);
|
2017-03-13 20:36:37 +08:00
|
|
|
int mmc_cmdq_enable(struct mmc_card *card);
|
|
|
|
int mmc_cmdq_disable(struct mmc_card *card);
|
2006-12-25 05:46:55 +08:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|