From: Mike Frysinger Date: Wed, 21 Apr 2010 03:42:18 -0400 Subject: [U-Boot] [PATCH] spi_flash: support old STMicro parts with RES In-Reply-To: <1271830447-19221-1-git-send-email-thomas@wytron.com.tw> References: <1271830447-19221-1-git-send-email-thomas@wytron.com.tw> Message-ID: <201004210342.19832.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wednesday 21 April 2010 02:14:07 Thomas Chou wrote: > --- a/drivers/mtd/spi/spi_flash.c > +++ b/drivers/mtd/spi/spi_flash.c > @@ -120,6 +120,18 @@ struct spi_flash *spi_flash_probe(unsigned int bus, > unsigned int cs, ret = spi_flash_cmd(spi, CMD_READ_ID, &idcode, > sizeof(idcode)); > if (ret) > goto err_read_id; > +#ifdef CONFIG_SPI_FLASH_STMICRO > + if (idcode[0] == 0xff) { /* try RES to read electronic id */ > + ret = spi_flash_cmd(spi, 0xab, &idcode, sizeof(idcode)); > + if (ret) > + goto err_read_id; > + if ((idcode[3] & 0xf0) == 0x10) { > + idcode[0] = 0x20; > + idcode[1] = 0x20; > + idcode[2] = idcode[3] + 1; > + } > + } > +#endif please move this logic to stmicro's probe function to keep the common code clear of such cruft. -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. Url : http://lists.denx.de/pipermail/u-boot/attachments/20100421/002a377d/attachment.pgp