From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Sun, 12 Jun 2016 23:33:02 -0600 Subject: [U-Boot] [PATCH v2 21/55] dm: sandbox: Add a simple driver to test of-platdata In-Reply-To: <1465796016-18375-1-git-send-email-sjg@chromium.org> References: <1465796016-18375-1-git-send-email-sjg@chromium.org> Message-ID: <1465796016-18375-22-git-send-email-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Add a driver which uses of-platdata to obtain its platform data. This can be used to test the feature in sandbox. Signed-off-by: Simon Glass --- Changes in v2: None drivers/misc/Makefile | 5 +++++ drivers/misc/spltest_sandbox.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 drivers/misc/spltest_sandbox.c diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 066639b..3eac024 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -35,6 +35,11 @@ obj-$(CONFIG_SMSC_LPC47M) += smsc_lpc47m.o obj-$(CONFIG_SMSC_SIO1007) += smsc_sio1007.o obj-$(CONFIG_STATUS_LED) += status_led.o obj-$(CONFIG_SANDBOX) += swap_case.o +ifdef CONFIG_SPL_OF_PLATDATA +ifdef CONFIG_SPL_BUILD +obj-$(CONFIG_SANDBOX) += spltest_sandbox.o +endif +endif obj-$(CONFIG_SANDBOX) += syscon_sandbox.o obj-$(CONFIG_TWL4030_LED) += twl4030_led.o obj-$(CONFIG_FSL_IFC) += fsl_ifc.o diff --git a/drivers/misc/spltest_sandbox.c b/drivers/misc/spltest_sandbox.c new file mode 100644 index 0000000..ac4d10c --- /dev/null +++ b/drivers/misc/spltest_sandbox.c @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 Google, Inc + * Written by Simon Glass + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +static int sandbox_spl_probe(struct udevice *dev) +{ + struct dtd_sandbox_spl_test *plat = dev_get_platdata(dev); + + printf("here %s\n", plat->string); + + return 0; +} + +U_BOOT_DRIVER(sandbox_spl_test) = { + .name = "sandbox_spl_test", + .id = UCLASS_MISC, + .flags = DM_FLAG_PRE_RELOC, + .probe = sandbox_spl_probe, +}; -- 2.8.0.rc3.226.g39d4020