From patchwork Wed Mar 11 09:20:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 184401 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp401653ile; Wed, 11 Mar 2020 02:20:43 -0700 (PDT) X-Received: by 2002:a2e:2419:: with SMTP id k25mr1365378ljk.165.1583918442831; Wed, 11 Mar 2020 02:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583918442; cv=none; d=google.com; s=arc-20160816; b=XumCVuIPqKhwXvhbcPL8jXr2R4eFvOobQen4jhWeKwKN0HRvP8WoZfubc1MgfCCTbJ LWS5yRIAcSnIQ/e38y8jkfrrj4diFk5bFhwsXEua2M6v7RG6LGY1yOhFtnWbQWSItDfF /lYSLg49XE1iJVoqo9e3V5XsDiSZrF0XNiZ8ahY6Mya5EkdMcQFukT4wxc5pjM4AYniT nSzfTID3Jw75Lg57zIiycg22rcGfOqpvznlLabMQ1i6uZCa+TYyi+t7S3TYD0aO0TYVu HLrV1nGD1RnC59hwtKapNADF/kLTwSv69ah6aUcdBUzuFgrPLOTK5/PBLTw6Sk/HyS6v 25yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=gzGrKjx7T6bMEuJHSdVpyuDphTMIQkVy9Cv5wxaqPB0=; b=I+pTzo8Br97Fk+ovplian1LZPHdllvzSWDF6/4u3Yssrhmj+HGDZzI44W3AmQ81kqO 0QBr94Soa1s7akdfJfniP3Czx3oxb9PHrDweKmHuKpSnva6G8yh1UyhMu8/asQtRktVD 2c2UI9T5PF0HzfglYRe47AnwKbtd2ucp4tCAVA4VorR2lo/MgjdQIgAd8BQ/t8eQxQzD 6E8FvD7piaYxE3es5e8WXZPj14MUx3YYePJZyKuKmo6oFXAm8yRA+ISmPAPbXByLoW1Z jAhO4INKn+/48eQ4MJhIcvuIVVTJRDKFqbvV+tCPmgO8e/0oG62/z4/PQNhbCYB9BqdJ gFsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uin1HPcf; 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 t29sor449087lfg.41.2020.03.11.02.20.42 for (Google Transport Security); Wed, 11 Mar 2020 02:20:42 -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=uin1HPcf; 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:mime-version :content-transfer-encoding; bh=gzGrKjx7T6bMEuJHSdVpyuDphTMIQkVy9Cv5wxaqPB0=; b=uin1HPcfChLr7/kvEoXUMG9V77Sy64D58DUXUt5FD+Av68kNHXx9UzkxkTIB1ltLHF OaFD1x9gaQ5czvUXMyDnPpzqfRqnOz5B9Rqz/Vq3dgFdikwcco9QWil5fV8G4xIMPSd6 F4N/NvlHdcBVzcsQtVpGzGLaaKcl+ij3EZKgtcP0dNAkZ5iiTpU/Y0eAJA9ZSbAcTCcE URWRgtwwHzYDq/uu3tZHmiMxZavmxG+ngiSgFU3is365Q+FUsq5ffzHEjUbVS1P+ImVh Q+HB4rGtanTTejopcUyemcUxlRiOhtDyUg4/TiKSvC/6TWDj/pxS8o+knypUNWLcag/h lqFg== 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:mime-version :content-transfer-encoding; bh=gzGrKjx7T6bMEuJHSdVpyuDphTMIQkVy9Cv5wxaqPB0=; b=SSzKInErrrnayBzqTyoada8T6WCbf4e6Q7Yia0tAft60Mz8L01WeNIBy4VGOhTeU2z U81qsQAeU62tqI0DEDnkO5/0Gtkp4nM20+yCqVZBD3z+6lNJjQA5wOoRARTLYPl2znEf YHD3x1gzfzX0/jhOLL1Px44HKRrnc74huotkV2J9SdYmOOkT4LLH/9FnA48xvvb14KK3 9KeTKrJiBKc4ugF2QUuGW+ObivI8lYEDsajzfsF9Al+5u3lKf+EanHFWSSa9U6iCrz2H PHIAh5zEgkGCDHW85IS9AahKv/MstCO9R9PNRPqydd0bkS6ATYX9RN6UcDGkguKjVV8Z nK4Q== X-Gm-Message-State: ANhLgQ1hVibTPufxN1wmERQTyZBuvotLISDHWwKvpqK1+RfPvB5HdTiz Z91PDeBOCKNqMJyqd0SXOUR6Zsei X-Google-Smtp-Source: ADFU+vtZ+9l/EWWD6Wh6gxr/y5f9nLAAX9h4wbaqzGjDjekloDtJQpTBZX60pH/YmP5E/up8uDrXTA== X-Received: by 2002:ac2:58ee:: with SMTP id v14mr1571246lfo.62.1583918442381; Wed, 11 Mar 2020 02:20:42 -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 e2sm23169178ljp.55.2020.03.11.02.20.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 02:20:41 -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] mmc: core: Respect MMC_CAP_NEED_RSP_BUSY for eMMC sleep command Date: Wed, 11 Mar 2020 10:20:36 +0100 Message-Id: <20200311092036.16084-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 The busy timeout for the CMD5 to put the eMMC into sleep state, is specific to the card. Potentially the timeout may exceed the host->max_busy_timeout. If that becomes the case, mmc_sleep() 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/mmc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index f6912ded652d..de14b5845f52 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1910,9 +1910,12 @@ static int mmc_sleep(struct mmc_host *host) * If the max_busy_timeout of the host is specified, validate it against * the sleep cmd timeout. A failure means we need to prevent the host * from doing hw busy detection, which is done by converting to a R1 - * response instead of a R1B. + * response 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)) { cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; } else { cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;