| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#include <bootstate.h> |
| 10 |
#include <commonlib/console/post_codes.h> |
| 11 |
#include <console/console.h> |
| 12 |
#include <cpu/x86/smm.h> |
| 13 |
#include <device/mmio.h> |
| 14 |
#include <device/pci.h> |
| 15 |
#include <intelblocks/cse.h> |
| 16 |
#include <intelblocks/lpc_lib.h> |
| 17 |
#include <intelblocks/pcr.h> |
| 18 |
#include <intelblocks/pmclib.h> |
| 19 |
#include <intelblocks/systemagent.h> |
| 20 |
#include <intelblocks/tco.h> |
| 21 |
#include <soc/p2sb.h> |
| 22 |
#include <soc/pci_devs.h> |
| 23 |
#include <soc/pcr_ids.h> |
| 24 |
#include <soc/pm.h> |
| 25 |
#include <soc/smbus.h> |
| 26 |
#include <soc/soc_chip.h> |
| 27 |
#include <soc/systemagent.h> |
| 28 |
#include <spi-generic.h> |
| 29 |
#include <static.h> |
| 30 |
|
| 31 |
#define CAMERA1_CLK 0x8000 |
| 32 |
#define CAMERA2_CLK 0x8080 |
| 33 |
#define CAM_CLK_EN (1 << 1) |
| 34 |
#define MIPI_CLK (1 << 0) |
| 35 |
#define HDPLL_CLK (0 << 0) |
| 36 |
|
| 37 |
static void pch_enable_isclk(void) |
| 38 |
{ |
| 39 |
pcr_or32(PID_ISCLK, CAMERA1_CLK, CAM_CLK_EN | MIPI_CLK); |
| 40 |
pcr_or32(PID_ISCLK, CAMERA2_CLK, CAM_CLK_EN | MIPI_CLK); |
| 41 |
} |
| 42 |
|
| 43 |
static void pch_handle_sideband(config_t *config) |
| 44 |
{ |
| 45 |
if (config->pch_isclk) |
| 46 |
pch_enable_isclk(); |
| 47 |
} |
| 48 |
|
| 49 |
static void pch_finalize(void) |
| 50 |
{ |
| 51 |
config_t *config = config_of_soc(); |
| 52 |
|
| 53 |
|
| 54 |
tco_lockdown(); |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
pch_handle_sideband(config); |
| 59 |
|
| 60 |
pmc_clear_pmcon_sts(); |
| 61 |
} |
| 62 |
|
| 63 |
static void tbt_finalize(void) |
| 64 |
{ |
| 65 |
int i; |
| 66 |
const struct device *dev; |
| 67 |
|
| 68 |
|
| 69 |
for (i = 0; i < NUM_TBT_FUNCTIONS; i++) { |
| 70 |
dev = pcidev_path_on_root(SA_DEVFN_TBT(i)); |
| 71 |
if (dev) |
| 72 |
pci_dev_disable_bus_master(dev); |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
static void heci_finalize(void) |
| 77 |
{ |
| 78 |
heci_set_to_d0i3(); |
| 79 |
if (CONFIG(DISABLE_HECI1_AT_PRE_BOOT)) |
| 80 |
heci1_disable(); |
| 81 |
} |
| 82 |
|
| 83 |
static void soc_finalize(void *unused) |
| 84 |
{ |
| 85 |
printk(BIOS_DEBUG, "Finalizing chipset.\n"); |
| 86 |
|
| 87 |
pch_finalize(); |
| 88 |
apm_control(APM_CNT_FINALIZE); |
| 89 |
tbt_finalize(); |
| 90 |
if (CONFIG(USE_FSP_NOTIFY_PHASE_READY_TO_BOOT) && |
| 91 |
CONFIG(USE_FSP_NOTIFY_PHASE_END_OF_FIRMWARE)) |
| 92 |
heci_finalize(); |
| 93 |
|
| 94 |
|
| 95 |
post_code(POSTCODE_OS_BOOT); |
| 96 |
} |
| 97 |
|
| 98 |
BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, soc_finalize, NULL); |
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_BOOT, BS_ON_ENTRY, soc_finalize, NULL); |