Merge branch '2020-05-18-reduce-size-of-common.h'
[oweals/u-boot.git] / drivers / spi / sandbox_spi.c
index 906401ec8ab46acb242b7cfad857622427a717ba..b0a46c886815925027c5c3cf5a790083f1ebcd16 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <spi_flash.h>
@@ -117,7 +118,17 @@ static int sandbox_cs_info(struct udevice *bus, uint cs,
 {
        /* Always allow activity on CS 0 */
        if (cs >= 1)
-               return -ENODEV;
+               return -EINVAL;
+
+       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;
 }
@@ -127,6 +138,7 @@ static const struct dm_spi_ops sandbox_spi_ops = {
        .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[] = {