[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 35/45] net: etraxfs_eth: add a reset method
From: |
Eduardo Habkost |
Subject: |
[Qemu-ppc] [PULL 35/45] net: etraxfs_eth: add a reset method |
Date: |
Thu, 18 Oct 2018 17:04:12 -0300 |
From: Cédric Le Goater <address@hidden>
Cc: Edgar E. Iglesias <address@hidden>
Signed-off-by: Cédric Le Goater <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
hw/net/etraxfs_eth.c | 31 +++++++++++++++++++++++++------
1 file changed, 25 insertions(+), 6 deletions(-)
diff --git a/hw/net/etraxfs_eth.c b/hw/net/etraxfs_eth.c
index 64ab3df1ae..36855804db 100644
--- a/hw/net/etraxfs_eth.c
+++ b/hw/net/etraxfs_eth.c
@@ -127,7 +127,7 @@ tdk_write(struct qemu_phy *phy, unsigned int req, unsigned
int data)
}
static void
-tdk_init(struct qemu_phy *phy)
+tdk_reset(struct qemu_phy *phy)
{
phy->regs[0] = 0x3100;
/* PHY Id. */
@@ -136,9 +136,6 @@ tdk_init(struct qemu_phy *phy)
/* Autonegotiation advertisement reg. */
phy->regs[4] = 0x01E1;
phy->link = 1;
-
- phy->read = tdk_read;
- phy->write = tdk_write;
}
struct qemu_mdio
@@ -585,6 +582,27 @@ static NetClientInfo net_etraxfs_info = {
.link_status_changed = eth_set_link,
};
+static void etraxfs_eth_reset(DeviceState *dev)
+{
+ ETRAXFSEthState *s = ETRAX_FS_ETH(dev);
+
+ memset(s->regs, 0, sizeof(s->regs));
+ memset(s->macaddr, 0, sizeof(s->macaddr));
+ s->duplex_mismatch = 0;
+
+ s->mdio_bus.mdc = 0;
+ s->mdio_bus.mdio = 0;
+ s->mdio_bus.state = 0;
+ s->mdio_bus.drive = 0;
+ s->mdio_bus.cnt = 0;
+ s->mdio_bus.addr = 0;
+ s->mdio_bus.opc = 0;
+ s->mdio_bus.req = 0;
+ s->mdio_bus.data = 0;
+
+ tdk_reset(&s->phy);
+}
+
static void etraxfs_eth_realize(DeviceState *dev, Error **errp)
{
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
@@ -609,8 +627,8 @@ static void etraxfs_eth_realize(DeviceState *dev, Error
**errp)
object_get_typename(OBJECT(s)), dev->id, s);
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
-
- tdk_init(&s->phy);
+ s->phy.read = tdk_read;
+ s->phy.write = tdk_write;
mdio_attach(&s->mdio_bus, &s->phy, s->phyaddr);
}
@@ -627,6 +645,7 @@ static void etraxfs_eth_class_init(ObjectClass *klass, void
*data)
DeviceClass *dc = DEVICE_CLASS(klass);
dc->realize = etraxfs_eth_realize;
+ dc->reset = etraxfs_eth_reset;
dc->props = etraxfs_eth_properties;
/* Reason: pointer properties "dma_out", "dma_in" */
dc->user_creatable = false;
--
2.18.0.rc1.1.g3f1ff2140
- [Qemu-ppc] [PULL 26/45] memory-device: add and use memory_device_get_region_size(), (continued)
- [Qemu-ppc] [PULL 26/45] memory-device: add and use memory_device_get_region_size(), Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 27/45] memory-device: factor out get_memory_region() from pc-dimm, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 29/45] memory-device: add device class function set_addr(), Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 28/45] memory-device: drop get_region_size(), Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 31/45] memory-device: complete factoring out plug handling, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 30/45] memory-device: complete factoring out pre_plug handling, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 32/45] memory-device: complete factoring out unplug handling, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 33/45] memory-device: trace when pre_plugging/plugging/unplugging, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 34/45] net: etraxfs_eth: convert SysBus init method to a realize method, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 35/45] net: etraxfs_eth: add a reset method,
Eduardo Habkost <=
- [Qemu-ppc] [PULL 37/45] net: lance: convert SysBus init method to a realize method, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 36/45] net: lan9118: convert SysBus init method to a realize method, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 38/45] net: milkymist_minimac2: convert SysBus init method to a realize method, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 39/45] net: mipsnet: convert SysBus init method to a realize method, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 40/45] net: opencores_eth: convert SysBus init method to a realize method, Eduardo Habkost, 2018/10/18