rock960-rk3399.c 966 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2018 Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
  4. */
  5. #include <common.h>
  6. #include <dm.h>
  7. #include <dm/pinctrl.h>
  8. #include <dm/uclass-internal.h>
  9. #include <asm/arch-rockchip/periph.h>
  10. #include <power/regulator.h>
  11. #include <spl.h>
  12. int board_init(void)
  13. {
  14. int ret;
  15. ret = regulators_enable_boot_on(false);
  16. if (ret)
  17. debug("%s: Cannot enable boot on regulator\n", __func__);
  18. return 0;
  19. }
  20. void spl_board_init(void)
  21. {
  22. struct udevice *pinctrl;
  23. int ret;
  24. ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
  25. if (ret) {
  26. debug("%s: Cannot find pinctrl device\n", __func__);
  27. goto err;
  28. }
  29. /* Enable debug UART */
  30. ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG);
  31. if (ret) {
  32. debug("%s: Failed to set up console UART\n", __func__);
  33. goto err;
  34. }
  35. preloader_console_init();
  36. return;
  37. err:
  38. printf("%s: Error %d\n", __func__, ret);
  39. /* No way to report error here */
  40. hang();
  41. }