From patchwork Thu Dec 22 04:57:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 88802 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp2627424qgi; Wed, 21 Dec 2016 20:57:55 -0800 (PST) X-Received: by 10.98.61.21 with SMTP id k21mr7291379pfa.118.1482382675398; Wed, 21 Dec 2016 20:57:55 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q63si29239118pfg.266.2016.12.21.20.57.55; Wed, 21 Dec 2016 20:57:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 S932878AbcLVE5y (ORCPT + 7 others); Wed, 21 Dec 2016 23:57:54 -0500 Received: from mail-pf0-f175.google.com ([209.85.192.175]:35060 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932496AbcLVE5x (ORCPT ); Wed, 21 Dec 2016 23:57:53 -0500 Received: by mail-pf0-f175.google.com with SMTP id i88so37683647pfk.2 for ; Wed, 21 Dec 2016 20:57:53 -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=tKXU7oL4vgjY12v9O5ibN4Zf/6hpkYHIBQESbp2fMM4=; b=PrSii//epQKGkAbY91oscwxG9h8wd2RLqTpRDUm6GlGkyXKLIM9C1mlcE9Ae3QH2Rx H4NLvHFDYlKh6esB9t//FVCwtW+HmM8uQpVsPw4VmyMCwod6jPjgVbWX4iarGWqar+W7 eAtPepexue8YJtEhky0ApEEFe2uhOlrsmVUpc= 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=tKXU7oL4vgjY12v9O5ibN4Zf/6hpkYHIBQESbp2fMM4=; b=qkAv0QISLPUNSU0fu0vIyvE+K/dvnwVKchKZEphEX90QZtU3y9tttIdjvF7aUaxuXT +IF7ggK4ovRYZIQ3r2kvTUt1Xiox5WL2n9oJHf9OBqK0LyZhITA6pUW00SPwUjMa0wVu k8aDH3hV8IqdKSK9pv7AXP5dLDvJxhg6SoK8An9K2O9/yXuw1yOXYoH6TAlX4y9WMYnK JzpDceEu37KpoNimm5KmEjIGjZkkZbNDnI7zYnItvgZTzN1rH0rPD3LXB4C9CvJlYR9U E2UPurpV4wlv0Anl0jMXiRATgB6ptJnKJVSux94BgExqSPcHdq+N868AOliJ6/z8mRzN 7eVw== X-Gm-Message-State: AIkVDXLPDvmzgwGCfk7I/b1gyckvg0wif2vPbu0FZ3pfrbWvqy1p9B5gofCaoZpJjGwlqYe3 X-Received: by 10.99.158.18 with SMTP id s18mr13805185pgd.88.1482382671607; Wed, 21 Dec 2016 20:57:51 -0800 (PST) Received: from localhost.localdomain (125-227-221-25.HINET-IP.hinet.net. [125.227.221.25]) by smtp.gmail.com with ESMTPSA id t15sm6385583pgn.18.2016.12.21.20.57.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Dec 2016 20:57:51 -0800 (PST) From: Jun Nie To: robh+dt@kernel.org, mark.rutland@arm.com, shawn.guo@linaro.org, xie.baoyou@zte.com.cn, devicetree@vger.kernel.org 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 v8 2/5] mmc: dw: Add fifo address property Date: Thu, 22 Dec 2016 12:57:34 +0800 Message-Id: <1482382657-16681-3-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1482382657-16681-1-git-send-email-jun.nie@linaro.org> References: <1482382657-16681-1-git-send-email-jun.nie@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@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 Reviewed-by: Shawn Lin --- 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 devicetree" 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 b44306b..b600170 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -2977,6 +2977,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; @@ -3180,7 +3182,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 15db6f8..1c09cca 100644 --- a/include/linux/mmc/dw_mmc.h +++ b/include/linux/mmc/dw_mmc.h @@ -113,6 +113,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. @@ -160,6 +161,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;