blob: b5485e9895b8b9a529bc617dcdddb14bc1931fd2 [file] [log] [blame]
Mario Six5381c282018-07-31 11:44:11 +02001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2017
4 * Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
5 */
6
7#include <common.h>
8#include <dm.h>
9#include <board.h>
10
11int board_get(struct udevice **devp)
12{
13 return uclass_first_device_err(UCLASS_BOARD, devp);
14}
15
16int board_detect(struct udevice *dev)
17{
18 struct board_ops *ops = board_get_ops(dev);
19
20 if (!ops->detect)
21 return -ENOSYS;
22
23 return ops->detect(dev);
24}
25
Jean-Jacques Hiblotd42730e2019-10-22 16:39:19 +020026int board_get_fit_loadable(struct udevice *dev, int index,
27 const char *type, const char **strp)
28{
29 struct board_ops *ops = board_get_ops(dev);
30
31 if (!ops->get_fit_loadable)
32 return -ENOSYS;
33
34 return ops->get_fit_loadable(dev, index, type, strp);
35}
36
Mario Six5381c282018-07-31 11:44:11 +020037int board_get_bool(struct udevice *dev, int id, bool *val)
38{
39 struct board_ops *ops = board_get_ops(dev);
40
41 if (!ops->get_bool)
42 return -ENOSYS;
43
44 return ops->get_bool(dev, id, val);
45}
46
47int board_get_int(struct udevice *dev, int id, int *val)
48{
49 struct board_ops *ops = board_get_ops(dev);
50
51 if (!ops->get_int)
52 return -ENOSYS;
53
54 return ops->get_int(dev, id, val);
55}
56
57int board_get_str(struct udevice *dev, int id, size_t size, char *val)
58{
59 struct board_ops *ops = board_get_ops(dev);
60
61 if (!ops->get_str)
62 return -ENOSYS;
63
64 return ops->get_str(dev, id, size, val);
65}
66
67UCLASS_DRIVER(board) = {
68 .id = UCLASS_BOARD,
69 .name = "board",
70 .post_bind = dm_scan_fdt_dev,
71};