summaryrefslogtreecommitdiff
path: root/src/soc/intel/broadwell/pch
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2020-10-23 22:35:41 +0200
committerAngel Pons <th3fanbus@gmail.com>2020-10-30 00:46:44 +0000
commit071754c9dc8b68ef63481688a787be3d8bc17bf2 (patch)
tree68feac0be1431bcb53c3c0a0578613dd0d2f8982 /src/soc/intel/broadwell/pch
parent9eaca7dcf42c173645627e5523e5d8d6b7b74b76 (diff)
downloadcoreboot-071754c9dc8b68ef63481688a787be3d8bc17bf2.tar.xz
soc/intel/broadwell: Relocate PCH finalisation code
Change-Id: I94a4194e935fddb99645ed2929bdd70583c2fd5b Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/46709 Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/intel/broadwell/pch')
-rw-r--r--src/soc/intel/broadwell/pch/Makefile.inc1
-rw-r--r--src/soc/intel/broadwell/pch/finalize.c51
2 files changed, 52 insertions, 0 deletions
diff --git a/src/soc/intel/broadwell/pch/Makefile.inc b/src/soc/intel/broadwell/pch/Makefile.inc
index 7e5c65aa76..1c196136c4 100644
--- a/src/soc/intel/broadwell/pch/Makefile.inc
+++ b/src/soc/intel/broadwell/pch/Makefile.inc
@@ -3,6 +3,7 @@ bootblock-y += bootblock.c
ramstage-y += adsp.c
romstage-y += early_pch.c
ramstage-$(CONFIG_ELOG) += elog.c
+ramstage-y += finalize.c
ramstage-y += gpio.c
romstage-y += gpio.c
smm-y += gpio.c
diff --git a/src/soc/intel/broadwell/pch/finalize.c b/src/soc/intel/broadwell/pch/finalize.c
new file mode 100644
index 0000000000..37afded317
--- /dev/null
+++ b/src/soc/intel/broadwell/pch/finalize.c
@@ -0,0 +1,51 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <device/pci_ops.h>
+#include <reg_script.h>
+#include <spi-generic.h>
+#include <soc/pci_devs.h>
+#include <soc/lpc.h>
+#include <soc/pch.h>
+#include <soc/rcba.h>
+#include <soc/spi.h>
+#include <southbridge/intel/common/spi.h>
+
+const struct reg_script pch_finalize_script[] = {
+#if !CONFIG(EM100PRO_SPI_CONSOLE)
+ /* Lock SPIBAR */
+ REG_MMIO_OR32(RCBA_BASE_ADDRESS + SPIBAR_OFFSET + SPIBAR_HSFS,
+ SPIBAR_HSFS_FLOCKDN),
+#endif
+
+ /* TC Lockdown */
+ REG_MMIO_OR32(RCBA_BASE_ADDRESS + 0x0050, (1 << 31)),
+
+ /* BIOS Interface Lockdown */
+ REG_MMIO_OR32(RCBA_BASE_ADDRESS + GCS, (1 << 0)),
+
+ /* Function Disable SUS Well Lockdown */
+ REG_MMIO_OR8(RCBA_BASE_ADDRESS + FDSW, (1 << 7)),
+
+ /* Global SMI Lock */
+ REG_PCI_OR16(GEN_PMCON_1, SMI_LOCK),
+
+ /* GEN_PMCON Lock */
+ REG_PCI_OR8(GEN_PMCON_LOCK, SLP_STR_POL_LOCK | ACPI_BASE_LOCK),
+
+ /* PMSYNC */
+ REG_MMIO_OR32(RCBA_BASE_ADDRESS + PMSYNC_CONFIG, (1 << 31)),
+
+ REG_SCRIPT_END
+};
+
+void broadwell_pch_finalize(void)
+{
+ spi_finalize_ops();
+ reg_script_run_on_dev(PCH_DEV_LPC, pch_finalize_script);
+
+ /* Lock */
+ RCBA32_OR(0x3a6c, 0x00000001);
+
+ /* Read+Write this R/WO register */
+ RCBA32(LCAP) = RCBA32(LCAP);
+}