From 32f3311f3e4b891fea3aad5dac8cff53c2a26db7 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Tue, 14 Sep 2021 10:36:50 -0600 Subject: [PATCH] Add oryp8 Change-Id: I28611cf59c9509726af250411a867a1898ec7ace --- src/mainboard/system76/oryp8/Kconfig | 83 ++ src/mainboard/system76/oryp8/Kconfig.name | 2 + src/mainboard/system76/oryp8/Makefile.inc | 5 + .../system76/oryp8/acpi/backlight.asl | 30 + src/mainboard/system76/oryp8/acpi/dgpu.asl | 32 + .../system76/oryp8/acpi/mainboard.asl | 14 + src/mainboard/system76/oryp8/acpi/sleep.asl | 46 + src/mainboard/system76/oryp8/board_info.txt | 8 + src/mainboard/system76/oryp8/bootblock.c | 11 + src/mainboard/system76/oryp8/cmos.default | 3 + src/mainboard/system76/oryp8/cmos.layout | 43 + src/mainboard/system76/oryp8/data.vbt | Bin 0 -> 8704 bytes src/mainboard/system76/oryp8/devicetree.cb | 252 ++++ src/mainboard/system76/oryp8/dsdt.asl | 32 + src/mainboard/system76/oryp8/gpio.h | 297 +++++ src/mainboard/system76/oryp8/hda_verb.c | 30 + src/mainboard/system76/oryp8/ramstage.c | 27 + src/mainboard/system76/oryp8/romstage.c | 34 + src/mainboard/system76/oryp8/tas5825m.c | 1080 +++++++++++++++++ 19 files changed, 2029 insertions(+) create mode 100644 src/mainboard/system76/oryp8/Kconfig create mode 100644 src/mainboard/system76/oryp8/Kconfig.name create mode 100644 src/mainboard/system76/oryp8/Makefile.inc create mode 100644 src/mainboard/system76/oryp8/acpi/backlight.asl create mode 100644 src/mainboard/system76/oryp8/acpi/dgpu.asl create mode 100644 src/mainboard/system76/oryp8/acpi/mainboard.asl create mode 100644 src/mainboard/system76/oryp8/acpi/sleep.asl create mode 100644 src/mainboard/system76/oryp8/board_info.txt create mode 100644 src/mainboard/system76/oryp8/bootblock.c create mode 100644 src/mainboard/system76/oryp8/cmos.default create mode 100644 src/mainboard/system76/oryp8/cmos.layout create mode 100644 src/mainboard/system76/oryp8/data.vbt create mode 100644 src/mainboard/system76/oryp8/devicetree.cb create mode 100644 src/mainboard/system76/oryp8/dsdt.asl create mode 100644 src/mainboard/system76/oryp8/gpio.h create mode 100644 src/mainboard/system76/oryp8/hda_verb.c create mode 100644 src/mainboard/system76/oryp8/ramstage.c create mode 100644 src/mainboard/system76/oryp8/romstage.c create mode 100644 src/mainboard/system76/oryp8/tas5825m.c diff --git a/src/mainboard/system76/oryp8/Kconfig b/src/mainboard/system76/oryp8/Kconfig new file mode 100644 index 0000000000..65fa556a23 --- /dev/null +++ b/src/mainboard/system76/oryp8/Kconfig @@ -0,0 +1,83 @@ +if BOARD_SYSTEM76_ORYP8 + +config BOARD_SPECIFIC_OPTIONS + def_bool y + select BOARD_ROMSIZE_KB_16384 + select DRIVERS_I2C_HID + select DRIVERS_I2C_TAS5825M + select DRIVERS_SYSTEM76_DGPU + select EC_SYSTEM76_EC + select EC_SYSTEM76_EC_BAT_THRESHOLDS + select EC_SYSTEM76_EC_COLOR_KEYBOARD + select EC_SYSTEM76_EC_DGPU + select HAVE_ACPI_RESUME + select HAVE_ACPI_TABLES + select HAVE_CMOS_DEFAULT + select HAVE_OPTION_TABLE + select INTEL_GMA_HAVE_VBT + select INTEL_LPSS_UART_FOR_CONSOLE + select MAINBOARD_HAS_LPC_TPM + select MAINBOARD_HAS_TPM2 + select NO_UART_ON_SUPERIO + select PCIEXP_HOTPLUG + select SOC_INTEL_TIGERLAKE + select SOC_INTEL_TIGERLAKE_PCH_H + select SOC_INTEL_COMMON_BLOCK_HDA_VERB + select SPD_READ_BY_WORD + select SYSTEM_TYPE_LAPTOP + select TPM_RDRESP_NEED_DELAY + select USE_OPTION_TABLE + +config MAINBOARD_DIR + string + default "system76/oryp8" + +config MAINBOARD_PART_NUMBER + string + default "oryp8" + +config MAINBOARD_SMBIOS_PRODUCT_NAME + string + default "Oryx Pro" + +config MAINBOARD_VERSION + string + default "oryp8" + +config CBFS_SIZE + hex + default 0xA00000 + +config CONSOLE_POST + bool + default y + +config DIMM_MAX + int + default 4 # Hack to make soc code work + +config DIMM_SPD_SIZE + int + default 512 + +config DRIVERS_SYSTEM76_DGPU_DEVICE + hex + default 0x01 + +config MAX_CPUS + int + default 16 + +config ONBOARD_VGA_IS_PRIMARY + bool + default y + +config POST_DEVICE + bool + default n + +config UART_FOR_CONSOLE + int + default 2 + +endif diff --git a/src/mainboard/system76/oryp8/Kconfig.name b/src/mainboard/system76/oryp8/Kconfig.name new file mode 100644 index 0000000000..236b8c87cc --- /dev/null +++ b/src/mainboard/system76/oryp8/Kconfig.name @@ -0,0 +1,2 @@ +config BOARD_SYSTEM76_ORYP8 + bool "oryp8" diff --git a/src/mainboard/system76/oryp8/Makefile.inc b/src/mainboard/system76/oryp8/Makefile.inc new file mode 100644 index 0000000000..649edffda6 --- /dev/null +++ b/src/mainboard/system76/oryp8/Makefile.inc @@ -0,0 +1,5 @@ +## SPDX-License-Identifier: GPL-2.0-only +bootblock-y += bootblock.c +ramstage-y += ramstage.c +ramstage-y += hda_verb.c +ramstage-y += tas5825m.c diff --git a/src/mainboard/system76/oryp8/acpi/backlight.asl b/src/mainboard/system76/oryp8/acpi/backlight.asl new file mode 100644 index 0000000000..12aaab6e4f --- /dev/null +++ b/src/mainboard/system76/oryp8/acpi/backlight.asl @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include + +Scope (GFX0) { + Name (BRIG, Package (22) { + 40, /* default AC */ + 40, /* default Battery */ + 5, + 10, + 15, + 20, + 25, + 30, + 35, + 40, + 45, + 50, + 55, + 60, + 65, + 70, + 75, + 80, + 85, + 90, + 95, + 100 + }) +} diff --git a/src/mainboard/system76/oryp8/acpi/dgpu.asl b/src/mainboard/system76/oryp8/acpi/dgpu.asl new file mode 100644 index 0000000000..ba1e2d7d0f --- /dev/null +++ b/src/mainboard/system76/oryp8/acpi/dgpu.asl @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +Scope (\_SB.PCI0.PEG1) { + Device (DEV0) { + Name(_ADR, 0x00000000) + Name(SSID, 0x00000000) + + OperationRegion (PCIC, PCI_Config, 0x00, 0x50) + Field (PCIC, DwordAcc, NoLock, Preserve) { + Offset (0x40), + NVID, 32 + } + + Name (_PR0, Package () { PWRR }) + Name (_PR3, Package () { PWRR }) + PowerResource (PWRR, 0, 0) { + Name (_STA, 1) + + Method (_ON) { + ^^NVID = ^^SSID + Printf("GPU _ON %o", ToHexString(^^SSID)) + _STA = 1 + } + + Method (_OFF) { + ^^SSID = ^^NVID + Printf("GPU _OFF %o", ToHexString(^^SSID)) + _STA = 0 + } + } + } +} diff --git a/src/mainboard/system76/oryp8/acpi/mainboard.asl b/src/mainboard/system76/oryp8/acpi/mainboard.asl new file mode 100644 index 0000000000..aff8765c6e --- /dev/null +++ b/src/mainboard/system76/oryp8/acpi/mainboard.asl @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include "dgpu.asl" + +#define EC_GPE_SCI 0x6E +#define EC_GPE_SWI 0x6B +#include + +Scope (\_SB) { + #include "sleep.asl" + Scope (PCI0) { + #include "backlight.asl" + } +} diff --git a/src/mainboard/system76/oryp8/acpi/sleep.asl b/src/mainboard/system76/oryp8/acpi/sleep.asl new file mode 100644 index 0000000000..ceb8bacb12 --- /dev/null +++ b/src/mainboard/system76/oryp8/acpi/sleep.asl @@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include + +Method (PGPM, 1, Serialized) +{ + For (Local0 = 0, Local0 < 6, Local0++) + { + \_SB.PCI0.CGPM (Local0, Arg0) + } +} + +/* + * Method called from _PTS prior to system sleep state entry + * Enables dynamic clock gating for all 5 GPIO communities + */ +Method (MPTS, 1, Serialized) +{ + \_SB.PCI0.LPCB.EC0.PTS (Arg0) + PGPM (MISCCFG_ENABLE_GPIO_PM_CONFIG) +} + +/* + * Method called from _WAK prior to system sleep state wakeup + * Disables dynamic clock gating for all 5 GPIO communities + */ +Method (MWAK, 1, Serialized) +{ + PGPM (0) + \_SB.PCI0.LPCB.EC0.WAK (Arg0) +} + +/* + * S0ix Entry/Exit Notifications + * Called from \_SB.PEPD._DSM + */ +Method (MS0X, 1, Serialized) +{ + If (Arg0 == 1) { + /* S0ix Entry */ + PGPM (MISCCFG_ENABLE_GPIO_PM_CONFIG) + } Else { + /* S0ix Exit */ + PGPM (0) + } +} diff --git a/src/mainboard/system76/oryp8/board_info.txt b/src/mainboard/system76/oryp8/board_info.txt new file mode 100644 index 0000000000..544c341cf5 --- /dev/null +++ b/src/mainboard/system76/oryp8/board_info.txt @@ -0,0 +1,8 @@ +Vendor name: System76 +Board name: oryp8 +Category: laptop +Release year: 2021 +ROM package: SOIC-8 +ROM protocol: SPI +ROM socketed: n +Flashrom support: y diff --git a/src/mainboard/system76/oryp8/bootblock.c b/src/mainboard/system76/oryp8/bootblock.c new file mode 100644 index 0000000000..44489dfa6d --- /dev/null +++ b/src/mainboard/system76/oryp8/bootblock.c @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include "gpio.h" +#include + +void bootblock_mainboard_init(void) { + gpio_configure_pads(early_gpio_table, ARRAY_SIZE(early_gpio_table)); + dgpu_power_enable(1); +} diff --git a/src/mainboard/system76/oryp8/cmos.default b/src/mainboard/system76/oryp8/cmos.default new file mode 100644 index 0000000000..c2fded82a3 --- /dev/null +++ b/src/mainboard/system76/oryp8/cmos.default @@ -0,0 +1,3 @@ +boot_option=Fallback +debug_level=Debug +preserve_smmstore=0 diff --git a/src/mainboard/system76/oryp8/cmos.layout b/src/mainboard/system76/oryp8/cmos.layout new file mode 100644 index 0000000000..bf6e103a3a --- /dev/null +++ b/src/mainboard/system76/oryp8/cmos.layout @@ -0,0 +1,43 @@ +# SPDX-License-Identifier: GPL-2.0-only + +entries + +0 384 r 0 reserved_memory + +# RTC_BOOT_BYTE (coreboot hardcoded) +384 1 e 4 boot_option +388 4 h 0 reboot_counter + +# RTC_CLK_ALTCENTURY +400 8 r 0 century + +408 1 h 1 preserve_smmstore +#409 2 e 7 power_on_after_fail +412 4 e 6 debug_level +984 16 h 0 check_sum + +enumerations + +1 0 Disable +1 1 Enable + +4 0 Fallback +4 1 Normal + +6 0 Emergency +6 1 Alert +6 2 Critical +6 3 Error +6 4 Warning +6 5 Notice +6 6 Info +6 7 Debug +6 8 Spew + +7 0 Disable +7 1 Enable +7 2 Keep + +checksums + +checksum 408 983 984 diff --git a/src/mainboard/system76/oryp8/data.vbt b/src/mainboard/system76/oryp8/data.vbt new file mode 100644 index 0000000000000000000000000000000000000000..5641c17f76d843dfaf63eff3e2bd7105abb2a8bd GIT binary patch literal 8704 zcmeHMO-vg{6n?X|*N(fCjf@h9CUk&^7#d*hB$OaaS=&J31cGe{b)-rdVmCo?zy(s# zs*<-72YOqnQbnRxu_{%qIMH(t<SKDDn3k|spW`-Ybfh@y! zl-UAsr~p$4kF_{8H`1S+18zh zSqm`8!;CgJ6Jb|&hw&gI?B?#U#~+|pu995{BQ%1jMqk^?2d0f}Eu-3PvBP=f0P-;M zTga2hw~_B6r;$HK{sj4R2C5I*6z6h}p~2acHW}Y-G!x8BgBNpsXD^fvSP6roDk(?N27Hj!rA13) zRT>s)xKUQ+Z5oJf*@K3!yB9aZjcsalrDOxqMXo^=*Q&7L(gjtSTJxytdP#!_{KGDd zTdIlVJI&*(VQ5kY_54_{Na}2H1!zh&arm%H&%_#=RE6fp0`tMF^M#M3S*!8F<<&B& zwN}*7!TJS24Hlh$Ql*S#sfv8K-=4{ams*t2z5K+A8ce`fRgx-Jqe1CVH)2b1#Tn)~ zz-=&LIwC!9PI4Rgk_~f`R^i2?M#zNdQAJV$tY5 zPBq$D8VeKf^`L|+X7SnYMY{?y4ID99KFs>f$APaarJ=#lL}+p*k-R#2C-D+A37s zoF<0BD!NwfNq3c~xjE``8ykq$=Hh(=-O@Sk7L6nCirXM1ph(eZufQ(wg} z<#HD=!T@ZNWmabMTSzu#)~8>;(0~KR25u+vdco$IZX4_&&^kTi!42Pp%L^Wa^KBts zYdx1@SBv()pJ7|X_$@p3UMr1Ec}?Wh`x6w8XUgRVxOF~a7mH_82iT9A>9q*dB2bG! zEdsR&)FM!eKrI6QV+8uX5RSv!QvjNvwCC0fd zmpy!f0JBP*u#D%_ZFn3ea#u7gH^0PFXv+#wAcYtOpToT@(mFDeEm|m%QPyad%Vhd* zOtwj)u!6F-GFf&}098~36}7CHJ!P`T!vw}Ht7H&#w517U#@V5U{r!?9po