mb/system76: Enable dGPUs
Change-Id: I28fe45afaccd60621f2f2456af14306e18df2657 Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
		| @@ -7,6 +7,7 @@ config BOARD_SPECIFIC_OPTIONS | |||||||
| 	select BOARD_ROMSIZE_KB_16384 | 	select BOARD_ROMSIZE_KB_16384 | ||||||
| 	select DRIVERS_GENERIC_CBFS_SERIAL | 	select DRIVERS_GENERIC_CBFS_SERIAL | ||||||
| 	select DRIVERS_GENERIC_CBFS_UUID | 	select DRIVERS_GENERIC_CBFS_UUID | ||||||
|  | 	select DRIVERS_GFX_NVIDIA | ||||||
| 	select DRIVERS_I2C_HID | 	select DRIVERS_I2C_HID | ||||||
| 	select DRIVERS_I2C_TAS5825M | 	select DRIVERS_I2C_TAS5825M | ||||||
| 	select EC_SYSTEM76_EC | 	select EC_SYSTEM76_EC | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| ## SPDX-License-Identifier: GPL-2.0-only | ## SPDX-License-Identifier: GPL-2.0-only | ||||||
|  |  | ||||||
| CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include | CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include | ||||||
|  |  | ||||||
| bootblock-y += bootblock.c | bootblock-y += bootblock.c | ||||||
| bootblock-y += variants/$(VARIANT_DIR)/gpio_early.c | bootblock-y += variants/$(VARIANT_DIR)/gpio_early.c | ||||||
|   | |||||||
| @@ -1,11 +1,19 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #include <variant/gpio.h> | ||||||
|  |  | ||||||
| #define EC_GPE_SCI 0x03 /* GPP_K3 */ | #define EC_GPE_SCI 0x03 /* GPP_K3 */ | ||||||
| #define EC_GPE_SWI 0x06 /* GPP_K6 */ | #define EC_GPE_SWI 0x06 /* GPP_K6 */ | ||||||
| #include <ec/system76/ec/acpi/ec.asl> | #include <ec/system76/ec/acpi/ec.asl> | ||||||
|  |  | ||||||
| Scope (\_SB) { | Scope (\_SB) { | ||||||
| 	#include "sleep.asl" | 	#include "sleep.asl" | ||||||
|  | 	Scope (PCI0) { | ||||||
|  | 		Device (PEGP) { | ||||||
|  | 			Name (_ADR, CONFIG_DRIVERS_GFX_NVIDIA_BRIDGE << 16) | ||||||
|  | 			#include <drivers/gfx/nvidia/acpi/coffeelake.asl> | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| Scope (\_GPE) { | Scope (\_GPE) { | ||||||
|   | |||||||
| @@ -56,6 +56,12 @@ chip soc/intel/cannonlake | |||||||
| 			# PCI Express Graphics #0 x16, Clock 8 (NVIDIA GPU) | 			# PCI Express Graphics #0 x16, Clock 8 (NVIDIA GPU) | ||||||
| 			register "PcieClkSrcUsage[8]" = "0x40" | 			register "PcieClkSrcUsage[8]" = "0x40" | ||||||
| 			register "PcieClkSrcClkReq[8]" = "8" | 			register "PcieClkSrcClkReq[8]" = "8" | ||||||
|  | 			chip drivers/gfx/nvidia | ||||||
|  | 				device pci 00.0 on end # VGA controller | ||||||
|  | 				device pci 00.1 on end # Audio device | ||||||
|  | 				device pci 00.2 on end # USB xHCI Host controller | ||||||
|  | 				device pci 00.3 on end # USB Type-C UCSI controller | ||||||
|  | 			end | ||||||
| 		end | 		end | ||||||
| 		device pci 02.0 on  end # Integrated Graphics Device | 		device pci 02.0 on  end # Integrated Graphics Device | ||||||
| 		device pci 04.0 on      # SA Thermal device | 		device pci 04.0 on      # SA Thermal device | ||||||
|   | |||||||
| @@ -1,7 +1,9 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #include <drivers/gfx/nvidia/gpu.h> | ||||||
| #include <soc/cnl_memcfg_init.h> | #include <soc/cnl_memcfg_init.h> | ||||||
| #include <soc/romstage.h> | #include <soc/romstage.h> | ||||||
|  | #include <variant/gpio.h> | ||||||
|  |  | ||||||
| static const struct cnl_mb_cfg memcfg = { | static const struct cnl_mb_cfg memcfg = { | ||||||
| 	.spd[0] = { | 	.spd[0] = { | ||||||
| @@ -20,5 +22,17 @@ static const struct cnl_mb_cfg memcfg = { | |||||||
|  |  | ||||||
| void mainboard_memory_init_params(FSPM_UPD *memupd) | void mainboard_memory_init_params(FSPM_UPD *memupd) | ||||||
| { | { | ||||||
|  | 	const struct nvidia_gpu_config config = { | ||||||
|  | 		.power_gpio = DGPU_PWR_EN, | ||||||
|  | 		.reset_gpio = DGPU_RST_N, | ||||||
|  | 		.enable = true, | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	// Enable dGPU power | ||||||
|  | 	nvidia_set_power(&config); | ||||||
|  |  | ||||||
|  | 	// Set primary display to internal graphics | ||||||
|  | 	memupd->FspmConfig.PrimaryDisplay = 0; | ||||||
|  |  | ||||||
| 	cannonlake_memcfg_init(&memupd->FspmConfig, &memcfg); | 	cannonlake_memcfg_init(&memupd->FspmConfig, &memcfg); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -3,7 +3,16 @@ | |||||||
| #ifndef VARIANT_GPIO_H | #ifndef VARIANT_GPIO_H | ||||||
| #define VARIANT_GPIO_H | #define VARIANT_GPIO_H | ||||||
| 
 | 
 | ||||||
|  | #include <soc/gpio.h> | ||||||
|  | 
 | ||||||
|  | #define DGPU_RST_N	GPP_F22 | ||||||
|  | #define DGPU_PWR_EN	GPP_F23 | ||||||
|  | #define DGPU_GC6	GPP_C12 | ||||||
|  | #define DGPU_SSID	0x65d11558 | ||||||
|  | 
 | ||||||
|  | #ifndef __ACPI__ | ||||||
| void variant_configure_early_gpios(void); | void variant_configure_early_gpios(void); | ||||||
| void variant_configure_gpios(void); | void variant_configure_gpios(void); | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
| @@ -0,0 +1,18 @@ | |||||||
|  | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #ifndef VARIANT_GPIO_H | ||||||
|  | #define VARIANT_GPIO_H | ||||||
|  |  | ||||||
|  | #include <soc/gpio.h> | ||||||
|  |  | ||||||
|  | #define DGPU_RST_N	GPP_F22 | ||||||
|  | #define DGPU_PWR_EN	GPP_F23 | ||||||
|  | #define DGPU_GC6	GPP_C12 | ||||||
|  | #define DGPU_SSID	0x65e11558 | ||||||
|  |  | ||||||
|  | #ifndef __ACPI__ | ||||||
|  | void variant_configure_early_gpios(void); | ||||||
|  | void variant_configure_gpios(void); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif | ||||||
| @@ -35,10 +35,12 @@ config BOARD_SYSTEM76_GALP6 | |||||||
|  |  | ||||||
| config BOARD_SYSTEM76_GAZE17_3050 | config BOARD_SYSTEM76_GAZE17_3050 | ||||||
| 	select BOARD_SYSTEM76_ADL_COMMON | 	select BOARD_SYSTEM76_ADL_COMMON | ||||||
|  | 	select DRIVERS_GFX_NVIDIA | ||||||
| 	select EC_SYSTEM76_EC_DGPU | 	select EC_SYSTEM76_EC_DGPU | ||||||
|  |  | ||||||
| config BOARD_SYSTEM76_GAZE17_3060_B | config BOARD_SYSTEM76_GAZE17_3060_B | ||||||
| 	select BOARD_SYSTEM76_ADL_COMMON | 	select BOARD_SYSTEM76_ADL_COMMON | ||||||
|  | 	select DRIVERS_GFX_NVIDIA | ||||||
| 	select EC_SYSTEM76_EC_DGPU | 	select EC_SYSTEM76_EC_DGPU | ||||||
| 	select MAINBOARD_USES_IFD_GBE_REGION | 	select MAINBOARD_USES_IFD_GBE_REGION | ||||||
|  |  | ||||||
| @@ -48,11 +50,15 @@ config BOARD_SYSTEM76_LEMP11 | |||||||
|  |  | ||||||
| config BOARD_SYSTEM76_ORYP9 | config BOARD_SYSTEM76_ORYP9 | ||||||
| 	select BOARD_SYSTEM76_ADL_COMMON | 	select BOARD_SYSTEM76_ADL_COMMON | ||||||
|  | 	select DRIVERS_GFX_NVIDIA | ||||||
|  | 	select DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST | ||||||
| 	select DRIVERS_I2C_TAS5825M | 	select DRIVERS_I2C_TAS5825M | ||||||
| 	select EC_SYSTEM76_EC_DGPU | 	select EC_SYSTEM76_EC_DGPU | ||||||
|  |  | ||||||
| config BOARD_SYSTEM76_ORYP10 | config BOARD_SYSTEM76_ORYP10 | ||||||
| 	select BOARD_SYSTEM76_ADL_COMMON | 	select BOARD_SYSTEM76_ADL_COMMON | ||||||
|  | 	select DRIVERS_GFX_NVIDIA | ||||||
|  | 	select DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST | ||||||
| 	select EC_SYSTEM76_EC_DGPU | 	select EC_SYSTEM76_EC_DGPU | ||||||
|  |  | ||||||
| if BOARD_SYSTEM76_ADL_COMMON | if BOARD_SYSTEM76_ADL_COMMON | ||||||
| @@ -106,6 +112,12 @@ config D3COLD_SUPPORT | |||||||
| config DIMM_SPD_SIZE | config DIMM_SPD_SIZE | ||||||
| 	default 512 | 	default 512 | ||||||
|  |  | ||||||
|  | config DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST_TPP | ||||||
|  | 	default 45 if BOARD_SYSTEM76_ORYP9 || BOARD_SYSTEM76_ORYP10 | ||||||
|  |  | ||||||
|  | config DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST_MAX | ||||||
|  | 	default 25 if BOARD_SYSTEM76_ORYP9 || BOARD_SYSTEM76_ORYP10 | ||||||
|  |  | ||||||
| config FMDFILE | config FMDFILE | ||||||
| 	default "src/mainboard/\$(CONFIG_MAINBOARD_DIR)/board.fmd" | 	default "src/mainboard/\$(CONFIG_MAINBOARD_DIR)/board.fmd" | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,6 +2,10 @@ | |||||||
|  |  | ||||||
| CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include | CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include | ||||||
|  |  | ||||||
|  | ifeq ($(CONFIG_DRIVERS_GFX_NVIDIA),y) | ||||||
|  | CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include | ||||||
|  | endif | ||||||
|  |  | ||||||
| bootblock-y += bootblock.c | bootblock-y += bootblock.c | ||||||
| bootblock-y += variants/$(VARIANT_DIR)/gpio_early.c | bootblock-y += variants/$(VARIANT_DIR)/gpio_early.c | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,5 +1,9 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #if CONFIG(DRIVERS_GFX_NVIDIA) | ||||||
|  | #include <variant/gpio.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #define EC_GPE_SCI 0x6E | #define EC_GPE_SCI 0x6E | ||||||
| #define EC_GPE_SWI 0x6B | #define EC_GPE_SWI 0x6B | ||||||
| #include <ec/system76/ec/acpi/ec.asl> | #include <ec/system76/ec/acpi/ec.asl> | ||||||
| @@ -8,5 +12,11 @@ Scope (\_SB) { | |||||||
| 	#include "sleep.asl" | 	#include "sleep.asl" | ||||||
| 	Scope (PCI0) { | 	Scope (PCI0) { | ||||||
| 		#include "backlight.asl" | 		#include "backlight.asl" | ||||||
|  |  | ||||||
|  | #if CONFIG(DRIVERS_GFX_NVIDIA) | ||||||
|  | 		Scope (PEG2) { | ||||||
|  | 			#include <drivers/gfx/nvidia/acpi/tigerlake.asl> | ||||||
|  | 		} | ||||||
|  | #endif | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -0,0 +1,13 @@ | |||||||
|  | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #ifndef VARIANT_GPIO_H | ||||||
|  | #define VARIANT_GPIO_H | ||||||
|  |  | ||||||
|  | #include <soc/gpio.h> | ||||||
|  |  | ||||||
|  | #define DGPU_RST_N	GPP_B2 | ||||||
|  | #define DGPU_PWR_EN	GPP_A14 | ||||||
|  | #define DGPU_GC6	GPP_F13 | ||||||
|  | #define DGPU_SSID	0x866d1558 | ||||||
|  |  | ||||||
|  | #endif | ||||||
| @@ -38,6 +38,10 @@ chip soc/intel/alderlake | |||||||
| 				.clk_req = 3, | 				.clk_req = 3, | ||||||
| 				.flags = PCIE_RP_LTR, | 				.flags = PCIE_RP_LTR, | ||||||
| 			}" | 			}" | ||||||
|  | 			chip drivers/gfx/nvidia | ||||||
|  | 				device pci 00.0 on end # VGA controller | ||||||
|  | 				device pci 00.1 on end # Audio device | ||||||
|  | 			end | ||||||
| 		end | 		end | ||||||
| 		device ref pcie4_0 on | 		device ref pcie4_0 on | ||||||
| 			# PCIe PEG0 x4, Clock 0 (SSD2) | 			# PCIe PEG0 x4, Clock 0 (SSD2) | ||||||
|   | |||||||
| @@ -1,7 +1,9 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #include <drivers/gfx/nvidia/gpu.h> | ||||||
| #include <soc/meminit.h> | #include <soc/meminit.h> | ||||||
| #include <soc/romstage.h> | #include <soc/romstage.h> | ||||||
|  | #include <variant/gpio.h> | ||||||
|  |  | ||||||
| void mainboard_memory_init_params(FSPM_UPD *mupd) | void mainboard_memory_init_params(FSPM_UPD *mupd) | ||||||
| { | { | ||||||
| @@ -17,6 +19,14 @@ void mainboard_memory_init_params(FSPM_UPD *mupd) | |||||||
| 	}; | 	}; | ||||||
| 	const bool half_populated = false; | 	const bool half_populated = false; | ||||||
|  |  | ||||||
|  | 	const struct nvidia_gpu_config config = { | ||||||
|  | 		.power_gpio = DGPU_PWR_EN, | ||||||
|  | 		.reset_gpio = DGPU_RST_N, | ||||||
|  | 		.enable = true, | ||||||
|  | 	}; | ||||||
|  | 	// Enable dGPU power | ||||||
|  | 	nvidia_set_power(&config); | ||||||
|  |  | ||||||
| 	// Set primary display to internal graphics | 	// Set primary display to internal graphics | ||||||
| 	mupd->FspmConfig.PrimaryDisplay = 0; | 	mupd->FspmConfig.PrimaryDisplay = 0; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -0,0 +1,13 @@ | |||||||
|  | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #ifndef VARIANT_GPIO_H | ||||||
|  | #define VARIANT_GPIO_H | ||||||
|  |  | ||||||
|  | #include <soc/gpio.h> | ||||||
|  |  | ||||||
|  | #define DGPU_RST_N	GPP_B2 | ||||||
|  | #define DGPU_PWR_EN	GPP_A14 | ||||||
|  | #define DGPU_GC6	GPP_F13 | ||||||
|  | #define DGPU_SSID	0x867c1558 | ||||||
|  |  | ||||||
|  | #endif | ||||||
| @@ -38,6 +38,10 @@ chip soc/intel/alderlake | |||||||
| 				.clk_req = 3, | 				.clk_req = 3, | ||||||
| 				.flags = PCIE_RP_LTR, | 				.flags = PCIE_RP_LTR, | ||||||
| 			}" | 			}" | ||||||
|  | 			chip drivers/gfx/nvidia | ||||||
|  | 				device pci 00.0 on end # VGA controller | ||||||
|  | 				device pci 00.1 on end # Audio device | ||||||
|  | 			end | ||||||
| 		end | 		end | ||||||
| 		device ref igpu on | 		device ref igpu on | ||||||
| 			# DDIA is eDP | 			# DDIA is eDP | ||||||
|   | |||||||
| @@ -1,7 +1,9 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #include <drivers/gfx/nvidia/gpu.h> | ||||||
| #include <soc/meminit.h> | #include <soc/meminit.h> | ||||||
| #include <soc/romstage.h> | #include <soc/romstage.h> | ||||||
|  | #include <variant/gpio.h> | ||||||
|  |  | ||||||
| void mainboard_memory_init_params(FSPM_UPD *mupd) | void mainboard_memory_init_params(FSPM_UPD *mupd) | ||||||
| { | { | ||||||
| @@ -17,6 +19,14 @@ void mainboard_memory_init_params(FSPM_UPD *mupd) | |||||||
| 	}; | 	}; | ||||||
| 	const bool half_populated = false; | 	const bool half_populated = false; | ||||||
|  |  | ||||||
|  | 	const struct nvidia_gpu_config config = { | ||||||
|  | 		.power_gpio = DGPU_PWR_EN, | ||||||
|  | 		.reset_gpio = DGPU_RST_N, | ||||||
|  | 		.enable = true, | ||||||
|  | 	}; | ||||||
|  | 	// Enable dGPU power | ||||||
|  | 	nvidia_set_power(&config); | ||||||
|  |  | ||||||
| 	// Set primary display to internal graphics | 	// Set primary display to internal graphics | ||||||
| 	mupd->FspmConfig.PrimaryDisplay = 0; | 	mupd->FspmConfig.PrimaryDisplay = 0; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -0,0 +1,13 @@ | |||||||
|  | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #ifndef VARIANT_GPIO_H | ||||||
|  | #define VARIANT_GPIO_H | ||||||
|  |  | ||||||
|  | #include <soc/gpio.h> | ||||||
|  |  | ||||||
|  | #define DGPU_RST_N	GPP_B2 | ||||||
|  | #define DGPU_PWR_EN	GPP_A14 | ||||||
|  | #define DGPU_GC6	GPP_A7 | ||||||
|  | #define DGPU_SSID	0x65f51558 | ||||||
|  |  | ||||||
|  | #endif | ||||||
| @@ -23,6 +23,10 @@ chip soc/intel/alderlake | |||||||
| 				.clk_req = 3, | 				.clk_req = 3, | ||||||
| 				.flags = PCIE_RP_LTR, | 				.flags = PCIE_RP_LTR, | ||||||
| 			}" | 			}" | ||||||
|  | 			chip drivers/gfx/nvidia | ||||||
|  | 				device pci 00.0 on end # VGA controller | ||||||
|  | 				device pci 00.1 on end # Audio device | ||||||
|  | 			end | ||||||
| 		end | 		end | ||||||
| 		device ref igpu on | 		device ref igpu on | ||||||
| 			register "ddi_portA_config" = "1" | 			register "ddi_portA_config" = "1" | ||||||
|   | |||||||
| @@ -1,7 +1,9 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #include <drivers/gfx/nvidia/gpu.h> | ||||||
| #include <soc/meminit.h> | #include <soc/meminit.h> | ||||||
| #include <soc/romstage.h> | #include <soc/romstage.h> | ||||||
|  | #include <variant/gpio.h> | ||||||
|  |  | ||||||
| void mainboard_memory_init_params(FSPM_UPD *mupd) | void mainboard_memory_init_params(FSPM_UPD *mupd) | ||||||
| { | { | ||||||
| @@ -20,6 +22,14 @@ void mainboard_memory_init_params(FSPM_UPD *mupd) | |||||||
| 	}; | 	}; | ||||||
| 	const bool half_populated = false; | 	const bool half_populated = false; | ||||||
|  |  | ||||||
|  | 	const struct nvidia_gpu_config config = { | ||||||
|  | 		.power_gpio = DGPU_PWR_EN, | ||||||
|  | 		.reset_gpio = DGPU_RST_N, | ||||||
|  | 		.enable = true, | ||||||
|  | 	}; | ||||||
|  | 	// Enable dGPU power | ||||||
|  | 	nvidia_set_power(&config); | ||||||
|  |  | ||||||
| 	// Set primary display to internal graphics | 	// Set primary display to internal graphics | ||||||
| 	mupd->FspmConfig.PrimaryDisplay = 0; | 	mupd->FspmConfig.PrimaryDisplay = 0; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -0,0 +1,13 @@ | |||||||
|  | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #ifndef VARIANT_GPIO_H | ||||||
|  | #define VARIANT_GPIO_H | ||||||
|  |  | ||||||
|  | #include <soc/gpio.h> | ||||||
|  |  | ||||||
|  | #define DGPU_RST_N	GPP_B2 | ||||||
|  | #define DGPU_PWR_EN	GPP_A14 | ||||||
|  | #define DGPU_GC6	GPP_A7 | ||||||
|  | #define DGPU_SSID	0x65f51558 | ||||||
|  |  | ||||||
|  | #endif | ||||||
| @@ -23,6 +23,10 @@ chip soc/intel/alderlake | |||||||
| 				.clk_req = 3, | 				.clk_req = 3, | ||||||
| 				.flags = PCIE_RP_LTR, | 				.flags = PCIE_RP_LTR, | ||||||
| 			}" | 			}" | ||||||
|  | 			chip drivers/gfx/nvidia | ||||||
|  | 				device pci 00.0 on end # VGA controller | ||||||
|  | 				device pci 00.1 on end # Audio device | ||||||
|  | 			end | ||||||
| 		end | 		end | ||||||
| 		device ref igpu on | 		device ref igpu on | ||||||
| 			register "ddi_portA_config" = "1" | 			register "ddi_portA_config" = "1" | ||||||
|   | |||||||
| @@ -1,7 +1,9 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #include <drivers/gfx/nvidia/gpu.h> | ||||||
| #include <soc/meminit.h> | #include <soc/meminit.h> | ||||||
| #include <soc/romstage.h> | #include <soc/romstage.h> | ||||||
|  | #include <variant/gpio.h> | ||||||
|  |  | ||||||
| void mainboard_memory_init_params(FSPM_UPD *mupd) | void mainboard_memory_init_params(FSPM_UPD *mupd) | ||||||
| { | { | ||||||
| @@ -17,6 +19,14 @@ void mainboard_memory_init_params(FSPM_UPD *mupd) | |||||||
| 	}; | 	}; | ||||||
| 	const bool half_populated = false; | 	const bool half_populated = false; | ||||||
|  |  | ||||||
|  | 	const struct nvidia_gpu_config config = { | ||||||
|  | 		.power_gpio = DGPU_PWR_EN, | ||||||
|  | 		.reset_gpio = DGPU_RST_N, | ||||||
|  | 		.enable = true, | ||||||
|  | 	}; | ||||||
|  | 	// Enable dGPU power | ||||||
|  | 	nvidia_set_power(&config); | ||||||
|  |  | ||||||
| 	// Set primary display to internal graphics | 	// Set primary display to internal graphics | ||||||
| 	mupd->FspmConfig.PrimaryDisplay = 0; | 	mupd->FspmConfig.PrimaryDisplay = 0; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -7,6 +7,7 @@ config BOARD_SPECIFIC_OPTIONS | |||||||
| 	select BOARD_ROMSIZE_KB_16384 | 	select BOARD_ROMSIZE_KB_16384 | ||||||
| 	select DRIVERS_GENERIC_CBFS_SERIAL | 	select DRIVERS_GENERIC_CBFS_SERIAL | ||||||
| 	select DRIVERS_GENERIC_CBFS_UUID | 	select DRIVERS_GENERIC_CBFS_UUID | ||||||
|  | 	select DRIVERS_GFX_NVIDIA | ||||||
| 	select DRIVERS_I2C_HID | 	select DRIVERS_I2C_HID | ||||||
| 	select DRIVERS_I2C_TAS5825M | 	select DRIVERS_I2C_TAS5825M | ||||||
| 	select EC_SYSTEM76_EC | 	select EC_SYSTEM76_EC | ||||||
|   | |||||||
| @@ -59,12 +59,13 @@ chip soc/intel/cannonlake | |||||||
| 			# PCI Express Graphics #0 x16, Clock 7 (NVIDIA GPU) | 			# PCI Express Graphics #0 x16, Clock 7 (NVIDIA GPU) | ||||||
| 			register "PcieClkSrcUsage[7]" = "0x40" | 			register "PcieClkSrcUsage[7]" = "0x40" | ||||||
| 			register "PcieClkSrcClkReq[7]" = "7" | 			register "PcieClkSrcClkReq[7]" = "7" | ||||||
|  | 			chip drivers/gfx/nvidia | ||||||
| 				device pci 00.0 on end # VGA controller | 				device pci 00.0 on end # VGA controller | ||||||
| 				device pci 00.1 on end # Audio device | 				device pci 00.1 on end # Audio device | ||||||
| 				device pci 00.2 on end # USB xHCI Host controller | 				device pci 00.2 on end # USB xHCI Host controller | ||||||
| 				device pci 00.3 on end # USB Type-C UCSI controller | 				device pci 00.3 on end # USB Type-C UCSI controller | ||||||
| 			end | 			end | ||||||
|  | 		end | ||||||
| 		# TODO: is this enough to disable iGPU? | 		# TODO: is this enough to disable iGPU? | ||||||
| 		device pci 02.0 off end # Integrated Graphics Device | 		device pci 02.0 off end # Integrated Graphics Device | ||||||
| 		device pci 04.0 on  end # SA Thermal device | 		device pci 04.0 on  end # SA Thermal device | ||||||
|   | |||||||
| @@ -7,6 +7,7 @@ config BOARD_SPECIFIC_OPTIONS | |||||||
| 	select BOARD_ROMSIZE_KB_16384 | 	select BOARD_ROMSIZE_KB_16384 | ||||||
| 	select DRIVERS_GENERIC_CBFS_SERIAL | 	select DRIVERS_GENERIC_CBFS_SERIAL | ||||||
| 	select DRIVERS_GENERIC_CBFS_UUID | 	select DRIVERS_GENERIC_CBFS_UUID | ||||||
|  | 	select DRIVERS_GFX_NVIDIA | ||||||
| 	select DRIVERS_I2C_HID | 	select DRIVERS_I2C_HID | ||||||
| 	select EC_SYSTEM76_EC | 	select EC_SYSTEM76_EC | ||||||
| 	select EC_SYSTEM76_EC_DGPU | 	select EC_SYSTEM76_EC_DGPU | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| ## SPDX-License-Identifier: GPL-2.0-only | ## SPDX-License-Identifier: GPL-2.0-only | ||||||
|  |  | ||||||
| CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include | CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include | ||||||
|  |  | ||||||
| bootblock-y += bootblock.c | bootblock-y += bootblock.c | ||||||
| bootblock-y += variants/$(VARIANT_DIR)/gpio_early.c | bootblock-y += variants/$(VARIANT_DIR)/gpio_early.c | ||||||
|   | |||||||
| @@ -1,5 +1,7 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #include <variant/gpio.h> | ||||||
|  |  | ||||||
| #define EC_GPE_SCI 0x03 /* GPP_K3 */ | #define EC_GPE_SCI 0x03 /* GPP_K3 */ | ||||||
| #define EC_GPE_SWI 0x06 /* GPP_K6 */ | #define EC_GPE_SWI 0x06 /* GPP_K6 */ | ||||||
| #include <ec/system76/ec/acpi/ec.asl> | #include <ec/system76/ec/acpi/ec.asl> | ||||||
| @@ -8,6 +10,10 @@ Scope (\_SB) { | |||||||
| 	#include "sleep.asl" | 	#include "sleep.asl" | ||||||
| 	Scope (PCI0) { | 	Scope (PCI0) { | ||||||
| 		#include "backlight.asl" | 		#include "backlight.asl" | ||||||
|  | 		Device (PEGP) { | ||||||
|  | 			Name (_ADR, CONFIG_DRIVERS_GFX_NVIDIA_BRIDGE << 16) | ||||||
|  | 			#include <drivers/gfx/nvidia/acpi/coffeelake.asl> | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -55,6 +55,12 @@ chip soc/intel/cannonlake | |||||||
| 			# PCI Express Graphics #0 x16, Clock 8 (NVIDIA GPU) | 			# PCI Express Graphics #0 x16, Clock 8 (NVIDIA GPU) | ||||||
| 			register "PcieClkSrcUsage[8]" = "0x40" | 			register "PcieClkSrcUsage[8]" = "0x40" | ||||||
| 			register "PcieClkSrcClkReq[8]" = "8" | 			register "PcieClkSrcClkReq[8]" = "8" | ||||||
|  | 			chip drivers/gfx/nvidia | ||||||
|  | 				device pci 00.0 on end # VGA controller | ||||||
|  | 				device pci 00.1 on end # Audio device | ||||||
|  | 				device pci 00.2 on end # USB xHCI Host controller | ||||||
|  | 				device pci 00.3 on end # USB Type-C UCSI controller | ||||||
|  | 			end | ||||||
| 		end | 		end | ||||||
| 		device pci 02.0 on      # Integrated Graphics Device | 		device pci 02.0 on      # Integrated Graphics Device | ||||||
| 			register "gfx" = "GMA_DEFAULT_PANEL(0)" | 			register "gfx" = "GMA_DEFAULT_PANEL(0)" | ||||||
|   | |||||||
| @@ -1,7 +1,9 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #include <drivers/gfx/nvidia/gpu.h> | ||||||
| #include <soc/cnl_memcfg_init.h> | #include <soc/cnl_memcfg_init.h> | ||||||
| #include <soc/romstage.h> | #include <soc/romstage.h> | ||||||
|  | #include <variant/gpio.h> | ||||||
|  |  | ||||||
| static const struct cnl_mb_cfg memcfg = { | static const struct cnl_mb_cfg memcfg = { | ||||||
| 	.spd[0] = { | 	.spd[0] = { | ||||||
| @@ -20,5 +22,17 @@ static const struct cnl_mb_cfg memcfg = { | |||||||
|  |  | ||||||
| void mainboard_memory_init_params(FSPM_UPD *memupd) | void mainboard_memory_init_params(FSPM_UPD *memupd) | ||||||
| { | { | ||||||
|  | 	const struct nvidia_gpu_config config = { | ||||||
|  | 		.power_gpio = DGPU_PWR_EN, | ||||||
|  | 		.reset_gpio = DGPU_RST_N, | ||||||
|  | 		.enable = true, | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	// Enable dGPU power | ||||||
|  | 	nvidia_set_power(&config); | ||||||
|  |  | ||||||
|  | 	// Set primary display to internal graphics | ||||||
|  | 	memupd->FspmConfig.PrimaryDisplay = 0; | ||||||
|  |  | ||||||
| 	cannonlake_memcfg_init(&memupd->FspmConfig, &memcfg); | 	cannonlake_memcfg_init(&memupd->FspmConfig, &memcfg); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -0,0 +1,18 @@ | |||||||
|  | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #ifndef VARIANT_GPIO_H | ||||||
|  | #define VARIANT_GPIO_H | ||||||
|  |  | ||||||
|  | #include <soc/gpio.h> | ||||||
|  |  | ||||||
|  | #define DGPU_RST_N	GPP_F22 | ||||||
|  | #define DGPU_PWR_EN	GPP_F23 | ||||||
|  | #define DGPU_GC6	GPP_K21 | ||||||
|  | #define DGPU_SSID	0x85501558 | ||||||
|  |  | ||||||
|  | #ifndef __ACPI__ | ||||||
|  | void variant_configure_early_gpios(void); | ||||||
|  | void variant_configure_gpios(void); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif | ||||||
| @@ -0,0 +1,18 @@ | |||||||
|  | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #ifndef VARIANT_GPIO_H | ||||||
|  | #define VARIANT_GPIO_H | ||||||
|  |  | ||||||
|  | #include <soc/gpio.h> | ||||||
|  |  | ||||||
|  | #define DGPU_RST_N	GPP_F22 | ||||||
|  | #define DGPU_PWR_EN	GPP_F23 | ||||||
|  | #define DGPU_GC6	GPP_K21 | ||||||
|  | #define DGPU_SSID	0x85201558 | ||||||
|  |  | ||||||
|  | #ifndef __ACPI__ | ||||||
|  | void variant_configure_early_gpios(void); | ||||||
|  | void variant_configure_gpios(void); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif | ||||||
| @@ -7,6 +7,7 @@ config BOARD_SPECIFIC_OPTIONS | |||||||
| 	select BOARD_ROMSIZE_KB_16384 | 	select BOARD_ROMSIZE_KB_16384 | ||||||
| 	select DRIVERS_GENERIC_CBFS_SERIAL | 	select DRIVERS_GENERIC_CBFS_SERIAL | ||||||
| 	select DRIVERS_GENERIC_CBFS_UUID | 	select DRIVERS_GENERIC_CBFS_UUID | ||||||
|  | 	select DRIVERS_GFX_NVIDIA | ||||||
| 	select DRIVERS_I2C_HID | 	select DRIVERS_I2C_HID | ||||||
| 	select DRIVERS_I2C_TAS5825M | 	select DRIVERS_I2C_TAS5825M | ||||||
| 	select EC_SYSTEM76_EC | 	select EC_SYSTEM76_EC | ||||||
|   | |||||||
| @@ -1,5 +1,7 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #include <mainboard/gpio.h> | ||||||
|  |  | ||||||
| #define EC_GPE_SCI 0x17 /* GPP_B23 */ | #define EC_GPE_SCI 0x17 /* GPP_B23 */ | ||||||
| #define EC_GPE_SWI 0x26 /* GPP_G6 */ | #define EC_GPE_SWI 0x26 /* GPP_G6 */ | ||||||
| #include <ec/system76/ec/acpi/ec.asl> | #include <ec/system76/ec/acpi/ec.asl> | ||||||
| @@ -9,6 +11,10 @@ Scope (\_SB) | |||||||
| 	#include "sleep.asl" | 	#include "sleep.asl" | ||||||
| 	Scope (PCI0) { | 	Scope (PCI0) { | ||||||
| 		#include "backlight.asl" | 		#include "backlight.asl" | ||||||
|  | 		Device (PEGP) { | ||||||
|  | 			Name (_ADR, CONFIG_DRIVERS_GFX_NVIDIA_BRIDGE << 16) | ||||||
|  | 			#include <drivers/gfx/nvidia/acpi/coffeelake.asl> | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -63,6 +63,12 @@ chip soc/intel/cannonlake | |||||||
| 			# PCI Express Graphics #0 x16, Clock 8 (NVIDIA GPU) | 			# PCI Express Graphics #0 x16, Clock 8 (NVIDIA GPU) | ||||||
| 			register "PcieClkSrcUsage[8]" = "0x40" | 			register "PcieClkSrcUsage[8]" = "0x40" | ||||||
| 			register "PcieClkSrcClkReq[8]" = "8" | 			register "PcieClkSrcClkReq[8]" = "8" | ||||||
|  | 			chip drivers/gfx/nvidia | ||||||
|  | 				device pci 00.0 on end # VGA controller | ||||||
|  | 				device pci 00.1 on end # Audio device | ||||||
|  | 				device pci 00.2 on end # USB xHCI Host controller | ||||||
|  | 				device pci 00.3 on end # USB Type-C UCSI controller | ||||||
|  | 			end | ||||||
| 		end | 		end | ||||||
| 		device pci 02.0 on      # Integrated Graphics Device | 		device pci 02.0 on      # Integrated Graphics Device | ||||||
| 			register "gfx" = "GMA_DEFAULT_PANEL(0)" | 			register "gfx" = "GMA_DEFAULT_PANEL(0)" | ||||||
|   | |||||||
| @@ -3,7 +3,16 @@ | |||||||
| #ifndef MAINBOARD_GPIO_H | #ifndef MAINBOARD_GPIO_H | ||||||
| #define MAINBOARD_GPIO_H | #define MAINBOARD_GPIO_H | ||||||
|  |  | ||||||
|  | #include <soc/gpio.h> | ||||||
|  |  | ||||||
|  | #define DGPU_RST_N	GPP_F22 | ||||||
|  | #define DGPU_PWR_EN	GPP_F23 | ||||||
|  | #define DGPU_GC6	GPP_C12 | ||||||
|  | #define DGPU_SSID	0x95e61558 | ||||||
|  |  | ||||||
|  | #ifndef __ACPI__ | ||||||
| void mainboard_configure_early_gpios(void); | void mainboard_configure_early_gpios(void); | ||||||
| void mainboard_configure_gpios(void); | void mainboard_configure_gpios(void); | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #endif | #endif | ||||||
|   | |||||||
| @@ -1,5 +1,7 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #include <drivers/gfx/nvidia/gpu.h> | ||||||
|  | #include <mainboard/gpio.h> | ||||||
| #include <soc/cnl_memcfg_init.h> | #include <soc/cnl_memcfg_init.h> | ||||||
| #include <soc/romstage.h> | #include <soc/romstage.h> | ||||||
|  |  | ||||||
| @@ -20,6 +22,18 @@ static const struct cnl_mb_cfg memcfg = { | |||||||
|  |  | ||||||
| void mainboard_memory_init_params(FSPM_UPD *memupd) | void mainboard_memory_init_params(FSPM_UPD *memupd) | ||||||
| { | { | ||||||
|  | 	const struct nvidia_gpu_config config = { | ||||||
|  | 		.power_gpio = DGPU_PWR_EN, | ||||||
|  | 		.reset_gpio = DGPU_RST_N, | ||||||
|  | 		.enable = true, | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	// Enable dGPU power | ||||||
|  | 	nvidia_set_power(&config); | ||||||
|  |  | ||||||
|  | 	// Set primary display to internal graphics | ||||||
|  | 	memupd->FspmConfig.PrimaryDisplay = 0; | ||||||
|  |  | ||||||
| 	// Allow memory speeds higher than 2666 MT/s | 	// Allow memory speeds higher than 2666 MT/s | ||||||
| 	memupd->FspmConfig.SaOcSupport = 1; | 	memupd->FspmConfig.SaOcSupport = 1; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -7,6 +7,7 @@ config BOARD_SPECIFIC_OPTIONS | |||||||
| 	select BOARD_ROMSIZE_KB_16384 | 	select BOARD_ROMSIZE_KB_16384 | ||||||
| 	select DRIVERS_GENERIC_CBFS_SERIAL | 	select DRIVERS_GENERIC_CBFS_SERIAL | ||||||
| 	select DRIVERS_GENERIC_CBFS_UUID | 	select DRIVERS_GENERIC_CBFS_UUID | ||||||
|  | 	select DRIVERS_GFX_NVIDIA | ||||||
| 	select DRIVERS_I2C_HID | 	select DRIVERS_I2C_HID | ||||||
| 	select DRIVERS_I2C_TAS5825M | 	select DRIVERS_I2C_TAS5825M | ||||||
| 	select EC_SYSTEM76_EC | 	select EC_SYSTEM76_EC | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| ## SPDX-License-Identifier: GPL-2.0-only | ## SPDX-License-Identifier: GPL-2.0-only | ||||||
|  |  | ||||||
| CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include | CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include | ||||||
|  | CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include | ||||||
|  |  | ||||||
| bootblock-y += bootblock.c | bootblock-y += bootblock.c | ||||||
| bootblock-y += variants/$(VARIANT_DIR)/gpio_early.c | bootblock-y += variants/$(VARIANT_DIR)/gpio_early.c | ||||||
|   | |||||||
| @@ -1,5 +1,7 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #include <variant/gpio.h> | ||||||
|  |  | ||||||
| #define EC_GPE_SCI 0x03 /* GPP_K3 */ | #define EC_GPE_SCI 0x03 /* GPP_K3 */ | ||||||
| #define EC_GPE_SWI 0x06 /* GPP_K6 */ | #define EC_GPE_SWI 0x06 /* GPP_K6 */ | ||||||
| #include <ec/system76/ec/acpi/ec.asl> | #include <ec/system76/ec/acpi/ec.asl> | ||||||
| @@ -8,6 +10,10 @@ Scope (\_SB) { | |||||||
| 	#include "sleep.asl" | 	#include "sleep.asl" | ||||||
| 	Scope (PCI0) { | 	Scope (PCI0) { | ||||||
| 		#include "backlight.asl" | 		#include "backlight.asl" | ||||||
|  | 		Device (PEGP) { | ||||||
|  | 			Name (_ADR, CONFIG_DRIVERS_GFX_NVIDIA_BRIDGE << 16) | ||||||
|  | 			#include <drivers/gfx/nvidia/acpi/coffeelake.asl> | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -60,6 +60,12 @@ chip soc/intel/cannonlake | |||||||
| 			# PCI Express Graphics #0 x16, Clock 8 (NVIDIA GPU) | 			# PCI Express Graphics #0 x16, Clock 8 (NVIDIA GPU) | ||||||
| 			register "PcieClkSrcUsage[8]" = "0x40" | 			register "PcieClkSrcUsage[8]" = "0x40" | ||||||
| 			register "PcieClkSrcClkReq[8]" = "8" | 			register "PcieClkSrcClkReq[8]" = "8" | ||||||
|  | 			chip drivers/gfx/nvidia | ||||||
|  | 				device pci 00.0 on end # VGA controller | ||||||
|  | 				device pci 00.1 on end # Audio device | ||||||
|  | 				device pci 00.2 on end # USB xHCI Host controller | ||||||
|  | 				device pci 00.3 on end # USB Type-C UCSI controller | ||||||
|  | 			end | ||||||
| 		end | 		end | ||||||
| 		device pci 02.0 on      # Integrated Graphics Device | 		device pci 02.0 on      # Integrated Graphics Device | ||||||
| 			register "gfx" = "GMA_DEFAULT_PANEL(0)" | 			register "gfx" = "GMA_DEFAULT_PANEL(0)" | ||||||
|   | |||||||
| @@ -1,7 +1,9 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #include <drivers/gfx/nvidia/gpu.h> | ||||||
| #include <soc/cnl_memcfg_init.h> | #include <soc/cnl_memcfg_init.h> | ||||||
| #include <soc/romstage.h> | #include <soc/romstage.h> | ||||||
|  | #include <variant/gpio.h> | ||||||
| #include <variant/romstage.h> | #include <variant/romstage.h> | ||||||
|  |  | ||||||
| static const struct cnl_mb_cfg memcfg = { | static const struct cnl_mb_cfg memcfg = { | ||||||
| @@ -21,6 +23,18 @@ static const struct cnl_mb_cfg memcfg = { | |||||||
|  |  | ||||||
| void mainboard_memory_init_params(FSPM_UPD *memupd) | void mainboard_memory_init_params(FSPM_UPD *memupd) | ||||||
| { | { | ||||||
|  | 	const struct nvidia_gpu_config config = { | ||||||
|  | 		.power_gpio = DGPU_PWR_EN, | ||||||
|  | 		.reset_gpio = DGPU_RST_N, | ||||||
|  | 		.enable = true, | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	// Enable dGPU power | ||||||
|  | 	nvidia_set_power(&config); | ||||||
|  |  | ||||||
|  | 	// Set primary display to internal graphics | ||||||
|  | 	memupd->FspmConfig.PrimaryDisplay = 0; | ||||||
|  |  | ||||||
| 	variant_configure_fspm(memupd); | 	variant_configure_fspm(memupd); | ||||||
|  |  | ||||||
| 	cannonlake_memcfg_init(&memupd->FspmConfig, &memcfg); | 	cannonlake_memcfg_init(&memupd->FspmConfig, &memcfg); | ||||||
|   | |||||||
| @@ -0,0 +1,18 @@ | |||||||
|  | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #ifndef VARIANT_GPIO_H | ||||||
|  | #define VARIANT_GPIO_H | ||||||
|  |  | ||||||
|  | #include <soc/gpio.h> | ||||||
|  |  | ||||||
|  | #define DGPU_RST_N	GPP_F22 | ||||||
|  | #define DGPU_PWR_EN	GPP_F23 | ||||||
|  | #define DGPU_GC6	GPP_K21 | ||||||
|  | #define DGPU_SSID	0x50d31558 | ||||||
|  |  | ||||||
|  | #ifndef __ACPI__ | ||||||
|  | void variant_configure_early_gpios(void); | ||||||
|  | void variant_configure_gpios(void); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif | ||||||
| @@ -0,0 +1,18 @@ | |||||||
|  | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #ifndef VARIANT_GPIO_H | ||||||
|  | #define VARIANT_GPIO_H | ||||||
|  |  | ||||||
|  | #include <soc/gpio.h> | ||||||
|  |  | ||||||
|  | #define DGPU_RST_N	GPP_F22 | ||||||
|  | #define DGPU_PWR_EN	GPP_F23 | ||||||
|  | #define DGPU_GC6	GPP_K21 | ||||||
|  | #define DGPU_SSID	0x65e51558 | ||||||
|  |  | ||||||
|  | #ifndef __ACPI__ | ||||||
|  | void variant_configure_early_gpios(void); | ||||||
|  | void variant_configure_gpios(void); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif | ||||||
| @@ -27,6 +27,8 @@ config BOARD_SYSTEM76_RPL_COMMON | |||||||
|  |  | ||||||
| config BOARD_SYSTEM76_ADDW3 | config BOARD_SYSTEM76_ADDW3 | ||||||
| 	select BOARD_SYSTEM76_RPL_COMMON | 	select BOARD_SYSTEM76_RPL_COMMON | ||||||
|  | 	select DRIVERS_GFX_NVIDIA | ||||||
|  | 	select DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST | ||||||
| 	select DRIVERS_INTEL_DTBT | 	select DRIVERS_INTEL_DTBT | ||||||
| 	select EC_SYSTEM76_EC_DGPU | 	select EC_SYSTEM76_EC_DGPU | ||||||
| 	select MAINBOARD_USES_IFD_GBE_REGION | 	select MAINBOARD_USES_IFD_GBE_REGION | ||||||
| @@ -35,6 +37,8 @@ config BOARD_SYSTEM76_ADDW3 | |||||||
|  |  | ||||||
| config BOARD_SYSTEM76_BONW15 | config BOARD_SYSTEM76_BONW15 | ||||||
| 	select BOARD_SYSTEM76_RPL_COMMON | 	select BOARD_SYSTEM76_RPL_COMMON | ||||||
|  | 	select DRIVERS_GFX_NVIDIA | ||||||
|  | 	select DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST | ||||||
| 	select DRIVERS_INTEL_DTBT | 	select DRIVERS_INTEL_DTBT | ||||||
| 	select EC_SYSTEM76_EC_DGPU | 	select EC_SYSTEM76_EC_DGPU | ||||||
| 	select PCIEXP_HOTPLUG | 	select PCIEXP_HOTPLUG | ||||||
| @@ -52,6 +56,8 @@ config BOARD_SYSTEM76_GALP7 | |||||||
|  |  | ||||||
| config BOARD_SYSTEM76_GAZE18 | config BOARD_SYSTEM76_GAZE18 | ||||||
| 	select BOARD_SYSTEM76_RPL_COMMON | 	select BOARD_SYSTEM76_RPL_COMMON | ||||||
|  | 	select DRIVERS_GFX_NVIDIA | ||||||
|  | 	select DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST | ||||||
| 	select EC_SYSTEM76_EC_DGPU | 	select EC_SYSTEM76_EC_DGPU | ||||||
| 	select SOC_INTEL_ALDERLAKE_PCH_P | 	select SOC_INTEL_ALDERLAKE_PCH_P | ||||||
|  |  | ||||||
| @@ -63,12 +69,16 @@ config BOARD_SYSTEM76_LEMP12 | |||||||
|  |  | ||||||
| config BOARD_SYSTEM76_ORYP11 | config BOARD_SYSTEM76_ORYP11 | ||||||
| 	select BOARD_SYSTEM76_RPL_COMMON | 	select BOARD_SYSTEM76_RPL_COMMON | ||||||
|  | 	select DRIVERS_GFX_NVIDIA | ||||||
|  | 	select DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST | ||||||
| 	select EC_SYSTEM76_EC_DGPU | 	select EC_SYSTEM76_EC_DGPU | ||||||
| 	select SOC_INTEL_ALDERLAKE_PCH_P | 	select SOC_INTEL_ALDERLAKE_PCH_P | ||||||
| 	select SOC_INTEL_ENABLE_USB4_PCIE_RESOURCES | 	select SOC_INTEL_ENABLE_USB4_PCIE_RESOURCES | ||||||
|  |  | ||||||
| config BOARD_SYSTEM76_SERW13 | config BOARD_SYSTEM76_SERW13 | ||||||
| 	select BOARD_SYSTEM76_RPL_COMMON | 	select BOARD_SYSTEM76_RPL_COMMON | ||||||
|  | 	select DRIVERS_GFX_NVIDIA | ||||||
|  | 	select DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST | ||||||
| 	select DRIVERS_INTEL_DTBT | 	select DRIVERS_INTEL_DTBT | ||||||
| 	select EC_SYSTEM76_EC_DGPU | 	select EC_SYSTEM76_EC_DGPU | ||||||
| 	select PCIEXP_HOTPLUG | 	select PCIEXP_HOTPLUG | ||||||
| @@ -131,6 +141,17 @@ config D3COLD_SUPPORT | |||||||
| config DIMM_SPD_SIZE | config DIMM_SPD_SIZE | ||||||
| 	default 512 | 	default 512 | ||||||
|  |  | ||||||
|  | config DRIVERS_GFX_NVIDIA_BRIDGE | ||||||
|  | 	default 0x02 if BOARD_SYSTEM76_BONW15 | ||||||
|  |  | ||||||
|  | config DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST_TPP | ||||||
|  | 	default 45 if BOARD_SYSTEM76_ORYP11 | ||||||
|  | 	default 55 if BOARD_SYSTEM76_ADDW3 || BOARD_SYSTEM76_GAZE18 || BOARD_SYSTEM76_SERW13 | ||||||
|  | 	default 80 if BOARD_SYSTEM76_BONW15 | ||||||
|  |  | ||||||
|  | config DRIVERS_GFX_NVIDIA_DYNAMIC_BOOST_MAX | ||||||
|  | 	default 25 if BOARD_SYSTEM76_ADDW3 || BOARD_SYSTEM76_BONW15 || BOARD_SYSTEM76_GAZE18 || BOARD_SYSTEM76_ORYP11 || BOARD_SYSTEM76_SERW13 | ||||||
|  |  | ||||||
| config FMDFILE | config FMDFILE | ||||||
| 	default "src/mainboard/\$(CONFIG_MAINBOARD_DIR)/variants/\$(CONFIG_VARIANT_DIR)/board.fmd" | 	default "src/mainboard/\$(CONFIG_MAINBOARD_DIR)/variants/\$(CONFIG_VARIANT_DIR)/board.fmd" | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,6 +2,10 @@ | |||||||
|  |  | ||||||
| CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include | CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include | ||||||
|  |  | ||||||
|  | ifeq ($(CONFIG_DRIVERS_GFX_NVIDIA),y) | ||||||
|  | CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include | ||||||
|  | endif | ||||||
|  |  | ||||||
| bootblock-y += bootblock.c | bootblock-y += bootblock.c | ||||||
| bootblock-y += variants/$(VARIANT_DIR)/gpio_early.c | bootblock-y += variants/$(VARIANT_DIR)/gpio_early.c | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,5 +1,9 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #if CONFIG(DRIVERS_GFX_NVIDIA) | ||||||
|  | #include <variant/gpio.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #define EC_GPE_SCI 0x6E | #define EC_GPE_SCI 0x6E | ||||||
| #define EC_GPE_SWI 0x6B | #define EC_GPE_SWI 0x6B | ||||||
| #include <ec/system76/ec/acpi/ec.asl> | #include <ec/system76/ec/acpi/ec.asl> | ||||||
| @@ -8,5 +12,17 @@ Scope (\_SB) { | |||||||
| 	#include "sleep.asl" | 	#include "sleep.asl" | ||||||
| 	Scope (PCI0) { | 	Scope (PCI0) { | ||||||
| 		#include "backlight.asl" | 		#include "backlight.asl" | ||||||
|  |  | ||||||
|  | #if CONFIG(DRIVERS_GFX_NVIDIA) | ||||||
|  | #if CONFIG(SOC_INTEL_ALDERLAKE_PCH_P) || CONFIG(BOARD_SYSTEM76_BONW15) | ||||||
|  | 		Scope (PEG2) { | ||||||
|  | 			#include <drivers/gfx/nvidia/acpi/tigerlake.asl> | ||||||
|  | 		} | ||||||
|  | #else | ||||||
|  | 		Scope (PEG1) { | ||||||
|  | 			#include <drivers/gfx/nvidia/acpi/tigerlake.asl> | ||||||
|  | 		} | ||||||
|  | #endif | ||||||
|  | #endif // CONFIG(DRIVERS_GFX_NVIDIA) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -0,0 +1,13 @@ | |||||||
|  | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #ifndef VARIANT_GPIO_H | ||||||
|  | #define VARIANT_GPIO_H | ||||||
|  |  | ||||||
|  | #include <soc/gpio.h> | ||||||
|  |  | ||||||
|  | #define DGPU_RST_N	GPP_R16 | ||||||
|  | #define DGPU_PWR_EN	GPP_F9 | ||||||
|  | #define DGPU_GC6	GPP_F8 | ||||||
|  | #define DGPU_SSID	0xa6711558 | ||||||
|  |  | ||||||
|  | #endif | ||||||
| @@ -1,7 +1,9 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #include <drivers/gfx/nvidia/gpu.h> | ||||||
| #include <soc/meminit.h> | #include <soc/meminit.h> | ||||||
| #include <soc/romstage.h> | #include <soc/romstage.h> | ||||||
|  | #include <variant/gpio.h> | ||||||
|  |  | ||||||
| void mainboard_memory_init_params(FSPM_UPD *mupd) | void mainboard_memory_init_params(FSPM_UPD *mupd) | ||||||
| { | { | ||||||
| @@ -22,6 +24,15 @@ void mainboard_memory_init_params(FSPM_UPD *mupd) | |||||||
| 	}; | 	}; | ||||||
| 	const bool half_populated = false; | 	const bool half_populated = false; | ||||||
|  |  | ||||||
|  | 	const struct nvidia_gpu_config config = { | ||||||
|  | 		.power_gpio = DGPU_PWR_EN, | ||||||
|  | 		.reset_gpio = DGPU_RST_N, | ||||||
|  | 		.enable = true, | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	// Enable dGPU power | ||||||
|  | 	nvidia_set_power(&config); | ||||||
|  |  | ||||||
| 	// Set primary display to internal graphics | 	// Set primary display to internal graphics | ||||||
| 	mupd->FspmConfig.PrimaryDisplay = 0; | 	mupd->FspmConfig.PrimaryDisplay = 0; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -0,0 +1,13 @@ | |||||||
|  | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #ifndef VARIANT_GPIO_H | ||||||
|  | #define VARIANT_GPIO_H | ||||||
|  |  | ||||||
|  | #include <soc/gpio.h> | ||||||
|  |  | ||||||
|  | #define DGPU_RST_N	GPP_R16 | ||||||
|  | #define DGPU_PWR_EN	GPP_F22 | ||||||
|  | #define DGPU_GC6	GPP_F8 | ||||||
|  | #define DGPU_SSID	0x37021558 | ||||||
|  |  | ||||||
|  | #endif | ||||||
| @@ -1,7 +1,9 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #include <drivers/gfx/nvidia/gpu.h> | ||||||
| #include <soc/meminit.h> | #include <soc/meminit.h> | ||||||
| #include <soc/romstage.h> | #include <soc/romstage.h> | ||||||
|  | #include <variant/gpio.h> | ||||||
|  |  | ||||||
| void mainboard_memory_init_params(FSPM_UPD *mupd) | void mainboard_memory_init_params(FSPM_UPD *mupd) | ||||||
| { | { | ||||||
| @@ -22,6 +24,15 @@ void mainboard_memory_init_params(FSPM_UPD *mupd) | |||||||
| 	}; | 	}; | ||||||
| 	const bool half_populated = false; | 	const bool half_populated = false; | ||||||
|  |  | ||||||
|  | 	const struct nvidia_gpu_config config = { | ||||||
|  | 		.power_gpio = DGPU_PWR_EN, | ||||||
|  | 		.reset_gpio = DGPU_RST_N, | ||||||
|  | 		.enable = true, | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	// Enable dGPU power | ||||||
|  | 	nvidia_set_power(&config); | ||||||
|  |  | ||||||
| 	// Set primary display to internal graphics | 	// Set primary display to internal graphics | ||||||
| 	mupd->FspmConfig.PrimaryDisplay = 0; | 	mupd->FspmConfig.PrimaryDisplay = 0; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -0,0 +1,13 @@ | |||||||
|  | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #ifndef VARIANT_GPIO_H | ||||||
|  | #define VARIANT_GPIO_H | ||||||
|  |  | ||||||
|  | #include <soc/gpio.h> | ||||||
|  |  | ||||||
|  | #define DGPU_RST_N	GPP_B2 | ||||||
|  | #define DGPU_PWR_EN	GPP_A14 | ||||||
|  | #define DGPU_GC6	GPP_F13 | ||||||
|  | #define DGPU_SSID	0x56301558 | ||||||
|  |  | ||||||
|  | #endif | ||||||
| @@ -1,7 +1,9 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #include <drivers/gfx/nvidia/gpu.h> | ||||||
| #include <soc/meminit.h> | #include <soc/meminit.h> | ||||||
| #include <soc/romstage.h> | #include <soc/romstage.h> | ||||||
|  | #include <variant/gpio.h> | ||||||
|  |  | ||||||
| void mainboard_memory_init_params(FSPM_UPD *mupd) | void mainboard_memory_init_params(FSPM_UPD *mupd) | ||||||
| { | { | ||||||
| @@ -19,6 +21,15 @@ void mainboard_memory_init_params(FSPM_UPD *mupd) | |||||||
| 	}; | 	}; | ||||||
| 	const bool half_populated = false; | 	const bool half_populated = false; | ||||||
|  |  | ||||||
|  | 	const struct nvidia_gpu_config config = { | ||||||
|  | 		.power_gpio = DGPU_PWR_EN, | ||||||
|  | 		.reset_gpio = DGPU_RST_N, | ||||||
|  | 		.enable = true, | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	// Enable dGPU power | ||||||
|  | 	nvidia_set_power(&config); | ||||||
|  |  | ||||||
| 	// Set primary display to internal graphics | 	// Set primary display to internal graphics | ||||||
| 	mupd->FspmConfig.PrimaryDisplay = 0; | 	mupd->FspmConfig.PrimaryDisplay = 0; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -0,0 +1,13 @@ | |||||||
|  | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #ifndef VARIANT_GPIO_H | ||||||
|  | #define VARIANT_GPIO_H | ||||||
|  |  | ||||||
|  | #include <soc/gpio.h> | ||||||
|  |  | ||||||
|  | #define DGPU_RST_N	GPP_B2 | ||||||
|  | #define DGPU_PWR_EN	GPP_A14 | ||||||
|  | #define DGPU_GC6	GPP_F13 | ||||||
|  | #define DGPU_SSID	0x66a21558 | ||||||
|  |  | ||||||
|  | #endif | ||||||
| @@ -1,7 +1,9 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #include <drivers/gfx/nvidia/gpu.h> | ||||||
| #include <soc/meminit.h> | #include <soc/meminit.h> | ||||||
| #include <soc/romstage.h> | #include <soc/romstage.h> | ||||||
|  | #include <variant/gpio.h> | ||||||
|  |  | ||||||
| void mainboard_memory_init_params(FSPM_UPD *mupd) | void mainboard_memory_init_params(FSPM_UPD *mupd) | ||||||
| { | { | ||||||
| @@ -19,6 +21,15 @@ void mainboard_memory_init_params(FSPM_UPD *mupd) | |||||||
| 	}; | 	}; | ||||||
| 	const bool half_populated = false; | 	const bool half_populated = false; | ||||||
|  |  | ||||||
|  | 	const struct nvidia_gpu_config config = { | ||||||
|  | 		.power_gpio = DGPU_PWR_EN, | ||||||
|  | 		.reset_gpio = DGPU_RST_N, | ||||||
|  | 		.enable = true, | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	// Enable dGPU power | ||||||
|  | 	nvidia_set_power(&config); | ||||||
|  |  | ||||||
| 	// Set primary display to internal graphics | 	// Set primary display to internal graphics | ||||||
| 	mupd->FspmConfig.PrimaryDisplay = 0; | 	mupd->FspmConfig.PrimaryDisplay = 0; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -0,0 +1,13 @@ | |||||||
|  | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #ifndef VARIANT_GPIO_H | ||||||
|  | #define VARIANT_GPIO_H | ||||||
|  |  | ||||||
|  | #include <soc/gpio.h> | ||||||
|  |  | ||||||
|  | #define DGPU_RST_N	GPP_R16 | ||||||
|  | #define DGPU_PWR_EN	GPP_F9 | ||||||
|  | #define DGPU_GC6	GPP_A11 | ||||||
|  | #define DGPU_SSID	0xd5021558 | ||||||
|  |  | ||||||
|  | #endif | ||||||
| @@ -1,7 +1,9 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #include <drivers/gfx/nvidia/gpu.h> | ||||||
| #include <soc/meminit.h> | #include <soc/meminit.h> | ||||||
| #include <soc/romstage.h> | #include <soc/romstage.h> | ||||||
|  | #include <variant/gpio.h> | ||||||
|  |  | ||||||
| void mainboard_memory_init_params(FSPM_UPD *mupd) | void mainboard_memory_init_params(FSPM_UPD *mupd) | ||||||
| { | { | ||||||
| @@ -22,6 +24,14 @@ void mainboard_memory_init_params(FSPM_UPD *mupd) | |||||||
| 	}; | 	}; | ||||||
| 	const bool half_populated = false; | 	const bool half_populated = false; | ||||||
|  |  | ||||||
|  | 	const struct nvidia_gpu_config config = { | ||||||
|  | 		.power_gpio = DGPU_PWR_EN, | ||||||
|  | 		.reset_gpio = DGPU_RST_N, | ||||||
|  | 		.enable = true, | ||||||
|  | 	}; | ||||||
|  | 	// Enable dGPU power | ||||||
|  | 	nvidia_set_power(&config); | ||||||
|  |  | ||||||
| 	// Set primary display to internal graphics | 	// Set primary display to internal graphics | ||||||
| 	mupd->FspmConfig.PrimaryDisplay = 0; | 	mupd->FspmConfig.PrimaryDisplay = 0; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -8,6 +8,7 @@ config BOARD_SPECIFIC_OPTIONS | |||||||
| 	select DRIVERS_GENERIC_BAYHUB_LV2 | 	select DRIVERS_GENERIC_BAYHUB_LV2 | ||||||
| 	select DRIVERS_GENERIC_CBFS_SERIAL | 	select DRIVERS_GENERIC_CBFS_SERIAL | ||||||
| 	select DRIVERS_GENERIC_CBFS_UUID | 	select DRIVERS_GENERIC_CBFS_UUID | ||||||
|  | 	select DRIVERS_GFX_NVIDIA | ||||||
| 	select DRIVERS_I2C_HID | 	select DRIVERS_I2C_HID | ||||||
| 	select DRIVERS_I2C_TAS5825M if BOARD_SYSTEM76_ORYP8 | 	select DRIVERS_I2C_TAS5825M if BOARD_SYSTEM76_ORYP8 | ||||||
| 	select EC_SYSTEM76_EC | 	select EC_SYSTEM76_EC | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| ## SPDX-License-Identifier: GPL-2.0-only | ## SPDX-License-Identifier: GPL-2.0-only | ||||||
|  |  | ||||||
| CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include | CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include | ||||||
|  | CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include | ||||||
|  |  | ||||||
| bootblock-y += bootblock.c | bootblock-y += bootblock.c | ||||||
| bootblock-y += variants/$(VARIANT_DIR)/gpio_early.c | bootblock-y += variants/$(VARIANT_DIR)/gpio_early.c | ||||||
|   | |||||||
| @@ -1,5 +1,7 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #include <variant/gpio.h> | ||||||
|  |  | ||||||
| #define EC_GPE_SCI 0x6E | #define EC_GPE_SCI 0x6E | ||||||
| #define EC_GPE_SWI 0x6B | #define EC_GPE_SWI 0x6B | ||||||
| #include <ec/system76/ec/acpi/ec.asl> | #include <ec/system76/ec/acpi/ec.asl> | ||||||
| @@ -8,5 +10,8 @@ Scope (\_SB) { | |||||||
| 	#include "sleep.asl" | 	#include "sleep.asl" | ||||||
| 	Scope (PCI0) { | 	Scope (PCI0) { | ||||||
| 		#include "backlight.asl" | 		#include "backlight.asl" | ||||||
|  | 		Scope (PEG1) { | ||||||
|  | 			#include <drivers/gfx/nvidia/acpi/tigerlake.asl> | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,7 +1,9 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #include <drivers/gfx/nvidia/gpu.h> | ||||||
| #include <soc/meminit.h> | #include <soc/meminit.h> | ||||||
| #include <soc/romstage.h> | #include <soc/romstage.h> | ||||||
|  | #include <variant/gpio.h> | ||||||
| #include <variant/romstage.h> | #include <variant/romstage.h> | ||||||
|  |  | ||||||
| static const struct mb_cfg board_cfg = { | static const struct mb_cfg board_cfg = { | ||||||
| @@ -21,9 +23,21 @@ static const struct mem_spd spd_info = { | |||||||
|  |  | ||||||
| void mainboard_memory_init_params(FSPM_UPD *mupd) | void mainboard_memory_init_params(FSPM_UPD *mupd) | ||||||
| { | { | ||||||
| 	variant_memory_init_params(mupd); |  | ||||||
|  |  | ||||||
| 	const bool half_populated = false; | 	const bool half_populated = false; | ||||||
|  |  | ||||||
|  | 	const struct nvidia_gpu_config config = { | ||||||
|  | 		.power_gpio = DGPU_PWR_EN, | ||||||
|  | 		.reset_gpio = DGPU_RST_N, | ||||||
|  | 		.enable = true, | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	// Enable dGPU power | ||||||
|  | 	nvidia_set_power(&config); | ||||||
|  |  | ||||||
|  | 	// Set primary display to internal graphics | ||||||
|  | 	mupd->FspmConfig.PrimaryDisplay = 0; | ||||||
|  |  | ||||||
|  | 	variant_memory_init_params(mupd); | ||||||
|  |  | ||||||
| 	memcfg_init(mupd, &board_cfg, &spd_info, half_populated); | 	memcfg_init(mupd, &board_cfg, &spd_info, half_populated); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -3,7 +3,16 @@ | |||||||
| #ifndef VARIANT_GPIO_H | #ifndef VARIANT_GPIO_H | ||||||
| #define VARIANT_GPIO_H | #define VARIANT_GPIO_H | ||||||
| 
 | 
 | ||||||
|  | #include <soc/gpio.h> | ||||||
|  | 
 | ||||||
|  | #define DGPU_RST_N	GPP_F8 | ||||||
|  | #define DGPU_PWR_EN	GPP_F9 | ||||||
|  | #define DGPU_GC6	GPP_K11 | ||||||
|  | #define DGPU_SSID	0x50151558 | ||||||
|  | 
 | ||||||
|  | #ifndef __ACPI__ | ||||||
| void variant_configure_early_gpios(void); | void variant_configure_early_gpios(void); | ||||||
| void variant_configure_gpios(void); | void variant_configure_gpios(void); | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
| @@ -6,15 +6,11 @@ chip soc/intel/tigerlake | |||||||
| 			# PCIe PEG2 (remapped to PEG1 by FSP) x8, Clock 0 (DGPU) | 			# PCIe PEG2 (remapped to PEG1 by FSP) x8, Clock 0 (DGPU) | ||||||
| 			register "PcieClkSrcUsage[0]" = "0x42" | 			register "PcieClkSrcUsage[0]" = "0x42" | ||||||
| 			register "PcieClkSrcClkReq[0]" = "0" | 			register "PcieClkSrcClkReq[0]" = "0" | ||||||
| 			chip soc/intel/common/block/pcie/rtd3 | 			chip drivers/gfx/nvidia | ||||||
| 				register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_F9)" # DGPU_PWR_EN | 				device pci 00.0 on end # VGA controller | ||||||
| 				register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_F8)" # DGPU_RST#_PCH | 				device pci 00.1 on end # Audio device | ||||||
| 				register "enable_delay_ms" = "16" | 				device pci 00.2 on end # USB xHCI Host controller | ||||||
| 				register "enable_off_delay_ms" = "4" | 				device pci 00.3 on end # USB Type-C UCSI controller | ||||||
| 				register "reset_delay_ms" = "10" |  | ||||||
| 				register "reset_off_delay_ms" = "4" |  | ||||||
| 				register "srcclk_pin" = "0" # GFX_CLKREQ0# |  | ||||||
| 				device generic 0 on end |  | ||||||
| 			end | 			end | ||||||
| 		end | 		end | ||||||
| 		device ref igpu on | 		device ref igpu on | ||||||
|   | |||||||
| @@ -3,7 +3,16 @@ | |||||||
| #ifndef VARIANT_GPIO_H | #ifndef VARIANT_GPIO_H | ||||||
| #define VARIANT_GPIO_H | #define VARIANT_GPIO_H | ||||||
| 
 | 
 | ||||||
|  | #include <soc/gpio.h> | ||||||
|  | 
 | ||||||
|  | #define DGPU_RST_N	GPP_F8 | ||||||
|  | #define DGPU_PWR_EN	GPP_F9 | ||||||
|  | #define DGPU_GC6	GPP_K11 | ||||||
|  | #define DGPU_SSID	0x50e11558 | ||||||
|  | 
 | ||||||
|  | #ifndef __ACPI__ | ||||||
| void variant_configure_early_gpios(void); | void variant_configure_early_gpios(void); | ||||||
| void variant_configure_gpios(void); | void variant_configure_gpios(void); | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
| @@ -6,15 +6,11 @@ chip soc/intel/tigerlake | |||||||
| 			# PCIe PEG1 x16, Clock 9 (DGPU) | 			# PCIe PEG1 x16, Clock 9 (DGPU) | ||||||
| 			register "PcieClkSrcUsage[9]" = "0x41" | 			register "PcieClkSrcUsage[9]" = "0x41" | ||||||
| 			register "PcieClkSrcClkReq[9]" = "9" | 			register "PcieClkSrcClkReq[9]" = "9" | ||||||
| 			chip soc/intel/common/block/pcie/rtd3 | 			chip drivers/gfx/nvidia | ||||||
| 				register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_F9)" # DGPU_PWR_EN | 				device pci 00.0 on end # VGA controller | ||||||
| 				register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_F8)" # DGPU_RST#_PCH | 				device pci 00.1 on end # Audio device | ||||||
| 				register "enable_delay_ms" = "16" | 				device pci 00.2 on end # USB xHCI Host controller | ||||||
| 				register "enable_off_delay_ms" = "4" | 				device pci 00.3 on end # USB Type-C UCSI controller | ||||||
| 				register "reset_delay_ms" = "10" |  | ||||||
| 				register "reset_off_delay_ms" = "4" |  | ||||||
| 				register "srcclk_pin" = "9" # PEG_CLKREQ# |  | ||||||
| 				device generic 0 on end |  | ||||||
| 			end | 			end | ||||||
| 		end | 		end | ||||||
| 		device ref igpu on | 		device ref igpu on | ||||||
|   | |||||||
| @@ -3,7 +3,16 @@ | |||||||
| #ifndef VARIANT_GPIO_H | #ifndef VARIANT_GPIO_H | ||||||
| #define VARIANT_GPIO_H | #define VARIANT_GPIO_H | ||||||
| 
 | 
 | ||||||
|  | #include <soc/gpio.h> | ||||||
|  | 
 | ||||||
|  | #define DGPU_RST_N	GPP_F8 | ||||||
|  | #define DGPU_PWR_EN	GPP_F9 | ||||||
|  | #define DGPU_GC6	GPP_K11 | ||||||
|  | #define DGPU_SSID	0x65f11558 | ||||||
|  | 
 | ||||||
|  | #ifndef __ACPI__ | ||||||
| void variant_configure_early_gpios(void); | void variant_configure_early_gpios(void); | ||||||
| void variant_configure_gpios(void); | void variant_configure_gpios(void); | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
| @@ -19,15 +19,11 @@ chip soc/intel/tigerlake | |||||||
| 			# PCIe PEG1 x16, Clock 9 (DGPU) | 			# PCIe PEG1 x16, Clock 9 (DGPU) | ||||||
| 			register "PcieClkSrcUsage[9]" = "0x41" | 			register "PcieClkSrcUsage[9]" = "0x41" | ||||||
| 			register "PcieClkSrcClkReq[9]" = "9" | 			register "PcieClkSrcClkReq[9]" = "9" | ||||||
| 			chip soc/intel/common/block/pcie/rtd3 | 			chip drivers/gfx/nvidia | ||||||
| 				register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_F9)" # DGPU_PWR_EN | 				device pci 00.0 on end # VGA controller | ||||||
| 				register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_F8)" # DGPU_RST#_PCH | 				device pci 00.1 on end # Audio device | ||||||
| 				register "enable_delay_ms" = "16" | 				device pci 00.2 on end # USB xHCI Host controller | ||||||
| 				register "enable_off_delay_ms" = "4" | 				device pci 00.3 on end # USB Type-C UCSI controller | ||||||
| 				register "reset_delay_ms" = "10" |  | ||||||
| 				register "reset_off_delay_ms" = "4" |  | ||||||
| 				register "srcclk_pin" = "9" # PEG_CLKREQ# |  | ||||||
| 				device generic 0 on end |  | ||||||
| 			end | 			end | ||||||
| 		end | 		end | ||||||
| 		device ref peg0 on | 		device ref peg0 on | ||||||
|   | |||||||
| @@ -8,6 +8,7 @@ config BOARD_SPECIFIC_OPTIONS | |||||||
| 	select DRIVERS_GENERIC_BAYHUB_LV2 | 	select DRIVERS_GENERIC_BAYHUB_LV2 | ||||||
| 	select DRIVERS_GENERIC_CBFS_SERIAL | 	select DRIVERS_GENERIC_CBFS_SERIAL | ||||||
| 	select DRIVERS_GENERIC_CBFS_UUID | 	select DRIVERS_GENERIC_CBFS_UUID | ||||||
|  | 	select DRIVERS_GFX_NVIDIA if BOARD_SYSTEM76_GALP5 | ||||||
| 	select DRIVERS_I2C_HID | 	select DRIVERS_I2C_HID | ||||||
| 	select DRIVERS_INTEL_PMC | 	select DRIVERS_INTEL_PMC | ||||||
| 	select DRIVERS_INTEL_USB4_RETIMER | 	select DRIVERS_INTEL_USB4_RETIMER | ||||||
| @@ -73,4 +74,15 @@ config UART_FOR_CONSOLE | |||||||
| config USE_PM_ACPI_TIMER | config USE_PM_ACPI_TIMER | ||||||
| 	default n | 	default n | ||||||
|  |  | ||||||
|  | # For galp5 with dGPU | ||||||
|  | if DRIVERS_GFX_NVIDIA | ||||||
|  |  | ||||||
|  | config ONBOARD_VGA_IS_PRIMARY | ||||||
|  | 	default y | ||||||
|  |  | ||||||
|  | config DRIVERS_GFX_NVIDIA_BRIDGE | ||||||
|  | 	default 0x1c | ||||||
|  |  | ||||||
|  | endif # DRIVERS_GFX_NVIDIA | ||||||
|  |  | ||||||
| endif | endif | ||||||
|   | |||||||
| @@ -1,5 +1,9 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
|  | #if CONFIG(BOARD_SYSTEM76_GALP5) | ||||||
|  | #include <variant/gpio.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #define EC_GPE_SCI 0x6E | #define EC_GPE_SCI 0x6E | ||||||
| #define EC_GPE_SWI 0x6B | #define EC_GPE_SWI 0x6B | ||||||
| #include <ec/system76/ec/acpi/ec.asl> | #include <ec/system76/ec/acpi/ec.asl> | ||||||
| @@ -8,5 +12,10 @@ Scope (\_SB) { | |||||||
| 	#include "sleep.asl" | 	#include "sleep.asl" | ||||||
| 	Scope (PCI0) { | 	Scope (PCI0) { | ||||||
| 		#include "backlight.asl" | 		#include "backlight.asl" | ||||||
|  | #if CONFIG(BOARD_SYSTEM76_GALP5) | ||||||
|  | 		Scope (RP01) { // Remapped from RP05 | ||||||
|  | 			#include <drivers/gfx/nvidia/acpi/tigerlake.asl> | ||||||
|  | 		} | ||||||
|  | #endif | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -144,15 +144,11 @@ chip soc/intel/tigerlake | |||||||
| 			register "PcieRpLtrEnable[4]" = "1" | 			register "PcieRpLtrEnable[4]" = "1" | ||||||
| 			register "PcieClkSrcUsage[2]" = "4" | 			register "PcieClkSrcUsage[2]" = "4" | ||||||
| 			register "PcieClkSrcClkReq[2]" = "2" | 			register "PcieClkSrcClkReq[2]" = "2" | ||||||
| 			chip soc/intel/common/block/pcie/rtd3 | 			chip drivers/gfx/nvidia | ||||||
| 				register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_U5)" # DGPU_PWR_EN | 				device pci 00.0 on end # VGA controller | ||||||
| 				register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_U4)" # DGPU_RST#_PCH | 				device pci 00.1 on end # Audio device | ||||||
| 				register "enable_delay_ms" = "16" | 				device pci 00.2 on end # USB xHCI Host controller | ||||||
| 				register "enable_off_delay_ms" = "4" | 				device pci 00.3 on end # USB Type-C UCSI controller | ||||||
| 				register "reset_delay_ms" = "10" |  | ||||||
| 				register "reset_off_delay_ms" = "4" |  | ||||||
| 				register "srcclk_pin" = "2" # PEG_CLKREQ# |  | ||||||
| 				device generic 0 on end |  | ||||||
| 			end | 			end | ||||||
| 		end | 		end | ||||||
| 		device ref pcie_rp9 on | 		device ref pcie_rp9 on | ||||||
|   | |||||||
| @@ -1,8 +1,9 @@ | |||||||
| /* SPDX-License-Identifier: GPL-2.0-only */ | /* SPDX-License-Identifier: GPL-2.0-only */ | ||||||
|  |  | ||||||
| #include <fsp/util.h> | #include <drivers/gfx/nvidia/gpu.h> | ||||||
| #include <soc/meminit.h> | #include <soc/meminit.h> | ||||||
| #include <soc/romstage.h> | #include <soc/romstage.h> | ||||||
|  | #include <variant/gpio.h> | ||||||
|  |  | ||||||
| void mainboard_memory_init_params(FSPM_UPD *mupd) | void mainboard_memory_init_params(FSPM_UPD *mupd) | ||||||
| { | { | ||||||
| @@ -18,5 +19,17 @@ void mainboard_memory_init_params(FSPM_UPD *mupd) | |||||||
| 	}; | 	}; | ||||||
| 	const bool half_populated = false; | 	const bool half_populated = false; | ||||||
|  |  | ||||||
|  | 	const struct nvidia_gpu_config config = { | ||||||
|  | 		.power_gpio = DGPU_PWR_EN, | ||||||
|  | 		.reset_gpio = DGPU_RST_N, | ||||||
|  | 		.enable = true, | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	// Enable dGPU power | ||||||
|  | 	nvidia_set_power(&config); | ||||||
|  |  | ||||||
|  | 	// Set primary display to internal graphics | ||||||
|  | 	mupd->FspmConfig.PrimaryDisplay = 0; | ||||||
|  |  | ||||||
| 	memcfg_init(mupd, &board_cfg, &spd_info, half_populated); | 	memcfg_init(mupd, &board_cfg, &spd_info, half_populated); | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user