Bin Meng | 08e484c | 2014-12-17 15:50:36 +0800 | [diff] [blame] | 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> | ||||
Bin Meng | b8b4440 | 2014-12-17 15:50:44 +0800 | [diff] [blame] | 9 | #include <asm/pci.h> |
Bin Meng | 08e484c | 2014-12-17 15:50:36 +0800 | [diff] [blame] | 10 | #include <asm/post.h> |
Bin Meng | 1530536 | 2015-04-24 18:10:06 +0800 | [diff] [blame^] | 11 | #include <asm/arch/device.h> |
12 | #include <asm/arch/irq.h> | ||||
Simon Glass | b93abfc | 2015-01-27 22:13:36 -0700 | [diff] [blame] | 13 | #include <asm/fsp/fsp_support.h> |
Bin Meng | 08e484c | 2014-12-17 15:50:36 +0800 | [diff] [blame] | 14 | #include <asm/processor.h> |
15 | |||||
Bin Meng | b8b4440 | 2014-12-17 15:50:44 +0800 | [diff] [blame] | 16 | static void unprotect_spi_flash(void) |
17 | { | ||||
18 | u32 bc; | ||||
19 | |||||
Bin Meng | 80e336a | 2015-04-13 19:03:42 +0800 | [diff] [blame] | 20 | bc = x86_pci_read_config32(TNC_LPC, 0xd8); |
Bin Meng | b8b4440 | 2014-12-17 15:50:44 +0800 | [diff] [blame] | 21 | bc |= 0x1; /* unprotect the flash */ |
Bin Meng | 80e336a | 2015-04-13 19:03:42 +0800 | [diff] [blame] | 22 | x86_pci_write_config32(TNC_LPC, 0xd8, bc); |
Bin Meng | b8b4440 | 2014-12-17 15:50:44 +0800 | [diff] [blame] | 23 | } |
24 | |||||
Bin Meng | 08e484c | 2014-12-17 15:50:36 +0800 | [diff] [blame] | 25 | int arch_cpu_init(void) |
26 | { | ||||
Bin Meng | b8b4440 | 2014-12-17 15:50:44 +0800 | [diff] [blame] | 27 | struct pci_controller *hose; |
28 | int ret; | ||||
29 | |||||
Bin Meng | 08e484c | 2014-12-17 15:50:36 +0800 | [diff] [blame] | 30 | post_code(POST_CPU_INIT); |
31 | #ifdef CONFIG_SYS_X86_TSC_TIMER | ||||
32 | timer_set_base(rdtsc()); | ||||
33 | #endif | ||||
34 | |||||
Bin Meng | b8b4440 | 2014-12-17 15:50:44 +0800 | [diff] [blame] | 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; | ||||
Bin Meng | 08e484c | 2014-12-17 15:50:36 +0800 | [diff] [blame] | 46 | } |
Bin Meng | 1530536 | 2015-04-24 18:10:06 +0800 | [diff] [blame^] | 47 | |
48 | int arch_misc_init(void) | ||||
49 | { | ||||
50 | pirq_init(); | ||||
51 | |||||
52 | return 0; | ||||
53 | } |