All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: "Jason Wang" <jasowang@redhat.com>,
	"Dmitry Fleytman" <dmitry.fleytman@gmail.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Laurent Vivier" <lvivier@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
	"Michael S . Tsirkin" <mst@redhat.com>,
	"Yan Vugenfirer" <yvugenfi@redhat.com>,
	"Yuri Benditovich" <yuri.benditovich@daynix.com>,
	"Sriram Yagnaraman" <sriram.yagnaraman@est.tech>,
	"Alexander Bulekov" <alxndr@bu.edu>,
	"Akihiko Odaki" <akihiko.odaki@daynix.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH v4 03/28] fsl_etsec: Use hw/net/mii.h
Date: Mon, 30 Jan 2023 22:46:50 +0900	[thread overview]
Message-ID: <20230130134715.76604-4-akihiko.odaki@daynix.com> (raw)
In-Reply-To: <20230130134715.76604-1-akihiko.odaki@daynix.com>

hw/net/mii.h provides common definitions for MII.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/net/fsl_etsec/etsec.c | 11 ++++++-----
 hw/net/fsl_etsec/etsec.h | 17 -----------------
 hw/net/fsl_etsec/miim.c  |  5 +++--
 include/hw/net/mii.h     |  1 +
 4 files changed, 10 insertions(+), 24 deletions(-)

diff --git a/hw/net/fsl_etsec/etsec.c b/hw/net/fsl_etsec/etsec.c
index c753bfb3a8..798ea33d08 100644
--- a/hw/net/fsl_etsec/etsec.c
+++ b/hw/net/fsl_etsec/etsec.c
@@ -29,6 +29,7 @@
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "hw/irq.h"
+#include "hw/net/mii.h"
 #include "hw/ptimer.h"
 #include "hw/qdev-properties.h"
 #include "etsec.h"
@@ -339,11 +340,11 @@ static void etsec_reset(DeviceState *d)
     etsec->rx_buffer_len = 0;
 
     etsec->phy_status =
-        MII_SR_EXTENDED_CAPS    | MII_SR_LINK_STATUS   | MII_SR_AUTONEG_CAPS  |
-        MII_SR_AUTONEG_COMPLETE | MII_SR_PREAMBLE_SUPPRESS |
-        MII_SR_EXTENDED_STATUS  | MII_SR_100T2_HD_CAPS | MII_SR_100T2_FD_CAPS |
-        MII_SR_10T_HD_CAPS      | MII_SR_10T_FD_CAPS   | MII_SR_100X_HD_CAPS  |
-        MII_SR_100X_FD_CAPS     | MII_SR_100T4_CAPS;
+        MII_BMSR_EXTCAP   | MII_BMSR_LINK_ST  | MII_BMSR_AUTONEG  |
+        MII_BMSR_AN_COMP  | MII_BMSR_MFPS     | MII_BMSR_EXTSTAT  |
+        MII_BMSR_100T2_HD | MII_BMSR_100T2_FD |
+        MII_BMSR_10T_HD   | MII_BMSR_10T_FD   |
+        MII_BMSR_100TX_HD | MII_BMSR_100TX_FD | MII_BMSR_100T4;
 
     etsec_update_irq(etsec);
 }
diff --git a/hw/net/fsl_etsec/etsec.h b/hw/net/fsl_etsec/etsec.h
index 3c625c955c..3860864a3f 100644
--- a/hw/net/fsl_etsec/etsec.h
+++ b/hw/net/fsl_etsec/etsec.h
@@ -76,23 +76,6 @@ typedef struct eTSEC_rxtx_bd {
 #define FCB_TX_CTU     (1 << 1)
 #define FCB_TX_NPH     (1 << 0)
 
-/* PHY Status Register */
-#define MII_SR_EXTENDED_CAPS     0x0001    /* Extended register capabilities */
-#define MII_SR_JABBER_DETECT     0x0002    /* Jabber Detected */
-#define MII_SR_LINK_STATUS       0x0004    /* Link Status 1 = link */
-#define MII_SR_AUTONEG_CAPS      0x0008    /* Auto Neg Capable */
-#define MII_SR_REMOTE_FAULT      0x0010    /* Remote Fault Detect */
-#define MII_SR_AUTONEG_COMPLETE  0x0020    /* Auto Neg Complete */
-#define MII_SR_PREAMBLE_SUPPRESS 0x0040    /* Preamble may be suppressed */
-#define MII_SR_EXTENDED_STATUS   0x0100    /* Ext. status info in Reg 0x0F */
-#define MII_SR_100T2_HD_CAPS     0x0200    /* 100T2 Half Duplex Capable */
-#define MII_SR_100T2_FD_CAPS     0x0400    /* 100T2 Full Duplex Capable */
-#define MII_SR_10T_HD_CAPS       0x0800    /* 10T   Half Duplex Capable */
-#define MII_SR_10T_FD_CAPS       0x1000    /* 10T   Full Duplex Capable */
-#define MII_SR_100X_HD_CAPS      0x2000    /* 100X  Half Duplex Capable */
-#define MII_SR_100X_FD_CAPS      0x4000    /* 100X  Full Duplex Capable */
-#define MII_SR_100T4_CAPS        0x8000    /* 100T4 Capable */
-
 /* eTSEC */
 
 /* Number of register in the device */
diff --git a/hw/net/fsl_etsec/miim.c b/hw/net/fsl_etsec/miim.c
index 6bba01c82a..b48d2cb57b 100644
--- a/hw/net/fsl_etsec/miim.c
+++ b/hw/net/fsl_etsec/miim.c
@@ -23,6 +23,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "hw/net/mii.h"
 #include "etsec.h"
 #include "registers.h"
 
@@ -140,8 +141,8 @@ void etsec_miim_link_status(eTSEC *etsec, NetClientState *nc)
 {
     /* Set link status */
     if (nc->link_down) {
-        etsec->phy_status &= ~MII_SR_LINK_STATUS;
+        etsec->phy_status &= ~MII_BMSR_LINK_ST;
     } else {
-        etsec->phy_status |= MII_SR_LINK_STATUS;
+        etsec->phy_status |= MII_BMSR_LINK_ST;
     }
 }
diff --git a/include/hw/net/mii.h b/include/hw/net/mii.h
index c6a767a49a..ed1bb52b0f 100644
--- a/include/hw/net/mii.h
+++ b/include/hw/net/mii.h
@@ -55,6 +55,7 @@
 #define MII_BMCR_CTST       (1 << 7)  /* Collision test */
 #define MII_BMCR_SPEED1000  (1 << 6)  /* MSB of Speed (1000) */
 
+#define MII_BMSR_100T4      (1 << 15) /* Can do 100mbps T4 */
 #define MII_BMSR_100TX_FD   (1 << 14) /* Can do 100mbps, full-duplex */
 #define MII_BMSR_100TX_HD   (1 << 13) /* Can do 100mbps, half-duplex */
 #define MII_BMSR_10T_FD     (1 << 12) /* Can do 10mbps, full-duplex */
-- 
2.39.1



  parent reply	other threads:[~2023-01-30 13:55 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30 13:46 [PATCH v4 00/28] e1000x cleanups (preliminary for IGB) Akihiko Odaki
2023-01-30 13:46 ` [PATCH v4 01/28] e1000e: Fix the code style Akihiko Odaki
2023-01-30 13:46 ` [PATCH v4 02/28] hw/net: Add more MII definitions Akihiko Odaki
2023-01-30 13:46 ` Akihiko Odaki [this message]
2023-01-30 13:46 ` [PATCH v4 04/28] e1000: Use hw/net/mii.h Akihiko Odaki
2023-01-30 13:46 ` [PATCH v4 05/28] e1000: Mask registers when writing Akihiko Odaki
2023-01-30 13:46 ` [PATCH v4 06/28] e1000e: " Akihiko Odaki
2023-01-30 13:46 ` [PATCH v4 07/28] e1000: Use more constant definitions Akihiko Odaki
2023-01-30 13:46 ` [PATCH v4 08/28] e1000e: " Akihiko Odaki
2023-01-30 13:46 ` [PATCH v4 09/28] e1000: Use memcpy to intialize registers Akihiko Odaki
2023-01-30 13:46 ` [PATCH v4 10/28] e1000e: " Akihiko Odaki
2023-01-30 13:46 ` [PATCH v4 11/28] e1000e: Remove pending interrupt flags Akihiko Odaki
2023-01-30 13:46 ` [PATCH v4 12/28] e1000e: Improve software reset Akihiko Odaki
2023-01-30 13:47 ` [PATCH v4 13/28] e1000: Configure ResettableClass Akihiko Odaki
2023-01-30 13:47 ` [PATCH v4 14/28] e1000e: " Akihiko Odaki
2023-01-30 13:47 ` [PATCH v4 15/28] e1000e: Introduce e1000_rx_desc_union Akihiko Odaki
2023-01-30 13:47 ` [PATCH v4 16/28] e1000e: Set MII_ANER_NWAY Akihiko Odaki
2023-01-30 13:47 ` [PATCH v4 17/28] e1000e: Remove extra pointer indirection Akihiko Odaki
2023-01-30 13:47 ` [PATCH v4 18/28] net: Check L4 header size Akihiko Odaki
2023-01-30 13:47 ` [PATCH v4 19/28] e1000x: Alter the signature of e1000x_is_vlan_packet Akihiko Odaki
2023-01-30 13:47 ` [PATCH v4 20/28] net: Strip virtio-net header when dumping Akihiko Odaki
2023-01-30 15:12   ` Michael S. Tsirkin
2023-01-30 15:36     ` Akihiko Odaki
2023-01-30 15:47       ` Michael S. Tsirkin
2023-01-31  2:36         ` Akihiko Odaki
2023-01-30 13:47 ` [PATCH v4 21/28] hw/net/net_tx_pkt: Automatically determine if virtio-net header is used Akihiko Odaki
2023-01-30 13:47 ` [PATCH v4 22/28] hw/net/net_rx_pkt: Remove net_rx_pkt_has_virt_hdr Akihiko Odaki
2023-01-30 13:47 ` [PATCH v4 23/28] e1000e: Perform software segmentation for loopback Akihiko Odaki
2023-01-30 13:47 ` [PATCH v4 24/28] hw/net/net_tx_pkt: Implement TCP segmentation Akihiko Odaki
2023-01-30 13:47 ` [PATCH v4 25/28] hw/net/net_tx_pkt: Check the payload length Akihiko Odaki
2023-01-30 13:47 ` [PATCH v4 26/28] e1000e: Do not assert when MSI-X is disabled later Akihiko Odaki
2023-01-30 13:47 ` [PATCH v4 27/28] MAINTAINERS: Add Akihiko Odaki as a e1000e reviewer Akihiko Odaki
2023-01-30 13:47 ` [PATCH v4 28/28] MAINTAINERS: Add e1000e test files Akihiko Odaki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230130134715.76604-4-akihiko.odaki@daynix.com \
    --to=akihiko.odaki@daynix.com \
    --cc=alxndr@bu.edu \
    --cc=dmitry.fleytman@gmail.com \
    --cc=jasowang@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=sriram.yagnaraman@est.tech \
    --cc=thuth@redhat.com \
    --cc=yuri.benditovich@daynix.com \
    --cc=yvugenfi@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.