Debian Codegraph @

src/southbridge/intel/lynxpoint/bootblock.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <arch/bootblock.h>
4 #include <device/pci_ops.h>
5 #include <southbridge/intel/common/early_spi.h>
6 #include "pch.h"
7
8 static void map_rcba(void)
9 {
10 pci_write_config32(PCH_LPC_DEV, RCBA, CONFIG_FIXED_RCBA_MMIO_BASE | 1);
11 }
12
13 static void enable_port80_on_lpc(void)
14 {
15 /* Enable port 80 POST on LPC. The chipset does this by default,
16 * but it doesn't appear to hurt anything. */
17 u32 gcs = RCBA32(GCS);
18 gcs = gcs & ~0x4;
19 RCBA32(GCS) = gcs;
20 }
21
22 static void set_spi_speed(void)
23 {
24 u32 fdod;
25 u8 ssfc;
26
27 /* Observe SPI Descriptor Component Section 0 */
28 SPIBAR32(FDOC) = 0x1000;
29
30 /* Extract the Write/Erase SPI Frequency from descriptor */
31 fdod = SPIBAR32(FDOD);
32 fdod >>= 24;
33 fdod &= 7;
34
35 /* Set Software Sequence frequency to match */
36 ssfc = SPIBAR8(SSFC + 2);
37 ssfc &= ~7;
38 ssfc |= fdod;
39 SPIBAR8(SSFC + 2) = ssfc;
40 }
41
42 void bootblock_early_southbridge_init(void)
43 {
44 map_rcba();
45 enable_spi_prefetching_and_caching();
46 enable_port80_on_lpc();
47 set_spi_speed();
48
49 /* Enable upper 128bytes of CMOS */
50 RCBA32(RC) = (1 << 2);
51
52 pch_enable_lpc();
53 mainboard_config_superio();
54
55 /* Broadwell MRC.bin uses HPET, but does not enable it beforehand */
56 if (CONFIG(USE_BROADWELL_MRC)) {
57 /* Set HPET address and enable it */
58 RCBA32_AND_OR(HPTC, ~3, 1 << 7);
59
60 /*
61 * Reading the register back guarantees that the write is
62 * done before we use the configured base address below.
63 */
64 (void)RCBA32(HPTC);
65
66 /* Enable HPET to start counter */
67 setbits32((void *)0xfed00000 + 0x10, 1 << 0);
68 }
69
70 if (CONFIG(SERIALIO_UART_CONSOLE))
71 uart_bootblock_init();
72 }