lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230607100607.135bfba4@xps-13>
Date:   Wed, 7 Jun 2023 10:06:07 +0200
From:   Miquel Raynal <miquel.raynal@...tlin.com>
To:     William Zhang <william.zhang@...adcom.com>
Cc:     Broadcom Kernel List <bcm-kernel-feedback-list@...adcom.com>,
        Linux MTD List <linux-mtd@...ts.infradead.org>,
        f.fainelli@...il.com, rafal@...ecki.pl, kursad.oney@...adcom.com,
        joel.peshkin@...adcom.com, computersforpeace@...il.com,
        anand.gore@...adcom.com, dregan@...l.com, kamal.dasu@...adcom.com,
        tomer.yacoby@...adcom.com, dan.beygelman@...adcom.com,
        Florian Fainelli <florian.fainelli@...adcom.com>,
        Rob Herring <robh@...nel.org>, linux-kernel@...r.kernel.org,
        Vignesh Raghavendra <vigneshr@...com>,
        Richard Weinberger <richard@....at>,
        Boris Brezillon <bbrezillon@...nel.org>,
        Kamal Dasu <kdasu.kdev@...il.com>
Subject: Re: [PATCH 01/12] mtd: rawnand: brcmnand: Fix ECC level field
 setting for v7.2 controller

Hi William,

william.zhang@...adcom.com wrote on Tue,  6 Jun 2023 16:12:41 -0700:

> v7.2 controller has different ECC level field size and shift in the acc
> control register than its predecessor and successor controller. It needs
> to be set specifically.
> 
> Fixes: decba6d47869 ("mtd: brcmnand: Add v7.2 controller support")
> Signed-off-by: William Zhang <william.zhang@...adcom.com>
> Reviewed-by: Florian Fainelli <florian.fainelli@...adcom.com>
> ---
> 
>  drivers/mtd/nand/raw/brcmnand/brcmnand.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> index 2e9c2e2d9c9f..b2cde1082b3b 100644
> --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> @@ -977,12 +977,20 @@ static inline u32 brcmnand_ecc_level_mask(struct brcmnand_controller *ctrl)
>  	mask <<= NAND_ACC_CONTROL_ECC_SHIFT;
>  
>  	/* v7.2 includes additional ECC levels */
> -	if (ctrl->nand_version >= 0x0702)
> +	if (ctrl->nand_version == 0x0702)
>  		mask |= 0x7 << NAND_ACC_CONTROL_ECC_EXT_SHIFT;
>  
>  	return mask;
>  }
>  
> +static inline int brcmnand_ecc_level_shift(struct brcmnand_controller *ctrl)
> +{
> +	if (ctrl->nand_version == 0x0702)
> +		return NAND_ACC_CONTROL_ECC_EXT_SHIFT;
> +	else
> +		return NAND_ACC_CONTROL_ECC_SHIFT;
> +}
> +
>  static void brcmnand_set_ecc_enabled(struct brcmnand_host *host, int en)
>  {
>  	struct brcmnand_controller *ctrl = host->ctrl;
> @@ -992,8 +1000,8 @@ static void brcmnand_set_ecc_enabled(struct brcmnand_host *host, int en)
>  
>  	if (en) {
>  		acc_control |= ecc_flags; /* enable RD/WR ECC */
> -		acc_control |= host->hwcfg.ecc_level
> -			       << NAND_ACC_CONTROL_ECC_SHIFT;
> +		acc_control &= ~brcmnand_ecc_level_mask(ctrl);

Could we use static driver data instead? Let's avoid making
non-useful function calls when this can easily be avoided.

> +		acc_control |= host->hwcfg.ecc_level << brcmnand_ecc_level_shift(ctrl);
>  	} else {
>  		acc_control &= ~ecc_flags; /* disable RD/WR ECC */
>  		acc_control &= ~brcmnand_ecc_level_mask(ctrl);


Thanks,
Miquèl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ