Skip to content

Commit

Permalink
drivers: smem: sandbox
Browse files Browse the repository at this point in the history
Add Sandbox driver for SMEM. mostly stub operations.

Signed-off-by: Ramon Fried <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
  • Loading branch information
mellowcandle authored and trini committed Jul 19, 2018
1 parent 6621bed commit 7fd7e2c
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/sandbox/dts/test.dts
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,10 @@
remoteproc-name = "remoteproc-test-dev2";
};

smem@0 {
compatible = "sandbox,smem";
};

spi@0 {
#address-cells = <1>;
#size-cells = <0>;
Expand Down
2 changes: 2 additions & 0 deletions configs/sandbox64_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,5 @@ CONFIG_UT_TIME=y
CONFIG_UT_DM=y
CONFIG_UT_ENV=y
CONFIG_UT_OVERLAY=y
CONFIG_SMEM=y
CONFIG_SANDBOX_SMEM=y
2 changes: 2 additions & 0 deletions configs/sandbox_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,5 @@ CONFIG_UT_TIME=y
CONFIG_UT_DM=y
CONFIG_UT_ENV=y
CONFIG_UT_OVERLAY=y
CONFIG_SMEM=y
CONFIG_SANDBOX_SMEM=y
9 changes: 9 additions & 0 deletions drivers/smem/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions drivers/smem/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
45 changes: 45 additions & 0 deletions drivers/smem/sandbox_smem.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (c) 2018 Ramon Fried <[email protected]>
*/

#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,
};

0 comments on commit 7fd7e2c

Please sign in to comment.