From: Florian Fainelli <f.fainelli@gmail.com>
To: "Rafał Miłecki" <rafal@milecki.pl>
Cc: "Rafał Miłecki" <zajec5@gmail.com>,
"Miquel Raynal" <miquel.raynal@bootlin.com>,
"Richard Weinberger" <richard@nod.at>,
"Vignesh Raghavendra" <vigneshr@ti.com>,
"Rob Herring" <robh+dt@kernel.org>,
"Brian Norris" <computersforpeace@gmail.com>,
"Kamal Dasu" <kdasu.kdev@gmail.com>,
linux-mtd@lists.infradead.org, devicetree@vger.kernel.org,
bcm-kernel-feedback-list@broadcom.com
Subject: Re: [PATCH 2/2] mtd: rawnand: brcmnand: support "no-wp" DT property
Date: Wed, 3 Nov 2021 11:08:58 -0700 [thread overview]
Message-ID: <03140f48-8447-9431-2bf0-ed75578bdced@gmail.com> (raw)
In-Reply-To: <f4694a87a459ac19fea451294fda45ef@milecki.pl>
On 11/3/21 11:03 AM, Rafał Miłecki wrote:
> On 2021-11-03 18:50, Florian Fainelli wrote:
>> On 11/3/21 8:11 AM, Rafał Miłecki wrote:
>>> From: Rafał Miłecki <rafal@milecki.pl>
>>>
>>> Some boards may use WP-capable controller but still have WP not
>>> connected. This change fixes:
>>> [ 1.175550] bcm63138_nand ff801800.nand: timeout on status poll
>>> (expected c0000040 got c00000c0)
>>> [ 1.184524] bcm63138_nand ff801800.nand: nand #WP expected on
>>> [ 1.285547] bcm63138_nand ff801800.nand: timeout on status poll
>>> (expected c0000040 got c00000c0)
>>> [ 1.294516] bcm63138_nand ff801800.nand: nand #WP expected on
>>> [ 1.395548] bcm63138_nand ff801800.nand: timeout on status poll
>>> (expected c0000040 got c00000c0)
>>> [ 1.404517] bcm63138_nand ff801800.nand: nand #WP expected on
>>>
>>> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
>>> ---
>>> drivers/mtd/nand/raw/brcmnand/brcmnand.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
>>> b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
>>> index f75929783b94..8b6167457f0c 100644
>>> --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
>>> +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
>>> @@ -714,7 +714,8 @@ static int brcmnand_revision_init(struct
>>> brcmnand_controller *ctrl)
>>> if (ctrl->nand_version >= 0x0500)
>>> ctrl->features |= BRCMNAND_HAS_1K_SECTORS;
>>>
>>> - if (ctrl->nand_version >= 0x0700)
>>> + if (ctrl->nand_version >= 0x0700 &&
>>> + !of_property_read_bool(ctrl->dev->of_node, "no-wp"))
>>> ctrl->features |= BRCMNAND_HAS_WP;
>>
>> Should not this be a logical OR here or rather, should it be moved out
>> of the check on ctrl->nand_version entirely? What revision of the NAND
>> controller do you have on that chip?
>
> It's NAND controller version 0x0701 (v7.1) and I think it's correct.
>
> I think we want WP enabled on rev 7.0+ unless it was explicitly disabled.
True, I somehow got confused about the negative logic, so maybe we need
to combine the logic of all of these lines into a single one:
if ((ctrl->nand_version >= 0x700 ||
of_property_read_bool(ctrl->dev->of_node, "brcm,nand-has-wp")) &&
!of_property_read_bool(ctrl->dev->of_node, "no-wp")
such that it is clearer, Kamal, what do you think?
--
Florian
next prev parent reply other threads:[~2021-11-03 18:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-03 15:11 [PATCH 1/2] dt-bindings: mtd: brcmnand: add "no-wp" property Rafał Miłecki
2021-11-03 15:11 ` [PATCH 2/2] mtd: rawnand: brcmnand: support "no-wp" DT property Rafał Miłecki
2021-11-03 17:50 ` Florian Fainelli
2021-11-03 18:03 ` Rafał Miłecki
2021-11-03 18:08 ` Florian Fainelli [this message]
2021-11-09 7:49 ` [PATCH 1/2] dt-bindings: mtd: brcmnand: add "no-wp" property Rafał Miłecki
2021-11-09 10:52 ` Miquel Raynal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=03140f48-8447-9431-2bf0-ed75578bdced@gmail.com \
--to=f.fainelli@gmail.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=computersforpeace@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=kdasu.kdev@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=rafal@milecki.pl \
--cc=richard@nod.at \
--cc=robh+dt@kernel.org \
--cc=vigneshr@ti.com \
--cc=zajec5@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox