t4240rdb.c 3.0 KB

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