From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B75CC2D0F0 for ; Wed, 1 Apr 2020 16:23:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 23F0E214D8 for ; Wed, 1 Apr 2020 16:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585758184; bh=7dvN1NdL/HtOrinW/+c+KVVhJbekjgY1PpNQMIsuZFo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=I5Thk1VUaWFcq5/VYCOhKDJFVnUXaRiiUvA8Viv/IeYV3jrZ/QaVmrwIPYJ9R1OyZ 32lk/M+l2XuMdErYd0VK9aDpBvCEcPPV0/Wz5gcYOBaQbxAZbAxil8vSOqg8XZ4COs x3vyqFiiSo20qpROhV+8l0KEzq3i+QTGhOPPnnPw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733274AbgDAQXC (ORCPT ); Wed, 1 Apr 2020 12:23:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:46144 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732817AbgDAQW6 (ORCPT ); Wed, 1 Apr 2020 12:22:58 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 06FAD214D8; Wed, 1 Apr 2020 16:22:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585758177; bh=7dvN1NdL/HtOrinW/+c+KVVhJbekjgY1PpNQMIsuZFo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iFSCzSi+AIRJm7sBT+sxI6K7iUy8nHGJt7xIlH1CJqPeJX8tsgWWtvmtv0slZwBru hvht+8NvFWcvD1X3S0/48UPbXiwUPioIqLKyAALfi2JkRh6LJMECMfsoUN4qA1h2Nt sxYMXAVUdqEUeFiFUGLhXbYGIk0CSesJGKrFLiqg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sowjanya Komatineni , Anders Roxell , Faiz Abbas , Peter Geis , Ulf Hansson , Sasha Levin Subject: [PATCH 4.19 001/116] mmc: core: Allow host controllers to require R1B for CMD6 Date: Wed, 1 Apr 2020 18:16:17 +0200 Message-Id: <20200401161542.769267371@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200401161542.669484650@linuxfoundation.org> References: <20200401161542.669484650@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ulf Hansson [ Upstream commit 1292e3efb149ee21d8d33d725eeed4e6b1ade963 ] It has turned out that some host controllers can't use R1B for CMD6 and other commands that have R1B associated with them. Therefore invent a new host cap, MMC_CAP_NEED_RSP_BUSY to let them specify this. In __mmc_switch(), let's check the flag and use it to prevent R1B responses from being converted into R1. Note that, this also means that the host are on its own, when it comes to manage the busy timeout. Suggested-by: Sowjanya Komatineni Cc: Tested-by: Anders Roxell Tested-by: Sowjanya Komatineni Tested-by: Faiz Abbas Tested-By: Peter Geis Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/core/mmc_ops.c | 8 +++++--- include/linux/mmc/host.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 873b2aa0c1556..693b99eff74b5 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -536,10 +536,12 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, * If the cmd timeout and the max_busy_timeout of the host are both * specified, let's validate them. A failure means we need to prevent * the host from doing hw busy detection, which is done by converting - * to a R1 response instead of a R1B. + * to a R1 response instead of a R1B. Note, some hosts requires R1B, + * which also means they are on their own when it comes to deal with the + * busy timeout. */ - if (timeout_ms && host->max_busy_timeout && - (timeout_ms > host->max_busy_timeout)) + if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && timeout_ms && + host->max_busy_timeout && (timeout_ms > host->max_busy_timeout)) use_r1b_resp = false; cmd.opcode = MMC_SWITCH; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 840462ed1ec7e..7e8e5b20e82b0 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -332,6 +332,7 @@ struct mmc_host { MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | \ MMC_CAP_UHS_DDR50) /* (1 << 21) is free for reuse */ +#define MMC_CAP_NEED_RSP_BUSY (1 << 22) /* Commands with R1B can't use R1. */ #define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */ #define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */ #define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */ -- 2.20.1