summaryrefslogtreecommitdiff
path: root/board/phytec
diff options
context:
space:
mode:
authorKever Yang <kever.yang@rock-chips.com>2019-07-22 19:59:25 +0800
committerKever Yang <kever.yang@rock-chips.com>2019-07-29 10:25:27 +0800
commit8f5b5aac7671fcf7ad681b1f690b853cacb3fe3d (patch)
treeabecbcf629263ef9358ef7574c24c800dda619f4 /board/phytec
parent57d55db603f548b48d03bdf021dc7eb33464e12c (diff)
rockchip: rk3288-phycore: move phycore_init() to its own board file
phycore_init() is use for phycore board only, it should be move back to phycore-rk3288.c Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Diffstat (limited to 'board/phytec')
-rw-r--r--board/phytec/phycore_rk3288/phycore-rk3288.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/board/phytec/phycore_rk3288/phycore-rk3288.c b/board/phytec/phycore_rk3288/phycore-rk3288.c
index ffe1833b06..fbf1511978 100644
--- a/board/phytec/phycore_rk3288/phycore-rk3288.c
+++ b/board/phytec/phycore_rk3288/phycore-rk3288.c
@@ -8,10 +8,13 @@
#include <common.h>
#include <dm.h>
#include <environment.h>
+#include <fdtdec.h>
#include <i2c.h>
#include <i2c_eeprom.h>
#include <netdev.h>
#include "som.h"
+#include <power/regulator.h>
+#include <power/rk8xx_pmic.h>
static int valid_rk3288_som(struct rk3288_som *som)
{
@@ -68,3 +71,47 @@ int rk_board_late_init(void)
return 0;
}
+
+#ifdef CONFIG_SPL_BUILD
+#if !defined(CONFIG_SPL_OF_PLATDATA)
+static int phycore_init(void)
+{
+ struct udevice *pmic;
+ int ret;
+
+ ret = uclass_first_device_err(UCLASS_PMIC, &pmic);
+ if (ret)
+ return ret;
+
+#if defined(CONFIG_SPL_POWER_SUPPORT)
+ /* Increase USB input current to 2A */
+ ret = rk818_spl_configure_usb_input_current(pmic, 2000);
+ if (ret)
+ return ret;
+
+ /* Close charger when USB lower then 3.26V */
+ ret = rk818_spl_configure_usb_chrg_shutdown(pmic, 3260000);
+ if (ret)
+ return ret;
+#endif
+
+ return 0;
+}
+#endif
+
+void spl_board_init(void)
+{
+#if !defined(CONFIG_SPL_OF_PLATDATA)
+ int ret;
+
+ if (of_machine_is_compatible("phytec,rk3288-phycore-som")) {
+ ret = phycore_init();
+ if (ret) {
+ debug("Failed to set up phycore power settings: %d\n",
+ ret);
+ return;
+ }
+ }
+#endif
+}
+#endif