t4240emu.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 <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_liodn.h>
  18. DECLARE_GLOBAL_DATA_PTR;
  19. int checkboard(void)
  20. {
  21. struct cpu_type *cpu = gd->arch.cpu;
  22. printf("Board: %sEMU\n", cpu->name);
  23. return 0;
  24. }
  25. int board_early_init_r(void)
  26. {
  27. const unsigned int flashbase = CONFIG_SYS_FLASH_BASE;
  28. int flash_esel = find_tlb_idx((void *)flashbase, 1);
  29. /*
  30. * Remap Boot flash + PROMJET region to caching-inhibited
  31. * so that flash can be erased properly.
  32. */
  33. /* Flush d-cache and invalidate i-cache of any FLASH data */
  34. flush_dcache();
  35. invalidate_icache();
  36. if (flash_esel == -1) {
  37. /* very unlikely unless something is messed up */
  38. puts("Error: Could not find TLB for FLASH BASE\n");
  39. flash_esel = 2; /* give our best effort to continue */
  40. } else {
  41. /* invalidate existing TLB entry for flash */
  42. disable_tlb(flash_esel);
  43. }
  44. set_tlb(1, flashbase, CONFIG_SYS_FLASH_BASE_PHYS,
  45. MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
  46. 0, flash_esel, BOOKE_PAGESZ_256M, 1);
  47. return 0;
  48. }
  49. int misc_init_r(void)
  50. {
  51. return 0;
  52. }
  53. int ft_board_setup(void *blob, bd_t *bd)
  54. {
  55. phys_addr_t base;
  56. phys_size_t size;
  57. ft_cpu_setup(blob, bd);
  58. base = getenv_bootm_low();
  59. size = getenv_bootm_size();
  60. fdt_fixup_memory(blob, (u64)base, (u64)size);
  61. fdt_fixup_liodn(blob);
  62. fsl_fdt_fixup_dr_usb(blob, bd);
  63. return 0;
  64. }