Shyam Sundar S K 05d980046f i2c: piix4: Export i2c_piix4 driver functions as library
Export the following i2c_piix4 driver functions as a library so that the
AMD ASF driver can utilize these core functionalities from the i2c_piix4
driver:

- piix4_sb800_region_request(): Request access to a specific SMBus region
on the SB800 chipset.

- piix4_sb800_region_release(): Release the previously requested SMBus
region on the SB800 chipset.

- piix4_transaction(): Handle SMBus transactions between the SMBus
controller and connected devices.

- piix4_sb800_port_sel(): Select the appropriate SMBus port on the SB800
chipset.

By making these functions available as a library, enable the AMD ASF
driver to leverage the established mechanisms in the i2c_piix4 driver,
promoting code reuse and consistency across different drivers.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2024-11-13 23:29:46 +01:00

45 lines
1.3 KiB
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* PIIX4/SB800 SMBus Interfaces
*
* Copyright (c) 2024, Advanced Micro Devices, Inc.
* All Rights Reserved.
*
* Authors: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
* Sanket Goswami <Sanket.Goswami@amd.com>
*/
#ifndef I2C_PIIX4_H
#define I2C_PIIX4_H
#include <linux/types.h>
/* PIIX4 SMBus address offsets */
#define SMBHSTSTS (0x00 + piix4_smba)
#define SMBHSLVSTS (0x01 + piix4_smba)
#define SMBHSTCNT (0x02 + piix4_smba)
#define SMBHSTCMD (0x03 + piix4_smba)
#define SMBHSTADD (0x04 + piix4_smba)
#define SMBHSTDAT0 (0x05 + piix4_smba)
#define SMBHSTDAT1 (0x06 + piix4_smba)
#define SMBBLKDAT (0x07 + piix4_smba)
#define SMBSLVCNT (0x08 + piix4_smba)
#define SMBSHDWCMD (0x09 + piix4_smba)
#define SMBSLVEVT (0x0A + piix4_smba)
#define SMBSLVDAT (0x0C + piix4_smba)
/* PIIX4 constants */
#define PIIX4_BLOCK_DATA 0x14
struct sb800_mmio_cfg {
void __iomem *addr;
bool use_mmio;
};
int piix4_sb800_port_sel(u8 port, struct sb800_mmio_cfg *mmio_cfg);
int piix4_transaction(struct i2c_adapter *piix4_adapter, unsigned short piix4_smba);
int piix4_sb800_region_request(struct device *dev, struct sb800_mmio_cfg *mmio_cfg);
void piix4_sb800_region_release(struct device *dev, struct sb800_mmio_cfg *mmio_cfg);
#endif /* I2C_PIIX4_H */