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: <20220103112705.718c580c@collabora.com>
Date:   Mon, 3 Jan 2022 11:27:05 +0100
From:   Boris Brezillon <boris.brezillon@...labora.com>
To:     Apurva Nandan <a-nandan@...com>
Cc:     Miquel Raynal <miquel.raynal@...tlin.com>,
        Richard Weinberger <richard@....at>,
        Vignesh Raghavendra <vigneshr@...com>,
        Mark Brown <broonie@...nel.org>,
        Patrice Chotard <patrice.chotard@...s.st.com>,
        Christophe Kerello <christophe.kerello@...s.st.com>,
        Daniel Palmer <daniel@...f.com>,
        Alexander Lobakin <alobakin@...me>,
        <linux-mtd@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
        <linux-spi@...r.kernel.org>, <p.yadav@...com>
Subject: Re: [PATCH v3 15/17] mtd: spianand: winbond: Add change_mode()
 manufacturer_ops

On Sat, 1 Jan 2022 13:12:48 +0530
Apurva Nandan <a-nandan@...com> wrote:

> Add implementation of change_mode() for Winbond's manufacturer_ops,
> that executes octal_dtr_enable() and octal_dtr_disable() according
> to requested protocol.
> 
> Datasheet: https://www.winbond.com/export/sites/winbond/datasheet/W35N01JW_Datasheet_Brief.pdf
> 
> Signed-off-by: Apurva Nandan <a-nandan@...com>
> ---
>  drivers/mtd/nand/spi/winbond.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c
> index c7478faf6cee..d8eccb40c80f 100644
> --- a/drivers/mtd/nand/spi/winbond.c
> +++ b/drivers/mtd/nand/spi/winbond.c
> @@ -242,8 +242,33 @@ static int winbond_spinand_octal_dtr_disable(struct spinand_device *spinand)
>  	return 0;
>  }
>  
> +static int winbond_change_spi_mode(struct spinand_device *spinand,
> +				   const enum spinand_protocol protocol)
> +{
> +	if (spinand->protocol == protocol)
> +		return 0;
> +
> +	switch (spinand->protocol) {
> +	case SPINAND_1S_1S_1S:
> +		if (protocol == SPINAND_8D_8D_8D)
> +			return winbond_spinand_octal_dtr_enable(spinand);
> +		break;
> +
> +	case SPINAND_8D_8D_8D:
> +		if (protocol == SPINAND_1S_1S_1S)
> +			return winbond_spinand_octal_dtr_disable(spinand);
> +		break;
> +
> +	default:
> +		return -EOPNOTSUPP;
> +	}
> +
> +	return -EOPNOTSUPP;

This version is slightly more concise:

	if (spinand->protocol == protocol)
		return 0;
	else if (spinand->protocol == SPINAND_1S && protocol ==	SPINAND_8D)
		return winbond_spinand_octal_dtr_enable(spinand);
	else if (spinand->protocol == SPINAND_8D && protocol ==	SPINAND_1S)
		return winbond_spinand_octal_dtr_disable(spinand);

	return -EOPNOTSUPP;

> +}
> +
>  static const struct spinand_manufacturer_ops winbond_spinand_manuf_ops = {
>  	.init = winbond_spinand_init,
> +	.change_mode = winbond_change_spi_mode,
>  };
>  
>  const struct spinand_manufacturer winbond_spinand_manufacturer = {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ