From patchwork Thu Aug 3 12:46:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 109324 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp730636qge; Thu, 3 Aug 2017 05:46:44 -0700 (PDT) X-Received: by 10.84.139.195 with SMTP id 61mr1796118plr.445.1501764404136; Thu, 03 Aug 2017 05:46:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501764404; cv=none; d=google.com; s=arc-20160816; b=FeIFUye6Rmr9AHsAQyod+zl1i2FwJw1cSybsRxGoF5VYATrUrQLZTOKtd8r9A2OZM7 aOpghs9F+Xqx8tmJbuxbti1ICtloxI42IC4qnehpjy+rlY6ZyK/QrDS6jOZfpRrHypi1 wQMZPPVn6vccRa+aw8MqTIwUWziG4hx2yJLBxSB9+wB6/tIsTs/3xmAvGJsnylXH9sB6 H4pvxxtucInN0jImzlvqj5/Z7Et/o6trp/j+aCywnST3xtTawXzEVneNfXmiFMmGZjfY qeCc/WdAIpJvrgDNj9ouzB0c+1Z6omAcK8HZsjhNoxfWYVDILgxMEX0nadxUzvAyRoas d1gg== 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=N/JvQhUorW/04xWhjk/Z++XR43zVck96TwZFUcnGL2s=; b=mt/9YEVrpIA/9IDLDUU2EzO0op+AOhL7ylpsP7vphAz9/21dPdGUEC/znZH+rSH5jU Ob7eSnZvBOUcGMvJsgA07/HRyVaLvmu/Cm+qb7MUlYT2CKAQ8IqErzVjrSJ4EyovU+tG rqVcbJDlgwxRlz5PUN/5aSV7aytrg6FM/M1sg3lreeP0+8KpDBIc0UJYT8/gHOiCJLNf CKRwcLJpf/Pru78AoCezAQdgdE8uFFJMrMyDCzDz8oRmyCo8E/+RSVhlx4LIXvc51q/p CzKvZBT8VeC6AsS0wdzsjd7zMpbNINZxGD2Cn5ZLoO59ngKsaa1pbTHnkOhHMMbU8uaH O4TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=VrGOMwJJ; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 33si14840148plk.1031.2017.08.03.05.46.43; Thu, 03 Aug 2017 05:46:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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.b=VrGOMwJJ; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1751868AbdHCMqX (ORCPT + 9 others); Thu, 3 Aug 2017 08:46:23 -0400 Received: from mail-it0-f43.google.com ([209.85.214.43]:35899 "EHLO mail-it0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751134AbdHCMqW (ORCPT ); Thu, 3 Aug 2017 08:46:22 -0400 Received: by mail-it0-f43.google.com with SMTP id 77so8559101itj.1 for ; Thu, 03 Aug 2017 05:46:22 -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=qahcXPthA+twx52pqUTEh8unlrgM1JkuggMp0m6FI+4=; b=VrGOMwJJed0XdQHpxDCKYVuDHY1Ky7r5Vjr28IcUXnO/Kr7wGJ5g7DbF2Al3i84bME sDdVnjizbksJi0qYiJFSFdxWqPUOQ2qCVcaJYCaWGO9cUS49NIUPbMbM4plf9iZxG6qq 3EeNKmL11m3HfmgpY8QYbiZMk8QWUD6AUea38= 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=qahcXPthA+twx52pqUTEh8unlrgM1JkuggMp0m6FI+4=; b=BqOnwuN8Av/7NYAxtNmwFqYndcMmxFegBuXpkpZjt4Fd1Skm1P8KGyRZQMQcmtcuS4 5Gd97AencVEdgW9NK5jsqfrB50whmKegeKbuvdlklaxR1+4DZo9aNCOCenrzxudSv6nT 80exKCcHLjTtsKJefni76QqowQrjplo2Qpf3NvZMZz15g9Bnxt2Rj5WicIR8y3fhD5xI dbRBqj2K3YXJSnsA6q+RXbgs/6NDHVnfoyJUUr/LZmwwaEIfpH4Vv2HAsTae72G5yGe9 ENpFCpTJjFlRGXvC60kRzlKye93lu01sfA5rXhiisKZtI4a3nUwbDzQTSbkxckj1BddK JOsw== X-Gm-Message-State: AIVw110W9RGcOAiRjMs8gk8pUXDQIxQP6RHKjxuy4S++Rb4NUWRM/pUQ DhEvTtNy6mDL6Bpk X-Received: by 10.36.144.133 with SMTP id x127mr1764557itd.2.1501764381901; Thu, 03 Aug 2017 05:46:21 -0700 (PDT) Received: from localhost.localdomain (static.8.26.4.46.clients.your-server.de. [46.4.26.8]) by smtp.gmail.com with ESMTPSA id b66sm13768459ioj.66.2017.08.03.05.46.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Aug 2017 05:46:21 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: adrian.hunter@intel.com, ulf.hansson@linaro.org Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v3 1/2] mmc: sdhci: add sdma_boundary member to struct sdhci_host Date: Thu, 3 Aug 2017 14:46:13 +0200 Message-Id: <20170803124614.21788-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170803124614.21788-1-srinivas.kandagatla@linaro.org> References: <20170803124614.21788-1-srinivas.kandagatla@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Srinivas Kandagatla This patch adds sdma_boundary member to struct sdhci_host to give more flexibility to drivers to control the sdma boundary buffer value and also to fix issue on some sdhci controllers which are broken when HOST SDMA Buffer Boundary is programmed in Block Size Register (0x04) when using ADMA. Qualcomm sdhci controller is one of such type, writing to this bits is un-supported. Default value of sdma_boundary is set to SDHCI_DEFAULT_BOUNDARY_ARG. Signed-off-by: Srinivas Kandagatla --- drivers/mmc/host/sdhci.c | 13 ++++++++----- drivers/mmc/host/sdhci.h | 3 +++ 2 files changed, 11 insertions(+), 5 deletions(-) -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Acked-by: Adrian Hunter diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index ecd0d43..c6a6c52 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -897,8 +897,8 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_command *cmd) sdhci_set_transfer_irqs(host); /* Set the DMA boundary value and block size */ - sdhci_writew(host, SDHCI_MAKE_BLKSZ(SDHCI_DEFAULT_BOUNDARY_ARG, - data->blksz), SDHCI_BLOCK_SIZE); + sdhci_writew(host, SDHCI_MAKE_BLKSZ(host->sdma_boundary, data->blksz), + SDHCI_BLOCK_SIZE); sdhci_writew(host, data->blocks, SDHCI_BLOCK_COUNT); } @@ -2037,6 +2037,7 @@ static void sdhci_send_tuning(struct sdhci_host *host, u32 opcode) struct mmc_command cmd = {}; struct mmc_request mrq = {}; unsigned long flags; + u32 b = host->sdma_boundary; spin_lock_irqsave(&host->lock, flags); @@ -2052,9 +2053,9 @@ static void sdhci_send_tuning(struct sdhci_host *host, u32 opcode) */ if (cmd.opcode == MMC_SEND_TUNING_BLOCK_HS200 && mmc->ios.bus_width == MMC_BUS_WIDTH_8) - sdhci_writew(host, SDHCI_MAKE_BLKSZ(7, 128), SDHCI_BLOCK_SIZE); + sdhci_writew(host, SDHCI_MAKE_BLKSZ(b, 128), SDHCI_BLOCK_SIZE); else - sdhci_writew(host, SDHCI_MAKE_BLKSZ(7, 64), SDHCI_BLOCK_SIZE); + sdhci_writew(host, SDHCI_MAKE_BLKSZ(b, 64), SDHCI_BLOCK_SIZE); /* * The tuning block is sent by the card to the host controller. @@ -2998,7 +2999,7 @@ void sdhci_cqe_enable(struct mmc_host *mmc) ctrl |= SDHCI_CTRL_ADMA32; sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL); - sdhci_writew(host, SDHCI_MAKE_BLKSZ(SDHCI_DEFAULT_BOUNDARY_ARG, 512), + sdhci_writew(host, SDHCI_MAKE_BLKSZ(host->sdma_boundary, 512), SDHCI_BLOCK_SIZE); /* Set maximum timeout */ @@ -3119,6 +3120,8 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev, host->tuning_delay = -1; + host->sdma_boundary = SDHCI_DEFAULT_BOUNDARY_ARG; + return host; } diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 0469fa1..399edc6 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -541,6 +541,9 @@ struct sdhci_host { /* Delay (ms) between tuning commands */ int tuning_delay; + /* Host SDMA buffer boundary. */ + u32 sdma_boundary; + unsigned long private[0] ____cacheline_aligned; };