From patchwork Fri Apr 3 18:40:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 458018 X-Patchwork-Delegate: scottwood@freescale.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id BF35714012C for ; Sat, 4 Apr 2015 05:41:24 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=agner.ch header.i=@agner.ch header.b=ow4w/Ix2; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C9BA84B635; Fri, 3 Apr 2015 20:41:10 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hD0Z_9YCbeRF; Fri, 3 Apr 2015 20:41:10 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CC38D3927; Fri, 3 Apr 2015 20:41:01 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 570F14A036 for ; Fri, 3 Apr 2015 20:40:53 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wQD-EfR7Y6rK for ; Fri, 3 Apr 2015 20:40:53 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail.kmu-office.ch (mail.kmu-office.ch [178.209.48.109]) by theia.denx.de (Postfix) with ESMTP id 26A254A039 for ; Fri, 3 Apr 2015 20:40:49 +0200 (CEST) Received: from trochilidae.agner.local (195-226-23-137.pool.cyberlink.ch [195.226.23.137]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 8A1E15C093E; Fri, 3 Apr 2015 20:40:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=agner.ch; s=dkim; t=1428086402; bh=e9wbteuXmWQXBLvlqdMlVCv+vRYVEwEDIMinchvPYVQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ow4w/Ix2LdEe2t1Rwv7LiAj9x5ITUCpNMBW73QSZGvUir2aZV6I1L+nD+JhA5a+9h cB7uQLvr6wlNFBNXJkMTq4D+s+uEK4v85ZlrT2oKU+YsaoHRR1Q8sgZgWfMMmt2LnT ALTr65HLbL557jc3u1KXG97/7zrlFOuqM58NKQtQ= From: Stefan Agner To: scottwood@freescale.com, trini@konsulko.com Date: Fri, 3 Apr 2015 20:40:45 +0200 Message-Id: <1428086445-10554-4-git-send-email-stefan@agner.ch> X-Mailer: git-send-email 2.3.5 In-Reply-To: <1428086445-10554-1-git-send-email-stefan@agner.ch> References: <1428086445-10554-1-git-send-email-stefan@agner.ch> Cc: u-boot@lists.denx.de, bpringlemeir@nbsps.com Subject: [U-Boot] [PATCH 4/4] mtd: vf610_nfc: support subpage write X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Support subpage writes using a custom implementation of write_subpage. The driver loads the page into SRAM buffer using NAND_CMD_READ0, when the framework requests the NAND_CMD_SEQIN command. Then, the buffer is updated by the custom write_subpage implementation. Upon write, the controller calculates the hardware ECC across the whole page before programming the page. This method saves transferring the whole page over the bus to the NFC IP, which would happen when using NAND_NO_SUBPAGE_WRITE. Signed-off-by: Stefan Agner --- This implements the procedure as discussed on the ML: http://lists.denx.de/pipermail/u-boot/2015-March/209567.html http://lists.denx.de/pipermail/u-boot/2015-March/209671.html The drivers mxc_nand and mpc5121_nfc implement a similar subpage write. drivers/mtd/nand/vf610_nfc.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/vf610_nfc.c b/drivers/mtd/nand/vf610_nfc.c index a8af00e..d552bed 100644 --- a/drivers/mtd/nand/vf610_nfc.c +++ b/drivers/mtd/nand/vf610_nfc.c @@ -566,6 +566,19 @@ static int vf610_nfc_write_page(struct mtd_info *mtd, struct nand_chip *chip, return 0; } +static int vf610_nfc_write_subpage(struct mtd_info *mtd, struct nand_chip *chip, + uint32_t offset, uint32_t data_len, + const uint8_t *buf, int oob_required) +{ + struct vf610_nfc *nfc = mtd_to_nfc(mtd); + nfc->column = offset; + vf610_nfc_write_buf(mtd, buf, data_len); + if (oob_required) + vf610_nfc_write_buf(mtd, chip->oob_poi, mtd->oobsize); + + return 0; +} + struct vf610_nfc_config { int hardware_ecc; int width; @@ -608,9 +621,6 @@ static int vf610_nfc_nand_init(int devnum, void __iomem *addr) vf610_nfc_clear(mtd, NFC_FLASH_CONFIG, CONFIG_16BIT); } - /* Disable subpage writes as we do not provide ecc->hwctl */ - chip->options |= NAND_NO_SUBPAGE_WRITE; - chip->dev_ready = vf610_nfc_dev_ready; chip->cmdfunc = vf610_nfc_command; chip->read_byte = vf610_nfc_read_byte; @@ -669,6 +679,7 @@ static int vf610_nfc_nand_init(int devnum, void __iomem *addr) mtd->ecclayout = chip->ecc.layout; chip->ecc.read_page = vf610_nfc_read_page; chip->ecc.write_page = vf610_nfc_write_page; + chip->ecc.write_subpage = vf610_nfc_write_subpage; chip->ecc.mode = NAND_ECC_HW; chip->ecc.size = PAGE_2K;