Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zephyr Firmware
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kestrel Collaboration
Kestrel Firmware
Zephyr Firmware
Commits
4cf395d4
Commit
4cf395d4
authored
Mar 14, 2021
by
Evan Lojewski
Committed by
Raptor Engineering Development Team
Mar 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
i2c: Limit number of CPUs to max supported by firmware.
parent
1d87af65
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
18 deletions
+45
-18
main.c
main.c
+45
-18
No files found.
main.c
View file @
4cf395d4
...
...
@@ -103,13 +103,33 @@ typedef struct
{
int8_t
index
;
uint8_t
*
i2c_master
;
uint8_t
vdd_regulator_addr
;
uint8_t
vdn_regulator_addr
;
uint8_t
vdd_smbus_addr
;
uint8_t
vdn_smbus_addr
;
}
cpu_info_t
;
static
const
cpu_info_t
g_cpu_info
[]
=
{
{
.
index
=
0
,
.
i2c_master
=
(
uint8_t
*
)
I2CMASTER1_BASE
},
{
.
index
=
0
,
.
i2c_master
=
(
uint8_t
*
)
I2CMASTER1_BASE
,
.
vdd_regulator_addr
=
0x70
,
.
vdn_regulator_addr
=
0x73
,
.
vdd_smbus_addr
=
0x28
,
.
vdn_smbus_addr
=
0x2b
,
},
#ifdef I2CMASTER2_BASE
{
.
index
=
1
,
.
i2c_master
=
(
uint8_t
*
)
I2CMASTER2_BASE
},
{
.
index
=
1
,
.
i2c_master
=
(
uint8_t
*
)
I2CMASTER2_BASE
,
.
vdd_regulator_addr
=
0x70
,
.
vdn_regulator_addr
=
0x73
,
.
vdd_smbus_addr
=
0x28
,
.
vdn_smbus_addr
=
0x2b
,
},
#endif
};
#define MAX_CPUS_SUPPORTED (sizeof(g_cpu_info) / sizeof(g_cpu_info[0]))
void
primary_service_event_loop
(
void
);
...
...
@@ -1379,7 +1399,7 @@ static int apply_avsbus_workarounds_cpu(const cpu_info_t *cpu)
printf
(
"
\t
VDD/VCS %d: Enabling AVSBus CLK/MDAT pullups and selecting "
"VIH/VIL 0x2 (0.65V/0.55V)
\n
"
,
cpu
->
index
);
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
0x28
,
0x2e
,
0x23
))
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
cpu
->
vdd_smbus_addr
,
0x2e
,
0x23
))
{
return
-
1
;
}
...
...
@@ -1387,7 +1407,7 @@ static int apply_avsbus_workarounds_cpu(const cpu_info_t *cpu)
printf
(
"
\t
VDN %d: Enabling AVSBus CLK/MDAT pullups and selecting VIH/VIL "
"0x2 (0.65V/0.55V)
\n
"
,
cpu
->
index
);
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
0x2b
,
0x2e
,
0x23
))
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
cpu
->
vdn_smbus_addr
,
0x2e
,
0x23
))
{
return
-
1
;
}
...
...
@@ -1415,31 +1435,31 @@ 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
)
{
printf
(
"
\t
VDD %d: Placing device in AVSBus voltage command mode
\n
"
,
cpu
->
index
);
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
0x70
,
0x00
,
0x00
))
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
cpu
->
vdd_regulator_addr
,
0x00
,
0x00
))
{
return
-
1
;
}
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
0x70
,
0x01
,
0xb0
))
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
cpu
->
vdd_regulator_addr
,
0x01
,
0xb0
))
{
return
-
1
;
}
printf
(
"
\t
VCS %d: Placing device in AVSBus voltage command mode
\n
"
,
cpu
->
index
);
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
0x70
,
0x00
,
0x01
))
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
cpu
->
vdd_regulator_addr
,
0x00
,
0x01
))
{
return
-
1
;
}
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
0x70
,
0x01
,
0xb0
))
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
cpu
->
vdd_regulator_addr
,
0x01
,
0xb0
))
{
return
-
1
;
}
printf
(
"
\t
VDN %d: Placing device in AVSBus voltage command mode
\n
"
,
cpu
->
index
);
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
0x73
,
0x00
,
0x00
))
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
cpu
->
vdn_regulator_addr
,
0x00
,
0x00
))
{
return
-
1
;
}
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
0x73
,
0x01
,
0xb0
))
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
cpu
->
vdn_regulator_addr
,
0x01
,
0xb0
))
{
return
-
1
;
}
...
...
@@ -1467,31 +1487,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
)
{
printf
(
"
\t
VDD %d: Placing device in immediate off mode
\n
"
,
cpu
->
index
);
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
0x70
,
0x00
,
0x00
))
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
cpu
->
vdd_regulator_addr
,
0x00
,
0x00
))
{
return
-
1
;
}
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
0x70
,
0x01
,
0xb0
))
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
cpu
->
vdd_regulator_addr
,
0x01
,
0xb0
))
{
return
-
1
;
}
printf
(
"
\t
VCS %d: Placing device in immediate off mode
\n
"
,
cpu
->
index
);
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
0x70
,
0x00
,
0x01
))
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
cpu
->
vdd_regulator_addr
,
0x00
,
0x01
))
{
return
-
1
;
}
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
0x70
,
0x01
,
0xb0
))
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
cpu
->
vdd_regulator_addr
,
0x01
,
0xb0
))
{
return
-
1
;
}
printf
(
"
\t
VDN %d: Placing device in immediate off mode
\n
"
,
cpu
->
index
);
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
0x73
,
0x00
,
0x00
))
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
cpu
->
vdn_regulator_addr
,
0x00
,
0x00
))
{
return
-
1
;
}
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
0x73
,
0x01
,
0xb0
))
if
(
i2c_write_register_byte
(
cpu
->
i2c_master
,
cpu
->
vdn_regulator_addr
,
0x01
,
0xb0
))
{
return
-
1
;
}
...
...
@@ -1500,19 +1520,21 @@ static int disable_avsbus_pmbus_cpu(const cpu_info_t *cpu)
}
static
int
disable_avsbus_pmbus
(
const
cpu_info_t
*
cpu_info
,
int
cpu_count
)
{
int
status
=
0
;
printf
(
"Disabling AVSbus PMBUS functionality...
\n
"
);
while
(
--
cpu_count
)
{
// Attempt to turn of power on all CPUs, even if one isn't responding.
if
(
disable_avsbus_pmbus_cpu
(
&
cpu_info
[
0
]))
{
return
-
1
;
status
=
-
1
;
}
cpu_info
++
;
}
printf
(
"
\t
AVSBus PMBUS functionality disabled!
\n
"
);
return
0
;
return
status
;
}
static
void
power_off_chassis
(
void
)
...
...
@@ -1584,6 +1606,11 @@ static int power_on_chassis(void)
}
printf
(
"Chassis power verified active
\n
"
);
configured_cpu_count
=
cpu_count
;
if
(
cpu_count
>
MAX_CPUS_SUPPORTED
)
{
configured_cpu_count
=
cpu_count
=
MAX_CPUS_SUPPORTED
;
printf
(
"Limiting number of CPUs to %d
\n
"
,
MAX_CPUS_SUPPORTED
);
}
printf
(
"%d CPU(s) installed
\n
"
,
cpu_count
);
// Apply AVSBus workarounds
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment