[U-Boot] [PATCH v3 41/57] ram: rk3399: Simplify data training first argument

Kever Yang kever.yang at rock-chips.com
Tue Jul 16 13:17:41 UTC 2019


On 2019/7/16 下午7:57, Jagan Teki wrote:
> data training is using chan_info as first argument with
> channel number as second argument instead of that use
> dram_info as first argument so-that we can get the
> chan_info at data training definition.
>
> This was the argument handling is meaningful, readable
> and it would help to add similar data training for
> lpddr4 in future.
>
> Signed-off-by: Jagan Teki <jagan at amarulasolutions.com>

Reviewed-by: Kever Yang <Kever.yang at rock-chips.com>

Thanks,
  - Kever
> ---
>   drivers/ram/rockchip/sdram_rk3399.c | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c
> index e3f1abf7e7..1aaaeb5b88 100644
> --- a/drivers/ram/rockchip/sdram_rk3399.c
> +++ b/drivers/ram/rockchip/sdram_rk3399.c
> @@ -1286,10 +1286,11 @@ static int data_training_wdql(const struct chan_info *chan, u32 channel,
>   	return 0;
>   }
>   
> -static int data_training(const struct chan_info *chan, u32 channel,
> +static int data_training(struct dram_info *dram, u32 channel,
>   			 const struct rk3399_sdram_params *params,
>   			 u32 training_flag)
>   {
> +	struct chan_info *chan = &dram->chan[channel];
>   	u32 *denali_phy = chan->publ->denali_phy;
>   	int ret;
>   
> @@ -1498,8 +1499,7 @@ static int switch_to_phy_index1(struct dram_info *dram,
>   	for (channel = 0; channel < ch_count; channel++) {
>   		denali_phy = dram->chan[channel].publ->denali_phy;
>   		clrsetbits_le32(&denali_phy[896], (0x3 << 8) | 1, 1 << 8);
> -		ret = data_training(&dram->chan[channel], channel,
> -				    params, PI_FULL_TRAINING);
> +		ret = data_training(dram, channel, params, PI_FULL_TRAINING);
>   		if (ret < 0) {
>   			debug("index1 training failed\n");
>   			return ret;
> @@ -1662,8 +1662,7 @@ static int sdram_init(struct dram_info *dram,
>   			if (params->base.dramtype == LPDDR3)
>   				training_flag |= PI_CA_TRAINING;
>   
> -			if (!(data_training(&dram->chan[ch], ch,
> -					    params, training_flag)))
> +			if (!(data_training(dram, ch, params, training_flag)))
>   				break;
>   		}
>   		/* Computed rank with associated channel number */




More information about the U-Boot mailing list