From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: ACJfBot43305L7Aln7jVg/8qL1lnVGoioadSdOlN3tF/6l9Wd6Sv2rImfVD+Oz5F3Mo+VlatZzE4 ARC-Seal: i=1; a=rsa-sha256; t=1515416578; cv=none; d=google.com; s=arc-20160816; b=lKIIrS0A2U7tpXt0ZBMkyLy93NNUSCgMFJGFVEv7wjYU4yeJUhzo9e7CoeYBj/Lcjc LhWqhT2qncqNBdMMkuWSFQP3EII8ze2Onluc1toX4zvorTx2QDT721UkvmsDMIrQXHT2 mk5+CgWNtZ+PwEHPYasVmJl3DXIhMA8ifmQoMK7EXIcJEqzYmn+YdgTu9CZvZBR/ebl+ f1gCXyQ+izEJfAslT5p1/NtnLvvCaN/izTngu+XEkgQaoW7l61ZUSfSSzEh0Pg6KgF7M Y6BXoLEb+b441QRJSU/dJOQKP7UuYL3dSbsRRjarFA2M494pnyLE/1hLN2HfidgTI6wJ tfcQ== 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=adcilAryzJ3zsYjQM4VPFSe45+/tSLTFOoaNOXCE73E=; b=On61vSJPQdAo9UfamMHZm3T1riw2doTm/tI4jJZf+5vEVljew7gauhf2oU0rdmR8a5 eQEb8FS85ucatb7vmnq/HBz/PuTMJA1Q7jWAxCTwyfX6W6Vx8KamHf8XS8UsGwoXorA5 lNz0kWNWfZ/pR7QloTXkPAsBPtX495qIWTyuZT2tsvX4N+fL2prkNZYnDJhQsSdgGG0i FIVTr9a8GgStLlnYXjDuk1XGWZVDnNIPktPEbwn5XTWVcxerQLwnDz7z57kWQMmzMj4G sRr7eC2gxINcwjB0C4SIss2mZDCDaQv1L/g5+V2Pn/ic/ZINrALv5ykoGvBtknpGWuAI nwPA== 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.4 16/22] mtd: nand: pxa3xx: Fix READOOB implementation Date: Mon, 8 Jan 2018 13:59:43 +0100 Message-Id: <20180108125926.294823719@linuxfoundation.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180108125925.601688333@linuxfoundation.org> References: <20180108125925.601688333@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?1589029453934314645?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.4-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 @@ -912,6 +912,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; case NAND_CMD_READOOB: