sb/intel/smbus: Implement smbus_send_byte()
Allows to use this driver for the SMBus console without sending an index byte for every sent char (i.e. !CONSOLE_I2C_SMBUS_HAVE_DATA_REGISTER). Tested with WiP VIA CX700-M2 port and FT4222H as receiver. Change-Id: Ic368ef379039b104064c9a91474b188646388dd2 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/82763 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
		| @@ -253,6 +253,7 @@ static int smbus_write_cmd(uintptr_t base, u8 ctrl, u8 device, u8 address, u16 d | |||||||
| 	host_outb(base, SMBHSTCMD, address); | 	host_outb(base, SMBHSTCMD, address); | ||||||
|  |  | ||||||
| 	/* Set the data bytes... */ | 	/* Set the data bytes... */ | ||||||
|  | 	if (ctrl >= I801_BYTE_DATA) | ||||||
| 		host_outb(base, SMBHSTDAT0, data & 0xff); | 		host_outb(base, SMBHSTDAT0, data & 0xff); | ||||||
| 	if (ctrl == I801_WORD_DATA) | 	if (ctrl == I801_WORD_DATA) | ||||||
| 		host_outb(base, SMBHSTDAT1, data >> 8); | 		host_outb(base, SMBHSTDAT1, data >> 8); | ||||||
| @@ -354,6 +355,11 @@ int do_smbus_read_word(uintptr_t base, u8 device, u8 address) | |||||||
| 	return smbus_read_cmd(base, I801_WORD_DATA, device, address); | 	return smbus_read_cmd(base, I801_WORD_DATA, device, address); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | int do_smbus_send_byte(uintptr_t base, u8 device, u8 data) | ||||||
|  | { | ||||||
|  | 	return smbus_write_cmd(base, I801_BYTE, device, data, 0x00); | ||||||
|  | } | ||||||
|  |  | ||||||
| int do_smbus_write_byte(uintptr_t base, u8 device, u8 address, u8 data) | int do_smbus_write_byte(uintptr_t base, u8 device, u8 address, u8 data) | ||||||
| { | { | ||||||
| 	return smbus_write_cmd(base, I801_BYTE_DATA, device, address, data); | 	return smbus_write_cmd(base, I801_BYTE_DATA, device, address, data); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user