init.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Keystone2: Architecture initialization
  3. *
  4. * (C) Copyright 2012-2014
  5. * Texas Instruments Incorporated, <www.ti.com>
  6. *
  7. * SPDX-License-Identifier: GPL-2.0+
  8. */
  9. #include <common.h>
  10. #include <ns16550.h>
  11. #include <asm/io.h>
  12. #include <asm/arch/msmc.h>
  13. #include <asm/arch/clock.h>
  14. #include <asm/arch/hardware.h>
  15. void chip_configuration_unlock(void)
  16. {
  17. __raw_writel(KS2_KICK0_MAGIC, KS2_KICK0);
  18. __raw_writel(KS2_KICK1_MAGIC, KS2_KICK1);
  19. }
  20. int arch_cpu_init(void)
  21. {
  22. chip_configuration_unlock();
  23. icache_enable();
  24. msmc_share_all_segments(8); /* TETRIS */
  25. msmc_share_all_segments(9); /* NETCP */
  26. msmc_share_all_segments(10); /* QM PDSP */
  27. msmc_share_all_segments(11); /* PCIE 0 */
  28. #ifdef CONFIG_SOC_K2E
  29. msmc_share_all_segments(13); /* PCIE 1 */
  30. #endif
  31. /*
  32. * just initialise the COM2 port so that TI specific
  33. * UART register PWREMU_MGMT is initialized. Linux UART
  34. * driver doesn't handle this.
  35. */
  36. NS16550_init((NS16550_t)(CONFIG_SYS_NS16550_COM2),
  37. CONFIG_SYS_NS16550_CLK / 16 / CONFIG_BAUDRATE);
  38. return 0;
  39. }
  40. void reset_cpu(ulong addr)
  41. {
  42. volatile u32 *rstctrl = (volatile u32 *)(KS2_RSTCTRL);
  43. u32 tmp;
  44. tmp = *rstctrl & KS2_RSTCTRL_MASK;
  45. *rstctrl = tmp | KS2_RSTCTRL_KEY;
  46. *rstctrl &= KS2_RSTCTRL_SWRST;
  47. for (;;)
  48. ;
  49. }
  50. void enable_caches(void)
  51. {
  52. #ifndef CONFIG_SYS_DCACHE_OFF
  53. /* Enable D-cache. I-cache is already enabled in start.S */
  54. dcache_enable();
  55. #endif
  56. }