diff options
author | Simon Glass <sjg@chromium.org> | 2019-10-20 21:31:47 -0600 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2019-11-03 07:20:26 +0800 |
commit | c53b318e1bad2e0d5c2b846fadfc79ec77bfc5f7 (patch) | |
tree | 9fb3cf72abed73813d8a9885b59d4a66b7503b1b /drivers/spi/sandbox_spi.c | |
parent | e1500a6ce29a8424cc0c0a2fa82e694419941dd1 (diff) |
spi: Add support for memory-mapped flash
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 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.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'drivers/spi/sandbox_spi.c')
-rw-r--r-- | drivers/spi/sandbox_spi.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/spi/sandbox_spi.c b/drivers/spi/sandbox_spi.c index 16473ec7a0..6b610ff823 100644 --- a/drivers/spi/sandbox_spi.c +++ b/drivers/spi/sandbox_spi.c @@ -122,11 +122,22 @@ static int sandbox_cs_info(struct udevice *bus, uint cs, return 0; } +static int sandbox_spi_get_mmap(struct udevice *dev, ulong *map_basep, + uint *map_sizep, uint *offsetp) +{ + *map_basep = 0x1000; + *map_sizep = 0x2000; + *offsetp = 0x100; + + return 0; +} + static const struct dm_spi_ops sandbox_spi_ops = { .xfer = sandbox_spi_xfer, .set_speed = sandbox_spi_set_speed, .set_mode = sandbox_spi_set_mode, .cs_info = sandbox_cs_info, + .get_mmap = sandbox_spi_get_mmap, }; static const struct udevice_id sandbox_spi_ids[] = { |