From patchwork Mon Feb 1 04:20:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1434025 X-Patchwork-Delegate: van.freenix@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=kmN6nmfh; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DTZWt4CJcz9t1Q for ; Mon, 1 Feb 2021 15:21:30 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5AE47826F2; Mon, 1 Feb 2021 05:21:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kmN6nmfh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7D5D982713; Mon, 1 Feb 2021 05:21:06 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0C6DD826F7 for ; Mon, 1 Feb 2021 05:20:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-ed1-x532.google.com with SMTP id y8so2176735ede.6 for ; Sun, 31 Jan 2021 20:20:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4tm4rMluyeV52jES6FYVLL0aNY3WjIlzcdvRGFCjuFg=; b=kmN6nmfhAoglNOEhUft7PfLMV7dmxHu2Cizmk1ZuXhFALGWXlzmtlPoPJ4o/hDha7P ok3nK97aJzngvWVeqkrSkHYewrZwxStDlHz8ID80xG4DDGKm+N2Ehunm1BgAGQ7eMHZX wtQtXTszf1zFBUm/8BeGkzMmCUwd0XaylVRnva7ic2x6+XdEJoQuX8hzydiOdTy8KVid mzoZqaoIdyT5Vv7j3bP/Yis40tHNMoDPmv1z+SJVghfF/vlirFZ8cS943xkDcnCNhND6 SYJnrTCVGx8+4ieRmmU5EY5MI1qUXAbubuBcqX8qb7ZFozXm3Ok9Syi+3veVevB25uJP MEpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4tm4rMluyeV52jES6FYVLL0aNY3WjIlzcdvRGFCjuFg=; b=KkdqGhoU54lFPfbIvDf8ZwjlcyvrwdUWDwnM1aP6PagJJV6NZcyx3as1tBQ1xWcjj+ TxIvus5OmiJ/TIXfHSmAyZtehDcPSVRLSVpN+nOxQq+1AsfTAEHcF2ApxCh7KR20JYrY SbUjyg2IAfthxhbvYm/hJnAzgomNbtXsRQT/fRusKTW5tJsCBrR8AAEm0nmII5WB6+w7 pjN3lCSWk5ygvGTW4GTv7nScHwJ/r5MGN5uS8dpH4pBHMf/vFJ3BP4zCqsL5rBtj4wYf OiELSPG5tj3ef+s0dMl2nTzYTIDkdz9+KniTn3C9KsoGId7xYY5PGFfiIJqi075WwfPB s32Q== X-Gm-Message-State: AOAM530zISwZHfVvM4FLs4c6tFwVDNP8ugdcf6oDzUssteC9R7fO87vY oubvC+1OBb82QcrOGKwBE6w= X-Google-Smtp-Source: ABdhPJwP/QWQRHcqKRpvYNKyvPyb/gdjZsKn9L6sUBYKxB9xSfEVUGbN2tTtWSwCaQSE9dVfCEeURQ== X-Received: by 2002:a05:6402:1ad0:: with SMTP id ba16mr16914251edb.287.1612153258717; Sun, 31 Jan 2021 20:20:58 -0800 (PST) Received: from pek-vx-bsp2.wrs.com (ec2-44-242-66-180.us-west-2.compute.amazonaws.com. [44.242.66.180]) by smtp.gmail.com with ESMTPSA id n20sm8094302edr.89.2021.01.31.20.20.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 31 Jan 2021 20:20:58 -0800 (PST) From: Bin Meng To: Peng Fan , U-Boot Mailing List Cc: Jaehoon Chung , Pragnesh Patel , Bin Meng Subject: [PATCH 3/3] mmc: mmc_spi: Document the 3 local functions Date: Mon, 1 Feb 2021 12:20:34 +0800 Message-Id: <1612153234-7061-4-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1612153234-7061-1-git-send-email-bmeng.cn@gmail.com> References: <1612153234-7061-1-git-send-email-bmeng.cn@gmail.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean From: Bin Meng 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 Reviewed-by: Jaehoon Chung --- 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) {