Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp30699pxy; Thu, 6 May 2021 19:29:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4Z0n8tnkLBLMMTmwW8VLzOcFBHohLIhcVFur9VUr4n737EqO74wvih9WcyqVCd42FMJQF X-Received: by 2002:a65:4485:: with SMTP id l5mr7333261pgq.209.1620354568739; Thu, 06 May 2021 19:29:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620354568; cv=none; d=google.com; s=arc-20160816; b=V8KyH91T3yGAZpoRMSw6Mo0PP+19IgjZuScUY661Ez9YwQIsXv9a7e8xHv/oqdFwzX f9tzRlbSY24gRDFuDiw4FY8Iijk9whJRasoPxyh3dGU6juT+1uKE/0uNLLWaM4DgXiFG KyKEy6KpA5lhc1BN9TpbiBL57HUY8nQCEdUE5J0o/KzIlJz/aKu9xUlztV7QJXZqFeNJ hUKrhwRvp+MwxtUmk0aQU+DlM+2w7sOhvlEiQYVvgDYDlHEinO8jTJA4XecCeeEzLikq vE/+foA9hgrFw1EqgXdrxYX41UuAuptdKOYQBBvVp35NaZhVb7+DDNATD4xqbyiOS5IO twXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:subject:cc:user-agent:mime-version:date:message-id; bh=6Sr98gMhgl/zpE7zxOY3oEOy4YbfdwKWfbvl2rLkPgE=; b=KMX9TolofaRt4yo9nukKpNYAWhIFHHCu3KlHCcTgJvEYYhaxfE38B+pmfNtG/hcZxf cDeg1jX5fiyFSpYKjrjKf5yiXh6S5eTPPoOAIy4A8VuhGLpi4nBPg8QBTalAYJGBSGyi TNgaeUfH0UKlCebF2Ygq38TYdqPUMlX6oQAmyfSZGsiy40pmtzbkRqVCC4Nt6X3pSzFG OwD7jrvc4Mr59f55yP2S2KLjZQq07WX0QDD2b9fVoFYHrfONO5FTyI7YbEzZdLQ/shrs bAvZ5cfjAQUDMjOiQCi7yw02iwcMUNWk+HI0zIHS8q1yL6gNhQSdksGO6tZbE9S6k8gJ ae1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x9si5692757pjr.155.2021.05.06.19.29.15; Thu, 06 May 2021 19:29:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234306AbhEGB71 (ORCPT + 99 others); Thu, 6 May 2021 21:59:27 -0400 Received: from regular1.263xmail.com ([211.150.70.204]:40998 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232375AbhEGB70 (ORCPT ); Thu, 6 May 2021 21:59:26 -0400 Received: from localhost (unknown [192.168.167.223]) by regular1.263xmail.com (Postfix) with ESMTP id B58175B1; Fri, 7 May 2021 09:58:25 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-SKE-CHECKED: 1 X-ABS-CHECKED: 1 Received: from [172.16.12.64] (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P22002T139994497025792S1620352704320007_; Fri, 07 May 2021 09:58:25 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <4ca702759911cd48c330db2a6c072e83> X-RL-SENDER: shawn.lin@rock-chips.com X-SENDER: lintao@rock-chips.com X-LOGIN-NAME: shawn.lin@rock-chips.com X-FST-TO: linux-kernel@vger.kernel.org X-RCPT-COUNT: 10 X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 Message-ID: <3590da3a-046d-3fd4-42e2-238fcb6751ab@rock-chips.com> Date: Fri, 7 May 2021 09:58:24 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Thunderbird/87.0 Cc: shawn.lin@rock-chips.com, Linus Walleij , Wolfram Sang , Avri Altman , Masami Hiramatsu , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 08/11] mmc: core: Parse the SD SCR register for support of CMD48/49 and CMD58/59 To: Ulf Hansson , linux-mmc@vger.kernel.org, Adrian Hunter References: <20210504161222.101536-1-ulf.hansson@linaro.org> <20210504161222.101536-9-ulf.hansson@linaro.org> From: Shawn Lin In-Reply-To: <20210504161222.101536-9-ulf.hansson@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/5/5 0:12, Ulf Hansson wrote: > In SD spec v4.x the support for CMD48/49 and CMD58/59 were introduced as > optional features. To let the card announce whether it supports the > commands, the SCR register has been extended with corresponding support > bits. Let's parse and store this information for later use. > Just check v4.0 spec, and it says "Table 4-32 is added in Version 4.00. These commands are reserved for future extenstion". So, Reviewed-by: Shawn Lin > Signed-off-by: Ulf Hansson > --- > drivers/mmc/core/sd.c | 4 +++- > include/linux/mmc/card.h | 2 ++ > 2 files changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c > index 2c48d6504101..de7b5f8df550 100644 > --- a/drivers/mmc/core/sd.c > +++ b/drivers/mmc/core/sd.c > @@ -222,7 +222,9 @@ static int mmc_decode_scr(struct mmc_card *card) > else > card->erased_byte = 0x0; > > - if (scr->sda_spec3) > + if (scr->sda_spec4) > + scr->cmds = UNSTUFF_BITS(resp, 32, 4); > + else if (scr->sda_spec3) > scr->cmds = UNSTUFF_BITS(resp, 32, 2); > > /* SD Spec says: any SD Card shall set at least bits 0 and 2 */ > diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h > index f9ad35dd6012..858fc4d11240 100644 > --- a/include/linux/mmc/card.h > +++ b/include/linux/mmc/card.h > @@ -139,6 +139,8 @@ struct sd_scr { > unsigned char cmds; > #define SD_SCR_CMD20_SUPPORT (1<<0) > #define SD_SCR_CMD23_SUPPORT (1<<1) > +#define SD_SCR_CMD48_SUPPORT (1<<2) > +#define SD_SCR_CMD58_SUPPORT (1<<3) > }; > > struct sd_ssr { >