Implement Silicom card features #1

Merged
DataHoarder merged 12 commits from implement-silicom-card into master 2021-10-28 05:16:53 +00:00
2 changed files with 8 additions and 11 deletions
Showing only changes of commit 2568379d1c - Show all commits

View file

@ -129,7 +129,7 @@ static fm_status I2cWriteRead(fm_int sw,
status = switchPtr->WriteUINT32(sw, FM10000_I2C_DATA(i), regValue); status = switchPtr->WriteUINT32(sw, FM10000_I2C_DATA(i), regValue);
FM_LOG_EXIT_ON_ERR(FM_LOG_CAT_SWITCH, status); FM_LOG_EXIT_ON_ERR(FM_LOG_CAT_SWITCH, status);
FM_LOG_DEBUG_VERBOSE(FM_LOG_CAT_SWITCH, "WRITEDATA#%d : 0x%08x\n",i, regValue); FM_LOG_DEBUG_VERBOSE(FM_LOG_CAT_SWITCH, "WRITEDATA#%d : 0x%08x\n",i, regValue);
} }
regValue = 0; regValue = 0;

View file

@ -5441,6 +5441,7 @@ fm_status fmPlatformLibSetVrmVoltage(fm_int sw,
fm_i2cCfg * i2c; fm_i2cCfg * i2c;
fm_hwResId * hwResId; fm_hwResId * hwResId;
fm_vrmI2C * vrmI2c; fm_vrmI2C * vrmI2c;
uint voltageCalc;
fm_byte data[4]; fm_byte data[4];
fm_uint channel; fm_uint channel;
fm_uint regVidSet; fm_uint regVidSet;
@ -5690,30 +5691,26 @@ fm_status fmPlatformLibSetVrmVoltage(fm_int sw,
else if (hwResId->vrm.model && (hwResId->vrm.model == VRM_IR)) else if (hwResId->vrm.model && (hwResId->vrm.model == VRM_IR))
{ {
printf("vrm mVolt %d delta %d\n", mVolt, hwResId->vrm.delta); printf("vrm mVolt %d delta %d\n", mVolt, hwResId->vrm.delta);
uint voltageCalc = (mVolt + hwResId->vrm.delta) / 5 - 49; voltageCalc = (mVolt + hwResId->vrm.delta) / 5 - 49;
data[1] = voltageCalc; data[1] = voltageCalc;
printf("vrm channel %d data 0x%x\n", channel, voltageCalc); printf("vrm channel %d data 0x%x\n", channel, voltageCalc);
fflush(stdout); fflush(stdout);
if(channel == 0){ if(status == 0){
data[0] = 0x26; data[0] = 0x26;
} else if (channel == 1){ } else if (channel == 1){
data[0] = 0x27; data[0] = 0x27;
} }
for(uint i = 0; i < 0x32; ++i){ for(uint i = 0; i < 50; ++i){
status = i2c->writeReadFunc(i2c->handle, vrmI2c->addr, data, 2, 0); status = i2c->writeReadFunc(i2c->handle, vrmI2c->addr, data, 2, 0);
if(status == FM_OK){ if(status == FM_OK){
i2c->writeReadFunc(i2c->handle, vrmI2c->addr, data, 0, 1);
break; break;
} }
fmDelayBy(1, 0);
fmDelay(0, 1);
}
if(status != FM_OK){
i2c->writeReadFunc(i2c->handle, vrmI2c->addr, data, 0, 1);
FM_LOG_ABORT_ON_ERR(FM_LOG_CAT_PLATFORM, status);
} }
i2c->writeReadFunc(i2c->handle, vrmI2c->addr, data, 0, 1);
FM_LOG_ABORT_ON_ERR(FM_LOG_CAT_PLATFORM, status);
} }
else else
{ {