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 C22E5C636D7 for ; Thu, 16 Feb 2023 18:01:37 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CA35685BB0; Thu, 16 Feb 2023 19:01:31 +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="D3i7oMdI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BA56F85B9E; Thu, 16 Feb 2023 19:01:21 +0100 (CET) Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) (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 A319785BA8 for ; Thu, 16 Feb 2023 19:01:09 +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-x52e.google.com with SMTP id t16so5929782edd.10 for ; Thu, 16 Feb 2023 10:01:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=3Tv89+yyrFVhxEdUSFhlwBaGXQWdTWpWS0EUdiKkZHw=; b=D3i7oMdIUjrLR2V8tSamLaCd7+HSU5z31Z0MT1mkpd1LS95A4oKkBBTNib9WJx35py oCRue3MmddcL3RFrEfI9b3RcV7Fs5hV4GH2FdApKDZPkjzvAtK+S6/dK9g/9WXdlwAQ/ SefAcFK0kEBD6Al05VdH33DRMC51mkpfDS2rzyv9xbohshxohvwvlb3T5uQgmfqjj1VD mGxbq3VZYuWA8blmoeohBD/mTEIDRm6v34rNh+OiGXeza0uC5ACoF3jBPvoP6WaxdQpr uClxKTPrWhoYXIygsG7QEE5UfAZHoD0uGdhEld7VPI1GP06S/nd/LscLRlRfZ/gsG402 0/pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=3Tv89+yyrFVhxEdUSFhlwBaGXQWdTWpWS0EUdiKkZHw=; b=s0TC5U3o0+i+z1e0AutBOvDL/Adsyin7JiLWZnP/gEpdV2g6j8b166EX2XmOnx857C PRI+irCCmXAtfHI4hhniK38k2MBk0RuQIf6akInLRGZKXAshjN3prP6XaIgofsnMZ4FK XSPAvBS2HAFiekAG8T6lJdFWz4yEgnztviqM+Gr0zWHhfDJg1lWKKCXw4TiI/XQEl+Ui NgFez1b24AU8MWZgAhIMsqkVADLYGBFpE5QPAB4kD/GnFF9qBhgYA/xEsksm6ioGKyyn iTMyQ2iswSFExaKGwBMA5VVo61xf2um0HjUJ17OhxjLomEPppT+z7kH8RZ3eIiaba9MN sM2Q== X-Gm-Message-State: AO0yUKX0fe/dhs38OYncNM25H/JF8yT4SoU11cjOKZR+G8xjuYj00k3q IzIuovit3T1jDSvqKHJ7Km8= X-Google-Smtp-Source: AK7set+5R22bLgWXor/C+Xam97voQT3wLBVfTLaHj7spbxKKtq40r+eyP9226ecR1kr2AJ3iTxXfuA== X-Received: by 2002:a17:907:72cf:b0:88d:72c0:611 with SMTP id du15-20020a17090772cf00b0088d72c00611mr9500526ejc.3.1676570468482; Thu, 16 Feb 2023 10:01:08 -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 u20-20020a17090657d400b008b1779ba3c1sm518458ejr.115.2023.02.16.10.01.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Feb 2023 10:01:08 -0800 (PST) Message-ID: Date: Thu, 16 Feb 2023 19:01:07 +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 v3 11/11] mtd: nand: raw: rockchip_nfc: fix oobfree offset and description To: dario.binacchi@amarulasolutions.com, michael@amarulasolutions.com, sjg@chromium.org Cc: philipp.tomsich@vrull.eu, kever.yang@rock-chips.com, u-boot@lists.denx.de, yifeng.zhao@rock-chips.com References: <111b67cc-1ec6-14b2-31d4-d2261b8b7a03@gmail.com> Content-Language: en-US In-Reply-To: <111b67cc-1ec6-14b2-31d4-d2261b8b7a03@gmail.com> 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 --- 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