Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp3444428pxx; Mon, 2 Nov 2020 09:03:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZbRjijrl+89pD+8iUcbjteLeDgMCc0UdY8IduELhwn6BP5AB53MeUo6e4e/Eertr7ioh9 X-Received: by 2002:a17:906:f753:: with SMTP id jp19mr16058824ejb.280.1604336611767; Mon, 02 Nov 2020 09:03:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604336611; cv=none; d=google.com; s=arc-20160816; b=PHcxT43Ris7i/iE0asDa3u3AiBHy+X/x+pYwiaY3RwAp76T/nvfqJKQGU86u02EFZw GFsk1DgOh0jqtbVqEqmv+UW9CI9YTty9aYDCgSNb1Q9eYns48MTpj8YniVl8tVbWQkZA LB/nqw5xOJvRKF9F6QxjvVXEEtLfvIRIn5Wzi/VxfE/A/Bzv0xdptHUP6CDsym2+2RJL OHitwonaH5g7SUQ4h5O2e64qke60SS8JQ3GhysjcYjH+BLSEhUE6yxmXTD6J/rAlG/Eu GBDptBOHX0HiEwEWn+2b1MaDdYKph8lZa5C7xJyQ0OkoHQoCZAjJsfxGbZm5wHXcpP0X 3wzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=KC/y8TinvJtVbSuTwmVaTsFQxs0lttc1zVctbnxn5xY=; b=otaRPqlbMbQrjFZnaxoCGAVk7T2esi7R71OjckNqOpPu4otGVJYIc/Z0Sv9NjSdUSz 38TE8O4zr7x1Gr9xsPwA+LJqjpVayePfXDNIqMFNLjEJxUZ4vByiuqDmAH/Ht3KFVcH4 eCJk4aCcSt2l7rNY2NwGHC5ngxMgmMAlOKgvgkYaWf/YJ0xpNn3QHgTNaPWuPM8qd84Y eSbDW478Sot+4N3EsN3s7QKZwdiHtjdJmeyER0CksxrhJTXuoDc9519TTtCQNnienI+V fn9lzjJVatmxH+aGK9mPnuSMe/fZv+ZTdOtCPnD/qcM7wd/vpxsJvj8nWv/4yqRD04Xf XRPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q16si10513181ejr.545.2020.11.02.09.03.06; Mon, 02 Nov 2020 09:03:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727395AbgKBRAq convert rfc822-to-8bit (ORCPT + 99 others); Mon, 2 Nov 2020 12:00:46 -0500 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:57173 "EHLO relay8-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726613AbgKBRAq (ORCPT ); Mon, 2 Nov 2020 12:00:46 -0500 X-Originating-IP: 91.224.148.103 Received: from xps13 (unknown [91.224.148.103]) (Authenticated sender: miquel.raynal@bootlin.com) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 2B6131BF20A; Mon, 2 Nov 2020 17:00:41 +0000 (UTC) Date: Mon, 2 Nov 2020 18:00:39 +0100 From: Miquel Raynal To: Johan Jonker Cc: Yifeng , richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org, devicetree@vger.kernel.org, heiko@sntech.de, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v13 2/8] mtd: rawnand: rockchip: NFC drivers for RK3308, RK2928 and others Message-ID: <20201102180039.757d3234@xps13> In-Reply-To: <803e291f-67e0-f66c-6c9e-041db1b3847c@gmail.com> References: <20201028095326.15562-1-yifeng.zhao@rock-chips.com> <20201028095326.15562-3-yifeng.zhao@rock-chips.com> <0b417fc2-3503-9bf6-914d-0f8b38df1914@gmail.com> <20201102140725.66e7dcb1@xps13> <5ad70fa0-05a9-e1e7-32cc-32933ff25ae9@gmail.com> <803e291f-67e0-f66c-6c9e-041db1b3847c@gmail.com> Organization: Bootlin X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Johan, Johan Jonker wrote on Mon, 2 Nov 2020 17:31:18 +0100: > On 11/2/20 2:11 PM, Johan Jonker wrote: > > Hi, > > > > On 11/2/20 2:07 PM, Miquel Raynal wrote: > >> Hi Johan, Yifeng > >> > >> Johan Jonker wrote on Mon, 2 Nov 2020 13:57:56 > >> +0100: > >> > >>> Hi Yifeng, > >>> > >>> Don't poke with "ecc->bytes" ones it is set in rk_nfc_ecc_init(). It > >>> will not be noted by the MTD frame work or userspace. I think there's > >>> currently no way to let the user know that a different ECC must be used. > >>> Neither can the user set ECC on the fly. > >>> > >>> Example R/W flow: > >>> > >>> nand_select_target() > >>> chip->ecc.write_page_raw() > >>> chip->ecc.write_page() > >>> > >>> [..] > >>> > >>> chip->ecc.read_page_raw() > >>> chip->ecc.read_page() > >>> nand_deselect_target() > >>> > >>> A write/read with: > >>> > >>> rk_nfc_read_page_hwecc() > >>> rk_nfc_write_page_hwecc() > >>> > >>> or > >>> > >>> rk_nfc_read_page_raw() > >>> rk_nfc_write_page_raw() > >>> > >>> must end up with the same result. If we can't archive that, then we > >>> shouldn't offer RAW mode to the user for now. If Miquel agrees you > >>> should just get the driver ready now without these 2 functions and round > >>> things up. > >> > >> What about just not supporting the BootROM area if it was marked > >> "reserved" by the BRom in the DT? > > > > Should we just fill the buffers with '0xff' for boot blocks? > > (part 2) ;) > My fault.... > Better use: > > if ((chip->options & NAND_IS_BOOT_MEDIUM) && > (page < (pages_per_blk * rknand->boot_blks))) { > > return -EIO; > > } Yup, I was about to tell you that I would prefer returning a nice error, this is fine I guess. Anyway, I think reading bad block markers is done in raw mode, so if raw accessors refuse to return valid values for boot blocks, you won't be able to access it neither with raw nor corrected hooks. Perhaps refusing the access to the regular page access is ok, but maybe we should be able to at least read these pages in raw mode (and move the BBM to its right location). What do you think? Thanks, Miquèl > > > > > >> > >> Raw accessors is really a nice and basic feature that I would like to > >> have in every new driver. > >> > >> Thanks, > >> Miquèl > >> > > >