From patchwork Tue Mar 10 15:33:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 184354 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp848367ile; Tue, 10 Mar 2020 08:33:48 -0700 (PDT) X-Received: by 2002:a05:651c:486:: with SMTP id s6mr13397943ljc.100.1583854428789; Tue, 10 Mar 2020 08:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583854428; cv=none; d=google.com; s=arc-20160816; b=XI/Pe/fVHfD4QuUYo/2/1TSu8KQ4Y0T6TMHZz8sJcRQn1P6L/n+hs7lKyaHy4LjXeg HMsc2kLTsPCPUGaWKY2zNulwaL3S0G9Kku+jdhDciUnHkr9uhyZeh/y5RpGXNrt3KQ3J hQmQqLRf5MI3UCgN462xNp1dYQwIiPnku9BxaRFqGc+LEjSn0O9m8UtgSkXUga2IqAd3 Y9DJ/gIT7ePriCixaIZlwA7Tdvm4di3uUsLB8A7tYuIKIPHFrJ2uBYSGImncyZzsmebQ u0E5y7G/imeCRE994Prfxx5kNRAz8U88dB+Xl9lOpizWO6S7Gt0oDw+QcaCrC1oXA3uH 6dCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=0AS4iD/EqLgDWiA/Em9kdqcmCXIvsjkX4pJSBWor6Nk=; b=ugq4lP8TMRatuROYp+pFC34VvZ1pGadNXJpleWV5/dES5iP3WDQsf3oyX4eXIHRoG5 qjOZHJGwhiqrqUYapJypWMtAfLWTrT/HrHLRKPjp2ACih5QsKF03b82VKea0bRBwoSqn 4QWT/Ee50xdlqC2x/ovYZt0WYEsCmAbTsb5TWg07c60jBjAO+whQErxQ3Jh9/HpDIiZd K9pAwFnFtutHPjJub/V1ty3CeM5gIgNzekGB3mKfbpV8GMD2xYYZpDV0HK8qFm5oerGb K2DfZthq1dCd14cZN0EKNvwl2i/NdiBYDS8BAbSwOea6c0DmpKT68bxoVyo3BnM/Ees6 ZULg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="d3gT/cV7"; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 204sor5171763ljj.46.2020.03.10.08.33.48 for (Google Transport Security); Tue, 10 Mar 2020 08:33:48 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="d3gT/cV7"; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0AS4iD/EqLgDWiA/Em9kdqcmCXIvsjkX4pJSBWor6Nk=; b=d3gT/cV7yOBnJzdr1xBBXMnSAnWAFLDvl7xcHlspC0LOGFpsE72iS1YE9y9y1hng/8 sVSc2dRPuFLTwq5AA5GAA4NjVCYrvI4spfy6YFz9qV6Bkufx+syjQ/YfV09B0Hw8grLz scrjQBrAxtPZsDpMoTyYsktdNQ9Dw5JtGWltX2b05iZX01gTZ84NVjkd0NQd5efjTm5D 0jg3uvhnLV4DfctHeY6npC1Klk3gdFU5zG+79f9ngEBV4TGe8vvilXAi7NKk1XBCnUDA ASRWW/gH6EKTbIsc9nX+RY5S3+YDYQPBYp9pk307/CS9FDalkm0EFzDtt65dofgKd3TV eQqg== 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:mime-version:content-transfer-encoding; bh=0AS4iD/EqLgDWiA/Em9kdqcmCXIvsjkX4pJSBWor6Nk=; b=dvPxSMVu2J4KmrdTkCgzGf+B94UDZwj+G2P6ulAZPGdSkbo0/fs4xzdQkZBrDQz+pu xyylxpB07BTt4uI1AyXKux8PzZFE9adfR8pKwDIvNr01tHSUI6uzYNZXpG8K779rFTU0 LUn47yKnIGerB1JP7ineO3YVgVgXxtzNQe6gMI9LsH67x7tfg4gOpB22PXK6qjWb4Las WjCNHg9lrlXtum0exxzOi9SrFktYMmu6FihEFNNhY7ekM8XOf5CztlR4XQqsxywUJ8Zq i4NcRLJTAY1ZJzu+F2gDOqifFsjVKpePnx5FtGatjbf7Tt+EsTtJ1Dgw7+oRux6cqPpK USUw== X-Gm-Message-State: ANhLgQ2NEl3Fk2OhZZtKgLIWH+N5LVk7gMPhijPZTk33Kq6hC6LWdr0S DdY0DHfCT1GYG705HxP40SP0iPOk X-Google-Smtp-Source: ADFU+vvDpOfAMYNpRyOb2/6Q/jBOsY7V3AOt4HZMfeH3/3M38eXJsrZFEEpUT+38SSIr+2kEgT0qCg== X-Received: by 2002:a05:651c:414:: with SMTP id 20mr12234008lja.165.1583854427939; Tue, 10 Mar 2020 08:33:47 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id c22sm17283776lfi.41.2020.03.10.08.33.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2020 08:33:46 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Adrian Hunter , Wolfram Sang , Ludovic Barre , Baolin Wang , Linus Walleij , Chaotian Jing , Shawn Lin , mirq-linux@rere.qmqm.pl, Bitan Biswas , Peter Geis , Sowjanya Komatineni , Faiz Abbas , Anders Roxell , Naresh Kamboju , Jon Hunter , stable@vger.kernel.org Subject: [PATCH 1/4] mmc: core: Allow host controllers to require R1B for CMD6 Date: Tue, 10 Mar 2020 16:33:37 +0100 Message-Id: <20200310153340.5593-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200310153340.5593-1-ulf.hansson@linaro.org> References: <20200310153340.5593-1-ulf.hansson@linaro.org> MIME-Version: 1.0 It has turned out that some host controllers can't use R1B for CMD6 and other commands that have R1B associated with them. Therefore invent a new host cap, MMC_CAP_NEED_RSP_BUSY to let them specify this. In __mmc_switch(), let's check the flag and use it to prevent R1B responses from being converted into R1. Note that, this also means that the host are on its own, when it comes to manage the busy timeout. Suggested-by: Sowjanya Komatineni Cc: Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc_ops.c | 6 ++++-- include/linux/mmc/host.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index da425ee2d9bf..e025604e17d4 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -542,9 +542,11 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, * If the max_busy_timeout of the host is specified, make sure it's * enough to fit the used timeout_ms. In case it's not, let's instruct * the host to avoid HW busy detection, by converting to a R1 response - * instead of a R1B. + * instead of a R1B. Note, some hosts requires R1B, which also means + * they are on their own when it comes to deal with the busy timeout. */ - if (host->max_busy_timeout && (timeout_ms > host->max_busy_timeout)) + if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && host->max_busy_timeout && + (timeout_ms > host->max_busy_timeout)) use_r1b_resp = false; cmd.opcode = MMC_SWITCH; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index ba703384bea0..4c5eb3aa8e72 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -333,6 +333,7 @@ struct mmc_host { MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | \ MMC_CAP_UHS_DDR50) #define MMC_CAP_SYNC_RUNTIME_PM (1 << 21) /* Synced runtime PM suspends. */ +#define MMC_CAP_NEED_RSP_BUSY (1 << 22) /* Commands with R1B can't use R1. */ #define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */ #define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */ #define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */