summaryrefslogtreecommitdiff
path: root/board/samsung/smdk5250/exynos5-dt.c
diff options
context:
space:
mode:
authorHung-ying Tyan <tyanh@chromium.org>2013-05-15 18:27:34 +0800
committerTom Rini <trini@ti.com>2013-06-26 10:15:52 -0400
commiteb28fdac79bb145d6978abe86a2e0ad0a545319d (patch)
treef758d8cfa7c55f78eb31653afb276fec0cc633ed /board/samsung/smdk5250/exynos5-dt.c
parent60744a11878607d9e69c0579593688d817263abf (diff)
downloadu-boot-imx-eb28fdac79bb145d6978abe86a2e0ad0a545319d.zip
u-boot-imx-eb28fdac79bb145d6978abe86a2e0ad0a545319d.tar.gz
u-boot-imx-eb28fdac79bb145d6978abe86a2e0ad0a545319d.tar.bz2
cros: exynos: enable cros-ec for smdk5250
This patch initiates cros-ec in board_init() to enable it for smdk5250. This patch depends on the patch in the MMC series that brings in exynos5-dt.c. Refer to http://patchwork.ozlabs.org/patch/240084. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Signed-off-by: Hung-ying Tyan <tyanh@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'board/samsung/smdk5250/exynos5-dt.c')
-rw-r--r--board/samsung/smdk5250/exynos5-dt.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/board/samsung/smdk5250/exynos5-dt.c b/board/samsung/smdk5250/exynos5-dt.c
index 8131505..aacf43e 100644
--- a/board/samsung/smdk5250/exynos5-dt.c
+++ b/board/samsung/smdk5250/exynos5-dt.c
@@ -21,6 +21,7 @@
*/
#include <common.h>
+#include <cros_ec.h>
#include <fdtdec.h>
#include <asm/io.h>
#include <errno.h>
@@ -69,6 +70,13 @@ static void boot_temp_check(void)
}
#endif
+struct local_info {
+ struct cros_ec_dev *cros_ec_dev; /* Pointer to cros_ec device */
+ int cros_ec_err; /* Error for cros_ec, 0 if ok */
+};
+
+static struct local_info local;
+
#ifdef CONFIG_USB_EHCI_EXYNOS
int board_usb_vbus_init(void)
{
@@ -97,6 +105,20 @@ static void board_enable_audio_codec(void)
}
#endif
+struct cros_ec_dev *board_get_cros_ec_dev(void)
+{
+ return local.cros_ec_dev;
+}
+
+static int board_init_cros_ec_devices(const void *blob)
+{
+ local.cros_ec_err = cros_ec_init(blob, &local.cros_ec_dev);
+ if (local.cros_ec_err)
+ return -1; /* Will report in board_late_init() */
+
+ return 0;
+}
+
int board_init(void)
{
gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
@@ -112,6 +134,10 @@ int board_init(void)
#ifdef CONFIG_EXYNOS_SPI
spi_init();
#endif
+
+ if (board_init_cros_ec_devices(gd->fdt_blob))
+ return -1;
+
#ifdef CONFIG_USB_EHCI_EXYNOS
board_usb_vbus_init();
#endif
@@ -421,3 +447,22 @@ void exynos_set_dp_phy(unsigned int onoff)
set_dp_phy_ctrl(onoff);
}
#endif
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+ stdio_print_current_devices();
+
+ if (local.cros_ec_err) {
+ /* Force console on */
+ gd->flags &= ~GD_FLG_SILENT;
+
+ printf("cros-ec communications failure %d\n",
+ local.cros_ec_err);
+ puts("\nPlease reset with Power+Refresh\n\n");
+ panic("Cannot init cros-ec device");
+ return -1;
+ }
+ return 0;
+}
+#endif