From patchwork Fri Nov 18 06:29:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 82839 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp1183108qge; Thu, 17 Nov 2016 22:29:39 -0800 (PST) X-Received: by 10.129.42.213 with SMTP id q204mr5868291ywq.342.1479450579499; Thu, 17 Nov 2016 22:29:39 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u99si1337044ybi.13.2016.11.17.22.29.39; Thu, 17 Nov 2016 22:29:39 -0800 (PST) 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 S1751643AbcKRG3i (ORCPT + 4 others); Fri, 18 Nov 2016 01:29:38 -0500 Received: from mail-pf0-f182.google.com ([209.85.192.182]:35880 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751574AbcKRG3i (ORCPT ); Fri, 18 Nov 2016 01:29:38 -0500 Received: by mail-pf0-f182.google.com with SMTP id 189so53275798pfz.3 for ; Thu, 17 Nov 2016 22:29:37 -0800 (PST) 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=9Xli1L7gNxZYS62UxdlZMjSLmlGNDukDHh8E12vu1tE=; b=gYyqK1DJSNIzoMWOIBrxlJTSDXtCr8/aOvPAvsHb7NsP+OkeZ4Tyv6TwTnM1aQNp64 FjKj3AC6kMGTd3YFumLpn8eZvKFleuJKrvSVUUOGx1qbKDJSHBcyHbzwZC9c53RX+kfc KAnSe1kw4lf+4Vo1k/MkRm6F4/PnnrA3gPXDE= 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=9Xli1L7gNxZYS62UxdlZMjSLmlGNDukDHh8E12vu1tE=; b=mPLNtZDZktjUgXbrV1ypR2zQdeZ7SKbZiHPN8oC7YwTwqtYivqRmSH14fVMUT1PA1h dW+yl09H/wrku2xLwkAIGlzOAelLSO+tyf0NQImors0hl60qcDyqa4wq2sgAyDp/O0yI vcZPEBKfzJBj8//my5XqNiCvA2JmCyGGguxJoRHfLMOFcx6zu6NKfxP6e0gKY60umkdL ElZwSVJX5LAXu1+olmJeZMLXNiLgQtV9FJGNNBABv9h70N1CzpX3gYGmmi6LE3k9cjk2 dxzSJFfUNOdBng14lF77tdgA42b9BlPPsoD/TWUVyNxVG2e3ccap98DRRmdeKUcifXry u9ew== X-Gm-Message-State: ABUngvcIubTRBmHMIkmvHIUuMbyDVH/SABa/8ScPNiqWgrMHJE0CtoJQipG05wysSuPMGDQJ X-Received: by 10.98.156.17 with SMTP id f17mr9519047pfe.63.1479450577011; Thu, 17 Nov 2016 22:29:37 -0800 (PST) Received: from localhost.localdomain (61-216-161-10.HINET-IP.hinet.net. [61.216.161.10]) by smtp.gmail.com with ESMTPSA id z62sm13638848pfz.19.2016.11.17.22.29.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Nov 2016 22:29:36 -0800 (PST) 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, chen.chaokai@zte.com.cn, lai.binz@zte.com.cn, linux-mmc@vger.kernel.org, Jun Nie Subject: [PATCH v6 4/5] mmc: dw: Add fifo address property Date: Fri, 18 Nov 2016 14:29:14 +0800 Message-Id: <1479450555-19047-5-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1479450555-19047-1-git-send-email-jun.nie@linaro.org> References: <1479450555-19047-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 The FIFO address may break default address assumption of 0x100 (version < 0x240A) and 0x200(version >= 0x240A) in current driver. The new property is introduced to override fifo address via DT node information. Signed-off-by: Jun Nie --- drivers/mmc/host/dw_mmc.c | 6 +++++- include/linux/mmc/dw_mmc.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) -- 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 1c9ee36..696b5e6 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -2955,6 +2955,8 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host) of_property_read_u32(np, "card-detect-delay", &pdata->detect_delay_ms); + of_property_read_u32(np, "data-addr", &host->data_addr_override); + if (!of_property_read_u32(np, "clock-frequency", &clock_frequency)) pdata->bus_hz = clock_frequency; @@ -3158,7 +3160,9 @@ int dw_mci_probe(struct dw_mci *host) host->verid = SDMMC_GET_VERID(mci_readl(host, VERID)); dev_info(host->dev, "Version ID is %04x\n", host->verid); - if (host->verid < DW_MMC_240A) + if (host->data_addr_override) + host->fifo_reg = host->regs + host->data_addr_override; + else if (host->verid < DW_MMC_240A) host->fifo_reg = host->regs + DATA_OFFSET; else host->fifo_reg = host->regs + DATA_240A_OFFSET; diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h index f5af2bd..17cb95a 100644 --- a/include/linux/mmc/dw_mmc.h +++ b/include/linux/mmc/dw_mmc.h @@ -107,6 +107,7 @@ struct dw_mci_dma_slave { * @ciu_clk: Pointer to card interface unit clock instance. * @slot: Slots sharing this MMC controller. * @fifo_depth: depth of FIFO. + * @data_addr_override: override fifo reg offset with this value. * @data_shift: log2 of FIFO item size. * @part_buf_start: Start index in part_buf. * @part_buf_count: Bytes of partial data in part_buf. @@ -154,6 +155,7 @@ struct dw_mci { spinlock_t irq_lock; void __iomem *regs; void __iomem *fifo_reg; + u32 data_addr_override; struct scatterlist *sg; struct sg_mapping_iter sg_miter;