From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Fri, 18 Oct 2019 08:13:56 -0600 Subject: [U-Boot] [PATCH v2 14/38] spi: Add support for memory-mapped flash In-Reply-To: References: <20190925141147.191166-1-sjg@chromium.org> <20190925141147.191166-15-sjg@chromium.org> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Vignesh, On Fri, 18 Oct 2019 at 03:48, Vignesh Raghavendra wrote: > > > > On 18/10/19 7:52 AM, Simon Glass wrote: > > Hi, > > > > On Thu, 17 Oct 2019 at 08:28, Simon Glass wrote: > >> > >> Hi Vignesh, > >> > >> On Wed, 16 Oct 2019 at 04:28, Vignesh Raghavendra wrote: > >>> > >>> Hi Simon, > >>> > >>> On 12/10/19 10:03 AM, Bin Meng wrote: > >>>> Hi Simon, > >>>> > >>>> On Sat, Oct 12, 2019 at 11:08 AM Simon Glass wrote: > >>>>> > >>>>> Hi Bin, > >>>>> > >>>>> On Wed, 9 Oct 2019 at 07:55, Bin Meng wrote: > >>>>>> > >>>>>> Hi Simon, > >>>>>> > >>>>>> On Wed, Sep 25, 2019 at 10:12 PM Simon Glass wrote: > >>>>>>> > >>>>>>> On x86 platforms the SPI flash can be mapped into memory so that the > >>>>>>> contents can be read with normal memory accesses. > >>>>>>> > >>>>>>> Add a new SPI flash method to find the location of the SPI flash in > >>>>>>> memory. This differs from the existing device-tree "memory-map" mechanism > >>>>>>> in that the location can be discovered at run-time. > >>>>>>> > >>> > >>> Whats is the usecase? Why can't spi_flash_read() be used instead? > >>> Flash + Controller driver can underneath take care of using memory > >>> mapped mode to read data from flash right while making sure that access > >>> is within valid window? > >> > >> I can see spi_flash_read_dm() but it does not support returning a > >> pointer to the data, only reading it. > >> > > No, I was merely suggesting to use spi_flash_read_dm() (which underneath > can be implemented by spi_mem_ops) to get data from flash instead of > using get_mmap() to get MMIO pointer and then reading the data using > that potiner. OK I see. > > >> Also I cannot find any documentation about any of this. I've been > >> looking in the doc/ directory. > >> > >> I found the spi_mem.h file but it doesn't mention the meaning of the > >> in and out buffer pointers so I don't know how to use them. > >> > >> Is there an API missing or just comments/documentation? > > > > spi-mem.h has struct and APIs documented as kerneldoc: > https://elixir.bootlin.com/u-boot/latest/source/include/spi-mem.h#L72 > https://elixir.bootlin.com/u-boot/latest/source/include/spi-mem.h#L168 Yes I see that, but these appear to be undocumented, or not documented enough to understand their purpose/use: opcode in out Could you please update that? > > Note that clients should still use spi_flash_*() APIs to interact with > flash. spi_mem_ops are not an alternative to spi_flash_*() APIs which > are used by other drivers to read/write data from/to flash. This > continues to be the same. OK. Regards, Simon