aboutsummaryrefslogtreecommitdiff
path: root/src/mainboard/google/veyron_pinky
diff options
context:
space:
mode:
authorhuang lin <hl@rock-chips.com>2014-09-25 16:33:38 +0800
committerAaron Durbin <adurbin@google.com>2015-04-02 21:16:45 +0200
commitbfdd732b80a56e31d3bbe59de76a6a91b0f5b9e4 (patch)
tree6ab65295596023084a4f08ffa6addc38aae7ab8e /src/mainboard/google/veyron_pinky
parentbbcffd9e25e12a8ee5858ac580aa7e86ecf32ee5 (diff)
rockchip: support pwm regulator
BUG=None TEST=Boot Veyron Pinky and test the VDD_LOG Original-Change-Id: Ie2eef918e04ba0e13879e915b0b0bef44aef550e Original-Signed-off-by: huang lin <hl@rock-chips.com> Original-Reviewed-on: https://chromium-review.googlesource.com/219753 Original-Reviewed-by: Julius Werner <jwerner@chromium.org> Original-Commit-Queue: Julius Werner <jwerner@chromium.org> Change-Id: I444b47564d90b3480b351fdd8460e5b94e71927c (cherry picked from commit 4491d9c4037161fd8c4cc40856167bf73182fda6) Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/9240 Reviewed-by: Patrick Georgi <pgeorgi@google.com> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/mainboard/google/veyron_pinky')
-rw-r--r--src/mainboard/google/veyron_pinky/romstage.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/mainboard/google/veyron_pinky/romstage.c b/src/mainboard/google/veyron_pinky/romstage.c
index 31317a06a4..f972ee26c8 100644
--- a/src/mainboard/google/veyron_pinky/romstage.c
+++ b/src/mainboard/google/veyron_pinky/romstage.c
@@ -28,11 +28,32 @@
#include <timestamp.h>
#include <arch/cache.h>
#include <arch/exception.h>
+#include <stdlib.h>
+#include <assert.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include <soc/rockchip/rk3288/sdram.h>
#include <soc/rockchip/rk3288/clock.h>
+#include <soc/rockchip/rk3288/pwm.h>
+#include <soc/rockchip/rk3288/grf.h>
#include "timer.h"
+static void regulate_vdd_log(unsigned int mv)
+{
+ unsigned int duty_ns;
+ const u32 period_ns = 2000; /* pwm period: 2000ns */
+ const u32 max_regulator_mv = 1350; /* 1.35V */
+ const u32 min_regulator_mv = 870; /* 0.87V */
+
+ writel(IOMUX_PWM1, &rk3288_grf->iomux_pwm1);
+
+ assert((mv >= min_regulator_mv) && (mv <= max_regulator_mv));
+
+ duty_ns = (max_regulator_mv - mv) * period_ns /
+ (max_regulator_mv - min_regulator_mv);
+
+ pwm_init(1, period_ns, duty_ns);
+}
+
void main(void)
{
#if CONFIG_COLLECT_TIMESTAMPS
@@ -49,6 +70,8 @@ void main(void)
console_init();
+ /* vdd_log 1200mv is enough for ddr run 666Mhz */
+ regulate_vdd_log(1200);
#if CONFIG_COLLECT_TIMESTAMPS
before_dram_time = timestamp_get();
#endif