t208xrdb.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. * Copyright 2009-2013 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/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 "t208xrdb.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. static const char *freq[3] = {"100.00MHZ", "125.00MHz", "156.25MHZ"};
  26. printf("Board: %sRDB, ", cpu->name);
  27. printf("Board rev: 0x%02x CPLD ver: 0x%02x, boot from ",
  28. CPLD_READ(hw_ver), CPLD_READ(sw_ver));
  29. #ifdef CONFIG_SDCARD
  30. puts("SD/MMC\n");
  31. #elif CONFIG_SPIFLASH
  32. puts("SPI\n");
  33. #else
  34. u8 reg;
  35. reg = CPLD_READ(flash_csr);
  36. if (reg & CPLD_BOOT_SEL) {
  37. puts("NAND\n");
  38. } else {
  39. reg = ((reg & CPLD_LBMAP_MASK) >> CPLD_LBMAP_SHIFT);
  40. printf("NOR vBank%d\n", reg);
  41. }
  42. #endif
  43. puts("SERDES Reference Clocks:\n");
  44. printf("SD1_CLK1=%s, SD1_CLK2=%s\n", freq[2], freq[0]);
  45. printf("SD2_CLK1=%s, SD2_CLK2=%s\n", freq[0], freq[0]);
  46. return 0;
  47. }
  48. int board_early_init_r(void)
  49. {
  50. const unsigned int flashbase = CONFIG_SYS_FLASH_BASE;
  51. int flash_esel = find_tlb_idx((void *)flashbase, 1);
  52. /*
  53. * Remap Boot flash + PROMJET region to caching-inhibited
  54. * so that flash can be erased properly.
  55. */
  56. /* Flush d-cache and invalidate i-cache of any FLASH data */
  57. flush_dcache();
  58. invalidate_icache();
  59. if (flash_esel == -1) {
  60. /* very unlikely unless something is messed up */
  61. puts("Error: Could not find TLB for FLASH BASE\n");
  62. flash_esel = 2; /* give our best effort to continue */
  63. } else {
  64. /* invalidate existing TLB entry for flash + promjet */
  65. disable_tlb(flash_esel);
  66. }
  67. set_tlb(1, flashbase, CONFIG_SYS_FLASH_BASE_PHYS,
  68. MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
  69. 0, flash_esel, BOOKE_PAGESZ_256M, 1);
  70. /*
  71. * Adjust core voltage according to voltage ID
  72. * This function changes I2C mux to channel 2.
  73. */
  74. if (adjust_vdd(0))
  75. printf("Warning: Adjusting core voltage failed.\n");
  76. return 0;
  77. }
  78. unsigned long get_board_sys_clk(void)
  79. {
  80. return CONFIG_SYS_CLK_FREQ;
  81. }
  82. unsigned long get_board_ddr_clk(void)
  83. {
  84. return CONFIG_DDR_CLK_FREQ;
  85. }
  86. int misc_init_r(void)
  87. {
  88. u8 reg;
  89. /* Reset CS4315 PHY */
  90. reg = CPLD_READ(reset_ctl);
  91. reg |= CPLD_RSTCON_EDC_RST;
  92. CPLD_WRITE(reset_ctl, reg);
  93. return 0;
  94. }
  95. int ft_board_setup(void *blob, bd_t *bd)
  96. {
  97. phys_addr_t base;
  98. phys_size_t size;
  99. ft_cpu_setup(blob, bd);
  100. base = getenv_bootm_low();
  101. size = getenv_bootm_size();
  102. fdt_fixup_memory(blob, (u64)base, (u64)size);
  103. #ifdef CONFIG_PCI
  104. pci_of_setup(blob, bd);
  105. #endif
  106. fdt_fixup_liodn(blob);
  107. fsl_fdt_fixup_dr_usb(blob, bd);
  108. #ifdef CONFIG_SYS_DPAA_FMAN
  109. fdt_fixup_fman_ethernet(blob);
  110. fdt_fixup_board_enet(blob);
  111. #endif
  112. return 0;
  113. }