t104xrdb.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * Copyright 2013 Freescale Semiconductor, Inc.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <command.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_portals.h>
  17. #include <asm/fsl_liodn.h>
  18. #include <fm_eth.h>
  19. #include <asm/mpc85xx_gpio.h>
  20. #include "t104xrdb.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\n", cpu->name);
  28. printf("Board rev: 0x%02x CPLD ver: 0x%02x, ",
  29. CPLD_READ(hw_ver), CPLD_READ(sw_ver));
  30. sw = CPLD_READ(flash_ctl_status);
  31. sw = ((sw & CPLD_LBMAP_MASK) >> CPLD_LBMAP_SHIFT);
  32. if (sw <= 7)
  33. printf("vBank: %d\n", sw);
  34. else
  35. printf("Unsupported Bank=%x\n", sw);
  36. return 0;
  37. }
  38. int board_early_init_r(void)
  39. {
  40. #ifdef CONFIG_SYS_FLASH_BASE
  41. const unsigned int flashbase = CONFIG_SYS_FLASH_BASE;
  42. int flash_esel = find_tlb_idx((void *)flashbase, 1);
  43. /*
  44. * Remap Boot flash region to caching-inhibited
  45. * so that flash can be erased properly.
  46. */
  47. /* Flush d-cache and invalidate i-cache of any FLASH data */
  48. flush_dcache();
  49. invalidate_icache();
  50. if (flash_esel == -1) {
  51. /* very unlikely unless something is messed up */
  52. puts("Error: Could not find TLB for FLASH BASE\n");
  53. flash_esel = 2; /* give our best effort to continue */
  54. } else {
  55. /* invalidate existing TLB entry for flash */
  56. disable_tlb(flash_esel);
  57. }
  58. set_tlb(1, flashbase, CONFIG_SYS_FLASH_BASE_PHYS,
  59. MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
  60. 0, flash_esel, BOOKE_PAGESZ_256M, 1);
  61. #endif
  62. set_liodns();
  63. #ifdef CONFIG_SYS_DPAA_QBMAN
  64. setup_portals();
  65. #endif
  66. return 0;
  67. }
  68. int misc_init_r(void)
  69. {
  70. return 0;
  71. }
  72. int ft_board_setup(void *blob, bd_t *bd)
  73. {
  74. phys_addr_t base;
  75. phys_size_t size;
  76. ft_cpu_setup(blob, bd);
  77. base = getenv_bootm_low();
  78. size = getenv_bootm_size();
  79. fdt_fixup_memory(blob, (u64)base, (u64)size);
  80. #ifdef CONFIG_PCI
  81. pci_of_setup(blob, bd);
  82. #endif
  83. fdt_fixup_liodn(blob);
  84. #ifdef CONFIG_HAS_FSL_DR_USB
  85. fdt_fixup_dr_usb(blob, bd);
  86. #endif
  87. #ifdef CONFIG_SYS_DPAA_FMAN
  88. fdt_fixup_fman_ethernet(blob);
  89. #endif
  90. return 0;
  91. }
  92. #ifdef CONFIG_DEEP_SLEEP
  93. void board_mem_sleep_setup(void)
  94. {
  95. /* does not provide HW signals for power management */
  96. CPLD_WRITE(misc_ctl_status, (CPLD_READ(misc_ctl_status) & ~0x40));
  97. /* Disable MCKE isolation */
  98. gpio_set_value(2, 0);
  99. udelay(1);
  100. }
  101. #endif