mx7ulp_com.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2016 Freescale Semiconductor, Inc.
  4. */
  5. #include <common.h>
  6. #include <init.h>
  7. #include <asm/global_data.h>
  8. #include <asm/io.h>
  9. #include <asm/arch/sys_proto.h>
  10. #include <asm/arch/mx7ulp-pins.h>
  11. #include <asm/arch/iomux.h>
  12. #include <asm/gpio.h>
  13. DECLARE_GLOBAL_DATA_PTR;
  14. #define UART_PAD_CTRL (PAD_CTL_PUS_UP)
  15. int dram_init(void)
  16. {
  17. gd->ram_size = imx_ddr_size();
  18. #ifdef CONFIG_OPTEE_TZDRAM_SIZE
  19. gd->ram_size -= CONFIG_OPTEE_TZDRAM_SIZE;
  20. #endif
  21. return 0;
  22. }
  23. static iomux_cfg_t const lpuart4_pads[] = {
  24. MX7ULP_PAD_PTC3__LPUART4_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
  25. MX7ULP_PAD_PTC2__LPUART4_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
  26. };
  27. static void setup_iomux_uart(void)
  28. {
  29. mx7ulp_iomux_setup_multiple_pads(lpuart4_pads,
  30. ARRAY_SIZE(lpuart4_pads));
  31. }
  32. int board_early_init_f(void)
  33. {
  34. setup_iomux_uart();
  35. return 0;
  36. }
  37. int board_init(void)
  38. {
  39. /* address of boot parameters */
  40. gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
  41. return 0;
  42. }
  43. #ifdef CONFIG_SPL_BUILD
  44. #include <spl.h>
  45. #ifdef CONFIG_SPL_LOAD_FIT
  46. int board_fit_config_name_match(const char *name)
  47. {
  48. if (!strcmp(name, "imx7ulp-com"))
  49. return 0;
  50. return -1;
  51. }
  52. #endif
  53. void spl_board_init(void)
  54. {
  55. preloader_console_init();
  56. }
  57. void board_init_f(ulong dummy)
  58. {
  59. arch_cpu_init();
  60. board_early_init_f();
  61. }
  62. #endif