From patchwork Mon Dec 5 02:29:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 86485 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1275709qgi; Sun, 4 Dec 2016 18:30:53 -0800 (PST) X-Received: by 10.99.145.74 with SMTP id l71mr98217609pge.128.1480905052950; Sun, 04 Dec 2016 18:30:52 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w17si12870432pge.203.2016.12.04.18.30.52; Sun, 04 Dec 2016 18:30:52 -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 S1751569AbcLECan (ORCPT + 7 others); Sun, 4 Dec 2016 21:30:43 -0500 Received: from mail-pf0-f173.google.com ([209.85.192.173]:34454 "EHLO mail-pf0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751515AbcLEC36 (ORCPT ); Sun, 4 Dec 2016 21:29:58 -0500 Received: by mail-pf0-f173.google.com with SMTP id c4so60418062pfb.1 for ; Sun, 04 Dec 2016 18:29:58 -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=VkDR7wGL6wAkx6J0UsciUb135uI713DOIVN349KwqE6+pEIbeO8TWnkPnCpHDy5M11 Hi2tGqA26jCmCY1qn1rFhVai8JY2sfuem8xc/mc4rn+ys4coIxAHe/UqEBC9Apx4zZ3n uzrW8ooRPFAx+Tx7w/420QeR9t0U7dktBrSvA= 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=tKXU7oL4vgjY12v9O5ibN4Zf/6hpkYHIBQESbp2fMM4=; b=N17VZtzj0B9ihTVqQtVDpBgpAGCf521N19YinK7h1agEUO99E/PhbIlJWU6K3joo8y cHekIRo9bCxkAibsJDZOHSYdKKHpGrp+aYp/4H3QCcXB5fnbnVp5pcXu1WJBnt7KprUf khiHMvMj06LM0BETGYhoJ1zKfWayKSV/o2ccoUdFLLnywfxu/vVDWBTdQpp68mMqF0TC Lsu3fY0mKesfrubJiSil/2xVjqpnQ15U8heD+Fv/YC6GRY71G8T7/tlp79kXrawgxxPq zkRBq+5IcwPVpxm3NF+gGtLAedpGJGOz2lIh5Yr/GmAl2pgSZ7gkdik5slSzjT5cDxdp P6PQ== X-Gm-Message-State: AKaTC011zWOlMBlK2kplAei8tnKQYGVOqDYCQJU2Dzun1OwtXEd4Sb4z0m0h/gr51Dl9Ow// X-Received: by 10.98.59.154 with SMTP id w26mr54700551pfj.112.1480904997463; Sun, 04 Dec 2016 18:29:57 -0800 (PST) Received: from localhost.localdomain (118-163-207-41.HINET-IP.hinet.net. [118.163.207.41]) by smtp.gmail.com with ESMTPSA id w125sm22818670pfb.8.2016.12.04.18.29.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 04 Dec 2016 18:29:57 -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 v7 4/5] mmc: dw: Add fifo address property Date: Mon, 5 Dec 2016 10:29:35 +0800 Message-Id: <1480904976-7081-5-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1480904976-7081-1-git-send-email-jun.nie@linaro.org> References: <1480904976-7081-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;