diff mbox series

[v2,2/2] rockchip: gru: Allow setting up clocks in U-Boot proper

Message ID 20201027211511.14544-2-alpernebiyasak@gmail.com
State Accepted
Commit 13634bb6585ec0e789da7504146873fb492456e5
Delegated to: Kever Yang
Headers show
Series [v2,1/2] rockchip: rk3399: Init clocks in U-Boot proper if SPL was not run | expand

Commit Message

Alper Nebi Yasak Oct. 27, 2020, 9:15 p.m. UTC
Commit fe974716326c ("rockchip: rk3288: Allow setting up clocks in
U-Boot proper") fixes some clock issues when chainloading U-Boot on
rk3288 chromebooks. Part of that change is still available in veyron's
board_early_init_r() function. Since chain-loading U-Boot proper from
vendor firmware is possible on gru boards as well, do the same thing for
them too.

On rk3399, this needs to detect whether SPL was run via handoff, so
enable that and bloblist kconfigs it needs for chromebook_bob.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
---

Changes in v2:
- Enable kconfigs needed for using SPL handoff

v1: https://patchwork.ozlabs.org/project/uboot/patch/20201022203740.24528-2-alpernebiyasak@gmail.com/

 board/google/gru/gru.c           | 23 +++++++++++++++++++++++
 configs/chromebook_bob_defconfig |  5 +++++
 2 files changed, 28 insertions(+)

Comments

Simon Glass Nov. 3, 2020, 3:11 p.m. UTC | #1
On Tue, 27 Oct 2020 at 15:15, Alper Nebi Yasak <alpernebiyasak@gmail.com> wrote:
>
> Commit fe974716326c ("rockchip: rk3288: Allow setting up clocks in
> U-Boot proper") fixes some clock issues when chainloading U-Boot on
> rk3288 chromebooks. Part of that change is still available in veyron's
> board_early_init_r() function. Since chain-loading U-Boot proper from
> vendor firmware is possible on gru boards as well, do the same thing for
> them too.
>
> On rk3399, this needs to detect whether SPL was run via handoff, so
> enable that and bloblist kconfigs it needs for chromebook_bob.
>
> Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
> ---
>
> Changes in v2:
> - Enable kconfigs needed for using SPL handoff
>
> v1: https://patchwork.ozlabs.org/project/uboot/patch/20201022203740.24528-2-alpernebiyasak@gmail.com/
>
>  board/google/gru/gru.c           | 23 +++++++++++++++++++++++
>  configs/chromebook_bob_defconfig |  5 +++++
>  2 files changed, 28 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>
Kever Yang Nov. 13, 2020, 10:13 a.m. UTC | #2
On 2020/10/28 上午5:15, Alper Nebi Yasak wrote:
> Commit fe974716326c ("rockchip: rk3288: Allow setting up clocks in
> U-Boot proper") fixes some clock issues when chainloading U-Boot on
> rk3288 chromebooks. Part of that change is still available in veyron's
> board_early_init_r() function. Since chain-loading U-Boot proper from
> vendor firmware is possible on gru boards as well, do the same thing for
> them too.
>
> On rk3399, this needs to detect whether SPL was run via handoff, so
> enable that and bloblist kconfigs it needs for chromebook_bob.
>
> Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>
> Changes in v2:
> - Enable kconfigs needed for using SPL handoff
>
> v1: https://patchwork.ozlabs.org/project/uboot/patch/20201022203740.24528-2-alpernebiyasak@gmail.com/
>
>   board/google/gru/gru.c           | 23 +++++++++++++++++++++++
>   configs/chromebook_bob_defconfig |  5 +++++
>   2 files changed, 28 insertions(+)
>
> diff --git a/board/google/gru/gru.c b/board/google/gru/gru.c
> index 7dfbc3ac8676..441a1a376a9a 100644
> --- a/board/google/gru/gru.c
> +++ b/board/google/gru/gru.c
> @@ -4,6 +4,7 @@
>    */
>   
>   #include <common.h>
> +#include <dm.h>
>   #include <init.h>
>   
>   #ifdef CONFIG_SPL_BUILD
> @@ -31,3 +32,25 @@ int board_early_init_f(void)
>   	return 0;
>   }
>   #endif
> +
> +#ifndef CONFIG_SPL_BUILD
> +int board_early_init_r(void)
> +{
> +	struct udevice *clk;
> +	int ret;
> +
> +	/*
> +	 * This init is done in SPL, but when chain-loading U-Boot SPL will
> +	 * have been skipped. Allow the clock driver to check if it needs
> +	 * setting up.
> +	 */
> +	ret = uclass_get_device_by_driver(UCLASS_CLK,
> +					  DM_GET_DRIVER(clk_rk3399), &clk);
> +	if (ret) {
> +		debug("%s: CLK init failed: %d\n", __func__, ret);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +#endif
> diff --git a/configs/chromebook_bob_defconfig b/configs/chromebook_bob_defconfig
> index 4608892fb567..73635f0d13f1 100644
> --- a/configs/chromebook_bob_defconfig
> +++ b/configs/chromebook_bob_defconfig
> @@ -19,6 +19,11 @@ CONFIG_DEBUG_UART=y
>   CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-gru-bob.dtb"
>   # CONFIG_DISPLAY_CPUINFO is not set
>   CONFIG_DISPLAY_BOARDINFO_LATE=y
> +CONFIG_BOARD_EARLY_INIT_R=y
> +CONFIG_BLOBLIST=y
> +CONFIG_BLOBLIST_SIZE=0x1000
> +CONFIG_BLOBLIST_ADDR=0x100000
> +CONFIG_HANDOFF=y
>   # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
>   CONFIG_SPL_STACK_R=y
>   CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x4000
diff mbox series

Patch

diff --git a/board/google/gru/gru.c b/board/google/gru/gru.c
index 7dfbc3ac8676..441a1a376a9a 100644
--- a/board/google/gru/gru.c
+++ b/board/google/gru/gru.c
@@ -4,6 +4,7 @@ 
  */
 
 #include <common.h>
+#include <dm.h>
 #include <init.h>
 
 #ifdef CONFIG_SPL_BUILD
@@ -31,3 +32,25 @@  int board_early_init_f(void)
 	return 0;
 }
 #endif
+
+#ifndef CONFIG_SPL_BUILD
+int board_early_init_r(void)
+{
+	struct udevice *clk;
+	int ret;
+
+	/*
+	 * This init is done in SPL, but when chain-loading U-Boot SPL will
+	 * have been skipped. Allow the clock driver to check if it needs
+	 * setting up.
+	 */
+	ret = uclass_get_device_by_driver(UCLASS_CLK,
+					  DM_GET_DRIVER(clk_rk3399), &clk);
+	if (ret) {
+		debug("%s: CLK init failed: %d\n", __func__, ret);
+		return ret;
+	}
+
+	return 0;
+}
+#endif
diff --git a/configs/chromebook_bob_defconfig b/configs/chromebook_bob_defconfig
index 4608892fb567..73635f0d13f1 100644
--- a/configs/chromebook_bob_defconfig
+++ b/configs/chromebook_bob_defconfig
@@ -19,6 +19,11 @@  CONFIG_DEBUG_UART=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-gru-bob.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_BOARD_EARLY_INIT_R=y
+CONFIG_BLOBLIST=y
+CONFIG_BLOBLIST_SIZE=0x1000
+CONFIG_BLOBLIST_ADDR=0x100000
+CONFIG_HANDOFF=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x4000