From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: ACJfBouvxs33xNQ1WtPw3sZZNbpl788p1FA/Xpft3LYj3XHrfdF68xzfP6416Ks+yM50/Ye1M3o2 ARC-Seal: i=1; a=rsa-sha256; t=1515416477; cv=none; d=google.com; s=arc-20160816; b=czyZ46yJYs+Z+FVhCfanqYTkLDavPAD2bWpJ9V7thgmBAwn88fYbGS+se8M1Gxg+2V oESBydaAwAhj16kGuRbIssbWuHKPpISKSCfP3/mDQkX054mDfqhkjvuzjbDeWuchD1Gx SCNlzS38dMaM+Mug4lAH2vpMycKHrSIvTe9lpqxr0v2R33DAKC6LRVezFkDLT3Ie+VLX +Nj5OMsudNcXNthfBwb0sizko/IyUpdWkdFL/YWsjAhUQqht687epOded7RZwpHSaXeC G/h3JL9eWmALN3VJ5zc12yC7dSZlE0SI1KMoLf3H51WbImVaPzOr2iuvYcUK9FfqZpUN 8LWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=wgsvvuLGOdo7Jd0DlxXmqjsiwo1CR78Unya/IVKpzHk=; b=Vvt5bDEXIl/ICQFKbRTrN2wCygosGBZxgvIBuKyliOglyf8CrGnSfIfjD/tF6v62/Q WWO6+6OrUE0ILA7RK1EwCh3mVgiCdR4K86LIlqlstbGOMkclt/tt40/8cSHXwCRgrL3R See70Me0ak3FyKo6gxGscDgst5AFBwIP7LklzUKTHv5r75yBSZ6xXCskMLH1qWypBXRa UrN7ZElqpZ3zCfIMWchhrUs4ChWosBHBOE4cJawQHGv2YMEOYizTFLCsB1NZ/b84XCfO DVDpmW1jzGZ/Jpevh8hiAYni5pJDN4zoNMft1w1U8khfRBGXl9rZ/HpXcVphpB4XBaJm xrcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Sean=20Nyekj=C3=A6r?= , Willy Tarreau , Boris Brezillon , Ezequiel Garcia , Robert Jarzmik , Richard Weinberger Subject: [PATCH 4.14 36/38] mtd: nand: pxa3xx: Fix READOOB implementation Date: Mon, 8 Jan 2018 13:59:29 +0100 Message-Id: <20180108125918.623762526@linuxfoundation.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180108125915.951963528@linuxfoundation.org> References: <20180108125915.951963528@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1589029348755296846?= X-GMAIL-MSGID: =?utf-8?q?1589029348755296846?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Boris Brezillon commit fee4380f368e84ed216b62ccd2fbc4126f2bf40b upstream. In the current driver, OOB bytes are accessed in raw mode, and when a page access is done with NDCR_SPARE_EN set and NDCR_ECC_EN cleared, the driver must read the whole spare area (64 bytes in case of a 2k page, 16 bytes for a 512 page). The driver was only reading the free OOB bytes, which was leaving some unread data in the FIFO and was somehow leading to a timeout. We could patch the driver to read ->spare_size + ->ecc_size instead of just ->spare_size when READOOB is requested, but we'd better make in-band and OOB accesses consistent. Since the driver is always accessing in-band data in non-raw mode (with the ECC engine enabled), we should also access OOB data in this mode. That's particularly useful when using the BCH engine because in this mode the free OOB bytes are also ECC protected. Fixes: 43bcfd2bb24a ("mtd: nand: pxa3xx: Add driver-specific ECC BCH support") Reported-by: Sean Nyekjær Tested-by: Willy Tarreau Signed-off-by: Boris Brezillon Acked-by: Ezequiel Garcia Tested-by: Sean Nyekjaer Acked-by: Robert Jarzmik Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/nand/pxa3xx_nand.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c @@ -950,6 +950,7 @@ static void prepare_start_command(struct switch (command) { case NAND_CMD_READ0: + case NAND_CMD_READOOB: case NAND_CMD_PAGEPROG: info->use_ecc = 1; break;