diff options
author | Ramon Fried <ramon.fried@gmail.com> | 2018-07-02 02:57:59 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-07-19 16:31:38 -0400 |
commit | 7fd7e2cf339ea2ec570f6dae1cdfaf8e066eb4af (patch) | |
tree | 5d8dd398705c2d3055fc388068eb3988ba9db247 /drivers/smem | |
parent | 6621bedb9642690fb072e3663ce5339aee533d27 (diff) | |
download | u-boot-7fd7e2cf339ea2ec570f6dae1cdfaf8e066eb4af.tar.gz u-boot-7fd7e2cf339ea2ec570f6dae1cdfaf8e066eb4af.tar.xz u-boot-7fd7e2cf339ea2ec570f6dae1cdfaf8e066eb4af.zip |
drivers: smem: sandbox
Add Sandbox driver for SMEM. mostly stub operations.
Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/smem')
-rw-r--r-- | drivers/smem/Kconfig | 9 | ||||
-rw-r--r-- | drivers/smem/Makefile | 1 | ||||
-rw-r--r-- | drivers/smem/sandbox_smem.c | 45 |
3 files changed, 55 insertions, 0 deletions
diff --git a/drivers/smem/Kconfig b/drivers/smem/Kconfig index 6cf5a4e61e..7169d0f205 100644 --- a/drivers/smem/Kconfig +++ b/drivers/smem/Kconfig @@ -3,6 +3,15 @@ menuconfig SMEM if SMEM +config SANDBOX_SMEM + bool "Sandbox Shared Memory Manager (SMEM)" + depends on SANDBOX && DM + help + enable SMEM support for sandbox. This is an emulation of a real SMEM + manager. + The sandbox driver allocates a shared memory from the heap and + initialzies it on start. + config MSM_SMEM bool "Qualcomm Shared Memory Manager (SMEM)" depends on DM diff --git a/drivers/smem/Makefile b/drivers/smem/Makefile index 605b8fc290..af3e9b5088 100644 --- a/drivers/smem/Makefile +++ b/drivers/smem/Makefile @@ -2,5 +2,6 @@ # # Makefile for the U-Boot SMEM interface drivers +obj-$(CONFIG_SANDBOX_SMEM) += sandbox_smem.o obj-$(CONFIG_SMEM) += smem-uclass.o obj-$(CONFIG_MSM_SMEM) += msm_smem.o diff --git a/drivers/smem/sandbox_smem.c b/drivers/smem/sandbox_smem.c new file mode 100644 index 0000000000..7397e4407a --- /dev/null +++ b/drivers/smem/sandbox_smem.c @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2018 Ramon Fried <ramon.fried@gmail.com> + */ + +#include <common.h> +#include <dm.h> +#include <errno.h> +#include <smem.h> +#include <asm/test.h> + +static int sandbox_smem_alloc(unsigned int host, + unsigned int item, size_t size) +{ + return 0; +} + +static void *sandbox_smem_get(unsigned int host, + unsigned int item, size_t *size) +{ + return NULL; +} + +static int sandbox_smem_get_free_space(unsigned int host) +{ + return 0; +} + +static const struct smem_ops sandbox_smem_ops = { + .alloc = sandbox_smem_alloc, + .get = sandbox_smem_get, + .get_free_space = sandbox_smem_get_free_space, +}; + +static const struct udevice_id sandbox_smem_ids[] = { + { .compatible = "sandbox,smem" }, + { } +}; + +U_BOOT_DRIVER(smem_sandbox) = { + .name = "smem_sandbox", + .id = UCLASS_SMEM, + .of_match = sandbox_smem_ids, + .ops = &sandbox_smem_ops, +}; |