mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
hw/ssi: Add SPI model
SPI controller device model supports a connection to a single SPI responder. This provide access to SPI seeproms, TPM, flash device and an ADC controller. All SPI function control is mapped into the SPI register space to enable full control by firmware. In this commit SPI configuration component is modelled which contains all SPI configuration and status registers as well as the hold registers for data to be sent or having been received. An existing QEMU SSI framework is used and SSI_BUS is created. Signed-off-by: Chalapathi V <chalapathi.v@linux.ibm.com> Reviewed-by: Caleb Schlossin <calebs@linux.vnet.ibm.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Reviewed-by: Glenn Miles <milesg@linux.ibm.com> [np: Fix FDT macro compile for qtest] Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
This commit is contained in:
parent
117664a1e7
commit
29318db133
8 changed files with 339 additions and 0 deletions
40
include/hw/ssi/pnv_spi.h
Normal file
40
include/hw/ssi/pnv_spi.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* QEMU PowerPC SPI model
|
||||
*
|
||||
* Copyright (c) 2024, IBM Corporation.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*
|
||||
* This model Supports a connection to a single SPI responder.
|
||||
* Introduced for P10 to provide access to SPI seeproms, TPM, flash device
|
||||
* and an ADC controller.
|
||||
*/
|
||||
|
||||
#ifndef PPC_PNV_SPI_H
|
||||
#define PPC_PNV_SPI_H
|
||||
|
||||
#include "hw/ssi/ssi.h"
|
||||
#include "hw/sysbus.h"
|
||||
|
||||
#define TYPE_PNV_SPI "pnv-spi"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(PnvSpi, PNV_SPI)
|
||||
|
||||
#define PNV_SPI_REG_SIZE 8
|
||||
#define PNV_SPI_REGS 7
|
||||
|
||||
#define TYPE_PNV_SPI_BUS "pnv-spi-bus"
|
||||
typedef struct PnvSpi {
|
||||
SysBusDevice parent_obj;
|
||||
|
||||
SSIBus *ssi_bus;
|
||||
qemu_irq *cs_line;
|
||||
MemoryRegion xscom_spic_regs;
|
||||
/* SPI object number */
|
||||
uint32_t spic_num;
|
||||
|
||||
/* SPI registers */
|
||||
uint64_t regs[PNV_SPI_REGS];
|
||||
uint8_t seq_op[PNV_SPI_REG_SIZE];
|
||||
uint64_t status;
|
||||
} PnvSpi;
|
||||
#endif /* PPC_PNV_SPI_H */
|
Loading…
Add table
Add a link
Reference in a new issue