]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
rockchip: rk3288: Move rk3288_detect_reset_reason to soc file
authorKever Yang <kever.yang@rock-chips.com>
Mon, 22 Jul 2019 12:02:14 +0000 (20:02 +0800)
committerKever Yang <kever.yang@rock-chips.com>
Mon, 29 Jul 2019 02:27:45 +0000 (10:27 +0800)
The rk3288_detect_reset_reason() is per-SoC operation, move
it to rk3288.c, and extend the rk_board_late_init() with
rk3288_board_late_init() to make all the board works fine
as before.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
arch/arm/mach-rockchip/rk3288-board.c
arch/arm/mach-rockchip/rk3288/rk3288.c
board/chipspark/popmetal_rk3288/popmetal-rk3288.c
board/phytec/phycore_rk3288/phycore-rk3288.c
board/rockchip/tinker_rk3288/tinker-rk3288.c

index 1c37038c992590a7e700547c238d91f593037a51..1f33f25943afc06a221ad2fd89fde333892eba35 100644 (file)
@@ -24,47 +24,9 @@ __weak int rk_board_late_init(void)
        return 0;
 }
 
-static void rk3288_detect_reset_reason(void)
-{
-       struct rk3288_cru *cru = rockchip_get_cru();
-       const char *reason;
-
-       if (IS_ERR(cru))
-               return;
-
-       switch (cru->cru_glb_rst_st) {
-       case GLB_POR_RST:
-               reason = "POR";
-               break;
-       case FST_GLB_RST_ST:
-       case SND_GLB_RST_ST:
-               reason = "RST";
-               break;
-       case FST_GLB_TSADC_RST_ST:
-       case SND_GLB_TSADC_RST_ST:
-               reason = "THERMAL";
-               break;
-       case FST_GLB_WDT_RST_ST:
-       case SND_GLB_WDT_RST_ST:
-               reason = "WDOG";
-               break;
-       default:
-               reason = "unknown reset";
-       }
-
-       env_set("reset_reason", reason);
-
-       /*
-        * Clear cru_glb_rst_st, so we can determine the last reset cause
-        * for following resets.
-        */
-       rk_clrreg(&cru->cru_glb_rst_st, GLB_RST_ST_MASK);
-}
-
 int board_late_init(void)
 {
        setup_boot_mode();
-       rk3288_detect_reset_reason();
 
        return rk_board_late_init();
 }
index 10db6dfa9b62ab8794681aeec6cb87c7319dd7be..b462c0906994fef239fb5322a726ac51b7715814 100644 (file)
@@ -100,6 +100,55 @@ void board_debug_uart_init(void)
 }
 #endif
 
+static void rk3288_detect_reset_reason(void)
+{
+       struct rk3288_cru *cru = rockchip_get_cru();
+       const char *reason;
+
+       if (IS_ERR(cru))
+               return;
+
+       switch (cru->cru_glb_rst_st) {
+       case GLB_POR_RST:
+               reason = "POR";
+               break;
+       case FST_GLB_RST_ST:
+       case SND_GLB_RST_ST:
+               reason = "RST";
+               break;
+       case FST_GLB_TSADC_RST_ST:
+       case SND_GLB_TSADC_RST_ST:
+               reason = "THERMAL";
+               break;
+       case FST_GLB_WDT_RST_ST:
+       case SND_GLB_WDT_RST_ST:
+               reason = "WDOG";
+               break;
+       default:
+               reason = "unknown reset";
+       }
+
+       env_set("reset_reason", reason);
+
+       /*
+        * Clear cru_glb_rst_st, so we can determine the last reset cause
+        * for following resets.
+        */
+       rk_clrreg(&cru->cru_glb_rst_st, GLB_RST_ST_MASK);
+}
+
+__weak int rk3288_board_late_init(void)
+{
+       return 0;
+}
+
+int rk_board_late_init(void)
+{
+       rk3288_detect_reset_reason();
+
+       return rk3288_board_late_init();
+}
+
 static int do_clock(cmd_tbl_t *cmdtp, int flag, int argc,
                       char * const argv[])
 {
index 9ba1fbd0e274030bd96d197d554c0ed82288df57..47b921a7486280a496bd632e89c9dd46e92e352d 100644 (file)
@@ -8,7 +8,7 @@
 
 #define GPIO7A3_HUB_RST        227
 
-int rk_board_late_init(void)
+int rk3288_board_late_init(void)
 {
        int ret;
 
index fbf15119783933ad0eb910a22971150670895fd9..92f3bd25f460b01eebf8024bcc7e0def8d161a82 100644 (file)
@@ -30,7 +30,7 @@ static int valid_rk3288_som(struct rk3288_som *som)
        return hw == som->bs;
 }
 
-int rk_board_late_init(void)
+int rk3288_board_late_init(void)
 {
        int ret;
        struct udevice *dev;
index 44f13183a5b593089f95a6df627ea5e5f02b8cb5..e6b018d89c4351e926eac261b8dfbb5034518325 100644 (file)
@@ -21,7 +21,7 @@ static int get_ethaddr_from_eeprom(u8 *addr)
        return i2c_eeprom_read(dev, 0, addr, 6);
 }
 
-int rk_board_late_init(void)
+int rk3288_board_late_init(void)
 {
        u8 ethaddr[6];