diff options
author | Shelly Chang <Shelly_Chang@wiwynn.com> | 2022-05-11 13:04:14 +0800 |
---|---|---|
committer | Werner Zeh <werner.zeh@siemens.com> | 2022-05-16 04:46:51 +0000 |
commit | 8b02bd1f8de71d852daf41df80d6bb27e86b90f7 (patch) | |
tree | 292508f1417fd733902ea7582402930fdd07e062 /src | |
parent | 0a5d1d7aae202b335e4f8dd0df05b15da584943c (diff) |
soc/intel/common/block/smbus: Add smbus block read write functions
Signed-off-by: Shelly Chang <Shelly_Chang@wiwynn.com>
Change-Id: Ib795f25abe5bbd95555b68af39c637d7c93aa819
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64251
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/soc/intel/common/block/smbus/smbus.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/soc/intel/common/block/smbus/smbus.c b/src/soc/intel/common/block/smbus/smbus.c index 7fdbffc5ce..3a500cac6d 100644 --- a/src/soc/intel/common/block/smbus/smbus.c +++ b/src/soc/intel/common/block/smbus/smbus.c @@ -33,9 +33,34 @@ static int lsmbus_write_byte(struct device *dev, u8 address, u8 data) return do_smbus_write_byte(res->base, device, address, data); } +static int lsmbus_read_block(struct device *dev, u8 cmd, u8 bytes, u8 *buffer) +{ + u16 device; + struct resource *res; + struct bus *pbus; + device = dev->path.i2c.device; + pbus = get_pbus_smbus(dev); + res = find_resource(pbus->dev, PCI_BASE_ADDRESS_4); + return do_smbus_block_read(res->base, device, cmd, bytes, buffer); +} + +static int lsmbus_write_block(struct device *dev, u8 cmd, u8 bytes, const u8 *buffer) +{ + u16 device; + struct resource *res; + struct bus *pbus; + + device = dev->path.i2c.device; + pbus = get_pbus_smbus(dev); + res = find_resource(pbus->dev, PCI_BASE_ADDRESS_4); + return do_smbus_block_write(res->base, device, cmd, bytes, (u8 *)buffer); +} + static struct smbus_bus_operations lops_smbus_bus = { .read_byte = lsmbus_read_byte, .write_byte = lsmbus_write_byte, + .block_read = lsmbus_read_block, + .block_write = lsmbus_write_block, }; static void pch_smbus_init(struct device *dev) |