From patchwork Tue Aug 9 06:36:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Shijie X-Patchwork-Id: 1047602 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p796bvCK032716 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 9 Aug 2011 06:38:23 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QqfwY-00061e-4i; Tue, 09 Aug 2011 06:37:38 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QqfwX-0005wV-7t; Tue, 09 Aug 2011 06:37:37 +0000 Received: from va3ehsobe003.messaging.microsoft.com ([216.32.180.13] helo=VA3EHSOBE003.bigfish.com) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QqfwT-0005w9-LY; Tue, 09 Aug 2011 06:37:34 +0000 Received: from mail169-va3-R.bigfish.com (10.7.14.241) by VA3EHSOBE003.bigfish.com (10.7.40.23) with Microsoft SMTP Server id 14.1.225.22; Tue, 9 Aug 2011 06:37:31 +0000 Received: from mail169-va3 (localhost.localdomain [127.0.0.1]) by mail169-va3-R.bigfish.com (Postfix) with ESMTP id 2800C1B81DE; Tue, 9 Aug 2011 06:37:31 +0000 (UTC) X-SpamScore: -9 X-BigFish: VS-9(zz9371Kc85dh1432N98dKzz1202h1082kzz8275bh8275dhz2dh2a8h668h839h34h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail169-va3 (localhost.localdomain [127.0.0.1]) by mail169-va3 (MessageSwitch) id 1312871850941549_31743; Tue, 9 Aug 2011 06:37:30 +0000 (UTC) Received: from VA3EHSMHS019.bigfish.com (unknown [10.7.14.245]) by mail169-va3.bigfish.com (Postfix) with ESMTP id 9B641F5004B; Tue, 9 Aug 2011 06:37:30 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by VA3EHSMHS019.bigfish.com (10.7.99.29) with Microsoft SMTP Server (TLS) id 14.1.225.22; Tue, 9 Aug 2011 06:37:21 +0000 Received: from az33smr01.freescale.net (10.64.34.199) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server id 14.1.323.2; Tue, 9 Aug 2011 01:37:21 -0500 Received: from localhost.localdomain (udp161135uds.ap.freescale.net [10.192.242.11]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id p796bH1Z026517; Tue, 9 Aug 2011 01:37:18 -0500 (CDT) Message-ID: <4E40D563.2090202@freescale.com> Date: Tue, 9 Aug 2011 14:36:19 +0800 From: Huang Shijie User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc14 Thunderbird/3.1.11 MIME-Version: 1.0 To: Koen Beel Subject: Re: GPMI-NAND Status? References: <20110805135133.GA26981@pengutronix.de> <4E3F8087.6070206@freescale.com> <4E3FBC75.7010703@freescale.com> In-Reply-To: X-OriginatorOrg: freescale.com X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110809_023733_803751_C699D2F8 X-CRM114-Status: GOOD ( 30.68 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [216.32.180.13 listed in list.dnswl.org] Cc: Wolfram Sang , linux-mtd@lists.infradead.org, Shawn Guo , shijie8@gmail.com, linux-arm-kernel@lists.infradead.org, =?ISO-8859-1?Q?Lothar_Wa=DFmann?= X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 09 Aug 2011 06:38:23 +0000 (UTC) Hi Koen: > Hi, > > On Mon, Aug 8, 2011 at 12:37 PM, Huang Shijie wrote: >> Hi, >>> On my target, the mxs-dma is working for sdio until the gpmi-nand >>> gives a timeout. After that the dma for sdio is *not fully* working >>> anymore. >>> >> We need more log in following aspects: >> [1] apbh-dma registers >> [2] clk registers >> [3] gpmi registers >> >> Please git-apply the patch in the attachment. >> It will print out more DMA information WHEN dma-timeout occur. > Don't get it. What exactly are you trying to dump? > This patch dumps CTRL0, CTRL1, CTRL2, DEVSEL but also some registers > of APBH channel0 which is reserved.... sorry, I intended to print out the channel 4(NAND_DEVICE0). I want to know that: When the dma timeout occurs, whether it caused by the GPMI or by the DMA itself. Please try the new patch. Best Regards Huang Shijie > Then it prints some debug info on channel 1 (ssp1) and then alle > channel 2 register except the debug register (ssp2 = not used here). > > What info do you need? > > Br, > Koen > >> Best Regards >> Huang Shijie >> > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel > From 69b5bf4d3bf73a89b521a7c592f5bea1d66c2755 Mon Sep 17 00:00:00 2001 From: Huang Shijie Date: Mon, 8 Aug 2011 18:39:11 +0800 Subject: [PATCH] print_more_log print out the DMA register when timeout occur. Signed-off-by: Huang Shijie --- drivers/dma/mxs-dma.c | 37 +++++++++++++++++++++++++++++++- drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 2 + 2 files changed, 38 insertions(+), 1 deletions(-) diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c index 88aad4f..755cbfc 100644 --- a/drivers/dma/mxs-dma.c +++ b/drivers/dma/mxs-dma.c @@ -130,6 +130,7 @@ struct mxs_dma_engine { struct mxs_dma_chan mxs_chans[MXS_DMA_CHANNELS]; }; +struct mxs_dma_chan *g_mxs_chan; static void mxs_dma_reset_chan(struct mxs_dma_chan *mxs_chan) { struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; @@ -239,6 +240,7 @@ static dma_cookie_t mxs_dma_tx_submit(struct dma_async_tx_descriptor *tx) struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(tx->chan); mxs_dma_enable_chan(mxs_chan); + g_mxs_chan = mxs_chan; return mxs_dma_assign_cookie(mxs_chan); } @@ -370,6 +372,7 @@ static void mxs_dma_free_chan_resources(struct dma_chan *chan) clk_disable(mxs_dma->clk); } +static int idx; static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg( struct dma_chan *chan, struct scatterlist *sgl, unsigned int sg_len, enum dma_data_direction direction, @@ -381,7 +384,6 @@ static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg( struct scatterlist *sg; int i, j; u32 *pio; - static int idx; if (mxs_chan->status == DMA_IN_PROGRESS && !append) return NULL; @@ -606,6 +608,39 @@ err_out: return ret; } + +void dump_dma_reg(void) +{ + int i; + u32 stat1; + + struct mxs_dma_chan *mxs_chan = g_mxs_chan; + struct mxs_dma_engine *g_mxs_dma = mxs_chan->mxs_dma; + struct mxs_dma_ccw *ccw; + + printk("------------------------DMA DUMP END ------------\n"); + for (i = 0; i < 7; i++) { + stat1 = readl(g_mxs_dma->base + 0x10 * i); + printk("APBH REG :%x : %.8X\n", 0x10 * i, stat1); + } + for (i = 0; i < 7; i++) { + stat1 = readl(g_mxs_dma->base + 0x10 * i + 0x400); + printk("APBH REG :%x : %.8X\n", 0x10 * i + 0x400, stat1); + } + + for (i = 0; i < idx; i++) { + int j; + + ccw = &mxs_chan->ccw[i]; + printk("[ %d ] : ME : %.8x, next : %.8x, bits : %.8x, bytes : %.8x, buf : %.8x\n", + i, mxs_chan->ccw_phys + sizeof(*ccw) * i, + ccw->next, ccw->bits, ccw->xfer_bytes, ccw->bufaddr); + for (j = 0; j < 3; j++) + printk("[ %d ] PIO[%d] : %.8x\n", i, j, ccw->pio_words[j]); + } + printk("------------------------DMA DUMP END ------------\n"); +} + static int __init mxs_dma_probe(struct platform_device *pdev) { const struct platform_device_id *id_entry = diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index 1c2cbc5..3d6895b 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c @@ -378,6 +378,7 @@ int start_dma_without_bch_irq(struct gpmi_nand_data *this, { struct completion *dma_c = &this->dma_done; int err; + extern void dump_dma_reg(void); init_completion(dma_c); @@ -391,6 +392,7 @@ int start_dma_without_bch_irq(struct gpmi_nand_data *this, if (err) { pr_info("DMA timeout, last DMA :%d\n", this->last_dma_type); if (gpmi_debug & GPMI_DEBUG_CRAZY) { + dump_dma_reg(); gpmi_show_regs(this); panic("-----------DMA FAILED------------------"); } -- 1.7.0.4