From patchwork Tue May 12 06:00:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= X-Patchwork-Id: 209855 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2008C54E8B for ; Tue, 12 May 2020 06:00:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8CB4920746 for ; Tue, 12 May 2020 06:00:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="D9eV/Zf5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728858AbgELGAe (ORCPT ); Tue, 12 May 2020 02:00:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725933AbgELGAc (ORCPT ); Tue, 12 May 2020 02:00:32 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2DB8C061A0C; Mon, 11 May 2020 23:00:31 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id z72so12233637wmc.2; Mon, 11 May 2020 23:00:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xqMgmNOYwrxdY+o1DnJ61eJdUyKQzmC6mhNhV0fXE88=; b=D9eV/Zf54+ehFvlVaYySHF1yxDS1BGjbh6+228BirDrpdom0MfF2DPTvrOx2PKqeqn msk0n3K9GPL+VHGSRvIHtUus4pCZqaqd3gAF8hfWLRyTj7xsOa9HsGZHUj4gpWc9Hkrw zHyu8JUu/7+BNPXx37aWLX4tFqwJHBk5qqyTa6IGtdBzKqnMJPAUGFDrHD/UXue2WOVn DdCazsjpbK7BT0mG9l+GrVhJfMbdFhEPdf64dxv0ES+GbH5Ft1cOo04SGO0mspp70c0w 7OpSWbgz92HLJOSQ8ByE+aZrZ4qCkvazVxoLZ1K3Ciy2wq4fjmCpm8qCXF/QuIgwrvRc rc3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xqMgmNOYwrxdY+o1DnJ61eJdUyKQzmC6mhNhV0fXE88=; b=oNg9qNyZoarkWeBpQhaqMhwHpw9ghoHchM8yYfpnFzwhxdnJJRmiSeN8kK5TxCnQgs lgCSUABjE1Cgj9+HRiLwaQn7WyuUrAsfkUdCcQknMH/yl/Pve9SvyjuPqST2wmUAfiBs XfEwQOaP5iL1cIPDr2rRRG02tSE8izk2W7qwaB7rrMtX94nonC/vCgxqJvh7KiECKyJ5 FhUcXu2RGPkiTNTMvrz0g+6PV8PzSO8GME1q5GgoAhLO7uLyEHpcGOkoiB/1CZaWufQM JQy5UWezasoy52drMOba5msRcX2tuPjFvAJtKobfxBwpcUyJWOYksGsZnBSsADkF+Ln3 YDqQ== X-Gm-Message-State: AGi0PuYzJER3ToFWHQsYjM+OHMEcu67g7VhnkrKIGeV7QQEgmIeoYA0x 6nM7bewlFDZVovEjGxTIEQ8= X-Google-Smtp-Source: APiQypJChnU7y6gqwA6+tQ/g42zXUMKmCWgR04qMmUVzGvHla1KX0Ibexk1/9cnyXDApm2t7GubW/A== X-Received: by 2002:a7b:c1c4:: with SMTP id a4mr36219836wmj.86.1589263230616; Mon, 11 May 2020 23:00:30 -0700 (PDT) Received: from skynet.lan (198.red-83-49-57.dynamicip.rima-tde.net. [83.49.57.198]) by smtp.gmail.com with ESMTPSA id a13sm20539150wrv.67.2020.05.11.23.00.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2020 23:00:30 -0700 (PDT) From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= To: computersforpeace@gmail.com, kdasu.kdev@gmail.com, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, sumit.semwal@linaro.org, linux-mtd@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= , stable@vger.kernel.org Subject: [PATCH v3 1/2] mtd: rawnand: brcmnand: fix hamming oob layout Date: Tue, 12 May 2020 08:00:22 +0200 Message-Id: <20200512060023.684871-2-noltari@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200512060023.684871-1-noltari@gmail.com> References: <20200504185945.2776148-1-noltari@gmail.com> <20200512060023.684871-1-noltari@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org First 2 bytes are used in large-page nand. Fixes: ef5eeea6e911 ("mtd: nand: brcm: switch to mtd_ooblayout_ops") Cc: stable@vger.kernel.org Signed-off-by: Álvaro Fernández Rojas --- v3: invert patch order v2: extend original comment drivers/mtd/nand/raw/brcmnand/brcmnand.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index e4e3ceeac38f..1c1070111ebc 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -1116,11 +1116,14 @@ static int brcmnand_hamming_ooblayout_free(struct mtd_info *mtd, int section, if (!section) { /* * Small-page NAND use byte 6 for BBI while large-page - * NAND use byte 0. + * NAND use bytes 0 and 1. */ - if (cfg->page_size > 512) - oobregion->offset++; - oobregion->length--; + if (cfg->page_size > 512) { + oobregion->offset += 2; + oobregion->length -= 2; + } else { + oobregion->length--; + } } } From patchwork Mon May 4 18:59:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= X-Patchwork-Id: 209951 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F111AC4724C for ; Mon, 4 May 2020 19:00:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C05602073E for ; Mon, 4 May 2020 19:00:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TRQM1Y5Y" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726750AbgEDS76 (ORCPT ); Mon, 4 May 2020 14:59:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725956AbgEDS75 (ORCPT ); Mon, 4 May 2020 14:59:57 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93FA1C061A0F; Mon, 4 May 2020 11:59:52 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id i10so352237wrv.10; Mon, 04 May 2020 11:59:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dTu28xUDgKPSOfBD93/Q64n/TLopzl8Xcrc16onzdb4=; b=TRQM1Y5Y/kjYZMLRbOikbwDibHa3llJJVJ/bc7jGQWQvtEvHnYk+1txiccS6Rgx+6T 1cpp1S+GVHWE22ZiEMtiCRXQWeW/mtePV1UrimBZe/Rsw6y0mt6J0YlRUdfmkWvPMU72 D9rdhVW3L/6GTSOCfkvt6gRQDp8I/s7nzXE5vpUzPNKKbuVL913l/pHILh2AmLNoa7X4 2fSfTjShbGngeSDvAdACnvzOFfyriEE8CQYvSTJpqBC852ad1HA5FjpKz+1lqLRnPcsY jNREp73WKhNlU9NPAI3hqdLEuyfcJzOM5PLSxBtKjKSzv7jgQ+9uSFF94uhiC2g/SHpv Hn8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dTu28xUDgKPSOfBD93/Q64n/TLopzl8Xcrc16onzdb4=; b=Dp6IthFDLF3CBy3x/wT85UnqK74UXAOxlhVhynzh6wuWJ4x69w8ndn6PDcbYvMWA5P nWQ6ARVm6JVrF8FF7ChJodn1C5MB4yp9eQav/1QXeR5JoEQ9nmSHrndTjfOsvr29ey4g xLYqFhWbG5rx5YxjJhjIrqVEaMplEiG9GF7puEE+ARKjP6rJJKRibSZ+8Fjq8rt/g+ww kmnPmwHCofcEaZzKqKXhlq5oV8qZzh7aTT3SNdSAuXbRQ7abzDEiDh4Z4nMtPPGVoRc2 GKxQG8g33QkwAa4b4hixtfJV0uU+WSmuez0P/0Nu1CbDtwUQ+JskegBHdCc2gOFHnT+4 PSag== X-Gm-Message-State: AGi0PuY8I6V52gWGHQ2H5+zFDI7bciaSn+EIKqq70aLZ/K4FwuCRIE9G iLyZ9V0v7JoTbW0lf8kNiUA= X-Google-Smtp-Source: APiQypKIse9qXrWL+g42FDTv87t6NfFQ+bDzxi1DIXWKshuoMbdJwHPaPEgXUDiQ6wAWMVLgt0psUQ== X-Received: by 2002:adf:9447:: with SMTP id 65mr534819wrq.331.1588618791289; Mon, 04 May 2020 11:59:51 -0700 (PDT) Received: from skynet.lan (246.red-83-44-9.dynamicip.rima-tde.net. [83.44.9.246]) by smtp.gmail.com with ESMTPSA id i25sm452952wml.43.2020.05.04.11.59.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 11:59:50 -0700 (PDT) From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= To: computersforpeace@gmail.com, kdasu.kdev@gmail.com, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, sumit.semwal@linaro.org, linux-mtd@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= Subject: [PATCH v2 2/2] nand: brcmnand: fix hamming oob layout Date: Mon, 4 May 2020 20:59:45 +0200 Message-Id: <20200504185945.2776148-2-noltari@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200504185945.2776148-1-noltari@gmail.com> References: <20200504093034.2739968-1-noltari@gmail.com> <20200504185945.2776148-1-noltari@gmail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org First 2 bytes are used in large-page nand. Signed-off-by: Álvaro Fernández Rojas --- v2: extend original comment drivers/mtd/nand/raw/brcmnand/brcmnand.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 767343e0e6e7..0a1d76fde37b 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -1114,10 +1114,10 @@ static int brcmnand_hamming_ooblayout_free(struct mtd_info *mtd, int section, } else { /* * Small-page NAND use byte 6 for BBI while large-page - * NAND use byte 0. + * NAND use bytes 0 and 1. */ if (cfg->page_size > 512) { - oobregion->offset = 1; + oobregion->offset = 2; } else { oobregion->offset = 0; next--;