From patchwork Fri May 8 09:52:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 186321 Delivered-To: patches@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp4001887ill; Fri, 8 May 2020 02:52:32 -0700 (PDT) X-Received: by 2002:a2e:b4c2:: with SMTP id r2mr1173228ljm.143.1588931552376; Fri, 08 May 2020 02:52:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588931552; cv=none; d=google.com; s=arc-20160816; b=kFtP/xb0F1ZfERhXtB9X2YoHTJUs6nxVg1JgHhpToohK4slgxUA62Gvdx0Qz3s80l/ 78kwOYecbqau6DSFHzuMhdwQDol1YomWz+Y2/awMR4Zv2uZs04m0lIwJYFXVoxZx5aen ydetrw40GnntrpwPoNqq/UVC8SBGcmjNTv/osbynEEHBPsM8FvwyW6PBrljJmcCgrTmu bFc6QKkXocW0HYRzwpT3qbLAAmz3qemmNKAzCspv5K+XVwLRqHp3NYgD/HaQTHbegvQv jamGI0rb0kIOjnz+YFIISt5i94an3ZME44pHyHKMlyF1LVxp8E1FCH27BgEeoAjHIeVt 8yHA== 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=4TJAm+9iRwtFh5TlrP2asksTQquFny7nfEfVBEpyuw8=; b=HwkLVb0MyILgdB024UvUaFiK72KdqdlTW0CBamRyWzFZHtkulPfdAlAoHGXEboW526 5klyYOtYqV8Qw76QOC0LHi3jvrAhyAPE/h7SbFcfwadb+XdDQ9QmaWfY+z2Ip6KMKFeV X7wU1iT6faAriTQIMdq7b6mgH8CX+vioc3MWDUDoI0vvWtvs6Raq+v70B+AvngGrQset n7julJhNkyOyJUfTlDvVuYqSIDtAXqSpnpK1Am5C5Y6Q8vRy8pQJHw0/cuUpB4r8xikI 4RwrRGxlyUcUaVhwPozuahouaddNXRd30P/CB9yI8ukptTpOkCGKPkJbGLtAkYFoWYJt o7Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c7Msaojw; 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 y14sor758405ljc.1.2020.05.08.02.52.32 for (Google Transport Security); Fri, 08 May 2020 02:52:32 -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=c7Msaojw; 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=4TJAm+9iRwtFh5TlrP2asksTQquFny7nfEfVBEpyuw8=; b=c7Msaojwv00ZdbXSdNCabebkEe++MednrzhUl3DMwXQem1gVAmWmN6Q2nLJorbp0oo AHJ7j0FrtapDVBhPj45nzqgECClW37RbnRtg1jTX/OcmzsmSEYoAEl+22drLA1L38h/F V72ZlJLhZII3/g7z0QeCtuFNM5bpMBiJi8xXUabJ3YBsZPftogdGmZORQ0y4MCHkBqgt 0BbD6E9JThlpsClq+Jyy5nvZ267EmmiZG0NjkYb7w+2rmXVHEZ+A8gpIYbhGCIuwZWrG qgesNSFmDk3tKa2qEGz174wyq8J1IDrzJ6ZfrvylCTxSzA02+39gPvP+SxHgutYYJ7ek 9p7Q== 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=4TJAm+9iRwtFh5TlrP2asksTQquFny7nfEfVBEpyuw8=; b=Km7KxEkMBcgmp6HrLMTwmr39pF59yqnSzgcKGiN35lvMEvww9VxM5A76n0dj6NKVGS jKUKrQqrfVxLuP7tEZ1O6RQy4Bu6pTpHmToroFvgdCHupTViBgKmsXXRXjRrNu4Ck0pb 6/RN8JZFb80eYBxjECJc7x3DyO5f6EO8Cq/WuGfdUjpIMfZrcObk9YM+3TPMm3EB1J9E mhhYTHenoZ0nrPXx7b7nz9A57sLuU4rrLGEB+G0PXgP26iiADvJEpYyHv9MBbLTWPSr/ QhospJjXjz8eRAiGC0DRKvKZyjAg72WHJ0Ty/NqU9vi/w9x1bBbQg2s4xh+mFSXi9CB7 dWYQ== X-Gm-Message-State: AOAM531NHY8fPFEAC2XQM+vv9pyw/ry/5WmDLqU2RzIEt06eh+W54Hh4 bvC6tiTaHXZv6jArnLGC+B9ITtJC X-Google-Smtp-Source: ABdhPJz4u10vEjx1Wn3f64pWzn2t909DNsFV/HrElxLnIrccwUZtWv9ihIG8S1A1PnzbPDg8o1x6QQ== X-Received: by 2002:a2e:9b0f:: with SMTP id u15mr1146568lji.272.1588931551949; Fri, 08 May 2020 02:52:31 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-98-128-181-7.NA.cust.bahnhof.se. [98.128.181.7]) by smtp.gmail.com with ESMTPSA id t16sm882846lff.72.2020.05.08.02.52.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 02:52:30 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Sascha Sommer Subject: [PATCH v2 14/19] mmc: sdricoh_cs: Respect the cmd->busy_timeout from the mmc core Date: Fri, 8 May 2020 11:52:28 +0200 Message-Id: <20200508095228.14230-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Using a fixed 1s polling timeout for all commands is a bit problematic. For some commands it means waiting longer than needed for the polling to be aborted, which may not a big issue, but still. For other commands, like for an erase (CMD38) that uses a R1B response, may require longer timeouts than 1s. In these cases, we may end up treating the command as it failed, while it just needed some more time to complete successfully. Fix the problem by respecting the cmd->busy_timeout, which is provided by the mmc core. Note that, even if the sdricoh_cs driver may currently not support HW busy detection on DAT0, some comments in the code refer to that the HW may support it. Therefore, it seems better to be proactive in this case. Cc: Sascha Sommer Signed-off-by: Ulf Hansson --- Changes in v2: - Rebased, no changes. --- drivers/mmc/host/sdricoh_cs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/drivers/mmc/host/sdricoh_cs.c b/drivers/mmc/host/sdricoh_cs.c index 0594b5ffe151..76a8cd3a186f 100644 --- a/drivers/mmc/host/sdricoh_cs.c +++ b/drivers/mmc/host/sdricoh_cs.c @@ -157,7 +157,7 @@ static int sdricoh_query_status(struct sdricoh_host *host, unsigned int wanted) static int sdricoh_mmc_cmd(struct sdricoh_host *host, struct mmc_command *cmd) { - unsigned int status; + unsigned int status, timeout_us; int ret; unsigned char opcode = cmd->opcode; @@ -179,9 +179,12 @@ static int sdricoh_mmc_cmd(struct sdricoh_host *host, struct mmc_command *cmd) if (!opcode) return 0; + timeout_us = cmd->busy_timeout ? cmd->busy_timeout * 1000 : + SDRICOH_CMD_TIMEOUT_US; + ret = read_poll_timeout(sdricoh_readl, status, sdricoh_status_ok(host, status, STATUS_CMD_FINISHED), - 32, SDRICOH_CMD_TIMEOUT_US, false, + 32, timeout_us, false, host, R21C_STATUS); /*