From patchwork Tue Apr 14 16:14:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 185419 Delivered-To: patches@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp1601948ilf; Tue, 14 Apr 2020 09:14:47 -0700 (PDT) X-Received: by 2002:a2e:8511:: with SMTP id j17mr571952lji.292.1586880887723; Tue, 14 Apr 2020 09:14:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586880887; cv=none; d=google.com; s=arc-20160816; b=viH4EewV+PDm32EqZwCXt9tkaA615sEad0frNI28ubau3APk2qbbtfMLAUfrCXQoNc f01rBoVj4p+0t1fae6u4te9fBykmCB1ramDiAh55zFiIobVHiAx1j/vX6hJLtiSQHRGG JQGgoK2rdhscrcH6waBStKHfa1ubNvbaPnOGspi1krXBfqBuWN0VdgrX52gMfT2hWKK7 QCHAx3grXq8oxxJTB4bcXyojPJjgCrFmpuEl+tX8PmV/2Wo1wsa82Ks2pfoCd+GYJTk8 xy/UV8GNmA0YMreKlSuV7blJ7+zvXHZvJXt4lprtA5Tfd0E77ORJRA3oGsR5W7IS6zC2 2UsQ== 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=fV7yLQCho5m6+2k47darI60VgKdimEIQlNdusOHvHrI=; b=G2B0y3SaKP8aV0VuAKCGkkHgyecEO5bHYKq3jciM6DA6CL9sv793gTeoBWGg2os3tE W0maSIfHpumHLFT5x+5hvFgJBsZor8dcMV4AGLQoalOgxxZSMuQtrEWgZKLq4jFvtO6n iKr8d3DEeOptk4PBCEl4hHdNzTLoOHOJy9eE5tFpaNUq0e7z4WIwnxR5T4y4ps1HHYh4 Hve+2Vjtd+zNR8JcHHePilcTuYH3l3LmujSZJWcfgX1N2L14wikU8BjkS8QjCG3ovix0 L3WRS6slrUe9tWckRSf6RObyJQl3X+yZuduwio8AeW7cEp0wzyd8WhAaB9buOJ1Zn9Vb 0Ohg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="F3rQk/4Z"; 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 y205sor4150311lfc.52.2020.04.14.09.14.47 for (Google Transport Security); Tue, 14 Apr 2020 09:14:47 -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="F3rQk/4Z"; 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=fV7yLQCho5m6+2k47darI60VgKdimEIQlNdusOHvHrI=; b=F3rQk/4Z//sOg6fzVR2r3vntsIFgxeadDpOTTo0em3oUxUnS2xswqmPCK1NziVLsdm g7MbLjEwesW79tQ/fqcyYUi87aZCcSGCNff2Gt9+bh4saviZsOfOARZKLBHkodig+xaf amCWUOxEnVwrTX5NxrCVc0xjQZXlENrPinN0kbShXtk83w9yddamVgXUFFK9hPqpVuOC Zmy8f3g1owvRV8RQe9DE48mfnTrrmmcz/KzsBgs9xZuqbqCnE9oMOJbalSZ1tVdRtOtn jJRidQakHPpD6C5dZrhKY8uQeO0oNeBD4qMXG2kWdvGjTb0J54jcFXjq4BhdCjGFsRYv 3yMA== 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=fV7yLQCho5m6+2k47darI60VgKdimEIQlNdusOHvHrI=; b=d50SkjCiUuIvvJYOiRtXrj4sWX1+1s4VQtCwJHqdYS1ZPYuFdyCO2pB6ReWO5xvc9+ gZjRTZtIMGurWqyUPw7EJYVQ11uZ8gSchv76IAvI/pzeICuH5jz/kfF6JlTzQz6m7m6k RDagPB6XZGbEdBBrTQmenHHGuorqWUgGbSBOyyB8BRTUwKfTxGh8OEiSkoxR8AfCiMQD FY+AkzKOFBUtOe2eTtA0s33TRipbWAoV6K2dGNn5eqqGt4pV/uCAI3QgzsTViTAe56e4 VG/N89OWaP9bG3Ww223gSPRG2O2yYM3H9sHGR4kE124HQXLnlopBEotV7cotkTmC2hNb yRdw== X-Gm-Message-State: AGi0PuYtEb3cLXCzZWvC305481HtCiGCS7R3bX+pzT4C48S7S0kEn8fl oBWyk6PtkUIDKSX9+jshD+Ueppj7 X-Google-Smtp-Source: APiQypIx3GuWzm2apEhzDNWzcBGMOHlPS4R60kqm/Gp8FkwUtC+CSX7LB9PF6MpLnCwT97E6W+xm7w== X-Received: by 2002:a05:6512:3081:: with SMTP id z1mr359841lfd.102.1586880887299; Tue, 14 Apr 2020 09:14:47 -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.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 09:14:46 -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 17/19] mmc: mmc_spi: Add/rename defines for timeouts Date: Tue, 14 Apr 2020 18:14:11 +0200 Message-Id: <20200414161413.3036-18-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 Clarify the use of r1b_timeout, by renaming it to MMC_SPI_R1B_TIMEOUT_MS and by dropping the corresponding confusing comment about it. Additionally, let's also add a new define, MMC_SPI_INIT_TIMEOUT_MS and use it during the initialization. Even if these two defines are given the same value, the split makes it easier to understand them. Cc: Jonathan Neuschäfer Cc: Linus Walleij Signed-off-by: Ulf Hansson --- drivers/mmc/host/mmc_spi.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) -- 2.20.1 diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c index 951f76dc1ddd..5768fe9f8f6f 100644 --- a/drivers/mmc/host/mmc_spi.c +++ b/drivers/mmc/host/mmc_spi.c @@ -77,14 +77,8 @@ #define MMC_SPI_BLOCKSIZE 512 - -/* These fixed timeouts come from the latest SD specs, which say to ignore - * the CSD values. The R1B value is for card erase (e.g. the "I forgot the - * card's password" scenario); it's mostly applied to STOP_TRANSMISSION after - * reads which takes nowhere near that long. Older cards may be able to use - * shorter timeouts ... but why bother? - */ -#define r1b_timeout (HZ * 3) +#define MMC_SPI_R1B_TIMEOUT_MS 3000 +#define MMC_SPI_INIT_TIMEOUT_MS 3000 /* One of the critical speed parameters is the amount of data which may * be transferred in one command. If this value is too low, the SD card @@ -347,7 +341,8 @@ static int mmc_spi_response_get(struct mmc_spi_host *host, while (cp < end && *cp == 0) cp++; if (cp == end) - mmc_spi_wait_unbusy(host, r1b_timeout); + mmc_spi_wait_unbusy(host, + msecs_to_jiffies(MMC_SPI_R1B_TIMEOUT_MS)); break; /* SPI R2 == R1 + second status byte; SEND_STATUS @@ -1118,7 +1113,7 @@ static void mmc_spi_initsequence(struct mmc_spi_host *host) /* Try to be very sure any previous command has completed; * wait till not-busy, skip debris from any old commands. */ - mmc_spi_wait_unbusy(host, r1b_timeout); + mmc_spi_wait_unbusy(host, msecs_to_jiffies(MMC_SPI_INIT_TIMEOUT_MS)); mmc_spi_readbytes(host, 10); /*