From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: ACJfBov+Sdrq293RhRrNCS+O05QLjlPuZcEHgs8OEkGBNgmlXKDgObYSJ5ldgchZtlz9EXfW16FH ARC-Seal: i=1; a=rsa-sha256; t=1515416524; cv=none; d=google.com; s=arc-20160816; b=Zre9CEhVsjJAwxmB3zUTPlodem8HxZpf6X3KEx/Gt3Ff0gUkJx0vHlL8X7+Yu/6a9d OzfeuAVJwTtaOXhrt6AwiyugUbqrlTRYzydC9jSLwRS5UJGwl1Tk+/1tygNSTkcrw+lt 16nDcWjI3DxvZP0nMt9OpcowGBmoJKHjYA7V8Fo7gDF9iXZR2lUrUXx7ZrEIS9PGTHqA JqiYJOcv1FxER7kW9QUYcj23NAUZkWLuhM5QWAK/SjZs6mpuK6GXo/V71qO7GgS5f91v PspzXz+0Ywc5r5vD/lHe3O0hkU4RJ41wzMo2hzAGywlFD2ZMComCCwOPlEoqjVUu2aw2 hZhg== 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=GK1a8VIBZ3ASc0VxBq0ZKdjondhGX0xWQ7nh/dBLo2o=; b=sL7ASm0OejR72tVSFQr5K8BcwPyiuu1YIFTa4cHvHUrL5pwLlQFHyjeMnZ+Qs6J0Xi vXXmxWwnfulzTM4E+lt0pwKRBaXgrEe2fj1NTvks/Yc5nqAVEOdGEGQ3HaYH2k34QzBm nApdj14txgsHdo0l38bYL+P7rgT1oYqs/6iJTr7U7lH0Bmu9bauL5rr225HbUSSZPuio WCYsiY7gf005PD9Zr14forVS0HI6gJLS/pQdqcSrFS7SsRJ4n3fknBeBbEd6sS02cIHZ wdSufC6mSliQTRYfqrY8QkSLNYDLY0QHj3a0dzjB8HMpNlz0E/n8BIZNFADwMj3Swgoq f8iw== 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.9 19/21] mtd: nand: pxa3xx: Fix READOOB implementation Date: Mon, 8 Jan 2018 13:59:39 +0100 Message-Id: <20180108125921.192842788@linuxfoundation.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180108125920.106264989@linuxfoundation.org> References: <20180108125920.106264989@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?1589029397571641306?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.9-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;