From patchwork Tue Apr 14 16:14:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 185408 Delivered-To: patches@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp1601603ilf; Tue, 14 Apr 2020 09:14:28 -0700 (PDT) X-Received: by 2002:a2e:9718:: with SMTP id r24mr499912lji.287.1586880867993; Tue, 14 Apr 2020 09:14:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586880867; cv=none; d=google.com; s=arc-20160816; b=U7CX1m0ClMaR+Ua8+/+rG3n0dWYUhNo65N3+z+1ugTHcsSTxoGT4JOcOS4MS1kvfvM RLhGRHZxicU+6Fdk1Ob5GGMUbePgBY+ozqDonDgZogBWl2ecj9yy8g4TgFohcqSKCODZ 6JHnP7PWSBHJAcXfX+XPHWWcU49F17zQx5ZRXD56RwC8jcUZwfSu9KI2dZ8FhcBjE/1P /cAV3xPCiikU77ZGw4OTGcEnqkphJ+9NM3KrjVM5+jkImKK49z7BaHY2rPJavSnplBOR P5WzOV/tm9Jl+eDRmbilg0VcKgg7OA3dSpl/M/3JAdMDpNPCs/j0l7z9zQo8LrECh8YY VuqQ== 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=XmKXGQtxsIOhznp9pNPhEFf64m8qqLbnWlsrQ/4SF4E=; b=QUG/WRBHexQH9lPdrCz8MwF7dTJnEZJsOOvJ6JmtCzRe9nvtEYYrqIP8F3ONpnLso0 +LX6CY3wQjZe81lUsOqf2GplN3RAj+YAafxB62rj2QnZg3UXXhSmeK0A1DQXoO+4dHnX VmxZfpx4mLe/JQYuT3PMckAHV1SlK/NjHuBRSa6lBk/coU7QD6yIJpXAANhjFVQW4Xw8 91eY/ToEo+SODSeTcDmQ/yX6umBmrNFLb/9lazT5+SzIr45Uh9SofTwkMC5+s+xmOB2R pQvSsY12Z6DnQDjbmKRlcxzsM3r4He0QVySozbGQ3uExNdBJ+eO3T3ymY3z7bvQrLDPZ 6uMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ys2a2Rxv; 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 w16sor7900824ljh.11.2020.04.14.09.14.27 for (Google Transport Security); Tue, 14 Apr 2020 09:14:27 -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=ys2a2Rxv; 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=XmKXGQtxsIOhznp9pNPhEFf64m8qqLbnWlsrQ/4SF4E=; b=ys2a2Rxv1fHn6dNE3FKrh4UthQoW9bZjzaswrXjhQ4Iq/aceKq1zFPe1B/WUuYki0O kr5I47/MFXUgaCHkk3GwoT0mT6E0HIRhLmV5zHMDD+ddUsCupd17lfD0sjfhgsFLC4u+ Dmu1oWXhVQaCxIQ2eI4o7iNiI1dxXSoOSmxHxR2/9ZLla326g5CNJ5lzv+QBGs/lXZBZ hc+X82PFAdA5AS/cjVPWD4hmTDDm2TYADl1IXLe2Ji3zqrpZwHio32Zh3RT13j06sxpC 8yaj2g0cOf1nj4OCYp4iGx9bVm8KK3TmUHTolbyP0xP+TTTEoSyfL+iRMpUTcSa0Nd6U Z8Lg== 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=XmKXGQtxsIOhznp9pNPhEFf64m8qqLbnWlsrQ/4SF4E=; b=cAdONp9+QBC93vZPrXoUyU5kQVsPdMQHfnQoLQN5BZzgGcOcapf2fOfeiE1ezCD+tH SkdCUV9OBU09NTqS+QqsIA5Co9QV7kz9h6LqDaKlMBzJ/WEHJoV3cu7Jlk0m7/tlHukN b2zXDnpVZ2Bv5AMAvMmR84oRSeZIuzX0eNYLGO4k0bRsyRWgsfdAAUNzEiXW38zJ8BN3 hBBqdQWugQIxg5iY/6hM8SRKsc7Tz2p7CQ0Fzgs9OYe2JQqkrm/mklURrFdi1FgbRVE9 iLNKKzJWnAO5NKvz4DAVqUKnd7MXzvCegqYWG9zLqoitwc0+EchvrNpee7tqE60jS0Cq T4ZA== X-Gm-Message-State: AGi0Pua5dODINtLZEbBjIXOrQj0I8oF6XGh6Gf1MF3vpBZuECstXZDBT 5VGtAqiCT9qfjzCnlRxN8Dr7J8qg X-Google-Smtp-Source: APiQypIaSC7iIt+X71C9p8KMhHncniaeFLEwdearv2pXqObwPy8NQfjCkb14xmevkMJ2cFK7rA7FMg== X-Received: by 2002:a2e:2413:: with SMTP id k19mr587913ljk.134.1586880867557; Tue, 14 Apr 2020 09:14:27 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-98-128-181-131.NA.cust.bahnhof.se. [98.128.181.131]) by smtp.gmail.com with ESMTPSA id a26sm9330669ljn.22.2020.04.14.09.14.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 09:14:27 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Adrian Hunter , Linus Walleij , Rui Miguel Silva , Johan Hovold , Alex Elder , Greg Kroah-Hartman , =?utf-8?q?Jonathan_Neusch=C3=A4fer?= , Bruce Chang , Harald Welte , Alex Dubov , Sascha Sommer , Manivannan Sadhasivam , mirq-linux@rere.qmqm.pl, Jesper Nilsson , Lars Persson , Paul Cercueil , Ludovic Desroches , Nicolas Ferre Subject: [PATCH 06/19] mmc: cb710: Inform the mmc core about the maximum busy timeout Date: Tue, 14 Apr 2020 18:14:00 +0200 Message-Id: <20200414161413.3036-7-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200414161413.3036-1-ulf.hansson@linaro.org> References: <20200414161413.3036-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Some commands uses R1B responses, which means the card may assert the DAT0 line to signal busy for a period of time, after it has received the command. The mmc core normally specifies the busy period for the command in the cmd->busy_timeout. Ideally the driver should respect it, but that requires quite some update of the code, so let's defer that to someone with the HW at hand. Instead, let's inform the mmc core about the maximum supported busy timeout in ->max_busy_timeout during ->probe(). This value corresponds to the fixed ~2s timeout of the polling loop, implemented in cb710_wait_for_event(). In this way, we let the mmc core validate the needed timeout, which may lead to that it converts from a R1B into a R1 response and then use CMD13 to poll for busy completion. In other words, this change enables support for commands with longer busy periods than 2s, like erase (CMD38) for example. Cc: Michał Mirosław Signed-off-by: Ulf Hansson --- drivers/mmc/host/cb710-mmc.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.20.1 diff --git a/drivers/mmc/host/cb710-mmc.c b/drivers/mmc/host/cb710-mmc.c index e33270e40539..e84ed84ea4cc 100644 --- a/drivers/mmc/host/cb710-mmc.c +++ b/drivers/mmc/host/cb710-mmc.c @@ -10,6 +10,8 @@ #include #include "cb710-mmc.h" +#define CB710_MMC_REQ_TIMEOUT_MS 2000 + static const u8 cb710_clock_divider_log2[8] = { /* 1, 2, 4, 8, 16, 32, 128, 512 */ 0, 1, 2, 3, 4, 5, 7, 9 @@ -707,6 +709,12 @@ static int cb710_mmc_init(struct platform_device *pdev) mmc->f_min = val >> cb710_clock_divider_log2[CB710_MAX_DIVIDER_IDX]; mmc->ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34; mmc->caps = MMC_CAP_4_BIT_DATA; + /* + * In cb710_wait_for_event() we use a fixed timeout of ~2s, hence let's + * inform the core about it. A future improvement should instead make + * use of the cmd->busy_timeout. + */ + mmc->max_busy_timeout = CB710_MMC_REQ_TIMEOUT_MS; reader = mmc_priv(mmc);