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 69214C64EC4 for ; Tue, 28 Feb 2023 21:17:14 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2C7B585C10; Tue, 28 Feb 2023 22:17:12 +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="baQm1exM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4C76D85C09; Tue, 28 Feb 2023 22:17:03 +0100 (CET) Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) (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 4AFA185BF3 for ; Tue, 28 Feb 2023 22:17:00 +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-x530.google.com with SMTP id cy6so45714083edb.5 for ; Tue, 28 Feb 2023 13:17:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677619020; 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=yQlIVnLURZ7YoWj2mgSX57RjXNYcqSL7L+iuX6tf61c=; b=baQm1exMn49Q1Umk/sfpZmsMhKVihWliTRsLcxpKCxIaBugzPKdOb1TftdvOQaeKXg HHMv45DKqnSmaNBab2vSX2djefeoyoPKXkveGwzg4gN/tprpH0zj/kVhidQ7Axp/O7EU 26Oqrb1iYcUU/o9ySiDjk829J6Vn7B8aLTiVl0M8cDbkMk3e0EmtXUgenDK7F1PuChTK nX4TAtylf/hFtK0HuhZUZXs76/h6mERA97I38pCwTvv52kujaFD/LcCsV6d98pTM2N0w goYcbC/A4ailpDAV/bmkytbb/2/HO+cSNKLhFgdjp5T/pJaTH1HDCQQHjyq3+lUq87by dDGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677619020; 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=yQlIVnLURZ7YoWj2mgSX57RjXNYcqSL7L+iuX6tf61c=; b=mgs1WWiYr/JLCtzOQ4zQel8XIUEYT/Wv0o+8w7S+0y5wEFVBLeCaDK344HhHktQofP dbvjrGyYskEqBGuMLMNJGV5ky9T8v6gNU8AIvgrNwzElrr5AfDYzgcRkYiz5bfZUQXEP 3x3ML6VUUtVjEnWtx54W7JKhFG+eieNMIVdugqwm/cFn05caq9uHEEcMXiyXtaJ4j4Mr +Rejf/KMhEzCX4WY9hSQDIFE4hKV/nmz+3WmfF1mfvGgs07Zsf8lQfIdWA102YZiKbi5 K+ZK9mNK+ScEtEwpsuS8NEM4CM5tzPzqbWa6oM1oLaTyiQ8isKg1ee73M5DgqaX66Riw VOUw== X-Gm-Message-State: AO0yUKXNXxo+y5lE+BopkKNslf+KqNHlA5m4HqHzf9ZKzcd+Z0Fnvhn2 yJBAUznb7tJp40fqJ2GoQ2M= X-Google-Smtp-Source: AK7set8rrg2Mm3JqGNF+j1m0KL78DvK5ChAVhXVs+drV8y7NMVlrJ2VFwrdcuze3U1QtDqCG08GxEQ== X-Received: by 2002:a17:907:75e6:b0:8b1:79ce:a629 with SMTP id jz6-20020a17090775e600b008b179cea629mr4156938ejc.18.1677619019832; Tue, 28 Feb 2023 13:16:59 -0800 (PST) Received: from [192.168.2.1] (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id m15-20020a1709061ecf00b00882f9130eafsm4925201ejj.26.2023.02.28.13.16.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Feb 2023 13:16:59 -0800 (PST) Message-ID: <3c73d900-2aed-4f42-1c4a-24f3bcfff579@gmail.com> Date: Tue, 28 Feb 2023 22:16:58 +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 v5 05/21] 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.6 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 ca5e7313..5ca7eeb8 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