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: 9876241 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3BEA26037D for ; Wed, 2 Aug 2017 08:40:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A1D328760 for ; Wed, 2 Aug 2017 08:40:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E61C28795; Wed, 2 Aug 2017 08:40:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A845928760 for ; Wed, 2 Aug 2017 08:40:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752540AbdHBIjQ (ORCPT ); Wed, 2 Aug 2017 04:39:16 -0400 Received: from mail-io0-f172.google.com ([209.85.223.172]:37568 "EHLO mail-io0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752515AbdHBIiP (ORCPT ); Wed, 2 Aug 2017 04:38:15 -0400 Received: by mail-io0-f172.google.com with SMTP id c74so17673371iod.4 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=sjj9OfbT0i2PM1vSuUlqc7+/WJpxDn4do9KIi5nlHERm8Yq2W/4Cs80H4mh19mxUtN Z9GxuaLZhVDW98bZ4fB0P2obYm8XOBDzBwruckdkpcGzC3OFadDDvT80ky5Peiaaj0ct EtrbvbQEEGCiKirJGX0nmKOsZUhbi+YfHIfhyYGS6hF5Tzygy7xUpeHpe2OopulPyX1D 6u/CZaWdYIUE+NE7BWuP72rQPuIpKDl0EfVtjlDHBY6KQABmCeRkZR4WdRUSiyGmwpH7 OnVOPBYfzVZ7n4n0JVCuQpXsE2FEH677OONjRg09xyJFQWWGGwb1sTQdkppvFR4rZE1U LYQA== X-Gm-Message-State: AIVw110t2cQV+igUVL1VCJES2giWHF5EOL65VTUzjs4vzPvJUV6CCUXq 4vijMytuvgwUdIyk 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-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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; };