]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
39f7611f SG |
2 | /* |
3 | * Copyright (c) 2013 Google, Inc | |
4 | * | |
5 | * (C) Copyright 2012 | |
6 | * Pavel Herrmann <[email protected]> | |
39f7611f SG |
7 | */ |
8 | ||
9 | #include <common.h> | |
10 | #include <dm.h> | |
11 | #include <dm-demo.h> | |
0eb25b61 | 12 | #include <mapmem.h> |
39f7611f SG |
13 | #include <asm/io.h> |
14 | ||
54c5d08a | 15 | static int simple_hello(struct udevice *dev, int ch) |
39f7611f | 16 | { |
c69cda25 | 17 | const struct dm_demo_pdata *pdata = dev_get_plat(dev); |
39f7611f | 18 | |
c6b89f31 | 19 | printf("Hello from %08x: %s %d\n", (uint)map_to_sysmem(dev), pdata->colour, |
39f7611f SG |
20 | pdata->sides); |
21 | ||
22 | return 0; | |
23 | } | |
24 | ||
25 | static const struct demo_ops simple_ops = { | |
26 | .hello = simple_hello, | |
27 | }; | |
28 | ||
d1998a9f | 29 | static int demo_shape_of_to_plat(struct udevice *dev) |
39f7611f SG |
30 | { |
31 | /* Parse the data that is common with all demo devices */ | |
32 | return demo_parse_dt(dev); | |
33 | } | |
34 | ||
ae7f4513 | 35 | static const struct udevice_id demo_shape_id[] = { |
39f7611f SG |
36 | { "demo-simple", 0 }, |
37 | { }, | |
38 | }; | |
39 | ||
40 | U_BOOT_DRIVER(demo_simple_drv) = { | |
41 | .name = "demo_simple_drv", | |
42 | .of_match = demo_shape_id, | |
43 | .id = UCLASS_DEMO, | |
d1998a9f | 44 | .of_to_plat = demo_shape_of_to_plat, |
39f7611f | 45 | .ops = &simple_ops, |
caa4daa2 | 46 | .plat_auto = sizeof(struct dm_demo_pdata), |
39f7611f | 47 | }; |