mx7ulp_evk.c 1.8 KB

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