Angel Pons | f5627e8 | 2020-04-05 15:46:52 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Lijian Zhao | a515849 | 2017-08-29 14:37:17 -0700 | [diff] [blame] | 2 | |
Lijian Zhao | a515849 | 2017-08-29 14:37:17 -0700 | [diff] [blame] | 3 | #include <device/device.h> |
| 4 | #include <device/pci.h> |
Lijian Zhao | a515849 | 2017-08-29 14:37:17 -0700 | [diff] [blame] | 5 | #include <pc80/isa-dma.h> |
| 6 | #include <pc80/i8259.h> |
| 7 | #include <arch/io.h> |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 8 | #include <device/pci_ops.h> |
Lijian Zhao | a515849 | 2017-08-29 14:37:17 -0700 | [diff] [blame] | 9 | #include <arch/ioapic.h> |
| 10 | #include <intelblocks/itss.h> |
| 11 | #include <intelblocks/lpc_lib.h> |
Lijian Zhao | a515849 | 2017-08-29 14:37:17 -0700 | [diff] [blame] | 12 | #include <soc/iomap.h> |
Subrata Banik | 2a244c6 | 2018-11-14 15:45:39 +0530 | [diff] [blame] | 13 | #include <soc/irq.h> |
Lijian Zhao | 9258021 | 2018-04-13 16:34:56 -0700 | [diff] [blame] | 14 | #include <soc/lpc.h> |
Lijian Zhao | a515849 | 2017-08-29 14:37:17 -0700 | [diff] [blame] | 15 | #include <soc/pci_devs.h> |
| 16 | #include <soc/pcr_ids.h> |
| 17 | |
Elyes HAOUAS | bf0970e | 2019-03-21 11:10:03 +0100 | [diff] [blame] | 18 | #include "chip.h" |
| 19 | |
Patrick Georgi | 40b8f01 | 2021-05-12 14:52:12 +0200 | [diff] [blame] | 20 | void soc_get_gen_io_dec_range(uint32_t gen_io_dec[LPC_NUM_GENERIC_IO_RANGES]) |
Lijian Zhao | 9b50a57 | 2017-12-21 13:40:07 -0800 | [diff] [blame] | 21 | { |
Furquan Shaikh | e4f7e04 | 2020-12-23 14:11:00 -0800 | [diff] [blame] | 22 | const config_t *config = config_of_soc(); |
Lijian Zhao | 9b50a57 | 2017-12-21 13:40:07 -0800 | [diff] [blame] | 23 | |
| 24 | gen_io_dec[0] = config->gen1_dec; |
| 25 | gen_io_dec[1] = config->gen2_dec; |
| 26 | gen_io_dec[2] = config->gen3_dec; |
| 27 | gen_io_dec[3] = config->gen4_dec; |
| 28 | } |
| 29 | |
Lijian Zhao | 9b50a57 | 2017-12-21 13:40:07 -0800 | [diff] [blame] | 30 | #if ENV_RAMSTAGE |
Subrata Banik | 8885206 | 2018-01-10 10:51:50 +0530 | [diff] [blame] | 31 | void lpc_soc_init(struct device *dev) |
Lijian Zhao | a515849 | 2017-08-29 14:37:17 -0700 | [diff] [blame] | 32 | { |
Jeremy Soller | 1af482c9 | 2019-02-20 16:39:55 -0700 | [diff] [blame] | 33 | const config_t *config = dev->chip_info; |
| 34 | |
Lijian Zhao | a515849 | 2017-08-29 14:37:17 -0700 | [diff] [blame] | 35 | /* Legacy initialization */ |
| 36 | isa_dma_init(); |
| 37 | pch_misc_init(); |
| 38 | |
| 39 | /* Enable CLKRUN_EN for power gating LPC */ |
| 40 | lpc_enable_pci_clk_cntl(); |
| 41 | |
| 42 | /* Set LPC Serial IRQ mode */ |
Jeremy Soller | 1af482c9 | 2019-02-20 16:39:55 -0700 | [diff] [blame] | 43 | lpc_set_serirq_mode(config->serirq_mode); |
Lijian Zhao | a515849 | 2017-08-29 14:37:17 -0700 | [diff] [blame] | 44 | |
| 45 | /* Interrupt configuration */ |
Subrata Banik | 1366e44 | 2020-09-29 13:55:50 +0530 | [diff] [blame] | 46 | pch_enable_ioapic(); |
Subrata Banik | 78463a7 | 2020-09-29 14:28:09 +0530 | [diff] [blame] | 47 | pch_pirq_init(); |
Lijian Zhao | a515849 | 2017-08-29 14:37:17 -0700 | [diff] [blame] | 48 | setup_i8259(); |
| 49 | i8259_configure_irq_trigger(9, 1); |
Lijian Zhao | a515849 | 2017-08-29 14:37:17 -0700 | [diff] [blame] | 50 | } |
Subrata Banik | 71a5138 | 2018-01-10 11:01:32 +0530 | [diff] [blame] | 51 | |
Lijian Zhao | 9b50a57 | 2017-12-21 13:40:07 -0800 | [diff] [blame] | 52 | #endif |