2014-12-17 16:50:36 +09:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <asm/io.h>
|
2014-12-17 16:50:44 +09:00
|
|
|
#include <asm/pci.h>
|
2014-12-17 16:50:36 +09:00
|
|
|
#include <asm/post.h>
|
2015-04-24 19:10:06 +09:00
|
|
|
#include <asm/arch/device.h>
|
|
|
|
#include <asm/arch/irq.h>
|
2015-01-28 14:13:36 +09:00
|
|
|
#include <asm/fsp/fsp_support.h>
|
2014-12-17 16:50:36 +09:00
|
|
|
#include <asm/processor.h>
|
|
|
|
|
2014-12-17 16:50:44 +09:00
|
|
|
static void unprotect_spi_flash(void)
|
|
|
|
{
|
|
|
|
u32 bc;
|
|
|
|
|
2015-04-13 20:03:42 +09:00
|
|
|
bc = x86_pci_read_config32(TNC_LPC, 0xd8);
|
2014-12-17 16:50:44 +09:00
|
|
|
bc |= 0x1; /* unprotect the flash */
|
2015-04-13 20:03:42 +09:00
|
|
|
x86_pci_write_config32(TNC_LPC, 0xd8, bc);
|
2014-12-17 16:50:44 +09:00
|
|
|
}
|
|
|
|
|
2014-12-17 16:50:36 +09:00
|
|
|
int arch_cpu_init(void)
|
|
|
|
{
|
2014-12-17 16:50:44 +09:00
|
|
|
struct pci_controller *hose;
|
|
|
|
int ret;
|
|
|
|
|
2014-12-17 16:50:36 +09:00
|
|
|
post_code(POST_CPU_INIT);
|
|
|
|
#ifdef CONFIG_SYS_X86_TSC_TIMER
|
|
|
|
timer_set_base(rdtsc());
|
|
|
|
#endif
|
|
|
|
|
2014-12-17 16:50:44 +09:00
|
|
|
ret = x86_cpu_init_f();
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ret = pci_early_init_hose(&hose);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
unprotect_spi_flash();
|
|
|
|
|
|
|
|
return 0;
|
2014-12-17 16:50:36 +09:00
|
|
|
}
|
2015-04-24 19:10:06 +09:00
|
|
|
|
|
|
|
int arch_misc_init(void)
|
|
|
|
{
|
|
|
|
pirq_init();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|