1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #define __SIMPLE_DEVICE__
6 #include <soc/pci_devs.h>
7 #include <device/pci_def.h>
8 #include <device/pci_type.h>
9 #include <device/pci_ops.h>
10 #include <device/smbus_host.h>
11 #include <soc/smbus.h>
13 int smbus_i2c_block_write(u8 addr
, u8 bytes
, u8
*buf
)
15 const pci_devfn_t dev
= PCI_DEV(0, SMBUS_DEV
, SMBUS_FUNC
);
22 smbase
= pci_read_config32(dev
, PCI_BASE_ADDRESS_4
) & 0xFFFFFFFE;
24 /* Enable I2C_EN bit in HOSTC register */
25 smb_ctrl_reg
= pci_read_config32(dev
, HOSTC
);
26 pci_write_config32(dev
, HOSTC
, smb_ctrl_reg
| HOSTC_I2C_EN
);
28 status
= do_i2c_block_write(smbase
, addr
, bytes
, buf
);
30 /* Restore I2C_EN bit */
31 pci_write_config32(dev
, HOSTC
, smb_ctrl_reg
);