xref: /openbmc/qemu/include/hw/misc/aspeed_i3c.h (revision 119df56b)
1*119df56bSTroy Lee /*
2*119df56bSTroy Lee  * ASPEED I3C Controller
3*119df56bSTroy Lee  *
4*119df56bSTroy Lee  * Copyright (C) 2021 ASPEED Technology Inc.
5*119df56bSTroy Lee  *
6*119df56bSTroy Lee  * This code is licensed under the GPL version 2 or later.  See
7*119df56bSTroy Lee  * the COPYING file in the top-level directory.
8*119df56bSTroy Lee  */
9*119df56bSTroy Lee 
10*119df56bSTroy Lee #ifndef ASPEED_I3C_H
11*119df56bSTroy Lee #define ASPEED_I3C_H
12*119df56bSTroy Lee 
13*119df56bSTroy Lee #include "hw/sysbus.h"
14*119df56bSTroy Lee 
15*119df56bSTroy Lee #define TYPE_ASPEED_I3C "aspeed.i3c"
16*119df56bSTroy Lee #define TYPE_ASPEED_I3C_DEVICE "aspeed.i3c.device"
17*119df56bSTroy Lee OBJECT_DECLARE_TYPE(AspeedI3CState, AspeedI3CClass, ASPEED_I3C)
18*119df56bSTroy Lee 
19*119df56bSTroy Lee #define ASPEED_I3C_NR_REGS (0x70 >> 2)
20*119df56bSTroy Lee #define ASPEED_I3C_DEVICE_NR_REGS (0x300 >> 2)
21*119df56bSTroy Lee #define ASPEED_I3C_NR_DEVICES 6
22*119df56bSTroy Lee 
23*119df56bSTroy Lee OBJECT_DECLARE_SIMPLE_TYPE(AspeedI3CDevice, ASPEED_I3C_DEVICE)
24*119df56bSTroy Lee typedef struct AspeedI3CDevice {
25*119df56bSTroy Lee     /* <private> */
26*119df56bSTroy Lee     SysBusDevice parent;
27*119df56bSTroy Lee 
28*119df56bSTroy Lee     /* <public> */
29*119df56bSTroy Lee     MemoryRegion mr;
30*119df56bSTroy Lee     qemu_irq irq;
31*119df56bSTroy Lee 
32*119df56bSTroy Lee     uint8_t id;
33*119df56bSTroy Lee     uint32_t regs[ASPEED_I3C_DEVICE_NR_REGS];
34*119df56bSTroy Lee } AspeedI3CDevice;
35*119df56bSTroy Lee 
36*119df56bSTroy Lee typedef struct AspeedI3CState {
37*119df56bSTroy Lee     /* <private> */
38*119df56bSTroy Lee     SysBusDevice parent;
39*119df56bSTroy Lee 
40*119df56bSTroy Lee     /* <public> */
41*119df56bSTroy Lee     MemoryRegion iomem;
42*119df56bSTroy Lee     MemoryRegion iomem_container;
43*119df56bSTroy Lee     qemu_irq irq;
44*119df56bSTroy Lee 
45*119df56bSTroy Lee     uint32_t regs[ASPEED_I3C_NR_REGS];
46*119df56bSTroy Lee     AspeedI3CDevice devices[ASPEED_I3C_NR_DEVICES];
47*119df56bSTroy Lee } AspeedI3CState;
48*119df56bSTroy Lee #endif /* ASPEED_I3C_H */
49