evb-rk3399.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * (C) Copyright 2016 Rockchip Electronics Co., Ltd
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <dm.h>
  8. #include <dm/pinctrl.h>
  9. #include <asm/arch/periph.h>
  10. #include <power/regulator.h>
  11. DECLARE_GLOBAL_DATA_PTR;
  12. int board_init(void)
  13. {
  14. struct udevice *pinctrl, *regulator;
  15. int ret;
  16. /*
  17. * The PWM do not have decicated interrupt number in dts and can
  18. * not get periph_id by pinctrl framework, so let's init them here.
  19. * The PWM2 and PWM3 are for pwm regulater.
  20. */
  21. ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
  22. if (ret) {
  23. debug("%s: Cannot find pinctrl device\n", __func__);
  24. goto out;
  25. }
  26. ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM2);
  27. if (ret) {
  28. debug("%s PWM2 pinctrl init fail!\n", __func__);
  29. goto out;
  30. }
  31. ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM3);
  32. if (ret) {
  33. debug("%s PWM3 pinctrl init fail!\n", __func__);
  34. goto out;
  35. }
  36. ret = regulator_get_by_platname("vcc5v0_host", &regulator);
  37. if (ret) {
  38. debug("%s vcc5v0_host init fail! ret %d\n", __func__, ret);
  39. goto out;
  40. }
  41. ret = regulator_set_enable(regulator, true);
  42. if (ret) {
  43. debug("%s vcc5v0-host-en set fail!\n", __func__);
  44. goto out;
  45. }
  46. out:
  47. return 0;
  48. }
  49. int dram_init(void)
  50. {
  51. gd->ram_size = 0x80000000;
  52. return 0;
  53. }
  54. void dram_init_banksize(void)
  55. {
  56. /* Reserve 0x200000 for ATF bl31 */
  57. gd->bd->bi_dram[0].start = 0x200000;
  58. gd->bd->bi_dram[0].size = 0x80000000;
  59. }