mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
Here is an alternate approach to getting rid of the static in cs5536
smbus. Set up a global var variable called spd_inited. It is set when spd is inited. For simple cases, nothing is visible to initram main. For complex cases, initram main can do the work and set this variable. This compiles and runs on dbe62, which is actually meaningless since dbe62 has not smbus, but hey ... Signed-off-by: Ronald G. Minnich <rminnich@gmail.com> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> git-svn-id: svn://coreboot.org/repository/coreboot-v3@863 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
parent
74e0a0a268
commit
5a74d7889b
2 changed files with 5 additions and 3 deletions
|
@ -53,6 +53,8 @@ struct global_vars {
|
|||
/* these two values are of interest in many stages */
|
||||
u32 init_detected;
|
||||
struct sys_info sys_info;
|
||||
/* has the spd hardware been set up? */
|
||||
int spd_inited;
|
||||
};
|
||||
|
||||
#endif /* GLOBALVARS_H */
|
||||
|
|
|
@ -321,11 +321,11 @@ err:
|
|||
*/
|
||||
int smbus_read_byte(u16 device, u8 address)
|
||||
{
|
||||
static int first_time = 1;
|
||||
struct global_vars *g = global_vars();
|
||||
|
||||
if (first_time) {
|
||||
if (!g->spd_inited) {
|
||||
smbus_init();
|
||||
first_time = 0;
|
||||
g->spd_inited = 1;
|
||||
}
|
||||
|
||||
return do_smbus_read_byte(SMBUS_IO_BASE, device, address);
|
||||
|
|
Loading…
Add table
Reference in a new issue