jz4780.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * JZ4780 common routines
  4. *
  5. * Copyright (c) 2013 Imagination Technologies
  6. * Author: Paul Burton <paul.burton@imgtec.com>
  7. */
  8. #include <config.h>
  9. #include <common.h>
  10. #include <cpu_func.h>
  11. #include <hang.h>
  12. #include <image.h>
  13. #include <init.h>
  14. #include <asm/global_data.h>
  15. #include <asm/io.h>
  16. #include <asm/sections.h>
  17. #include <mach/jz4780.h>
  18. #include <mach/jz4780_dram.h>
  19. #include <mmc.h>
  20. #include <spl.h>
  21. #ifdef CONFIG_SPL_BUILD
  22. /* Pointer to the global data structure for SPL */
  23. DECLARE_GLOBAL_DATA_PTR;
  24. gd_t gdata __section(".bss");
  25. void board_init_f(ulong dummy)
  26. {
  27. typedef void __noreturn (*image_entry_noargs_t)(void);
  28. struct mmc *mmc;
  29. unsigned long count;
  30. struct image_header *header;
  31. int ret;
  32. /* Set global data pointer */
  33. gd = &gdata;
  34. timer_init();
  35. pll_init();
  36. sdram_init();
  37. enable_caches();
  38. /* Clear the BSS */
  39. memset(__bss_start, 0, (char *)&__bss_end - __bss_start);
  40. gd->flags |= GD_FLG_SPL_INIT;
  41. ret = mmc_initialize(NULL);
  42. if (ret)
  43. hang();
  44. mmc = find_mmc_device(BOOT_DEVICE_MMC1);
  45. if (ret)
  46. hang();
  47. ret = mmc_init(mmc);
  48. if (ret)
  49. hang();
  50. header = (struct image_header *)(CONFIG_SYS_TEXT_BASE -
  51. sizeof(struct image_header));
  52. count = blk_dread(mmc_get_blk_desc(mmc),
  53. CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR,
  54. 0x800, header);
  55. if (count == 0)
  56. hang();
  57. image_entry_noargs_t image_entry =
  58. (image_entry_noargs_t)CONFIG_SYS_TEXT_BASE;
  59. image_entry();
  60. hang();
  61. }
  62. #endif /* CONFIG_SPL_BUILD */
  63. ulong board_get_usable_ram_top(ulong total_size)
  64. {
  65. return CONFIG_SYS_SDRAM_BASE + (256 * 1024 * 1024);
  66. }
  67. int print_cpuinfo(void)
  68. {
  69. printf("CPU: Ingenic JZ4780\n");
  70. return 0;
  71. }