From patchwork Tue Feb 4 08:54: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: 183055 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp5064122ile; Tue, 4 Feb 2020 00:55:07 -0800 (PST) X-Received: by 2002:a2e:8755:: with SMTP id q21mr17091365ljj.156.1580806507023; Tue, 04 Feb 2020 00:55:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580806507; cv=none; d=google.com; s=arc-20160816; b=U6YcVU7D1zZjOm0K9J59eDMw+W1BFBfInLK4Hh6x7g+iBHDb7OhlprPkQr+ryxpHNs nU/zpQiXlIJEgP3sHW11MludrVOG11jRktcEJIEFizQ1OSJat3veu4oMgZ7dr7HEdc/k lGGUncCRi7dYqkklRaleWzWVFkgRcwTF8ReaPuMX4xYlV1skpM3izN10RoE8YQSFXuXW J4Kxa6u66YI5s1O4mHHFnueNcml48su40Txb7I9qewA6QsMevRPd3aqTjQjb4snLtDeM ags9zVpNBaHUM8A6vdNXXp/zTPtmRWZVqmMYAyRJc+FlRfdvfHj3ElH98qrCYCrhL4xX OHkg== 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=Y2N8JVgylePVorUFC9TPMnWSgeFKeUnkL2yRNJBh1UY=; b=kqL7jgZ2Qq8U9s7vILvwPzvPsgYotlK7wPfIGotTCo8rrC/soJ4H2ZZjan9LionaKL BjKp0kDg2aRIyBfAQEJpNI2HZkkeDGnQcIG24r0S5E5tRlRCIPQ47xx6OsG+gPVofoZi gXc/Z8fG/eloZ0fM0c0ipYD2f7o3tShjfIyyAU9K8T2PwAhTV/t0yeFI4KHEmcFDOjYF PmRznuqEM9DsKRp12YFzNRAFqxsHFKUcIpxznZxWyq/V3x4cXBVwhVDRpkTzciSh5ty4 GHX0t/+hibAsDX13UwKjKcEfsr8TG3JQVJPgyz19VCiUcSUxZOjbd0Ti7GWWjU2zZaAS YBsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sO1kZFmV; 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 s7sor12342846ljo.11.2020.02.04.00.55.06 for (Google Transport Security); Tue, 04 Feb 2020 00:55:06 -0800 (PST) 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=sO1kZFmV; 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:mime-version :content-transfer-encoding; bh=Y2N8JVgylePVorUFC9TPMnWSgeFKeUnkL2yRNJBh1UY=; b=sO1kZFmViA4D6F0bnh91onpkyvI7idKixOSd9TTma45hG6Hprh+JxZVPFMYr6IZ+lv 44Q9XY2sFOyBx48WhdeJ7KLHr8CFAno2OQC9006OZlTlb3OBFgOfHwjQDts/DSOUO1bW nbFE1xZHMYgFtirP5fqFJLuaZjtISOSFeVYo6F/JBniNu7R/fPKNGeXteD8wCK1mbdQY yum5/svuqS6Mazkss2M4XHIeLd5QsVqcPXCoxtaQqfTrbBRQj3pgAKfNAQWb0pqXIP6j VqJNAS4Ag3vMK47VAWfjQHiBPaW50CBo4wDanBKoN/RoTRHBv5ikX6AkUURqiaeljhsw Fxbg== 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=Y2N8JVgylePVorUFC9TPMnWSgeFKeUnkL2yRNJBh1UY=; b=n+3KM84+GelwGrCeNszfQpJg7xZLQkXK1d9ULDikbIZ8mvsgRPEzFVldbOfE4Um2ta HIiEYJ+BC4/bImqC33agVkgWnBYt7AgB6cyzpNvnGmQEeBPNWFGoDNMEjrW6SBBjWMZB dK407wvTOZepxJyrfYqkGdoWPACOScllmwLwauNiaIulBRJaISuhrrXJHtT4HeoGTsdh Fw+ewbx/uRn0bijLABxpnh2uxfoMtViRQSyFF5g8a/W81IUsAzHbOaRwbJu9NFZUsFsD Mo76pKLHEHOBTtFPu/5NOD/JYsWixD4HAAoao9kFEF1mInEVr9J7DEXrGti0IabZjIHn cruA== X-Gm-Message-State: APjAAAWInbvLAqxiOuSOQgoZ7iPl8oIVJv8bFmrWGn27tNXhe+iYjr3/ 3YAwS8h0/QmFpCTeQqWPeKSvKrBx X-Google-Smtp-Source: APXvYqwW2HAosr8IZgG1ml4U7boi5Cj9pUyAJeTegrmkpGf64PVkr5AQMKlY9skrePTQ2tgCRQa67A== X-Received: by 2002:a2e:808a:: with SMTP id i10mr16668342ljg.151.1580806506609; Tue, 04 Feb 2020 00:55:06 -0800 (PST) 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 n2sm11156283ljj.1.2020.02.04.00.55.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Feb 2020 00:55:05 -0800 (PST) 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 Subject: [PATCH 00/12] mmc: core: Improve code for polling and HW busy detect Date: Tue, 4 Feb 2020 09:54:37 +0100 Message-Id: <20200204085449.32585-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 There exists several separate variants of polling loops, used to detect when the card stop signals busy for various operations, in the mmc core. All of them have different issues that needs to be fixed. The intent with this series, is to address some of these problems, via first improving the mmc_poll_for_busy() function, then consolidate code by moving more users to it. While I was working on this, I stumbled over some code here and there, that deserved some cleanup, hence I also folded in a couple of patches for this. So far, I have only managed to extensively test the updated mmc_poll_for_busy() function for CMD6 commands. Some tests for erase/trim/discard and for HPI+sanitize are needed. Note that, there are still separate polling loops in the mmc block layer, but moving that to mmc_poll_for_busy() involves some additional work. I am looking into that as a next step. Please help review and test! Kind regards Ulf Hansson Ulf Hansson (12): mmc: core: Throttle polling rate for CMD6 mmc: core: Drop unused define mmc: core: Extend mmc_switch_status() to rid of __mmc_switch_status() mmc: core: Drop redundant in-parameter to __mmc_switch() mmc: core: Split up mmc_poll_for_busy() mmc: core: Enable re-use of mmc_blk_in_tran_state() mmc: core: Update CMD13 busy check for CMD6 commands mmc: core: Convert to mmc_poll_for_busy() for erase/trim/discard mmc: core: Drop redundant out-parameter to mmc_send_hpi_cmd() mmc: core: Convert to mmc_poll_for_busy() for HPI commands mmc: core: Fixup support for HW busy detection for HPI commands mmc: core: Re-work the error path for the eMMC sanitize command drivers/mmc/core/block.c | 55 +++++-------- drivers/mmc/core/core.c | 53 +------------ drivers/mmc/core/mmc.c | 38 ++++----- drivers/mmc/core/mmc_ops.c | 159 ++++++++++++++++++++++--------------- drivers/mmc/core/mmc_ops.h | 13 ++- include/linux/mmc/core.h | 3 - include/linux/mmc/mmc.h | 10 +++ 7 files changed, 157 insertions(+), 174 deletions(-) -- 2.17.1 Tested-by: Baolin Wang Tested-by: Ludovic Barre Reviewed-by: Ludovic Barre