From patchwork Sat Nov 26 18:06:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 84311 Delivered-To: patch@linaro.org Received: by 10.182.1.168 with SMTP id 8csp788715obn; Sat, 26 Nov 2016 10:16:04 -0800 (PST) X-Received: by 10.84.132.34 with SMTP id 31mr31516334ple.14.1480184164759; Sat, 26 Nov 2016 10:16:04 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3si20835436plb.131.2016.11.26.10.16.04; Sat, 26 Nov 2016 10:16:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754047AbcKZSPu (ORCPT + 25 others); Sat, 26 Nov 2016 13:15:50 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:47895 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753117AbcKZSIK (ORCPT ); Sat, 26 Nov 2016 13:08:10 -0500 Received: from grover.sesame (FL1-111-169-71-157.osk.mesh.ad.jp [111.169.71.157]) (authenticated) by conuserg-11.nifty.com with ESMTP id uAQI6Ueo018512; Sun, 27 Nov 2016 03:06:47 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com uAQI6Ueo018512 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1480183608; bh=TqTLPr/CsAy2VM8j1V1b6MSXbMgJrJgh7aF0BPyYTMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wjJy/6KXBjH/Lfq4amsSKNUOhXbWR9r8HYxWply+nXpkBj9eCerI3cl9mBsMTVlwY nmn8Vge/beliYXoxAtDwavWbDUBXGCI95dcPKpb4DW2Lh7S8if6x5968m1F9mC6Gsl X8YSh7unh1ont0a6ni8BTocZxJWUtaWTpxpfauVqw8/mTnuv8BYfojrus3BVH9kzQS qdT+mh7clCgMuhI+kn00isfHLXLANpxxcNsnKRvmdzMQ3ox9iyoB+DeH/LyWGnTdf9 hL5G47xLLrjMXEVIsaD2QLDWJstRBSi5OPUGNsjH2cVxWRAyjScQg2FGHVco/xXXmI pesES3N9CxJLQ== X-Nifty-SrcIP: [111.169.71.157] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org, Boris Brezillon , Marek Vasut , Brian Norris , Richard Weinberger , David Woodhouse , Cyrille Pitchen Subject: [PATCH 18/39] mtd: nand: denali: move denali_read_page_raw() above denali_read_page() Date: Sun, 27 Nov 2016 03:06:04 +0900 Message-Id: <1480183585-592-19-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1480183585-592-1-git-send-email-yamada.masahiro@socionext.com> References: <1480183585-592-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This will be needed in the next commit to call denali_read_page_raw() from denali_read_page(). Signed-off-by: Masahiro Yamada --- drivers/mtd/nand/denali.c | 76 +++++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 38 deletions(-) -- 2.7.4 diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index c101e7f..f035dac 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -1118,6 +1118,44 @@ static int denali_read_oob(struct mtd_info *mtd, struct nand_chip *chip, return 0; } +static int denali_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip, + u8 *buf, int oob_required, int page) +{ + struct denali_nand_info *denali = mtd_to_denali(mtd); + dma_addr_t addr = denali->buf.dma_buf; + size_t size = mtd->writesize + mtd->oobsize; + u32 irq_mask = INTR_STATUS__DMA_CMD_COMP; + + if (page != denali->page) { + dev_err(denali->dev, + "IN %s: page %d is not equal to denali->page %d", + __func__, page, denali->page); + BUG(); + } + + setup_ecc_for_xfer(denali, false, oob_required ? true : false); + denali_enable_dma(denali, true); + + dma_sync_single_for_device(denali->dev, addr, size, DMA_FROM_DEVICE); + + clear_interrupts(denali); + denali_setup_dma(denali, DENALI_READ); + + /* wait for operation to complete */ + wait_for_irq(denali, irq_mask); + + dma_sync_single_for_cpu(denali->dev, addr, size, DMA_FROM_DEVICE); + + denali_enable_dma(denali, false); + + memcpy(buf, denali->buf.buf, mtd->writesize); + if (oob_required) + memcpy(chip->oob_poi, denali->buf.buf + mtd->writesize, + mtd->oobsize); + + return 0; +} + static int denali_read_page(struct mtd_info *mtd, struct nand_chip *chip, u8 *buf, int oob_required, int page) { @@ -1182,44 +1220,6 @@ static int denali_read_page(struct mtd_info *mtd, struct nand_chip *chip, return max_bitflips; } -static int denali_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip, - u8 *buf, int oob_required, int page) -{ - struct denali_nand_info *denali = mtd_to_denali(mtd); - dma_addr_t addr = denali->buf.dma_buf; - size_t size = mtd->writesize + mtd->oobsize; - u32 irq_mask = INTR_STATUS__DMA_CMD_COMP; - - if (page != denali->page) { - dev_err(denali->dev, - "IN %s: page %d is not equal to denali->page %d", - __func__, page, denali->page); - BUG(); - } - - setup_ecc_for_xfer(denali, false, oob_required ? true : false); - denali_enable_dma(denali, true); - - dma_sync_single_for_device(denali->dev, addr, size, DMA_FROM_DEVICE); - - clear_interrupts(denali); - denali_setup_dma(denali, DENALI_READ); - - /* wait for operation to complete */ - wait_for_irq(denali, irq_mask); - - dma_sync_single_for_cpu(denali->dev, addr, size, DMA_FROM_DEVICE); - - denali_enable_dma(denali, false); - - memcpy(buf, denali->buf.buf, mtd->writesize); - if (oob_required) - memcpy(chip->oob_poi, denali->buf.buf + mtd->writesize, - mtd->oobsize); - - return 0; -} - static u8 denali_read_byte(struct mtd_info *mtd) { struct denali_nand_info *denali = mtd_to_denali(mtd);