ls2080a.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. * Copyright 2014 Freescale Semiconductor
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <malloc.h>
  8. #include <errno.h>
  9. #include <netdev.h>
  10. #include <fsl_ifc.h>
  11. #include <fsl_ddr.h>
  12. #include <asm/io.h>
  13. #include <fdt_support.h>
  14. #include <libfdt.h>
  15. #include <fsl-mc/fsl_mc.h>
  16. #include <environment.h>
  17. #include <asm/arch/soc.h>
  18. DECLARE_GLOBAL_DATA_PTR;
  19. int board_init(void)
  20. {
  21. init_final_memctl_regs();
  22. #ifdef CONFIG_ENV_IS_NOWHERE
  23. gd->env_addr = (ulong)&default_environment[0];
  24. #endif
  25. return 0;
  26. }
  27. int board_early_init_f(void)
  28. {
  29. fsl_lsch3_early_init_f();
  30. return 0;
  31. }
  32. void detail_board_ddr_info(void)
  33. {
  34. puts("\nDDR ");
  35. print_size(gd->bd->bi_dram[0].size + gd->bd->bi_dram[1].size, "");
  36. print_ddr_info(0);
  37. #ifdef CONFIG_SYS_FSL_HAS_DP_DDR
  38. if (soc_has_dp_ddr() && gd->bd->bi_dram[2].size) {
  39. puts("\nDP-DDR ");
  40. print_size(gd->bd->bi_dram[2].size, "");
  41. print_ddr_info(CONFIG_DP_DDR_CTRL);
  42. }
  43. #endif
  44. }
  45. #if defined(CONFIG_ARCH_MISC_INIT)
  46. int arch_misc_init(void)
  47. {
  48. return 0;
  49. }
  50. #endif
  51. int board_eth_init(bd_t *bis)
  52. {
  53. int error = 0;
  54. #ifdef CONFIG_SMC91111
  55. error = smc91111_initialize(0, CONFIG_SMC91111_BASE);
  56. #endif
  57. #ifdef CONFIG_FSL_MC_ENET
  58. error = cpu_eth_init(bis);
  59. #endif
  60. return error;
  61. }
  62. #ifdef CONFIG_FSL_MC_ENET
  63. void fdt_fixup_board_enet(void *fdt)
  64. {
  65. int offset;
  66. offset = fdt_path_offset(fdt, "/soc/fsl-mc");
  67. /*
  68. * TODO: Remove this when backward compatibility
  69. * with old DT node (/fsl-mc) is no longer needed.
  70. */
  71. if (offset < 0)
  72. offset = fdt_path_offset(fdt, "/fsl-mc");
  73. if (offset < 0) {
  74. printf("%s: ERROR: fsl-mc node not found in device tree (error %d)\n",
  75. __func__, offset);
  76. return;
  77. }
  78. if (get_mc_boot_status() == 0)
  79. fdt_status_okay(fdt, offset);
  80. else
  81. fdt_status_fail(fdt, offset);
  82. }
  83. void board_quiesce_devices(void)
  84. {
  85. fsl_mc_ldpaa_exit(gd->bd);
  86. }
  87. #endif
  88. #ifdef CONFIG_OF_BOARD_SETUP
  89. int ft_board_setup(void *blob, bd_t *bd)
  90. {
  91. u64 base[CONFIG_NR_DRAM_BANKS];
  92. u64 size[CONFIG_NR_DRAM_BANKS];
  93. ft_cpu_setup(blob, bd);
  94. /* fixup DT for the two GPP DDR banks */
  95. base[0] = gd->bd->bi_dram[0].start;
  96. size[0] = gd->bd->bi_dram[0].size;
  97. base[1] = gd->bd->bi_dram[1].start;
  98. size[1] = gd->bd->bi_dram[1].size;
  99. #ifdef CONFIG_RESV_RAM
  100. /* reduce size if reserved memory is within this bank */
  101. if (gd->arch.resv_ram >= base[0] &&
  102. gd->arch.resv_ram < base[0] + size[0])
  103. size[0] = gd->arch.resv_ram - base[0];
  104. else if (gd->arch.resv_ram >= base[1] &&
  105. gd->arch.resv_ram < base[1] + size[1])
  106. size[1] = gd->arch.resv_ram - base[1];
  107. #endif
  108. fdt_fixup_memory_banks(blob, base, size, 2);
  109. #ifdef CONFIG_FSL_MC_ENET
  110. fdt_fixup_board_enet(blob);
  111. #endif
  112. return 0;
  113. }
  114. #endif
  115. #if defined(CONFIG_RESET_PHY_R)
  116. void reset_phy(void)
  117. {
  118. }
  119. #endif