Skip to content

Commit

Permalink
board: sama5: Fix failure to amend VDDANA
Browse files Browse the repository at this point in the history
Fix the failure to amend the VDDANA OUT voltage.

When amending the voltage of OUT2 to 1.25v, the TWI will return
"timeout to wait RXRDY bit"(its value was updated in fact.)
In case return after asserting the error, the subsequent OUT voltage
will not be amended.

Even if the error from one OUT setting operation, it should not
affect other, their voltage will continue to be amended.

Adjust the sequence, alway put the OUT2 to last one to operate.

Signed-off-by: Wenyou Yang <[email protected]>
  • Loading branch information
wenyouya committed Apr 18, 2017
1 parent 24d5904 commit e451e0b
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 70 deletions.
16 changes: 4 additions & 12 deletions board/sama5d2_ptc/sama5d2_ptc.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,37 +505,29 @@ int at91_board_act8865_set_reg_voltage(void)
reg = REG4_0;
value = ACT8865_2V5;
ret = act8865_set_reg_voltage(reg, value);
if (ret) {
if (ret)
dbg_loud("ACT8865: Failed to make REG4 output 2500mV\n");
return -1;
}

/* Enable REG5 output 3.3V */
reg = REG5_0;
value = ACT8865_3V3;
ret = act8865_set_reg_voltage(reg, value);
if (ret) {
if (ret)
dbg_loud("ACT8865: Failed to make REG5 output 3300mV\n");
return -1;
}

/* Enable REG6 output 2.5V */
reg = REG6_0;
value = ACT8865_2V5;
ret = act8865_set_reg_voltage(reg, value);
if (ret) {
if (ret)
dbg_loud("ACT8865: Failed to make REG6 output 2500mV\n");
return -1;
}

/* Enable REG7 output 1.8V */
reg = REG7_0;
value = ACT8865_1V8;
ret = act8865_set_reg_voltage(reg, value);
if (ret) {
if (ret)
dbg_loud("ACT8865: Failed to make REG7 output 1800mV\n");
return -1;
}

return 0;
}
Expand Down
34 changes: 12 additions & 22 deletions board/sama5d2_xplained/sama5d2_xplained.c
Original file line number Diff line number Diff line change
Expand Up @@ -896,51 +896,41 @@ int at91_board_act8865_set_reg_voltage(void)
if (act8865_check_i2c_disabled())
return 0;

/* Enable REG2 output 1.2V */
reg = REG2_1;
value = ACT8865_1V2;
ret = act8865_set_reg_voltage(reg, value);
if (ret) {
dbg_loud("ACT8865: Failed to make REG2 output 1200mV\n");
return -1;
}

/* Enable REG4 output 2.5V */
reg = REG4_0;
value = ACT8865_2V5;
ret = act8865_set_reg_voltage(reg, value);
if (ret) {
if (ret)
dbg_loud("ACT8865: Failed to make REG4 output 2500mV\n");
return -1;
}

/* Enable REG5 output 3.3V */
reg = REG5_0;
value = ACT8865_3V3;
ret = act8865_set_reg_voltage(reg, value);
if (ret) {
if (ret)
dbg_loud("ACT8865: Failed to make REG5 output 3300mV\n");
return -1;
}

/* Enable REG6 output 2.5V */
reg = REG6_0;
value = ACT8865_2V5;
ret = act8865_set_reg_voltage(reg, value);
if (ret) {
if (ret)
dbg_loud("ACT8865: Failed to make REG6 output 2500mV\n");
return -1;
}

/* Enable REG7 output 1.8V */
reg = REG7_0;
value = ACT8865_1V8;
ret = act8865_set_reg_voltage(reg, value);
if (ret) {
if (ret)
dbg_loud("ACT8865: Failed to make REG7 output 1800mV\n");
return -1;
}

/* Enable REG2 output 1.2V */
reg = REG2_1;
value = ACT8865_1V2;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG2 output 1200mV\n");

/* Enable REG4 output 2.5V */
return 0;
}
#endif
20 changes: 8 additions & 12 deletions board/sama5d3_xplained/sama5d3_xplained.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,23 +335,19 @@ int at91_board_act8865_set_reg_voltage(void)
if (act8865_check_i2c_disabled())
return 0;

/* Enable REG2 output 1.25V */
reg = REG2_0;
value = ACT8865_1V25;
ret = act8865_set_reg_voltage(reg, value);
if (ret) {
dbg_loud("ACT8865: Failed to make REG2 output 1250mV\n");
return -1;
}

/* Enable REG5 output 3.3V */
reg = REG5_0;
value = ACT8865_3V3;
ret = act8865_set_reg_voltage(reg, value);
if (ret) {
if (ret)
dbg_loud("ACT8865: Failed to make REG5 output 3300mV\n");
return -1;
}

/* Enable REG2 output 1.25V */
reg = REG2_0;
value = ACT8865_1V25;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG2 output 1250mV\n");

return 0;
}
Expand Down
20 changes: 8 additions & 12 deletions board/sama5d3x_cmp/sama5d3x_cmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,23 +449,19 @@ int at91_board_act8865_set_reg_voltage(void)
if (act8865_check_i2c_disabled())
return 0;

/* Enable REG2 output 1.25V */
reg = REG2_0;
value = ACT8865_1V25;
ret = act8865_set_reg_voltage(reg, value);
if (ret) {
dbg_loud("ACT8865: Failed to make REG2 output 1250mV\n");
return -1;
}

/* Enable REG4(VDDANA) output 3.3V */
reg = REG4_0;
value = ACT8865_3V3;
ret = act8865_set_reg_voltage(reg, value);
if (ret) {
if (ret)
dbg_loud("ACT8865: Failed to make REG4 output 3300mV\n");
return -1;
}

/* Enable REG2 output 1.25V */
reg = REG2_0;
value = ACT8865_1V25;
ret = act8865_set_reg_voltage(reg, value);
if (ret)
dbg_loud("ACT8865: Failed to make REG2 output 1250mV\n");

return 0;
}
Expand Down
8 changes: 2 additions & 6 deletions board/sama5d4_xplained/sama5d4_xplained.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,19 +543,15 @@ int at91_board_act8865_set_reg_voltage(void)
reg = REG5_0;
value = ACT8865_3V3;
ret = act8865_set_reg_voltage(reg, value);
if (ret) {
if (ret)
dbg_loud("ACT8865: Failed to make REG5 output 3300mV\n");
return -1;
}

/* Enable REG6 output 1.8V */
reg = REG6_0;
value = ACT8865_1V8;
ret = act8865_set_reg_voltage(reg, value);
if (ret) {
if (ret)
dbg_loud("ACT8865: Failed to make REG6 output 1800mV\n");
return -1;
}

return 0;
}
Expand Down
8 changes: 2 additions & 6 deletions board/sama5d4ek/sama5d4ek.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,19 +554,15 @@ int at91_board_act8865_set_reg_voltage(void)
reg = REG5_0;
value = ACT8865_3V3;
ret = act8865_set_reg_voltage(reg, value);
if (ret) {
if (ret)
dbg_loud("ACT8865: Failed to make REG5 output 3300mV\n");
return -1;
}

/* Enable REG6 output 1.8V */
reg = REG6_0;
value = ACT8865_1V8;
ret = act8865_set_reg_voltage(reg, value);
if (ret) {
if (ret)
dbg_loud("ACT8865: Failed to make REG6 output 1800mV\n");
return -1;
}

return 0;
}
Expand Down

0 comments on commit e451e0b

Please sign in to comment.