From patchwork Wed Aug 2 08:38:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 109198 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp2505328qge; Wed, 2 Aug 2017 01:38:51 -0700 (PDT) X-Received: by 10.98.111.194 with SMTP id k185mr21936624pfc.235.1501663131051; Wed, 02 Aug 2017 01:38:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501663131; cv=none; d=google.com; s=arc-20160816; b=W8zwIQe7CPUdShTAcfAviI1nYO7ZJC9IjMVqjVZ7DmzL82QY0YtKRY0hOLuG9SA5rA 0hLKSau57KhKuSTBWFzL5b7LV18K2thXRpvybKfesDrUD/AiX1BldKzlhfBS2arLLccA 1/suEGSrOXjX8qqEnHYsGg/L+T4X1ivkLUyWPHAj3oAycXPDs87ZX97irETt32ucREzr tuWUKDIelKWsqQ4lfH+P7Ya6Qt3XzoUKhACOZpmWaj3Fu8MIcbx+fMxR6BjUoOU+lm3u 3waFxbSlL8cwjFFHeZeNMCRwHuQBxJ3wP2GxLIbkCXzhxOMStIFKsWWfZbIzG6ekLLmu 1OgQ== 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=7R92cscU55Qv/sktr7MvDxboYIcgiyaOUfEOAEqqpXw=; b=Iy56Cl5rrTGvyiwHIQceRZ3lk56KdIoc86Fwe961ctLl1iSWyl6W/JQrfrRLw0czEP 8nLjHZMGvICELb098F+hH0WjjrzxZPidznV477Rtf6rvsUmOxiebHLi6K1GZiY+wzA4a +cflmn4g9OEi2WVj/XHvzdL4rrlRU5+hSlkBIguTxkpYYeAIzahJe0Bl8uTsFTlbpO8b bjyh197A+G6D8YlgcMafGKPqpKzbTPPxZ+rZ/W6csUDtNukxxAgEVU2iDmdus19UaAtD lN8fZifXo1rjji+v13aTyKXb3iPa3c037iaqLYzVmlcw9ru/Lv6pIzwYWYiIsNdzhauO AnDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=kZMdslaM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (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 j14si19585308pgs.370.2017.08.02.01.38.50; Wed, 02 Aug 2017 01:38:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=kZMdslaM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752444AbdHBIir (ORCPT + 25 others); Wed, 2 Aug 2017 04:38:47 -0400 Received: from mail-io0-f178.google.com ([209.85.223.178]:34861 "EHLO mail-io0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752521AbdHBIiP (ORCPT ); Wed, 2 Aug 2017 04:38:15 -0400 Received: by mail-io0-f178.google.com with SMTP id m88so17629440iod.2 for ; Wed, 02 Aug 2017 01:38:15 -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=7R92cscU55Qv/sktr7MvDxboYIcgiyaOUfEOAEqqpXw=; b=kZMdslaM2qkdQQEArzEz8qDaoUjEkVGnap2+VrPE6YqW0UAgHGpu67Wm5TReQkEbTs 0PSMC0eFZrdktduaq5kl6aA9MM9pqZ4yGqbu+rfcR9f7jwhCHpvxfCQ1wetidian4mXu IuqO9WEG01hj/tbzCScQGRzwcJELoyJLfZBh8= 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=7R92cscU55Qv/sktr7MvDxboYIcgiyaOUfEOAEqqpXw=; b=jFsjbvHzLs/MTiykqBYPUMh9XKiJo96t+GJMW1iGdZBelJqL6pWmzuwuUjw3lQEizb Od+kfcGK244/KaTMIK7tGWl6Mc+zlTWxUNrt7xwoZPQce3or0Zh5vg0yOTORGhyHQtFQ 5M0cz6lvr07l+YXROJDIy3/tiqse5/6GggL+Hg2Ph3JdqOKvfP9K+u9ZC9Y4F6+zD60+ o8FCYOlMiHT98rb1iWhSVyOfWzdxMKAiLw2/2w/Pn5HiNfErovAyJflSncAltKuSnf44 KJcp4tlEl0ELHw8Z7W3buMu4M+JPEXhvmbn0GdVxEhdSLBu8GZmWiqhlsVuXMbBG6kBa MiIg== X-Gm-Message-State: AIVw112ePUXpwVgPJp/j0slLJzGhPqy0flvU+3gTokrS+/vBYeHQsTXJ CQMXNeG4/Gz+ZdoC X-Received: by 10.107.135.33 with SMTP id j33mr27663974iod.257.1501663094501; Wed, 02 Aug 2017 01:38:14 -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 b185sm1781226itc.1.2017.08.02.01.38.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Aug 2017 01:38:14 -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 v2 1/2] mmc: sdhci: add sdma_buffer_boundary_arg member to sdhci_host Date: Wed, 2 Aug 2017 10:38:06 +0200 Message-Id: <20170802083807.26280-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170802083807.26280-1-srinivas.kandagatla@linaro.org> References: <20170802083807.26280-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Srinivas Kandagatla This patch adds sdma_buffer_boundary_arg 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_buffer_boundary_arg is set to SDHCI_DEFAULT_BOUNDARY_ARG. Signed-off-by: Srinivas Kandagatla --- drivers/mmc/host/sdhci.c | 14 ++++++++++---- drivers/mmc/host/sdhci.h | 3 +++ 2 files changed, 13 insertions(+), 4 deletions(-) -- 2.11.0 diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index ecd0d4350e8a..4a7b5dcfc55b 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -897,7 +897,7 @@ 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, + sdhci_writew(host, SDHCI_MAKE_BLKSZ(host->sdma_buffer_boundary_arg, 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 barg = host->sdma_buffer_boundary_arg; spin_lock_irqsave(&host->lock, flags); @@ -2052,9 +2053,11 @@ 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(barg, 128), SDHCI_BLOCK_SIZE); else - sdhci_writew(host, SDHCI_MAKE_BLKSZ(7, 64), SDHCI_BLOCK_SIZE); + sdhci_writew(host, + SDHCI_MAKE_BLKSZ(barg, 64), SDHCI_BLOCK_SIZE); /* * The tuning block is sent by the card to the host controller. @@ -2998,7 +3001,8 @@ 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_buffer_boundary_arg, 512), SDHCI_BLOCK_SIZE); /* Set maximum timeout */ @@ -3119,6 +3123,8 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev, host->tuning_delay = -1; + host->sdma_buffer_boundary_arg = SDHCI_DEFAULT_BOUNDARY_ARG; + return host; } diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 0469fa191493..6ff2294e55b3 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_buffer_boundary_arg; + unsigned long private[0] ____cacheline_aligned; };