From patchwork Mon Oct 24 09:11:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 78916 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp2463508qge; Mon, 24 Oct 2016 02:12:38 -0700 (PDT) X-Received: by 10.98.19.208 with SMTP id 77mr27154810pft.102.1477300358093; Mon, 24 Oct 2016 02:12:38 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t62si14420970pfd.133.2016.10.24.02.12.37; Mon, 24 Oct 2016 02:12:38 -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; 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 dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753162AbcJXJMh (ORCPT + 3 others); Mon, 24 Oct 2016 05:12:37 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:35249 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934500AbcJXJMg (ORCPT ); Mon, 24 Oct 2016 05:12:36 -0400 Received: by mail-pf0-f182.google.com with SMTP id s8so95424051pfj.2 for ; Mon, 24 Oct 2016 02:12:36 -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=49Cz29HHqPXowzs9al9aHaT/f0TEgudXS5AbnEdNGxo=; b=iZuShhczWHlpwKPWXHt0wCHSg8/OyqNbYeseelkYNxGY61zaJNBzcWDVn4aJv3eycJ DEjgSBHSPFR6BFwvA524+YYJzvMEbVrjgy4USv0fFZKWnXW/tILa4VdkcvxSBRebMEYo PkL370CBXxtr4pvsiQchzp8dWBoVIcu2ix0dI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=49Cz29HHqPXowzs9al9aHaT/f0TEgudXS5AbnEdNGxo=; b=iOdCWKcWj2DrAJPGb4EGJDdL71LxjbT6X87CgmXdVFEVhj79D0JuOGLIMhbZKPVgyW RiGNowIl4UtY9Jfu2j+K5ntdTA5kAtUxPFIDDwPn+lgtwsylP+kESS11qEdKaM602iLe h288OoV48wgF/CSffKGllX1cgrEDEVddRz1ZGYCvSZZGu3ZHMOM8+ekjRjyzys6Lqsx0 1XVwMkML2xRwou55HnVHOm7TiiDYu8Vsob/tV30BRYgjKpmyLqDLlB7/zArh0bwV5ZKp DgHD8lQSZBkiSN1iEaty+zxhCZp4+y8IJl5Kt6mny1JzwUdIurwPZzc02RahfhHqsXu1 Csag== X-Gm-Message-State: ABUngvdfUYF0e9C3uMGAXbCbfoMSpZ9veGLEXNZpzwLgu9xUgRS5SJu4KIaFpG0EcazQpMmC X-Received: by 10.99.140.73 with SMTP id q9mr13609698pgn.112.1477300355636; Mon, 24 Oct 2016 02:12:35 -0700 (PDT) Received: from localhost.localdomain ([188.42.255.214]) by smtp.gmail.com with ESMTPSA id q23sm23464603pfg.95.2016.10.24.02.12.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Oct 2016 02:12:35 -0700 (PDT) From: Jun Nie To: shawn.guo@linaro.org, xie.baoyou@zte.com.cn Cc: ulf.hansson@linaro.org, jh80.chung@samsung.com, jason.liu@linaro.org, linux-mmc@vger.kernel.org, Jun Nie Subject: [PATCH 5/5] mmc: dw: Add fifo watermark quirk Date: Mon, 24 Oct 2016 17:11:56 +0800 Message-Id: <1477300316-1420-6-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1477300316-1420-1-git-send-email-jun.nie@linaro.org> References: <1477300316-1420-1-git-send-email-jun.nie@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Data done irq is expected if data length is less than watermark in PIO mode. But fifo watermark is requested to be aligned with data length in some SoC so that TX/RX irq can be generated with data done irq. Add the watermark quirk to mark this requirement and force fifo watermark setting accordingly. Signed-off-by: Jun Nie --- drivers/mmc/host/dw_mmc.c | 11 +++++++++-- include/linux/mmc/dw_mmc.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) -- 1.9.1 -- 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/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 9dcd6da..d746c4a 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1111,11 +1111,15 @@ static void dw_mci_submit_data(struct dw_mci *host, struct mmc_data *data) mci_writel(host, CTRL, temp); /* - * Use the initial fifoth_val for PIO mode. + * Use the initial fifoth_val for PIO mode. If wm_quirk + * is set, we set watermark same as data size. * If next issued data may be transfered by DMA mode, * prev_blksz should be invalidated. */ - mci_writel(host, FIFOTH, host->fifoth_val); + if (host->wm_quirk) + dw_mci_adjust_fifoth(host, data); + else + mci_writel(host, FIFOTH, host->fifoth_val); host->prev_blksz = 0; } else { /* @@ -2958,6 +2962,9 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host) of_property_read_u32(np, "fifo-addr-override", &host->fifo_addr_override); + if (of_get_property(np, "fifo-watermark-quirk", NULL)) + host->wm_quirk = true; + if (!of_property_read_u32(np, "clock-frequency", &clock_frequency)) pdata->bus_hz = clock_frequency; diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h index 4866ef5..e7cc584 100644 --- a/include/linux/mmc/dw_mmc.h +++ b/include/linux/mmc/dw_mmc.h @@ -156,6 +156,7 @@ struct dw_mci { void __iomem *regs; void __iomem *fifo_reg; u32 fifo_addr_override; + u32 wm_quirk; struct scatterlist *sg; struct sg_mapping_iter sg_miter;