All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] sf: bar: Clean BA24 Bank Address Register bit after read/write/erase operation
Date: Wed, 13 Sep 2017 13:02:59 -0300	[thread overview]
Message-ID: <CAOMZO5Bq84Pdj0AmDbJcRJoJVyjZ6OQTGhaji0M1d47yBZgURg@mail.gmail.com> (raw)
In-Reply-To: <1505295574-14294-1-git-send-email-lukma@denx.de>

Hi Lukasz,

On Wed, Sep 13, 2017 at 6:39 AM, Lukasz Majewski <lukma@denx.de> wrote:

>  #ifdef CONFIG_SPI_FLASH_BAR
> +/*
> + * This "cleanup" is necessary in a situation when one was accessing
> + * spi flash memory > 16 MiB by using Bank Address Register's BA24 bit.
> + *
> + * After it the BA24 bit shall be cleared to allow access to correct
> + * memory region after SW reset (by calling "reset" command).
> + *
> + * Otherwise, the BA24 bit may be left set and then after reset, the
> + * ROM would seek for SPL from 0x1000000, not 0x0.
> + */
> +static int cleanup_bar(struct spi_flash *flash)
> +{
> +       u8 cmd, bank_sel = 0;
> +
> +       if (flash->bank_curr == 0)
> +               return 0;
> +       cmd = flash->bank_write_cmd;
> +
> +       return spi_flash_write_common(flash, &cmd, 1, &bank_sel, 1);
> +}
> +

What about defining an empty stub for this function when
CONFIG_SPI_FLASH_BAR is not defined?

>  static int write_bar(struct spi_flash *flash, u32 offset)
>  {
>         u8 cmd, bank_sel;
> @@ -339,6 +360,10 @@ int spi_flash_cmd_erase_ops(struct spi_flash *flash, u32 offset, size_t len)
>                 len -= erase_size;
>         }
>
> +#ifdef CONFIG_SPI_FLASH_BAR
> +       ret = cleanup_bar(flash);
> +#endif

Then you don't need to add the ifdefs when calling cleanup_bar().

  reply	other threads:[~2017-09-13 16:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-13  9:39 [U-Boot] [PATCH] sf: bar: Clean BA24 Bank Address Register bit after read/write/erase operation Lukasz Majewski
2017-09-13 16:02 ` Fabio Estevam [this message]
2017-09-13 16:06   ` Łukasz Majewski
2017-09-23 22:40   ` Łukasz Majewski
2017-09-25 10:09 ` Jagan Teki
2017-09-25 10:23   ` Łukasz Majewski

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=CAOMZO5Bq84Pdj0AmDbJcRJoJVyjZ6OQTGhaji0M1d47yBZgURg@mail.gmail.com \
    --to=festevam@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.