From patchwork Fri Jul 10 11:08:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Chuang X-Patchwork-Id: 235216 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp344822ilg; Fri, 10 Jul 2020 04:08:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqXHuxqyET3dY60tjDER0wH0IMR73ZVTmWa4HZZzRcSaetdh2pUSwrEzQ8y2VOCPoGakfe X-Received: by 2002:a17:906:3fc7:: with SMTP id k7mr16640915ejj.332.1594379299905; Fri, 10 Jul 2020 04:08:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594379299; cv=none; d=google.com; s=arc-20160816; b=lpO/DFmRe+pueGIej51t+9042VpcD7rc/drz60LB0wmGePE3+bBxk1Z+WBErTrkZF5 3y02PLBd6+1uDNVmWITg1h99ZNhmpT4sFGkXcaaoMa8wb4hDhihuOueUNK64NtCJZauA FV73MY28KgBWt2LRpPCN7QTZPzG9HxSNaOGAZ4Ss858OviFc9NyOY8LG6cXFelpHhYZo ZG+kLhlwnbTuCjhFtn3XrhkwEed8pCz5R9fLYFeyAXcKlwZan/5RjQ7cj28EkNIM1Noq tIPYO8CNXx66InGEi+ChHCLAqa8XIV2BuME8FORBcgSBEmG7ZrmpfcR3kavhN2Wu3r5S DJVA== 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=MBX+zLWZoUU7YT17yBn/8lBjP/8tmr8iWyHaBASouus=; b=bOA3w0EJHyHaQbXdDQKJ9p/Mp1Ckbv07eXmCAsFXX6EFcxXZU+j/mFAvXOkba4NM3P bgg1e6QzyKt+ziYaNJ7rNagGlQreo8mUp6aPDWUr+jkxRWF+tWLbg3+od0rNuy7Usx4J 4WaHnt36iDMhLcRoO/LvePWuuHdzeNmH3v1Eb+c1ZfzDS/7KziKNHsYGqGz+df2JnL0A vwFveBo5YCrHhuMpLQhrjkSFcutq7yZAHBTXthlUJ/v7ZPJjf1heGsMEp1YMcMEjzooV D9Ev2JWz0AyULiUfeMN2b4amcPAuNXd3fkoLCMKVcZHL1M1Pkl2JXUjU534Ee2xlAIlu 1W0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=E+n7ZdWp; 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 cf17si3988168edb.488.2020.07.10.04.08.19; Fri, 10 Jul 2020 04:08:19 -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=E+n7ZdWp; 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 S1727995AbgGJLIS (ORCPT + 5 others); Fri, 10 Jul 2020 07:08:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726725AbgGJLIQ (ORCPT ); Fri, 10 Jul 2020 07:08:16 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87227C08C5CE; Fri, 10 Jul 2020 04:08:16 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id 72so2128723ple.0; Fri, 10 Jul 2020 04:08:16 -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=MBX+zLWZoUU7YT17yBn/8lBjP/8tmr8iWyHaBASouus=; b=E+n7ZdWpw4sKWwQtuC6WSFtvBrgcNYj/pWuRfB1lveg4e7Hpzv3o+a27EhPaBs1NxF mpDlH3xJ2P1vgVyjoDuA8sjh1RdKVvmCr9W+qy7UWYpiFYyhUN/uZmBjO5ukLdNq/H4J KC+BaRZzzmNQkPGA9CbB0ibnI2jjIQX/MDwc34qR2eazOoQlIzBmfy5Scjc7tUD9AV15 PbK3wH/YxMSE+1cej08SqfG4pBeKWFQfCP5mKENsNeH6JDMT8BdA/Vm7VMZJTThVtXVc 2MgbnrQxn2thSZps8BpZ9IeVgdeH6mGS+7O6TnUf14dhFK5oangsHBIws3sOqQ/4mSFy Rfug== 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=MBX+zLWZoUU7YT17yBn/8lBjP/8tmr8iWyHaBASouus=; b=T6IHwAXsCYiH12USh7w19ZnjYvpk7WME3QfYFJmU+4MmemZ+qKdr/y/wl1/ttMWvgS dkaYk8P45OogtVeO7Pw79xDgSoeK2QXLA6oZubpl8gCwOh7FpXgtb/StXSOpkqXZiEi+ xzYgBGtLsSvxXKSzWvtlej9EyHsrUqcdxFw0eN1N/F9yfR01FGajTP0TZIqL0pwB3YzA tJn+AVItlKdo6i3xUAvifOjVfLat7W21vwEeMU3BUoCE0ZbdrVzHjAedD5XFYCCprKwQ 9nidvFjx+BehIw3saWlxiKqsbpPfs2zpSrZT8kTtiXpHY9147xhAB3XhG+Htd6kXbXh0 5wcQ== X-Gm-Message-State: AOAM531xiJdVaxIH2cr8pyfVMa8TsdfJZA4L5yuRaivjE2Cn8ZhLLqDq FGese+vDbLziNsk77Cyd254= X-Received: by 2002:a17:902:a708:: with SMTP id w8mr16567900plq.128.1594379296110; Fri, 10 Jul 2020 04:08:16 -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 y80sm5498959pfb.165.2020.07.10.04.08.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 04:08:15 -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 05/21] mmc: core: UHS-II support, skip TMODE setup in some cases Date: Fri, 10 Jul 2020 19:08:58 +0800 Message-Id: <20200710110858.29166-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 UHS-II's data command packet has TMODE fields in which parameters for data transaction, like Duplex Mode(DM) and Length Mode(LM), are specified. In some cases, we don't need to initialize them and so set uhs2_tmode0_flag to 1 in order to skip them in generating a packet. (The code will be added in the next commit.) Signed-off-by: Ben Chuang Signed-off-by: AKASHI Takahiro --- drivers/mmc/core/block.c | 7 ++++++- drivers/mmc/core/sd_ops.c | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) -- 2.27.0 diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 7896952de1ac..212f872d60bc 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -56,6 +56,7 @@ #include "mmc_ops.h" #include "quirks.h" #include "sd_ops.h" +#include "uhs2.h" MODULE_ALIAS("mmc:block"); #ifdef MODULE_PARAM_PREFIX @@ -1526,6 +1527,9 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, struct request *req = mmc_queue_req_to_req(mqrq); struct mmc_blk_data *md = mq->blkdata; bool do_rel_wr, do_data_tag; + bool do_multi; + + do_multi = (card->host->flags & MMC_UHS2_INITIALIZED) ? true : false; mmc_blk_data_prep(mq, mqrq, disable_multi, &do_rel_wr, &do_data_tag); @@ -1536,7 +1540,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, brq->cmd.arg <<= 9; brq->cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; - if (brq->data.blocks > 1 || do_rel_wr) { + if (brq->data.blocks > 1 || do_rel_wr || do_multi) { /* SPI multiblock writes terminate using a special * token, not a STOP_TRANSMISSION request. */ @@ -1549,6 +1553,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, brq->mrq.stop = NULL; readcmd = MMC_READ_SINGLE_BLOCK; writecmd = MMC_WRITE_BLOCK; + brq->cmd.uhs2_tmode0_flag = 1; } brq->cmd.opcode = rq_data_dir(req) == READ ? readcmd : writecmd; diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c index 22bf528294b9..f58bb50872f6 100644 --- a/drivers/mmc/core/sd_ops.c +++ b/drivers/mmc/core/sd_ops.c @@ -235,6 +235,7 @@ int mmc_app_send_scr(struct mmc_card *card) cmd.opcode = SD_APP_SEND_SCR; cmd.arg = 0; cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; + cmd.uhs2_tmode0_flag = 1; data.blksz = 8; data.blocks = 1; @@ -282,6 +283,7 @@ int mmc_sd_switch(struct mmc_card *card, int mode, int group, cmd.arg &= ~(0xF << (group * 4)); cmd.arg |= value << (group * 4); cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; + cmd.uhs2_tmode0_flag = 1; data.blksz = 64; data.blocks = 1; @@ -323,6 +325,7 @@ int mmc_app_sd_status(struct mmc_card *card, void *ssr) cmd.opcode = SD_APP_SD_STATUS; cmd.arg = 0; cmd.flags = MMC_RSP_SPI_R2 | MMC_RSP_R1 | MMC_CMD_ADTC; + cmd.uhs2_tmode0_flag = 1; data.blksz = 64; data.blocks = 1;