1 /* 2 * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com> 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 */ 6 7 #include <common.h> 8 #include <asm/io.h> 9 #include <asm/pci.h> 10 #include <asm/post.h> 11 #include <asm/arch/device.h> 12 #include <asm/arch/irq.h> 13 #include <asm/fsp/fsp_support.h> 14 #include <asm/processor.h> 15 16 static void unprotect_spi_flash(void) 17 { 18 u32 bc; 19 20 bc = x86_pci_read_config32(TNC_LPC, 0xd8); 21 bc |= 0x1; /* unprotect the flash */ 22 x86_pci_write_config32(TNC_LPC, 0xd8, bc); 23 } 24 25 int arch_cpu_init(void) 26 { 27 struct pci_controller *hose; 28 int ret; 29 30 post_code(POST_CPU_INIT); 31 #ifdef CONFIG_SYS_X86_TSC_TIMER 32 timer_set_base(rdtsc()); 33 #endif 34 35 ret = x86_cpu_init_f(); 36 if (ret) 37 return ret; 38 39 ret = pci_early_init_hose(&hose); 40 if (ret) 41 return ret; 42 43 unprotect_spi_flash(); 44 45 return 0; 46 } 47 48 int arch_misc_init(void) 49 { 50 pirq_init(); 51 52 return 0; 53 } 54