diff options
author | huang lin <hl@rock-chips.com> | 2014-10-10 20:28:47 -0700 |
---|---|---|
committer | Aaron Durbin <adurbin@google.com> | 2015-04-04 15:05:12 +0200 |
commit | 08884e39cd3c7d0d0250e0e7921d12b5ae10ada1 (patch) | |
tree | 6c266022d90e3fcf3586b454257e41e7b7d62994 /src/soc/rockchip/rk3288/rk808.c | |
parent | 8affee58975f28e6a22fe3a474bd8bdd9a9cc05a (diff) |
rk3288: set cpu frequency up to 1.8GHz
before the rkclk_init(), we must set rk808
buck1 voltage up to 1300mv
BUG=chrome-os-partner:32716, chrome-os-partner:31896
TEST=Boot on veyron_pinky rev2,check the rk808 buck1 voltage 1300mv
and check the cpu frequency up to 1.8GHz
Original-Change-Id: I6a8c6e35bd7cc6017f2def72876a9170977f206e
Original-Signed-off-by: huang lin <hl@rock-chips.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/222957
Original-Reviewed-by: Doug Anderson <dianders@chromium.org>
(cherry picked from commit 2e7e7c265691250d4a1b3ff94fe70b0a05f23e16)
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Change-Id: Iff89d959456dd4d36f4293435caf7b4f7bdaf6fd
Reviewed-on: http://review.coreboot.org/9260
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/soc/rockchip/rk3288/rk808.c')
-rw-r--r-- | src/soc/rockchip/rk3288/rk808.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/soc/rockchip/rk3288/rk808.c b/src/soc/rockchip/rk3288/rk808.c index 50df96d591..48cfa8603e 100644 --- a/src/soc/rockchip/rk3288/rk808.c +++ b/src/soc/rockchip/rk3288/rk808.c @@ -22,12 +22,15 @@ #include <device/i2c.h> #include <stdint.h> #include <stdlib.h> +#include <delay.h> #include "rk808.h" #define RK808_ADDR 0x1b #define DCDC_EN 0x23 #define LDO_EN 0x24 +#define BUCK1SEL 0x2f +#define BUCK4SEL 0x38 #define LDO_ONSEL(i) (0x39 + 2 * i) #define LDO_SLPSEL(i) (0x3a + 2 * i) @@ -56,12 +59,12 @@ void rk808_configure_ldo(uint8_t bus, int ldo, int millivolts) case 4: case 5: case 8: - vsel = millivolts / 100 - 18; + vsel = div_round_up(millivolts, 100) - 18; break; case 3: case 6: case 7: - vsel = millivolts / 100 - 8; + vsel = div_round_up(millivolts, 100) - 8; break; default: die("Unknown LDO index!"); @@ -71,3 +74,29 @@ void rk808_configure_ldo(uint8_t bus, int ldo, int millivolts) rk808_clrsetbits(bus, LDO_ONSEL(ldo), 0x1f, vsel); rk808_clrsetbits(bus, LDO_EN, 0, 1 << (ldo - 1)); } + +void rk808_configure_buck(uint8_t bus, int buck, int millivolts) +{ + uint8_t vsel; + uint8_t buck_reg; + + switch (buck) { + case 1: + case 2: + /*base on 725mv, use 25mv step */ + vsel = (div_round_up(millivolts, 25) - 29) * 2 + 1; + assert(vsel <= 0x3f); + buck_reg = BUCK1SEL + 4 * (buck - 1); + break; + case 4: + vsel = div_round_up(millivolts, 100) - 18; + assert(vsel <= 0xf); + buck_reg = BUCK4SEL; + break; + default: + die("fault buck index!"); + } + rk808_clrsetbits(bus, buck_reg, 0x3f, vsel); + rk808_clrsetbits(bus, DCDC_EN, 0, 1 << (buck - 1)); + udelay(225);/* Must wait for voltage to stabilize */ +} |