[coreboot-gerrit] New patch to review for coreboot: 3f20f29 hp/pavilion_m6_1035dx: Add basic EC initialization

Alexandru Gagniuc (mr.nuke.me@gmail.com) gerrit at coreboot.org
Mon Apr 7 07:12:10 CEST 2014


Alexandru Gagniuc (mr.nuke.me at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5471

-gerrit

commit 3f20f2951295d662343476b65416b20ce75b2791
Author: Alexandru Gagniuc <mr.nuke.me at gmail.com>
Date:   Sun Apr 6 23:57:57 2014 -0500

    hp/pavilion_m6_1035dx: Add basic EC initialization
    
    The EC is now set to ACPI mode, and properly generates SCIs on
    external events. This fixes the issue where battery notifications were
    not working.
    
    Change-Id: Ib6f0d23984d4ed1320340282469b8325c83547d1
    Signed-off-by: Alexandru Gagniuc <mr.nuke.me at gmail.com>
---
 src/mainboard/hp/pavilion_m6_1035dx/Makefile.inc |  1 +
 src/mainboard/hp/pavilion_m6_1035dx/ec.c         | 27 ++++++++++++++++++++++++
 src/mainboard/hp/pavilion_m6_1035dx/ec.h         |  6 ++++++
 src/mainboard/hp/pavilion_m6_1035dx/mainboard.c  |  4 ++++
 4 files changed, 38 insertions(+)

diff --git a/src/mainboard/hp/pavilion_m6_1035dx/Makefile.inc b/src/mainboard/hp/pavilion_m6_1035dx/Makefile.inc
index 3103f70..07ea765 100644
--- a/src/mainboard/hp/pavilion_m6_1035dx/Makefile.inc
+++ b/src/mainboard/hp/pavilion_m6_1035dx/Makefile.inc
@@ -26,3 +26,4 @@ ramstage-y += buildOpts.c
 ramstage-y += agesawrapper.c
 ramstage-y += BiosCallOuts.c
 ramstage-y += PlatformGnbPcie.c
+ramstage-y += ec.c
diff --git a/src/mainboard/hp/pavilion_m6_1035dx/ec.c b/src/mainboard/hp/pavilion_m6_1035dx/ec.c
new file mode 100644
index 0000000..d6d7229
--- /dev/null
+++ b/src/mainboard/hp/pavilion_m6_1035dx/ec.c
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2014 Alexandru Gagniuc <mr.nuke.me at gmail.com>
+ * Subject to the GNU GPL v2, or (at your option) any later version.
+ */
+
+#include "ec.h"
+#include <ec/compal/ene932/ec.h>
+
+static void set_us_keyboard_layout(void)
+{
+	ec_kbc_write_cmd(0x59);
+	ec_kbc_write_ib(0xE5);
+}
+
+/* Tell EC to operate in ACPI mode, thus generating SCIs on events, not SMIs */
+static void enter_acpi_mode(void)
+{
+	ec_kbc_write_cmd(0x59);
+	ec_kbc_write_ib(0xE8);
+}
+
+void pavilion_m6_1035dx_ec_init(void)
+{
+	set_us_keyboard_layout();
+	/* This could also be done in an SMI, should we decide to use SMM */
+	enter_acpi_mode();
+}
diff --git a/src/mainboard/hp/pavilion_m6_1035dx/ec.h b/src/mainboard/hp/pavilion_m6_1035dx/ec.h
new file mode 100644
index 0000000..672141d
--- /dev/null
+++ b/src/mainboard/hp/pavilion_m6_1035dx/ec.h
@@ -0,0 +1,6 @@
+/*
+ * Copyright (C) 2014 Alexandru Gagniuc <mr.nuke.me at gmail.com>
+ * Subject to the GNU GPL v2, or (at your option) any later version.
+ */
+
+void pavilion_m6_1035dx_ec_init(void);
diff --git a/src/mainboard/hp/pavilion_m6_1035dx/mainboard.c b/src/mainboard/hp/pavilion_m6_1035dx/mainboard.c
index 5ac478f..2e2b72b 100644
--- a/src/mainboard/hp/pavilion_m6_1035dx/mainboard.c
+++ b/src/mainboard/hp/pavilion_m6_1035dx/mainboard.c
@@ -19,6 +19,7 @@
 
 #include "agesawrapper.h"
 #include "BiosCallOuts.h"
+#include "ec.h"
 
 #include <arch/acpi.h>
 #include <arch/io.h>
@@ -35,6 +36,9 @@
 static void mainboard_enable(device_t dev)
 {
 	printk(BIOS_INFO, "Mainboard " CONFIG_MAINBOARD_PART_NUMBER " Enable.\n");
+
+	pavilion_m6_1035dx_ec_init();
+
 	/*
 	 * The mainboard is the first place that we get control in ramstage. Check
 	 * for S3 resume and call the approriate AGESA/CIMx resume functions.



More information about the coreboot-gerrit mailing list