mx7ulp_evk.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2016 Freescale Semiconductor, Inc.
  4. */
  5. #include <common.h>
  6. #include <fdt_support.h>
  7. #include <init.h>
  8. #include <asm/global_data.h>
  9. #include <asm/io.h>
  10. #include <asm/arch/sys_proto.h>
  11. #include <asm/arch/mx7ulp-pins.h>
  12. #include <asm/arch/iomux.h>
  13. #include <asm/mach-imx/boot_mode.h>
  14. DECLARE_GLOBAL_DATA_PTR;
  15. #define UART_PAD_CTRL (PAD_CTL_PUS_UP)
  16. int dram_init(void)
  17. {
  18. gd->ram_size = imx_ddr_size();
  19. return 0;
  20. }
  21. static iomux_cfg_t const lpuart4_pads[] = {
  22. MX7ULP_PAD_PTC3__LPUART4_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
  23. MX7ULP_PAD_PTC2__LPUART4_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
  24. };
  25. static void setup_iomux_uart(void)
  26. {
  27. mx7ulp_iomux_setup_multiple_pads(lpuart4_pads,
  28. ARRAY_SIZE(lpuart4_pads));
  29. }
  30. int board_early_init_f(void)
  31. {
  32. setup_iomux_uart();
  33. return 0;
  34. }
  35. int board_init(void)
  36. {
  37. /* address of boot parameters */
  38. gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
  39. return 0;
  40. }
  41. #if IS_ENABLED(CONFIG_OF_BOARD_SETUP)
  42. int ft_board_setup(void *blob, struct bd_info *bd)
  43. {
  44. const char *path;
  45. int rc, nodeoff;
  46. if (get_boot_device() == USB_BOOT) {
  47. path = fdt_get_alias(blob, "mmc0");
  48. if (!path) {
  49. puts("Not found mmc0\n");
  50. return 0;
  51. }
  52. nodeoff = fdt_path_offset(blob, path);
  53. if (nodeoff < 0)
  54. return 0;
  55. printf("Found usdhc0 node\n");
  56. if (fdt_get_property(blob, nodeoff, "vqmmc-supply",
  57. NULL) != NULL) {
  58. rc = fdt_delprop(blob, nodeoff, "vqmmc-supply");
  59. if (!rc) {
  60. puts("Removed vqmmc-supply property\n");
  61. add:
  62. rc = fdt_setprop(blob, nodeoff,
  63. "no-1-8-v", NULL, 0);
  64. if (rc == -FDT_ERR_NOSPACE) {
  65. rc = fdt_increase_size(blob, 32);
  66. if (!rc)
  67. goto add;
  68. } else if (rc) {
  69. printf("Failed to add no-1-8-v property, %d\n", rc);
  70. } else {
  71. puts("Added no-1-8-v property\n");
  72. }
  73. } else {
  74. printf("Failed to remove vqmmc-supply property, %d\n", rc);
  75. }
  76. }
  77. }
  78. return 0;
  79. }
  80. #endif