From patchwork Wed Jun 28 13:35:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 106532 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1023357qge; Wed, 28 Jun 2017 06:35:47 -0700 (PDT) X-Received: by 10.98.62.70 with SMTP id l67mr11014637pfa.114.1498656947348; Wed, 28 Jun 2017 06:35:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498656947; cv=none; d=google.com; s=arc-20160816; b=J+kyAxiuS3eJPHgrJNjY+3t673tx3PEBJzDtkVQEzKw3qpTGe7Ygt9wnN2eeGAvIZc Pw+LRddf59PtgQm96se/6xENp2l6lV4B2SXGcxm3jfaIdpwXOJK3+yrNqFJe65kK4arb 1eFUPvg/+k8QzDeu1xdWe/oh92wb/RgJSFnC/zH5zsKW6YefH4B8HLOUtH+1eswr+mFf /iUkUnVRdwkLw+biJRA4xLJ4pa+/9z3D4fJP4kVfzaVy9mEPrg72ZDnb908biqbu0vAQ NvJ2ubTegdwsnRyn0kIEMYojHGDT99N+FR3HhHwoz+7SJyKdCyEg3C+F0ciyFgaMqUIG 1ZTQ== 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=bfHPVupFQnsDKD9OUSKSU01CGC7Kz6I25Kf1JJc/ru8=; b=i6+uumqjXn3eQxOwYGtj81wIjfVIEA17LGT8NJbNwlIbh+6HJZv9kRtDtnK7fBeIjf TjlA6Ap1FXdmf2NP95ZvZQWihlavtrOWghFcnyIBwj6PQTvosmX1D3DTNiqjETgHmIXo x3ckZQ9v5esypcDh/aOlCn71A7yMpzBI5qf4nd5TIBNnpocy0STIzOUoXnZlYSCz7t6T 5VM/ZWuRLifoBvpxtAkPESW+QfRWCLS+tcU7Axk7EVIx5Mm4I8H7a30YLuJ9O1LreyEl XogOCYJRXauJUZXaUVjIzE3I5JaSfRXfRH9UKM6qAQKaEBwoAZDg0z4MttT5agfS7Rmj tEiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=grZ63XZv; 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 b35si1746824plh.375.2017.06.28.06.35.47; Wed, 28 Jun 2017 06:35:47 -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=grZ63XZv; 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 S1752117AbdF1Nfa (ORCPT + 10 others); Wed, 28 Jun 2017 09:35:30 -0400 Received: from mail-it0-f54.google.com ([209.85.214.54]:36677 "EHLO mail-it0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752062AbdF1NfP (ORCPT ); Wed, 28 Jun 2017 09:35:15 -0400 Received: by mail-it0-f54.google.com with SMTP id m68so29726783ith.1 for ; Wed, 28 Jun 2017 06:35: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=Pv8ub8wsRKJkA262Lw6zCgorPhSPw4DwkAyy6hGqghs=; b=grZ63XZvoJ+eUWSk+r4/6f5Oq0jr0t8uYBynhF1rohKkU/ZfaTRInfp6cFt9XogUxB q2dxUZn5/qqeDZ+cr6QAU0Q9QO4oS8TAYl3FNiGM9T2tm3KqnPCuPJwe1n9yWREloSNM yrkViIMNzJ3IMcjIh5mV+U9sMcHTv+ndEAYxM= 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=Pv8ub8wsRKJkA262Lw6zCgorPhSPw4DwkAyy6hGqghs=; b=nv4lEZ5nYm3tVVO0CYLEHJpGwUQGDQtc6IGJBUbKfbSmWlRHIEG/I0kQkvA7bTybj3 CxgRlfGby2123sr36XS1qSPTzmA2zONSkZjunfUbzJu7Nj1DvSr/43P1miEDvvHjRVjg rXyXZ5yTFPbqUC7Kf3sbhYSbJZc2+M9OZVt2IrmRIrpVmVv0wr4WKfzlAMT/2NQrqs3s uNz0uldgnsM4S4GO1iTYF4i6Ns6gvHoFB7qpHQbj6QMfMQd0GkjneJLniWmUP3MxUnGB i/pt08fYrK7UXI+5YbR5/meFrUV64vu8jd6kvAznwfYCVRi3Y2ACI4+ZgMRRuSjE3JoJ /24w== X-Gm-Message-State: AKS2vOyUNgDUevMesZo3EjwaHStEu258ihoPUAQ1j2yToqAcmRrOlo76 rjxPr1XisDxLsQpe X-Received: by 10.36.163.198 with SMTP id p189mr7560833ite.64.1498656914892; Wed, 28 Jun 2017 06:35: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 h76sm2859553ith.24.2017.06.28.06.35.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Jun 2017 06:35:14 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: Adrian Hunter , Ulf Hansson Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Srinivas Kandagatla Subject: [RFC PATCH 1/2] mmc: sdhci: add quirk SDHCI_QUIRK2_BROKEN_SDMA_BOUNDARY_BUFFER Date: Wed, 28 Jun 2017 15:35:03 +0200 Message-Id: <20170628133504.17422-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170628133504.17422-1-srinivas.kandagatla@linaro.org> References: <20170628133504.17422-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 quirk to 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. Signed-off-by: Srinivas Kandagatla --- drivers/mmc/host/sdhci.c | 24 ++++++++++++++++++------ drivers/mmc/host/sdhci.h | 2 ++ 2 files changed, 20 insertions(+), 6 deletions(-) -- 2.11.0 -- 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 diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index ecd0d4350e8a..d68ff1955761 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -765,6 +765,20 @@ static void sdhci_set_timeout(struct sdhci_host *host, struct mmc_command *cmd) } } +static void sdhci_set_blk_size_reg(struct sdhci_host *host, + unsigned int sdma_boundary, + unsigned int blksz) +{ + if ((host->quirks2 & SDHCI_QUIRK2_BROKEN_SDMA_BOUNDARY_BUFFER) && + (host->flags & SDHCI_USE_ADMA)) { + sdhci_writew(host, SDHCI_MAKE_BLKSZ(0, blksz), + SDHCI_BLOCK_SIZE); + } else { + sdhci_writew(host, SDHCI_MAKE_BLKSZ(sdma_boundary, blksz), + SDHCI_BLOCK_SIZE); + } +} + static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_command *cmd) { u8 ctrl; @@ -897,8 +911,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, - data->blksz), SDHCI_BLOCK_SIZE); + sdhci_set_blk_size_reg(host, SDHCI_DEFAULT_BOUNDARY_ARG, data->blksz); sdhci_writew(host, data->blocks, SDHCI_BLOCK_COUNT); } @@ -2052,9 +2065,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_set_blk_size_reg(host, SDHCI_DEFAULT_BOUNDARY_ARG, 128); else - sdhci_writew(host, SDHCI_MAKE_BLKSZ(7, 64), SDHCI_BLOCK_SIZE); + sdhci_set_blk_size_reg(host, SDHCI_DEFAULT_BOUNDARY_ARG, 64); /* * The tuning block is sent by the card to the host controller. @@ -2998,8 +3011,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_BLOCK_SIZE); + sdhci_set_blk_size_reg(host, SDHCI_DEFAULT_BOUNDARY_ARG, 512); /* Set maximum timeout */ sdhci_writeb(host, 0xE, SDHCI_TIMEOUT_CONTROL); diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 0469fa191493..9a1343509bb5 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -435,6 +435,8 @@ struct sdhci_host { #define SDHCI_QUIRK2_ACMD23_BROKEN (1<<14) /* Broken Clock divider zero in controller */ #define SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN (1<<15) +/* Controller doesn't support sdma boundray buffer setup when using ADMA */ +#define SDHCI_QUIRK2_BROKEN_SDMA_BOUNDARY_BUFFER (1<<16) int irq; /* Device IRQ */ void __iomem *ioaddr; /* Mapped address */