diff --git a/MAINTAINERS b/MAINTAINERS index 810f7b9609..924247edaf 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -378,6 +378,13 @@ F: src/mainboard/siemens/mc_apl1/ +SYSTEM76 MAINBOARDS +M: Jeremy Soller +S: Maintained +F: src/mainboard/system76/ + + + SUPERMICRO X10SLM+-F MAINBOARD M: Tristan Corrick S: Maintained @@ -438,6 +445,11 @@ M: Alexander Couzens S: Maintained F: src/ec/lenovo/ +SYSTEM76 EC +M: Jeremy Soller +S: Maintained +F: src/ec/system76/ + ################################################################################ # Northbridges ################################################################################ diff --git a/src/ec/system76/ec/Kconfig b/src/ec/system76/ec/Kconfig index 448771eb07..fea4743593 100644 --- a/src/ec/system76/ec/Kconfig +++ b/src/ec/system76/ec/Kconfig @@ -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 diff --git a/src/ec/system76/ec/Makefile.inc b/src/ec/system76/ec/Makefile.inc index d6daa7cbdb..382daa6581 100644 --- a/src/ec/system76/ec/Makefile.inc +++ b/src/ec/system76/ec/Makefile.inc @@ -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 diff --git a/src/ec/system76/ec/acpi/s76.asl b/src/ec/system76/ec/acpi/s76.asl index b65f3edcd3..7beb50b813 100644 --- a/src/ec/system76/ec/acpi/s76.asl +++ b/src/ec/system76/ec/acpi/s76.asl @@ -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) } diff --git a/src/ec/system76/ec/system76_ec.c b/src/ec/system76/ec/system76_ec.c index 3bf83a7f66..238e630971 100644 --- a/src/ec/system76/ec/system76_ec.c +++ b/src/ec/system76/ec/system76_ec.c @@ -1,49 +1,50 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + #include #include -#include +#include #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(); } diff --git a/src/include/console/system76_ec.h b/src/include/console/system76_ec.h index 83437880f1..616e46f4a2 100644 --- a/src/include/console/system76_ec.h +++ b/src/include/console/system76_ec.h @@ -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 diff --git a/src/mainboard/system76/addw2/Kconfig b/src/mainboard/system76/addw2/Kconfig index 3b65c0711c..f609ed65a8 100644 --- a/src/mainboard/system76/addw2/Kconfig +++ b/src/mainboard/system76/addw2/Kconfig @@ -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 diff --git a/src/mainboard/system76/cml-u/Kconfig b/src/mainboard/system76/cml-u/Kconfig index 0b8abcb275..10e2973536 100644 --- a/src/mainboard/system76/cml-u/Kconfig +++ b/src/mainboard/system76/cml-u/Kconfig @@ -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 diff --git a/src/mainboard/system76/gaze14/Kconfig b/src/mainboard/system76/gaze14/Kconfig index e2ae4cdd3f..1926ac3395 100644 --- a/src/mainboard/system76/gaze14/Kconfig +++ b/src/mainboard/system76/gaze14/Kconfig @@ -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 diff --git a/src/mainboard/system76/gaze15/Kconfig b/src/mainboard/system76/gaze15/Kconfig index f5a5cdaef4..2d925e3b31 100644 --- a/src/mainboard/system76/gaze15/Kconfig +++ b/src/mainboard/system76/gaze15/Kconfig @@ -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 diff --git a/src/mainboard/system76/lemp9/devicetree.cb b/src/mainboard/system76/lemp9/devicetree.cb index f3f6ccbdc6..476ed8d03a 100644 --- a/src/mainboard/system76/lemp9/devicetree.cb +++ b/src/mainboard/system76/lemp9/devicetree.cb @@ -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 diff --git a/src/mainboard/system76/lemp9/gpio.h b/src/mainboard/system76/lemp9/gpio.h index 312cd87bc8..97026161c6 100644 --- a/src/mainboard/system76/lemp9/gpio.h +++ b/src/mainboard/system76/lemp9/gpio.h @@ -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), diff --git a/src/mainboard/system76/oryp6/Kconfig b/src/mainboard/system76/oryp6/Kconfig index 14eaac0b52..4cea3aeed7 100644 --- a/src/mainboard/system76/oryp6/Kconfig +++ b/src/mainboard/system76/oryp6/Kconfig @@ -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 diff --git a/src/mainboard/system76/whl-u/Kconfig b/src/mainboard/system76/whl-u/Kconfig index 4887a8db79..5bb38fd10b 100644 --- a/src/mainboard/system76/whl-u/Kconfig +++ b/src/mainboard/system76/whl-u/Kconfig @@ -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