[PATCH 2/2] mtd: rawnand: brcmnand: support "no-wp" DT property

Florian Fainelli f.fainelli at gmail.com
Wed Nov 3 10:50:48 PDT 2021


On 11/3/21 8:11 AM, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal at 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 at 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?

>  	else if (of_property_read_bool(ctrl->dev->of_node, "brcm,nand-has-wp"))
>  		ctrl->features |= BRCMNAND_HAS_WP;
> 


-- 
Florian



More information about the linux-mtd mailing list