From patchwork Tue May 4 16:12:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 430885 Delivered-To: patches@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp3936540jao; Tue, 4 May 2021 09:12:49 -0700 (PDT) X-Received: by 2002:a05:6512:48c:: with SMTP id v12mr17004440lfq.132.1620144769257; Tue, 04 May 2021 09:12:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620144769; cv=none; d=google.com; s=arc-20160816; b=u5HDWwoqRRkerMHC1LC2ozN1VV35ZCIhNhtLru7qSgfjlDEn/BZlvpsj/4cpDU/ViD SlefYKtydcTbXmQ3Ce643991yO7qVwVMZaI0FSBglY7RxGk7Vj8Nlo9gsFZQPhl7lR8K e5o90adAg0fJtEx4Xi+onw+vuLQM2nyK3nNZA8zawnQRP6/x5xL3PpXz/OeR4uLaolxa u3Md3pmhOG43aJC8UUQnqjVvK6BNmyDF48FrDFuVuc06Yp2nPY5JUEkAwKQLtNPpDedk +Cn8qL3HzQ3Gh/37IyQjKbHMY+/1RvJ8RhbYBK8IhsfqsTEJ0yfupLKur0kbEwzcd+9C IT2A== 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=3YPvSgtMwuWKmsANJZN3wDrqLMspZZxchfU1o9bNBS0=; b=HbOZKyQDqLzlSp2pfFZm05cLSEa6FrSiDB6TAnhQ/dFNmjXtoRr6isfHAuQUrvq/Vd Gpe1jcB/gsKPAZOQ+UvSSMtTWHUOrN1kCC69KX3MpX3OemIb8NjJFv/dH2D9VchHJMaT Err1hfKOhJqSoBh42Wvu+ZhRUAzUs/SZGDSIq08K3RH04T/vW1dERG1sNbuMTnLqMpzN fT8uV94p802hUs1OmqAB43dU7a2EG5wNeKUngI1VLswmsZ3dmDpt4xLq45O0tQmRoUbF n5dy78vagTv08+JYXoJ+fYX2Cu8+NwS7xIVvlcxHi5fHe5G4Jqud2UAFO0mQzeJSYvIb 4UdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mQphSbjp; 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 v23sor4145574lfp.145.2021.05.04.09.12.49 for (Google Transport Security); Tue, 04 May 2021 09:12:49 -0700 (PDT) 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=mQphSbjp; 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:in-reply-to:references :mime-version:content-transfer-encoding; bh=3YPvSgtMwuWKmsANJZN3wDrqLMspZZxchfU1o9bNBS0=; b=mQphSbjpUQsny9Y+iTx74acCw2RC/7Rw66VAAOnWDQUbQN8E9LjjfCVAzjwDg73JYA 2IIFyaDZjid8qqdoeGQAIR3C515ImGXr120DHipM+PWv/A7IWFOERw4csxR8Xz3MfWLM BXA++rt0qv0y7yOl7xPOtANwFhnssW285d9b7MaIeL/719Jnyeb7Fl7m9GuBgfjiVELN ofhx+tgSVyM2kJoNjey09xJSfBxoagBzS0jZrS5u5+1y1oM7dYuX66Vx3x778dqu120z AIVs+p3XrD8Ngj1UbGm3GJ74xLM090JwCD/Eh0r13hdXrw6GlBAK/t+2pAA/afENElZM c5Jw== 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=3YPvSgtMwuWKmsANJZN3wDrqLMspZZxchfU1o9bNBS0=; b=fMe+DtQXXPx+bUJbvQEkYBileMVQJtRsZZfYMfX46h/5QNLZRoCMrnm4b97wBDJJ/u hmI5rN1oT/Iq7ZUCPlkWgblS2dJzDh/kQ8i2yHTiHLWFY+aFlrWfVvkOxeKSGOO5DnQ/ +VKIiGJzrYJctlgY9dQ/fWp6p6OM604UzXrsp4qkR8dUHpoGLPvgdOExsZikoOASoLtE CJRmFb9hGnUHpGrix9bUt0m/JIOP2gywCAW/N7Uu8zdwpHTFrY1bVt47x3kUJwEP2JO9 5o7GfBpwg65gpu5TDHupxxyy5jgiH/7aZ66q6QeV0iXsdeEmCkV92DCnsSNDYaExONab MyIg== X-Gm-Message-State: AOAM531KY0W12/VSbk3bVl5io/Ftqs1XX0LhEuCIjTGK2Gz3wplLtPcd 2UYoEW/yGZecmsNfPLPNkn7vIO6B X-Google-Smtp-Source: ABdhPJzEg4JyZbtiP7/8bkCcH2v8n2BiNms886QzrgiideGRN2RshaK0sMxOvd1N+Ux3WM8cYYi4Ig== X-Received: by 2002:a05:6512:c0a:: with SMTP id z10mr17587062lfu.467.1620144768925; Tue, 04 May 2021 09:12:48 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-98-128-180-197.NA.cust.bahnhof.se. [98.128.180.197]) by smtp.gmail.com with ESMTPSA id s20sm164193ljs.116.2021.05.04.09.12.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 May 2021 09:12:48 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter Cc: Linus Walleij , Wolfram Sang , Shawn Lin , Avri Altman , Masami Hiramatsu , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/11] mmc: core: Parse the SD SCR register for support of CMD48/49 and CMD58/59 Date: Tue, 4 May 2021 18:12:19 +0200 Message-Id: <20210504161222.101536-9-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210504161222.101536-1-ulf.hansson@linaro.org> References: <20210504161222.101536-1-ulf.hansson@linaro.org> MIME-Version: 1.0 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. Signed-off-by: Ulf Hansson --- drivers/mmc/core/sd.c | 4 +++- include/linux/mmc/card.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) -- 2.25.1 Reviewed-by: Linus Walleij Reviewed-by: Shawn Lin 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 {