]>
Commit | Line | Data |
---|---|---|
41364f0f VB |
1 | /* |
2 | * Copyright (c) 2012 The Chromium OS Authors. All rights reserved. | |
3 | * Use of this source code is governed by a BSD-style license that can be | |
4 | * found in the LICENSE file. | |
5 | * | |
6 | * Alternatively, this software may be distributed under the terms of the | |
7 | * GNU General Public License ("GPL") version 2 as published by the Free | |
8 | * Software Foundation. | |
9 | */ | |
10 | ||
11 | #include <common.h> | |
12 | #include <cros_ec.h> | |
84d6cbd3 SG |
13 | #include <dm.h> |
14 | #include <errno.h> | |
15 | ||
41364f0f VB |
16 | DECLARE_GLOBAL_DATA_PTR; |
17 | ||
41364f0f VB |
18 | struct cros_ec_dev *board_get_cros_ec_dev(void) |
19 | { | |
84d6cbd3 SG |
20 | struct udevice *dev; |
21 | int ret; | |
22 | ||
23 | ret = uclass_get_device(UCLASS_CROS_EC, 0, &dev); | |
24 | if (ret) { | |
25 | debug("%s: Error %d\n", __func__, ret); | |
26 | return NULL; | |
27 | } | |
e564f054 | 28 | return dev_get_uclass_priv(dev); |
41364f0f VB |
29 | } |
30 | ||
41364f0f VB |
31 | int cros_ec_get_error(void) |
32 | { | |
84d6cbd3 SG |
33 | struct udevice *dev; |
34 | int ret; | |
35 | ||
36 | ret = uclass_get_device(UCLASS_CROS_EC, 0, &dev); | |
37 | if (ret && ret != -ENODEV) | |
38 | return ret; | |
39 | ||
40 | return 0; | |
41364f0f | 41 | } |