Fix incorrect AVSBus disable commands

Rework CPU regulator data structures for additional
clarity on configuration.
parent 8d91662d
......@@ -166,7 +166,11 @@ typedef struct
uint8_t *i2c_master;
uint32_t i2c_frequency;
uint8_t vdd_regulator_addr;
uint8_t vdd_regulator_page;
uint8_t vcs_regulator_addr;
uint8_t vcs_regulator_page;
uint8_t vdn_regulator_addr;
uint8_t vdn_regulator_page;
uint8_t vdd_smbus_addr;
uint8_t vdn_smbus_addr;
} cpu_info_t;
......@@ -176,7 +180,11 @@ static const cpu_info_t g_cpu_info[] = {
.i2c_master = (uint8_t *)I2CMASTER1_BASE,
.i2c_frequency = 100000,
.vdd_regulator_addr = 0x70,
.vdd_regulator_page = 0x00,
.vcs_regulator_addr = 0x70,
.vcs_regulator_page = 0x01,
.vdn_regulator_addr = 0x73,
.vdn_regulator_page = 0x00,
.vdd_smbus_addr = 0x28,
.vdn_smbus_addr = 0x2b,
......@@ -187,7 +195,12 @@ static const cpu_info_t g_cpu_info[] = {
.i2c_master = (uint8_t *)I2CMASTER2_BASE,
.i2c_frequency = 100000,
.vdd_regulator_addr = 0x70,
.vdd_regulator_page = 0x00,
.vcs_regulator_addr = 0x70,
.vcs_regulator_addr = 0x70,
.vcs_regulator_page = 0x01,
.vdn_regulator_addr = 0x73,
.vdn_regulator_page = 0x00,
.vdd_smbus_addr = 0x28,
.vdn_smbus_addr = 0x2b,
},
......@@ -2089,7 +2102,7 @@ static int apply_avsbus_workarounds(const cpu_info_t *cpu_info, int cpu_count)
static int enable_avsbus_pmbus_cpu(const cpu_info_t *cpu)
{
KESTREL_LOG("\tVDD %d: Placing device in AVSBus voltage command mode", cpu->index);
if (i2c_write_register_byte(cpu->i2c_master, cpu->vdd_regulator_addr, 0x00, 0x00))
if (i2c_write_register_byte(cpu->i2c_master, cpu->vdd_regulator_addr, 0x00, cpu->vdd_regulator_page))
{
return -1;
}
......@@ -2099,17 +2112,17 @@ static int enable_avsbus_pmbus_cpu(const cpu_info_t *cpu)
}
KESTREL_LOG("\tVCS %d: Placing device in AVSBus voltage command mode", cpu->index);
if (i2c_write_register_byte(cpu->i2c_master, cpu->vdd_regulator_addr, 0x00, 0x01))
if (i2c_write_register_byte(cpu->i2c_master, cpu->vcs_regulator_addr, 0x00, cpu->vcs_regulator_page))
{
return -1;
}
if (i2c_write_register_byte(cpu->i2c_master, cpu->vdd_regulator_addr, 0x01, 0xb0))
if (i2c_write_register_byte(cpu->i2c_master, cpu->vcs_regulator_addr, 0x01, 0xb0))
{
return -1;
}
KESTREL_LOG("\tVDN %d: Placing device in AVSBus voltage command mode", cpu->index);
if (i2c_write_register_byte(cpu->i2c_master, cpu->vdn_regulator_addr, 0x00, 0x00))
if (i2c_write_register_byte(cpu->i2c_master, cpu->vdn_regulator_addr, 0x00, cpu->vdn_regulator_page))
{
return -1;
}
......@@ -2140,31 +2153,31 @@ static int enable_avsbus_pmbus(const cpu_info_t *cpu_info, int cpu_count)
static int disable_avsbus_pmbus_cpu(const cpu_info_t *cpu)
{
KESTREL_LOG("\tVDD %d: Placing device in immediate off mode", cpu->index);
if (i2c_write_register_byte(cpu->i2c_master, cpu->vdd_regulator_addr, 0x00, 0x00))
if (i2c_write_register_byte(cpu->i2c_master, cpu->vdd_regulator_addr, 0x00, cpu->vdd_regulator_page))
{
return -1;
}
if (i2c_write_register_byte(cpu->i2c_master, cpu->vdd_regulator_addr, 0x01, 0xb0))
if (i2c_write_register_byte(cpu->i2c_master, cpu->vdd_regulator_addr, 0x01, 0x80))
{
return -1;
}
KESTREL_LOG("\tVCS %d: Placing device in immediate off mode", cpu->index);
if (i2c_write_register_byte(cpu->i2c_master, cpu->vdd_regulator_addr, 0x00, 0x01))
if (i2c_write_register_byte(cpu->i2c_master, cpu->vcs_regulator_addr, 0x00, cpu->vcs_regulator_page))
{
return -1;
}
if (i2c_write_register_byte(cpu->i2c_master, cpu->vdd_regulator_addr, 0x01, 0xb0))
if (i2c_write_register_byte(cpu->i2c_master, cpu->vcs_regulator_addr, 0x01, 0x80))
{
return -1;
}
KESTREL_LOG("\tVDN %d: Placing device in immediate off mode", cpu->index);
if (i2c_write_register_byte(cpu->i2c_master, cpu->vdn_regulator_addr, 0x00, 0x00))
if (i2c_write_register_byte(cpu->i2c_master, cpu->vdn_regulator_addr, 0x00, cpu->vdn_regulator_page))
{
return -1;
}
if (i2c_write_register_byte(cpu->i2c_master, cpu->vdn_regulator_addr, 0x01, 0xb0))
if (i2c_write_register_byte(cpu->i2c_master, cpu->vdn_regulator_addr, 0x01, 0x80))
{
return -1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment