From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A52D7C6FD19 for ; Mon, 13 Mar 2023 00:29:15 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5A86286102; Mon, 13 Mar 2023 01:29:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="kD9mUzfm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A6815860FB; Mon, 13 Mar 2023 01:29:11 +0100 (CET) Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) (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 54AE0860FB for ; Mon, 13 Mar 2023 01:29:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jbx6244@gmail.com Received: by mail-ed1-x535.google.com with SMTP id o12so42244134edb.9 for ; Sun, 12 Mar 2023 17:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678667347; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=GPuOXwYyEb8oODKadlX9EJ5aOjKbiel0Z2EUmi0HXFk=; b=kD9mUzfmB7Gt1wr71CCkFxaLfG2WPsOUTSJd+eixDCFzmM3j53g0dDCsRTRQ9hXvpk t7acV+oy/kJ6JUBraXadoUFzm663Nr55yiz6o+EtuBgHXHgWY0fCVKbNfaBY06G2q8Ao AL1uoW0+SgKee3XUvLIgxmLJsMLh67Did3cmgJvTdUou+U5avupWTIUWQEsuATiLX7Dl xIHS60R3snbUP99iBy/A2vPKNvVipyrQ2G2zV2IaTMLr6qqJ5/wKmTXWZ7zGQ87MxvLN PQjbCwvdY27YbcOPEAMsGxIapPX436bcOoH4ObXV8sz3GA6bFihsIFa7qc9ansjX6RFB DG4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678667347; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=GPuOXwYyEb8oODKadlX9EJ5aOjKbiel0Z2EUmi0HXFk=; b=uf9hXvseJg9cqo/BMRo5rAR9wGw2NyFKTOPSGSNMa/Yv3sILlrTD/DU+zzPdcQTuWj +QXORsqDJyjXeR7plKkerFckQgKjQWKE7Ryh1ITzZhJ5zne2Brxat8NrTEwLv4cNvTM0 bZ0T0Sox2bA7OZeD2H3ZFDIhQ2WSYHcQzWC/gsAQgCtvTv6vXm0kWycmoklPemB5gpHj QbRhVUyijvCaiwK7H9+ktb0b9QEvypGQNVFhSwh+Ibg71CFtqkQVPcO57T3zpoijl4bR L2ZrZawZYjK5v/STODHTC+td8Zr/L/8xQgt3B73rN5kMT7ZxBWBIsvvJWydTr6DDAiP4 gXxQ== X-Gm-Message-State: AO0yUKWjHl9vAWEWJopk9Ph8rxAeikafo6Z0dXvAJSTpwwFph4tFiJv8 wLAF6G75t66bm/Q+4kzyn18= X-Google-Smtp-Source: AK7set/sghaaywwk7m0LkYlXr4f7sWddh+IE6qgzCymvkLaeXGTUGBt/QekAln+AJtAAYOAp/Wprfw== X-Received: by 2002:a17:907:3f90:b0:8de:acd1:90f0 with SMTP id hr16-20020a1709073f9000b008deacd190f0mr39404324ejc.3.1678667346797; Sun, 12 Mar 2023 17:29:06 -0700 (PDT) Received: from [192.168.2.2] (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id sa41-20020a1709076d2900b00909f7f28ed7sm2797532ejc.16.2023.03.12.17.29.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 12 Mar 2023 17:29:06 -0700 (PDT) Message-ID: <01021d5d-819c-060b-a076-770d24160bea@gmail.com> Date: Mon, 13 Mar 2023 01:29:05 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 From: Johan Jonker Subject: [PATCH v8 05/24] mtd: nand: raw: rockchip_nfc: fix oobfree offset and description To: dario.binacchi@amarulasolutions.com, michael@amarulasolutions.com, sjg@chromium.org, philipp.tomsich@vrull.eu, kever.yang@rock-chips.com Cc: u-boot@lists.denx.de, yifeng.zhao@rock-chips.com References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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.8 at phobos.denx.de X-Virus-Status: Clean The MTD framework reserves 1 or 2 bytes for the bad block marker depending on the bus size. The rockchip_nfc driver currently only supports a 8 bit bus, but reserves standard 2 bytes for the BBM. The first free OOB byte is therefore OOB2 at offset 2. Page address(PA) bytes are moved to the last 4 positions before ECC. Update the description for U-boot. Signed-off-by: Johan Jonker Reviewed-by: Kever Yang --- drivers/mtd/nand/raw/rockchip_nfc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/raw/rockchip_nfc.c b/drivers/mtd/nand/raw/rockchip_nfc.c index 25e04974..5fcf6a6b 100644 --- a/drivers/mtd/nand/raw/rockchip_nfc.c +++ b/drivers/mtd/nand/raw/rockchip_nfc.c @@ -487,10 +487,10 @@ static int rk_nfc_write_page_raw(struct mtd_info *mtd, * * BBM OOB1 OOB2 OOB3 |......| PA0 PA1 PA2 PA3 * - * The rk_nfc_ooblayout_free() function already has reserved - * these 4 bytes with: + * The oobfree structure already has reserved these 4 bytes + * together with 2 bytes for BBM by reducing it's length: * - * oob_region->offset = NFC_SYS_DATA_SIZE + 2; + * oobfree[0].length = rknand->metadata_size - NFC_SYS_DATA_SIZE - 2; */ if (!i) memcpy(rk_nfc_oob_ptr(chip, i), @@ -867,7 +867,7 @@ static int rk_nfc_ecc_init(struct rk_nfc *nfc, struct nand_chip *chip) ecc->layout->eccpos[i] = rknand->metadata_size + i; ecc->layout->oobfree[0].length = rknand->metadata_size - NFC_SYS_DATA_SIZE - 2; - ecc->layout->oobfree[0].offset = NFC_SYS_DATA_SIZE + 2; + ecc->layout->oobfree[0].offset = 2; return 0; } -- 2.20.1