soc/intel/common: Sync early SMBUS prototypes
Change-Id: I6b4b5ffd552b9eb4467689c8df85905a1c199bb0 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/38120 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Patrick Rudolph <siro@das-labor.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
c2ce370f30
commit
4ae9f1e5d8
|
@ -30,7 +30,7 @@ static int lsmbus_read_byte(struct device *dev, u8 address)
|
||||||
device = dev->path.i2c.device;
|
device = dev->path.i2c.device;
|
||||||
pbus = get_pbus_smbus(dev);
|
pbus = get_pbus_smbus(dev);
|
||||||
res = find_resource(pbus->dev, PCI_BASE_ADDRESS_4);
|
res = find_resource(pbus->dev, PCI_BASE_ADDRESS_4);
|
||||||
return smbus_read8(res->base, device, address);
|
return do_smbus_read_byte(res->base, device, address);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lsmbus_write_byte(struct device *dev, u8 address, u8 data)
|
static int lsmbus_write_byte(struct device *dev, u8 address, u8 data)
|
||||||
|
@ -42,7 +42,7 @@ static int lsmbus_write_byte(struct device *dev, u8 address, u8 data)
|
||||||
device = dev->path.i2c.device;
|
device = dev->path.i2c.device;
|
||||||
pbus = get_pbus_smbus(dev);
|
pbus = get_pbus_smbus(dev);
|
||||||
res = find_resource(pbus->dev, PCI_BASE_ADDRESS_4);
|
res = find_resource(pbus->dev, PCI_BASE_ADDRESS_4);
|
||||||
return smbus_write8(res->base, device, address, data);
|
return do_smbus_write_byte(res->base, device, address, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct smbus_bus_operations lops_smbus_bus = {
|
static struct smbus_bus_operations lops_smbus_bus = {
|
||||||
|
|
|
@ -47,8 +47,7 @@ static int smbus_wait_till_done(u16 smbus_base)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int smbus_read8(unsigned int smbus_base, unsigned int device,
|
int do_smbus_read_byte(unsigned int smbus_base, u8 device, unsigned int address)
|
||||||
unsigned int address)
|
|
||||||
{
|
{
|
||||||
unsigned char global_status_register;
|
unsigned char global_status_register;
|
||||||
unsigned char byte;
|
unsigned char byte;
|
||||||
|
@ -93,8 +92,8 @@ int smbus_read8(unsigned int smbus_base, unsigned int device,
|
||||||
return byte;
|
return byte;
|
||||||
}
|
}
|
||||||
|
|
||||||
int smbus_write8(unsigned int smbus_base, unsigned int device,
|
int do_smbus_write_byte(unsigned int smbus_base, u8 device, unsigned int address,
|
||||||
unsigned int address, unsigned int data)
|
unsigned int data)
|
||||||
{
|
{
|
||||||
unsigned char global_status_register;
|
unsigned char global_status_register;
|
||||||
|
|
||||||
|
@ -137,8 +136,7 @@ int smbus_write8(unsigned int smbus_base, unsigned int device,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int smbus_read16(unsigned int smbus_base, unsigned int device,
|
int do_smbus_read_word(unsigned int smbus_base, u8 device, unsigned int address)
|
||||||
unsigned int address)
|
|
||||||
{
|
{
|
||||||
unsigned char global_status_register;
|
unsigned char global_status_register;
|
||||||
unsigned short data;
|
unsigned short data;
|
||||||
|
@ -180,15 +178,15 @@ int smbus_read16(unsigned int smbus_base, unsigned int device,
|
||||||
|
|
||||||
u16 smbus_read_word(u8 addr, u8 offset)
|
u16 smbus_read_word(u8 addr, u8 offset)
|
||||||
{
|
{
|
||||||
return smbus_read16(SMBUS_IO_BASE, addr, offset);
|
return do_smbus_read_word(SMBUS_IO_BASE, addr, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 smbus_read_byte(u8 addr, u8 offset)
|
u8 smbus_read_byte(u8 addr, u8 offset)
|
||||||
{
|
{
|
||||||
return smbus_read8(SMBUS_IO_BASE, addr, offset);
|
return do_smbus_read_byte(SMBUS_IO_BASE, addr, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 smbus_write_byte(u8 addr, u8 offset, u8 value)
|
u8 smbus_write_byte(u8 addr, u8 offset, u8 value)
|
||||||
{
|
{
|
||||||
return smbus_write8(SMBUS_IO_BASE, addr, offset, value);
|
return do_smbus_write_byte(SMBUS_IO_BASE, addr, offset, value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#ifndef SOC_INTEL_COMMON_BLOCK_SMBUS__LIB_H
|
#ifndef SOC_INTEL_COMMON_BLOCK_SMBUS__LIB_H
|
||||||
#define SOC_INTEL_COMMON_BLOCK_SMBUS__LIB_H
|
#define SOC_INTEL_COMMON_BLOCK_SMBUS__LIB_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
/* SMBus IO Base Address */
|
/* SMBus IO Base Address */
|
||||||
#define SMBUS_IO_BASE 0xefa0
|
#define SMBUS_IO_BASE 0xefa0
|
||||||
/* PCI Configuration Space : SMBus */
|
/* PCI Configuration Space : SMBus */
|
||||||
|
@ -30,11 +32,9 @@
|
||||||
|
|
||||||
#define SMBUS_TIMEOUT 15 /* 15ms */
|
#define SMBUS_TIMEOUT 15 /* 15ms */
|
||||||
|
|
||||||
int smbus_read8(unsigned int smbus_base, unsigned int device,
|
int do_smbus_read_byte(unsigned int smbus_base, u8 device, unsigned int address);
|
||||||
unsigned int address);
|
int do_smbus_write_byte(unsigned int smbus_base, u8 device, unsigned int address,
|
||||||
int smbus_write8(unsigned int smbus_base, unsigned int device,
|
unsigned int data);
|
||||||
unsigned int address, unsigned int data);
|
int do_smbus_read_word(unsigned int smbus_base, u8 device, unsigned int address);
|
||||||
int smbus_read16(unsigned int smbus_base, unsigned int device,
|
|
||||||
unsigned int address);
|
|
||||||
|
|
||||||
#endif /* SOC_INTEL_COMMON_BLOCK_SMBUS__LIB_H */
|
#endif /* SOC_INTEL_COMMON_BLOCK_SMBUS__LIB_H */
|
||||||
|
|
Loading…
Reference in New Issue