blob: a3228e7e521c101227a7dede758f45b24f3daed9 [file] [log] [blame]
Angel Pons182dbde2020-04-02 23:49:05 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Stefan Reinauer8e073822012-04-04 00:07:22 +02002
Kyösti Mälkkide640782019-12-03 07:30:26 +02003#include <arch/bootblock.h>
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +02004#include <device/pci_ops.h>
Angel Ponsc9ee2c02020-06-21 17:58:59 +02005#include <southbridge/intel/common/early_spi.h>
Stefan Reinauer8e073822012-04-04 00:07:22 +02006#include "pch.h"
7
Stefan Reinauer8e073822012-04-04 00:07:22 +02008static void enable_port80_on_lpc(void)
9{
Stefan Reinauer8e073822012-04-04 00:07:22 +020010 /* Enable port 80 POST on LPC */
Stefan Reinauer8e073822012-04-04 00:07:22 +020011 RCBA32(GCS) &= (~0x04);
Stefan Reinauer8e073822012-04-04 00:07:22 +020012}
13
Duncan Laurie2a700ec2012-10-08 15:26:54 -070014static void set_spi_speed(void)
15{
16 u32 fdod;
17 u8 ssfc;
18
19 /* Observe SPI Descriptor Component Section 0 */
20 RCBA32(0x38b0) = 0x1000;
21
22 /* Extract the Write/Erase SPI Frequency from descriptor */
23 fdod = RCBA32(0x38b4);
24 fdod >>= 24;
25 fdod &= 7;
26
27 /* Set Software Sequence frequency to match */
28 ssfc = RCBA8(0x3893);
29 ssfc &= ~7;
30 ssfc |= fdod;
31 RCBA8(0x3893) = ssfc;
32}
33
Arthur Heymans360d9472019-11-12 18:11:03 +010034void bootblock_early_southbridge_init(void)
Stefan Reinauer8e073822012-04-04 00:07:22 +020035{
Angel Ponsc9ee2c02020-06-21 17:58:59 +020036 enable_spi_prefetching_and_caching();
Arthur Heymans360d9472019-11-12 18:11:03 +010037
38 early_pch_init();
39
Stefan Reinauer8e073822012-04-04 00:07:22 +020040 enable_port80_on_lpc();
Duncan Laurie2a700ec2012-10-08 15:26:54 -070041 set_spi_speed();
Duncan Laurie8e515d32012-06-23 15:43:41 -070042
43 /* Enable upper 128bytes of CMOS */
44 RCBA32(RC) = (1 << 2);
Stefan Reinauer8e073822012-04-04 00:07:22 +020045}