public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Stuebner <heiko@sntech.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/8] rockchip: rk3188: Setup the armclk in spl
Date: Mon, 20 Mar 2017 12:40:33 +0100	[thread overview]
Message-ID: <20170320114036.21475-6-heiko@sntech.de> (raw)
In-Reply-To: <20170320114036.21475-1-heiko@sntech.de>

The armclk starts in slow mode (24MHz) on the rk3188, which results in U-Boot
startup taking a lot of time (U-Boot itself, but also the rc4 decoding done
in the bootrom).

With default pmic settings we can always reach a safe frequency of 600MHz
which is also the frequency the proprietary loader left the armclk at,
without needing access to the systems pmic.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 arch/arm/mach-rockchip/rk3188-board-spl.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c b/arch/arm/mach-rockchip/rk3188-board-spl.c
index af4623fdb0..affd959f86 100644
--- a/arch/arm/mach-rockchip/rk3188-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3188-board-spl.c
@@ -4,6 +4,7 @@
  * SPDX-License-Identifier:     GPL-2.0+
  */
 
+#include <clk.h>
 #include <common.h>
 #include <debug_uart.h>
 #include <dm.h>
@@ -76,6 +77,27 @@ u32 spl_boot_mode(const u32 boot_device)
 	return MMCSD_MODE_RAW;
 }
 
+static int setup_arm_clock(void)
+{
+	struct udevice *dev;
+	struct clk clk;
+	int ret;
+
+	ret = rockchip_get_clk(&dev);
+	if (ret)
+		return ret;
+
+	clk.id = CLK_ARM;
+	ret = clk_request(dev, &clk);
+	if (ret < 0)
+		return ret;
+
+	ret = clk_set_rate(&clk, 600000000);
+
+	clk_free(&clk);
+	return ret;
+}
+
 void board_init_f(ulong dummy)
 {
 	struct udevice *pinctrl, *dev;
@@ -144,6 +166,8 @@ void board_init_f(ulong dummy)
 		return;
 	}
 
+	setup_arm_clock();
+
 #if defined(CONFIG_ROCKCHIP_SPL_BACK_TO_BROM) && !defined(CONFIG_SPL_BOARD_INIT)
 	back_to_bootrom();
 #endif
-- 
2.11.0

  parent reply	other threads:[~2017-03-20 11:40 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-20 11:40 [U-Boot] [PATCH 0/8] rockchip: rk3188: fixups and armclk speedup Heiko Stuebner
2017-03-20 11:40 ` [U-Boot] [PATCH 1/8] rockchip: rk3188: sdram: Set correct sdram base Heiko Stuebner
2017-03-24  3:27   ` Simon Glass
2017-03-26  2:42     ` Simon Glass
2017-03-20 11:40 ` [U-Boot] [PATCH 2/8] rockchip: rk3188: Decode the actual amount of ram Heiko Stuebner
2017-03-24  3:27   ` Simon Glass
2017-03-26  2:42     ` Simon Glass
2017-03-20 11:40 ` [U-Boot] [PATCH 3/8] rockchip: rk3188: Cleanup some SPL/TPL rename leftovers Heiko Stuebner
2017-03-24  3:27   ` Simon Glass
2017-03-26  2:42     ` Simon Glass
2017-03-20 11:40 ` [U-Boot] [PATCH 4/8] rockchip: clk: rk3188: Allow configuration of the armclk Heiko Stuebner
2017-03-24  3:27   ` Simon Glass
2017-03-26  2:42     ` Simon Glass
2017-03-20 11:40 ` Heiko Stuebner [this message]
2017-03-24  3:28   ` [U-Boot] [PATCH 5/8] rockchip: rk3188: Setup the armclk in spl Simon Glass
2017-03-26  2:42     ` Simon Glass
2017-03-20 11:40 ` [U-Boot] [PATCH 6/8] rockchip: rk3188: Switch to new i2c IP blocks Heiko Stuebner
2017-03-24  3:28   ` Simon Glass
2017-03-24  7:32     ` Heiko Stübner
2017-03-26  1:17       ` Simon Glass
2017-03-26 13:01         ` Heiko Stuebner
2017-04-01  4:22           ` Simon Glass
2017-03-20 11:40 ` [U-Boot] [PATCH 7/8] rockchip: i2c: Add compatibles for Rockchip Cortex-A9 socs Heiko Stuebner
2017-03-24  3:28   ` Simon Glass
2017-03-26  2:42     ` Simon Glass
2017-03-20 11:40 ` [U-Boot] [PATCH 8/8] rockchip: Enable pmic options and act8846 driver on rk3188 rock boards Heiko Stuebner
2017-03-24  3:28   ` Simon Glass
2017-03-26 19:13     ` Heiko Stuebner
2017-03-24  3:28 ` [U-Boot] [PATCH 0/8] rockchip: rk3188: fixups and armclk speedup Simon Glass
2017-03-24 16:04   ` Heiko Stuebner
2017-03-27 18:36     ` Simon Glass
2017-03-27 20:11       ` Heiko Stuebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170320114036.21475-6-heiko@sntech.de \
    --to=heiko@sntech.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox