All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hung-ying Tyan <tyanh@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 7/7] cros: enable cros-ec for smdk5250
Date: Tue,  2 Apr 2013 18:01:54 +0800	[thread overview]
Message-ID: <1364896914-17868-8-git-send-email-tyanh@chromium.org> (raw)
In-Reply-To: <1364896914-17868-1-git-send-email-tyanh@chromium.org>

This patch initiates cros-ec in board_init() to enable it for smdk5250.

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>
---
Changes in v4: None
Changes in v3: None
Changes in v2:
- Moved code from smdk5250.c (non-FDT) to exynos5-dt.c (FDT).
- Moved code from smdk5250.h to exynos5250-dt.h.
- Added commit message.
- Dropped the period from commit subject.

 board/samsung/smdk5250/exynos5-dt.c | 45 +++++++++++++++++++++++++++++++++++++
 include/configs/exynos5250-dt.h     | 10 ++++++++-
 2 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/board/samsung/smdk5250/exynos5-dt.c b/board/samsung/smdk5250/exynos5-dt.c
index b01fe72..8be3192 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>
@@ -39,6 +40,13 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+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)
 {
@@ -55,12 +63,30 @@ int board_usb_vbus_init(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);
 #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
@@ -337,3 +363,22 @@ int board_early_init_f(void)
 	return err;
 }
 #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
diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h
index 0721c17..80dfce7 100644
--- a/include/configs/exynos5250-dt.h
+++ b/include/configs/exynos5250-dt.h
@@ -77,11 +77,19 @@
 #define CONFIG_BAUDRATE			115200
 #define EXYNOS5_DEFAULT_UART_OFFSET	0x010000
 
+/* Enable keyboard */
+#define CONFIG_CROS_EC		/* CROS_EC protocol */
+#define CONFIG_CROS_EC_SPI		/* Support CROS_EC over SPI */
+#define CONFIG_CROS_EC_I2C		/* Support CROS_EC over I2C */
+#define CONFIG_CROS_EC_KEYB	/* CROS_EC keyboard input */
+#define CONFIG_CMD_CROS_EC
+#define CONFIG_KEYBOARD
+
 /* Console configuration */
 #define CONFIG_CONSOLE_MUX
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
 #define EXYNOS_DEVICE_SETTINGS \
-		"stdin=serial\0" \
+		"stdin=serial,cros-ec-keyb\0" \
 		"stdout=serial,lcd\0" \
 		"stderr=serial,lcd\0"
 
-- 
1.8.1.3

  parent reply	other threads:[~2013-04-02 10:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-02 10:01 [U-Boot] [PATCH v4 0/7] Add cros-ec protocol driver and enable it in smdk5250 Hung-ying Tyan
2013-04-02 10:01 ` [U-Boot] [PATCH v4 1/7] cros: add cros_ec driver Hung-ying Tyan
2013-04-04 20:13   ` Simon Glass
2013-04-02 10:01 ` [U-Boot] [PATCH v4 2/7] cros: add I2C support for cros_ec Hung-ying Tyan
2013-04-04 20:14   ` Simon Glass
2013-04-02 10:01 ` [U-Boot] [PATCH v4 3/7] cros: add SPI " Hung-ying Tyan
2013-04-04 20:14   ` Simon Glass
2013-04-02 10:01 ` [U-Boot] [PATCH v4 4/7] cros: add LPC " Hung-ying Tyan
2013-04-04 20:15   ` Simon Glass
2013-04-02 10:01 ` [U-Boot] [PATCH v4 5/7] cros: adds cros_ec keyboard driver Hung-ying Tyan
2013-04-04 20:15   ` Simon Glass
2013-04-02 10:01 ` [U-Boot] [PATCH v4 6/7] cros: exynos: add cros-ec device nodes to exynos5250-snow.dts Hung-ying Tyan
2013-04-04 20:16   ` Simon Glass
2013-04-02 10:01 ` Hung-ying Tyan [this message]
2013-04-04 20:17   ` [U-Boot] [PATCH v4 7/7] cros: enable cros-ec for smdk5250 Simon Glass
2013-04-16 20:42     ` Simon Glass
2013-04-04 20:18 ` [U-Boot] [PATCH v4 0/7] Add cros-ec protocol driver and enable it in smdk5250 Simon Glass
2013-04-30 16:07 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1364896914-17868-8-git-send-email-tyanh@chromium.org \
    --to=tyanh@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.