u-boot/drivers/ram/rockchip
Thomas Hebb 95052b4b40 ram: rk3399: don't assume phy_io_config() uses real regs
In the RK3399 DRAM driver, the function set_ds_odt() supports operating
in two different modes, selected by the ctl_phy_reg argument: when true,
the function reads and writes directly from the DRAM registers, accessed
through "chan->pctl->denali_*"; when false, the function reads and
writes from an array, accessed through "params->pctl_regs.denali_*",
which is written to DRAM registers at a later time.

However, phy_config_io(), which is called by set_ds_odt() to do a subset
of its register operations, operates directly on DRAM registers at all
times. This means that it reads incorrect values (and writes new values
prematurely) when ctl_phy_reg in set_ds_odt() is false. Fix this by
passing in the address of the registers to work with.

This prevents an "Invalid DRV value" error in the SPL debug log and
(presumably) results in a more correct end state. See the following logs
from a RK3399 NanoPi M4 board (4GB LPDDR3):

Before:

  sdram_init() Starting SDRAM initialization...
  phy_io_config() Invalid DRV value.
  phy_io_config() Invalid DRV value.
  sdram_init() sdram_init: data trained for rank 2, ch 0
  phy_io_config() Invalid DRV value.
  phy_io_config() Invalid DRV value.
  sdram_init() sdram_init: data trained for rank 2, ch 1
  Channel 0: LPDDR3, 933MHz
  BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
  Channel 1: LPDDR3, 933MHz
  BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
  256B stride
  256B stride
  sdram_init() Finish SDRAM initialization...

After:

  sdram_init() Starting SDRAM initialization...
  sdram_init() sdram_init: data trained for rank 2, ch 0
  sdram_init() sdram_init: data trained for rank 2, ch 1
  Channel 0: LPDDR3, 933MHz
  BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
  Channel 1: LPDDR3, 933MHz
  BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
  256B stride
  256B stride
  sdram_init() Finish SDRAM initialization...

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2020-01-30 11:44:01 +08:00
..
dmc-rk3368.c common: Move hang() to the same header as panic() 2020-01-17 17:53:40 -05:00
Kconfig ram: rk3399: migrate to use common code 2019-11-17 16:23:56 +08:00
Makefile rockchip: rk3308: Add sdram driver 2019-11-17 17:22:53 +08:00
sdram-px30-ddr3-detect-333.inc ram: px30: add sdram driver 2019-11-17 16:23:56 +08:00
sdram-px30-ddr4-detect-333.inc ram: px30: add sdram driver 2019-11-17 16:23:56 +08:00
sdram-px30-ddr_skew.inc ram: px30: add sdram driver 2019-11-17 16:23:56 +08:00
sdram-px30-lpddr2-detect-333.inc ram: px30: add sdram driver 2019-11-17 16:23:56 +08:00
sdram-px30-lpddr3-detect-333.inc ram: px30: add sdram driver 2019-11-17 16:23:56 +08:00
sdram-rk3399-lpddr4-400.inc ram: rockchip: update lpddr4 timing for rk3399 2019-11-17 16:23:56 +08:00
sdram-rk3399-lpddr4-800.inc ram: rockchip: update lpddr4 timing for rk3399 2019-11-17 16:23:56 +08:00
sdram_common.c ram: rockchip: move sdram_debug function into sdram_common 2019-11-17 16:23:56 +08:00
sdram_pctl_px30.c ram: rockchip: add controller code for PX30 2019-11-17 16:23:56 +08:00
sdram_phy_px30.c ram: rockchip: add phy driver code for PX30 2019-11-17 16:23:56 +08:00
sdram_px30.c ram: px30: add sdram driver 2019-11-17 16:23:56 +08:00
sdram_rk322x.c ram: rockchip: rename sdram_common.c/h to sdram.c 2019-11-17 16:23:56 +08:00
sdram_rk3128.c ram: rockchip: rename sdram_common.c/h to sdram.c 2019-11-17 16:23:56 +08:00
sdram_rk3188.c common: Move hang() to the same header as panic() 2020-01-17 17:53:40 -05:00
sdram_rk3288.c common: Move hang() to the same header as panic() 2020-01-17 17:53:40 -05:00
sdram_rk3308.c rockchip: rk3308: Add sdram driver 2019-11-17 17:22:53 +08:00
sdram_rk3328.c ram: rk3328: use common sdram driver 2019-11-17 16:23:56 +08:00
sdram_rk3399.c ram: rk3399: don't assume phy_io_config() uses real regs 2020-01-30 11:44:01 +08:00