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