2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2015-03-26 14:36:56 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) Marvell International Ltd. and its affiliates
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _DDR3_TRAINING_IP_FLOW_H_
|
|
|
|
#define _DDR3_TRAINING_IP_FLOW_H_
|
|
|
|
|
|
|
|
#include "ddr3_training_ip.h"
|
2018-12-03 01:26:49 +00:00
|
|
|
#include "ddr3_training_ip_db.h"
|
2021-05-03 20:48:53 +00:00
|
|
|
#include "mv_ddr_plat.h"
|
2015-03-26 14:36:56 +00:00
|
|
|
|
|
|
|
#define KILLER_PATTERN_LENGTH 32
|
|
|
|
#define EXT_ACCESS_BURST_LENGTH 8
|
|
|
|
|
2018-05-10 01:28:29 +00:00
|
|
|
#define ECC_READ_BUS_0 0
|
|
|
|
#define ECC_PHY_ACCESS_3 3
|
|
|
|
#define ECC_PHY_ACCESS_4 4
|
|
|
|
#define ECC_PHY_ACCESS_8 8
|
2015-03-26 14:36:56 +00:00
|
|
|
#define BUS_WIDTH_IN_BITS 8
|
2018-05-10 01:28:29 +00:00
|
|
|
#define MAX_POLLING_ITERATIONS 1000000
|
|
|
|
#define ADLL_LENGTH 32
|
|
|
|
|
|
|
|
#define GP_RSVD0_REG 0x182e0
|
2015-03-26 14:36:56 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* DFX address Space
|
|
|
|
* Table 2: DFX address space
|
|
|
|
* Address Bits Value Description
|
|
|
|
* [31 : 20] 0x? DFX base address bases PCIe mapping
|
|
|
|
* [19 : 15] 0...Number_of_client-1 Client Index inside pipe.
|
|
|
|
* See also Table 1 Multi_cast = 29 Broadcast = 28
|
|
|
|
* [14 : 13] 2'b01 Access to Client Internal Register
|
|
|
|
* [12 : 0] Client Internal Register offset See related Client Registers
|
|
|
|
* [14 : 13] 2'b00 Access to Ram Wrappers Internal Register
|
|
|
|
* [12 : 6] 0 Number_of_rams-1 Ram Index inside Client
|
|
|
|
* [5 : 0] Ram Wrapper Internal Register offset See related Ram Wrappers
|
|
|
|
* Registers
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* nsec */
|
2018-05-10 01:28:29 +00:00
|
|
|
#define AUTO_ZQC_TIMING 15384
|
|
|
|
|
|
|
|
enum mr_number {
|
|
|
|
MR_CMD0,
|
|
|
|
MR_CMD1,
|
|
|
|
MR_CMD2,
|
|
|
|
MR_CMD3,
|
|
|
|
MR_LAST
|
|
|
|
};
|
2015-03-26 14:36:56 +00:00
|
|
|
|
2018-05-10 01:28:29 +00:00
|
|
|
struct mv_ddr_mr_data {
|
|
|
|
u32 cmd;
|
|
|
|
u32 reg_addr;
|
|
|
|
};
|
2015-03-26 14:36:56 +00:00
|
|
|
|
|
|
|
struct write_supp_result {
|
|
|
|
enum hws_wl_supp stage;
|
|
|
|
int is_pup_fail;
|
|
|
|
};
|
|
|
|
|
|
|
|
int ddr3_tip_write_leveling_static_config(u32 dev_num, u32 if_id,
|
2018-12-03 01:26:49 +00:00
|
|
|
enum mv_ddr_freq frequency,
|
2015-03-26 14:36:56 +00:00
|
|
|
u32 *round_trip_delay_arr);
|
|
|
|
int ddr3_tip_read_leveling_static_config(u32 dev_num, u32 if_id,
|
2018-12-03 01:26:49 +00:00
|
|
|
enum mv_ddr_freq frequency,
|
2015-03-26 14:36:56 +00:00
|
|
|
u32 *total_round_trip_delay_arr);
|
|
|
|
int ddr3_tip_if_write(u32 dev_num, enum hws_access_type interface_access,
|
|
|
|
u32 if_id, u32 reg_addr, u32 data_value, u32 mask);
|
|
|
|
int ddr3_tip_if_polling(u32 dev_num, enum hws_access_type access_type,
|
|
|
|
u32 if_id, u32 exp_value, u32 mask, u32 offset,
|
|
|
|
u32 poll_tries);
|
|
|
|
int ddr3_tip_if_read(u32 dev_num, enum hws_access_type interface_access,
|
|
|
|
u32 if_id, u32 reg_addr, u32 *data, u32 mask);
|
|
|
|
int ddr3_tip_bus_read_modify_write(u32 dev_num,
|
|
|
|
enum hws_access_type access_type,
|
|
|
|
u32 if_id, u32 phy_id,
|
|
|
|
enum hws_ddr_phy phy_type,
|
|
|
|
u32 reg_addr, u32 data_value, u32 reg_mask);
|
|
|
|
int ddr3_tip_bus_read(u32 dev_num, u32 if_id, enum hws_access_type phy_access,
|
|
|
|
u32 phy_id, enum hws_ddr_phy phy_type, u32 reg_addr,
|
|
|
|
u32 *data);
|
|
|
|
int ddr3_tip_bus_write(u32 dev_num, enum hws_access_type e_interface_access,
|
|
|
|
u32 if_id, enum hws_access_type e_phy_access, u32 phy_id,
|
|
|
|
enum hws_ddr_phy e_phy_type, u32 reg_addr,
|
|
|
|
u32 data_value);
|
|
|
|
int ddr3_tip_freq_set(u32 dev_num, enum hws_access_type e_access, u32 if_id,
|
2018-12-03 01:26:49 +00:00
|
|
|
enum mv_ddr_freq memory_freq);
|
2015-03-26 14:36:56 +00:00
|
|
|
int ddr3_tip_adjust_dqs(u32 dev_num);
|
|
|
|
int ddr3_tip_init_controller(u32 dev_num);
|
|
|
|
int ddr3_tip_ext_read(u32 dev_num, u32 if_id, u32 reg_addr,
|
|
|
|
u32 num_of_bursts, u32 *addr);
|
|
|
|
int ddr3_tip_ext_write(u32 dev_num, u32 if_id, u32 reg_addr,
|
|
|
|
u32 num_of_bursts, u32 *addr);
|
|
|
|
int ddr3_tip_dynamic_read_leveling(u32 dev_num, u32 ui_freq);
|
2018-05-10 01:28:29 +00:00
|
|
|
int mv_ddr_rl_dqs_burst(u32 dev_num, u32 if_id, u32 freq);
|
2015-03-26 14:36:56 +00:00
|
|
|
int ddr3_tip_legacy_dynamic_read_leveling(u32 dev_num);
|
|
|
|
int ddr3_tip_dynamic_per_bit_read_leveling(u32 dev_num, u32 ui_freq);
|
|
|
|
int ddr3_tip_legacy_dynamic_write_leveling(u32 dev_num);
|
2018-05-10 01:28:29 +00:00
|
|
|
int ddr3_tip_dynamic_write_leveling(u32 dev_num, int phase_remove);
|
2015-03-26 14:36:56 +00:00
|
|
|
int ddr3_tip_dynamic_write_leveling_supp(u32 dev_num);
|
|
|
|
int ddr3_tip_static_init_controller(u32 dev_num);
|
|
|
|
int ddr3_tip_configure_phy(u32 dev_num);
|
|
|
|
int ddr3_tip_load_pattern_to_odpg(u32 dev_num, enum hws_access_type access_type,
|
|
|
|
u32 if_id, enum hws_pattern pattern,
|
|
|
|
u32 load_addr);
|
|
|
|
int ddr3_tip_load_pattern_to_mem(u32 dev_num, enum hws_pattern e_pattern);
|
|
|
|
int ddr3_tip_configure_odpg(u32 dev_num, enum hws_access_type access_type,
|
|
|
|
u32 if_id, enum hws_dir direction, u32 tx_phases,
|
|
|
|
u32 tx_burst_size, u32 rx_phases,
|
|
|
|
u32 delay_between_burst, u32 rd_mode, u32 cs_num,
|
|
|
|
u32 addr_stress_jump, u32 single_pattern);
|
2018-05-10 01:28:29 +00:00
|
|
|
int ddr3_tip_write_mrs_cmd(u32 dev_num, u32 *cs_mask_arr, enum mr_number mr_num, u32 data, u32 mask);
|
2015-03-26 14:36:56 +00:00
|
|
|
int ddr3_tip_write_cs_result(u32 dev_num, u32 offset);
|
|
|
|
int ddr3_tip_reset_fifo_ptr(u32 dev_num);
|
2021-05-03 20:48:53 +00:00
|
|
|
int ddr3_tip_read_adll_value(u32 dev_num,
|
|
|
|
u32 pup_values[MAX_INTERFACE_NUM * MAX_BUS_NUM],
|
|
|
|
u32 reg_addr, u32 mask);
|
|
|
|
int ddr3_tip_write_adll_value(u32 dev_num,
|
|
|
|
u32 pup_values[MAX_INTERFACE_NUM * MAX_BUS_NUM],
|
|
|
|
u32 reg_addr);
|
2018-12-03 01:26:49 +00:00
|
|
|
int ddr3_tip_tune_training_params(u32 dev_num, struct tune_train_params *params);
|
2015-03-26 14:36:56 +00:00
|
|
|
|
|
|
|
#endif /* _DDR3_TRAINING_IP_FLOW_H_ */
|