microblaze-generic.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2007-2018 Michal Simek
  4. *
  5. * Michal SIMEK <monstr@monstr.eu>
  6. */
  7. /*
  8. * This is a board specific file. It's OK to include board specific
  9. * header files
  10. */
  11. #include <common.h>
  12. #include <config.h>
  13. #include <env.h>
  14. #include <init.h>
  15. #include <log.h>
  16. #include <asm/global_data.h>
  17. #include <dm/lists.h>
  18. #include <fdtdec.h>
  19. #include <linux/sizes.h>
  20. #include "../common/board.h"
  21. DECLARE_GLOBAL_DATA_PTR;
  22. int dram_init_banksize(void)
  23. {
  24. return fdtdec_setup_memory_banksize();
  25. }
  26. int dram_init(void)
  27. {
  28. if (fdtdec_setup_mem_size_base() != 0)
  29. return -EINVAL;
  30. return 0;
  31. };
  32. int board_late_init(void)
  33. {
  34. ulong max_size;
  35. u32 status = 0;
  36. #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_SYSRESET_MICROBLAZE)
  37. int ret;
  38. ret = device_bind_driver(gd->dm_root, "mb_soft_reset",
  39. "reset_soft", NULL);
  40. if (ret)
  41. printf("Warning: No reset driver: ret=%d\n", ret);
  42. #endif
  43. if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
  44. debug("Saved variables - Skipping\n");
  45. return 0;
  46. }
  47. max_size = gd->start_addr_sp - CONFIG_STACK_SIZE;
  48. max_size = round_down(max_size, SZ_16M);
  49. status |= env_set_hex("scriptaddr", max_size + SZ_2M);
  50. status |= env_set_hex("pxefile_addr_r", max_size + SZ_1M);
  51. status |= env_set_hex("kernel_addr_r", gd->ram_base + SZ_32M);
  52. status |= env_set_hex("fdt_addr_r", gd->ram_base + SZ_32M - SZ_1M);
  53. status |= env_set_hex("ramdisk_addr_r",
  54. gd->ram_base + SZ_32M + SZ_4M + SZ_2M);
  55. if (IS_ENABLED(CONFIG_MTD_NOR_FLASH))
  56. status |= env_set_hex("script_offset_nor",
  57. gd->bd->bi_flashstart +
  58. CONFIG_BOOT_SCRIPT_OFFSET);
  59. if (status)
  60. printf("%s: Saving run time variables FAILED\n", __func__);
  61. return board_late_init_xilinx();
  62. }