xref: /linux/drivers/i2c/busses/i2c-piix4.h (revision 7f71507851fc7764b36a3221839607d3a45c2025)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * PIIX4/SB800 SMBus Interfaces
4  *
5  * Copyright (c) 2024, Advanced Micro Devices, Inc.
6  * All Rights Reserved.
7  *
8  * Authors: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
9  *	    Sanket Goswami <Sanket.Goswami@amd.com>
10  */
11 
12 #ifndef I2C_PIIX4_H
13 #define I2C_PIIX4_H
14 
15 #include <linux/types.h>
16 
17 /* PIIX4 SMBus address offsets */
18 #define SMBHSTSTS	(0x00 + piix4_smba)
19 #define SMBHSLVSTS	(0x01 + piix4_smba)
20 #define SMBHSTCNT	(0x02 + piix4_smba)
21 #define SMBHSTCMD	(0x03 + piix4_smba)
22 #define SMBHSTADD	(0x04 + piix4_smba)
23 #define SMBHSTDAT0	(0x05 + piix4_smba)
24 #define SMBHSTDAT1	(0x06 + piix4_smba)
25 #define SMBBLKDAT	(0x07 + piix4_smba)
26 #define SMBSLVCNT	(0x08 + piix4_smba)
27 #define SMBSHDWCMD	(0x09 + piix4_smba)
28 #define SMBSLVEVT	(0x0A + piix4_smba)
29 #define SMBSLVDAT	(0x0C + piix4_smba)
30 
31 /* PIIX4 constants */
32 #define PIIX4_BLOCK_DATA	0x14
33 
34 struct sb800_mmio_cfg {
35 	void __iomem *addr;
36 	bool use_mmio;
37 };
38 
39 int piix4_sb800_port_sel(u8 port, struct sb800_mmio_cfg *mmio_cfg);
40 int piix4_transaction(struct i2c_adapter *piix4_adapter, unsigned short piix4_smba);
41 int piix4_sb800_region_request(struct device *dev, struct sb800_mmio_cfg *mmio_cfg);
42 void piix4_sb800_region_release(struct device *dev, struct sb800_mmio_cfg *mmio_cfg);
43 
44 #endif /* I2C_PIIX4_H */
45