From patchwork Fri Aug 14 22:13:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Heiko_St=C3=BCbner?= X-Patchwork-Id: 7019721 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 39EC1C05AC for ; Fri, 14 Aug 2015 22:14:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 53E1920504 for ; Fri, 14 Aug 2015 22:14:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7203F20457 for ; Fri, 14 Aug 2015 22:14:40 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZQNFG-0000r3-53; Fri, 14 Aug 2015 22:14:38 +0000 Received: from gloria.sntech.de ([95.129.55.99]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZQNFE-0000nQ-CL; Fri, 14 Aug 2015 22:14:37 +0000 Received: from ip5f5b6ac8.dynamic.kabel-deutschland.de ([95.91.106.200] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1ZQNEU-0004Zo-Af; Sat, 15 Aug 2015 00:13:50 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: Shawn Lin Subject: Re: [RFC PATCH v5 1/9] mmc: dw_mmc: Add external dma interface support Date: Sat, 15 Aug 2015 00:13:49 +0200 Message-ID: <1522710.BT6Gc0L6oH@diego> User-Agent: KMail/4.14.1 (Linux/3.16.0-4-amd64; KDE/4.14.2; x86_64; ; ) In-Reply-To: <1439541275-30146-1-git-send-email-shawn.lin@rock-chips.com> References: <1439541232-30100-1-git-send-email-shawn.lin@rock-chips.com> <1439541275-30146-1-git-send-email-shawn.lin@rock-chips.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150814_151436_593615_B2A12F6B X-CRM114-Status: GOOD ( 15.29 ) X-Spam-Score: -3.6 (---) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mips@linux-mips.org, ulf.hansson@linaro.org, Krzysztof Kozlowski , linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Russell King , Alexey Brodkin , Wei Xu , jh80.chung@samsung.com, linux-rockchip@lists.infradead.org, Kukjin Kim , Zhangfei Gao , Vineet.Gupta1@synopsys.com, devicetree@vger.kernel.org, Arnd Bergmann , Joachim Eastwood , Govindraj Raja , linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, dianders@chromium.org, Ralf Baechle , Jun Nie Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Shawn, Am Freitag, 14. August 2015, 16:34:35 schrieb Shawn Lin: > DesignWare MMC Controller can supports two types of DMA > mode: external dma and internal dma. We get a RK312x platform > integrated dw_mmc and ARM pl330 dma controller. This patch add > edmac ops to support these platforms. I've tested it on RK312x > platform with edmac mode and RK3288 platform with idmac mode. > > Signed-off-by: Shawn Lin judging by your "from", I guess you're running this on some older Rockchip soc without the idma? Because I tried testing this on a Radxa Rock, but only got failures, from the start (failed to read card status register). In PIO mode everything works again. I guess I overlooked just some tiny detail, but to me the dma channel ids seem correct after all. Maybe you have any hints what I'm doing wrong? [...] > diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c > index fcbf552..e01ead3 100644 > --- a/drivers/mmc/host/dw_mmc.c > +++ b/drivers/mmc/host/dw_mmc.c > @@ -2517,8 +2642,23 @@ static void dw_mci_cleanup_slot(struct dw_mci_slot > *slot, unsigned int id) static void dw_mci_init_dma(struct dw_mci *host) > { > int addr_config; > + int trans_mode; > + struct device *dev = host->dev; > + struct device_node *np = dev->of_node; > + > + /* Check tansfer mode */ > + trans_mode = SDMMC_GET_TRANS_MODE(mci_readl(host, HCON)); > + if (trans_mode == 0) { > + trans_mode = TRANS_MODE_IDMAC; > + } else if (trans_mode == 1 || trans_mode == 2) { > + trans_mode = TRANS_MODE_EDMAC; > + } else { > + trans_mode = TRANS_MODE_PIO; > + goto no_dma; > + } > + > /* Check ADDR_CONFIG bit in HCON to find IDMAC address bus width */ > - addr_config = (mci_readl(host, HCON) >> 27) & 0x01; > + addr_config = SDMMC_GET_ADDR_CONFIG(mci_readl(host, HCON)); > > if (addr_config == 1) { > /* host supports IDMAC in 64-bit address mode */ I guess the idmac address size checking block /* Check ADDR_CONFIG bit in HCON to find IDMAC address bus width */ addr_config = SDMMC_GET_ADDR_CONFIG(mci_readl(host, HCON)); if (addr_config == 1) { /* host supports IDMAC in 64-bit address mode */ host->dma_64bit_address = 1; dev_info(host->dev, "IDMAC supports 64-bit address mode.\n"); if (!dma_set_mask(host->dev, DMA_BIT_MASK(64))) dma_set_coherent_mask(host->dev, DMA_BIT_MASK(64)); } else { /* host supports IDMAC in 32-bit address mode */ host->dma_64bit_address = 0; dev_info(host->dev, "IDMAC supports 32-bit address mode.\n"); } could either live inside the trans_mode == 0 conditional above or get its own if (trans_mode == 0) conditional. Either way I guess it should not talk about idmac when either pio or extdmac are used. Thanks Heiko diff --git a/arch/arm/boot/dts/rk3xxx.dtsi b/arch/arm/boot/dts/rk3xxx.dtsi index 4497d28..92d7156 100644 --- a/arch/arm/boot/dts/rk3xxx.dtsi +++ b/arch/arm/boot/dts/rk3xxx.dtsi @@ -217,6 +217,8 @@ interrupts = ; clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>; clock-names = "biu", "ciu"; + dmas = <&dmac2 1>; + dma-names = "rx-tx"; fifo-depth = <256>; status = "disabled"; }; @@ -227,6 +229,8 @@ interrupts = ; clocks = <&cru HCLK_SDIO>, <&cru SCLK_SDIO>; clock-names = "biu", "ciu"; + dmas = <&dmac2 3>; + dma-names = "rx-tx"; fifo-depth = <256>; status = "disabled"; }; @@ -237,6 +241,8 @@ interrupts = ; clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>; clock-names = "biu", "ciu"; + dmas = <&dmac2 4>; + dma-names = "rx-tx"; fifo-depth = <256>; status = "disabled"; };