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: <DM6PR02MB47797E4A5ADFC87DE4B04A81AF3C0@DM6PR02MB4779.namprd02.prod.outlook.com>
Date:   Wed, 24 Apr 2019 05:04:38 +0000
From:   Naga Sureshkumar Relli <nagasure@...inx.com>
To:     Helmut Grohne <helmut.grohne@...enta.de>
CC:     "bbrezillon@...nel.org" <bbrezillon@...nel.org>,
        "miquel.raynal@...tlin.com" <miquel.raynal@...tlin.com>,
        "richard@....at" <richard@....at>,
        "dwmw2@...radead.org" <dwmw2@...radead.org>,
        "computersforpeace@...il.com" <computersforpeace@...il.com>,
        "marek.vasut@...il.com" <marek.vasut@...il.com>,
        "linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Michal Simek <michals@...inx.com>,
        "nagasureshkumarrelli@...il.com" <nagasureshkumarrelli@...il.com>
Subject: RE: [LINUX PATCH v14] mtd: rawnand: pl353: Add basic driver for arm
 pl353 smc nand interface

Hi Helmut,

> -----Original Message-----
> From: Helmut Grohne <helmut.grohne@...enta.de>
> Sent: Tuesday, April 23, 2019 6:15 PM
> To: Naga Sureshkumar Relli <nagasure@...inx.com>
> Cc: bbrezillon@...nel.org; miquel.raynal@...tlin.com; richard@....at;
> dwmw2@...radead.org; computersforpeace@...il.com; marek.vasut@...il.com; linux-
> mtd@...ts.infradead.org; linux-kernel@...r.kernel.org; Michal Simek <michals@...inx.com>;
> nagasureshkumarrelli@...il.com
> Subject: Re: [LINUX PATCH v14] mtd: rawnand: pl353: Add basic driver for arm pl353 smc
> nand interface
> 
> WARNING: This driver might brick the hardware. See below.
> 
> Hi Naga,
> 
> On Mon, Apr 15, 2019 at 04:40:13PM +0530, Naga Sureshkumar Relli wrote:
> > Changes in v14:
> >  - Removed legacy hooks as per Miquel comments
> 
> Thank you for the update.
> 
> > +static inline int pl353_wait_for_dev_ready(struct nand_chip *chip) {
> > +	unsigned long timeout = jiffies + PL353_NAND_DEV_BUSY_TIMEOUT;
> > +
> > +	do {
> > +		if (pl353_smc_get_nand_int_status_raw()) {
> > +			pl353_smc_clr_nand_int();
> > +			break;
> 
> A closing brace is missing here. This causes a compilation failure.
While cleaning up the warnings reported by checkpatch,  this happened.
sorry for that. I will correct it. 
> 
> > +
> > +		cpu_relax();
> 
> You previously used cond_resched (via nand_wait_ready) here. Why did you change it to
> cpu_relax()?
I just replicated the pl353_wait_for_ecc_done() API definition.
But did you see any issue with this?
Anyway I will replace it with cond_resched(), instead of cpu_releax()
> 
> > +	} while (!time_after_eq(jiffies, timeout));
> > +
> > +	if (time_after_eq(jiffies, timeout)) {
> > +		pr_err("%s timed out\n", __func__);
> > +		return -ETIMEDOUT;
> > +	}
> > +
> > +	return 0;
> > +}
> 
> 
> > +static int pl353_nand_read_page_hwecc(struct nand_chip *chip,
> > +				      u8 *buf, int oob_required, int page) {
> > +	int i, stat, eccsize = chip->ecc.size;
> > +	int eccbytes = chip->ecc.bytes;
> > +	int eccsteps = chip->ecc.steps;
> > +	u8 *p = buf;
> > +	u8 *ecc_calc = chip->ecc.calc_buf;
> > +	u8 *ecc = chip->ecc.code_buf;
> > +	unsigned int max_bitflips = 0;
> > +	u8 *oob_ptr;
> > +	u32 ret;
> > +	unsigned long data_phase_addr;
> > +	unsigned long nand_offset = (unsigned long __force)xnfc->regs;
> 
> The variable xnfc is undeclared here. Consider swapping the line with the next one.
> 
> > +	struct pl353_nand_controller *xnfc = to_pl353_nand(chip);
> > +	struct mtd_info *mtd = nand_to_mtd(chip);
> 
> After loading the driver, the device does not work. The dmesg output is:
> 
> nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xda
> nand: Micron MT29F2G08ABAEAWP
> nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64 Bad block table not
> found for chip 0 Bad block table not found for chip 0 Scanning device for bad blocks
> nand_bbt: error while writing BBT block -524
> nand_bbt: error while writing BBT block -524
> nand_bbt: error while writing BBT block -524
> nand_bbt: error while writing BBT block -524 No space left to write bad block table
> nand_bbt: error while writing bad block table -28 pl353-nand e1000000.flash: could not scan
> the nand chip
> pl353-nand: probe of e1000000.flash failed with error -28
Did you follow the same thing that you tried earlier?
i.e. updated "nand-bus-width" property and "nand-ecc-mode" ?
I haven't seen any issue in BBT scanning, with this patch.

> 
> After trying the driver, the flash chip was bricked. Neither the old driver nor the uboot-xlnx
> driver nor the Xilinx fsbl are able to talk to the chip afterwards. This behaviour persists even
> after a full power cycle. I'll try reinitializing the flash chip next. I've only seen this behaviour
> once, so there is a slight chance that the cause is something else.
Sometimes I also faced the same problem during driver development.
What I did is, in standalone nandps driver example,  I forcibly created BBT in the init and once
 it is done. I just reloaded the actual example. Then after wards u-boot and Linux are able to scan
the BBT.

Thanks,
Naga Sureshkumar Relli
> 
> Helmut

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ