blob: 37cc784d96235254f24a9f03248a26a48937c121 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/*
* Nuvoton Peripheral SPI Module
*
* Copyright 2023 Google LLC
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef NPCM_PSPI_H
#define NPCM_PSPI_H
#include "hw/ssi/ssi.h"
#include "hw/sysbus.h"
/*
* Number of registers in our device state structure. Don't change this without
* incrementing the version_id in the vmstate.
*/
#define NPCM_PSPI_NR_REGS 3
/**
* NPCMPSPIState - Device state for one Flash Interface Unit.
* @parent: System bus device.
* @mmio: Memory region for register access.
* @spi: The SPI bus mastered by this controller.
* @regs: Register contents.
* @irq: The interrupt request queue for this module.
*
* Each PSPI has a shared bank of registers, and controls up to four chip
* selects. Each chip select has a dedicated memory region which may be used to
* read and write the flash connected to that chip select as if it were memory.
*/
typedef struct NPCMPSPIState {
SysBusDevice parent;
MemoryRegion mmio;
SSIBus *spi;
uint16_t regs[NPCM_PSPI_NR_REGS];
qemu_irq irq;
} NPCMPSPIState;
#define TYPE_NPCM_PSPI "npcm-pspi"
OBJECT_DECLARE_SIMPLE_TYPE(NPCMPSPIState, NPCM_PSPI)
#endif /* NPCM_PSPI_H */
|