From patchwork Wed Apr 21 10:31:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 425284 Delivered-To: patches@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp203460jao; Wed, 21 Apr 2021 03:32:08 -0700 (PDT) X-Received: by 2002:a2e:7010:: with SMTP id l16mr4434145ljc.41.1619001127985; Wed, 21 Apr 2021 03:32:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619001127; cv=none; d=google.com; s=arc-20160816; b=dFyYkv+dMRqIsDVy+h0pDzjcR/tU4mnsY81YO2wdINqq/RdXVXLafdAhH+yK+lCKo6 GeNzRI1uXWeCeXG7FVAmg57OxiSDtVhwAlska4W3bYtxAb/dUo4WLin9C+jO7OCC39r8 v8PL3NJmlLC8OSrsOfPGUCTDFEFWn1Xz+tzA2lJwUZRurki3Pw5HtDct4S5Wd5REmRss jksfpVlYzgAlDaONBt0wfAZ6sPmge+xaBc1UY6s7R/ngjP2Q2rTtQBqVcHrS8m4TpE7T UP3PEmLopRLM1mpld0xP+wQWYl3KhEvEywhZ/QfiWgBZqOMtxkqdnopgXS2yQ/y/ap/O p5og== 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=CK5ZIEcklumCxnJNLBKoSlxqImVpYTzG5Udsn4Ishsw=; b=qdsItxbsiX0zdyynsEcazcff/sq/QMfX1Qb5nOkLlSlGFMsq1YPtXwgnkuBOVBL8V9 Pc1oC/Kl8ALhsZUxz3IsdIiagv0Ldyj1EyCLUJ2VwUpka9bDWJbFFJDNLuGZk+9xhZOl VDGkKUMCASaABVrk0HI0AuvkDp9kwXf50tSHvfeHiGfvQA0XbzceOyi1YcJpLPhh4eh/ xzGqFB9dytAjD+LM8I69NqJ+y0oxeuyJF2SM/yatfOwdJe9QPM5Mz75fWQ9mWESduL// NYOqha9eIMDSpobROvnXU6bMG/UcEiQ6nztEU258FK/PFEppLm0qRXDhiqM7HBR5FTES fSVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NfwbLuvj; 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 w15sor377707lft.135.2021.04.21.03.32.07 for (Google Transport Security); Wed, 21 Apr 2021 03:32:07 -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=NfwbLuvj; 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=CK5ZIEcklumCxnJNLBKoSlxqImVpYTzG5Udsn4Ishsw=; b=NfwbLuvjkQ46lE3tfHiUd1UVjBQdEFZFRmA85If0MapK4xLiIpe9e769dDZ/tMC55c OyNMD5PBJoUa/4ir6pJ9ZQyPlIGEGyfxJb0MZMAwX0tPdyNGhesy465To4aNY/gdyCkN 6Sjv0cUpOy7IO3sA8bLNhdru1DzjPFf3fwuHOaZt7usJBpmYnnqK8z2j91sxoOMsbhAu T3foVqNKF/vmvUCgp001jS/hjrFtgafpPQExxU0uRl/WLqrcjZVTdiA3y7+0kDTPlHQm ZThmzbXndKWHk2E/lVdMzao4cQ4vY1yUIASaLlRVPNyme5YkJHkJveGXTZTOQlrzRq4U x1iQ== 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=CK5ZIEcklumCxnJNLBKoSlxqImVpYTzG5Udsn4Ishsw=; b=lDNR9s5rlpV8fQaFwMoAstQJYrNrByCsP5aaqpzV66KwDvhDfDZbywj/a+0z2HZvPV 8G5lgYmmck++hmoUztRctfnm1dv73vs43YWZet8oofDEd6ln9X0OZGm2yOjE1O/Z8+Fj Z1aJJATciUDefv+b8PpPoLD9E2i0ECXbqRJqFJDV+x81Y4PHzGScst2H1jZ6tRMuEJh5 LP8kSMUGXwoTq8zhT70TuVsqlywq9sPf06S88kmZKEseNncM3UCj2h3l/Kv9QJSonyc5 HSPQv+vofI2fJg8naDUvdMn600eh89yE9OEEoRz7+xR8OyLwUg0LdeFD/psD4CsyYkGx ltnw== X-Gm-Message-State: AOAM532aWa0PIpn0FmvfdEIOxxpjwrkA0AJx/XQdp/G43BYRGtSDsNqs fpMn2kxpfo5rALH3fOtRF1K0/LmcTl3Wgo3p62w= X-Google-Smtp-Source: ABdhPJw9+YrZ+qOFFIfvbAx57atTu7H7oJy61BBb5cvZnyc5yynow4ONRd/Z65zuDWLe+Mk9NaNP7w== X-Received: by 2002:a19:7704:: with SMTP id s4mr20262774lfc.268.1619001127623; Wed, 21 Apr 2021 03:32:07 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-155-4-129-234.NA.cust.bahnhof.se. [155.4.129.234]) by smtp.gmail.com with ESMTPSA id u13sm170603lfg.139.2021.04.21.03.32.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Apr 2021 03:32:06 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter Cc: Shawn Lin , Avri Altman , Masami Hiramatsu , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] mmc: core: Parse the SD SCR register for support of CMD48/49 and CMD58/59 Date: Wed, 21 Apr 2021 12:31:51 +0200 Message-Id: <20210421103154.169410-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210421103154.169410-1-ulf.hansson@linaro.org> References: <20210421103154.169410-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 the information. 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 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 {