[U-Boot] [PATCH] spi_flash: support old STMicro parts with RES

Mike Frysinger vapier at gentoo.org
Wed Apr 21 09:42:18 CEST 2010


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 


More information about the U-Boot mailing list