xpp: init_card_6_3: parallel calibration

FXS module type 6: Further reduces time of the initialization by writing
to several ports' chips in parallel.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
This commit is contained in:
Dima Stoliarov 2017-06-08 16:09:25 +03:00 committed by Tzafrir Cohen
parent 24648e6eb3
commit d9abf02894

View File

@ -907,32 +907,30 @@ sub load_general_params($) {
} }
} }
sub calibrate_slics($$$$) { sub calibrate_slics($$$) {
my $slic = shift;
my $cal0 = shift; my $cal0 = shift;
my $cal1 = shift; my $cal1 = shift;
my $cal2 = shift; my $cal2 = shift;
main::debug "Calibrating channel $slic"; main::debug "Calibrating channels @SlicNums";
write_reg($slic, 26, $cal0); # CAL0 write_reg('*', 26, $cal0); # CAL0
write_reg($slic, 27, $cal1); # CAL1 write_reg('*', 27, $cal1); # CAL1
write_reg($slic, 28, $cal2); # CAL2 write_reg('*', 28, $cal2); # CAL2
write_reg($slic, 29, 0x80); # CAL3, CAN_EN write_reg('*', 29, 0x80); # CAL3, CAL_EN
# wait until all slics have finished calibration, or for timeout # wait until all slics have finished calibration, or for timeout
# time periods in seconds: # time periods in seconds:
my $sleep_time = 0.001; my $sleep_time = 0.001;
my $timeout_time = 0.600; # Maximum from the spec my $timeout_time = 0.600; # Maximum from the spec
my @curr_slics; my @curr_slics = @SlicNums;
my $sleep_cnt = 0; my $sleep_cnt = 0;
push(@curr_slics, $slic);
CALIB_LOOP: CALIB_LOOP:
while(1) { while(1) {
main::mysleep($sleep_time); main::mysleep($sleep_time);
my @next_slics; my @next_slics;
for my $slic (@curr_slics) { for my $slic (@curr_slics) {
main::debug("checking slic $slic");
my $val = read_reg($slic, 29, 'D'); my $val = read_reg($slic, 29, 'D');
main::debug("checking slic $slic: $val.");
push(@next_slics, $slic) if ($val & 0x80) != 0; push(@next_slics, $slic) if ($val & 0x80) != 0;
} }
@curr_slics = @next_slics; @curr_slics = @next_slics;
@ -949,19 +947,25 @@ CALIB_LOOP:
} }
sub dc_powerup($) { sub dc_powerup($) {
my $slic = shift; my $slics_ref = shift;
FXS::set_user_mode($slic, 1); # Turn on user mode my @slics = @{ $slics_ref };
write_ram($slic, 1538, 0x700000, 3); # PD_DCDC, In case OV or UV previously occurred
# write_ram($slic, 1555, 0x100000, 3); # DCDC_CPUMP, Turn on charge pump foreach my $slic (@slics) {
FXS::set_user_mode($slic, 1); # Turn on user mode
}
write_ram('*', 1538, 0x700000, 3); # PD_DCDC, In case OV or UV previously occurred
# write_ram('*', 1555, 0x100000, 3); # DCDC_CPUMP, Turn on charge pump
main::mysleep(0.010); main::mysleep(0.010);
# write_ram($slic, 1538, 0x00600000, 3); # start up converter # write_ram('*', 1538, 0x00600000, 3); # start up converter
main::mysleep(0.500); main::mysleep(0.500);
write_ram($slic, 1555, 0x000000, 3); # DCDC_CPUMP, Turn off charge pump write_ram('*', 1555, 0x000000, 3); # DCDC_CPUMP, Turn off charge pump
write_ram($slic, 1542, 0x300000, 3); # PD_OCLO write_ram('*', 1542, 0x300000, 3); # PD_OCLO
write_ram($slic, 1551, 0x00000000, 3); # sClear DCDC status write_ram('*', 1551, 0x00000000, 3); # sClear DCDC status
main::mysleep(0.030); main::mysleep(0.030);
write_ram($slic, 1538, 0x00400000, 3); write_ram('*', 1538, 0x00400000, 3);
FXS::set_user_mode($slic, 0); # Turn off user mode foreach my $slic (@slics) {
FXS::set_user_mode($slic, 0); # Turn off user mode
}
} }
sub read_defaults() { sub read_defaults() {
@ -1130,21 +1134,15 @@ FXS::load_general_params(\@SlicNums);
if($settings{fxs_skip_calib}) { if($settings{fxs_skip_calib}) {
main::logit "==== WARNING: SKIPPED SLIC CALIBRATION ====="; main::logit "==== WARNING: SKIPPED SLIC CALIBRATION =====";
} else { } else {
foreach my $slic (@SlicNums) { FXS::calibrate_slics(0x00, 0x00, 0x01);
FXS::calibrate_slics($slic, 0x00, 0x00, 0x01);
}
main::mysleep(0.060); main::mysleep(0.060);
foreach my $slic (@SlicNums) { FXS::dc_powerup(\@SlicNums);
FXS::dc_powerup($slic); FXS::calibrate_slics(0x00, 0xC0, 0x18); # remaining cals (except mads, lb)
FXS::calibrate_slics($slic, 0x00, 0xC0, 0x18); # remaining cals (except mads, lb)
}
main::mysleep(0.700); main::mysleep(0.700);
foreach my $slic (@SlicNums) { foreach my $slic (@SlicNums) {
FXS::set_linefeed($slic, 0); FXS::set_linefeed($slic, 0);
FXS::set_linefeed($slic, 1); FXS::set_linefeed($slic, 1);
} }
main::mysleep(0.010);
#FXS::calibrate_slics($slic, 0x0F, 0x00, 0x00); #
main::mysleep(1.000); main::mysleep(1.000);
} }