All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pratyush Yadav <p.yadav@ti.com>
To: <tkuw584924@gmail.com>
Cc: <u-boot@lists.denx.de>, <jagan@amarulasolutions.com>,
	<vigneshr@ti.com>, <Bacem.Daassi@infineon.com>,
	Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
Subject: Re: [PATCH 2/2] mtd: spi-nor-core: Add fixups for Spansion S25FL256L
Date: Fri, 17 Sep 2021 22:21:16 +0530	[thread overview]
Message-ID: <20210917165114.uikwq65qrypidfug@ti.com> (raw)
In-Reply-To: <518a2f98449bc956e0e3d6b19ff60b18b08d973a.1631088494.git.Takahiro.Kuwano@infineon.com>

On 08/09/21 05:47PM, tkuw584924@gmail.com wrote:
> From: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
> 
> The S25FL256L is 32MB NOR Flash that does not support Bank Address
> Register. This fixup is activated if CONFIG_SPI_FLASH_BAR is enabled and
> returns ENOTSUPP in setup() hook to avoid further ops.
> 
> Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
> ---
>  drivers/mtd/spi/spi-nor-core.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
> index d5d905fa5a..4940b35682 100644
> --- a/drivers/mtd/spi/spi-nor-core.c
> +++ b/drivers/mtd/spi/spi-nor-core.c
> @@ -3222,6 +3222,23 @@ static struct spi_nor_fixups s25hx_t_fixups = {
>  	.post_bfpt = s25hx_t_post_bfpt_fixup,
>  	.post_sfdp = s25hx_t_post_sfdp_fixup,
>  };
> +
> +#ifdef CONFIG_SPI_FLASH_BAR
> +static int s25fl256l_setup(struct spi_nor *nor, const struct flash_info *info,
> +			   const struct spi_nor_flash_parameter *params)
> +{
> +	return -ENOTSUPP; /* Bank Address Register is not supported */

I am not very familiar with BAR. Can you please explain what would 
happen if we don't do this?

> +}
> +
> +static void s25fl256l_default_init(struct spi_nor *nor)
> +{
> +	nor->setup = s25fl256l_setup;
> +}
> +
> +static struct spi_nor_fixups s25fl256l_fixups = {
> +	.default_init = s25fl256l_default_init,
> +};
> +#endif
>  #endif
>  
>  #ifdef CONFIG_SPI_FLASH_S28HS512T
> @@ -3644,6 +3661,10 @@ void spi_nor_set_fixups(struct spi_nor *nor)
>  			break;
>  		}
>  	}
> +#ifdef CONFIG_SPI_FLASH_BAR

We should avoid using #ifdef as much as possible. Change this to

  if (CONFIG_IS_ENABLED(SPI_FLASH_BAR) && !strcmp())

> +	if (!strcmp(nor->info->name, "s25fl256l"))
> +		nor->fixups = &s25fl256l_fixups;
> +#endif

*sigh* we really need to find a better way to specify fixups. Let me see 
if I can figure something out. In the meantime, this should be fine.

>  #endif
>  
>  #ifdef CONFIG_SPI_FLASH_S28HS512T
> -- 
> 2.25.1
> 

-- 
Regards,
Pratyush Yadav
Texas Instruments Inc.

  reply	other threads:[~2021-09-17 16:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-08  8:47 [PATCH 0/2] mtd: spi-nor: Add support for Spansion S25FL256L tkuw584924
2021-09-08  8:47 ` [PATCH 1/2] mtd: spi-nor-ids: " tkuw584924
2021-09-17 16:47   ` Pratyush Yadav
2021-09-08  8:47 ` [PATCH 2/2] mtd: spi-nor-core: Add fixups " tkuw584924
2021-09-17 16:51   ` Pratyush Yadav [this message]
2021-09-29  5:22     ` Takahiro Kuwano

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=20210917165114.uikwq65qrypidfug@ti.com \
    --to=p.yadav@ti.com \
    --cc=Bacem.Daassi@infineon.com \
    --cc=Takahiro.Kuwano@infineon.com \
    --cc=jagan@amarulasolutions.com \
    --cc=tkuw584924@gmail.com \
    --cc=u-boot@lists.denx.de \
    --cc=vigneshr@ti.com \
    /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.