From patchwork Tue May 4 16:12:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 430879 Delivered-To: patches@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp3936354jao; Tue, 4 May 2021 09:12:37 -0700 (PDT) X-Received: by 2002:a05:6512:3b8c:: with SMTP id g12mr17536855lfv.195.1620144757075; Tue, 04 May 2021 09:12:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620144757; cv=none; d=google.com; s=arc-20160816; b=M75EHMbSpdmZ3gjvC/jo9fTldsaOuRGJznmch8CnpvqRmTtLqxaErUp7gufLaVdDG7 L53cp8orMyOklfsoFSGetBnKIqku4nVDd4gol79WOlfzyjPLngOA39w/HO0HBgW6K32F JncC3QAf2pefyXVKC4aywr8xtAGdA4JzaosYgGL7TpBR8c23MLOZD6x3t8P2n3xPovWj lNpGFhV5xzD85EqlYbp8YBtS04QoRrq4oHlwm6s8TcSJvSDUsBRjfSLg6Wkpfr8ugs2x NiL1B5Szi42/5TIIkvHeZBqV2HBtqM/kjdYBAsopf35R1PsjMsAWQeTcAWdwtyAOAHXC HLiw== 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=0EaNyrJPx800SxJDWlIRfuBN901wRckS9/iskflhAQE=; b=Fs1thgPTu3dozihmoz336K3+v0do2dJZ3gluEW15eozg5dIvDDPJ2VDAK+IClqRcCU T8MZz95M3IzCXEXc0OVBhwDSaLEJUnodvc5R+xBkguMJc7UxBHCR3UYcQYrZMZDXdzdL Mj6CvYM2vA4B+9UDgnrkJ/HyJndcN6z3HYvXbsGARUyo3oLGSeUI3PctMDYTkwRBafWL hkzu4SInFqPa/dseXeoSJ5x4lV5V2tq9HlvNnIxKY1YbN2HuzPD4u7ps23pEZ5G4DfHr CAcqaelWHuQCK2qaT7u1A87KeYwODaZlQMcFVYRIcOtejJD61TZY90kFxE/mPIPRVqUu iUwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rLqzdYDt; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 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-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id q4sor4170612lfg.79.2021.05.04.09.12.36 for (Google Transport Security); Tue, 04 May 2021 09:12:37 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rLqzdYDt; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 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=0EaNyrJPx800SxJDWlIRfuBN901wRckS9/iskflhAQE=; b=rLqzdYDt2bR1nt+32bTw5Wj2OBKwKaY9mrTO+TeMNsCSJDdsSHogYHXYq5aVUojavE 3LCmWXYW2vY3UAjcjB/f3iKc/sj6kaqqMUPm4/EO9RaJa6D6V5mAWSivkj7fGhnKWuAV UrvtBimlKBhnhYKItjnUr1wwzR9g4K7+MjnfkHv9MyLN6ZNtmBhyFXD1gUiCVeObhn8R 9rT7bJ6X7D4bzJG7yDkJ6XVoqMPt1cZICN+UiFYlAIS0c8ftRV2e172076Fxst9vrAo7 VralKmATjvw3d4BaT3+vwxzZPv4NA3r48RUgGFmcu+i085fi3Cdgy0POR82KLLN+201j 36hw== 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=0EaNyrJPx800SxJDWlIRfuBN901wRckS9/iskflhAQE=; b=CKQc9HaBJnna6pbFGZc0sOU/NIW7fwJPSo8vjBBCkDdz7w5m2EzRppLwlSlycbvac/ jzrHcq3UgNGF6Z0LKR/MmTG/LGwSmrbuMymIbfQOp8OCTor8hZIAM94jVtykFP4y75qK /PY0QTURTabHPYG284MxstcDlMvo/RYW0zUTjPDZejSAwXT/a3hV0RCWLZR2ri87wafy LVo51ngb+QDMTCRwaS3KJACjpp1IOEVOiArB4koo07/kB8+NY9AKVyBCsRWhPncBBk2V NnlA9yv3lXRREamRC5Fwff4Wwp8kcWG3rCbF1Ad7F103P5acJ8EYbgngvn5Q3YMN2AI4 gRUA== X-Gm-Message-State: AOAM531cqg0KG4yzCMtpQ23YBLDrEzKgLpXZinlabfI8MmWsZIIwlLss OiQRbP59QABUI1EjtTIIhKwLoutw X-Google-Smtp-Source: ABdhPJwJgHrJrftbsHwgtxIfiKijEzdjusVilj+/efOsaaWnqgmRssrUyapG+NpbSFPTrxS8x3rgWA== X-Received: by 2002:ac2:5fcb:: with SMTP id q11mr17218402lfg.248.1620144756714; Tue, 04 May 2021 09:12:36 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-98-128-180-197.NA.cust.bahnhof.se. [98.128.180.197]) by smtp.gmail.com with ESMTPSA id s20sm164193ljs.116.2021.05.04.09.12.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 May 2021 09:12:35 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter Cc: Linus Walleij , Wolfram Sang , Shawn Lin , Avri Altman , Masami Hiramatsu , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/11] mmc: core: Take into account MMC_CAP_NEED_RSP_BUSY for eMMC HPI commands Date: Tue, 4 May 2021 18:12:13 +0200 Message-Id: <20210504161222.101536-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210504161222.101536-1-ulf.hansson@linaro.org> References: <20210504161222.101536-1-ulf.hansson@linaro.org> MIME-Version: 1.0 In mmc_send_hpi_cmd() the host->max_busy_timeout is being validated towards the timeout for the eMMC HPI command, as to decide whether an R1 or R1B response should be used. Although, it has turned out the some host can't cope with that conversion, but needs R1B, which means MMC_CAP_NEED_RSP_BUSY is set for them. Let's take this into account, via using the common mmc_prepare_busy_cmd() when doing the validation, which also avoids some open coding. Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc_ops.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) -- 2.25.1 Reviewed-by: Linus Walleij Reviewed-by: Shawn Lin diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 025a4134d5c7..66ae699a410f 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -817,28 +817,17 @@ static int mmc_send_hpi_cmd(struct mmc_card *card) { unsigned int busy_timeout_ms = card->ext_csd.out_of_int_time; struct mmc_host *host = card->host; - bool use_r1b_resp = true; + bool use_r1b_resp = false; struct mmc_command cmd = {}; int err; cmd.opcode = card->ext_csd.hpi_cmd; cmd.arg = card->rca << 16 | 1; + cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; - /* - * Make sure the host's max_busy_timeout fit the needed timeout for HPI. - * In case it doesn't, let's instruct the host to avoid HW busy - * detection, by using a R1 response instead of R1B. - */ - if (host->max_busy_timeout && busy_timeout_ms > host->max_busy_timeout) - use_r1b_resp = false; - - if (cmd.opcode == MMC_STOP_TRANSMISSION && use_r1b_resp) { - cmd.flags = MMC_RSP_R1B | MMC_CMD_AC; - cmd.busy_timeout = busy_timeout_ms; - } else { - cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; - use_r1b_resp = false; - } + if (cmd.opcode == MMC_STOP_TRANSMISSION) + use_r1b_resp = mmc_prepare_busy_cmd(host, &cmd, + busy_timeout_ms); err = mmc_wait_for_cmd(host, &cmd, 0); if (err) {