board.c 974 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2012 Atmel Corporation
  4. * Copyright (C) 2019 Stefan Roese <sr@denx.de>
  5. */
  6. #include <common.h>
  7. #include <debug_uart.h>
  8. #include <env.h>
  9. #include <init.h>
  10. #include <led.h>
  11. #include <asm/arch/at91_common.h>
  12. #include <asm/arch/clk.h>
  13. DECLARE_GLOBAL_DATA_PTR;
  14. static void at91_prepare_cpu_var(void)
  15. {
  16. env_set("cpu", get_cpu_name());
  17. }
  18. int board_late_init(void)
  19. {
  20. at91_prepare_cpu_var();
  21. if (IS_ENABLED(CONFIG_LED))
  22. led_default_state();
  23. return 0;
  24. }
  25. #ifdef CONFIG_DEBUG_UART_BOARD_INIT
  26. void board_debug_uart_init(void)
  27. {
  28. at91_seriald_hw_init();
  29. }
  30. #endif
  31. int board_early_init_f(void)
  32. {
  33. #ifdef CONFIG_DEBUG_UART
  34. debug_uart_init();
  35. #endif
  36. return 0;
  37. }
  38. int board_init(void)
  39. {
  40. /* Address of boot parameters */
  41. gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
  42. return 0;
  43. }
  44. int dram_init(void)
  45. {
  46. gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
  47. CONFIG_SYS_SDRAM_SIZE);
  48. return 0;
  49. }