public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 1/2] SPI Flash: add support of sst26wf* flash ICs protection ops
Date: Mon, 9 Apr 2018 13:52:31 +0000	[thread overview]
Message-ID: <1523281950.23469.24.camel@synopsys.com> (raw)
In-Reply-To: <CAD6G_RTdAywzUKtCx3WE=8Oyq9RynwpgzrmQi=9VFYvPXR5UNQ@mail.gmail.com>

Hi Jagan,

On Mon, 2018-04-09 at 16:52 +0530, Jagan Teki wrote:
> On Mon, Apr 9, 2018 at 4:27 PM, Eugeniy Paltsev
> <Eugeniy.Paltsev@synopsys.com> wrote:
> > sst26wf flash series block protection implementation differs
> > from other SST series, so add specific implementation
> > flash_lock/flash_unlock/flash_is_locked functions for sst26wf
> > flash ICs.
> > 
> > +enum flash_lock_status {
> > +       SF_UNLOCKED             = 0,
> > +       SF_LOCKED               = 1,
> > +};
> 
> Try to use existing relevant error codes.

Hmm, I can return something like EACCES (positive value) if flash is locked. Is it OK?

> > +
> >  #define SPI_FLASH_3B_ADDR_LEN          3
> > +enum lock_ctl {
> > +       CTL_LOCK,
> > +       CTL_UNLOCK,
> > +       CTL_CHECK
> > +};
> 
> SST26_CTL_* ?
OK.

> > 
> > +#if defined(CONFIG_SPI_FLASH_SST)
> 
> Please move this code inside of existing #ifdef of SST (commented same
> in previous version)
OK.

[snip]
> > 
> >  #ifdef CONFIG_SPI_FLASH_MACRONIX
> >  static int macronix_quad_enable(struct spi_flash *flash)
> > @@ -1033,6 +1189,15 @@ int spi_flash_scan(struct spi_flash *flash)
> >         }
> >  #endif
> > 
> > +/* sst26wf series block protection implementation differs from other series */
> > +#if defined(CONFIG_SPI_FLASH_SST)
> > +       if (JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_SST && info->id[1] == 0x26) {
> > +               flash->flash_lock = sst26_lock;
> > +               flash->flash_unlock = sst26_unlock;
> > +               flash->flash_is_locked = sst26_is_locked;
> > +       }
> > +#endif
> 
> Previous version comment need to fix here? (about switch case with
> existing lock ops)?

I guess switch case isn't suitable here:
we need check several parameters (JEDEC_MFR and Device Type) and we need to check
CONFIG_SPI_FLASH_*** ifdefs.

Also we have only two lock ops: "stm_*" and "sst26_*" (which I add by this patch).

So I guess using switch here is unnecessarily.

> Jagan.
-- 
 Eugeniy Paltsev

  reply	other threads:[~2018-04-09 13:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-09 10:57 [U-Boot] [PATCH v4 0/2] SF: add support for sst26wf016, sst26wf032, sst26wf064 Eugeniy Paltsev
2018-04-09 10:57 ` [U-Boot] [PATCH v4 1/2] SPI Flash: add support of sst26wf* flash ICs protection ops Eugeniy Paltsev
2018-04-09 11:22   ` Jagan Teki
2018-04-09 13:52     ` Eugeniy Paltsev [this message]
2018-04-09 10:57 ` [U-Boot] [PATCH v4 2/2] SF: add support for sst26wf016, sst26wf032, sst26wf064 Eugeniy Paltsev

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=1523281950.23469.24.camel@synopsys.com \
    --to=eugeniy.paltsev@synopsys.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox