jz4780.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 <init.h>
  12. #include <asm/io.h>
  13. #include <asm/sections.h>
  14. #include <mach/jz4780.h>
  15. #include <mach/jz4780_dram.h>
  16. #include <mmc.h>
  17. #include <spl.h>
  18. #ifdef CONFIG_SPL_BUILD
  19. /* Pointer to the global data structure for SPL */
  20. DECLARE_GLOBAL_DATA_PTR;
  21. gd_t gdata __attribute__ ((section(".bss")));
  22. void board_init_f(ulong dummy)
  23. {
  24. typedef void __noreturn (*image_entry_noargs_t)(void);
  25. struct mmc *mmc;
  26. unsigned long count;
  27. struct image_header *header;
  28. int ret;
  29. /* Set global data pointer */
  30. gd = &gdata;
  31. timer_init();
  32. pll_init();
  33. sdram_init();
  34. enable_caches();
  35. /* Clear the BSS */
  36. memset(__bss_start, 0, (char *)&__bss_end - __bss_start);
  37. gd->flags |= GD_FLG_SPL_INIT;
  38. ret = mmc_initialize(NULL);
  39. if (ret)
  40. hang();
  41. mmc = find_mmc_device(BOOT_DEVICE_MMC1);
  42. if (ret)
  43. hang();
  44. ret = mmc_init(mmc);
  45. if (ret)
  46. hang();
  47. header = (struct image_header *)(CONFIG_SYS_TEXT_BASE -
  48. sizeof(struct image_header));
  49. count = blk_dread(mmc_get_blk_desc(mmc),
  50. CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR,
  51. 0x800, header);
  52. if (count == 0)
  53. hang();
  54. image_entry_noargs_t image_entry =
  55. (image_entry_noargs_t)CONFIG_SYS_TEXT_BASE;
  56. image_entry();
  57. hang();
  58. }
  59. #endif /* CONFIG_SPL_BUILD */
  60. ulong board_get_usable_ram_top(ulong total_size)
  61. {
  62. return CONFIG_SYS_SDRAM_BASE + (256 * 1024 * 1024);
  63. }
  64. int print_cpuinfo(void)
  65. {
  66. printf("CPU: Ingenic JZ4780\n");
  67. return 0;
  68. }