summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic (Chun-Ju) Yang <victoryang@chromium.org>2014-01-16 16:02:09 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-01-17 18:06:58 +0000
commit83d082a1f2173da5e087d3a853096cd9b720bc26 (patch)
tree2a1bc3c418b36f0fe2ede92d9cde54e2d387df5a
parentca9c2744eace5c803a948502c032f99d602a0566 (diff)
downloadchrome-ec-83d082a1f2173da5e087d3a853096cd9b720bc26.tar.gz
mec1322: Use EMI module for port 80
EMI module is the only LPC module suitable for port 80 implementation, and thus let's move it to 0x80. Consequently the EMI mapped memory is moved to 0x82-0x87. BUG=chrome-os-partner:24107 TEST=Write to port 80 and see the data printed to console BRANCH=None Change-Id: I7d749650d6d109af2941a1db6e6c4a32e7482f61 Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/182796 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--chip/mec1322/lpc.c19
-rw-r--r--util/comm-mec1322.c12
2 files changed, 19 insertions, 12 deletions
diff --git a/chip/mec1322/lpc.c b/chip/mec1322/lpc.c
index 7974940e34..2e76b6c39e 100644
--- a/chip/mec1322/lpc.c
+++ b/chip/mec1322/lpc.c
@@ -12,6 +12,7 @@
#include "host_command.h"
#include "keyboard_protocol.h"
#include "lpc.h"
+#include "port80.h"
#include "registers.h"
#include "task.h"
#include "timer.h"
@@ -186,16 +187,16 @@ static void setup_lpc(void)
/* TODO(crosbug.com/p/24107): Route KIRQ to SER_IRQ1 */
- /* Set up EMI module for memory mapped region.
- * TODO(crosbug.com/p/24107): Use LPC memory transaction for this
- * when we have updated info of memory BAR
- * register.
- */
- MEC1322_LPC_EMI_BAR = 0x0800800f;
+ /* Set up EMI module for memory mapped region and port 80 */
+ MEC1322_LPC_EMI_BAR = 0x0080800f;
MEC1322_EMI_MBA0 = ptr;
MEC1322_EMI_MRL0 = 0x200;
MEC1322_EMI_MWL0 = 0x100;
+ MEC1322_INT_ENABLE(15) |= 1 << 2;
+ MEC1322_INT_BLK_EN |= 1 << 15;
+ task_enable_irq(MEC1322_IRQ_EMI);
+
/* We support LPC args and version 3 protocol */
*(lpc_get_memmap_range() + EC_MEMMAP_HOST_CMD_FLAGS) =
EC_HOST_CMD_FLAG_LPC_ARGS_SUPPORTED |
@@ -224,6 +225,12 @@ static void lpc_init(void)
*/
DECLARE_HOOK(HOOK_INIT, lpc_init, HOOK_PRIO_INIT_LPC);
+static void emi_interrupt(void)
+{
+ port_80_write(MEC1322_EMI_H2E_MBX);
+}
+DECLARE_IRQ(MEC1322_IRQ_EMI, emi_interrupt, 1);
+
static void acpi_0_interrupt(void)
{
uint8_t value, result, is_cmd;
diff --git a/util/comm-mec1322.c b/util/comm-mec1322.c
index d4b2c3ad00..dcbcb503bb 100644
--- a/util/comm-mec1322.c
+++ b/util/comm-mec1322.c
@@ -50,19 +50,19 @@ static int wait_for_ec(int status_addr, int timeout_usec)
static void write_memmap(uint8_t b, uint16_t addr)
{
addr -= 0x800;
- outb(addr & 0xfc, 0x802);
- outb((addr >> 8) & 0x7f, 0x803);
+ outb(addr & 0xfc, 0x82);
+ outb((addr >> 8) & 0x7f, 0x83);
usleep(500);
- outb(b, 0x804 + (addr & 0x3));
+ outb(b, 0x84 + (addr & 0x3));
}
static uint8_t read_memmap(uint16_t addr)
{
addr -= 0x800;
- outb(addr & 0xfc, 0x802);
- outb((addr >> 8) & 0x7f, 0x803);
+ outb(addr & 0xfc, 0x82);
+ outb((addr >> 8) & 0x7f, 0x83);
usleep(500);
- return inb(0x804 + (addr & 0x3));
+ return inb(0x84 + (addr & 0x3));
}
static void send_byte(uint8_t b, uint16_t addr)