#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;
#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;
}
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;
-}