summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/samsung/common/board.c10
-rw-r--r--board/sandbox/sandbox.c9
-rw-r--r--common/cros_ec.c12
3 files changed, 12 insertions, 19 deletions
diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
index c4b6baedf0..6fd26a3a91 100644
--- a/board/samsung/common/board.c
+++ b/board/samsung/common/board.c
@@ -306,14 +306,16 @@ int checkboard(void)
#ifdef CONFIG_BOARD_LATE_INIT
int board_late_init(void)
{
- stdio_print_current_devices();
+ struct udevice *dev;
+ int ret;
- if (cros_ec_get_error()) {
+ stdio_print_current_devices();
+ ret = uclass_first_device_err(UCLASS_CROS_EC, &dev);
+ if (ret && ret != -ENODEV) {
/* Force console on */
gd->flags &= ~GD_FLG_SILENT;
- printf("cros-ec communications failure %d\n",
- cros_ec_get_error());
+ printf("cros-ec communications failure %d\n", ret);
puts("\nPlease reset with Power+Refresh\n\n");
panic("Cannot init cros-ec device");
return -1;
diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c
index 0e87674826..397e7561d4 100644
--- a/board/sandbox/sandbox.c
+++ b/board/sandbox/sandbox.c
@@ -59,12 +59,15 @@ int board_init(void)
#ifdef CONFIG_BOARD_LATE_INIT
int board_late_init(void)
{
- if (cros_ec_get_error()) {
+ struct udevice *dev;
+ int ret;
+
+ ret = uclass_first_device_err(UCLASS_CROS_EC, &dev);
+ if (ret && ret != -ENODEV) {
/* Force console on */
gd->flags &= ~GD_FLG_SILENT;
- printf("cros-ec communications failure %d\n",
- cros_ec_get_error());
+ printf("cros-ec communications failure %d\n", ret);
puts("\nPlease reset with Power+Refresh\n\n");
panic("Cannot init cros-ec device");
return -1;
diff --git a/common/cros_ec.c b/common/cros_ec.c
index 4ca15e19d5..e66471ebd1 100644
--- a/common/cros_ec.c
+++ b/common/cros_ec.c
@@ -25,15 +25,3 @@ struct udevice *board_get_cros_ec_dev(void)
}
return dev;
}
-
-int cros_ec_get_error(void)
-{
- struct udevice *dev;
- int ret;
-
- ret = uclass_get_device(UCLASS_CROS_EC, 0, &dev);
- if (ret && ret != -ENODEV)
- return ret;
-
- return 0;
-}