From patchwork Sun Jan 15 19:53:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 642954 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp251039pvb; Sun, 15 Jan 2023 11:55:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXvgUhX+K2x5wIXXNKzwEF3PMsNIjwh1r2Z39Vpyo4iuHL5M7kptGArr+Io2DPP+2NREbC1t X-Received: by 2002:a05:6808:2906:b0:35e:7b67:2eca with SMTP id ev6-20020a056808290600b0035e7b672ecamr35195427oib.2.1673812500747; Sun, 15 Jan 2023 11:55:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673812500; cv=none; d=google.com; s=arc-20160816; b=lsOKcZFYDD1fnZS7WGtJ/72fOSNY6JuIX8TwbLY63VsZufwVoJfh9gBL0IqRGlEDEO 2UH5lHnQfhXPnYxmJZhbCbPhv5KUH1R+1/Fc/94PWeK7E03JNXgzikO5EfaiVwm/Z1po 14dllTxxita6HwisZtNz8Apvdsbfz+lH6pzpP28dtCiPeOcFCuE+7LebYFPlPv7OlvBF Rxl1BzLIYblKqDYzZispEEE9ThcX4EW6TTGBojVxmRRF/7G0vfJkZmmRLt2C25kkbCIV DT2OQluCHQiBjJOmih+QXNmwcCplmGmEQhPiVf0RlqKnSu4nDxewUtH1DPCxEGMLOXPd 7cRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=R/ejN6HxLTHHDXLF7+I38WOnnbW5uVWnufthnnCTFuY=; b=QYLAqtcr0qgZJ/SCWUNxqwydt5PdNxuTdJlxCTD9yCHo3sCZE990sKLnSEO/IaKUxP SyRs6LNOUDZgY3qx7nhfVezZU8qswEehmBU551aAkRer34wT2EVQhV5wTcBM0yY6ipiL xc+pPdSrHHi6JEW7I942h0OZinYasfqoh+ZpQsnFNALtSB5SrHfRRqnlw5bw0DxM2Ozn L+AF38Mu6EInqkfGUy6uzwiaeqxHOwV2xlmBNYj7JoFu2GM7YO/qoRrtBiXDW7spuUJV sb1/foqKWRcmqvymbQsCfpia7HZBGY2C5tFqkU1mw2EAahdR6k8qCCH2PhWTpTwn/tXT lLKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gJXRrElF; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id fc10-20020a0568082a8a00b0035edcb946a8si24022613oib.206.2023.01.15.11.55.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Jan 2023 11:55:00 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gJXRrElF; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1DDAC855A1; Sun, 15 Jan 2023 20:53:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="gJXRrElF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8DE7185582; Sun, 15 Jan 2023 20:53:47 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 34E4185592 for ; Sun, 15 Jan 2023 20:53:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=linus.walleij@linaro.org Received: by mail-lf1-x12e.google.com with SMTP id f34so40081227lfv.10 for ; Sun, 15 Jan 2023 11:53:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=R/ejN6HxLTHHDXLF7+I38WOnnbW5uVWnufthnnCTFuY=; b=gJXRrElF7CiEw/HJ7DCcdwlFm3XWRSxYa8sKfkIb9+V0MoViSAFA+306myH0vk/15c zBGBVGKhahU/++SGNTqpnYFQbxxbmc+sqkpiosHZBAAwJG5UIvJT/aF5Ux4S5mqtg6S0 ZggM3N/QjJlD7QKLe/5YqC2iOdAaCLpRqjcaMDw6bOtMm8h2EvMAXzH70Ft9bvV3ehju XDXqLyLJx4XAxJhOhs5prBTT6htMu3QHGSJ1vM7umoBXiJQM5nXNT10WyNxcmExZ1Cp0 VOLsjA90BqVL0OBTjN4z83mCG9YWp6bTgm569VlU8H7wlrPdJRIe4vbRMcV3SISqNq8N kBwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R/ejN6HxLTHHDXLF7+I38WOnnbW5uVWnufthnnCTFuY=; b=DvpdY35vu+vUnUvr/y9+unKwgRG/xx5fKYr4Y6AO4p9hGp7kapoKPbmRj+uQbIXy9N ktHgwENkBrhyW3E5Ux3xjZ7nczgdRPLjyaiRGYTcubWCeivEjchAgGhAcBM/cw2ntxdO 7Y2OL/4QFaNEyoF9Ldd7ILebQB4le+cyxoWSLLQfcKAuSReNjXjgfrxxEWf9DU135SXs hEoChCQ8RcdpReUJfv+CG+gW1cgNltNr0cY9bOrPlJR2YhTB2ZT/tW5yMlQNKa7uWXuQ nQ8+KuQ6wpTIcujn2cK4DnilwdJeyKRJTlWlKsMhZcZdXJNxQSSNi0+wyT14tmBM12h9 wMuw== X-Gm-Message-State: AFqh2koe3q+H5dupAEKfq3FWT4+Pchg19bsy8QZhOsrT/Z6zvYiSw+nW AnXbPtX0NIvsS83w3pHL4xTkqKA0yB1ut3VN X-Received: by 2002:a05:6512:224f:b0:4cc:586b:1834 with SMTP id i15-20020a056512224f00b004cc586b1834mr12702690lfu.45.1673812420160; Sun, 15 Jan 2023 11:53:40 -0800 (PST) Received: from localhost.localdomain (c-05d8225c.014-348-6c756e10.bbcust.telenor.se. [92.34.216.5]) by smtp.gmail.com with ESMTPSA id r12-20020ac252ac000000b004aab0ca795csm4780439lfm.211.2023.01.15.11.53.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Jan 2023 11:53:39 -0800 (PST) From: Linus Walleij To: u-boot@lists.denx.de, Tom Rini Cc: Anand Gore , William Zhang , Kursad Oney , Joel Peshkin , Philippe Reynes , =?utf-8?q?=C3=81lvaro_Fer?= =?utf-8?q?n=C3=A1ndez_Rojas?= , stable@vger.kernel.org, Miquel Raynal , Linus Walleij Subject: [PATCH 07/14] mtd: rawnand: brcmnand: fix hamming oob layout Date: Sun, 15 Jan 2023 20:53:05 +0100 Message-Id: <20230115195312.1477845-8-linus.walleij@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230115195312.1477845-1-linus.walleij@linaro.org> References: <20230115195312.1477845-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean From: Álvaro Fernández Rojas 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 Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20200512075733.745374-2-noltari@gmail.com [Ported to U-Boot from the Linux kernel] Signed-off-by: Linus Walleij --- 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 fdc1fc6c1043..7cb6f2651250 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -1059,11 +1059,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--; + } } }