t4240rdb.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright 2014 Freescale Semiconductor, Inc.
  4. */
  5. #include <common.h>
  6. #include <command.h>
  7. #include <i2c.h>
  8. #include <netdev.h>
  9. #include <linux/compiler.h>
  10. #include <asm/mmu.h>
  11. #include <asm/processor.h>
  12. #include <asm/cache.h>
  13. #include <asm/immap_85xx.h>
  14. #include <asm/fsl_law.h>
  15. #include <asm/fsl_serdes.h>
  16. #include <asm/fsl_liodn.h>
  17. #include <fm_eth.h>
  18. #include "t4rdb.h"
  19. #include "cpld.h"
  20. #include "../common/vid.h"
  21. DECLARE_GLOBAL_DATA_PTR;
  22. int checkboard(void)
  23. {
  24. struct cpu_type *cpu = gd->arch.cpu;
  25. u8 sw;
  26. printf("Board: %sRDB, ", cpu->name);
  27. printf("Board rev: 0x%02x CPLD ver: 0x%02x%02x, ",
  28. CPLD_READ(hw_ver), CPLD_READ(sw_maj_ver), CPLD_READ(sw_min_ver));
  29. sw = CPLD_READ(vbank);
  30. sw = sw & CPLD_BANK_SEL_MASK;
  31. if (sw <= 7)
  32. printf("vBank: %d\n", sw);
  33. else
  34. printf("Unsupported Bank=%x\n", sw);
  35. puts("SERDES Reference Clocks:\n");
  36. printf(" SERDES1=100MHz SERDES2=156.25MHz\n"
  37. " SERDES3=100MHz SERDES4=100MHz\n");
  38. return 0;
  39. }
  40. int board_early_init_r(void)
  41. {
  42. const unsigned int flashbase = CONFIG_SYS_FLASH_BASE;
  43. int flash_esel = find_tlb_idx((void *)flashbase, 1);
  44. /*
  45. * Remap Boot flash + PROMJET region to caching-inhibited
  46. * so that flash can be erased properly.
  47. */
  48. /* Flush d-cache and invalidate i-cache of any FLASH data */
  49. flush_dcache();
  50. invalidate_icache();
  51. if (flash_esel == -1) {
  52. /* very unlikely unless something is messed up */
  53. puts("Error: Could not find TLB for FLASH BASE\n");
  54. flash_esel = 2; /* give our best effort to continue */
  55. } else {
  56. /* invalidate existing TLB entry for flash + promjet */
  57. disable_tlb(flash_esel);
  58. }
  59. set_tlb(1, flashbase, CONFIG_SYS_FLASH_BASE_PHYS,
  60. MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
  61. 0, flash_esel, BOOKE_PAGESZ_256M, 1);
  62. /*
  63. * Adjust core voltage according to voltage ID
  64. * This function changes I2C mux to channel 2.
  65. */
  66. if (adjust_vdd(0))
  67. printf("Warning: Adjusting core voltage failed.\n");
  68. return 0;
  69. }
  70. int misc_init_r(void)
  71. {
  72. return 0;
  73. }
  74. int ft_board_setup(void *blob, bd_t *bd)
  75. {
  76. phys_addr_t base;
  77. phys_size_t size;
  78. ft_cpu_setup(blob, bd);
  79. base = env_get_bootm_low();
  80. size = env_get_bootm_size();
  81. fdt_fixup_memory(blob, (u64)base, (u64)size);
  82. #ifdef CONFIG_PCI
  83. pci_of_setup(blob, bd);
  84. #endif
  85. fdt_fixup_liodn(blob);
  86. fsl_fdt_fixup_dr_usb(blob, bd);
  87. #ifdef CONFIG_SYS_DPAA_FMAN
  88. fdt_fixup_fman_ethernet(blob);
  89. fdt_fixup_board_enet(blob);
  90. #endif
  91. return 0;
  92. }
  93. /*
  94. * This function is called by bdinfo to print detail board information.
  95. * As an exmaple for future board, we organize the messages into
  96. * several sections. If applicable, the message is in the format of
  97. * <name> = <value>
  98. * It should aligned with normal output of bdinfo command.
  99. *
  100. * Voltage: Core, DDR and another configurable voltages
  101. * Clock : Critical clocks which are not printed already
  102. * RCW : RCW source if not printed already
  103. * Misc : Other important information not in above catagories
  104. */
  105. void board_detail(void)
  106. {
  107. int rcwsrc;
  108. /* RCW section SW3[4] */
  109. rcwsrc = 0x0;
  110. puts("RCW source = ");
  111. switch (rcwsrc & 0x1) {
  112. case 0x1:
  113. puts("SDHC/eMMC\n");
  114. break;
  115. default:
  116. puts("I2C normal addressing\n");
  117. break;
  118. }
  119. }