cpu.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright (C) 2012 Michal Simek <monstr@monstr.eu>
  3. * Copyright (C) 2012 Xilinx, Inc. All rights reserved.
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.h>
  8. #include <asm/io.h>
  9. #include <asm/arch/clk.h>
  10. #include <asm/arch/sys_proto.h>
  11. #include <asm/arch/hardware.h>
  12. #define ZYNQ_SILICON_VER_MASK 0xF0000000
  13. #define ZYNQ_SILICON_VER_SHIFT 28
  14. int arch_cpu_init(void)
  15. {
  16. zynq_slcr_unlock();
  17. #ifndef CONFIG_SPL_BUILD
  18. /* Device config APB, unlock the PCAP */
  19. writel(0x757BDF0D, &devcfg_base->unlock);
  20. writel(0xFFFFFFFF, &devcfg_base->rom_shadow);
  21. #if (CONFIG_SYS_SDRAM_BASE == 0)
  22. /* remap DDR to zero, FILTERSTART */
  23. writel(0, &scu_base->filter_start);
  24. /* OCM_CFG, Mask out the ROM, map ram into upper addresses */
  25. writel(0x1F, &slcr_base->ocm_cfg);
  26. /* FPGA_RST_CTRL, clear resets on AXI fabric ports */
  27. writel(0x0, &slcr_base->fpga_rst_ctrl);
  28. /* Set urgent bits with register */
  29. writel(0x0, &slcr_base->ddr_urgent_sel);
  30. /* Urgent write, ports S2/S3 */
  31. writel(0xC, &slcr_base->ddr_urgent);
  32. #endif
  33. #endif
  34. zynq_clk_early_init();
  35. zynq_slcr_lock();
  36. return 0;
  37. }
  38. unsigned int zynq_get_silicon_version(void)
  39. {
  40. unsigned int ver;
  41. ver = (readl(&devcfg_base->mctrl) &
  42. ZYNQ_SILICON_VER_MASK) >> ZYNQ_SILICON_VER_SHIFT;
  43. return ver;
  44. }
  45. void reset_cpu(ulong addr)
  46. {
  47. zynq_slcr_cpu_reset();
  48. while (1)
  49. ;
  50. }
  51. #ifndef CONFIG_SYS_DCACHE_OFF
  52. void enable_caches(void)
  53. {
  54. /* Enable D-cache. I-cache is already enabled in start.S */
  55. dcache_enable();
  56. }
  57. #endif