Re: [PATCH V14 16/21] mmc: sdhci-uhs2: add request() and others

From: Adrian Hunter
Date: Tue Jan 30 2024 - 10:31:52 EST


On 23/01/24 08:28, Victor Shih wrote:
> From: Victor Shih <victor.shih@xxxxxxxxxxxxxxxxxxx>
>
> This is a sdhci version of mmc's request operation.
> It covers both UHS-I and UHS-II.
>
> Signed-off-by: Ben Chuang <ben.chuang@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@xxxxxxxxxx>
> Signed-off-by: Victor Shih <victor.shih@xxxxxxxxxxxxxxxxxxx>
> ---
>
> Updates in V14:
> - Use mmc_card_uhs2() to stead sdhci_uhs2_mode() in the
> sdhci_uhs2_request().
>
> Updates in V13:
> - Re-order function to avoid declaration.
> - Remove unnecessary function.
>
> Updates in V11:
> - Drop the check mmc_card_uhs2_hd_mode(host->mmc)
> in sdhci_uhs2_set_transfer_mode().
>
> Updates in V10:
> - Use tmode_half_duplex to instead of uhs2_tmode0_flag
> in sdhci_uhs2_set_transfer_mode().
>
> Updates in V9:
> - Modify the annotations in __sdhci_uhs2_send_command().
>
> Updates in V8:
> - Adjust the position of matching brackets in
> sdhci_uhs2_send_command_retry().
> - Modify CameCase definition in __sdhci_uhs2_finish_command().
> - Modify error message in __sdhci_uhs2_finish_command().
> - sdhci_uhs2_send_command_retry() to instead of sdhci_uhs2_send_command()
> in sdhci_uhs2_request().
> - Use sdhci_uhs2_mode() to simplify code in sdhci_uhs2_request_atomic().
> - Add forward declaration for sdhci_send_command().
>
> Updates in V7:
> - Cancel export state of some functions.
> - Remove unnecessary whitespace changes.
>
> Updates in V6:
> - Add uhs2_dev_cmd() to simplify code.
> - Remove unnecessary functions.
> - Cancel export state of some functions.
> - Drop use CONFIG_MMC_DEBUG().
> - Wrap at 100 columns in some functions.
>
> ---
>
> drivers/mmc/host/sdhci-uhs2.c | 379 +++++++++++++++++++++++++++++++++-
> drivers/mmc/host/sdhci.c | 49 +++--
> drivers/mmc/host/sdhci.h | 8 +
> 3 files changed, 420 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-uhs2.c b/drivers/mmc/host/sdhci-uhs2.c
> index 0c543899ed6c..b47bcf6f890f 100644
> --- a/drivers/mmc/host/sdhci-uhs2.c
> +++ b/drivers/mmc/host/sdhci-uhs2.c
> @@ -14,6 +14,8 @@
> #include <linux/module.h>
> #include <linux/iopoll.h>
> #include <linux/bitfield.h>
> +#include <linux/mmc/mmc.h>
> +#include <linux/mmc/host.h>
>
> #include "sdhci.h"
> #include "sdhci-uhs2.h"
> @@ -29,6 +31,8 @@
> #define UHS2_INTERFACE_DETECT_TIMEOUT_100MS 100000
> #define UHS2_LANE_SYNC_TIMEOUT_150MS 150000
>
> +#define UHS2_ARG_IOADR_MASK 0xfff
> +
> void sdhci_uhs2_dump_regs(struct sdhci_host *host)
> {
> if (!(mmc_card_uhs2(host->mmc)))
> @@ -63,6 +67,11 @@ EXPORT_SYMBOL_GPL(sdhci_uhs2_dump_regs);
> * *
> \*****************************************************************************/
>
> +static inline u16 uhs2_dev_cmd(struct mmc_command *cmd)
> +{
> + return be16_to_cpu((__be16)cmd->uhs2_cmd->arg) & UHS2_ARG_IOADR_MASK;
> +}
> +
> static inline int mmc_opt_regulator_set_ocr(struct mmc_host *mmc,
> struct regulator *supply,
> unsigned short vdd_bit)
> @@ -140,7 +149,7 @@ static void sdhci_uhs2_set_power(struct sdhci_host *host, unsigned char mode, un
>
> static u8 sdhci_calc_timeout_uhs2(struct sdhci_host *host, u8 *cmd_res, u8 *dead_lock)
> {
> - /* timeout in us */
> + /* timeout in us */#define UHS2_ARG_IOADR_MASK 0xfff

Extraneous "#define UHS2_ARG_IOADR_MASK 0xfff"