All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH 12/19] sf: Support querying write-protect
Date: Fri, 26 Mar 2021 20:17:45 -0700	[thread overview]
Message-ID: <CAPnjgZ2FOKnsmPswszy1+V2PWFRE42MJH5HzYFvXd=FfYBCmqg@mail.gmail.com> (raw)
In-Reply-To: <20210315181056.12.I145e35c98b7629f46b20ab96e5a950ebd94689f3@changeid>

This feature was dropped from U-Boot some time ago:

   f12f96cfaf5 (sf: Drop spl_flash_get_sw_write_prot")

However, we do need a way to see if a flash device is write-protected,
since if it is, it may not be possible to write to do (i.e. failing to
write is expected).

I am not sure of the correct layer to implement this, so this patch is a
stab at it. If spi-flash makes sense then I will add to the 'sf' also.

Re the points mentioned in the removal commit:

    1) This kind of requirement can be achieved using existing
       flash operations and flash locking API calls instead of
       making a separate flash API.

Which uclass is this?

    2) Technically there is no real hardware user for this API to
       use in the source tree.

I do want coral (at least) to support this.

    3) Having a flash operations API for simple register read bits
       also make difficult to extend the flash operations.

This new patch only mentions write-protect being on or off, rather than
the actual mechanism.

    4) Instead of touching generic code, it is possible to have
       this functionality inside spinor operations in the form of
       flash hooks or fixups for associated flash chips.

That sounds to me like what drivers are for. But we still need some sort
of API for it to be accessible.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/mtd/spi/sf-uclass.c    |  9 +++++++++
 drivers/mtd/spi/sf_internal.h  |  4 ++++
 drivers/mtd/spi/sf_probe.c     |  8 ++++++++
 drivers/mtd/spi/spi-nor-core.c | 11 +++++++++++
 drivers/mtd/spi/spi-nor-tiny.c |  6 ++++++
 include/spi_flash.h            | 27 +++++++++++++++++++++++++++
 test/dm/sf.c                   | 10 +++++++++-
 7 files changed, 74 insertions(+), 1 deletion(-)

Applied to u-boot-dm/next, thanks!

  parent reply	other threads:[~2021-03-27  3:17 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-15  5:11 [PATCH 00/19] sandbox: Preparation for running vboot from coreboot Simon Glass
2021-03-15  5:11 ` [PATCH 01/19] sandbox: Only call timer_timebase_fallback() if present Simon Glass
2021-03-16  0:09   ` Sean Anderson
2021-03-27  3:18   ` Simon Glass
2021-03-15  5:11 ` [PATCH 02/19] sandbox: Only delete the executable if requested Simon Glass
2021-03-15  5:11 ` [PATCH 03/19] sandbox: cros_ec: Only write EC state when the EC is probed Simon Glass
2021-03-15 10:58   ` Heinrich Schuchardt
2021-03-15 18:23     ` Simon Glass
2021-03-27  3:17     ` Simon Glass
2021-03-15  5:11 ` [PATCH 04/19] sandbox: Disintangle declarations in do_host_bind() Simon Glass
2021-03-15  5:11 ` [PATCH 05/19] sandbox: Update do_host_bind() argument counting Simon Glass
2021-03-15  5:11 ` [PATCH 06/19] sandbox: Provide a way to bind fixed/removeable devices Simon Glass
2021-03-15  5:11 ` [PATCH 07/19] sandbox: image: Allow sandbox to load any image Simon Glass
2021-03-27  3:20   ` Simon Glass
2021-03-15  5:11 ` [PATCH 08/19] test: Silenece the echo and print tests Simon Glass
2021-03-15  5:11 ` [PATCH 09/19] binman: Show a message when changing subnodes Simon Glass
2021-03-15  5:11 ` [PATCH 10/19] spl: Split out bootstage ID into a function Simon Glass
2021-03-15  5:11 ` [PATCH 11/19] bootstage: Warning if space is exhausted Simon Glass
2021-03-15  5:11 ` [PATCH 12/19] sf: Support querying write-protect Simon Glass
2021-03-15  5:11 ` [PATCH 13/19] cpu: Rename SPL_CPU_SUPPORT to SPL_CPU Simon Glass
2021-03-15  5:11 ` [PATCH 14/19] malloc: Export malloc_simple_info() Simon Glass
2021-03-15  5:11 ` [PATCH 15/19] doc: Convert Chromium OS docs to rst Simon Glass
2021-03-15 10:56   ` Heinrich Schuchardt
2021-03-27  3:17   ` Simon Glass
2021-03-15  5:11 ` [PATCH 16/19] command: Fix operation of !CONFIG_CMDLINE Simon Glass
2021-03-15  5:11 ` [PATCH 17/19] bloblist: Make BLOBLIST_TABLES depend on BLOBLIST Simon Glass
2021-03-15  5:11 ` [PATCH 18/19] bootm: Skip command-line substitution if !CONFIG_CMDLINE Simon Glass
2021-03-15  5:11 ` [PATCH 19/19] sandbox: Correct uninit conflict Simon Glass
2021-03-27  3:17 ` Simon Glass
2021-03-27  3:17 ` [PATCH 17/19] bloblist: Make BLOBLIST_TABLES depend on BLOBLIST Simon Glass
2021-03-27  3:17 ` [PATCH 16/19] command: Fix operation of !CONFIG_CMDLINE Simon Glass
2021-03-27  3:17 ` [PATCH 14/19] malloc: Export malloc_simple_info() Simon Glass
2021-03-27  3:17 ` Simon Glass [this message]
2021-03-27  3:17 ` [PATCH 11/19] bootstage: Warning if space is exhausted Simon Glass
2021-03-27  3:17 ` [PATCH 09/19] binman: Show a message when changing subnodes Simon Glass
2021-03-27  3:17 ` [PATCH 08/19] test: Silenece the echo and print tests Simon Glass
2021-03-27  3:17 ` [PATCH 06/19] sandbox: Provide a way to bind fixed/removeable devices Simon Glass
2021-03-27  3:17 ` [PATCH 05/19] sandbox: Update do_host_bind() argument counting Simon Glass
2021-03-27  3:17 ` [PATCH 04/19] sandbox: Disintangle declarations in do_host_bind() Simon Glass
2021-03-27  3:17 ` [PATCH 02/19] sandbox: Only delete the executable if requested Simon Glass

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='CAPnjgZ2FOKnsmPswszy1+V2PWFRE42MJH5HzYFvXd=FfYBCmqg@mail.gmail.com' \
    --to=sjg@chromium.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 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.