summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-03-26 09:29:31 -0600
committerSimon Glass <sjg@chromium.org>2015-04-18 11:11:15 -0600
commite96fc7dfc835b282521c2a661a479f0563c653b5 (patch)
treee968d30d3908021b81f1675ab98afe6a1c803f05 /drivers/misc
parent72a38e06a20129209eaa0e5211cbf50b192de688 (diff)
downloadu-boot-imx-e96fc7dfc835b282521c2a661a479f0563c653b5.zip
u-boot-imx-e96fc7dfc835b282521c2a661a479f0563c653b5.tar.gz
u-boot-imx-e96fc7dfc835b282521c2a661a479f0563c653b5.tar.bz2
cros_ec: Reinit the cros_ec device when 'crosec init' is used
This command is supposed to reinit the device. At present with driver model is does nothing. Implement this feature. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/cros_ec.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c
index efcad89..6d4d045 100644
--- a/drivers/misc/cros_ec.c
+++ b/drivers/misc/cros_ec.c
@@ -1606,13 +1606,19 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
cmd = argv[1];
if (0 == strcmp("init", cmd)) {
-#ifndef CONFIG_DM_CROS_EC
+#ifdef CONFIG_DM_CROS_EC
+ /* Remove any existing device */
+ ret = uclass_find_device(UCLASS_CROS_EC, 0, &udev);
+ if (!ret)
+ device_remove(udev);
+ ret = uclass_get_device(UCLASS_CROS_EC, 0, &udev);
+#else
ret = cros_ec_init(gd->fdt_blob, &dev);
+#endif
if (ret) {
printf("Could not init cros_ec device (err %d)\n", ret);
return 1;
}
-#endif
return 0;
}