public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] mtd: sf: Add CONFIG_SPI_N25Q256A_RESET for software-reset
Date: Fri, 1 May 2015 16:24:45 +0200	[thread overview]
Message-ID: <201505011624.45335.marex@denx.de> (raw)
In-Reply-To: <20150501090108.GA7205@amd>

On Friday, May 01, 2015 at 11:01:09 AM, Pavel Machek wrote:
> This is needed for the SoCFPGA booting from SPI NOR flash
> e.g. (N25Q256A) as long as u-boot-spl 2013 is used (newer one is not
> available).
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> Signed-off-by: Pavel Machek <pavel@denx.de>
> 
> ---
> 
> Ported to today's u-boot version.
> 
> diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
> index 201471c..f7cfbd9 100644
> --- a/drivers/mtd/spi/sf_probe.c
> +++ b/drivers/mtd/spi/sf_probe.c
> @@ -347,6 +348,36 @@ int spi_flash_probe_slave(struct spi_slave *spi,
> struct spi_flash *flash) }
>  	}
> 
> +#ifdef CONFIG_SPI_N25Q256A_RESET

Should be CONFIG_SPI_MICRON_RESET, since other parts which can also be
used would have similar issue.

This should also be documented in README I believe. It'd be nice if you
added diffstat into your patches as it makes things easier during review.

> +#define CMD_RESET_ENABLE 0x66
> +#define CMD_RESET_MEMORY 0x99
> +	/*
> +	 * This is needed for the SoCFPGA booting from SPI NOR flash
> +	 * e.g. (N25Q256A), as U-Boot SPL 2013-socfpga (only version
> +	 * working on that board) sets 4-byt addressing mode.
> +	 *
> +	 * Additionally it may be good idea to change
> +	 * this line in the Linux SPI NOR flash driver:

Please submit a patch for Linux then. But this will be extremely
crappy and unreliable solution, so you should at least make the
kernel spit some warning upon shutdown so people are aware they
are doing something terribly wrong.

> +	 * { "n25q256a", INFO(0x20ba19, 0, 64 * 1024,  512,
> +	 *    SECT_4K | SHUTDOWN_3BYTE) },
> +	 *
> +	 * Add SHUTDOWN_3BYTE here.
> +	 */
> +	ret = spi_flash_cmd(spi, CMD_RESET_ENABLE, NULL, 0);
> +	if (ret) {
> +		printf("SF: Failed issue reset command\n");

I thought this was just a reset-enable command. If this command
fails, user won't be able to tell which of these two failed, so
it's a bad idea to use the same error message for both.

> +		goto err_read_id;
> +	}
> +
> +	ret = spi_flash_cmd(spi, CMD_RESET_MEMORY, NULL, 0);
> +	if (ret) {
> +		printf("SF: Failed issue reset command\n");
> +		goto err_read_id;
> +	}
> +
> +	printf("SF: Device software reset\n");
> +#endif
>  #ifdef CONFIG_OF_CONTROL
>  	if (spi_flash_decode_fdt(gd->fdt_blob, flash)) {
>  		debug("SF: FDT decode error\n");

Best regards,
Marek Vasut

  reply	other threads:[~2015-05-01 14:24 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-01 15:13 [U-Boot] [PATCH 0/2 v3] arm: socfpga: Add Cadence QSPI support Stefan Roese
2014-10-01 15:13 ` [U-Boot] [PATCH 1/4 v3] spi: Add Cadence QSPI driver used by SoCFPGA Stefan Roese
2014-10-01 15:13 ` [U-Boot] [PATCH 2/4 v3] arm: socfpga: Add Cadence QSPI support to config header Stefan Roese
2014-10-01 15:13 ` [U-Boot] [PATCH 3/4 v3] arm: socfpga: Don't define CONFIG_SPI_FLASH_QUAD Stefan Roese
2014-10-01 15:13 ` [U-Boot] [RFC PATCH 4/4 v3] mtd: sf: Add CONFIG_SPI_N25Q256A_RESET for software-reset Stefan Roese
2014-10-01 18:25   ` Marek Vasut
2014-10-01 18:57     ` Stefan Roese
2014-10-01 19:04       ` Jagan Teki
2014-10-01 19:25         ` Stefan Roese
2014-10-01 23:07           ` Pavel Machek
2014-10-02  6:13             ` Stefan Roese
2014-10-02  2:47         ` Marek Vasut
2014-10-02  8:40           ` Pavel Machek
2014-10-02 11:23             ` Marek Vasut
2015-04-25 19:48         ` Pavel Machek
2015-04-27 16:35           ` Marek Vasut
2015-05-01  9:01             ` [U-Boot] [PATCH] " Pavel Machek
2015-05-01 14:24               ` Marek Vasut [this message]
2015-05-01 14:49                 ` Pavel Machek
2015-05-01 17:26                   ` Marek Vasut
2015-05-10  9:07                     ` Pavel Machek
2015-05-10  9:15                       ` [U-Boot] [PATCHv2] " Pavel Machek
2015-05-10  9:48                         ` Marek Vasut
2015-05-10 10:49                         ` [U-Boot] [PATCHv3] " Pavel Machek
2015-05-10 12:24                           ` Jagan Teki
2015-05-10 16:25                             ` Marek Vasut
2015-05-10 17:43                               ` Pavel Machek
2015-05-11  7:47                                 ` Marek Vasut
2015-05-10 17:53                             ` Pavel Machek
2015-05-11  7:48                               ` Marek Vasut
2015-05-11  8:05                                 ` Jagan Teki
2015-05-11  8:29                                   ` Pavel Machek
2015-05-11  8:33                                     ` Jagan Teki
2015-05-11  8:39                                       ` Pavel Machek
2015-05-11  8:44                                         ` Jagan Teki
2015-05-11  8:50                                           ` Pavel Machek
2015-05-11  9:05                                             ` Jagan Teki
2015-05-11  9:56                                               ` Pavel Machek
2015-05-11 10:03                                                 ` Jagan Teki
2015-05-15  8:47                                                   ` Pavel Machek
2015-05-15  9:36                                                     ` Marek Vasut
2015-05-15  9:55                                                       ` Pavel Machek
2015-05-10  9:48                       ` [U-Boot] [PATCH] " Marek Vasut
2015-04-25 19:44     ` [U-Boot] [RFC PATCH 4/4 v3] " Pavel Machek
2014-10-01 18:43   ` Jagan Teki
2014-10-03 20:58 ` [U-Boot] [PATCH 0/2 v3] arm: socfpga: Add Cadence QSPI support Marek Vasut

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=201505011624.45335.marex@denx.de \
    --to=marex@denx.de \
    --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