Hi, On Thu, Oct 07, 2021 at 06:06:23PM +0530, Pratyush Yadav wrote: > > Unfortunately there is no way to tell the controller any of these. It > > simply does "read" or "write" (as we command it) and internally then > > uses whatever it got from the SFDP tables of the flash chip. That's why > > we just claim to support all these operations and let the controller do > > its thing (whatever it is). > > That is not ideal. SPI NOR uses this to negotiate the best available > protocol with the controller. Say you have a flash that is capable of > octal mode but the controller can only support quad mode. Your driver > will happily tell SPI NOR that it can support octal mode. I think you > should check the SPI mode bits to make sure the protocol bus width is > supported at least (see spi_check_buswidth_req() in spi-mem.c). Okay, I'll see if I can add that check somewhere. > As for opcodes, is there no way to find out what opcodes the controller > discovered via SFDP? Maybe we can't change them, but can we at least > take a peek at them? AFAICT no. The controller only allows "higher" level commands like read, write, erase but does not expose any of that to software. You can see yourself if you want, the spec is here: https://cdrdv2.intel.com/v1/dl/getContent/636174 Page 403 has the control register. > I think this has problems similar to the Cadence xSPI controller [0]. Probably but I would not call these "problems" - it is how the controller is designed. This one is meant only for SPI-NOR flash access, typically used by the BIOS. It is by no means general purpose SPI controller (as you can see from the datasheet). The BIOS does need the full SPI stack, it just issues these simple commands and let's the controller figure out what actually needs to be done. > Sorry I only replied to this after you posted a new version. It got lost > in the heap of emails in my inbox :-( No worries :)