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 9FB24C636CC for ; Sat, 18 Feb 2023 15:29:53 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3FF5E85A58; Sat, 18 Feb 2023 16:29:29 +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="jVnRkdoy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8ADA785A58; Sat, 18 Feb 2023 16:29:26 +0100 (CET) Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (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 F1496852B8 for ; Sat, 18 Feb 2023 16:29:23 +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-wm1-x330.google.com with SMTP id bg25-20020a05600c3c9900b003e21af96703so328919wmb.2 for ; Sat, 18 Feb 2023 07:29:23 -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=jVnRkdoyefL1k22NsDJL+nkkQOz8ni96WM/FyzzELaiokbsIaZjm3hhwjqsiRww1ak uekjxXYsgikEu3r4ebP+5yc4j+6cFf1QRurjrOEFYiYa2ck0j04PLCLJy/ZqAsALw7eq vSg+qaNCMUOTsfNAi5tNExlQlXZhiEr2lhQaufIPDohduRLPLUqe2GVzBY8N0N296eWR PqUYFML+9ivv9+B3Ct+n+f91Vl2nKtKglD9P7cwXrSdASvnQ0gE9LgRO5n63pvEBTPDn nO6JYT2TvJfZ1K0pvnufwcNOo5r6AT+tkd7QhbVkkAk7gu9+dmeYsHg2KF5dj3eIHSXB VJVQ== 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=EvXjdxdPbO5W+nPYTixqVKVlaIU25mCmiqX30e2OaBpbRUNWGpQ4GdsfgdNvbStIpz 4uFTgEJLAElof2LO3CMIh8P9qY1Vs6HVjRvwxK+p4nRNCmfDrBC0yXOsvHtihgSJCV8N Jo1p3w/OrVzfB7X74pUlgHVCUXlyNmtf73tz55t2LoLAf+iAQD3qx7jfU0gdPiSY1My7 GelNwfwJfYGotD9154oyjhASWIkewxmHj5SWcjGqPoV5IcbTbG+vuC4Hgbxpb6CuBuvL eiwokBxYnV4HDY3t4WyRQUKXIYY6Mo4lrkddeAsl5MTFX7/ihu8HioQRcWXijCIW17rD GPgQ== X-Gm-Message-State: AO0yUKVrvH/v7EVquZUjt9M4tUxBE/QuHpJ+9TYYDtPb2z6pVb8h7xO6 QmdZbSp4iXuDnU1HwnSM9rU= X-Google-Smtp-Source: AK7set/Z4+afcSjSSIzuU/4dYRKg9zrA/f6MB6i94VSY+qvMW4rbe6lpNkA3ggT/VAkrGR3UXRsbkA== X-Received: by 2002:a05:600c:16c6:b0:3e2:9b3:3cb4 with SMTP id l6-20020a05600c16c600b003e209b33cb4mr7548427wmn.5.1676734163405; Sat, 18 Feb 2023 07:29:23 -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 v6-20020a05600c214600b003dfe549da4fsm4047191wml.18.2023.02.18.07.29.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 18 Feb 2023 07:29:23 -0800 (PST) Message-ID: <4412f90b-08d6-2640-3c1f-fbe6aaae008d@gmail.com> Date: Sat, 18 Feb 2023 16:29:22 +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 v4 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: 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 --- 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