Bin Meng | 81da5a8 | 2015-02-02 22:35:27 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015, 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/processor.h> |
Bin Meng | 3446986 | 2015-02-04 16:26:09 +0800 | [diff] [blame^] | 12 | #include <asm/arch/device.h> |
| 13 | #include <asm/arch/msg_port.h> |
| 14 | #include <asm/arch/quark.h> |
| 15 | |
| 16 | static void quark_setup_bars(void) |
| 17 | { |
| 18 | /* GPIO - D31:F0:R44h */ |
| 19 | pci_write_config_dword(QUARK_LEGACY_BRIDGE, LB_GBA, |
| 20 | CONFIG_GPIO_BASE | IO_BAR_EN); |
| 21 | |
| 22 | /* ACPI PM1 Block - D31:F0:R48h */ |
| 23 | pci_write_config_dword(QUARK_LEGACY_BRIDGE, LB_PM1BLK, |
| 24 | CONFIG_ACPI_PM1_BASE | IO_BAR_EN); |
| 25 | |
| 26 | /* GPE0 - D31:F0:R4Ch */ |
| 27 | pci_write_config_dword(QUARK_LEGACY_BRIDGE, LB_GPE0BLK, |
| 28 | CONFIG_ACPI_GPE0_BASE | IO_BAR_EN); |
| 29 | |
| 30 | /* WDT - D31:F0:R84h */ |
| 31 | pci_write_config_dword(QUARK_LEGACY_BRIDGE, LB_WDTBA, |
| 32 | CONFIG_WDT_BASE | IO_BAR_EN); |
| 33 | |
| 34 | /* RCBA - D31:F0:RF0h */ |
| 35 | pci_write_config_dword(QUARK_LEGACY_BRIDGE, LB_RCBA, |
| 36 | CONFIG_RCBA_BASE | MEM_BAR_EN); |
| 37 | |
| 38 | /* ACPI P Block - Msg Port 04:R70h */ |
| 39 | msg_port_write(MSG_PORT_RMU, PBLK_BA, |
| 40 | CONFIG_ACPI_PBLK_BASE | IO_BAR_EN); |
| 41 | |
| 42 | /* SPI DMA - Msg Port 04:R7Ah */ |
| 43 | msg_port_write(MSG_PORT_RMU, SPI_DMA_BA, |
| 44 | CONFIG_SPI_DMA_BASE | IO_BAR_EN); |
| 45 | |
| 46 | /* PCIe ECAM */ |
| 47 | msg_port_write(MSG_PORT_MEM_ARBITER, AEC_CTRL, |
| 48 | CONFIG_PCIE_ECAM_BASE | MEM_BAR_EN); |
| 49 | msg_port_write(MSG_PORT_HOST_BRIDGE, HEC_REG, |
| 50 | CONFIG_PCIE_ECAM_BASE | MEM_BAR_EN); |
| 51 | } |
Bin Meng | 81da5a8 | 2015-02-02 22:35:27 +0800 | [diff] [blame] | 52 | |
| 53 | int arch_cpu_init(void) |
| 54 | { |
| 55 | struct pci_controller *hose; |
| 56 | int ret; |
| 57 | |
| 58 | post_code(POST_CPU_INIT); |
| 59 | #ifdef CONFIG_SYS_X86_TSC_TIMER |
| 60 | timer_set_base(rdtsc()); |
| 61 | #endif |
| 62 | |
| 63 | ret = x86_cpu_init_f(); |
| 64 | if (ret) |
| 65 | return ret; |
| 66 | |
| 67 | ret = pci_early_init_hose(&hose); |
| 68 | if (ret) |
| 69 | return ret; |
| 70 | |
Bin Meng | 3446986 | 2015-02-04 16:26:09 +0800 | [diff] [blame^] | 71 | /* |
| 72 | * Quark SoC has some non-standard BARs (excluding PCI standard BARs) |
| 73 | * which need be initialized with suggested values |
| 74 | */ |
| 75 | quark_setup_bars(); |
| 76 | |
Bin Meng | 81da5a8 | 2015-02-02 22:35:27 +0800 | [diff] [blame] | 77 | return 0; |
| 78 | } |
| 79 | |
| 80 | int print_cpuinfo(void) |
| 81 | { |
| 82 | post_code(POST_CPU_INFO); |
| 83 | return default_print_cpuinfo(); |
| 84 | } |
| 85 | |
| 86 | void reset_cpu(ulong addr) |
| 87 | { |
| 88 | /* cold reset */ |
| 89 | outb(0x08, PORT_RESET); |
| 90 | } |