public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] spi_flash: support old STMicro parts with RES
Date: Wed, 21 Apr 2010 03:42:18 -0400	[thread overview]
Message-ID: <201004210342.19832.vapier@gentoo.org> (raw)
In-Reply-To: <1271830447-19221-1-git-send-email-thomas@wytron.com.tw>

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 

  reply	other threads:[~2010-04-21  7:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-21  6:14 [U-Boot] [PATCH] spi_flash: support old STMicro parts with RES Thomas Chou
2010-04-21  7:42 ` Mike Frysinger [this message]
2010-04-21  7:51   ` Thomas Chou
2010-04-21  9:54     ` Mike Frysinger
2010-04-21  8:16 ` [U-Boot] [PATCH v2] " Thomas Chou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201004210342.19832.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox