Fri Oct 28 06:27:11 2016 UTC ()
- Define WMPHY_I217, WMPHY_VF and WMPHY_210.
- Use BME1000_PHY_PAGE_SELECT in wm_gmii_bm_{read,write}reg(). This change has
  no effect because GG82563_PHY_PAGE_SELECT and BME1000_PHY_PAGE_SELECT have
  the same value.


(msaitoh)
diff -r1.432 -r1.433 src/sys/dev/pci/if_wm.c
diff -r1.31 -r1.32 src/sys/dev/pci/if_wmvar.h

cvs diff -r1.432 -r1.433 src/sys/dev/pci/if_wm.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_wm.c 2016/10/28 05:50:18 1.432
+++ src/sys/dev/pci/if_wm.c 2016/10/28 06:27:11 1.433
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_wm.c,v 1.432 2016/10/28 05:50:18 msaitoh Exp $ */ 1/* $NetBSD: if_wm.c,v 1.433 2016/10/28 06:27:11 msaitoh Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. 4 * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 7 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -74,27 +74,27 @@ @@ -74,27 +74,27 @@
74 * 74 *
75 * - Check XXX'ed comments 75 * - Check XXX'ed comments
76 * - Disable D0 LPLU on 8257[12356], 82580 and I350. 76 * - Disable D0 LPLU on 8257[12356], 82580 and I350.
77 * - TX Multi queue improvement (refine queue selection logic) 77 * - TX Multi queue improvement (refine queue selection logic)
78 * - Advanced Receive Descriptor 78 * - Advanced Receive Descriptor
79 * - EEE (Energy Efficiency Ethernet) 79 * - EEE (Energy Efficiency Ethernet)
80 * - Virtual Function 80 * - Virtual Function
81 * - Set LED correctly (based on contents in EEPROM) 81 * - Set LED correctly (based on contents in EEPROM)
82 * - Rework how parameters are loaded from the EEPROM. 82 * - Rework how parameters are loaded from the EEPROM.
83 * - Image Unique ID 83 * - Image Unique ID
84 */ 84 */
85 85
86#include <sys/cdefs.h> 86#include <sys/cdefs.h>
87__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.432 2016/10/28 05:50:18 msaitoh Exp $"); 87__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.433 2016/10/28 06:27:11 msaitoh Exp $");
88 88
89#ifdef _KERNEL_OPT 89#ifdef _KERNEL_OPT
90#include "opt_net_mpsafe.h" 90#include "opt_net_mpsafe.h"
91#endif 91#endif
92 92
93#include <sys/param.h> 93#include <sys/param.h>
94#include <sys/systm.h> 94#include <sys/systm.h>
95#include <sys/callout.h> 95#include <sys/callout.h>
96#include <sys/mbuf.h> 96#include <sys/mbuf.h>
97#include <sys/malloc.h> 97#include <sys/malloc.h>
98#include <sys/kmem.h> 98#include <sys/kmem.h>
99#include <sys/kernel.h> 99#include <sys/kernel.h>
100#include <sys/socket.h> 100#include <sys/socket.h>
@@ -8242,30 +8242,32 @@ wm_gmii_mediainit(struct wm_softc *sc, p @@ -8242,30 +8242,32 @@ wm_gmii_mediainit(struct wm_softc *sc, p
8242 break; 8242 break;
8243 default: 8243 default:
8244 if (((sc->sc_flags & WM_F_SGMII) != 0) 8244 if (((sc->sc_flags & WM_F_SGMII) != 0)
8245 && !wm_sgmii_uses_mdio(sc)){ 8245 && !wm_sgmii_uses_mdio(sc)){
8246 /* SGMII */ 8246 /* SGMII */
8247 mii->mii_readreg = wm_sgmii_readreg; 8247 mii->mii_readreg = wm_sgmii_readreg;
8248 mii->mii_writereg = wm_sgmii_writereg; 8248 mii->mii_writereg = wm_sgmii_writereg;
8249 } else if (sc->sc_type >= WM_T_ICH8) { 8249 } else if (sc->sc_type >= WM_T_ICH8) {
8250 /* non-82567 ICH8, 9 and 10 */ 8250 /* non-82567 ICH8, 9 and 10 */
8251 mii->mii_readreg = wm_gmii_i82544_readreg; 8251 mii->mii_readreg = wm_gmii_i82544_readreg;
8252 mii->mii_writereg = wm_gmii_i82544_writereg; 8252 mii->mii_writereg = wm_gmii_i82544_writereg;
8253 } else if (sc->sc_type >= WM_T_80003) { 8253 } else if (sc->sc_type >= WM_T_80003) {
8254 /* 80003 */ 8254 /* 80003 */
 8255 sc->sc_phytype = WMPHY_GG82563;
8255 mii->mii_readreg = wm_gmii_i80003_readreg; 8256 mii->mii_readreg = wm_gmii_i80003_readreg;
8256 mii->mii_writereg = wm_gmii_i80003_writereg; 8257 mii->mii_writereg = wm_gmii_i80003_writereg;
8257 } else if (sc->sc_type >= WM_T_I210) { 8258 } else if (sc->sc_type >= WM_T_I210) {
8258 /* I210 and I211 */ 8259 /* I210 and I211 */
 8260 sc->sc_phytype = WMPHY_210;
8259 mii->mii_readreg = wm_gmii_gs40g_readreg; 8261 mii->mii_readreg = wm_gmii_gs40g_readreg;
8260 mii->mii_writereg = wm_gmii_gs40g_writereg; 8262 mii->mii_writereg = wm_gmii_gs40g_writereg;
8261 } else if (sc->sc_type >= WM_T_82580) { 8263 } else if (sc->sc_type >= WM_T_82580) {
8262 /* 82580, I350 and I354 */ 8264 /* 82580, I350 and I354 */
8263 sc->sc_phytype = WMPHY_82580; 8265 sc->sc_phytype = WMPHY_82580;
8264 mii->mii_readreg = wm_gmii_82580_readreg; 8266 mii->mii_readreg = wm_gmii_82580_readreg;
8265 mii->mii_writereg = wm_gmii_82580_writereg; 8267 mii->mii_writereg = wm_gmii_82580_writereg;
8266 } else if (sc->sc_type >= WM_T_82544) { 8268 } else if (sc->sc_type >= WM_T_82544) {
8267 /* 82544, 0, [56], [17], 8257[1234] and 82583 */ 8269 /* 82544, 0, [56], [17], 8257[1234] and 82583 */
8268 mii->mii_readreg = wm_gmii_i82544_readreg; 8270 mii->mii_readreg = wm_gmii_i82544_readreg;
8269 mii->mii_writereg = wm_gmii_i82544_writereg; 8271 mii->mii_writereg = wm_gmii_i82544_writereg;
8270 } else { 8272 } else {
8271 mii->mii_readreg = wm_gmii_i82543_readreg; 8273 mii->mii_readreg = wm_gmii_i82543_readreg;
@@ -8752,27 +8754,27 @@ wm_gmii_bm_readreg(device_t self, int ph @@ -8752,27 +8754,27 @@ wm_gmii_bm_readreg(device_t self, int ph
8752 8754
8753 if (sc->phy.acquire(sc)) { 8755 if (sc->phy.acquire(sc)) {
8754 aprint_error_dev(sc->sc_dev, "%s: failed to get semaphore\n", 8756 aprint_error_dev(sc->sc_dev, "%s: failed to get semaphore\n",
8755 __func__); 8757 __func__);
8756 return 0; 8758 return 0;
8757 } 8759 }
8758 8760
8759 if (reg > BME1000_MAX_MULTI_PAGE_REG) { 8761 if (reg > BME1000_MAX_MULTI_PAGE_REG) {
8760 if (phy == 1) 8762 if (phy == 1)
8761 wm_gmii_mdic_writereg(self, phy, 8763 wm_gmii_mdic_writereg(self, phy,
8762 MII_IGPHY_PAGE_SELECT, reg); 8764 MII_IGPHY_PAGE_SELECT, reg);
8763 else 8765 else
8764 wm_gmii_mdic_writereg(self, phy, 8766 wm_gmii_mdic_writereg(self, phy,
8765 GG82563_PHY_PAGE_SELECT, 8767 BME1000_PHY_PAGE_SELECT,
8766 reg >> GG82563_PAGE_SHIFT); 8768 reg >> GG82563_PAGE_SHIFT);
8767 } 8769 }
8768 8770
8769 rv = wm_gmii_mdic_readreg(self, phy, reg & MII_ADDRMASK); 8771 rv = wm_gmii_mdic_readreg(self, phy, reg & MII_ADDRMASK);
8770 sc->phy.release(sc); 8772 sc->phy.release(sc);
8771 return rv; 8773 return rv;
8772} 8774}
8773 8775
8774/* 8776/*
8775 * wm_gmii_bm_writereg: [mii interface function] 8777 * wm_gmii_bm_writereg: [mii interface function]
8776 * 8778 *
8777 * Write a PHY register on the kumeran. 8779 * Write a PHY register on the kumeran.
8778 * This could be handled by the PHY layer if we didn't have to lock the 8780 * This could be handled by the PHY layer if we didn't have to lock the
@@ -8785,27 +8787,27 @@ wm_gmii_bm_writereg(device_t self, int p @@ -8785,27 +8787,27 @@ wm_gmii_bm_writereg(device_t self, int p
8785 8787
8786 if (sc->phy.acquire(sc)) { 8788 if (sc->phy.acquire(sc)) {
8787 aprint_error_dev(sc->sc_dev, "%s: failed to get semaphore\n", 8789 aprint_error_dev(sc->sc_dev, "%s: failed to get semaphore\n",
8788 __func__); 8790 __func__);
8789 return; 8791 return;
8790 } 8792 }
8791 8793
8792 if (reg > BME1000_MAX_MULTI_PAGE_REG) { 8794 if (reg > BME1000_MAX_MULTI_PAGE_REG) {
8793 if (phy == 1) 8795 if (phy == 1)
8794 wm_gmii_mdic_writereg(self, phy, 8796 wm_gmii_mdic_writereg(self, phy,
8795 MII_IGPHY_PAGE_SELECT, reg); 8797 MII_IGPHY_PAGE_SELECT, reg);
8796 else 8798 else
8797 wm_gmii_mdic_writereg(self, phy, 8799 wm_gmii_mdic_writereg(self, phy,
8798 GG82563_PHY_PAGE_SELECT, 8800 BME1000_PHY_PAGE_SELECT,
8799 reg >> GG82563_PAGE_SHIFT); 8801 reg >> GG82563_PAGE_SHIFT);
8800 } 8802 }
8801 8803
8802 wm_gmii_mdic_writereg(self, phy, reg & MII_ADDRMASK, val); 8804 wm_gmii_mdic_writereg(self, phy, reg & MII_ADDRMASK, val);
8803 sc->phy.release(sc); 8805 sc->phy.release(sc);
8804} 8806}
8805 8807
8806static void 8808static void
8807wm_access_phy_wakeup_reg_bm(device_t self, int offset, int16_t *val, int rd) 8809wm_access_phy_wakeup_reg_bm(device_t self, int offset, int16_t *val, int rd)
8808{ 8810{
8809 struct wm_softc *sc = device_private(self); 8811 struct wm_softc *sc = device_private(self);
8810 uint16_t regnum = BM_PHY_REG_NUM(offset); 8812 uint16_t regnum = BM_PHY_REG_NUM(offset);
8811 uint16_t wuce; 8813 uint16_t wuce;

cvs diff -r1.31 -r1.32 src/sys/dev/pci/if_wmvar.h (expand / switch to unified diff)

--- src/sys/dev/pci/if_wmvar.h 2016/05/06 08:56:20 1.31
+++ src/sys/dev/pci/if_wmvar.h 2016/10/28 06:27:11 1.32
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_wmvar.h,v 1.31 2016/05/06 08:56:20 msaitoh Exp $ */ 1/* $NetBSD: if_wmvar.h,v 1.32 2016/10/28 06:27:11 msaitoh Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. 4 * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 7 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -155,24 +155,27 @@ typedef enum { @@ -155,24 +155,27 @@ typedef enum {
155typedef enum { 155typedef enum {
156 WMPHY_UNKNOWN = 0, 156 WMPHY_UNKNOWN = 0,
157 WMPHY_NONE, 157 WMPHY_NONE,
158 WMPHY_M88, 158 WMPHY_M88,
159 WMPHY_IGP, 159 WMPHY_IGP,
160 WMPHY_IGP_2, 160 WMPHY_IGP_2,
161 WMPHY_GG82563, 161 WMPHY_GG82563,
162 WMPHY_IGP_3, 162 WMPHY_IGP_3,
163 WMPHY_IFE, 163 WMPHY_IFE,
164 WMPHY_BM, 164 WMPHY_BM,
165 WMPHY_82577, 165 WMPHY_82577,
166 WMPHY_82578, 166 WMPHY_82578,
167 WMPHY_82579, 167 WMPHY_82579,
168 WMPHY_82580 168 WMPHY_I217,
 169 WMPHY_82580,
 170 WMPHY_VF,
 171 WMPHY_210
169} wm_phy_type; 172} wm_phy_type;
170 173
171 174
172#define WM_GEN_POLL_TIMEOUT 640 175#define WM_GEN_POLL_TIMEOUT 640
173#define WM_PHY_CFG_TIMEOUT 100 176#define WM_PHY_CFG_TIMEOUT 100
174#define WM_ICH8_LAN_INIT_TIMEOUT 1500 177#define WM_ICH8_LAN_INIT_TIMEOUT 1500
175#define WM_MDIO_OWNERSHIP_TIMEOUT 10 178#define WM_MDIO_OWNERSHIP_TIMEOUT 10
176#define WM_MAX_PLL_TRIES 5 179#define WM_MAX_PLL_TRIES 5
177 180
178#endif /* _DEV_PCI_IF_WMVAR_H_ */ 181#endif /* _DEV_PCI_IF_WMVAR_H_ */