2020-04-05 15:47:03 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2018-10-17 08:25:01 +02:00
|
|
|
|
|
|
|
#include <device/device.h>
|
|
|
|
#include <device/pci.h>
|
|
|
|
#include <pc80/isa-dma.h>
|
|
|
|
#include <pc80/i8259.h>
|
|
|
|
#include <arch/io.h>
|
2019-03-01 12:43:02 +01:00
|
|
|
#include <device/pci_ops.h>
|
2018-10-17 08:25:01 +02:00
|
|
|
#include <arch/ioapic.h>
|
|
|
|
#include <intelblocks/itss.h>
|
|
|
|
#include <intelblocks/lpc_lib.h>
|
2018-10-31 18:38:14 +01:00
|
|
|
#include <soc/espi.h>
|
2018-10-17 08:25:01 +02:00
|
|
|
#include <soc/iomap.h>
|
2018-11-14 11:20:03 +01:00
|
|
|
#include <soc/irq.h>
|
2018-10-17 08:25:01 +02:00
|
|
|
#include <soc/pci_devs.h>
|
|
|
|
#include <soc/pcr_ids.h>
|
2019-07-05 12:30:38 +02:00
|
|
|
#include <soc/soc_chip.h>
|
2019-03-21 11:10:03 +01:00
|
|
|
|
2020-12-23 23:11:00 +01:00
|
|
|
void soc_get_gen_io_dec_range(uint32_t *gen_io_dec)
|
2018-10-17 08:25:01 +02:00
|
|
|
{
|
2020-12-23 23:11:00 +01:00
|
|
|
const config_t *config = config_of_soc();
|
2018-10-17 08:25:01 +02:00
|
|
|
|
|
|
|
gen_io_dec[0] = config->gen1_dec;
|
|
|
|
gen_io_dec[1] = config->gen2_dec;
|
|
|
|
gen_io_dec[2] = config->gen3_dec;
|
|
|
|
gen_io_dec[3] = config->gen4_dec;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if ENV_RAMSTAGE
|
|
|
|
void lpc_soc_init(struct device *dev)
|
|
|
|
{
|
|
|
|
/* Legacy initialization */
|
|
|
|
isa_dma_init();
|
|
|
|
pch_misc_init();
|
|
|
|
|
2018-10-31 18:38:14 +01:00
|
|
|
/* Enable CLKRUN_EN for power gating ESPI */
|
2018-10-17 08:25:01 +02:00
|
|
|
lpc_enable_pci_clk_cntl();
|
|
|
|
|
2018-10-31 18:38:14 +01:00
|
|
|
/* Set ESPI Serial IRQ mode */
|
2019-03-06 01:53:33 +01:00
|
|
|
if (CONFIG(SERIRQ_CONTINUOUS_MODE))
|
2018-10-17 08:25:01 +02:00
|
|
|
lpc_set_serirq_mode(SERIRQ_CONTINUOUS);
|
|
|
|
else
|
|
|
|
lpc_set_serirq_mode(SERIRQ_QUIET);
|
|
|
|
|
|
|
|
/* Interrupt configuration */
|
2020-09-29 10:25:50 +02:00
|
|
|
pch_enable_ioapic();
|
2020-09-29 10:58:09 +02:00
|
|
|
pch_pirq_init();
|
2018-10-17 08:25:01 +02:00
|
|
|
setup_i8259();
|
|
|
|
i8259_configure_irq_trigger(9, 1);
|
|
|
|
}
|
|
|
|
|
2018-10-31 18:38:14 +01:00
|
|
|
/* Fill up ESPI IO resource structure inside SoC directory */
|
2018-10-17 08:25:01 +02:00
|
|
|
void pch_lpc_soc_fill_io_resources(struct device *dev)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* PMC pci device gets hidden from PCI bus due to Silicon
|
|
|
|
* policy hence bind ACPI BASE aka ABASE (offset 0x20) with
|
2018-10-31 18:38:14 +01:00
|
|
|
* ESPI IO resources to ensure that ABASE falls under PCI reserved
|
2018-10-17 08:25:01 +02:00
|
|
|
* IO memory range.
|
|
|
|
*
|
|
|
|
* Note: Don't add any more resource with same offset 0x20
|
|
|
|
* under this device space.
|
|
|
|
*/
|
|
|
|
pch_lpc_add_new_resource(dev, PCI_BASE_ADDRESS_4,
|
|
|
|
ACPI_BASE_ADDRESS, ACPI_BASE_SIZE, IORESOURCE_IO |
|
|
|
|
IORESOURCE_ASSIGNED | IORESOURCE_FIXED);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|