[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 15/21] ftgmac100: Improve software reset
From: |
Cédric Le Goater |
Subject: |
[PATCH v2 15/21] ftgmac100: Improve software reset |
Date: |
Wed, 19 Aug 2020 12:09:50 +0200 |
The software reset of the MAC needs a finer granularity. Some settings
in MACCR are kept.
Cc: Frederic Konrad <konrad.frederic@yahoo.fr>
Fixes: bd44300d1afc ("net: add FTGMAC100 support")
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
hw/net/ftgmac100.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c
index 7c9fa720df03..782ff192cedc 100644
--- a/hw/net/ftgmac100.c
+++ b/hw/net/ftgmac100.c
@@ -649,10 +649,8 @@ static uint32_t ftgmac100_rxpoll(FTGMAC100State *s)
return cnt / div[speed];
}
-static void ftgmac100_reset(DeviceState *d)
+static void ftgmac100_do_reset(FTGMAC100State *s, bool sw_reset)
{
- FTGMAC100State *s = FTGMAC100(d);
-
/* Reset the FTGMAC100 */
s->isr = 0;
s->ier = 0;
@@ -671,7 +669,12 @@ static void ftgmac100_reset(DeviceState *d)
s->fear1 = 0;
s->tpafcr = 0xf1;
- s->maccr = 0;
+ if (sw_reset) {
+ s->maccr &= FTGMAC100_MACCR_GIGA_MODE | FTGMAC100_MACCR_FAST_MODE;
+ } else {
+ s->maccr = 0;
+ }
+
s->phycr = 0;
s->phydata = 0;
s->fcr = 0x400;
@@ -680,6 +683,11 @@ static void ftgmac100_reset(DeviceState *d)
phy_reset(s);
}
+static void ftgmac100_reset(DeviceState *d)
+{
+ ftgmac100_do_reset(FTGMAC100(d), false);
+}
+
static uint64_t ftgmac100_read(void *opaque, hwaddr addr, unsigned size)
{
FTGMAC100State *s = FTGMAC100(opaque);
@@ -824,7 +832,7 @@ static void ftgmac100_write(void *opaque, hwaddr addr,
case FTGMAC100_MACCR: /* MAC Device control */
s->maccr = value;
if (value & FTGMAC100_MACCR_SW_RST) {
- ftgmac100_reset(DEVICE(s));
+ ftgmac100_do_reset(s, true);
}
if (ftgmac100_can_receive(qemu_get_queue(s->nic))) {
--
2.25.4
- [PATCH v2 11/21] ftgmac100: Fix interrupt status "Packet moved to RX FIFO", (continued)
- [PATCH v2 11/21] ftgmac100: Fix interrupt status "Packet moved to RX FIFO", Cédric Le Goater, 2020/08/19
- [PATCH v2 03/21] m25p80: Add support for n25q512ax3, Cédric Le Goater, 2020/08/19
- [PATCH v2 17/21] aspeed/sdmc: Allow writes to unprotected registers, Cédric Le Goater, 2020/08/19
- [PATCH v2 05/21] hw/arm/aspeed: Add board model for Supermicro X11 BMC, Cédric Le Goater, 2020/08/19
- [PATCH v2 06/21] aspeed/smc: Fix MemoryRegionOps definition, Cédric Le Goater, 2020/08/19
- [PATCH v2 14/21] ftgmac100: Fix integer overflow in ftgmac100_do_tx(), Cédric Le Goater, 2020/08/19
- [PATCH v2 08/21] aspeed/sdhci: Fix reset sequence, Cédric Le Goater, 2020/08/19
- [PATCH v2 12/21] ftgmac100: Change interrupt status when a DMA error occurs, Cédric Le Goater, 2020/08/19
- [PATCH v2 09/21] ftgmac100: Fix registers that can be read, Cédric Le Goater, 2020/08/19
- [PATCH v2 15/21] ftgmac100: Improve software reset,
Cédric Le Goater <=
- [PATCH v2 19/21] aspeed/smc: Open AHB window of the second chip of the AST2600 FMC controller, Cédric Le Goater, 2020/08/19
- [PATCH v2 20/21] arm: aspeed: add strap define `25HZ` of AST2500, Cédric Le Goater, 2020/08/19
- [PATCH v2 21/21] hw: add a number of SPI-flash's of m25p80 family, Cédric Le Goater, 2020/08/19
- Re: [PATCH v2 00/21] aspeed: cleanups and some extensions, Joel Stanley, 2020/08/25