Commit fb7406469c012092d652741f103b0993103cf8e3

Authored by Philipp Tomsich
1 parent 861ff27757

rockchip: rk3399: make spl_board_init board-specific

The later-stage spl_board_init (as opposed to board_init_f) should set
up board-specific details: these differ between the EVB-RK3399 and the
RK3399-Q7 (Puma).

This moves spl_board_init back into the individual boards and removes
the unneeded functionality from Puma.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

Showing 3 changed files with 36 additions and 33 deletions Side-by-side Diff

arch/arm/mach-rockchip/rk3399-board-spl.c
... ... @@ -149,33 +149,6 @@
149 149 }
150 150 }
151 151  
152   -void spl_board_init(void)
153   -{
154   - struct udevice *pinctrl;
155   - int ret;
156   -
157   - ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
158   - if (ret) {
159   - debug("%s: Cannot find pinctrl device\n", __func__);
160   - goto err;
161   - }
162   -
163   - /* Enable debug UART */
164   - ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG);
165   - if (ret) {
166   - debug("%s: Failed to set up console UART\n", __func__);
167   - goto err;
168   - }
169   -
170   - preloader_console_init();
171   - return;
172   -err:
173   - printf("spl_board_init: Error %d\n", ret);
174   -
175   - /* No way to report error here */
176   - hang();
177   -}
178   -
179 152 #ifdef CONFIG_SPL_LOAD_FIT
180 153 int board_fit_config_name_match(const char *name)
181 154 {
board/rockchip/evb_rk3399/evb-rk3399.c
... ... @@ -3,13 +3,14 @@
3 3 *
4 4 * SPDX-License-Identifier: GPL-2.0+
5 5 */
  6 +
6 7 #include <common.h>
7 8 #include <dm.h>
8   -#include <ram.h>
9 9 #include <dm/pinctrl.h>
10 10 #include <dm/uclass-internal.h>
11 11 #include <asm/arch/periph.h>
12 12 #include <power/regulator.h>
  13 +#include <spl.h>
13 14  
14 15 DECLARE_GLOBAL_DATA_PTR;
15 16  
... ... @@ -66,5 +67,32 @@
66 67  
67 68 out:
68 69 return 0;
  70 +}
  71 +
  72 +void spl_board_init(void)
  73 +{
  74 + struct udevice *pinctrl;
  75 + int ret;
  76 +
  77 + ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
  78 + if (ret) {
  79 + debug("%s: Cannot find pinctrl device\n", __func__);
  80 + goto err;
  81 + }
  82 +
  83 + /* Enable debug UART */
  84 + ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG);
  85 + if (ret) {
  86 + debug("%s: Failed to set up console UART\n", __func__);
  87 + goto err;
  88 + }
  89 +
  90 + preloader_console_init();
  91 + return;
  92 +err:
  93 + printf("%s: Error %d\n", __func__, ret);
  94 +
  95 + /* No way to report error here */
  96 + hang();
69 97 }
board/theobroma-systems/puma_rk3399/puma-rk3399.c
... ... @@ -3,15 +3,16 @@
3 3 *
4 4 * SPDX-License-Identifier: GPL-2.0+
5 5 */
  6 +
6 7 #include <common.h>
7 8 #include <dm.h>
8 9 #include <misc.h>
9   -#include <ram.h>
10 10 #include <dm/pinctrl.h>
11 11 #include <dm/uclass-internal.h>
12 12 #include <asm/setup.h>
13 13 #include <asm/arch/periph.h>
14 14 #include <power/regulator.h>
  15 +#include <spl.h>
15 16 #include <u-boot/sha256.h>
16 17  
17 18 DECLARE_GLOBAL_DATA_PTR;
... ... @@ -59,6 +60,11 @@
59 60 return 0;
60 61 }
61 62  
  63 +void spl_board_init(void)
  64 +{
  65 + preloader_console_init();
  66 +}
  67 +
62 68 static void setup_macaddr(void)
63 69 {
64 70 #if CONFIG_IS_ENABLED(CMD_NET)
... ... @@ -91,8 +97,6 @@
91 97 mac_addr[0] |= 0x02; /* set local assignment bit (IEEE802) */
92 98 eth_env_set_enetaddr("ethaddr", mac_addr);
93 99 #endif
94   -
95   - return;
96 100 }
97 101  
98 102 static void setup_serial(void)
... ... @@ -147,8 +151,6 @@
147 151 env_set("cpuid#", cpuid_str);
148 152 env_set("serial#", serialno_str);
149 153 #endif
150   -
151   - return;
152 154 }
153 155  
154 156 int misc_init_r(void)