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