Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp3756991pxy; Tue, 4 May 2021 09:15:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxriShAY7k25Z/Ag3foAJbK7wDuvBbzXwSys1XUGhiMc4GBqNbudU68pLmBI/1ERUgenyK9 X-Received: by 2002:a17:906:32d1:: with SMTP id k17mr22563760ejk.94.1620144923970; Tue, 04 May 2021 09:15:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620144923; cv=none; d=google.com; s=arc-20160816; b=T80pto7FOsuLJNjsHVjIDzpylu6RH3X6l2ofCmugKUORNqDrFEyntlQzhzeSfS2MK9 7/JPgnViVHJTtwDegaGO++jDpEntqudI7/6unepUBmGY0SzZJlcC2o0HrGKHBT2D/5FQ 2gTzhB/A7s3j2M4gMXF8JCGUGf0oKMmSzSNFBRPXvgJzRl33VMbgp9IgBoYIs1gX7LlM Rm+qnV6KXdhBM/PCmIWErWjzezqaTG8U3LspDPTP7thi0w+pJdYrsIV5/OGOrQGsZ+J4 xeWz2RqVsT7E3zEDkkOPMiLk+egmluIXVWPE0d2D3CO2IWZOY5imT14EU7xu/M/jzM82 6Agw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3YPvSgtMwuWKmsANJZN3wDrqLMspZZxchfU1o9bNBS0=; b=j4ev1vQ9y6vWSOzCrX0qNnhSEDNknXAasEng4i9ZzdzfOpZsFqrEyrdC88V4bvg8QV 92h4ME4wq/Zurc12Ozx9xayQwircMhvHs1Ca/IGfrSjZM5J5neIvQkE62NdP76mue+x0 DcoxjtZjTBeV4OQ3NE7BcVxxb2iLLJI5T2hbKD9yHZ3sXgkKjmuQojzIUNN48zR5t/32 btqUIf53UBxDe1uTCVicJkXy9QaBahsRxo5RXEYTrroiFMvjhF1a/HuPtd+hoDT9vYxW iEDvzCbyn3vd8g2Rt9T5JO2JqyYrDN1rEgj55uHZQrJb5a3mlrk5chUczjywDJ6OsCgA mdDQ== 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 linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bw22si2904763ejb.745.2021.05.04.09.14.59; Tue, 04 May 2021 09:15:23 -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; dkim=pass header.i=@linaro.org header.s=google header.b=mQphSbjp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231704AbhEDQOM (ORCPT + 99 others); Tue, 4 May 2021 12:14:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231755AbhEDQNs (ORCPT ); Tue, 4 May 2021 12:13:48 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F4B6C06138F for ; Tue, 4 May 2021 09:12:50 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id z9so9631362lfu.8 for ; Tue, 04 May 2021 09:12:50 -0700 (PDT) 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=DPdui4dJZb309AyuzBlSK8FyTVG86//z+WLd2ybHvpRWYpo9WdgKPxMTiv7ZWQAsGQ pauH/ZUKp0V+Gt7uhyapvx4C4Q8rGsV12mIuWaK7Kst4oRS28kXFcHzLMU+AESK2RzYF PD8FgikOLp/C4rPLI3/v4CuWyB/hIxxHQ4pa7jqpwKoOcTFa8N2/RBDEobV2wD175gWz ftYQNBfe1O3jSCwbvm1sXxofgk7BIQbNQtb80D9bpuZLYLYnHR48TH0qFEBqoWNbnI37 o8Oi26xHkIottZBLxs0Bpq7n6J8i0UntV1PNWc/9tVvBSIIh1VXbo+v6RFyV8jvVIGdj vmUg== X-Gm-Message-State: AOAM530DWzwnPuRTk34nUY+p09NC5ROsX0IfGZSdsffae/8Zh4xewxaF WK/Uc0LOZeehTrMeUo7f/OWX3GHSEkomAIPB X-Received: by 2002:a05:6512:c0a:: with SMTP id z10mr17587062lfu.467.1620144768925; Tue, 04 May 2021 09:12:48 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) 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 { -- 2.25.1