Lines Matching +full:mmc +full:- +full:card

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * linux/drivers/mmc/core/sd_ops.h
5 * Copyright 2006-2007 Pierre Ossman
13 #include <linux/mmc/host.h>
14 #include <linux/mmc/card.h>
15 #include <linux/mmc/mmc.h>
16 #include <linux/mmc/sd.h>
21 int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card) in mmc_app_cmd() argument
26 if (WARN_ON(card && card->host != host)) in mmc_app_cmd()
27 return -EINVAL; in mmc_app_cmd()
31 if (card) { in mmc_app_cmd()
32 cmd.arg = card->rca << 16; in mmc_app_cmd()
43 /* Check that card supported application commands */ in mmc_app_cmd()
45 return -EOPNOTSUPP; in mmc_app_cmd()
51 static int mmc_wait_for_app_cmd(struct mmc_host *host, struct mmc_card *card, in mmc_wait_for_app_cmd() argument
55 int i, err = -EIO; in mmc_wait_for_app_cmd()
62 err = mmc_app_cmd(host, card); in mmc_wait_for_app_cmd()
66 if (cmd->resp[0] & R1_SPI_ILLEGAL_COMMAND) in mmc_wait_for_app_cmd()
74 memset(cmd->resp, 0, sizeof(cmd->resp)); in mmc_wait_for_app_cmd()
75 cmd->retries = 0; in mmc_wait_for_app_cmd()
78 cmd->data = NULL; in mmc_wait_for_app_cmd()
82 err = cmd->error; in mmc_wait_for_app_cmd()
83 if (!cmd->error) in mmc_wait_for_app_cmd()
88 if (cmd->resp[0] & R1_SPI_ILLEGAL_COMMAND) in mmc_wait_for_app_cmd()
96 int mmc_app_set_bus_width(struct mmc_card *card, int width) in mmc_app_set_bus_width() argument
111 return -EINVAL; in mmc_app_set_bus_width()
114 return mmc_wait_for_app_cmd(card->host, card, &cmd); in mmc_app_set_bus_width()
129 for (i = 100; i; i--) { in mmc_send_app_op_cond()
147 err = -ETIMEDOUT; in mmc_send_app_op_cond()
153 pr_err("%s: card never left busy state\n", mmc_hostname(host)); in mmc_send_app_op_cond()
187 return -EIO; in mmc_send_if_cond()
210 int mmc_app_send_scr(struct mmc_card *card) in mmc_app_send_scr() argument
219 /* NOTE: caller guarantees scr is heap-allocated */ in mmc_app_send_scr()
221 err = mmc_app_cmd(card->host, card); in mmc_app_send_scr()
226 * routine normally provide temporary on-stack buffers ... in mmc_app_send_scr()
228 scr = kmalloc(sizeof(card->raw_scr), GFP_KERNEL); in mmc_app_send_scr()
230 return -ENOMEM; in mmc_app_send_scr()
247 mmc_set_data_timeout(&data, card); in mmc_app_send_scr()
249 mmc_wait_for_req(card->host, &mrq); in mmc_app_send_scr()
251 card->raw_scr[0] = be32_to_cpu(scr[0]); in mmc_app_send_scr()
252 card->raw_scr[1] = be32_to_cpu(scr[1]); in mmc_app_send_scr()
264 int mmc_sd_switch(struct mmc_card *card, int mode, int group, in mmc_sd_switch() argument
272 /* NOTE: caller guarantees resp is heap-allocated */ in mmc_sd_switch()
294 mmc_set_data_timeout(&data, card); in mmc_sd_switch()
296 mmc_wait_for_req(card->host, &mrq); in mmc_sd_switch()
306 int mmc_app_sd_status(struct mmc_card *card, void *ssr) in mmc_app_sd_status() argument
314 /* NOTE: caller guarantees ssr is heap-allocated */ in mmc_app_sd_status()
316 err = mmc_app_cmd(card->host, card); in mmc_app_sd_status()
335 mmc_set_data_timeout(&data, card); in mmc_app_sd_status()
337 mmc_wait_for_req(card->host, &mrq); in mmc_app_sd_status()