misc.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (C) 2012 Altera Corporation <www.altera.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #include <common.h>
  18. #include <asm/io.h>
  19. #include <asm/arch/reset_manager.h>
  20. DECLARE_GLOBAL_DATA_PTR;
  21. static const struct socfpga_reset_manager *reset_manager_base =
  22. (void *)SOCFPGA_RSTMGR_ADDRESS;
  23. /*
  24. * Write the reset manager register to cause reset
  25. */
  26. void reset_cpu(ulong addr)
  27. {
  28. /* request a warm reset */
  29. writel(RSTMGR_CTRL_SWWARMRSTREQ_LSB, &reset_manager_base->ctrl);
  30. /*
  31. * infinite loop here as watchdog will trigger and reset
  32. * the processor
  33. */
  34. while (1)
  35. ;
  36. }
  37. /*
  38. * Release peripherals from reset based on handoff
  39. */
  40. void reset_deassert_peripherals_handoff(void)
  41. {
  42. writel(0, &reset_manager_base->per_mod_reset);
  43. }
  44. int dram_init(void)
  45. {
  46. gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE);
  47. return 0;
  48. }