Sync changes from upstream PRs

Change-Id: If65cd6262ab625047edb8d242d00f520e4ff8d14
This commit is contained in:
Jeremy Soller
2020-07-21 09:09:38 -06:00
parent bccef94545
commit d563135d4b
14 changed files with 79 additions and 76 deletions

View File

@@ -378,6 +378,13 @@ F: src/mainboard/siemens/mc_apl1/
SYSTEM76 MAINBOARDS
M: Jeremy Soller <jeremy@system76.com>
S: Maintained
F: src/mainboard/system76/
SUPERMICRO X10SLM+-F MAINBOARD
M: Tristan Corrick <tristan@corrick.kiwi>
S: Maintained
@@ -438,6 +445,11 @@ M: Alexander Couzens <lynxis@fe80.eu>
S: Maintained
F: src/ec/lenovo/
SYSTEM76 EC
M: Jeremy Soller <jeremy@system76.com>
S: Maintained
F: src/ec/system76/
################################################################################
# Northbridges
################################################################################

View File

@@ -2,3 +2,8 @@ config EC_SYSTEM76_EC
bool
help
System76 EC
config EC_SYSTEM76_EC_COLOR_KEYBOARD
depends on EC_SYSTEM76_EC
bool
default n

View File

@@ -1,10 +1,6 @@
ifeq ($(CONFIG_EC_SYSTEM76_EC),y)
bootblock-y += system76_ec.c
verstage-y += system76_ec.c
romstage-y += system76_ec.c
postcar-y += system76_ec.c
ramstage-y += system76_ec.c
all-y += system76_ec.c
smm-$(CONFIG_DEBUG_SMI) += system76_ec.c
endif

View File

@@ -14,9 +14,9 @@ Device (S76D) {
Debug = "S76D: RSET"
SAPL(0)
SKBL(0)
#if EC_COLOR_KEYBOARD
#if CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD)
SKBC(0xFFFFFF)
#endif
#endif // CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD)
}
Method (INIT, 0, Serialized) {
@@ -64,7 +64,7 @@ Device (S76D) {
}
}
#if EC_COLOR_KEYBOARD
#if CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD)
// Set KB LED Brightness
Method (SKBL, 1, Serialized) {
If (^^PCI0.LPCB.EC0.ECOK) {
@@ -89,7 +89,7 @@ Device (S76D) {
Return (0)
}
}
#else
#else // CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD)
// Get KB LED
Method (GKBL, 0, Serialized) {
Local0 = 0
@@ -110,5 +110,5 @@ Device (S76D) {
^^PCI0.LPCB.EC0.FCMD = 0xCA
}
}
#endif
#endif // CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD)
}

View File

@@ -1,49 +1,50 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <arch/io.h>
#include <console/system76_ec.h>
#include <delay.h>
#include <timer.h>
#define SYSTEM76_EC_BASE 0x0E00
static inline uint8_t system76_ec_read(uint8_t addr) {
return inb(SYSTEM76_EC_BASE + (uint16_t)addr);
static inline uint8_t system76_ec_read(uint8_t addr)
{
return inb(SYSTEM76_EC_BASE + (uint16_t)addr);
}
static inline void system76_ec_write(uint8_t addr, uint8_t data) {
outb(data, SYSTEM76_EC_BASE + (uint16_t)addr);
static inline void system76_ec_write(uint8_t addr, uint8_t data)
{
outb(data, SYSTEM76_EC_BASE + (uint16_t)addr);
}
void system76_ec_init(void) {
// Clear entire command region
for (int i = 0; i < 256; i++) {
system76_ec_write((uint8_t)i, 0);
}
void system76_ec_init(void)
{
// Clear entire command region
for (int i = 0; i < 256; i++)
system76_ec_write((uint8_t)i, 0);
}
void system76_ec_flush(void) {
// Send command
system76_ec_write(0, 4);
void system76_ec_flush(void)
{
// Send command
system76_ec_write(0, 4);
// Wait for command completion, for up to 10 milliseconds
int timeout;
for (timeout = 10000; timeout > 0; timeout--) {
if (system76_ec_read(0) == 0) break;
udelay(1);
}
// Wait for command completion, for up to 10 milliseconds
wait_us(10000, system76_ec_read(0) == 0);
// Clear length
system76_ec_write(3, 0);
// Clear length
system76_ec_write(3, 0);
}
void system76_ec_print(uint8_t byte) {
// Read length
uint8_t len = system76_ec_read(3);
// Write data at offset
system76_ec_write(len + 4, byte);
// Update length
system76_ec_write(3, len + 1);
void system76_ec_print(uint8_t byte)
{
// Read length
uint8_t len = system76_ec_read(3);
// Write data at offset
system76_ec_write(len + 4, byte);
// Update length
system76_ec_write(3, len + 1);
// If we hit the end of the buffer, or were given a newline, flush
if (byte == '\n' || len >= 128) {
system76_ec_flush();
}
// If we hit the end of the buffer, or were given a newline, flush
if (byte == '\n' || len >= 128)
system76_ec_flush();
}

View File

@@ -9,17 +9,21 @@ void system76_ec_flush(void);
void system76_ec_print(uint8_t byte);
#define __CONSOLE_SYSTEM76_EC_ENABLE__ (CONFIG(CONSOLE_SYSTEM76_EC) && \
(ENV_BOOTBLOCK || ENV_ROMSTAGE || ENV_RAMSTAGE || ENV_SEPARATE_VERSTAGE \
|| ENV_POSTCAR || (ENV_SMM && CONFIG(DEBUG_SMI))))
(ENV_BOOTBLOCK || ENV_ROMSTAGE || ENV_RAMSTAGE \
|| ENV_SEPARATE_VERSTAGE || ENV_POSTCAR \
|| (ENV_SMM && CONFIG(DEBUG_SMI))))
#if __CONSOLE_SYSTEM76_EC_ENABLE__
static inline void __system76_ec_init(void) {
system76_ec_init();
static inline void __system76_ec_init(void)
{
system76_ec_init();
}
static inline void __system76_ec_tx_flush(void) {
system76_ec_flush();
static inline void __system76_ec_tx_flush(void)
{
system76_ec_flush();
}
static inline void __system76_ec_tx_byte(unsigned char byte) {
static inline void __system76_ec_tx_byte(unsigned char byte)
{
system76_ec_print(byte);
}
#else

View File

@@ -7,6 +7,7 @@ config BOARD_SPECIFIC_OPTIONS
select DRIVERS_I2C_TAS5825M
select DRIVERS_SYSTEM76_DGPU
select EC_SYSTEM76_EC
select EC_SYSTEM76_EC_COLOR_KEYBOARD
select HAVE_ACPI_RESUME
select HAVE_ACPI_TABLES
select HAVE_SMI_HANDLER

View File

@@ -5,6 +5,7 @@ config BOARD_SPECIFIC_OPTIONS
select BOARD_ROMSIZE_KB_16384
select DRIVERS_I2C_HID
select EC_SYSTEM76_EC
select EC_SYSTEM76_EC_COLOR_KEYBOARD if BOARD_SYSTEM76_DARP6
select HAVE_ACPI_RESUME
select HAVE_ACPI_TABLES
select HAVE_CMOS_DEFAULT

View File

@@ -6,6 +6,7 @@ config BOARD_SPECIFIC_OPTIONS
select DRIVERS_I2C_HID
select DRIVERS_SYSTEM76_DGPU
select EC_SYSTEM76_EC
select EC_SYSTEM76_EC_COLOR_KEYBOARD
select HAVE_ACPI_RESUME
select HAVE_ACPI_TABLES
select HAVE_SMI_HANDLER

View File

@@ -6,6 +6,7 @@ config BOARD_SPECIFIC_OPTIONS
select DRIVERS_I2C_HID
select DRIVERS_SYSTEM76_DGPU
select EC_SYSTEM76_EC
select EC_SYSTEM76_EC_COLOR_KEYBOARD
select HAVE_ACPI_RESUME
select HAVE_ACPI_TABLES
select HAVE_SMI_HANDLER

View File

@@ -1,7 +1,7 @@
chip soc/intel/cannonlake
# Lock Down
register "common_soc_config" = "{
.chipset_lockdown = CHIPSET_LOCKDOWN_COREBOOT,
/* Touchpad */
.i2c[0] = {
.speed = I2C_SPEED_FAST,
.rise_time_ns = 80,
@@ -13,7 +13,7 @@ chip soc/intel/cannonlake
register "SendVrMbxCmd" = "2"
# ACPI (soc/intel/cannonlake/acpi.c)
# Enable s0ix
# Disable s0ix
register "s0ix_enable" = "0"
# PM Timer Enabled
@@ -42,18 +42,8 @@ chip soc/intel/cannonlake
# FSP Silicon (soc/intel/cannonlake/fsp_params.c)
# Serial I/O
register "SerialIoDevMode" = "{
[PchSerialIoIndexI2C0] = PchSerialIoPci,
[PchSerialIoIndexI2C1] = PchSerialIoDisabled,
[PchSerialIoIndexI2C2] = PchSerialIoPci,
[PchSerialIoIndexI2C3] = PchSerialIoDisabled,
[PchSerialIoIndexI2C4] = PchSerialIoDisabled,
[PchSerialIoIndexI2C5] = PchSerialIoDisabled,
[PchSerialIoIndexSPI0] = PchSerialIoDisabled,
[PchSerialIoIndexSPI1] = PchSerialIoDisabled,
[PchSerialIoIndexSPI2] = PchSerialIoDisabled,
[PchSerialIoIndexUART0] = PchSerialIoDisabled,
[PchSerialIoIndexUART1] = PchSerialIoDisabled,
[PchSerialIoIndexUART2] = PchSerialIoPci,
[PchSerialIoIndexI2C0] = PchSerialIoPci, // Touchpad
[PchSerialIoIndexUART2] = PchSerialIoSkipInit, // LPSS UART
}"
# SATA
@@ -166,9 +156,6 @@ chip soc/intel/cannonlake
# Thermal
register "tcc_offset" = "12"
# Serial IRQ Continuous
register "serirq_mode" = "SERIRQ_CONTINUOUS"
# Graphics (soc/intel/cannonlake/graphics.c)
register "gfx" = "GMA_STATIC_DISPLAYS(0)"
@@ -183,14 +170,6 @@ chip soc/intel/cannonlake
# Address 0x90: Decode 0xF00 - 0xFFF (AP/EC debug)
register "gen4_dec" = "0x00fc0F01"
# PMC (soc/intel/cannonlake/pmc.c)
# Enable deep Sx states
register "deep_s3_enable_ac" = "0"
register "deep_s3_enable_dc" = "0"
register "deep_s5_enable_ac" = "0"
register "deep_s5_enable_dc" = "0"
register "deep_sx_config" = "0"
# PM Util (soc/intel/cannonlake/pmutil.c)
# GPE configuration
# Note that GPE events called out in ASL code rely on this
@@ -230,7 +209,7 @@ chip soc/intel/cannonlake
register "hid_desc_reg_offset" = "0x01"
device i2c 15 on end
end
end # I2C #0
end # I2C #0
device pci 15.1 off end # I2C #1
device pci 15.2 off end # I2C #2
device pci 15.3 off end # I2C #3

View File

@@ -140,7 +140,7 @@ static const struct pad_config gpio_table[] = {
// CPU Misc
// GPP_B3 (touchpad interrupt)
PAD_CFG_GPI_APIC(GPP_B3, NONE, PLTRST, EDGE_SINGLE, INVERT),
PAD_CFG_GPI_APIC_EDGE_LOW(GPP_B3, NONE, PLTRST),
// NC
PAD_CFG_NC(GPP_B4),

View File

@@ -7,6 +7,7 @@ config BOARD_SPECIFIC_OPTIONS
select DRIVERS_I2C_TAS5825M
select DRIVERS_SYSTEM76_DGPU
select EC_SYSTEM76_EC
select EC_SYSTEM76_EC_COLOR_KEYBOARD
select HAVE_ACPI_RESUME
select HAVE_ACPI_TABLES
select HAVE_SMI_HANDLER

View File

@@ -5,6 +5,7 @@ config BOARD_SPECIFIC_OPTIONS
select BOARD_ROMSIZE_KB_16384
select DRIVERS_I2C_HID
select EC_SYSTEM76_EC
select EC_SYSTEM76_EC_COLOR_KEYBOARD if BOARD_SYSTEM76_DARP5
select HAVE_ACPI_RESUME
select HAVE_ACPI_TABLES
select HAVE_CMOS_DEFAULT