Patchwork [v2,3/8] xilinx_axienet: Register reset properly

login
register
mail settings
Submitter Peter Crosthwaite
Date Feb. 25, 2013, 8:50 a.m.
Message ID <e57e3b01569f8bf926762185bb192742d40ee4e1.1361782087.git.peter.crosthwaite@xilinx.com>
Download mbox | patch
Permalink /patch/222867/
State New
Headers show

Comments

Peter Crosthwaite - Feb. 25, 2013, 8:50 a.m.
Register the reset function and the Device::reset function rather than
explicitly call it from the sysbus::init.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---

 hw/xilinx_axienet.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
Andreas Färber - Feb. 25, 2013, 12:44 p.m.
Am 25.02.2013 09:50, schrieb Peter Crosthwaite:
> Register the reset function and the Device::reset function rather than
> explicitly call it from the sysbus::init.
> 
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

Reviewed-by: Andreas Färber <afaerber@suse.de>

Seems like it might also fix genuine reboot issues - I don't see a
qemu_register_reset() being removed, so looks like it was only called on
initial device init before.

Andreas

Patch

diff --git a/hw/xilinx_axienet.c b/hw/xilinx_axienet.c
index 7b50682..3932846 100644
--- a/hw/xilinx_axienet.c
+++ b/hw/xilinx_axienet.c
@@ -401,8 +401,10 @@  static inline int axienet_newfunc_enabled(XilinxAXIEnet *s)
     return !!(s->regs[R_RAF] & RAF_NEWFUNC_EN);
 }
 
-static void axienet_reset(XilinxAXIEnet *s)
+static void xilinx_axienet_reset(DeviceState *d)
 {
+    XilinxAXIEnet *s = XILINX_AXI_ENET(d);
+
     axienet_rx_reset(s);
     axienet_tx_reset(s);
 
@@ -868,7 +870,6 @@  static int xilinx_enet_init(SysBusDevice *dev)
     s->TEMAC.parent = s;
 
     s->rxmem = g_malloc(s->c_rxmem);
-    axienet_reset(s);
 
     return 0;
 }
@@ -899,6 +900,7 @@  static void xilinx_enet_class_init(ObjectClass *klass, void *data)
 
     k->init = xilinx_enet_init;
     dc->props = xilinx_enet_properties;
+    dc->reset = xilinx_axienet_reset;
     ssc->push = axienet_stream_push;
 }