sama7g5ek.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2020 Microchip Technology, Inc.
  4. * Eugen Hristev <eugen.hristev@microchip.com>
  5. */
  6. #include <common.h>
  7. #include <debug_uart.h>
  8. #include <init.h>
  9. #include <asm/global_data.h>
  10. #include <asm/io.h>
  11. #include <asm/arch/at91_common.h>
  12. #include <asm/arch/atmel_pio4.h>
  13. #include <asm/arch/clk.h>
  14. #include <asm/arch/gpio.h>
  15. #include <asm/arch/sama7g5.h>
  16. DECLARE_GLOBAL_DATA_PTR;
  17. int board_late_init(void)
  18. {
  19. return 0;
  20. }
  21. #if (IS_ENABLED(CONFIG_DEBUG_UART_BOARD_INIT))
  22. static void board_uart0_hw_init(void)
  23. {
  24. /* FLEXCOM3 IO0 */
  25. atmel_pio4_set_f_periph(AT91_PIO_PORTD, 17, ATMEL_PIO_PUEN_MASK);
  26. /* FLEXCOM3 IO1 */
  27. atmel_pio4_set_f_periph(AT91_PIO_PORTD, 16, 0);
  28. at91_periph_clk_enable(ATMEL_ID_FLEXCOM3);
  29. }
  30. void board_debug_uart_init(void)
  31. {
  32. board_uart0_hw_init();
  33. }
  34. #endif
  35. int board_early_init_f(void)
  36. {
  37. #if (IS_ENABLED(CONFIG_DEBUG_UART))
  38. debug_uart_init();
  39. #endif
  40. return 0;
  41. }
  42. #define MAC24AA_MAC_OFFSET 0xfa
  43. #if (IS_ENABLED(CONFIG_MISC_INIT_R))
  44. int misc_init_r(void)
  45. {
  46. #if (IS_ENABLED(CONFIG_I2C_EEPROM))
  47. at91_set_ethaddr(MAC24AA_MAC_OFFSET);
  48. at91_set_eth1addr(MAC24AA_MAC_OFFSET);
  49. #endif
  50. return 0;
  51. }
  52. #endif
  53. int board_init(void)
  54. {
  55. /* address of boot parameters */
  56. gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
  57. return 0;
  58. }
  59. int dram_init(void)
  60. {
  61. gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
  62. CONFIG_SYS_SDRAM_SIZE);
  63. return 0;
  64. }