Signed-off-by: Marek Vasut <marex@denx.de>
-static uint32_t rw_mgr_mem_calibrate_read_test_all_ranks(uint32_t group,
- uint32_t num_tries, uint32_t all_correct, uint32_t *bit_chk,
- uint32_t all_groups)
+/**
+ * rw_mgr_mem_calibrate_read_test_all_ranks() - Perform READ test on all ranks
+ * @grp: Read/Write group
+ * @num_tries: Number of retries of the test
+ * @all_correct: All bits must be correct in the mask
+ * @all_groups: Test all R/W groups
+ *
+ * Perform a READ test across all memory ranks.
+ */
+static int
+rw_mgr_mem_calibrate_read_test_all_ranks(const u32 grp, const u32 num_tries,
+ const u32 all_correct,
+ const u32 all_groups)
- return rw_mgr_mem_calibrate_read_test(0, group, num_tries, all_correct,
- bit_chk, all_groups, 1);
+ u32 bit_chk;
+ return rw_mgr_mem_calibrate_read_test(0, grp, num_tries, all_correct,
+ &bit_chk, all_groups, 1);
*/
static int find_vfifo_failing_read(const u32 grp)
{
*/
static int find_vfifo_failing_read(const u32 grp)
{
- u32 v, ret, bit_chk, fail_cnt = 0;
+ u32 v, ret, fail_cnt = 0;
for (v = 0; v < VFIFO_SIZE; v++) {
debug_cond(DLEVEL == 2, "%s:%d: vfifo %u\n",
__func__, __LINE__, v);
ret = rw_mgr_mem_calibrate_read_test_all_ranks(grp, 1,
for (v = 0; v < VFIFO_SIZE; v++) {
debug_cond(DLEVEL == 2, "%s:%d: vfifo %u\n",
__func__, __LINE__, v);
ret = rw_mgr_mem_calibrate_read_test_all_ranks(grp, 1,
- PASS_ONE_BIT, &bit_chk, 0);
u32 *work, const u32 work_inc, u32 *pd)
{
const u32 max = delay ? IO_DQS_EN_DELAY_MAX : IO_DQS_EN_PHASE_MAX;
u32 *work, const u32 work_inc, u32 *pd)
{
const u32 max = delay ? IO_DQS_EN_DELAY_MAX : IO_DQS_EN_PHASE_MAX;
for (; *pd <= max; (*pd)++) {
if (delay)
for (; *pd <= max; (*pd)++) {
if (delay)
scc_mgr_set_dqs_en_phase_all_ranks(grp, *pd);
ret = rw_mgr_mem_calibrate_read_test_all_ranks(grp, 1,
scc_mgr_set_dqs_en_phase_all_ranks(grp, *pd);
ret = rw_mgr_mem_calibrate_read_test_all_ranks(grp, 1,
- PASS_ONE_BIT, &bit_chk, 0);
if (!working)
ret = !ret;
if (!working)
ret = !ret;
*/
static void sdr_backup_phase(const u32 grp, u32 *work_bgn, u32 *p)
{
*/
static void sdr_backup_phase(const u32 grp, u32 *work_bgn, u32 *p)
{
- u32 tmp_delay, bit_chk, d;
int ret;
/* Special case code for backing up a phase */
int ret;
/* Special case code for backing up a phase */
scc_mgr_set_dqs_en_delay_all_ranks(grp, d);
ret = rw_mgr_mem_calibrate_read_test_all_ranks(grp, 1,
scc_mgr_set_dqs_en_delay_all_ranks(grp, d);
ret = rw_mgr_mem_calibrate_read_test_all_ranks(grp, 1,
- PASS_ONE_BIT, &bit_chk, 0);
if (ret) {
*work_bgn = tmp_delay;
break;
if (ret) {
*work_bgn = tmp_delay;
break;
static int sdr_find_window_center(const u32 grp, const u32 work_bgn,
const u32 work_end)
{
static int sdr_find_window_center(const u32 grp, const u32 work_bgn,
const u32 work_end)
{
int tmp_delay = 0;
int i, p, d;
int tmp_delay = 0;
int i, p, d;
debug_cond(DLEVEL == 2, "find_dqs_en_phase: center\n");
if (rw_mgr_mem_calibrate_read_test_all_ranks(grp, 1,
PASS_ONE_BIT,
debug_cond(DLEVEL == 2, "find_dqs_en_phase: center\n");
if (rw_mgr_mem_calibrate_read_test_all_ranks(grp, 1,
PASS_ONE_BIT,
debug_cond(DLEVEL == 2,
"%s:%d center: found: ptap=%u dtap=%u\n",
__func__, __LINE__, p, d);
debug_cond(DLEVEL == 2,
"%s:%d center: found: ptap=%u dtap=%u\n",
__func__, __LINE__, p, d);
static uint32_t rw_mgr_mem_calibrate_lfifo(void)
{
uint32_t found_one;
static uint32_t rw_mgr_mem_calibrate_lfifo(void)
{
uint32_t found_one;
debug("%s:%d\n", __func__, __LINE__);
debug("%s:%d\n", __func__, __LINE__);
if (!rw_mgr_mem_calibrate_read_test_all_ranks(0,
NUM_READ_TESTS,
PASS_ALL_BITS,
if (!rw_mgr_mem_calibrate_read_test_all_ranks(0,
NUM_READ_TESTS,
PASS_ALL_BITS,