virtio-gpu-3d: fix abnormal display after a warm reboot
[qemu/ar7.git] / include / hw / ssi / npcm7xx_fiu.h
bloba3a17042896271d00749ded9b0dfc93b2c50d9fd
1 /*
2 * Nuvoton NPCM7xx Flash Interface Unit (FIU)
4 * Copyright 2020 Google LLC
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
16 #ifndef NPCM7XX_FIU_H
17 #define NPCM7XX_FIU_H
19 #include "hw/ssi/ssi.h"
20 #include "hw/sysbus.h"
23 * Number of registers in our device state structure. Don't change this without
24 * incrementing the version_id in the vmstate.
26 #define NPCM7XX_FIU_NR_REGS (0x7c / sizeof(uint32_t))
28 typedef struct NPCM7xxFIUState NPCM7xxFIUState;
30 /**
31 * struct NPCM7xxFIUFlash - Per-chipselect flash controller state.
32 * @direct_access: Memory region for direct flash access.
33 * @fiu: Pointer to flash controller shared state.
35 typedef struct NPCM7xxFIUFlash {
36 MemoryRegion direct_access;
37 NPCM7xxFIUState *fiu;
38 } NPCM7xxFIUFlash;
40 /**
41 * NPCM7xxFIUState - Device state for one Flash Interface Unit.
42 * @parent: System bus device.
43 * @mmio: Memory region for register access.
44 * @cs_count: Number of flash chips that may be connected to this module.
45 * @active_cs: Currently active chip select, or -1 if no chip is selected.
46 * @cs_lines: GPIO lines that may be wired to flash chips.
47 * @flash: Array of @cs_count per-flash-chip state objects.
48 * @spi: The SPI bus mastered by this controller.
49 * @regs: Register contents.
51 * Each FIU has a shared bank of registers, and controls up to four chip
52 * selects. Each chip select has a dedicated memory region which may be used to
53 * read and write the flash connected to that chip select as if it were memory.
55 struct NPCM7xxFIUState {
56 SysBusDevice parent;
58 MemoryRegion mmio;
60 int32_t cs_count;
61 int32_t active_cs;
62 qemu_irq *cs_lines;
63 NPCM7xxFIUFlash *flash;
65 SSIBus *spi;
67 uint32_t regs[NPCM7XX_FIU_NR_REGS];
70 #define TYPE_NPCM7XX_FIU "npcm7xx-fiu"
71 #define NPCM7XX_FIU(obj) OBJECT_CHECK(NPCM7xxFIUState, (obj), TYPE_NPCM7XX_FIU)
73 #endif /* NPCM7XX_FIU_H */