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 AC49CC636CC for ; Mon, 13 Feb 2023 14:19:06 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 464E880BA0; Mon, 13 Feb 2023 15:19:04 +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="Hyt3LpH8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3A31A80BA3; Mon, 13 Feb 2023 15:19:01 +0100 (CET) Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) (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 346E880B9F for ; Mon, 13 Feb 2023 15:18:57 +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-ej1-x635.google.com with SMTP id jg8so32259251ejc.6 for ; Mon, 13 Feb 2023 06:18:57 -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=fBgRcfwpkHGcVTg6kS8qtkF1uix5ghml5yUXy/w6Zzo=; b=Hyt3LpH8Tigie2Z4mjZOO+MQ6LPdYbnga2Cyio3fSmIxJzPBQEbFaMb9u8bGoiWydU d2jl/0GAzzSPNN1zrBcQKEVmQJhWzXpqY5mI6RW4mm/SI9g+W6VNKCv/lgMy9D0fRnKs kO+T+Z9nFhGZ7IGeaT5zpA8W7nSvidOdcWsRMoHn7DnjYXoXz2DWx5bW4bqQCaAu84Qg GPDaaRkkgtunwm5XGprRM/Rn+bgeRypE8GYyAls4k/vTbUxrcxKR/UF+cQZIAWAysKKO IeVYsiJdOUvxa9zITCjJniFGhhBdgBSKKtFdMbEq+GqigVUrLqSUV9mkhYJWVxKuUYe+ 0Bmg== 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=fBgRcfwpkHGcVTg6kS8qtkF1uix5ghml5yUXy/w6Zzo=; b=e2RFf4vdYcugyZrApNiwCiWc8Bs/nMDBbnyF3q/JijcPMB5rPvAK6B37GvkqTRzSf7 JXzDjp7BSu5BBeONO6hXm0mEjPQmmpwxFBztWRdUGeVRyBkx6tWMy60s4S+avx1j5Ea/ QNrlGfrZLAddA7M0rRvJwiL3eoumA6WuGArJydxobiwMBAJNyR3bH2jpkMhb4YPfn0lN I3e/rC4+IIa/KZDanrge8gm3lbhOGtRt3+naOD1QB7/4JVF6w0npmyW7w43OzGI1FJxQ TuE+N5ZNqrP3yRyTpuCNAiAMfAJe6k501WMuT6AEtIgBg2w9agDlpQQgrNmcm+L3H87T Anfw== X-Gm-Message-State: AO0yUKWZO0hdVtLY0F+qbZ/U2CgAltHCt+DyX2UHANR8uvHG6OVrssi4 rO3Wg+2I5874XidkxvUA4fs= X-Google-Smtp-Source: AK7set9VK9w10ksFwyGYLV20ArYh3VrNt9j4EvhVXWte4+EPimFSgBYQ3M7i6Up73uUGALbgIdLgbQ== X-Received: by 2002:a17:906:85d2:b0:879:767f:6e45 with SMTP id i18-20020a17090685d200b00879767f6e45mr23932844ejy.17.1676297937505; Mon, 13 Feb 2023 06:18:57 -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 u9-20020a1709060ec900b008aac35b1c2esm6946841eji.173.2023.02.13.06.18.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Feb 2023 06:18:56 -0800 (PST) Message-ID: <27ead98a-e235-0240-f0d7-4d333d130598@gmail.com> Date: Mon, 13 Feb 2023 15:18:55 +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 v1] 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: <241e9e7b-58d6-dfa5-fcb5-5660e6402021@gmail.com> Content-Language: en-US In-Reply-To: <241e9e7b-58d6-dfa5-fcb5-5660e6402021@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 --- Note: Merge after serie: [PATCH v2 00/10] Fixes for Rockchip NFC driver part 1 --- 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 9e3a2533..bcab219b 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