[coreboot-gerrit] New patch to review for coreboot: rockchip/rk3399: add/remove local variables to sdram_init
Martin Roth (martinroth@google.com)
gerrit at coreboot.org
Thu Jul 14 00:25:05 CEST 2016
Martin Roth (martinroth at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15653
-gerrit
commit aa1a30308186d456b2f2e766205b290d84cc8026
Author: Derek Basehore <dbasehore at chromium.org>
Date: Thu Jun 23 14:24:36 2016 -0700
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 at chromium.org>
Original-Commit-Id: b7d1135c65298a73e6bf2a4a34b7c9b84f249ea8
Original-Change-Id: I4e1a1a4a8848d0eab07475a336c24bda90b2c9f8
Original-Signed-off-by: Derek Basehore <dbasehore at chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/355666
Original-Reviewed-by: Duncan Laurie <dlaurie at chromium.org>
---
src/soc/rockchip/rk3399/sdram.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/src/soc/rockchip/rk3399/sdram.c b/src/soc/rockchip/rk3399/sdram.c
index f56ac17..7fdb6e7 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))
More information about the coreboot-gerrit
mailing list