blob: 1fef8252ab8370fa9b47d452f064195ae4cff06e [file] [log] [blame]
Simon Glassbab82332016-07-04 11:58:01 -06001/*
2 * Copyright (c) 2016 Google, Inc
3 * Written by Simon Glass <sjg@chromium.org>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#include <common.h>
9#include <dm.h>
10#include <dt-structs.h>
11
12DECLARE_GLOBAL_DATA_PTR;
13
14static int sandbox_spl_probe(struct udevice *dev)
15{
16 struct dtd_sandbox_spl_test *plat = dev_get_platdata(dev);
17 int i;
18
19 printf("of-platdata probe:\n");
20 printf("bool %d\n", plat->boolval);
21
22 printf("byte %02x\n", plat->byteval);
23 printf("bytearray");
24 for (i = 0; i < sizeof(plat->bytearray); i++)
25 printf(" %02x", plat->bytearray[i]);
26 printf("\n");
27
28 printf("int %d\n", plat->intval);
29 printf("intarray");
30 for (i = 0; i < ARRAY_SIZE(plat->intarray); i++)
31 printf(" %d", plat->intarray[i]);
32 printf("\n");
33
34 printf("longbytearray");
35 for (i = 0; i < sizeof(plat->longbytearray); i++)
36 printf(" %02x", plat->longbytearray[i]);
37 printf("\n");
38
39 printf("string %s\n", plat->stringval);
40 printf("stringarray");
41 for (i = 0; i < ARRAY_SIZE(plat->stringarray); i++)
42 printf(" \"%s\"", plat->stringarray[i]);
43 printf("\n");
44
45 return 0;
46}
47
48U_BOOT_DRIVER(sandbox_spl_test) = {
49 .name = "sandbox_spl_test",
50 .id = UCLASS_MISC,
51 .flags = DM_FLAG_PRE_RELOC,
52 .probe = sandbox_spl_probe,
53};