Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6765020rwd; Tue, 6 Jun 2023 01:19:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4bH37uEWZ9txo3E77oIiXaglYXhMesDP5jxHQJwgn3ZpUkcqPXMVyuBrQfCEi5yt/Mz4hc X-Received: by 2002:a37:ab19:0:b0:75b:23a0:de95 with SMTP id u25-20020a37ab19000000b0075b23a0de95mr1382305qke.19.1686039558619; Tue, 06 Jun 2023 01:19:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686039558; cv=none; d=google.com; s=arc-20160816; b=MYDZIhVMXwHOX01nqnKMyZ+5JvlwV0fzENxgWbEp11TBGp6xen8vdjvWmo3DaaFFJk 2lxVTKpdS/JkfH+ITWH1XHXDV2DteJBqJu5+dsx4efvfJBB28X50GcWZmzoDnDbUWdZc GtGHIF1w2qeJV8+wXaGLNtHskv3Nf3c8MAA0zxnU0WEr+gYvv6ovJoQxeP9SC4pkiehT 5Fg8MsqItD0iI+SBOKwumHtyZQT77tfCC1sPBhX9m8HrQ5seO15ba9gMrXi/g9gB+RaE W3lHqvhaEXeHnZkmKamAh7HmFfbHr2CiIaEYZcYBByZ3hDfVltv1wA026daoSO8q1XPg qcOA== 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:dkim-signature; bh=hUxPIpvbFeVKFbvXsT93sPgr2hxk0tuN/r+2D9z+hgY=; b=FtYzjR4agEIxHsPwIpYDA9jMY57bCOLvpWySF3LsDeaErlb7cYX1ZOVguMUgKbedlf TFIY+YEsZpvrLHGJNf7+pZdj8p54vU66LfZrj1DHdOJOL0rYUOTglDezBkMu12x5noMo 88teGPGR+4egNV9HqyslayKEgpV6hwPm9O3/5lBSPg+LiEGuLFs+nSBDexkpKs1UU2Qr FX5/6V4hn2K1sJSpK7/H/+P1WJaWhOLfvblBJDC2olcI045OHoxxHwou0XPeTWANH/0+ yihO7cvLO6/FBrzx5N2l2t99xNjyBuHW6ip+QFKV4qfJRqNDW63q7Kfnm4iE/YbI+mIK uJBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=AZi1yqEm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k3-20020ae9f103000000b0075cbdd670desi5407707qkg.749.2023.06.06.01.19.04; Tue, 06 Jun 2023 01:19:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=AZi1yqEm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234603AbjFFH7B (ORCPT + 99 others); Tue, 6 Jun 2023 03:59:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234697AbjFFH6c (ORCPT ); Tue, 6 Jun 2023 03:58:32 -0400 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9962F1FF9 for ; Tue, 6 Jun 2023 00:55:54 -0700 (PDT) X-GND-Sasl: miquel.raynal@bootlin.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1686038152; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hUxPIpvbFeVKFbvXsT93sPgr2hxk0tuN/r+2D9z+hgY=; b=AZi1yqEmOO7yWD2SfDQF1XWxP6bA5kqUoPmcUIUcaDYS5cRVLDzw6bhralT+2uJ80VxdsW ACkxqmFJACimzyvoR5syFfe3vTex/B0sCKDAvmDS/luHOZA2gJrDHwTQqPNGezAF+CK24q 3OSlmaYhAEGW0tV5L/v+t7qhuIusIwmju08CdVB5NbFZGQ/nP+U7W+FkXE7Y0G0o2tfZUV TvyXWwxUOVEz0uPXLE84HO6dorN5sMbIR5SI5kHXsHCTFcdSs80sKB5oeRTArmf8TbReDg fQrlEXY1PJwX7EWuT0LMR0EbSfYVPNEAtCxbGxNEZCnMeatm6fHTdfgreDzJig== X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 99A97C0009; Tue, 6 Jun 2023 07:55:49 +0000 (UTC) Date: Tue, 6 Jun 2023 09:55:48 +0200 From: Miquel Raynal To: Arseniy Krasnov Cc: Liang Yang , Richard Weinberger , Vignesh Raghavendra , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , , , , , , Subject: Re: [RFC PATCH v5 2/6] mtd: rawnand: meson: wait for command in polling mode Message-ID: <20230606095548.6257b271@xps-13> In-Reply-To: <19eeb588-f909-8aad-b68c-bcfea8f2e926@sberdevices.ru> References: <20230601061850.3907800-1-AVKrasnov@sberdevices.ru> <20230601061850.3907800-3-AVKrasnov@sberdevices.ru> <20230601100751.41c3ff0b@xps-13> <9e106d50-2524-c999-48b1-a20760238aaf@sberdevices.ru> <20230605110546.6cb00a8d@xps-13> <2a755783-1d56-9842-2eee-b5ab41152c81@amlogic.com> <163e0684-caff-77d0-1eaf-9a58290c200d@amlogic.com> <20230606090344.3aca96c8@xps-13> <19eeb588-f909-8aad-b68c-bcfea8f2e926@sberdevices.ru> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arseniy, avkrasnov@sberdevices.ru wrote on Tue, 6 Jun 2023 10:40:21 +0300: > On 06.06.2023 10:03, Miquel Raynal wrote: > > Hi Arseniy, > >=20 > > avkrasnov@sberdevices.ru wrote on Mon, 5 Jun 2023 19:58:02 +0300: > > =20 > >> On 05.06.2023 16:30, Liang Yang wrote: =20 > >>> > >>> > >>> On 2023/6/5 21:19, Liang Yang wrote: =20 > >>>> Hi Miquel and Arseniy, > >>>> > >>>> > >>>> On 2023/6/5 17:05, Miquel Raynal wrote: =20 > >>>>> [ EXTERNAL EMAIL ] > >>>>> > >>>>> Hi Arseniy, > >>>>> =20 > >>>>>>>> @@ -1412,6 +1419,8 @@ static int meson_nfc_probe(struct platform= _device *pdev) > >>>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 return ret; > >>>>>>>> =C2=A0=C2=A0=C2=A0 } > >>>>>>>> > >>>>>>>> +=C2=A0 nfc->use_polling =3D of_property_read_bool(dev->of_node,= "polling"); =20 > >>>>>>> > >>>>>>> This is a problem. You cannot add a polling property like that. > >>>>>>> > >>>>>>> There is already a nand-rb property which is supposed to carry ho= w are > >>>>>>> wired the RB lines. I don't see any in-tree users of the compatib= les, I > >>>>>>> don't know how acceptable it is to consider using soft fallback w= hen > >>>>>>> this property is missing, otherwise take the values of the rb lin= es > >>>>>>> provided in the DT and user hardware control, but I would definit= ely > >>>>>>> prefer that. =20 > >>>>>> > >>>>>> I see. So i need to implement processing of this property here? An= d if it > >>>>>> is missed -> use software waiting. I think interesting thing will = be that: > >>>>>> > >>>>>> 1) Even with support of this property here, I really don't know ho= w to pass > >>>>>> =C2=A0=C2=A0=C2=A0 RB values to this controller - I just have defi= ne for RB command and that's > >>>>>> =C2=A0=C2=A0=C2=A0 it. I found that this property is an array of u= 32 - IIUC each element is > >>>>>> =C2=A0=C2=A0=C2=A0 RB pin per chip. May be i need to dive into the= old vendor's driver to find > >>>>>> =C2=A0=C2=A0=C2=A0 how to use RB values (although this driver uses= software waiting so I'm not > >>>>>> =C2=A0=C2=A0=C2=A0 sure that I'll find something in it). =20 > >>>>> > >>>>> Liang, can you please give use the relevant information here? How d= o we > >>>>> target RB0 and RB1? It seems like you use the CS as only information > >>>>> like if the RB lines where hardwired internally to a CS. Can we inv= ert > >>>>> the lines with a specific configuration? =20 > >>>> > >>>> Controllor has only one external RB pinmux (NAND_RB0). all the RB pi= ns > >>>> of different CEs need to be bound into one wire and connect with > >>>> NAND_RB0 if want to use controller polling rb. the current operating > >>>> CE of NAND is decided to "chip_select", of course controller interna= lly has different nfc commands to regconize which Ce's RB signal is polling. > >>>> > >>>> <&nand_pins> in dts/yaml should include the NAND_RB0 if hardware con= nects, or use software polling here. > >>>> > >>>> @Arseniy, sorry, i don't travel all the informations yet. but why do= n't you use the new RB_INT command with irq that i provided in another thre= ad. the new RB_INT command doesn't depend on the physical RB wires, it also= send the READ status command(0x70) and wait for the irq wake up completion= . =20 > >> > >> Technically no problem! I can use new RB_INT instead of 'nand_soft_wai= trdy()' as software fallback, and currently > >> implemented RB_INT as interrupt driven way. What do You think Miquel ? > >> =20 > >>> > >>> Use "nand-rb" in dts to decide old RB_INT(physical RB wires is needed= ) or new RB_INT(no physical RB wires). the new RB_INT command decides the R= B0 or RB1 by the previous command with ce args. > >>> =20 > >> > >> So I can implement "nand-rb" in dts as boolean value - "false" or miss= ing means use "no physical RB wires", "true" - means use "physical RB wires= " ? =20 > >=20 > > As long as it works and does not contain any extremely strange READ0 or > > READ_STATUS in the middle of nothing, I'm fine, take the simplest > > approach which will work for all. =20 >=20 > "extremetely strange READ0" is method which uses STATUS, interrupt, READ0= ? This method was > described by Liang. It needs to be very well contained in dedicated helpers and documented. You choose what is easier for you (Liang's method or nand_soft_waitrdy()), but I don't want to see spurious READ0 or READ_STATUS calls inside read/write_page helpers like before. > And You mean to use the following logic: > if ("nand-rb" =3D=3D true) > use RB_INT which requires wire > else > use 'nand_soft_waitrdy()' >=20 > ? >=20 > Thanks, Arseniy >=20 > > =20 > >> > >> Thanks, Arseniy > >> =20 > >>>> =20 > >>>>> Arseniy, if the answer to my above question is no, then you should > >>>>> expect the nand-rb and reg arrays to be identical. If they are not, > >>>>> then you can return -EINVAL. > >>>>> > >>>>> If the nand-rb property is missing, then fallback to software wait. > >>>>> =20 > >>>>>> 2) I can't test RB mode - I don't have such device :( > >>>>>> > >>>>>> Also for example in arasan-nand-controller.c parsed 'nand-rb' valu= es are used > >>>>>> in controller specific register for waiting (I guess Meson control= ler has something > >>>>>> like that, but I don't have doc). While in marvell_nand.c it looks= like that they parse > >>>>>> 'nand-rb' property, but never use it. =20 > >>>>> > >>>>> Yes, the logic around the second RB line (taking care of CS1/CS3) is > >>>>> slightly broken or at least badly documented, and thus should not be > >>>>> used. > >>>>> =20 > >>>>>>> In any case you'll need a dt-binding update which must be acked by > >>>>>>> dt-binding maintainers. =20 > >>>>>> > >>>>>> You mean to add this property desc to Documentation/devicetree/bin= dings/mtd/amlogic,meson-nand.yaml ? =20 > >>>>> > >>>>> Yes. In a dedicated patch. Something along the lines: > >>>>> > >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 nand-rb: true > >>>>> > >>>>> inside the nand chip object should be fine. And flag the change as a > >>>>> fix because we should have used and parsed this property since the > >>>>> beginning. > >>>>> > >>>>> Thanks, > >>>>> Miqu=C3=A8l =20 > >=20 > >=20 > > Thanks, > > Miqu=C3=A8l =20 Thanks, Miqu=C3=A8l