Jonathon Hall has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/74363 )
Change subject: mb/purism/librem_cnl: Provide CBFS setting for Mini auto power on ......................................................................
mb/purism/librem_cnl: Provide CBFS setting for Mini auto power on
Control Mini v2 automatic power on by adding a 'board_settings' file to CBFS. This allows us to use one build for Mini v1/v2 that is just configured differently. By default, the EC setting is not configured by coreboot, and the OS could configure it.
Add ITE SuperIO configuration to device tree and configure base address of BRAM1. (BRAM1 contains the EC firmware setting for automatic power on.)
Test: Build Mini v2, boot with no settings in CBFS. Add board_settings configured for automatic power-on, flash, boot, confirm EC now powers on automatically when power applied.
Change-Id: Ib0a4ea02d71f6f99e344484726a629e0552e4941 Signed-off-by: Jonathon Hall jonathon.hall@puri.sm --- M src/mainboard/purism/librem_cnl/Kconfig.name M src/mainboard/purism/librem_cnl/variants/librem_mini/Makefile.inc A src/mainboard/purism/librem_cnl/variants/librem_mini/mainboard.c M src/mainboard/purism/librem_cnl/variants/librem_mini/overridetree.cb 4 files changed, 96 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/63/74363/1
diff --git a/src/mainboard/purism/librem_cnl/Kconfig.name b/src/mainboard/purism/librem_cnl/Kconfig.name index ad22009..a575e44 100644 --- a/src/mainboard/purism/librem_cnl/Kconfig.name +++ b/src/mainboard/purism/librem_cnl/Kconfig.name @@ -2,11 +2,13 @@ bool "Librem Mini" select BOARD_PURISM_BASEBOARD_LIBREM_CNL select SOC_INTEL_WHISKEYLAKE + select SUPERIO_ITE_IT8528E
config BOARD_PURISM_LIBREM_MINI_V2 bool "Librem Mini v2" select BOARD_PURISM_BASEBOARD_LIBREM_CNL select SOC_INTEL_COMETLAKE_1 + select SUPERIO_ITE_IT8528E
config BOARD_PURISM_LIBREM_14 bool "Librem 14" diff --git a/src/mainboard/purism/librem_cnl/variants/librem_mini/Makefile.inc b/src/mainboard/purism/librem_cnl/variants/librem_mini/Makefile.inc index 20ff438..c583603 100644 --- a/src/mainboard/purism/librem_cnl/variants/librem_mini/Makefile.inc +++ b/src/mainboard/purism/librem_cnl/variants/librem_mini/Makefile.inc @@ -2,3 +2,4 @@
all-y += die.c smm-y += die.c +ramstage-y += mainboard.c diff --git a/src/mainboard/purism/librem_cnl/variants/librem_mini/mainboard.c b/src/mainboard/purism/librem_cnl/variants/librem_mini/mainboard.c new file mode 100644 index 0000000..3401c43 --- /dev/null +++ b/src/mainboard/purism/librem_cnl/variants/librem_mini/mainboard.c @@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <arch/io.h> +#include <device/device.h> +#include <cbfs.h> + +/* Create a cbfs file called 'board_settings' to configure settings: + * Byte 0: EC automatic power on (EC_POWER_ON_*) + */ + +/* Unconfigured: Don't change the EC BRAM. The OS can configure if desired.*/ +#define EC_POWER_ON_UNCONFIGURED 0 +/* Enable: Configure the EC to power on automatically. */ +#define EC_POWER_ON_ENABLE 1 +/* Disable: Configure the EC to stay off. */ +#define EC_POWER_ON_DISABLE 2 + +static void mainboard_final(void *chip_info) +{ + /* There is just one setting currently */ + uint8_t ec_power_on = 0; + size_t board_settings_size = 0; + void *board_settings = cbfs_map("board_settings", &board_settings_size); + /* The board settings size can be larger for forward compatibility with + * future settings, which are ignored */ + if (board_settings && board_settings_size > 0) + memcpy(&ec_power_on, board_settings, 1); + + printk(BIOS_DEBUG, "ec_power_on=%d\n", ec_power_on); + switch (ec_power_on) { + case EC_POWER_ON_ENABLE: + outb(0x29, 0x360); /* Select offset 29h in BRAM bank 1 */ + outb(0x00, 0x361); /* Write 0 = automatic power on */ + break; + case EC_POWER_ON_DISABLE: + outb(0x29, 0x360); + outb(0x01, 0x361); /* Write 1 = stay off */ + break; + default: + break; + } +} + +struct chip_operations mainboard_ops = { + .final = mainboard_final +}; diff --git a/src/mainboard/purism/librem_cnl/variants/librem_mini/overridetree.cb b/src/mainboard/purism/librem_cnl/variants/librem_mini/overridetree.cb index 9270313..cab254a 100644 --- a/src/mainboard/purism/librem_cnl/variants/librem_mini/overridetree.cb +++ b/src/mainboard/purism/librem_cnl/variants/librem_mini/overridetree.cb @@ -150,5 +150,29 @@ register "PcieClkSrcClkReq[1]" = "1" smbios_slot_desc "SlotTypeM2Socket3" "SlotLengthOther" "M.2/M 2280" "SlotDataBusWidth4X" end + device pci 1f.0 on # LPC Bridge + chip superio/ite/it8528e + device pnp 2e.1 on # UART1 + io 0x60 = 0x3F8 + irq 0x70 = 0x04 + end + device pnp 2e.2 off end # UART2 + device pnp 2e.4 off end # System Wake-Up Control (SWUC) + device pnp 2e.5 off end # KBC/Mouse + device pnp 2e.6 off end # KBC/Keyboard + device pnp 2e.a off end # Consumer IR + device pnp 2e.f off end # Shared Memory/Flash Interface (SMFI) + device pnp 2e.10 on # RTC-like Timer + io 0x62 = 0x360 # BRAM1 I/O base address + end + device pnp 2e.11 off end # Power Management I/F Channel 1 (PMC1) + device pnp 2e.12 off end # Power Management I/F Channel 2 (PMC2) + device pnp 2e.13 off end # Serial Peripheral Interface (SSPI) + device pnp 2e.14 off end # Platform Environment Control Interface (PECI) + device pnp 2e.17 off end # Power Management I/F Channel 3 (PMC3) + device pnp 2e.18 off end # Power Management I/F Channel 4 (PMC4) + device pnp 2e.19 off end # Power Management I/F Channel 5 (PMC5) + end + end end end