public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Sending vendor specific commands to spi-nor flash
@ 2022-05-18 12:32 Paul Barker
  2022-05-23  8:31 ` Michael Walle
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Barker @ 2022-05-18 12:32 UTC (permalink / raw)
  To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, linux-mtd
  Cc: Stuart Rubin


[-- Attachment #1.1.1.1: Type: text/plain, Size: 2031 bytes --]

Hi,

We're looking to add support for sending vendor specific commands to 
Micron Authenta flash devices over the SPI bus. Since we're using the 
MTD block interface to support a filesystem on the SPI flash we need to 
send these vendor specific commands via some sort of IOCTL.

I can see a couple of ways to achieve this (as follows) and would like 
to get some feedback from the MTD & spi-nor maintainers on which 
approach is preferred:

1) Add new IOCTLs to the mtdchar device to support these vendor specific 
operations. An initial set of patches was sent back in October 2021 
which took this route [1], but no further progress was made. The new 
IOCTLs would exist for all mtdchar devices (regardless of vendor) if we 
go this route and we'd need to ensure -EINVAL or -ENOTSUPP is returned 
as appropriate if these IOCTLs are called on a device which does not 
implement them.

2) Add a vendor-specific IOCTL layer to the mtdchar device interface. 
When the mtdchar IOCTL handler is called with a command not defined in 
mtdchar.c, pass the call on to a device-specific IOCTL handler which can 
potentially handle vendor specific commands.

3) Add a generic SPI transfer IOCTL for spi-nor MTD devices. This would 
avoid the need to define IOCTLs for every vendor specific command 
supported by SPI flash devices. Instead, knowledge of the vendor 
specific commands would be kept in userspace and the kernel would simply 
provide an API for sending & receiving arbitrary bytes over the SPI bus. 
This is similar to the MMC_IOC_CMD IOCTL supported by the MMC driver.

My preference would be for option (3) since it minimizes the scope of 
the changes we need to make in the kernel. We're not tied to this 
though, so let us know if a different option is preferred.

[1]: 
https://lore.kernel.org/linux-mtd/20211027103352.8879-1-sshivamurthy@micron.com/T/

Regards,

-- 
Paul Barker
Principal Software Engineer
SanCloud Ltd

e: paul.barker@sancloud.com
w: https://sancloud.com/

[-- Attachment #1.1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7645 bytes --]

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

[-- Attachment #2: Type: text/plain, Size: 144 bytes --]

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-20  9:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-18 12:32 Sending vendor specific commands to spi-nor flash Paul Barker
2022-05-23  8:31 ` Michael Walle
2022-05-23 10:02   ` Paul Barker
2022-05-23 11:25     ` Michael Walle
2022-06-07 13:50       ` Paul Barker
2022-06-20  9:12         ` Paul Barker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox