mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
Make acpi/ec.c usable in romstage
On X201 to enable EHCI debug you need to go through EC if USB power is disabled so we need to inclue ec.c. Change-Id: I8f8b7de639ecaebceaa53cd338136befaeec8214 Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> Reviewed-on: http://review.coreboot.org/3405 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
parent
7d1ebbff5a
commit
fe50d0bcfe
2 changed files with 14 additions and 0 deletions
|
@ -1,2 +1,3 @@
|
||||||
ramstage-y += ec.c
|
ramstage-y += ec.c
|
||||||
smm-$(CONFIG_HAVE_SMI_HANDLER) += ec.c
|
smm-$(CONFIG_HAVE_SMI_HANDLER) += ec.c
|
||||||
|
romstage-$(CONFIG_BOARD_LENOVO_X201) += ec.c
|
||||||
|
|
|
@ -25,9 +25,18 @@
|
||||||
#include <delay.h>
|
#include <delay.h>
|
||||||
#include "ec.h"
|
#include "ec.h"
|
||||||
|
|
||||||
|
#ifdef __PRE_RAM__
|
||||||
|
|
||||||
|
static const int ec_cmd_reg = EC_SC;
|
||||||
|
static const int ec_data_reg = EC_DATA;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
static int ec_cmd_reg = EC_SC;
|
static int ec_cmd_reg = EC_SC;
|
||||||
static int ec_data_reg = EC_DATA;
|
static int ec_data_reg = EC_DATA;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
int send_ec_command(u8 command)
|
int send_ec_command(u8 command)
|
||||||
{
|
{
|
||||||
int timeout;
|
int timeout;
|
||||||
|
@ -132,12 +141,16 @@ void ec_clr_bit(u8 addr, u8 bit)
|
||||||
ec_write(addr, ec_read(addr) & ~(1 << bit));
|
ec_write(addr, ec_read(addr) & ~(1 << bit));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __PRE_RAM__
|
||||||
|
|
||||||
void ec_set_ports(u16 cmd_reg, u16 data_reg)
|
void ec_set_ports(u16 cmd_reg, u16 data_reg)
|
||||||
{
|
{
|
||||||
ec_cmd_reg = cmd_reg;
|
ec_cmd_reg = cmd_reg;
|
||||||
ec_data_reg = data_reg;
|
ec_data_reg = data_reg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(__SMM__) && !defined(__PRE_RAM__)
|
#if !defined(__SMM__) && !defined(__PRE_RAM__)
|
||||||
struct chip_operations ec_acpi_ops = {
|
struct chip_operations ec_acpi_ops = {
|
||||||
CHIP_NAME("ACPI Embedded Controller")
|
CHIP_NAME("ACPI Embedded Controller")
|
||||||
|
|
Loading…
Add table
Reference in a new issue