From patchwork Fri Jul 10 11:09:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Chuang X-Patchwork-Id: 235218 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp345290ilg; Fri, 10 Jul 2020 04:08:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8gdCk6RnSiSU4ZDYo/sAaUvQFpYXXIeI8v/x/SNp0Xle891TnGPJ7L3IypruHO8H/8KE3 X-Received: by 2002:a17:906:c056:: with SMTP id bm22mr52741557ejb.444.1594379337525; Fri, 10 Jul 2020 04:08:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594379337; cv=none; d=google.com; s=arc-20160816; b=d0m8TN66L3HxO7MExr3aqgjNiZPK89HIeNr2eOl7VfUjCXClvk2dpW+GJB0mF5XLM0 laFoym31cUq7q1B/7Nt7lm9YFvj8TJFTIw8MI4vFMq7PcNiI6LU032Fr8Y2Jn7t10Zlg Mg69bvOcyUlZj0lWcnsqtYZnOUE7GpViq0dZE3PWbwRWDMa1XmDGa72KlK/OhE4PhDSL sO8uoXoJ6FDuKEjuqajRaKtShNJmb4Xl/RH2LpEwRStULzhqexNnl3h21RX4jE22MadR U9OgBJrStn6QiZDuZCq/PLmeZ0QIYljFZYzJBBN2NEAK+O/+NDvxugOKKQ/Y21xtApC0 Iawg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=tErlLbdtCWDGv/vKwdRdEOml4K+SgK9V6YiS5pXmAGk=; b=nWdMb7A8woq04X9ytHbftP31AjJ+lSBrKWycK+B5Mevdui3g2mkTN9snvb8mC/bQEX v3YclcSisACYT3Jh2JJi8JxRwWNMtWaBV7AL0PLNAg1VkC4/Hh2lyhk4OTvH2MxPu+Uw lL/3RVBF1r+3/+pKgYJcSHNJzfnoXmL2UETXAW85MGWLlLVMWJbLyf7UMvkXSpoVzdOV BcZFx9thLVFOT16qqXJ6Ofv4FBJd9X6ezn1aaTyJvBnwOcFBUY5crxpZZU6curww2Knq sEWXBmdifztKfNiCJ0rbe/oZAzzSaG7Yde7HKNE9nXiKpVjhe3hJMvufRMjBSIUcrf/c 9dEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rtoPGOCQ; spf=pass (google.com: domain of linux-mmc-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f3si3885786edy.2.2020.07.10.04.08.57; Fri, 10 Jul 2020 04:08:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-mmc-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=@gmail.com header.s=20161025 header.b=rtoPGOCQ; spf=pass (google.com: domain of linux-mmc-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728025AbgGJLI4 (ORCPT + 5 others); Fri, 10 Jul 2020 07:08:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726725AbgGJLIy (ORCPT ); Fri, 10 Jul 2020 07:08:54 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84127C08C5CE; Fri, 10 Jul 2020 04:08:54 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id k27so2395331pgm.2; Fri, 10 Jul 2020 04:08:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=tErlLbdtCWDGv/vKwdRdEOml4K+SgK9V6YiS5pXmAGk=; b=rtoPGOCQCl8nBYC27b28IX042RFJzQXF7gcoKuoh66Q41+udmEwxjWuAqt8+VyJrQY 9xmhqI/5q9DEftOclJP0yuilarwfXpABksX4mf9NW7CeVDr5hnqySm4iJaa0pWnJrra+ NBU+gVNKCFsbTkPZFta7DpNNq8wuMDp32wBkbep0fFLuqSJUZBNRNvg3qhNKiE19APr5 HDdlkbafU3q/t2o2nV+EAJkCxIituZZ516DF1Q8OdCVM6O1K+weGxCn3c30T9oYoWa2A vcQecjZOgMsRkMyPRBQHD97hTGxqtCyax1x2faS1k+tiye71UgiTdIaYBy2mszi7sWB4 1Wtw== 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:mime-version :content-transfer-encoding; bh=tErlLbdtCWDGv/vKwdRdEOml4K+SgK9V6YiS5pXmAGk=; b=jsW6Hjl+AgVng6Z65VFI2ActWhdx/qZo4INhtqHxgMcfFrs/czLVvAAXwtaIaTyflV 8Wtwi3ek6OUsvR4H3c4vglz1ae0c8ggZWLghVV7bWGDmFms2T+Ire5FYmtWpOOjZgCDO 25Hp3wJ7JEK4AyM2aYDtLDfqvwSG5TYeAvDhiOqaPBC0RhfV4WWzf79yEV6toVVVq1Ns 4pr0E3lCd+vcjs6fsL31uWRHiwLbth8ZXt6xpZ0fxl3ESe0H7fiUBIo4huhHwy0S8oOu Or5d2SZs5zuj1Td/1cTIputvEGjcx5JQSBG3DYFnGGtmp1RsDzH5/eLfc6caEXiUnTkw iqQQ== X-Gm-Message-State: AOAM532tlZ3mgu07m37+mZi9+IsSKmoHoIU1ek8VbvqSbNVjEhS8Uxlq HCwjT15l9z6nPCg/vxpXf5o= X-Received: by 2002:a62:f202:: with SMTP id m2mr51534273pfh.157.1594379334138; Fri, 10 Jul 2020 04:08:54 -0700 (PDT) Received: from gli-arch.genesyslogic.com.tw (60-251-58-169.HINET-IP.hinet.net. [60.251.58.169]) by smtp.gmail.com with ESMTPSA id v2sm5395427pje.19.2020.07.10.04.08.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 04:08:53 -0700 (PDT) From: Ben Chuang To: adrian.hunter@intel.com, ulf.hansson@linaro.org Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, ben.chuang@genesyslogic.com.tw, takahiro.akashi@linaro.org, greg.tu@genesyslogic.com.tw, Ben Chuang Subject: [RFC PATCH V3 07/21] mmc: core: UHS-II support, set APP_CMD bit if necessary Date: Fri, 10 Jul 2020 19:09:37 +0800 Message-Id: <20200710110937.29283-1-benchuanggli@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: AKASHI Takahiro In UHS-II mode, MMC_APP_CMD command need not to be sent. Instead, APP_CMD bit in a packet should be set. Signed-off-by: Ben Chuang Signed-off-by: AKASHI Takahiro --- drivers/mmc/core/sd_ops.c | 9 +++++++++ drivers/mmc/core/uhs2.c | 4 ++++ 2 files changed, 13 insertions(+) -- 2.27.0 diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c index f58bb50872f6..9dc296356928 100644 --- a/drivers/mmc/core/sd_ops.c +++ b/drivers/mmc/core/sd_ops.c @@ -26,6 +26,15 @@ int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card) if (WARN_ON(card && card->host != host)) return -EINVAL; + /* UHS2 packet has APP bit so only set APP_CMD flag here. + * Will set the APP bit when assembling UHS2 packet. + */ + if (host->flags & MMC_UHS2_SUPPORT && + host->flags & MMC_UHS2_INITIALIZED) { + host->flags |= MMC_UHS2_APP_CMD; + return 0; + } + cmd.opcode = MMC_APP_CMD; if (card) { diff --git a/drivers/mmc/core/uhs2.c b/drivers/mmc/core/uhs2.c index 6e26de429726..2fbd7b6d9dea 100644 --- a/drivers/mmc/core/uhs2.c +++ b/drivers/mmc/core/uhs2.c @@ -826,6 +826,10 @@ int uhs2_prepare_sd_cmd(struct mmc_host *host, struct mmc_request *mrq) header |= UHS2_PACKET_TYPE_CCMD; arg = cmd->opcode << UHS2_SD_CMD_INDEX_POS; + if (host->flags & MMC_UHS2_APP_CMD) { + arg |= UHS2_SD_CMD_APP; + host->flags &= ~MMC_UHS2_APP_CMD; + } uhs2_cmd = cmd->uhs2_cmd; payload = uhs2_cmd->payload;