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 */ From patchwork Tue Mar 10 15:33:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 184355 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp848393ile; Tue, 10 Mar 2020 08:33:50 -0700 (PDT) X-Received: by 2002:ac2:5473:: with SMTP id e19mr9822220lfn.24.1583854430365; Tue, 10 Mar 2020 08:33:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583854430; cv=none; d=google.com; s=arc-20160816; b=PNnCCmNNCFStNzgnrWCIltlDxL84OpQs8gnx8eC5UMyloEdUuB1z/E2sFZAx3VBrA5 onzGmm4GDwSzLm2CJdB7GVV8JjVbU/W9wuAc0MrytYV6p21QUUy4K5eJHXz81WhkuxwM 5VCgIf4d74MOdsu0Gw3I96X4Lss2EwDbl4sOccyfRokYum5CFIAp33hEdcNh6g6Mp1Q1 jKml4/sGdyJpOLDpbRrwUb30IJwJomD87b60HaAFh7NZ/i3AIRKujiNel7+rHQLWJXy5 LhJy1QYouEO1dFFLdyC1NJsKH4Sg7nUFnBzBT0QPFdQXcU9eEi/zRXE6LLnFM7SCeFYC iXew== 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=GFF5Nn+0MYGNKIt8ggfC3I2q2J2gXyLFnHV/fd1EhtU=; b=hSzMfBpHM7sohEPtDNIirgRnx/koBvvDKGUPVCjG/nYkrwsF/xAigDDXcB3ie0gkpD 78xlY19vAogtpld/SFHy3mNbrp1xDJKtjFdmQlqa+ZSRM3OrRYxOo6AU6S7/u4s5jCy1 LDSnE8iIC0wk0EeLhzjNIFjGRmvna3WRM2CLam94BnwIV5w561iRkveOZ4mIO05sAvcL 1U8Be0/iaWq+K1SJu+0R6/2/OAKksd4T0ejwJhfGBGgcDo3qXhyLmz0g3DXuXF2XVzRC quhCL1Ed8zjyNYYcLND088zy8cK2HmoEZSMI9VKbsY9AR4lXsNtyz5N5PfIVk4105BGb N60w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="j/MqCVvH"; 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 q2sor4461704lfa.14.2020.03.10.08.33.50 for (Google Transport Security); Tue, 10 Mar 2020 08:33:50 -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="j/MqCVvH"; 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=GFF5Nn+0MYGNKIt8ggfC3I2q2J2gXyLFnHV/fd1EhtU=; b=j/MqCVvH17KM8gW1kqrm22z+IZnEON6jMprpfTXFef3hwZzBL/5WAe/3AdQmRut44P uE9EZfoKSXp6bNBoCpNmkPmzcOzDyAAMLwwXnkXYhltJXzDirX1mUsEAGe5XfUsdFPMc MEsDi86NBxIuRq5anIInjaWiBP/7hw2xNqWSBLrFlkj71pjeqd8YhbKJXNU+QEtHLEA4 eVhearQSqCxRkE92r1r5r5rtFaElLAfNHzr4mHC5dhwnzxSoxJaNfPCfq+LbVA4uyz9C UIzG7htevwJ6oZTs52ZmtrT/4c2NbklYogsaUxD987R9bYOpGG1RDGWqNcPNkcfWQxtE aFxQ== 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=GFF5Nn+0MYGNKIt8ggfC3I2q2J2gXyLFnHV/fd1EhtU=; b=MSZ/QSBmxLo0bEZ1O4gvnrUQzOYpYCrYHViJqmGxqfmvioEfPSB1ldA7zzz7JxR+Mr gFIhyqEZyhyfpLwAoYVmY/8oLadDlQEGoFf32ZNELFB1pQ9lD9dIdZipkku6ka99dIvq moiwIX25wOHxm/DOTyYzxsqZ6iRt0UhXq/R98MtNui7A44SdwFxQPhUOVWFFOsqRgTRA G+73zDBHoq6EYmWFVJTYmi3VR/lSW0xmZfkIl1OgMERgwMqBZwnIW/lU2K7kQJ7kT6xT hjIjVn4CZHoGeMYTyS4vxYvl4PEl+KMAg2rONyiM2zl9WMZk6TcBoO4GHaNKqdn2avqM GKAQ== X-Gm-Message-State: ANhLgQ3dQJYSPtUb7hZn59tMEsYgyotavAVTV09sxrfmJ8uHGNnMm2GO 65bbdWAjqvoqJ99GsizFIdzEOFJ/ X-Google-Smtp-Source: ADFU+vtmiH30+Gm0I+Xbs8uD729V2mXSp7zVFQvsuP5yXIuBa5z2yMtZD6BoHHuDJ5/la1sxw6jVOA== X-Received: by 2002:a2e:b1c2:: with SMTP id e2mr4080968lja.288.1583854429815; Tue, 10 Mar 2020 08:33:49 -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.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2020 08:33:49 -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 2/4] mmc: core: Respect MMC_CAP_NEED_RSP_BUSY for erase/trim/discard Date: Tue, 10 Mar 2020 16:33:38 +0100 Message-Id: <20200310153340.5593-3-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 The busy timeout that is computed for each erase/trim/discard operation, can become quite long and may thus exceed the host->max_busy_timeout. If that becomes the case, mmc_do_erase() converts from using an R1B response to an R1 response, as to prevent the host from doing HW busy detection. However, it has turned out that some hosts requires an R1B response no matter what, so let's respect that via checking MMC_CAP_NEED_RSP_BUSY. Note that, if the R1B gets enforced, the host becomes fully responsible of managing the needed busy timeout, in one way or the other. Suggested-by: Sowjanya Komatineni Cc: Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index aa54d359dab7..a971c4bcc442 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1732,8 +1732,11 @@ static int mmc_do_erase(struct mmc_card *card, unsigned int from, * the erase operation does not exceed the max_busy_timeout, we should * use R1B response. Or we need to prevent the host from doing hw busy * detection, which is done by converting to a R1 response instead. + * Note, some hosts requires R1B, which also means they are on their own + * when it comes to deal with the busy timeout. */ - if (card->host->max_busy_timeout && + if (!(card->host->caps & MMC_CAP_NEED_RSP_BUSY) && + card->host->max_busy_timeout && busy_timeout > card->host->max_busy_timeout) { cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; } else { From patchwork Tue Mar 10 15:33:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 184356 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp848417ile; Tue, 10 Mar 2020 08:33:52 -0700 (PDT) X-Received: by 2002:a2e:b6c6:: with SMTP id m6mr13217959ljo.3.1583854432471; Tue, 10 Mar 2020 08:33:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583854432; cv=none; d=google.com; s=arc-20160816; b=UQp70uIMeVljl8imL2CaQI+o6v3Vuo36BXHGKJjXRsgYJDBNDwK9uwmx4ZNoaAmU+v MSfTVsZGYvQbW3c/k2N4vRNM0ZE3oKNo1NPsc5EM77eHEf6ycAhMo9rAV/mQrkr7vVz2 38xmxReShDkWWyJVPMcFOCS88j/Ph5ZrfqirEWPQQGGt0HuNG68tc7SxJxE3MSVEQa3z xNoVITq8zDBwzd5PvuvP+WdDletdjuGKRCeCbo3ijADth8gDintYOMmaq8A0hf+cwbyp 9ktJdY/Dc+KvqvXM6OnCkz4yqke2bnCEUHo9NdoEqgzb9RydIBHphawxa/ozL0R1BcTu BaEg== 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=tQ91NJmSAV4APRs3KHb2zhKlTLEt52ygW4o1xrxv0Yc=; b=Q7cSO6PsZ4ymmQOW4s6HcVzqp36mWJDdJHgU0GXlw1JpqsC7MB+YjO15ftgvIi16eN LuThjxiaZ37hETvx6o7GRVvejRTTn1AbQUO7U5pLVPaRlV66ankYz5fFFwTeYN7HJjCu XEat7Ov2vCBX5+lWqpdS5kbeZPn0decQ2oUCZZN41Oztb0XhkhiPYR5wrkErcFkksIjl aa3BrLv077sVPZvW+M+rvg1SfUwr1LpD+9fJcHhnlk/Cbfer4tM+hpg/SWf76/7kjkqB ePZOFu8jlsN5ETq+hXoVo/tIkLE88IajJ9FglpTktDfqgF49G1NMkBdeEzQRqf2aM5a3 MVnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cGdazkWP; 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 x6sor4099265lfq.26.2020.03.10.08.33.52 for (Google Transport Security); Tue, 10 Mar 2020 08:33:52 -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=cGdazkWP; 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=tQ91NJmSAV4APRs3KHb2zhKlTLEt52ygW4o1xrxv0Yc=; b=cGdazkWPAfKhtnRnEI2GJzFwuVajaBOS4BQ8hqRTuAgc81uzqNxFrUtq6heoNaKsSU OZWF59ABGCQQRm43Ezooj5qClm98b4lC2ETvbslgeg1zcRIOc1kNWoBa9yfyTCd2hDTH g7XZ7EGusHb2yPm3G2Etafv9bDdPlhF9oBgHUNy3s4ZUJINM88zPILHB7p8b/0UVKxmc IFspfNsRKQ8Agq6u/MYR+v+NA5Mak11gbH6sJsz2yh6pgaq8E7bcQ3eCzFnIaBXBvZjy hlzn9nd296Q6BaA2E20i1LCYf4xImX9mORB10ES0NGu3Fa5+zE4k/uCtDB7PsEWR4gPc SdIg== 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=tQ91NJmSAV4APRs3KHb2zhKlTLEt52ygW4o1xrxv0Yc=; b=K9oviOEceEIys3f09bloQsZ6jZcCzjy6QkdXDHPdiXqAbXyOg3txaxMpyyGbtDntp8 fxpZIDsP/K3+pMWhDNmkqD4STx8Ek2OfFiuxWbXwhx+L7oMS0SZcXgE3gtPYVaBRWfLP il8e713TEu4Di1PlCSL3G/vozw7oi0wBIqFSdUCLvv2UOTI6oE5E+gGC4kR8Zaw0upy3 AN0NFSKFywGWCyMPXKthLjvl7fKJ8V+PUfAIKn3Lw2nfJDBMrAG9kKsn+qsGsIOhKHRK v8WxermBDY7I9A48gNtYtzQHBzFHKeOy+bjMR6YPa38MUY+uADtH+ZC+cm6w/mwx1QaO NH4Q== X-Gm-Message-State: ANhLgQ1A0Pyiy3e33q+lUIOdgxCYYzTpT/x5KFFKMKd3S7fceZYzYSRD 6prcgKzMZrRi7nbepeS99gwAYx5R X-Google-Smtp-Source: ADFU+vsIvho5Opw/cggl/Q7zZCuGRhCYRY6r8tou4/ZEGVeYx3TZIfDapQeyl9aT5hVka/YBRvw9Jw== X-Received: by 2002:a2e:a419:: with SMTP id p25mr3027492ljn.206.1583854432037; Tue, 10 Mar 2020 08:33:52 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2020 08:33:51 -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 3/4] mmc: sdhci-omap: Fix busy detection by enabling MMC_CAP_NEED_RSP_BUSY Date: Tue, 10 Mar 2020 16:33:39 +0100 Message-Id: <20200310153340.5593-4-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 the sdhci-omap controller requires the R1B response, for commands that has this response associated with them. So, converting from an R1B to an R1 response for a CMD6 for example, leads to problems with the HW busy detection support. Fix this by informing the mmc core about the requirement, via setting the host cap, MMC_CAP_NEED_RSP_BUSY. Reported-by: Naresh Kamboju Reported-by: Anders Roxell Reported-by: Faiz Abbas Cc: Signed-off-by: Ulf Hansson --- drivers/mmc/host/sdhci-omap.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.20.1 Tested-by: Faiz Abbas diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c index 882053151a47..c4978177ef88 100644 --- a/drivers/mmc/host/sdhci-omap.c +++ b/drivers/mmc/host/sdhci-omap.c @@ -1192,6 +1192,9 @@ static int sdhci_omap_probe(struct platform_device *pdev) if (of_find_property(dev->of_node, "dmas", NULL)) sdhci_switch_external_dma(host, true); + /* R1B responses is required to properly manage HW busy detection. */ + mmc->caps |= MMC_CAP_NEED_RSP_BUSY; + ret = sdhci_setup_host(host); if (ret) goto err_put_sync; From patchwork Tue Mar 10 15:33:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 184357 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp848457ile; Tue, 10 Mar 2020 08:33:55 -0700 (PDT) X-Received: by 2002:a2e:5744:: with SMTP id r4mr9830682ljd.67.1583854434545; Tue, 10 Mar 2020 08:33:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583854434; cv=none; d=google.com; s=arc-20160816; b=a7p1UxVTrV319LcvEnnXjShOl1dgmUpnkWzeDnqK4AvylmaK/wPfcXwiNhn4jyAYWz MTh4f60Yocz2Oso/64cbp6u9nuwbAuR8r4BFCYJchp4oP/Lt0WHM5I2FRdMubTcde1dw UY8jC52+ajSIm6442IYg6zxPzep8OnlUXT+9V2x6ppZl5KEjTuzTTDf0hdkHQ31OkUGJ Vjv1akUUBhOTi1CE7UzWqQu3QsE3DD6sljgWPhwlJWcz9VibeqQktYT7R6roswWetvu+ HHhoTkI0jfvT5XRjIKtqS+3fAwf+dMZVbPxSnw/XvNUdxEuoJIFO2I6K1JzFRMwa5c9w TqDg== 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=zXfY+hm6nAyuD/AmdMy4F6zgsNBRxXYSqgTSrNob95Q=; b=nutXKC39s1vPbyPnHfhVJwPLoSK/Jn3OAFjH7M46EpXndzpOZwRhfBFnsh1P0N+LOA w1e8NFVS8QAnuWNjY/d7CnJH2qRB6a+R+1XO+aDJCT7TCsCnUZgldGTlD3qSO1Nvcp38 hFwF5KJpfktGDyoz3UbCjlhSyc/iAft/d6xbPXGNVKOeTAxBzs/CRDa5sPrM+lYqZgur fw9BeR0BqYXaPH6+qF1YJxXaC5z+xCx4mZE3IsrxPTNDc/KfNBVku2zWJAhvctg8ZpjX ZwPS5xgSL1enmUm4rH09smk1mmwO/pT3moqR5TDWru2XZFS7ZH2P+pCJXp6ax86sUpF/ psvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=evewDF+w; 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 h5sor3434349ljl.26.2020.03.10.08.33.54 for (Google Transport Security); Tue, 10 Mar 2020 08:33:54 -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=evewDF+w; 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=zXfY+hm6nAyuD/AmdMy4F6zgsNBRxXYSqgTSrNob95Q=; b=evewDF+wTbM0lLqZStPAgQrySHKOjDHSrTd0D3LYXi3Hs1GFNSR2WKOt5NSBLo8RIp LxOIXvlUl3s7CuyOoTRhBAfyHxGwEtKkv0VIU1R7vqrvkTlLg9qrbqES+G6AwX0c89Gz A0dmrhmJ/vNNCaOjDh2a1J++41kzdyq0wzhbk/qe+/NGoCdog6ZJ9BhLi5F2vygH/2r8 muK7CKqK/LHc8xNMcwbBlDDoC69aDJYHbJ9JJ0e5MO/szgUP5RsFkn/IrdTv2ZueelUS 9vukUF7mTkIb2upmvxx/cqXFl6PlKA5UnMs25tKaAvlBRbydEx3XD0EfYAayl45jYRkO Qx5g== 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=zXfY+hm6nAyuD/AmdMy4F6zgsNBRxXYSqgTSrNob95Q=; b=cKPGNp4qiRGyJ5eyljmUpzLP4oUXnlpbFZTCdxsULB+pWKwwjTSb5gz/qlrXXTSFnz fvScEsOfJI4tDNnUA0K57EjxkPIo0bYDfiz6rLNaa2BczzfZ6ISIHXLZxR2ipL0Cm1pb w4GWXKc/encyPgz9jcXRf8OUNOreOgNpwt0V6SnWM86lMLR0QAwuxu7GqFgbyM4eoYFE BjIht7qpHFt5QNE5AUYgJacdgfpat9bB/KdA2wUuFSlH7s3JNGS+zBaebHkBtXxnPKkT rpUb2VxQMYIhMGpBh81o+c2uIVS8poLOSMvzAZDEmHr7H8I+azzbSPVFBJWcjXpCEoOe rrjg== X-Gm-Message-State: ANhLgQ3pkx7p+r251fBgSksSKP/MNna/PfQdMaj6JOYlcVTsxgEmQKPp bKXdVpqjKk9SigaGujfRWO5NfVcN X-Google-Smtp-Source: ADFU+vu0tIjfpP50RQbzS8Z+nzh45tErRu3mPFdaEIEBUL9uWfO0Z5/yv52Cb1ks+dOCE2AuCLaiKA== X-Received: by 2002:a2e:3608:: with SMTP id d8mr12867272lja.52.1583854434100; Tue, 10 Mar 2020 08:33:54 -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.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2020 08:33:53 -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 4/4] mmc: sdhci-tegra: Fix busy detection by enabling MMC_CAP_NEED_RSP_BUSY Date: Tue, 10 Mar 2020 16:33:40 +0100 Message-Id: <20200310153340.5593-5-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 the sdhci-tegra controller requires the R1B response, for commands that has this response associated with them. So, converting from an R1B to an R1 response for a CMD6 for example, leads to problems with the HW busy detection support. Fix this by informing the mmc core about the requirement, via setting the host cap, MMC_CAP_NEED_RSP_BUSY. Reported-by: Bitan Biswas Reported-by: Peter Geis Suggested-by: Sowjanya Komatineni Cc: Signed-off-by: Ulf Hansson --- drivers/mmc/host/sdhci-tegra.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.20.1 diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 403ac44a7378..a25c3a4d3f6c 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -1552,6 +1552,9 @@ static int sdhci_tegra_probe(struct platform_device *pdev) if (tegra_host->soc_data->nvquirks & NVQUIRK_ENABLE_DDR50) host->mmc->caps |= MMC_CAP_1_8V_DDR; + /* R1B responses is required to properly manage HW busy detection. */ + host->mmc->caps |= MMC_CAP_NEED_RSP_BUSY; + tegra_sdhci_parse_dt(host); tegra_host->power_gpio = devm_gpiod_get_optional(&pdev->dev, "power",