[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 07/17] aspeed/scu: Fix W1C behavior
From: |
Cédric Le Goater |
Subject: |
[PATCH 07/17] aspeed/scu: Fix W1C behavior |
Date: |
Tue, 19 Nov 2019 15:12:01 +0100 |
From: Joel Stanley <address@hidden>
This models the clock write one to clear registers, and fixes up some
incorrect behavior in all of the write to clear registers.
There was also a typo in one of the register definitions.
Reviewed-by: Cédric Le Goater <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Signed-off-by: Joel Stanley <address@hidden>
[clg: checkpatch.pl fixes ]
Signed-off-by: Cédric Le Goater <address@hidden>
---
hw/misc/aspeed_scu.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c
index 717509bc5460..f62fa25e3474 100644
--- a/hw/misc/aspeed_scu.c
+++ b/hw/misc/aspeed_scu.c
@@ -98,7 +98,7 @@
#define AST2600_CLK_STOP_CTRL TO_REG(0x80)
#define AST2600_CLK_STOP_CTRL_CLR TO_REG(0x84)
#define AST2600_CLK_STOP_CTRL2 TO_REG(0x90)
-#define AST2600_CLK_STOP_CTR2L_CLR TO_REG(0x94)
+#define AST2600_CLK_STOP_CTRL2_CLR TO_REG(0x94)
#define AST2600_SDRAM_HANDSHAKE TO_REG(0x100)
#define AST2600_HPLL_PARAM TO_REG(0x200)
#define AST2600_HPLL_EXT TO_REG(0x204)
@@ -532,11 +532,13 @@ static uint64_t aspeed_ast2600_scu_read(void *opaque,
hwaddr offset,
return s->regs[reg];
}
-static void aspeed_ast2600_scu_write(void *opaque, hwaddr offset, uint64_t
data,
- unsigned size)
+static void aspeed_ast2600_scu_write(void *opaque, hwaddr offset,
+ uint64_t data64, unsigned size)
{
AspeedSCUState *s = ASPEED_SCU(opaque);
int reg = TO_REG(offset);
+ /* Truncate here so bitwise operations below behave as expected */
+ uint32_t data = data64;
if (reg >= ASPEED_AST2600_SCU_NR_REGS) {
qemu_log_mask(LOG_GUEST_ERROR,
@@ -563,15 +565,22 @@ static void aspeed_ast2600_scu_write(void *opaque, hwaddr
offset, uint64_t data,
/* fall through */
case AST2600_SYS_RST_CTRL:
case AST2600_SYS_RST_CTRL2:
+ case AST2600_CLK_STOP_CTRL:
+ case AST2600_CLK_STOP_CTRL2:
/* W1S (Write 1 to set) registers */
s->regs[reg] |= data;
return;
case AST2600_SYS_RST_CTRL_CLR:
case AST2600_SYS_RST_CTRL2_CLR:
+ case AST2600_CLK_STOP_CTRL_CLR:
+ case AST2600_CLK_STOP_CTRL2_CLR:
case AST2600_HW_STRAP1_CLR:
case AST2600_HW_STRAP2_CLR:
- /* W1C (Write 1 to clear) registers */
- s->regs[reg] &= ~data;
+ /*
+ * W1C (Write 1 to clear) registers are offset by one address from
+ * the data register
+ */
+ s->regs[reg - 1] &= ~data;
return;
case AST2600_RNG_DATA:
--
2.21.0
- [PATCH 00/17] aspeed: extensions and fixes, Cédric Le Goater, 2019/11/19
- [PATCH 01/17] aspeed/i2c: Add support for pool buffer transfers, Cédric Le Goater, 2019/11/19
- [PATCH 02/17] aspeed/i2c: Check SRAM enablement on AST2500, Cédric Le Goater, 2019/11/19
- [PATCH 03/17] aspeed: Add a DRAM memory region at the SoC level, Cédric Le Goater, 2019/11/19
- [PATCH 04/17] aspeed/i2c: Add support for DMA transfers, Cédric Le Goater, 2019/11/19
- [PATCH 05/17] aspeed/i2c: Add trace events, Cédric Le Goater, 2019/11/19
- [PATCH 06/17] aspeed/sdmc: Make ast2600 default 1G, Cédric Le Goater, 2019/11/19
- [PATCH 07/17] aspeed/scu: Fix W1C behavior,
Cédric Le Goater <=
- [PATCH 08/17] watchdog/aspeed: Improve watchdog timeout message, Cédric Le Goater, 2019/11/19
- [PATCH 09/17] watchdog/aspeed: Fix AST2600 frequency behaviour, Cédric Le Goater, 2019/11/19
- [PATCH 10/17] aspeed/smc: Restore default AHB window mapping at reset, Cédric Le Goater, 2019/11/19
- [PATCH 11/17] aspeed/smc: Do not map disabled segment on the AST2600, Cédric Le Goater, 2019/11/19
- [PATCH 12/17] aspeed/smc: Add AST2600 timings registers, Cédric Le Goater, 2019/11/19
- [PATCH 13/17] aspeed: Remove AspeedBoardConfig array and use AspeedMachineClass, Cédric Le Goater, 2019/11/19
- [PATCH 14/17] aspeed: Add support for the tacoma-bmc board, Cédric Le Goater, 2019/11/19
- [PATCH 15/17] gpio: fix memory leak in aspeed_gpio_init(), Cédric Le Goater, 2019/11/19
- [PATCH 16/17] aspeed: Change the "scu" property definition, Cédric Le Goater, 2019/11/19
- [PATCH 17/17] aspeed: Change the "nic" property definition, Cédric Le Goater, 2019/11/19