mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 17:41:54 +00:00
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>
This commit is contained in:
committed by
chrome-internal-fetch
parent
ca9c2744ea
commit
83d082a1f2
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user