From patchwork Fri Jun 15 02:04:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 138643 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp249146lji; Thu, 14 Jun 2018 19:04:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKFNFS9Luf8A5F3On0IHRpueXrVI+iQjb9N+6jHSDhGMNdW92TlKy/L1JPvRK5wkFgckiZY X-Received: by 2002:a62:484d:: with SMTP id v74-v6mr12069208pfa.256.1529028297887; Thu, 14 Jun 2018 19:04:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529028297; cv=none; d=google.com; s=arc-20160816; b=WarvdAsBl6qDsLKTC8lAYzzP3WmeFIzR7Ed/+FGD9aLbbtw3E3WMXUZGv+wM0BonZJ 1sqGT4bjlOjVMbrU5MQOhkaDVEwCpMllui4zHnULCLPnkF1BP7T6aIvonx61gHnu0KmG Hf2jBVLh5geZO8E08PS/KPYTgxHQfp9XPUyEKq2lJm05f8airyZtTiPQaiLC8DxwWR6r EyH2WfNiWnlEHqfUHfZNB7jlegNlhC+YEmphBlY1PA9FlrlJTaVxqF/KStASVmKp2jwz FEhSH/qPJeQCxRAJKSq5fWtEEOKAfrm/VhSmNVKqERaEAnxfSgv2wG9mzcv/5A3nSsbr P4Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=ttXYHFd8VUHKlDLn0n0uKkrTJ0Q2B+fNSHTV6BEXwkY=; b=f36YqqSzAEWXJR4oxy44LuIFyjxXJsCmh7I9PeOkwnREyCOGCJSbCUUnVfxtyPsw6/ OC7sqFRHHRLn7isaUcoyOLkrNnH5ChI+3f5EFm4BADBt6xKvnStsI69fUna2JpSnuZWr TljX3bZVsHYJ8Ur2562zfrg6/hJYSzIKrdJJwMamlxOsHaF/Q95y/iFeK/TkgnPJibvT iOlXlQ3xgT2SLxcTJ11grNp/+ZphpQa0c++o2vzCL/5vL9PgLzRncLvivmtM583+IYG3 iqRjPLnshXg9JIJICubPfe6phxRdVDGDexYiMdlp5Je2i2mdJxtOepp3XDYYb6nt5j0n wYSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Hd8DOIb1; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g17-v6si6578040plo.355.2018.06.14.19.04.57; Thu, 14 Jun 2018 19:04:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Hd8DOIb1; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965425AbeFOCE4 (ORCPT + 6 others); Thu, 14 Jun 2018 22:04:56 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:39439 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965420AbeFOCEx (ORCPT ); Thu, 14 Jun 2018 22:04:53 -0400 Received: by mail-pl0-f66.google.com with SMTP id f1-v6so4527520plt.6 for ; Thu, 14 Jun 2018 19:04:53 -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; bh=HweywlkV3W7hX6j4jAziXnB8202QrrYYO0FfXOW5ydM=; b=Hd8DOIb1VuXzTzCRG00r3F7KyoIp6qzwSDWD10+FgpacBq615zkgwJMx/NESKdxh9x bbhe+SJPEhLTFVBYPt9fmsT+7oxAB4YdUq2e4u1SJpz6oN+GtGvV6DzYLXIdxMPA0krI Ds/XBBX8oyipU8HJLCrdxFqbwKtWm82cEMdWU= 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; bh=HweywlkV3W7hX6j4jAziXnB8202QrrYYO0FfXOW5ydM=; b=SfyO/W1mrfClqw9kmA336RAweJjAOBGWUDpLQV1OCwmsfi6mB5YKWqU77hfSVRtGq8 +53eZlyUTjqj7TZ4phyJIaeV+tYAL0Vtnl6tphn3vmqSEp8+Gdpqee8Al9RBtwiz80vD V6nZkClsEmHBNnMoqz4gAfoYEXekp8dz/fuSAm7V9stEQDP2bKd7yXYYcduqtN2bC0D4 gRDTpVXPZNweQdGqYbIW1ru1veVHdZik+j78HscYaf5w5A7fNmClEfNhFgbo8lNDu4rf IsqUrkSIF2xDzHgj619eFo/AvgCOVer7CGPUOpWyf1Y0gRNihhWjSqHXJwlazegzGina msYw== X-Gm-Message-State: APt69E2TUdIuntFxIOLjMPe4duqwK4ml/K94KNfCW/+7zzE1oe4Kk78p W50X71MK7+Dhr94l7ymxJMgNDg== X-Received: by 2002:a17:902:c6b:: with SMTP id 98-v6mr5695123pls.37.1529028293264; Thu, 14 Jun 2018 19:04:53 -0700 (PDT) Received: from ubt.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id k69-v6sm9504953pgc.39.2018.06.14.19.04.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Jun 2018 19:04:52 -0700 (PDT) From: Chunyan Zhang To: Ulf Hansson , Adrian Hunter Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Orson Zhai , Baolin Wang , Billows Wu , zhang.lyra@gmail.com Subject: [PATCH V2 2/7] mmc: sdhci: made changes for System Address register of SDMA Date: Fri, 15 Jun 2018 10:04:10 +0800 Message-Id: <1529028255-6022-3-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529028255-6022-1-git-send-email-zhang.chunyan@linaro.org> References: <1529028255-6022-1-git-send-email-zhang.chunyan@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org According to the SD host controller specification version 4.10, when Host Version 4 is enabled, SDMA uses ADMA System Address register (05Fh-058h) instead of using SDMA System Address register to support both 32-bit and 64-bit addressing. Signed-off-by: Chunyan Zhang --- drivers/mmc/host/sdhci.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index cf5695f..f57201f 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -805,6 +805,7 @@ static void sdhci_set_timeout(struct sdhci_host *host, struct mmc_command *cmd) static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_command *cmd) { u8 ctrl; + u32 reg; struct mmc_data *data = cmd->data; if (sdhci_data_line_cmd(cmd)) @@ -894,8 +895,10 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_command *cmd) SDHCI_ADMA_ADDRESS_HI); } else { WARN_ON(sg_cnt != 1); + reg = host->v4_mode ? SDHCI_ADMA_ADDRESS : + SDHCI_DMA_ADDRESS; sdhci_writel(host, sdhci_sdma_address(host), - SDHCI_DMA_ADDRESS); + reg); } } @@ -2721,6 +2724,7 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) */ if (intmask & SDHCI_INT_DMA_END) { u32 dmastart, dmanow; + u32 reg; dmastart = sdhci_sdma_address(host); dmanow = dmastart + host->data->bytes_xfered; @@ -2733,7 +2737,9 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) host->data->bytes_xfered = dmanow - dmastart; DBG("DMA base 0x%08x, transferred 0x%06x bytes, next 0x%08x\n", dmastart, host->data->bytes_xfered, dmanow); - sdhci_writel(host, dmanow, SDHCI_DMA_ADDRESS); + reg = host->v4_mode ? SDHCI_ADMA_ADDRESS : + SDHCI_DMA_ADDRESS; + sdhci_writel(host, dmanow, reg); } if (intmask & SDHCI_INT_DATA_END) { From patchwork Fri Jun 15 02:04:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 138646 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp249474lji; Thu, 14 Jun 2018 19:05:19 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLPzWVD8ui6X9E6TCJRV3JGqeP9jaS4gu7BNVRPbFEk8W3tNBB8yXx/S+E0r2CZEKlSvwa1 X-Received: by 2002:a17:902:b195:: with SMTP id s21-v6mr5671291plr.202.1529028319258; Thu, 14 Jun 2018 19:05:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529028319; cv=none; d=google.com; s=arc-20160816; b=owPaL+FRnWvVtaB/ikIGfuAfstImDwek/bgLIOiIXOuV6SYgZuanVBG5QPjIC8gfJA DhWOR7f94Im9FRMr4NrrpiCXGOaGob185G3NeU11qEh8IooAdQFrMi6sLviypLjJX0Nu gP3Isvot55LF5n7+vVizSq2KAR2PK0SlWm8HTJypKMYi1IbyFuNDjMjmSxWvxxanKqLM Skwwm6Y5NNnAnDit15HQkoHXgcjq/EkMxn6yyET3SWa30UQqg6StYaLhJV7VGDdFaqM7 b5pNrG65mCc+mEzuODXKIVvDPDqtRgk9A/KI39Z00MFD/p+zR4k+bxSlMUsJfMMVO1rN dn+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=ec93jT7P/W8Vj+zAnkWAoiCmvYpbOmfPhA/OIErJBJM=; b=PqCBwlrUAfhoSN7jaoLJOOxZZgdmabqFd+1DeQ/zBZylS52VlhfFctvis9je00rl93 xH/0QonLTcSIvEPjGdVqNxgfxeSi1Mr+6vOupThvUINtOai2kywZzfP9ijSWTc0x6Hq3 CQZzImE+9/5mlXXm6TGNjIlGp0sVPNaTy/T6Brd9CegRZtX8C8C+R6fRfgCzKHQ/dSDd X945HrULnRsiYRZjOcRPhXbkyo+CwJ9+rabP4fT7FF1UkV8lSt0BSqxCewpgDeNiFmDV PCOCDOg9tUbDJYXFjzVpt3b9pJrWDdLblJcr/6ZMnV0r2c1K68HlFSmaM0Wj8TNyAogZ J7gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=L48YsjaH; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n68-v6si6642021pfb.152.2018.06.14.19.05.19; Thu, 14 Jun 2018 19:05:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=L48YsjaH; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965488AbeFOCFQ (ORCPT + 6 others); Thu, 14 Jun 2018 22:05:16 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:37186 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965487AbeFOCFO (ORCPT ); Thu, 14 Jun 2018 22:05:14 -0400 Received: by mail-pf0-f194.google.com with SMTP id y5-v6so4125382pfn.4 for ; Thu, 14 Jun 2018 19:05:14 -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; bh=Y2y/xY2dusr5GMTlLcs29f19Nju3/wuuxjplM+exAbo=; b=L48YsjaHSCvYqD74kW04H+9/aYUtXBSXZLec/VHg9XfYHeAjirdoDVUlw3e/3FHRNM cO8yeY1/D1nhjSeYtJ/DBC1EEmqb45dbTuGXsY8WzdqRuQ0Gwu99jhOAAXSMcW3sQnuC WJclfoErmkMO6rPwelFZDEW8ykNJoLvuIIMo4= 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; bh=Y2y/xY2dusr5GMTlLcs29f19Nju3/wuuxjplM+exAbo=; b=A9l2ExvURqHSsEztikY+McdZznqoWxkHeP1a2oX9ZQmZK3xbCw5Gm8n0XGFrKbr3MR X5Uqt0t6RRxB5bp2Cl9piX2O/WfjNGaRdYgEtmW/+XYl5qaYhpWddCcmhudci2mxcuRb uawg83/+UL6jwUW5rmq8cPnL4fDsVGGgXFqL3ewMBRpaPLzAmT1wr2HXcdE7vW1gB7hI GEMXAK7fQmcfpME3ZBe4Ikxt9Fk8Kbhxc6XEqW/q40RGAd14gzwq1EZB7ngqqlJe4Te6 MyDOgrLnqVCZiKXnaCohUWNQR/s3Tdc/tYfWYg6gyrcrYqXHN0mO2Gy2w0I62iIqURc3 8olg== X-Gm-Message-State: APt69E15rtGzGMRUWDG5NoQBh6jlzZ8cPVrcsg6BB8xNfDLS6KuKY1Yg nXL/46M3od4Px+shPjpJcN/i3Q== X-Received: by 2002:a63:b34e:: with SMTP id x14-v6mr4395991pgt.243.1529028314036; Thu, 14 Jun 2018 19:05:14 -0700 (PDT) Received: from ubt.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id k69-v6sm9504953pgc.39.2018.06.14.19.05.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Jun 2018 19:05:13 -0700 (PDT) From: Chunyan Zhang To: Ulf Hansson , Adrian Hunter Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Orson Zhai , Baolin Wang , Billows Wu , zhang.lyra@gmail.com Subject: [PATCH V2 5/7] mmc: sdhci: add CMD23 support for v4 mode Date: Fri, 15 Jun 2018 10:04:13 +0800 Message-Id: <1529028255-6022-6-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529028255-6022-1-git-send-email-zhang.chunyan@linaro.org> References: <1529028255-6022-1-git-send-email-zhang.chunyan@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Host Driver Version 4.10 adds a new bit in Host Control 2 Register for selecting Auto CMD23 or Auto CMD12 for ADMA3 data transfer. Signed-off-by: Chunyan Zhang --- drivers/mmc/host/sdhci.c | 16 +++++++++++++++- drivers/mmc/host/sdhci.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index b8ee124..3b2af7e 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -954,6 +954,20 @@ static inline bool sdhci_auto_cmd12(struct sdhci_host *host, !mrq->cap_cmd_during_tfr; } +static inline void sdhci_set_auto_cmd23(struct sdhci_host *host, + struct mmc_command *cmd) +{ + u16 ctrl2; + + if (host->v4_mode) { + ctrl2 = sdhci_readw(host, SDHCI_HOST_CONTROL2); + ctrl2 |= SDHCI_CMD23_ENABLE; + sdhci_writew(host, ctrl2, SDHCI_HOST_CONTROL2); + } else { + sdhci_writel(host, cmd->mrq->sbc->arg, SDHCI_ARGUMENT2); + } +} + static void sdhci_set_transfer_mode(struct sdhci_host *host, struct mmc_command *cmd) { @@ -989,7 +1003,7 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host, mode |= SDHCI_TRNS_AUTO_CMD12; else if (cmd->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) { mode |= SDHCI_TRNS_AUTO_CMD23; - sdhci_writel(host, cmd->mrq->sbc->arg, SDHCI_ARGUMENT2); + sdhci_set_auto_cmd23(host, cmd); } } diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 1e84539..d5e1c10 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -185,6 +185,7 @@ #define SDHCI_CTRL_DRV_TYPE_D 0x0030 #define SDHCI_CTRL_EXEC_TUNING 0x0040 #define SDHCI_CTRL_TUNED_CLK 0x0080 +#define SDHCI_CMD23_ENABLE 0x0800 #define SDHCI_CTRL_V4_MODE 0x1000 #define SDHCI_CTRL_64BIT_ADDR 0x2000 #define SDHCI_CTRL_PRESET_VAL_ENABLE 0x8000