The search_stop_check() always resets the bit_chk to a new value,
so bit_chk will never survive between search_left_edge() and
search_right_edge() invocation. There is thus no need to pass
it into these functions, so make bit_chk local to them.
Signed-off-by: Marek Vasut <marex@denx.de>
* @write_group: Write Group
* @read_group: Read Group
* @test_bgn: Rank number to begin the test
* @write_group: Write Group
* @read_group: Read Group
* @test_bgn: Rank number to begin the test
- * @bit_chk: Resulting bit mask after the test
* @sticky_bit_chk: Resulting sticky bit mask after the test
* @left_edge: Left edge of the DQ/DQS phase
* @right_edge: Right edge of the DQ/DQS phase
* @sticky_bit_chk: Resulting sticky bit mask after the test
* @left_edge: Left edge of the DQ/DQS phase
* @right_edge: Right edge of the DQ/DQS phase
*/
static void search_left_edge(const int write, const int rank_bgn,
const u32 write_group, const u32 read_group, const u32 test_bgn,
*/
static void search_left_edge(const int write, const int rank_bgn,
const u32 write_group, const u32 read_group, const u32 test_bgn,
- u32 *bit_chk, u32 *sticky_bit_chk,
int *left_edge, int *right_edge, const u32 use_read_test)
{
const u32 delay_max = write ? IO_IO_OUT1_DELAY_MAX : IO_IO_IN_DELAY_MAX;
const u32 dqs_max = write ? IO_IO_OUT1_DELAY_MAX : IO_DQS_IN_DELAY_MAX;
const u32 per_dqs = write ? RW_MGR_MEM_DQ_PER_WRITE_DQS :
RW_MGR_MEM_DQ_PER_READ_DQS;
int *left_edge, int *right_edge, const u32 use_read_test)
{
const u32 delay_max = write ? IO_IO_OUT1_DELAY_MAX : IO_IO_IN_DELAY_MAX;
const u32 dqs_max = write ? IO_IO_OUT1_DELAY_MAX : IO_DQS_IN_DELAY_MAX;
const u32 per_dqs = write ? RW_MGR_MEM_DQ_PER_WRITE_DQS :
RW_MGR_MEM_DQ_PER_READ_DQS;
int i, d;
for (d = 0; d <= dqs_max; d++) {
int i, d;
for (d = 0; d <= dqs_max; d++) {
writel(0, &sdr_scc_mgr->update);
stop = search_stop_check(write, d, rank_bgn, write_group,
writel(0, &sdr_scc_mgr->update);
stop = search_stop_check(write, d, rank_bgn, write_group,
- read_group, bit_chk, sticky_bit_chk,
+ read_group, &bit_chk, sticky_bit_chk,
use_read_test);
if (stop == 1)
break;
/* stop != 1 */
for (i = 0; i < per_dqs; i++) {
use_read_test);
if (stop == 1)
break;
/* stop != 1 */
for (i = 0; i < per_dqs; i++) {
/*
* Remember a passing test as
* the left_edge.
/*
* Remember a passing test as
* the left_edge.
if (left_edge[i] == delay_max + 1)
right_edge[i] = -(d + 1);
}
if (left_edge[i] == delay_max + 1)
right_edge[i] = -(d + 1);
}
- *bit_chk = *bit_chk >> 1;
* @read_group: Read Group
* @start_dqs: DQS start phase
* @start_dqs_en: DQS enable start phase
* @read_group: Read Group
* @start_dqs: DQS start phase
* @start_dqs_en: DQS enable start phase
- * @bit_chk: Resulting bit mask after the test
* @sticky_bit_chk: Resulting sticky bit mask after the test
* @left_edge: Left edge of the DQ/DQS phase
* @right_edge: Right edge of the DQ/DQS phase
* @sticky_bit_chk: Resulting sticky bit mask after the test
* @left_edge: Left edge of the DQ/DQS phase
* @right_edge: Right edge of the DQ/DQS phase
static int search_right_edge(const int write, const int rank_bgn,
const u32 write_group, const u32 read_group,
const int start_dqs, const int start_dqs_en,
static int search_right_edge(const int write, const int rank_bgn,
const u32 write_group, const u32 read_group,
const int start_dqs, const int start_dqs_en,
- u32 *bit_chk, u32 *sticky_bit_chk,
int *left_edge, int *right_edge, const u32 use_read_test)
{
const u32 delay_max = write ? IO_IO_OUT1_DELAY_MAX : IO_IO_IN_DELAY_MAX;
const u32 dqs_max = write ? IO_IO_OUT1_DELAY_MAX : IO_DQS_IN_DELAY_MAX;
const u32 per_dqs = write ? RW_MGR_MEM_DQ_PER_WRITE_DQS :
RW_MGR_MEM_DQ_PER_READ_DQS;
int *left_edge, int *right_edge, const u32 use_read_test)
{
const u32 delay_max = write ? IO_IO_OUT1_DELAY_MAX : IO_IO_IN_DELAY_MAX;
const u32 dqs_max = write ? IO_IO_OUT1_DELAY_MAX : IO_DQS_IN_DELAY_MAX;
const u32 per_dqs = write ? RW_MGR_MEM_DQ_PER_WRITE_DQS :
RW_MGR_MEM_DQ_PER_READ_DQS;
int i, d;
for (d = 0; d <= dqs_max - start_dqs; d++) {
int i, d;
for (d = 0; d <= dqs_max - start_dqs; d++) {
writel(0, &sdr_scc_mgr->update);
stop = search_stop_check(write, d, rank_bgn, write_group,
writel(0, &sdr_scc_mgr->update);
stop = search_stop_check(write, d, rank_bgn, write_group,
- read_group, bit_chk, sticky_bit_chk,
+ read_group, &bit_chk, sticky_bit_chk,
use_read_test);
if (stop == 1) {
if (write && (d == 0)) { /* WRITE-ONLY */
use_read_test);
if (stop == 1) {
if (write && (d == 0)) { /* WRITE-ONLY */
/* stop != 1 */
for (i = 0; i < per_dqs; i++) {
/* stop != 1 */
for (i = 0; i < per_dqs; i++) {
/*
* Remember a passing test as
* the right_edge.
/*
* Remember a passing test as
* the right_edge.
__func__, __LINE__, d);
debug_cond(DLEVEL == 2,
"bit_chk_test=%i left_edge[%u]: %d ",
__func__, __LINE__, d);
debug_cond(DLEVEL == 2,
"bit_chk_test=%i left_edge[%u]: %d ",
- *bit_chk & 1, i, left_edge[i]);
+ bit_chk & 1, i, left_edge[i]);
debug_cond(DLEVEL == 2, "right_edge[%u]: %d\n", i,
right_edge[i]);
debug_cond(DLEVEL == 2, "right_edge[%u]: %d\n", i,
right_edge[i]);
- *bit_chk = *bit_chk >> 1;
* Store these as signed since there are comparisons with
* signed numbers.
*/
* Store these as signed since there are comparisons with
* signed numbers.
*/
uint32_t sticky_bit_chk;
int32_t left_edge[RW_MGR_MEM_DQ_PER_READ_DQS];
int32_t right_edge[RW_MGR_MEM_DQ_PER_READ_DQS];
uint32_t sticky_bit_chk;
int32_t left_edge[RW_MGR_MEM_DQ_PER_READ_DQS];
int32_t right_edge[RW_MGR_MEM_DQ_PER_READ_DQS];
/* Search for the left edge of the window for each bit */
search_left_edge(0, rank_bgn, write_group, read_group, test_bgn,
/* Search for the left edge of the window for each bit */
search_left_edge(0, rank_bgn, write_group, read_group, test_bgn,
- &bit_chk, &sticky_bit_chk,
left_edge, right_edge, use_read_test);
/* Search for the right edge of the window for each bit */
ret = search_right_edge(0, rank_bgn, write_group, read_group,
start_dqs, start_dqs_en,
left_edge, right_edge, use_read_test);
/* Search for the right edge of the window for each bit */
ret = search_right_edge(0, rank_bgn, write_group, read_group,
start_dqs, start_dqs_en,
- &bit_chk, &sticky_bit_chk,
left_edge, right_edge, use_read_test);
if (ret) {
/*
left_edge, right_edge, use_read_test);
if (ret) {
/*
/* Search for the left edge of the window for each bit */
search_left_edge(1, rank_bgn, write_group, 0, test_bgn,
/* Search for the left edge of the window for each bit */
search_left_edge(1, rank_bgn, write_group, 0, test_bgn,
- &bit_chk, &sticky_bit_chk,
left_edge, right_edge, 0);
/* Search for the right edge of the window for each bit */
ret = search_right_edge(1, rank_bgn, write_group, 0,
start_dqs, 0,
left_edge, right_edge, 0);
/* Search for the right edge of the window for each bit */
ret = search_right_edge(1, rank_bgn, write_group, 0,
start_dqs, 0,
- &bit_chk, &sticky_bit_chk,
left_edge, right_edge, 0);
if (ret) {
set_failing_group_stage(test_bgn + ret - 1, CAL_STAGE_WRITES,
left_edge, right_edge, 0);
if (ret) {
set_failing_group_stage(test_bgn + ret - 1, CAL_STAGE_WRITES,