mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23:56 -06:00
qtest: Add functions for accessing devices on Aspeed I2C controller
Add read and write functions for accessing registers of I2C devices connected to the Aspeed I2C controller. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: Ninad Palsule <ninad@linux.ibm.com> Message-Id: <20230331173051.3857801-2-stefanb@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
2243299a74
commit
a3ebb580a2
3 changed files with 165 additions and 0 deletions
41
tests/qtest/qtest_aspeed.h
Normal file
41
tests/qtest/qtest_aspeed.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Aspeed i2c bus interface to reading and writing to i2c device registers
|
||||
*
|
||||
* Copyright (c) 2023 IBM Corporation
|
||||
*
|
||||
* Authors:
|
||||
* Stefan Berger <stefanb@linux.ibm.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
#ifndef QTEST_ASPEED_H
|
||||
#define QTEST_ASPEED_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libqtest.h"
|
||||
|
||||
#define AST2600_ASPEED_I2C_BASE_ADDR 0x1e78a000
|
||||
|
||||
/* Implements only AST2600 I2C controller */
|
||||
|
||||
static inline uint32_t ast2600_i2c_calc_bus_addr(uint8_t bus_num)
|
||||
{
|
||||
return AST2600_ASPEED_I2C_BASE_ADDR + 0x80 + bus_num * 0x80;
|
||||
}
|
||||
|
||||
uint8_t aspeed_i2c_readb(QTestState *s,
|
||||
uint32_t baseaddr, uint8_t slave_addr, uint8_t reg);
|
||||
uint16_t aspeed_i2c_readw(QTestState *s,
|
||||
uint32_t baseaddr, uint8_t slave_addr, uint8_t reg);
|
||||
uint32_t aspeed_i2c_readl(QTestState *s,
|
||||
uint32_t baseaddr, uint8_t slave_addr, uint8_t reg);
|
||||
void aspeed_i2c_writeb(QTestState *s, uint32_t baseaddr, uint8_t slave_addr,
|
||||
uint8_t reg, uint8_t v);
|
||||
void aspeed_i2c_writew(QTestState *s, uint32_t baseaddr, uint8_t slave_addr,
|
||||
uint8_t reg, uint16_t v);
|
||||
void aspeed_i2c_writel(QTestState *s, uint32_t baseaddr, uint8_t slave_addr,
|
||||
uint8_t reg, uint32_t v);
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue