blob: 46646d848527b86daca8e35dd720c8ed52c6c995 [file] [log] [blame]
Tan, Lean Sheng05dfe312020-08-25 20:40:17 -07001/* SPDX-License-Identifier: GPL-2.0-only */
2
3#include <arch/io.h>
4#include <arch/ioapic.h>
5#include <device/device.h>
6#include <device/pci.h>
7#include <device/pci_ops.h>
8#include <intelblocks/itss.h>
9#include <intelblocks/lpc_lib.h>
Tan, Lean Sheng05dfe312020-08-25 20:40:17 -070010#include <pc80/isa-dma.h>
11#include <pc80/i8259.h>
12#include <soc/espi.h>
13#include <soc/iomap.h>
14#include <soc/irq.h>
15#include <soc/pci_devs.h>
16#include <soc/pcr_ids.h>
17#include <soc/soc_chip.h>
18
Patrick Georgi40b8f012021-05-12 14:52:12 +020019void soc_get_gen_io_dec_range(uint32_t gen_io_dec[LPC_NUM_GENERIC_IO_RANGES])
Tan, Lean Sheng05dfe312020-08-25 20:40:17 -070020{
Furquan Shaikhe4f7e042020-12-23 14:11:00 -080021 const config_t *config = config_of_soc();
Tan, Lean Sheng05dfe312020-08-25 20:40:17 -070022
23 gen_io_dec[0] = config->gen1_dec;
24 gen_io_dec[1] = config->gen2_dec;
25 gen_io_dec[2] = config->gen3_dec;
26 gen_io_dec[3] = config->gen4_dec;
27}
28
Tan, Lean Sheng05dfe312020-08-25 20:40:17 -070029#if ENV_RAMSTAGE
Tan, Lean Sheng05dfe312020-08-25 20:40:17 -070030void lpc_soc_init(struct device *dev)
31{
32 /* Legacy initialization */
33 isa_dma_init();
34 pch_misc_init();
35
36 /* Enable CLKRUN_EN for power gating ESPI */
37 lpc_enable_pci_clk_cntl();
38
39 /* Set ESPI Serial IRQ mode */
40 if (CONFIG(SERIRQ_CONTINUOUS_MODE))
41 lpc_set_serirq_mode(SERIRQ_CONTINUOUS);
42 else
43 lpc_set_serirq_mode(SERIRQ_QUIET);
44
45 /* Interrupt configuration */
Subrata Banik1366e442020-09-29 13:55:50 +053046 pch_enable_ioapic();
Subrata Banik78463a72020-09-29 14:28:09 +053047 pch_pirq_init();
Tan, Lean Sheng05dfe312020-08-25 20:40:17 -070048 setup_i8259();
49 i8259_configure_irq_trigger(9, 1);
Tan, Lean Sheng05dfe312020-08-25 20:40:17 -070050}
51
52#endif