From: Ramon Fried <ramon.fried@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 5/6] drivers: smem: sandbox
Date: Fri, 22 Jun 2018 05:11:32 +0300 [thread overview]
Message-ID: <20180622021133.24062-6-ramon.fried@gmail.com> (raw)
In-Reply-To: <20180622021133.24062-1-ramon.fried@gmail.com>
Add Sandbox driver for SMEM. mostly stub operations.
Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
---
Changes in v2: None
arch/sandbox/dts/test.dts | 4 ++++
configs/sandbox64_defconfig | 2 ++
configs/sandbox_defconfig | 2 ++
drivers/smem/Kconfig | 9 ++++++++
drivers/smem/Makefile | 1 +
drivers/smem/sandbox_smem.c | 45 +++++++++++++++++++++++++++++++++++++
6 files changed, 63 insertions(+)
create mode 100644 drivers/smem/sandbox_smem.c
diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 5752bf547e..01e6bc0367 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -382,6 +382,10 @@
remoteproc-name = "remoteproc-test-dev2";
};
+ smem at 0 {
+ compatible = "sandbox,smem";
+ };
+
spi at 0 {
#address-cells = <1>;
#size-cells = <0>;
diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig
index 20a2ab3ffb..1fa85a819c 100644
--- a/configs/sandbox64_defconfig
+++ b/configs/sandbox64_defconfig
@@ -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
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 2fc84a16c9..47f6bfd87f 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -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
diff --git a/drivers/smem/Kconfig b/drivers/smem/Kconfig
index 77ad02e236..3aa32a6c13 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,
+};
--
2.17.1
next prev parent reply other threads:[~2018-06-22 2:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20180622021133.24062-1-ramon.fried@gmail.com>
2018-06-22 2:11 ` [U-Boot] [PATCH v2 1/6] dm: SMEM (Shared memory) uclass Ramon Fried
2018-06-26 3:59 ` Simon Glass
2018-06-25 22:54 ` Ramon Fried
2018-06-26 10:15 ` Ramon Fried
2018-06-26 23:18 ` Simon Glass
2018-06-28 10:21 ` Ramon Fried
2018-06-26 6:39 ` Dr. Philipp Tomsich
2018-06-26 14:41 ` Ramon Fried
2018-06-22 2:11 ` [U-Boot] [PATCH v2 2/6] soc: qualcomm: Add Shared Memory Manager driver Ramon Fried
2018-06-26 3:59 ` Simon Glass
2018-06-22 2:11 ` [U-Boot] [PATCH v2 3/6] dts: db410c: added smem nodes Ramon Fried
2018-06-26 3:59 ` Simon Glass
2018-06-22 2:11 ` [U-Boot] [PATCH v2 4/6] dts: db820c: " Ramon Fried
2018-06-26 3:59 ` Simon Glass
2018-06-22 2:11 ` Ramon Fried [this message]
2018-06-26 4:00 ` [U-Boot] [PATCH v2 5/6] drivers: smem: sandbox Simon Glass
2018-06-22 2:11 ` [U-Boot] [PATCH v2 6/6] test: smem: add basic smem test Ramon Fried
2018-06-26 3:59 ` Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180622021133.24062-6-ramon.fried@gmail.com \
--to=ramon.fried@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox