diff options
author | Derek Basehore <dbasehore@chromium.org> | 2016-06-23 14:24:36 -0700 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2016-07-15 00:36:57 +0200 |
commit | d570a5ada0015c9efeec2a1f4914bb5e36e7f3d8 (patch) | |
tree | 5c5a911874213a794ccc838c75469a3fbc001e73 /src | |
parent | 3030eaf55ee9acea7814be66346c521babfb7738 (diff) | |
download | coreboot-d570a5ada0015c9efeec2a1f4914bb5e36e7f3d8.tar.xz |
rockchip/rk3399: add/remove local variables to sdram_init
This adds two local variables for dramtype and ddr_freq to sdram_init
since those two values are commonly used in the function. It also
removes a variable that is just used once and directly uses the value
for a function call instead.
BRANCH=none
BUG=none
TEST=on kevin/gru, run "stressapptest -M 1024 -s 3600" and check that
it passes
Change-Id: I4e9dbc97803ff3300b52a5e1672e7e060af2cc85
Signed-off-by: Martin Roth <martinroth@chromium.org>
Original-Commit-Id: b7d1135c65298a73e6bf2a4a34b7c9b84f249ea8
Original-Change-Id: I4e1a1a4a8848d0eab07475a336c24bda90b2c9f8
Original-Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/355666
Original-Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://review.coreboot.org/15653
Tested-by: build bot (Jenkins)
Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/soc/rockchip/rk3399/sdram.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/soc/rockchip/rk3399/sdram.c b/src/soc/rockchip/rk3399/sdram.c index f56ac175ce..7fdb6e771e 100644 --- a/src/soc/rockchip/rk3399/sdram.c +++ b/src/soc/rockchip/rk3399/sdram.c @@ -1015,26 +1015,21 @@ static void dram_all_config(const struct rk3399_sdram_params *sdram_params) void sdram_init(const struct rk3399_sdram_params *sdram_params) { + unsigned char dramtype = sdram_params->dramtype; + unsigned int ddr_freq = sdram_params->ddr_freq; int channel; printk(BIOS_INFO, "Starting SDRAM initialization...\n"); - if ((sdram_params->dramtype == DDR3 - && sdram_params->ddr_freq > 800*MHz) || - (sdram_params->dramtype == LPDDR3 - && sdram_params->ddr_freq > 928*MHz) || - (sdram_params->dramtype == LPDDR4 - && sdram_params->ddr_freq > 800*MHz)) + if ((dramtype == DDR3 && ddr_freq > 800*MHz) || + (dramtype == LPDDR3 && ddr_freq > 928*MHz) || + (dramtype == LPDDR4 && ddr_freq > 800*MHz)) die("SDRAM frequency is to high!"); - rkclk_configure_ddr(sdram_params->ddr_freq); + rkclk_configure_ddr(ddr_freq); for (channel = 0; channel < 2; channel++) { - struct rk3399_ddr_publ_regs *ddr_publ_regs = - rk3399_ddr_publ[channel]; - - phy_dll_bypass_set(channel, ddr_publ_regs, - sdram_params->ddr_freq); + phy_dll_bypass_set(channel, rk3399_ddr_publ[channel], ddr_freq); if (channel >= sdram_params->num_channels) continue; @@ -1042,7 +1037,7 @@ void sdram_init(const struct rk3399_sdram_params *sdram_params) pctl_cfg(channel, sdram_params); /* LPDDR2/LPDDR3 need to wait DAI complete, max 10us */ - if (sdram_params->dramtype == LPDDR3) + if (dramtype == LPDDR3) udelay(10); if (data_training(channel, sdram_params, PI_FULL_TARINING)) |