From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754247AbbI1ATA (ORCPT ); Sun, 27 Sep 2015 20:19:00 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:35339 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753398AbbI1AS7 (ORCPT ); Sun, 27 Sep 2015 20:18:59 -0400 Date: Sun, 27 Sep 2015 17:18:56 -0700 From: Brian Norris To: Robert Jarzmik Cc: Ezequiel Garcia , David Woodhouse , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mtd: nand: pxa3xx-nand: switch to dmaengine Message-ID: <20150928001856.GB34421@google.com> References: <1441545167-23383-1-git-send-email-robert.jarzmik@free.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1441545167-23383-1-git-send-email-robert.jarzmik@free.fr> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sparse has one complaint, but I have no others: On Sun, Sep 06, 2015 at 03:12:47PM +0200, Robert Jarzmik wrote: > diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c > index 2f39bfe34584..1e9d462065e8 100644 > --- a/drivers/mtd/nand/pxa3xx_nand.c > +++ b/drivers/mtd/nand/pxa3xx_nand.c > @@ -15,7 +15,9 @@ ... > @@ -564,57 +567,61 @@ static void handle_data_pio(struct pxa3xx_nand_info *info) [...] > +static void start_data_dma(struct pxa3xx_nand_info *info) > +{ > + enum dma_data_direction direction; I think this should be dma_transfer_direction. See warning below. > + struct dma_async_tx_descriptor *tx; > > switch (info->state) { > case STATE_DMA_WRITING: > - desc->dsadr = info->data_buff_phys; > - desc->dtadr = info->mmio_phys + NDDB; > - desc->dcmd |= DCMD_INCSRCADDR | DCMD_FLOWTRG; > + info->dma_dir = DMA_TO_DEVICE; > + direction = DMA_MEM_TO_DEV; > break; > case STATE_DMA_READING: > - desc->dtadr = info->data_buff_phys; > - desc->dsadr = info->mmio_phys + NDDB; > - desc->dcmd |= DCMD_INCTRGADDR | DCMD_FLOWSRC; > + info->dma_dir = DMA_FROM_DEVICE; > + direction = DMA_DEV_TO_MEM; > break; > default: > dev_err(&info->pdev->dev, "%s: invalid state %d\n", __func__, > info->state); > BUG(); > } > - > - DRCMR(info->drcmr_dat) = DRCMR_MAPVLD | info->data_dma_ch; > - DDADR(info->data_dma_ch) = info->data_desc_addr; > - DCSR(info->data_dma_ch) |= DCSR_RUN; > -} > - > -static void pxa3xx_nand_data_dma_irq(int channel, void *data) > -{ > - struct pxa3xx_nand_info *info = data; > - uint32_t dcsr; > - > - dcsr = DCSR(channel); > - DCSR(channel) = dcsr; > - > - if (dcsr & DCSR_BUSERR) { > - info->retcode = ERR_DMABUSERR; > + info->sg.length = info->data_size + > + (info->oob_size ? info->spare_size + info->ecc_size : 0); > + dma_map_sg(info->dma_chan->device->dev, &info->sg, 1, info->dma_dir); > + > + tx = dmaengine_prep_slave_sg(info->dma_chan, &info->sg, 1, direction, > + DMA_PREP_INTERRUPT); drivers/mtd/nand/pxa3xx_nand.c:631:68: warning: mixing different enum types [sparse] drivers/mtd/nand/pxa3xx_nand.c:631:68: int enum dma_data_direction versus [sparse] drivers/mtd/nand/pxa3xx_nand.c:631:68: int enum dma_transfer_direction [sparse] > + if (!tx) { > + dev_err(&info->pdev->dev, "prep_slave_sg() failed\n"); > + return; > } > - > - info->state = STATE_DMA_DONE; > - enable_int(info, NDCR_INT_MASK); > - nand_writel(info, NDSR, NDSR_WRDREQ | NDSR_RDDREQ); > + tx->callback = pxa3xx_nand_data_dma_irq; > + tx->callback_param = info; > + info->dma_cookie = dmaengine_submit(tx); > + dma_async_issue_pending(info->dma_chan); > + dev_dbg(&info->pdev->dev, "%s(dir=%d cookie=%x size=%u)\n", > + __func__, direction, info->dma_cookie, info->sg.length); > } > -#else > -static void start_data_dma(struct pxa3xx_nand_info *info) > -{} > -#endif [...] Brian