From: Chris Zhong <zyw@rock-chips.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] rockchip: rk3288: correct sdram setting
Date: Tue, 8 Mar 2016 08:48:18 +0800 [thread overview]
Message-ID: <56DE2152.909@rock-chips.com> (raw)
In-Reply-To: <CAPnjgZ1SUg=WaAFWn+bfmeB2SkVFNwjDGO58FgdVhbXwEJj09g@mail.gmail.com>
On 2016?03?08? 02:30, Simon Glass wrote:
> Hi Chris,
>
> On 6 March 2016 at 23:51, Chris Zhong <zyw@rock-chips.com> wrote:
>> The DMC driver in v3.14 kernel[0] get the ddr setting from PMU_SYS_REG2,
>> and it expects uboot to store the value using a same protocol. But now
>> the ddr setting value is different with DMC, so if you enable the DMC,
>> system would crash in kernel. Correct the sdram setting here, according
>> to the requirements of kernel.
>>
>> [0]
>> https://chromium.googlesource.com/chromiumos/third_party/kernel/+/
>> chromeos-3.14/drivers/clk/rockchip/clk-rk3288-dmc.c
>>
>> Signed-off-by: Chris Zhong <zyw@rock-chips.com>
>> ---
>>
>> Changes in v2:
>> Modified into a more readable code style(Simon Glass)
>>
>> arch/arm/mach-rockchip/rk3288/sdram_rk3288.c | 14 +++++++-------
>> 1 file changed, 7 insertions(+), 7 deletions(-)
> Acked-by: Simon Glass <sjg@chromium.org>
>
> Longer term, might it be possible to write this info into the device
> tree and pass it to Linux that way?
Yes, agree, that would be better. At least not need so many complicated
calculations.
>
>> diff --git a/arch/arm/mach-rockchip/rk3288/sdram_rk3288.c b/arch/arm/mach-rockchip/rk3288/sdram_rk3288.c
>> index e9e2211..17daeca 100644
>> --- a/arch/arm/mach-rockchip/rk3288/sdram_rk3288.c
>> +++ b/arch/arm/mach-rockchip/rk3288/sdram_rk3288.c
>> @@ -561,14 +561,14 @@ static void dram_all_config(const struct dram_info *dram,
>> &sdram_params->ch[chan];
>>
>> sys_reg |= info->row_3_4 << SYS_REG_ROW_3_4_SHIFT(chan);
>> - sys_reg |= chan << SYS_REG_CHINFO_SHIFT(chan);
>> + sys_reg |= 1 << SYS_REG_CHINFO_SHIFT(chan);
>> sys_reg |= (info->rank - 1) << SYS_REG_RANK_SHIFT(chan);
>> sys_reg |= (info->col - 9) << SYS_REG_COL_SHIFT(chan);
>> - sys_reg |= info->bk == 3 ? 1 << SYS_REG_BK_SHIFT(chan) : 0;
>> + sys_reg |= info->bk == 3 ? 0 : 1 << SYS_REG_BK_SHIFT(chan);
>> sys_reg |= (info->cs0_row - 13) << SYS_REG_CS0_ROW_SHIFT(chan);
>> sys_reg |= (info->cs1_row - 13) << SYS_REG_CS1_ROW_SHIFT(chan);
>> - sys_reg |= info->bw << SYS_REG_BW_SHIFT(chan);
>> - sys_reg |= info->dbw << SYS_REG_DBW_SHIFT(chan);
>> + sys_reg |= (2 >> info->bw) << SYS_REG_BW_SHIFT(chan);
>> + sys_reg |= (2 >>info->dbw) << SYS_REG_DBW_SHIFT(chan);
>>
>> dram_cfg_rbc(&dram->chan[chan], chan, sdram_params);
>> }
>> @@ -720,13 +720,13 @@ size_t sdram_size_mb(struct rk3288_pmu *pmu)
>> rank = 1 + (sys_reg >> SYS_REG_RANK_SHIFT(ch) &
>> SYS_REG_RANK_MASK);
>> col = 9 + (sys_reg >> SYS_REG_COL_SHIFT(ch) & SYS_REG_COL_MASK);
>> - bk = sys_reg & (1 << SYS_REG_BK_SHIFT(ch)) ? 3 : 0;
>> + bk = 3 - ((sys_reg >> SYS_REG_BK_SHIFT(ch)) & SYS_REG_BK_MASK) ;
>> cs0_row = 13 + (sys_reg >> SYS_REG_CS0_ROW_SHIFT(ch) &
>> SYS_REG_CS0_ROW_MASK);
>> cs1_row = 13 + (sys_reg >> SYS_REG_CS1_ROW_SHIFT(ch) &
>> SYS_REG_CS1_ROW_MASK);
>> - bw = (sys_reg >> SYS_REG_BW_SHIFT(ch)) &
>> - SYS_REG_BW_MASK;
>> + bw = (2 >> (sys_reg >> SYS_REG_BW_SHIFT(ch)) &
>> + SYS_REG_BW_MASK);
>> row_3_4 = sys_reg >> SYS_REG_ROW_3_4_SHIFT(ch) &
>> SYS_REG_ROW_3_4_MASK;
>>
>> --
>> 1.9.1
>>
> Regards,
> Simon
>
>
>
next prev parent reply other threads:[~2016-03-08 0:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-29 12:16 [U-Boot] [PATCH] rockchip: rk3288: correct sdram setting Chris Zhong
2016-03-01 2:04 ` Simon Glass
2016-03-01 2:29 ` Chris Zhong
2016-03-07 2:39 ` Simon Glass
2016-03-07 2:57 ` Chris Zhong
2016-03-07 6:51 ` [U-Boot] [PATCH v2] " Chris Zhong
2016-03-07 18:30 ` Simon Glass
2016-03-08 0:48 ` Chris Zhong [this message]
2016-03-10 15:20 ` Simon Glass
2016-03-10 15:40 ` Simon Glass
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=56DE2152.909@rock-chips.com \
--to=zyw@rock-chips.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.