All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonas Bonn <jonas@norrbonn.se>
To: linux-mtd@lists.infradead.org
Cc: Jonas Bonn <jonas@norrbonn.se>
Subject: [PATCH v2 0/3] spi-nor block protection
Date: Tue, 29 Jan 2019 23:07:02 +0100	[thread overview]
Message-ID: <20190129220705.5143-1-jonas@norrbonn.se> (raw)

Changed in v2:
* Provide the below cover letter
* Rebase patches so they apply cleanly on linux-next


In order to make device that's effectively read-only except to an
authorized user we need:

i)  Some way of defaulting block-protection to on when device is first
powered
ii)  Some way of controlling the write-protect signal so that the BP
(block protect) bits can't be changed

Some SPI flashes support the BPNV configuration register bit:  block
protect non-volatile.  When this bit is set, the block protection bits
BP0, BP1, and BP2 default to 1, effectively causing the flash memory to
becomes read-only at power on.  If we can set this bit, we solve problem
i) above.

Controlling the write-protect input is a matter for something external
to the flash itself.  Unfortunately, the WP# signal is only honoured if
the status register bit SRWD (status register write disable) is set.  If
we can have this bit always set, then we solve problem ii) above.

This short patch series provides the above bits, allowing for the
creation of a device that's effectively read-only to any actor who isn't
able to control the WP# signal.

Jonas Bonn (3):
  mtd: spi-nor: always respect write-protect input
  mtd: spi-nor: s25fl512s supports region locking
  mtd: spi-nor: allow setting the BPNV (default locked) bit

 drivers/mtd/mtdchar.c         |   6 ++
 drivers/mtd/mtdcore.c         |   8 +++
 drivers/mtd/spi-nor/spi-nor.c | 119 ++++++++++++++++++++++------------
 include/linux/mtd/mtd.h       |   2 +
 include/linux/mtd/spi-nor.h   |   1 +
 include/uapi/mtd/mtd-abi.h    |   1 +
 6 files changed, 97 insertions(+), 40 deletions(-)

-- 
2.19.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

             reply	other threads:[~2019-01-29 22:07 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-29 22:07 Jonas Bonn [this message]
2019-01-29 22:07 ` [PATCH v2 1/3] mtd: spi-nor: always respect write-protect input Jonas Bonn
2019-03-10  9:58   ` Tudor.Ambarus
2019-03-10 10:42     ` Jonas Bonn
2019-03-11 14:05       ` Tudor.Ambarus
2019-03-11 20:14         ` Yong Qin
2019-03-12  9:29           ` Tudor.Ambarus
2019-03-12 19:27             ` Yong Qin
2019-03-19  6:59               ` Tudor.Ambarus
2019-03-19  7:13                 ` Jonas Bonn
2019-03-20  6:33                   ` Tudor.Ambarus
2019-03-20  7:06                     ` Jonas Bonn
2019-03-20  7:33                       ` Tudor.Ambarus
2019-03-20  7:39                         ` Jonas Bonn
2019-03-20 18:56                           ` Yong Qin
2019-03-20 21:05                             ` Jonas Bonn
2019-04-02  7:12                               ` Tudor.Ambarus
2019-04-27  6:23                                 ` [PATCH v3 1/1] " Jonas Bonn
2019-01-29 22:07 ` [PATCH v2 2/3] mtd: spi-nor: s25fl512s supports region locking Jonas Bonn
2019-03-19 16:30   ` Tudor.Ambarus
2019-01-29 22:07 ` [PATCH v2 3/3] mtd: spi-nor: allow setting the BPNV (default locked) bit Jonas Bonn
2019-03-10 10:06   ` Tudor.Ambarus
2019-02-14  9:21 ` [PATCH v2 0/3] spi-nor block protection Jonas Bonn
2019-02-14  9:33   ` Tudor.Ambarus

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=20190129220705.5143-1-jonas@norrbonn.se \
    --to=jonas@norrbonn.se \
    --cc=linux-mtd@lists.infradead.org \
    /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.