Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp448757ybt; Fri, 10 Jul 2020 04:09:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4e72RcG4pgP0By9AKOFADwCjxzOxWV/cSwHWPMt+T/FlZ7wDID7e5Ns76zW6IrZrNBPj3 X-Received: by 2002:a05:6402:22f0:: with SMTP id dn16mr77750832edb.83.1594379391480; Fri, 10 Jul 2020 04:09:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594379391; cv=none; d=google.com; s=arc-20160816; b=cwTwNwxKtIfAeFCzihuTXBDMRLjnnbQEOWejvNLtLxkHy3zyeZv2GNJHTgBPCtU95N sJqxxOkKws6iIJYHKUIVW8gSA2+pTiOzE1WAJJnwIF0Ztac2dVIMZdJ7zpbafmKgP/zV R39rvEOPbCQEkzC7kVNgr7z4JG5D0s7L+ey9BYT7Fw23IqunxBMwZviZPgAKNdoitRTf +z+8zwBTdKRWnohJexyxnGXO2Jpt3loaoXz79wZlEowwgUbNEaSn2ovNCB30bR70YjLa p8b0TBPU6tg9C53A/Y967tYO/dBVQbWMvBMz0Sboj2PYsHoWOZgEPqbOs8fGd0qaR0qP WLxA== 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=Wxp4GlIqguIXAzhkAnEZwz1md/YBSaT63Cu/32lxb6ewEpkHYQsLVuYFjZS7sn9K2e pXRs3jcSZeqaLNRfWYds0V+lFv19YH9UUmN/PJnq43Mxk3PxPI5pt8mznJO4y+5CCf4V 8y26NxqvRCSgI4jiHTZ1wBfBHXMRNCU2lz/REitnq4XWnq/z21xWWZMHjr2R3mcC41Nr qS1t5GX9kMgecmSKQUCwCYcaja6qe6b7Qg0RJnWAPBevLaNSqqrbH/AgMSr74dmHEPlI GOMJa15F3bZ0XLCoVWTF+WZ5wZG+A0NsPTkC7hh9XFxg7sE/kJRpPPKMGdGpAz/3iLck bcRg== 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-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=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 n8si3738000edi.222.2020.07.10.04.09.28; Fri, 10 Jul 2020 04:09:51 -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=@gmail.com header.s=20161025 header.b=E+n7ZdWp; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728001AbgGJLIS (ORCPT + 99 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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; -- 2.27.0