Simon Glass | 750c482 | 2016-07-04 11:58:01 -0600 | [diff] [blame] | 1 | /* |
| 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 | |
Simon Glass | 750c482 | 2016-07-04 11:58:01 -0600 | [diff] [blame] | 12 | static int sandbox_spl_probe(struct udevice *dev) |
| 13 | { |
| 14 | struct dtd_sandbox_spl_test *plat = dev_get_platdata(dev); |
| 15 | int i; |
| 16 | |
| 17 | printf("of-platdata probe:\n"); |
| 18 | printf("bool %d\n", plat->boolval); |
| 19 | |
| 20 | printf("byte %02x\n", plat->byteval); |
| 21 | printf("bytearray"); |
| 22 | for (i = 0; i < sizeof(plat->bytearray); i++) |
| 23 | printf(" %02x", plat->bytearray[i]); |
| 24 | printf("\n"); |
| 25 | |
| 26 | printf("int %d\n", plat->intval); |
| 27 | printf("intarray"); |
| 28 | for (i = 0; i < ARRAY_SIZE(plat->intarray); i++) |
| 29 | printf(" %d", plat->intarray[i]); |
| 30 | printf("\n"); |
| 31 | |
| 32 | printf("longbytearray"); |
| 33 | for (i = 0; i < sizeof(plat->longbytearray); i++) |
| 34 | printf(" %02x", plat->longbytearray[i]); |
| 35 | printf("\n"); |
| 36 | |
| 37 | printf("string %s\n", plat->stringval); |
| 38 | printf("stringarray"); |
| 39 | for (i = 0; i < ARRAY_SIZE(plat->stringarray); i++) |
| 40 | printf(" \"%s\"", plat->stringarray[i]); |
| 41 | printf("\n"); |
| 42 | |
| 43 | return 0; |
| 44 | } |
| 45 | |
| 46 | U_BOOT_DRIVER(sandbox_spl_test) = { |
| 47 | .name = "sandbox_spl_test", |
| 48 | .id = UCLASS_MISC, |
| 49 | .flags = DM_FLAG_PRE_RELOC, |
| 50 | .probe = sandbox_spl_probe, |
| 51 | }; |