From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH 3/3] mmc: mmc_spi: Document the 3 local functions
Date: Mon, 1 Feb 2021 12:20:34 +0800 [thread overview]
Message-ID: <1612153234-7061-4-git-send-email-bmeng.cn@gmail.com> (raw)
In-Reply-To: <1612153234-7061-1-git-send-email-bmeng.cn@gmail.com>
From: Bin Meng <bin.meng@windriver.com>
mmc_spi_sendcmd(), mmc_spi_readdata() and mmc_spi_writedata() are
currently undocumented. Add comment blocks to explain the arguments
and the return value.
Signed-off-by: Bin Meng <bin.meng@windriver.com>
---
drivers/mmc/mmc_spi.c | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/mmc_spi.c b/drivers/mmc/mmc_spi.c
index 5ec6b0f..6d4f205 100644
--- a/drivers/mmc/mmc_spi.c
+++ b/drivers/mmc/mmc_spi.c
@@ -37,7 +37,8 @@
#define SPI_RESPONSE_CRC_ERR ((5 << 1)|1)
#define SPI_RESPONSE_WRITE_ERR ((6 << 1)|1)
-/* Read and write blocks start with these tokens and end with crc;
+/*
+ * Read and write blocks start with these tokens and end with crc;
* on error, read tokens act like a subset of R2_SPI_* values.
*/
/* single block write multiblock read */
@@ -70,6 +71,20 @@ struct mmc_spi_priv {
struct spi_slave *spi;
};
+/**
+ * mmc_spi_sendcmd() - send a command to the SD card
+ *
+ * @dev: mmc_spi device
+ * @cmdidx: command index
+ * @cmdarg: command argument
+ * @resp_type: card response type
+ * @resp: buffer to store the card response
+ * @resp_size: size of the card response
+ * @resp_match: if true, compare each of received bytes with @resp_match_value
+ * @resp_match_value: a value to be compared with each of received bytes
+ * @r1b: if true, receive additional bytes for busy signal token
+ * @return 0 if OK, -ETIMEDOUT if no card response is received, -ve on error
+ */
static int mmc_spi_sendcmd(struct udevice *dev,
ushort cmdidx, u32 cmdarg, u32 resp_type,
u8 *resp, u32 resp_size,
@@ -159,6 +174,15 @@ static int mmc_spi_sendcmd(struct udevice *dev,
return 0;
}
+/**
+ * mmc_spi_readdata() - read data block(s) from the SD card
+ *
+ * @dev: mmc_spi device
+ * @xbuf: buffer of the actual data (excluding token and crc) to read
+ * @bcnt: number of data blocks to transfer
+ * @bsize: size of the actual data (excluding token and crc) in bytes
+ * @return 0 if OK, -ECOMM if crc error, -ETIMEDOUT on other errors
+ */
static int mmc_spi_readdata(struct udevice *dev,
void *xbuf, u32 bcnt, u32 bsize)
{
@@ -207,6 +231,16 @@ static int mmc_spi_readdata(struct udevice *dev,
return ret;
}
+/**
+ * mmc_spi_writedata() - write data block(s) to the SD card
+ *
+ * @dev: mmc_spi device
+ * @xbuf: buffer of the actual data (excluding token and crc) to write
+ * @bcnt: number of data blocks to transfer
+ * @bsize: size of actual data (excluding token and crc) in bytes
+ * @multi: indicate a transfer by multiple block write command (CMD25)
+ * @return 0 if OK, -ECOMM if crc error, -ETIMEDOUT on other errors
+ */
static int mmc_spi_writedata(struct udevice *dev, const void *xbuf,
u32 bcnt, u32 bsize, int multi)
{
--
2.7.4
next prev parent reply other threads:[~2021-02-01 4:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-01 4:20 [PATCH 0/3] mmc: mmc_spi: Fix potential spec violation in receiving card response Bin Meng
2021-02-01 4:20 ` [PATCH 1/3] mmc: mmc_spi: Move argument check to the beginning of mmc_spi_sendcmd() Bin Meng
2021-02-01 4:51 ` Jaehoon Chung
2021-02-01 4:20 ` [PATCH 2/3] mmc: mmc_spi: Fix potential spec violation in receiving card response Bin Meng
2021-02-01 4:56 ` Jaehoon Chung
2021-02-01 21:58 ` Jaehoon Chung
2021-02-01 4:20 ` Bin Meng [this message]
2021-02-01 4:53 ` [PATCH 3/3] mmc: mmc_spi: Document the 3 local functions Jaehoon Chung
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1612153234-7061-4-git-send-email-bmeng.cn@gmail.com \
--to=bmeng.cn@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox