quark.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <asm/io.h>
  8. #include <asm/pci.h>
  9. #include <asm/post.h>
  10. #include <asm/processor.h>
  11. #include <asm/arch/device.h>
  12. #include <asm/arch/msg_port.h>
  13. #include <asm/arch/quark.h>
  14. static void quark_setup_bars(void)
  15. {
  16. /* GPIO - D31:F0:R44h */
  17. pci_write_config_dword(QUARK_LEGACY_BRIDGE, LB_GBA,
  18. CONFIG_GPIO_BASE | IO_BAR_EN);
  19. /* ACPI PM1 Block - D31:F0:R48h */
  20. pci_write_config_dword(QUARK_LEGACY_BRIDGE, LB_PM1BLK,
  21. CONFIG_ACPI_PM1_BASE | IO_BAR_EN);
  22. /* GPE0 - D31:F0:R4Ch */
  23. pci_write_config_dword(QUARK_LEGACY_BRIDGE, LB_GPE0BLK,
  24. CONFIG_ACPI_GPE0_BASE | IO_BAR_EN);
  25. /* WDT - D31:F0:R84h */
  26. pci_write_config_dword(QUARK_LEGACY_BRIDGE, LB_WDTBA,
  27. CONFIG_WDT_BASE | IO_BAR_EN);
  28. /* RCBA - D31:F0:RF0h */
  29. pci_write_config_dword(QUARK_LEGACY_BRIDGE, LB_RCBA,
  30. CONFIG_RCBA_BASE | MEM_BAR_EN);
  31. /* ACPI P Block - Msg Port 04:R70h */
  32. msg_port_write(MSG_PORT_RMU, PBLK_BA,
  33. CONFIG_ACPI_PBLK_BASE | IO_BAR_EN);
  34. /* SPI DMA - Msg Port 04:R7Ah */
  35. msg_port_write(MSG_PORT_RMU, SPI_DMA_BA,
  36. CONFIG_SPI_DMA_BASE | IO_BAR_EN);
  37. /* PCIe ECAM */
  38. msg_port_write(MSG_PORT_MEM_ARBITER, AEC_CTRL,
  39. CONFIG_PCIE_ECAM_BASE | MEM_BAR_EN);
  40. msg_port_write(MSG_PORT_HOST_BRIDGE, HEC_REG,
  41. CONFIG_PCIE_ECAM_BASE | MEM_BAR_EN);
  42. }
  43. int arch_cpu_init(void)
  44. {
  45. struct pci_controller *hose;
  46. int ret;
  47. post_code(POST_CPU_INIT);
  48. #ifdef CONFIG_SYS_X86_TSC_TIMER
  49. timer_set_base(rdtsc());
  50. #endif
  51. ret = x86_cpu_init_f();
  52. if (ret)
  53. return ret;
  54. ret = pci_early_init_hose(&hose);
  55. if (ret)
  56. return ret;
  57. /*
  58. * Quark SoC has some non-standard BARs (excluding PCI standard BARs)
  59. * which need be initialized with suggested values
  60. */
  61. quark_setup_bars();
  62. return 0;
  63. }
  64. int print_cpuinfo(void)
  65. {
  66. post_code(POST_CPU_INFO);
  67. return default_print_cpuinfo();
  68. }
  69. void reset_cpu(ulong addr)
  70. {
  71. /* cold reset */
  72. outb(0x08, PORT_RESET);
  73. }