blob: eea86fc1a9b2fea3a439e43d207555bc7bd031bc [file] [log] [blame]
Angel Pons3bd1e3d2020-04-05 15:47:17 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Lee Leahyb0005132015-05-12 18:19:47 -07002
Lee Leahyb0005132015-05-12 18:19:47 -07003#include <device/device.h>
4#include <device/pci.h>
Lee Leahyb0005132015-05-12 18:19:47 -07005#include <pc80/isa-dma.h>
6#include <pc80/i8259.h>
Lee Leahyb0005132015-05-12 18:19:47 -07007#include <arch/ioapic.h>
Bora Guvendik43c31092017-04-11 16:05:23 -07008#include <intelblocks/itss.h>
Ravi Sarawadi1483d1f2017-09-28 17:06:01 -07009#include <intelblocks/lpc_lib.h>
Lee Leahyb0005132015-05-12 18:19:47 -070010#include <soc/iomap.h>
Subrata Banike7ceae72017-03-08 17:59:40 +053011#include <soc/pcr_ids.h>
praveen hodagatta praneshd6dffdc2017-12-09 00:51:21 +080012#include <soc/intel/common/block/lpc/lpc_def.h>
Ravi Sarawadi1483d1f2017-09-28 17:06:01 -070013
Elyes HAOUASbf0970e2019-03-21 11:10:03 +010014#include "chip.h"
15
Patrick Georgi40b8f012021-05-12 14:52:12 +020016void soc_get_gen_io_dec_range(uint32_t gen_io_dec[LPC_NUM_GENERIC_IO_RANGES])
Lee Leahyb0005132015-05-12 18:19:47 -070017{
Furquan Shaikhe4f7e042020-12-23 14:11:00 -080018 const config_t *config = config_of_soc();
Lee Leahyb0005132015-05-12 18:19:47 -070019
Ravi Sarawadi1483d1f2017-09-28 17:06:01 -070020 gen_io_dec[0] = config->gen1_dec;
21 gen_io_dec[1] = config->gen2_dec;
22 gen_io_dec[2] = config->gen3_dec;
23 gen_io_dec[3] = config->gen4_dec;
Lee Leahyb0005132015-05-12 18:19:47 -070024}
25
Subrata Banik88852062018-01-10 10:51:50 +053026void lpc_soc_init(struct device *dev)
Lee Leahyb0005132015-05-12 18:19:47 -070027{
Kyösti Mälkki8950cfb2019-07-13 22:16:25 +030028 const config_t *const config = config_of(dev);
Nico Huber44e89af2019-02-23 19:24:51 +010029
Lee Leahyb0005132015-05-12 18:19:47 -070030 /* Legacy initialization */
31 isa_dma_init();
Subrata Banik8971ccd2020-09-29 14:36:40 +053032 pch_misc_init();
Angel Pons72b8fd52021-09-28 10:28:38 +020033
34 /* Enable BIOS updates outside of SMM */
35 pci_and_config8(PCH_DEV_LPC, 0xdc, ~(1 << 5));
Ravi Sarawadi1483d1f2017-09-28 17:06:01 -070036
37 /* Enable CLKRUN_EN for power gating LPC */
38 lpc_enable_pci_clk_cntl();
39
40 /* Set LPC Serial IRQ mode */
Nico Huber44e89af2019-02-23 19:24:51 +010041 lpc_set_serirq_mode(config->serirq_mode);
Lee Leahyb0005132015-05-12 18:19:47 -070042
43 /* Interrupt configuration */
Subrata Banik1366e442020-09-29 13:55:50 +053044 pch_enable_ioapic();
Subrata Banik78463a72020-09-29 14:28:09 +053045 pch_pirq_init();
Lee Leahyb0005132015-05-12 18:19:47 -070046 setup_i8259();
47 i8259_configure_irq_trigger(9, 1);
Lee Leahyb0005132015-05-12 18:19:47 -070048}