CVS commit: src/sys/dev/mii

2023-10-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 17 14:08:13 UTC 2023

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
miidevs: Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.157 -r1.158 src/sys/dev/mii/miidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2023-10-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 17 14:08:13 UTC 2023

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
miidevs: Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.157 -r1.158 src/sys/dev/mii/miidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.168 src/sys/dev/mii/miidevs.h:1.169
--- src/sys/dev/mii/miidevs.h:1.168	Fri Sep 29 09:08:30 2023
+++ src/sys/dev/mii/miidevs.h	Tue Oct 17 14:08:13 2023
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.168 2023/09/29 09:08:30 msaitoh Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.169 2023/10/17 14:08:13 msaitoh Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.170 2023/09/29 09:08:16 msaitoh Exp
+ *	NetBSD: miidevs,v 1.171 2023/10/17 14:07:51 msaitoh Exp
  */
 
 /*-
@@ -417,6 +417,8 @@
 #define	MII_STR_INTEL2_I226_2	"I226 2.5G media interface (2)"
 #define	MII_MODEL_INTEL2_I225	0x000c		/* I225 2.5G media interface */
 #define	MII_STR_INTEL2_I225	"I225 2.5G media interface"
+#define	MII_MODEL_INTEL2_GPY115	0x0030		/* MaxLinear GPY115 Gigabit PHY */
+#define	MII_STR_INTEL2_GPY115	"MaxLinear GPY115 Gigabit PHY"
 
 /* JMicron PHYs */
 #define	MII_MODEL_JMICRON_JMP211	0x0021		/* JMP211 10/100/1000 media interface */

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.157 src/sys/dev/mii/miidevs_data.h:1.158
--- src/sys/dev/mii/miidevs_data.h:1.157	Fri Sep 29 09:08:30 2023
+++ src/sys/dev/mii/miidevs_data.h	Tue Oct 17 14:08:13 2023
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.157 2023/09/29 09:08:30 msaitoh Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.158 2023/10/17 14:08:13 msaitoh Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.170 2023/09/29 09:08:16 msaitoh Exp
+ *	NetBSD: miidevs,v 1.171 2023/10/17 14:07:51 msaitoh Exp
  */
 
 /*-
@@ -364,218 +364,220 @@ static const uint32_t mii_products[] = {
 	1656, 1651, 565, 571, 1665, 0,
 	MII_OUI_INTEL2, MII_MODEL_INTEL2_I225, 
 	1669, 1651, 565, 571, 0,
+	MII_OUI_INTEL2, MII_MODEL_INTEL2_GPY115, 
+	419, 1674, 1550, 497, 0,
 	MII_OUI_JMICRON, MII_MODEL_JMICRON_JMP211, 
-	1674, 625, 565, 571, 0,
+	1681, 625, 565, 571, 0,
 	MII_OUI_JMICRON, MII_MODEL_JMICRON_JMP202, 
-	1681, 558, 565, 571, 0,
-	MII_OUI_xxLEVEL1, MII_MODEL_xxLEVEL1_LXT970, 
 	1688, 558, 565, 571, 0,
+	MII_OUI_xxLEVEL1, MII_MODEL_xxLEVEL1_LXT970, 
+	1695, 558, 565, 571, 0,
 	MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT1000_OLD, 
-	1695, 804, 565, 571, 0,
+	1702, 804, 565, 571, 0,
 	MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT974, 
-	1703, 558, 748, 497, 0,
-	MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT975, 
 	1710, 558, 748, 497, 0,
+	MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT975, 
+	1717, 558, 748, 497, 0,
 	MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT1000, 
-	1695, 804, 565, 571, 0,
+	1702, 804, 565, 571, 0,
 	MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT971, 
-	1717, 558, 565, 571, 0,
+	1724, 558, 565, 571, 0,
 	MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT973, 
-	1726, 558, 761, 497, 0,
+	1733, 558, 761, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1000, 
-	236, 1733, 1550, 497, 0,
+	236, 1740, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1011, 
-	236, 1741, 1550, 497, 0,
+	236, 1748, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1000_3, 
-	236, 1733, 1550, 497, 0,
+	236, 1740, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1000S, 
-	236, 1749, 1550, 497, 0,
+	236, 1756, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1000_5, 
-	236, 1733, 1550, 497, 0,
+	236, 1740, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1101, 
-	236, 1758, 1550, 497, 0,
+	236, 1765, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E3082, 
-	236, 1766, 558, 1774, 1779, 497, 0,
+	236, 1773, 558, 1781, 1786, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1112, 
-	236, 1788, 1550, 497, 0,
+	236, 1795, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1149, 
-	236, 1796, 1550, 497, 0,
+	236, 1803, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E, 
-	236, 1804, 1550, 497, 0,
+	236, 1811, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1145, 
-	236, 1812, 748, 1550, 497, 0,
+	236, 1819, 748, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E6060, 
-	236, 1820, 1828, 558, 1774, 1779, 1835, 0,
+	236, 1827, 1835, 558, 1781, 1786, 1842, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_I347, 
-	305, 1842, 1550, 497, 0,
+	305, 1849, 1550, 497, 0,
 	  

CVS commit: src/sys/dev/mii

2023-10-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 17 14:07:51 UTC 2023

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
miidevs: Add MaxLinear GPY115.


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/sys/dev/mii/miidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.170 src/sys/dev/mii/miidevs:1.171
--- src/sys/dev/mii/miidevs:1.170	Fri Sep 29 09:08:16 2023
+++ src/sys/dev/mii/miidevs	Tue Oct 17 14:07:51 2023
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.170 2023/09/29 09:08:16 msaitoh Exp $
+$NetBSD: miidevs,v 1.171 2023/10/17 14:07:51 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -284,6 +284,7 @@ model INTEL2 GPY211		0x MaxLinear GP
 model INTEL2 I226_1		0x0001 I226 2.5G media interface (1)
 model INTEL2 I226_2		0x0005 I226 2.5G media interface (2)
 model INTEL2 I225		0x000c I225 2.5G media interface
+model INTEL2 GPY115		0x0030 MaxLinear GPY115 Gigabit PHY
 
 /* JMicron PHYs */
 model JMICRON JMP211		0x0021 JMP211 10/100/1000 media interface



CVS commit: src/sys/dev/mii

2023-10-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 17 14:07:51 UTC 2023

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
miidevs: Add MaxLinear GPY115.


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/sys/dev/mii/miidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2023-09-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Sep 29 09:08:30 UTC 2023

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.156 -r1.157 src/sys/dev/mii/miidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.167 src/sys/dev/mii/miidevs.h:1.168
--- src/sys/dev/mii/miidevs.h:1.167	Fri Sep 29 03:39:00 2023
+++ src/sys/dev/mii/miidevs.h	Fri Sep 29 09:08:30 2023
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.167 2023/09/29 03:39:00 msaitoh Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.168 2023/09/29 09:08:30 msaitoh Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.169 2023/09/29 03:38:36 msaitoh Exp
+ *	NetBSD: miidevs,v 1.170 2023/09/29 09:08:16 msaitoh Exp
  */
 
 /*-
@@ -409,9 +409,14 @@
 #define	MII_MODEL_ATTANSIC_I82578	0x0004		/* Intel 82578 10/100/1000 media interface */
 #define	MII_STR_ATTANSIC_I82578	"Intel 82578 10/100/1000 media interface"
 /* Acquired by MaxLinear */
-#define	MII_MODEL_INTEL2_GPY211	0x		/* MaxLinear GPY21[125] 2.5G PHY */
-#define	MII_STR_INTEL2_GPY211	"MaxLinear GPY21[125] 2.5G PHY"
-
+#define	MII_MODEL_INTEL2_GPY211	0x		/* MaxLinear GPY21[125] 2.5G media interface */
+#define	MII_STR_INTEL2_GPY211	"MaxLinear GPY21[125] 2.5G media interface"
+#define	MII_MODEL_INTEL2_I226_1	0x0001		/* I226 2.5G media interface (1) */
+#define	MII_STR_INTEL2_I226_1	"I226 2.5G media interface (1)"
+#define	MII_MODEL_INTEL2_I226_2	0x0005		/* I226 2.5G media interface (2) */
+#define	MII_STR_INTEL2_I226_2	"I226 2.5G media interface (2)"
+#define	MII_MODEL_INTEL2_I225	0x000c		/* I225 2.5G media interface */
+#define	MII_STR_INTEL2_I225	"I225 2.5G media interface"
 
 /* JMicron PHYs */
 #define	MII_MODEL_JMICRON_JMP211	0x0021		/* JMP211 10/100/1000 media interface */

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.156 src/sys/dev/mii/miidevs_data.h:1.157
--- src/sys/dev/mii/miidevs_data.h:1.156	Fri Sep 29 03:39:00 2023
+++ src/sys/dev/mii/miidevs_data.h	Fri Sep 29 09:08:30 2023
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.156 2023/09/29 03:39:00 msaitoh Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.157 2023/09/29 09:08:30 msaitoh Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.169 2023/09/29 03:38:36 msaitoh Exp
+ *	NetBSD: miidevs,v 1.170 2023/09/29 09:08:16 msaitoh Exp
  */
 
 /*-
@@ -357,219 +357,225 @@ static const uint32_t mii_products[] = {
 	MII_OUI_ATTANSIC, MII_MODEL_ATTANSIC_I82578, 
 	305, 1634, 625, 565, 571, 0,
 	MII_OUI_INTEL2, MII_MODEL_INTEL2_GPY211, 
-	419, 1640, 1651, 497, 0,
+	419, 1640, 1651, 565, 571, 0,
+	MII_OUI_INTEL2, MII_MODEL_INTEL2_I226_1, 
+	1656, 1651, 565, 571, 1661, 0,
+	MII_OUI_INTEL2, MII_MODEL_INTEL2_I226_2, 
+	1656, 1651, 565, 571, 1665, 0,
+	MII_OUI_INTEL2, MII_MODEL_INTEL2_I225, 
+	1669, 1651, 565, 571, 0,
 	MII_OUI_JMICRON, MII_MODEL_JMICRON_JMP211, 
-	1656, 625, 565, 571, 0,
+	1674, 625, 565, 571, 0,
 	MII_OUI_JMICRON, MII_MODEL_JMICRON_JMP202, 
-	1663, 558, 565, 571, 0,
+	1681, 558, 565, 571, 0,
 	MII_OUI_xxLEVEL1, MII_MODEL_xxLEVEL1_LXT970, 
-	1670, 558, 565, 571, 0,
+	1688, 558, 565, 571, 0,
 	MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT1000_OLD, 
-	1677, 804, 565, 571, 0,
+	1695, 804, 565, 571, 0,
 	MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT974, 
-	1685, 558, 748, 497, 0,
+	1703, 558, 748, 497, 0,
 	MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT975, 
-	1692, 558, 748, 497, 0,
+	1710, 558, 748, 497, 0,
 	MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT1000, 
-	1677, 804, 565, 571, 0,
+	1695, 804, 565, 571, 0,
 	MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT971, 
-	1699, 558, 565, 571, 0,
+	1717, 558, 565, 571, 0,
 	MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT973, 
-	1708, 558, 761, 497, 0,
+	1726, 558, 761, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1000, 
-	236, 1715, 1550, 497, 0,
+	236, 1733, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1011, 
-	236, 1723, 1550, 497, 0,
+	236, 1741, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1000_3, 
-	236, 1715, 1550, 497, 0,
+	236, 1733, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1000S, 
-	236, 1731, 1550, 497, 0,
+	236, 1749, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1000_5, 
-	236, 1715, 1550, 497, 0,
+	236, 1733, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1101, 
-	236, 1740, 1550, 497, 0,
+	236, 1758, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E3082, 
-	236, 1748, 558, 1756, 1761, 

CVS commit: src/sys/dev/mii

2023-09-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Sep 29 09:08:30 UTC 2023

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.156 -r1.157 src/sys/dev/mii/miidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2023-09-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Sep 29 09:08:16 UTC 2023

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
miidevs: Update I22[56]

 - Add model 0x0001 and 0x0005 for I226 and 0x000c for I225.
   Need more info to write better descriptions.
 - Modify GPY211's description a little.


To generate a diff of this commit:
cvs rdiff -u -r1.169 -r1.170 src/sys/dev/mii/miidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.169 src/sys/dev/mii/miidevs:1.170
--- src/sys/dev/mii/miidevs:1.169	Fri Sep 29 03:38:36 2023
+++ src/sys/dev/mii/miidevs	Fri Sep 29 09:08:16 2023
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.169 2023/09/29 03:38:36 msaitoh Exp $
+$NetBSD: miidevs,v 1.170 2023/09/29 09:08:16 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -280,8 +280,10 @@ model xxMARVELL I210		0x I210 10/100
 model xxMARVELL I82563		0x000a i82563 10/100/1000 media interface
 model ATTANSIC I82578		0x0004 Intel 82578 10/100/1000 media interface
 /* Acquired by MaxLinear */
-model INTEL2 GPY211		0x MaxLinear GPY21[125] 2.5G PHY
-
+model INTEL2 GPY211		0x MaxLinear GPY21[125] 2.5G media interface
+model INTEL2 I226_1		0x0001 I226 2.5G media interface (1)
+model INTEL2 I226_2		0x0005 I226 2.5G media interface (2)
+model INTEL2 I225		0x000c I225 2.5G media interface
 
 /* JMicron PHYs */
 model JMICRON JMP211		0x0021 JMP211 10/100/1000 media interface



CVS commit: src/sys/dev/mii

2023-09-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Sep 29 09:08:16 UTC 2023

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
miidevs: Update I22[56]

 - Add model 0x0001 and 0x0005 for I226 and 0x000c for I225.
   Need more info to write better descriptions.
 - Modify GPY211's description a little.


To generate a diff of this commit:
cvs rdiff -u -r1.169 -r1.170 src/sys/dev/mii/miidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2023-09-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Sep 29 03:39:00 UTC 2023

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.155 -r1.156 src/sys/dev/mii/miidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.166 src/sys/dev/mii/miidevs.h:1.167
--- src/sys/dev/mii/miidevs.h:1.166	Tue Jun 29 21:04:02 2021
+++ src/sys/dev/mii/miidevs.h	Fri Sep 29 03:39:00 2023
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.166 2021/06/29 21:04:02 pgoyette Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.167 2023/09/29 03:39:00 msaitoh Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.168 2020/06/23 14:35:36 msaitoh Exp
+ *	NetBSD: miidevs,v 1.169 2023/09/29 03:38:36 msaitoh Exp
  */
 
 /*-
@@ -99,6 +99,8 @@
 #define	MII_OUI_TI	0x080028		/* Texas Instruments */
 #define	MII_OUI_BROADCOM4	0x18c086		/* Broadcom Corporation */
 #define	MII_OUI_RENESAS	0x749050		/* Renesas */
+#define	MII_OUI_INTEL2	0x984fee		/* Intel */
+#define	MII_OUI_MAXLINEAR	0xac9a96		/* MaxLinear */
 
 /* Unregistered or wrong OUI */
 #define	MII_OUI_yyREALTEK	0x04		/* Realtek */
@@ -123,6 +125,7 @@
 #define	MII_OUI_xxPMCSIERRA2	0x009057		/* PMC-Sierra */
 #define	MII_OUI_xxCICADA	0x00c08f		/* Cicada Semiconductor */
 #define	MII_OUI_xxRDC	0x00d02d		/* RDC Semiconductor */
+#define	MII_OUI_xxMAXLINEAR	0x0c32ab		/* MaxLinear */
 #define	MII_OUI_xxNATSEMI	0x1000e8		/* National Semiconductor */
 #define	MII_OUI_xxLEVEL1	0x782000		/* Level 1 */
 #define	MII_OUI_xxXAQTI	0xace000		/* XaQti Corp. */
@@ -405,6 +408,9 @@
 #define	MII_STR_xxMARVELL_I82563	"i82563 10/100/1000 media interface"
 #define	MII_MODEL_ATTANSIC_I82578	0x0004		/* Intel 82578 10/100/1000 media interface */
 #define	MII_STR_ATTANSIC_I82578	"Intel 82578 10/100/1000 media interface"
+/* Acquired by MaxLinear */
+#define	MII_MODEL_INTEL2_GPY211	0x		/* MaxLinear GPY21[125] 2.5G PHY */
+#define	MII_STR_INTEL2_GPY211	"MaxLinear GPY21[125] 2.5G PHY"
 
 
 /* JMicron PHYs */

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.155 src/sys/dev/mii/miidevs_data.h:1.156
--- src/sys/dev/mii/miidevs_data.h:1.155	Tue Jun 29 21:04:02 2021
+++ src/sys/dev/mii/miidevs_data.h	Fri Sep 29 03:39:00 2023
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.155 2021/06/29 21:04:02 pgoyette Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.156 2023/09/29 03:39:00 msaitoh Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.168 2020/06/23 14:35:36 msaitoh Exp
+ *	NetBSD: miidevs,v 1.169 2023/09/29 03:38:36 msaitoh Exp
  */
 
 /*-
@@ -81,28 +81,31 @@ static const uint32_t mii_vendors[] = {
 	MII_OUI_TI, 393, 399, 0,
 	MII_OUI_BROADCOM4, 109, 118, 0,
 	MII_OUI_RENESAS, 411, 0,
-	MII_OUI_yyREALTEK, 419, 0,
+	MII_OUI_INTEL2, 305, 0,
+	MII_OUI_MAXLINEAR, 419, 0,
+	MII_OUI_yyREALTEK, 429, 0,
 	MII_OUI_yyAMD, 1, 10, 16, 0,
-	MII_OUI_xxVIA, 427, 66, 0,
+	MII_OUI_xxVIA, 437, 66, 0,
 	MII_OUI_xxMYSON, 315, 43, 0,
 	MII_OUI_xxTSC, 311, 186, 0,
-	MII_OUI_xxASIX, 431, 186, 0,
+	MII_OUI_xxASIX, 441, 186, 0,
 	MII_OUI_xxDAVICOM, 260, 186, 0,
 	MII_OUI_xxAMLOGIC, 252, 0,
 	MII_OUI_xxQUALSEMI, 244, 186, 0,
-	MII_OUI_xxREALTEK, 419, 0,
+	MII_OUI_xxREALTEK, 429, 0,
 	MII_OUI_xxBROADCOM, 109, 118, 0,
 	MII_OUI_xxPMCSIERRA, 338, 0,
-	MII_OUI_xxICPLUS, 436, 439, 378, 0,
+	MII_OUI_xxICPLUS, 446, 449, 378, 0,
 	MII_OUI_xxMARVELL, 236, 186, 0,
 	MII_OUI_xxINTEL, 305, 0,
 	MII_OUI_xxBROADCOM_ALT1, 109, 118, 0,
 	MII_OUI_yyINTEL, 305, 0,
-	MII_OUI_yyASIX, 431, 186, 0,
-	MII_OUI_xxVITESSE, 444, 186, 0,
+	MII_OUI_yyASIX, 441, 186, 0,
+	MII_OUI_xxVITESSE, 454, 186, 0,
 	MII_OUI_xxPMCSIERRA2, 338, 0,
-	MII_OUI_xxCICADA, 452, 186, 0,
-	MII_OUI_xxRDC, 459, 186, 0,
+	MII_OUI_xxCICADA, 462, 186, 0,
+	MII_OUI_xxRDC, 469, 186, 0,
+	MII_OUI_xxMAXLINEAR, 419, 0,
 	MII_OUI_xxNATSEMI, 384, 186, 0,
 	MII_OUI_xxLEVEL1, 228, 234, 0,
 	MII_OUI_xxXAQTI, 372, 378, 0,
@@ -110,461 +113,463 @@ static const uint32_t mii_vendors[] = {
 
 static const uint32_t mii_products[] = {
 	MII_OUI_AGERE, MII_MODEL_AGERE_ET1011, 
-	463, 470, 487, 0,
+	473, 480, 497, 0,
 	MII_OUI_AGERE, MII_MODEL_AGERE_ET1011C, 
-	491, 470, 487, 0,
+	501, 480, 497, 0,
 	MII_OUI_xxASIX, MII_MODEL_xxASIX_AX88X9X, 
-	499, 507, 487, 0,
+	509, 517, 497, 0,
 	MII_OUI_yyASIX, MII_MODEL_yyASIX_AX88772, 
-	516, 507, 487, 0,
+	526, 517, 497, 0,
 	MII_OUI_yyASIX, MII_MODEL_yyASIX_AX88772A, 
-	524, 507, 487, 0,
+	534, 517, 497, 0,
 	

CVS commit: src/sys/dev/mii

2023-09-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Sep 29 03:39:00 UTC 2023

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.155 -r1.156 src/sys/dev/mii/miidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2023-09-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Sep 29 03:38:36 UTC 2023

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
Add MaxLinear GPY21[125] 2.5G PHY.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/dev/mii/miidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.168 src/sys/dev/mii/miidevs:1.169
--- src/sys/dev/mii/miidevs:1.168	Tue Jun 23 14:35:36 2020
+++ src/sys/dev/mii/miidevs	Fri Sep 29 03:38:36 2023
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.168 2020/06/23 14:35:36 msaitoh Exp $
+$NetBSD: miidevs,v 1.169 2023/09/29 03:38:36 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -92,6 +92,8 @@ oui NATSEMI			0x080017	National Semicond
 oui TI0x080028	Texas Instruments
 oui BROADCOM4			0x18c086	Broadcom Corporation
 oui RENESAS			0x749050	Renesas
+oui INTEL2			0x984fee	Intel
+oui MAXLINEAR			0xac9a96	MaxLinear
 
 /* Unregistered or wrong OUI */
 oui yyREALTEK			0x04	Realtek
@@ -116,6 +118,7 @@ oui xxVITESSE			0x008083	Vitesse Semicon
 oui xxPMCSIERRA2		0x009057	PMC-Sierra
 oui xxCICADA			0x00c08f	Cicada Semiconductor
 oui xxRDC			0x00d02d	RDC Semiconductor
+oui xxMAXLINEAR			0x0c32ab	MaxLinear
 oui xxNATSEMI			0x1000e8	National Semiconductor
 oui xxLEVEL1			0x782000	Level 1
 oui xxXAQTI			0xace000	XaQti Corp.
@@ -276,6 +279,8 @@ model INTEL I350		0x003b I350 10/100/100
 model xxMARVELL I210		0x I210 10/100/1000 media interface
 model xxMARVELL I82563		0x000a i82563 10/100/1000 media interface
 model ATTANSIC I82578		0x0004 Intel 82578 10/100/1000 media interface
+/* Acquired by MaxLinear */
+model INTEL2 GPY211		0x MaxLinear GPY21[125] 2.5G PHY
 
 
 /* JMicron PHYs */



CVS commit: src/sys/dev/mii

2023-09-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Sep 29 03:38:36 UTC 2023

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
Add MaxLinear GPY21[125] 2.5G PHY.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/dev/mii/miidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2023-05-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 22 02:12:13 UTC 2023

Modified Files:
src/sys/dev/mii: mii_physubr.c

Log Message:
Fix a bug when a media is changed to IFM_AUTO.

 Fix a bug that ifconfig ifN media auto doesn't change the setting when
the previous media setting used autonego. When the mii_phy_setmedia()
function is called to change the media to IFM_AUTO, the BMCR_AUTOEN bit was
used to check if the previous setting was IFM_AUTO. It's not correct.
IFM_1000_T also uses autonego. So if a previous setting is IFM_1000_T and
the next setting is IFM_AUTO, mii_phy_auto() is not called if neither
MIIF_FORCEANEG nor MIIF_DOPAUSE are set. As a result, after changing
IFM_AUTO, neither 10Mbps nor 100Mbps are not advertised.

Note that almost all drivers uses MIIF_DOPAUSE flags.

TODO: cleanup ciphy.c and rgephy.c. Those have #ifdef foo.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/dev/mii/mii_physubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/mii_physubr.c
diff -u src/sys/dev/mii/mii_physubr.c:1.102 src/sys/dev/mii/mii_physubr.c:1.103
--- src/sys/dev/mii/mii_physubr.c:1.102	Wed Feb 22 08:09:09 2023
+++ src/sys/dev/mii/mii_physubr.c	Mon May 22 02:12:13 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii_physubr.c,v 1.102 2023/02/22 08:09:09 msaitoh Exp $	*/
+/*	$NetBSD: mii_physubr.c,v 1.103 2023/05/22 02:12:13 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.102 2023/02/22 08:09:09 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.103 2023/05/22 02:12:13 msaitoh Exp $");
 
 #include 
 #include 
@@ -138,22 +138,14 @@ mii_phy_setmedia(struct mii_softc *sc)
 {
 	struct mii_data *mii = sc->mii_pdata;
 	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
+	u_int subtype;
 	uint16_t bmcr, anar, gtcr;
 
 	KASSERT(mii_locked(mii));
 
-	if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) {
-		/*
-		 * Force renegotiation if MIIF_DOPAUSE.
-		 *
-		 * XXX This is only necessary because many NICs don't
-		 * XXX advertise PAUSE capabilities at boot time.  Maybe
-		 * XXX we should force this only once?
-		 */
-		PHY_READ(sc, MII_BMCR, );
-		if ((bmcr & BMCR_AUTOEN) == 0 ||
-		(sc->mii_flags & (MIIF_FORCEANEG | MIIF_DOPAUSE)))
-			(void) mii_phy_auto(sc);
+	subtype = IFM_SUBTYPE(ife->ifm_media);
+	if ((subtype == IFM_AUTO) || (subtype == IFM_1000_T)) {
+		(void) mii_phy_auto(sc);
 		return;
 	}
 
@@ -169,7 +161,7 @@ mii_phy_setmedia(struct mii_softc *sc)
 	gtcr = mii_media_table[ife->ifm_data].mm_gtcr;
 
 	if (mii->mii_media.ifm_media & IFM_ETH_MASTER) {
-		switch (IFM_SUBTYPE(ife->ifm_media)) {
+		switch (subtype) {
 		case IFM_1000_T:
 			gtcr |= GTCR_MAN_MS | GTCR_ADV_MS;
 			break;
@@ -198,10 +190,7 @@ mii_phy_setmedia(struct mii_softc *sc)
 	PHY_WRITE(sc, MII_ANAR, anar);
 	if (sc->mii_flags & MIIF_HAVE_GTCR)
 		PHY_WRITE(sc, MII_100T2CR, gtcr);
-	if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T)
-		mii_phy_auto(sc);
-	else
-		PHY_WRITE(sc, MII_BMCR, bmcr);
+	PHY_WRITE(sc, MII_BMCR, bmcr);
 }
 
 /* Setup autonegotiation and start it. */



CVS commit: src/sys/dev/mii

2023-05-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 22 02:12:13 UTC 2023

Modified Files:
src/sys/dev/mii: mii_physubr.c

Log Message:
Fix a bug when a media is changed to IFM_AUTO.

 Fix a bug that ifconfig ifN media auto doesn't change the setting when
the previous media setting used autonego. When the mii_phy_setmedia()
function is called to change the media to IFM_AUTO, the BMCR_AUTOEN bit was
used to check if the previous setting was IFM_AUTO. It's not correct.
IFM_1000_T also uses autonego. So if a previous setting is IFM_1000_T and
the next setting is IFM_AUTO, mii_phy_auto() is not called if neither
MIIF_FORCEANEG nor MIIF_DOPAUSE are set. As a result, after changing
IFM_AUTO, neither 10Mbps nor 100Mbps are not advertised.

Note that almost all drivers uses MIIF_DOPAUSE flags.

TODO: cleanup ciphy.c and rgephy.c. Those have #ifdef foo.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/dev/mii/mii_physubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2023-02-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 22 08:09:10 UTC 2023

Modified Files:
src/sys/dev/mii: atphy.c brgphy.c ciphy.c ipgphy.c jmphy.c
mii_physubr.c tlphy.c urlphy.c

Log Message:
Retry autonegotiation every mii_anegticks seconds instead of mii_anegticks+1.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/mii/atphy.c
cvs rdiff -u -r1.90 -r1.91 src/sys/dev/mii/brgphy.c
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/mii/ciphy.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/mii/ipgphy.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/mii/jmphy.c
cvs rdiff -u -r1.101 -r1.102 src/sys/dev/mii/mii_physubr.c
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/mii/tlphy.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/mii/urlphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/atphy.c
diff -u src/sys/dev/mii/atphy.c:1.30 src/sys/dev/mii/atphy.c:1.31
--- src/sys/dev/mii/atphy.c:1.30	Sun Mar 15 23:04:50 2020
+++ src/sys/dev/mii/atphy.c	Wed Feb 22 08:09:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: atphy.c,v 1.30 2020/03/15 23:04:50 thorpej Exp $ */
+/*	$NetBSD: atphy.c,v 1.31 2023/02/22 08:09:09 msaitoh Exp $ */
 /*	$OpenBSD: atphy.c,v 1.1 2008/09/25 20:47:16 brad Exp $	*/
 
 /*-
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.30 2020/03/15 23:04:50 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.31 2023/02/22 08:09:09 msaitoh Exp $");
 
 #include 
 #include 
@@ -323,7 +323,7 @@ done:
 			break;
 
 		/* Only retry autonegotiation every mii_anegticks seconds. */
-		if (sc->mii_ticks <= sc->mii_anegticks)
+		if (sc->mii_ticks < sc->mii_anegticks)
 			break;
 
 		atphy_mii_phy_auto(sc);

Index: src/sys/dev/mii/brgphy.c
diff -u src/sys/dev/mii/brgphy.c:1.90 src/sys/dev/mii/brgphy.c:1.91
--- src/sys/dev/mii/brgphy.c:1.90	Mon May 25 19:48:38 2020
+++ src/sys/dev/mii/brgphy.c	Wed Feb 22 08:09:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: brgphy.c,v 1.90 2020/05/25 19:48:38 jmcneill Exp $	*/
+/*	$NetBSD: brgphy.c,v 1.91 2023/02/22 08:09:09 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.90 2020/05/25 19:48:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.91 2023/02/22 08:09:09 msaitoh Exp $");
 
 #include 
 #include 
@@ -424,7 +424,7 @@ setit:
 
 		/* Only retry autonegotiation every mii_anegticks seconds. */
 		KASSERT(sc->mii_anegticks != 0);
-		if (sc->mii_ticks <= sc->mii_anegticks)
+		if (sc->mii_ticks < sc->mii_anegticks)
 			break;
 
 		brgphy_mii_phy_auto(sc);

Index: src/sys/dev/mii/ciphy.c
diff -u src/sys/dev/mii/ciphy.c:1.41 src/sys/dev/mii/ciphy.c:1.42
--- src/sys/dev/mii/ciphy.c:1.41	Mon Aug 24 04:23:41 2020
+++ src/sys/dev/mii/ciphy.c	Wed Feb 22 08:09:09 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ciphy.c,v 1.41 2020/08/24 04:23:41 msaitoh Exp $ */
+/* $NetBSD: ciphy.c,v 1.42 2023/02/22 08:09:09 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.41 2020/08/24 04:23:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.42 2023/02/22 08:09:09 msaitoh Exp $");
 
 /*
  * Driver for the Cicada CS8201 10/100/1000 copper PHY.
@@ -270,7 +270,7 @@ setit:
 			break;
 
 		/* Only retry autonegotiation every N seconds. */
-		if (sc->mii_ticks <= sc->mii_anegticks)
+		if (sc->mii_ticks < sc->mii_anegticks)
 			break;
 
 		mii_phy_auto_restart(sc);

Index: src/sys/dev/mii/ipgphy.c
diff -u src/sys/dev/mii/ipgphy.c:1.10 src/sys/dev/mii/ipgphy.c:1.11
--- src/sys/dev/mii/ipgphy.c:1.10	Sun Mar 15 23:04:50 2020
+++ src/sys/dev/mii/ipgphy.c	Wed Feb 22 08:09:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipgphy.c,v 1.10 2020/03/15 23:04:50 thorpej Exp $ */
+/*	$NetBSD: ipgphy.c,v 1.11 2023/02/22 08:09:09 msaitoh Exp $ */
 /*	$OpenBSD: ipgphy.c,v 1.19 2015/07/19 06:28:12 yuo Exp $	*/
 
 /*-
@@ -33,7 +33,7 @@
  * Driver for the IC Plus IP1000A/IP1001 10/100/1000 PHY.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipgphy.c,v 1.10 2020/03/15 23:04:50 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipgphy.c,v 1.11 2023/02/22 08:09:09 msaitoh Exp $");
 
 #include 
 #include 
@@ -237,7 +237,7 @@ done:
 			break;
 
 		/* Only retry autonegotiation every mii_anegticks seconds. */
-		if (sc->mii_ticks <= sc->mii_anegticks)
+		if (sc->mii_ticks < sc->mii_anegticks)
 			break;
 
 		sc->mii_ticks = 0;

Index: src/sys/dev/mii/jmphy.c
diff -u src/sys/dev/mii/jmphy.c:1.4 src/sys/dev/mii/jmphy.c:1.5
--- src/sys/dev/mii/jmphy.c:1.4	Sun Mar 15 23:04:50 2020
+++ src/sys/dev/mii/jmphy.c	Wed Feb 22 08:09:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: jmphy.c,v 1.4 2020/03/15 23:04:50 thorpej Exp $ */
+/*	$NetBSD: jmphy.c,v 1.5 2023/02/22 08:09:09 msaitoh Exp $ */
 /*	$OpenBSD: jmphy.c,v 1.6 2015/03/14 03:38:48 jsg Exp $	*/
 /*-
  * Copyright (c) 2008, Pyun YongHyeon 
@@ -174,7 +174,7 @@ jmphy_service(struct mii_softc 

CVS commit: src/sys/dev/mii

2023-02-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 22 08:09:10 UTC 2023

Modified Files:
src/sys/dev/mii: atphy.c brgphy.c ciphy.c ipgphy.c jmphy.c
mii_physubr.c tlphy.c urlphy.c

Log Message:
Retry autonegotiation every mii_anegticks seconds instead of mii_anegticks+1.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/mii/atphy.c
cvs rdiff -u -r1.90 -r1.91 src/sys/dev/mii/brgphy.c
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/mii/ciphy.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/mii/ipgphy.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/mii/jmphy.c
cvs rdiff -u -r1.101 -r1.102 src/sys/dev/mii/mii_physubr.c
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/mii/tlphy.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/mii/urlphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2022-10-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Oct 31 22:45:13 UTC 2022

Modified Files:
src/sys/dev/mii: micphy.c

Log Message:
fix blank printf at attach


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/mii/micphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2022-10-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Oct 31 22:45:13 UTC 2022

Modified Files:
src/sys/dev/mii: micphy.c

Log Message:
fix blank printf at attach


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/mii/micphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/micphy.c
diff -u src/sys/dev/mii/micphy.c:1.14 src/sys/dev/mii/micphy.c:1.15
--- src/sys/dev/mii/micphy.c:1.14	Sat Mar 28 18:37:18 2020
+++ src/sys/dev/mii/micphy.c	Mon Oct 31 22:45:13 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: micphy.c,v 1.14 2020/03/28 18:37:18 thorpej Exp $	*/
+/*	$NetBSD: micphy.c,v 1.15 2022/10/31 22:45:13 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: micphy.c,v 1.14 2020/03/28 18:37:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: micphy.c,v 1.15 2022/10/31 22:45:13 jmcneill Exp $");
 
 #include "opt_mii.h"
 
@@ -244,9 +244,7 @@ micphyattach(device_t parent, device_t s
 
 	mii_unlock(mii);
 
-	aprint_normal_dev(self, "");
 	mii_phy_add_media(sc);
-	aprint_normal("\n");
 }
 
 static void



CVS commit: src/sys/dev/mii

2022-08-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Aug 23 01:05:50 UTC 2022

Modified Files:
src/sys/dev/mii: mii_physubr.c

Log Message:
mii(9): Make mii_phy_down clear the flag if it prevented the callout.

This fixes a bug in the previous change to make mii_down wait for the
mii auto timeout to complete.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/dev/mii/mii_physubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2022-08-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Aug 23 01:05:50 UTC 2022

Modified Files:
src/sys/dev/mii: mii_physubr.c

Log Message:
mii(9): Make mii_phy_down clear the flag if it prevented the callout.

This fixes a bug in the previous change to make mii_down wait for the
mii auto timeout to complete.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/dev/mii/mii_physubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/mii_physubr.c
diff -u src/sys/dev/mii/mii_physubr.c:1.100 src/sys/dev/mii/mii_physubr.c:1.101
--- src/sys/dev/mii/mii_physubr.c:1.100	Sat Aug 20 11:12:46 2022
+++ src/sys/dev/mii/mii_physubr.c	Tue Aug 23 01:05:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii_physubr.c,v 1.100 2022/08/20 11:12:46 riastradh Exp $	*/
+/*	$NetBSD: mii_physubr.c,v 1.101 2022/08/23 01:05:50 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.100 2022/08/20 11:12:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.101 2022/08/23 01:05:50 riastradh Exp $");
 
 #include 
 #include 
@@ -441,9 +441,15 @@ mii_phy_down(struct mii_softc *sc)
 			sc->mii_pdata->mii_media.ifm_lock);
 		}
 	} else {
-		if (sc->mii_flags & MIIF_DOINGAUTO) {
-			callout_halt(>mii_nway_ch,
-			sc->mii_pdata->mii_media.ifm_lock);
+		if ((sc->mii_flags & MIIF_DOINGAUTO) != 0 &&
+		callout_halt(>mii_nway_ch,
+			sc->mii_pdata->mii_media.ifm_lock) == 0) {
+			/*
+			 * The callout was scheduled, and we prevented
+			 * it from running before it expired, so we are
+			 * now responsible for clearing the flag.
+			 */
+			sc->mii_flags &= ~MIIF_DOINGAUTO;
 		}
 	}
 	KASSERT((sc->mii_flags & MIIF_DOINGAUTO) == 0);



CVS commit: src/sys/dev/mii

2022-08-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug 20 11:12:46 UTC 2022

Modified Files:
src/sys/dev/mii: mii_physubr.c

Log Message:
mii(4): Make mii_down wait for concurrent mii_phy_auto to finish.

This is important for callers in if_stop routines to guarantee that
all concurrent access to the mii registers has ended.

Drivers must not call this from softint context.  Drivers with custom
watchdog timers (not if_watchdog) that do if_stop from callout must
defer to thread context instead, e.g. via workqueue(9) -- as they
should be doing anyway for heavyweight operations like if_stop.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/mii/mii_physubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/mii_physubr.c
diff -u src/sys/dev/mii/mii_physubr.c:1.99 src/sys/dev/mii/mii_physubr.c:1.100
--- src/sys/dev/mii/mii_physubr.c:1.99	Sun Aug 14 20:34:26 2022
+++ src/sys/dev/mii/mii_physubr.c	Sat Aug 20 11:12:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii_physubr.c,v 1.99 2022/08/14 20:34:26 riastradh Exp $	*/
+/*	$NetBSD: mii_physubr.c,v 1.100 2022/08/20 11:12:46 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.99 2022/08/14 20:34:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.100 2022/08/20 11:12:46 riastradh Exp $");
 
 #include 
 #include 
@@ -435,23 +435,18 @@ mii_phy_down(struct mii_softc *sc)
 
 	KASSERT(mii_locked(sc->mii_pdata));
 
-	if ((sc->mii_flags & (MIIF_DOINGAUTO|MIIF_AUTOTSLEEP)) ==
-	(MIIF_DOINGAUTO|MIIF_AUTOTSLEEP)) {
-		/*
-		 * Try to stop it.
-		 *
-		 * - If we stopped it before it expired, callout_stop
-		 *   returns 0, and it is our responsibility to clear
-		 *   MIIF_DOINGAUTO.
-		 *
-		 * - Otherwise, we're too late -- the callout has
-		 *   already begun, and we must leave MIIF_DOINGAUTO
-		 *   set so mii_phy_detach will wait for it to
-		 *   complete.
-		 */
-		if (!callout_stop(>mii_nway_ch))
-			sc->mii_flags &= ~MIIF_DOINGAUTO;
+	if (sc->mii_flags & MIIF_AUTOTSLEEP) {
+		while (sc->mii_flags & MIIF_DOINGAUTO) {
+			cv_wait(>mii_nway_cv,
+			sc->mii_pdata->mii_media.ifm_lock);
+		}
+	} else {
+		if (sc->mii_flags & MIIF_DOINGAUTO) {
+			callout_halt(>mii_nway_ch,
+			sc->mii_pdata->mii_media.ifm_lock);
+		}
 	}
+	KASSERT((sc->mii_flags & MIIF_DOINGAUTO) == 0);
 }
 
 void
@@ -691,19 +686,8 @@ mii_phy_detach(device_t self, int flags)
 {
 	struct mii_softc *sc = device_private(self);
 
-	mii_lock(sc->mii_pdata);
-	if (sc->mii_flags & MIIF_AUTOTSLEEP) {
-		while (sc->mii_flags & MIIF_DOINGAUTO) {
-			cv_wait(>mii_nway_cv,
-			sc->mii_pdata->mii_media.ifm_lock);
-		}
-	} else {
-		if (sc->mii_flags & MIIF_DOINGAUTO) {
-			callout_halt(>mii_nway_ch,
-			sc->mii_pdata->mii_media.ifm_lock);
-		}
-	}
-	mii_unlock(sc->mii_pdata);
+	/* No mii_lock because mii_flags should be stable by now.  */
+	KASSERT((sc->mii_flags & MIIF_DOINGAUTO) == 0);
 
 	if (sc->mii_flags & MIIF_AUTOTSLEEP)
 		cv_destroy(>mii_nway_cv);



CVS commit: src/sys/dev/mii

2022-08-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug 20 11:12:46 UTC 2022

Modified Files:
src/sys/dev/mii: mii_physubr.c

Log Message:
mii(4): Make mii_down wait for concurrent mii_phy_auto to finish.

This is important for callers in if_stop routines to guarantee that
all concurrent access to the mii registers has ended.

Drivers must not call this from softint context.  Drivers with custom
watchdog timers (not if_watchdog) that do if_stop from callout must
defer to thread context instead, e.g. via workqueue(9) -- as they
should be doing anyway for heavyweight operations like if_stop.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/mii/mii_physubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2022-08-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 14 20:34:26 UTC 2022

Modified Files:
src/sys/dev/mii: mii.c mii_physubr.c miivar.h

Log Message:
mii(4): Wait for MIIF_DOINGAUTO to clear with MIIF_AUTOTSLEEP too.

Otherwise mii_phy_detach may return while mii_phy_auto_timeout_locked
is still in progress in another thread.

Reuse the storage for mii_nway_ch, which is unused if MIIF_AUTOTSLEEP
is set, for a new condvar in a union.  This doesn't change the kernel
ABI because sizeof(struct kcondvar) <= sizeof(struct callout) and
both have the same alignment, for an array of void *.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/mii/mii.c
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/mii/mii_physubr.c
cvs rdiff -u -r1.74 -r1.75 src/sys/dev/mii/miivar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/mii.c
diff -u src/sys/dev/mii/mii.c:1.57 src/sys/dev/mii/mii.c:1.58
--- src/sys/dev/mii/mii.c:1.57	Sat Aug  7 16:19:13 2021
+++ src/sys/dev/mii/mii.c	Sun Aug 14 20:34:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii.c,v 1.57 2021/08/07 16:19:13 thorpej Exp $	*/
+/*	$NetBSD: mii.c,v 1.58 2022/08/14 20:34:26 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mii.c,v 1.57 2021/08/07 16:19:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii.c,v 1.58 2022/08/14 20:34:26 riastradh Exp $");
 
 #define	__IFMEDIA_PRIVATE
 
@@ -179,7 +179,10 @@ mii_attach(device_t parent, struct mii_d
 	.locators = locs)));
 		if (child) {
 			/* Link it up in the parent's MII data. */
-			callout_init(>mii_nway_ch, 0);
+			if (child->mii_flags & MIIF_AUTOTSLEEP)
+cv_init(>mii_nway_cv, "miiauto");
+			else
+callout_init(>mii_nway_ch, 0);
 			mii_lock(mii);
 			LIST_INSERT_HEAD(>mii_phys, child, mii_list);
 			child->mii_offset = offset;

Index: src/sys/dev/mii/mii_physubr.c
diff -u src/sys/dev/mii/mii_physubr.c:1.98 src/sys/dev/mii/mii_physubr.c:1.99
--- src/sys/dev/mii/mii_physubr.c:1.98	Sun Aug 14 20:33:57 2022
+++ src/sys/dev/mii/mii_physubr.c	Sun Aug 14 20:34:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii_physubr.c,v 1.98 2022/08/14 20:33:57 riastradh Exp $	*/
+/*	$NetBSD: mii_physubr.c,v 1.99 2022/08/14 20:34:26 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.98 2022/08/14 20:33:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.99 2022/08/14 20:34:26 riastradh Exp $");
 
 #include 
 #include 
@@ -282,6 +282,8 @@ mii_phy_auto(struct mii_softc *sc)
 		sc->mii_flags |= MIIF_DOINGAUTO;
 		kpause("miiaut", false, hz >> 1, mii->mii_media.ifm_lock);
 		mii_phy_auto_timeout_locked(sc);
+		KASSERT((sc->mii_flags & MIIF_DOINGAUTO) == 0);
+		cv_broadcast(>mii_nway_cv);
 	} else if ((sc->mii_flags & MIIF_DOINGAUTO) == 0) {
 		sc->mii_flags |= MIIF_DOINGAUTO;
 		callout_reset(>mii_nway_ch, hz >> 1,
@@ -309,6 +311,7 @@ mii_phy_auto_timeout_locked(struct mii_s
 {
 
 	KASSERT(mii_locked(sc->mii_pdata));
+	KASSERT(sc->mii_flags & MIIF_DOINGAUTO);
 
 	if (!device_is_active(sc->mii_dev))
 		return;
@@ -432,7 +435,8 @@ mii_phy_down(struct mii_softc *sc)
 
 	KASSERT(mii_locked(sc->mii_pdata));
 
-	if (sc->mii_flags & MIIF_DOINGAUTO) {
+	if ((sc->mii_flags & (MIIF_DOINGAUTO|MIIF_AUTOTSLEEP)) ==
+	(MIIF_DOINGAUTO|MIIF_AUTOTSLEEP)) {
 		/*
 		 * Try to stop it.
 		 *
@@ -688,13 +692,23 @@ mii_phy_detach(device_t self, int flags)
 	struct mii_softc *sc = device_private(self);
 
 	mii_lock(sc->mii_pdata);
-	if (sc->mii_flags & MIIF_DOINGAUTO) {
-		callout_halt(>mii_nway_ch,
-		sc->mii_pdata->mii_media.ifm_lock);
+	if (sc->mii_flags & MIIF_AUTOTSLEEP) {
+		while (sc->mii_flags & MIIF_DOINGAUTO) {
+			cv_wait(>mii_nway_cv,
+			sc->mii_pdata->mii_media.ifm_lock);
+		}
+	} else {
+		if (sc->mii_flags & MIIF_DOINGAUTO) {
+			callout_halt(>mii_nway_ch,
+			sc->mii_pdata->mii_media.ifm_lock);
+		}
 	}
 	mii_unlock(sc->mii_pdata);
 
-	callout_destroy(>mii_nway_ch);
+	if (sc->mii_flags & MIIF_AUTOTSLEEP)
+		cv_destroy(>mii_nway_cv);
+	else
+		callout_destroy(>mii_nway_ch);
 
 	mii_phy_delete_media(sc);
 

Index: src/sys/dev/mii/miivar.h
diff -u src/sys/dev/mii/miivar.h:1.74 src/sys/dev/mii/miivar.h:1.75
--- src/sys/dev/mii/miivar.h:1.74	Tue Jun 29 21:03:36 2021
+++ src/sys/dev/mii/miivar.h	Sun Aug 14 20:34:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: miivar.h,v 1.74 2021/06/29 21:03:36 pgoyette Exp $	*/
+/*	$NetBSD: miivar.h,v 1.75 2022/08/14 20:34:26 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2020 The NetBSD Foundation, Inc.
@@ -150,7 +150,10 @@ struct mii_softc {
 	int mii_ticks;			/* m: MII_TICK counter */
 	int mii_anegticks;		/* m: ticks before retrying aneg */
 
-	struct callout mii_nway_ch;	/* m: NWAY callout */
+	union {
+		struct 

CVS commit: src/sys/dev/mii

2022-08-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 14 20:34:26 UTC 2022

Modified Files:
src/sys/dev/mii: mii.c mii_physubr.c miivar.h

Log Message:
mii(4): Wait for MIIF_DOINGAUTO to clear with MIIF_AUTOTSLEEP too.

Otherwise mii_phy_detach may return while mii_phy_auto_timeout_locked
is still in progress in another thread.

Reuse the storage for mii_nway_ch, which is unused if MIIF_AUTOTSLEEP
is set, for a new condvar in a union.  This doesn't change the kernel
ABI because sizeof(struct kcondvar) <= sizeof(struct callout) and
both have the same alignment, for an array of void *.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/mii/mii.c
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/mii/mii_physubr.c
cvs rdiff -u -r1.74 -r1.75 src/sys/dev/mii/miivar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2022-08-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 14 20:33:57 UTC 2022

Modified Files:
src/sys/dev/mii: mii_physubr.c

Log Message:
mii(4): Sprinkle assertions in mii phy auto timeout.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/mii/mii_physubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2022-08-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 14 20:33:57 UTC 2022

Modified Files:
src/sys/dev/mii: mii_physubr.c

Log Message:
mii(4): Sprinkle assertions in mii phy auto timeout.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/mii/mii_physubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/mii_physubr.c
diff -u src/sys/dev/mii/mii_physubr.c:1.97 src/sys/dev/mii/mii_physubr.c:1.98
--- src/sys/dev/mii/mii_physubr.c:1.97	Tue Dec 28 12:00:48 2021
+++ src/sys/dev/mii/mii_physubr.c	Sun Aug 14 20:33:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii_physubr.c,v 1.97 2021/12/28 12:00:48 riastradh Exp $	*/
+/*	$NetBSD: mii_physubr.c,v 1.98 2022/08/14 20:33:57 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.97 2021/12/28 12:00:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.98 2022/08/14 20:33:57 riastradh Exp $");
 
 #include 
 #include 
@@ -308,6 +308,8 @@ static void
 mii_phy_auto_timeout_locked(struct mii_softc *sc)
 {
 
+	KASSERT(mii_locked(sc->mii_pdata));
+
 	if (!device_is_active(sc->mii_dev))
 		return;
 
@@ -322,6 +324,8 @@ mii_phy_auto_timeout(void *arg)
 {
 	struct mii_softc *sc = arg;
 
+	KASSERT((sc->mii_flags & MIIF_AUTOTSLEEP) == 0);
+
 	if (!device_is_active(sc->mii_dev))
 		return;
 



CVS commit: src/sys/dev/mii

2022-01-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jan  8 17:35:05 UTC 2022

Modified Files:
src/sys/dev/mii: urlphy.c

Log Message:
urlphy(4): Fix missing mii locking in urlphy_attach.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/mii/urlphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/urlphy.c
diff -u src/sys/dev/mii/urlphy.c:1.38 src/sys/dev/mii/urlphy.c:1.39
--- src/sys/dev/mii/urlphy.c:1.38	Mon Aug 24 04:49:05 2020
+++ src/sys/dev/mii/urlphy.c	Sat Jan  8 17:35:05 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: urlphy.c,v 1.38 2020/08/24 04:49:05 msaitoh Exp $	*/
+/*	$NetBSD: urlphy.c,v 1.39 2022/01/08 17:35:05 riastradh Exp $	*/
 /*
  * Copyright (c) 2001, 2002
  * Shingo WATANABE .  All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.38 2020/08/24 04:49:05 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.39 2022/01/08 17:35:05 riastradh Exp $");
 
 #include 
 #include 
@@ -118,11 +118,16 @@ urlphy_attach(device_t parent, device_t 
 		"ignoring this PHY, non-zero instance\n");
 		return;
 	}
+
+	mii_lock(mii);
+
 	PHY_RESET(sc);
 
 	PHY_READ(sc, MII_BMSR, >mii_capabilities);
 	sc->mii_capabilities &= ma->mii_capmask;
 
+	mii_unlock(mii);
+
 	mii_phy_add_media(sc);
 }
 



CVS commit: src/sys/dev/mii

2022-01-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jan  8 17:35:05 UTC 2022

Modified Files:
src/sys/dev/mii: urlphy.c

Log Message:
urlphy(4): Fix missing mii locking in urlphy_attach.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/mii/urlphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2022-01-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jan  6 07:39:10 UTC 2022

Modified Files:
src/sys/dev/mii: makphy.c makphyvar.h

Log Message:
QEMU e1000's PHY code doesn't reflect the PSSR_LINK bit. Do workaround.

   IEEE 802.3 clause 22's PHY device has a link status bit in the BMCR
  register, but it's required to read twice to get the correct value.
  Almost all PHY devices have the vendor specific register which has
  the link status bit that it's not required to read twice. makphy(4)
  use the bit in the PSSR register to reduce the access cost.

   QEMU's e1000 provides the PHY specific status register at 0x11 but the
  link indication bit (PSSR_LINK.) is always 1 because
  e1000x_update_regs_on_link_{down,up}() modify MII_SR_LINK_STATUS
  (BMSR_LINK in NetBSD) but don't modify PSSR_LINK. It causes
  "virsh domif-setlink xxx yyy down" doesn't work.
  To avoid this problem, read the BMSR and check the BMSR_LINK bit. Add
  MAKPHY_QUIRK_PSSR_LINK bit for this quirk. Set it if MII_EXTSR doesn't
  exist because it's one of the case of QEMU.

  Found and tested by ozaki-r.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/mii/makphy.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/mii/makphyvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2022-01-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jan  6 07:39:10 UTC 2022

Modified Files:
src/sys/dev/mii: makphy.c makphyvar.h

Log Message:
QEMU e1000's PHY code doesn't reflect the PSSR_LINK bit. Do workaround.

   IEEE 802.3 clause 22's PHY device has a link status bit in the BMCR
  register, but it's required to read twice to get the correct value.
  Almost all PHY devices have the vendor specific register which has
  the link status bit that it's not required to read twice. makphy(4)
  use the bit in the PSSR register to reduce the access cost.

   QEMU's e1000 provides the PHY specific status register at 0x11 but the
  link indication bit (PSSR_LINK.) is always 1 because
  e1000x_update_regs_on_link_{down,up}() modify MII_SR_LINK_STATUS
  (BMSR_LINK in NetBSD) but don't modify PSSR_LINK. It causes
  "virsh domif-setlink xxx yyy down" doesn't work.
  To avoid this problem, read the BMSR and check the BMSR_LINK bit. Add
  MAKPHY_QUIRK_PSSR_LINK bit for this quirk. Set it if MII_EXTSR doesn't
  exist because it's one of the case of QEMU.

  Found and tested by ozaki-r.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/mii/makphy.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/mii/makphyvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/makphy.c
diff -u src/sys/dev/mii/makphy.c:1.71 src/sys/dev/mii/makphy.c:1.72
--- src/sys/dev/mii/makphy.c:1.71	Tue Dec 28 06:36:29 2021
+++ src/sys/dev/mii/makphy.c	Thu Jan  6 07:39:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: makphy.c,v 1.71 2021/12/28 06:36:29 msaitoh Exp $	*/
+/*	$NetBSD: makphy.c,v 1.72 2022/01/06 07:39:10 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.71 2021/12/28 06:36:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.72 2022/01/06 07:39:10 msaitoh Exp $");
 
 #include 
 #include 
@@ -216,6 +216,12 @@ page0:
 			"Regard as 1000BASE-T.\n");
 			sc->mii_extcapabilities
 			|= EXTSR_1000TFDX | EXTSR_1000THDX;
+
+			/*
+			 * Also assume it doesn't support PSSR_LINK bit.
+			 * It's for QEMU.
+			 */
+			maksc->sc_flags |= MAKPHY_QUIRK_PSSR_LINK;
 		}
 	}
 
@@ -438,6 +444,7 @@ makphy_service(struct mii_softc *sc, str
 static void
 makphy_status(struct mii_softc *sc)
 {
+	struct makphy_softc *maksc = (struct makphy_softc *)sc;
 	struct mii_data *mii = sc->mii_pdata;
 	uint16_t bmcr, gsr, pssr, essr;
 
@@ -450,6 +457,23 @@ makphy_status(struct mii_softc *sc)
 	/* XXX FIXME: Use different page for Fiber on newer chips */
 	PHY_READ(sc, MAKPHY_PSSR, );
 
+	if ((maksc->sc_flags & MAKPHY_QUIRK_PSSR_LINK) != 0) {
+		uint16_t bmsr;
+
+		/*
+		 * QEMU e1000 driver has the PSSR register but it doesn't
+		 * support the PSSR_LINK bit well. It always returns 1.
+		 * To avoid this problem, use the BMSR_LINK bit. It's not
+		 * required to read it twice as real device because it's not
+		 * latched.
+		 */
+		PHY_READ(sc, MII_BMSR, );
+		if (bmsr & BMSR_LINK)
+			pssr |= MAKPHY_PSSR_LINK;
+		else
+			pssr &= ~MAKPHY_PSSR_LINK;
+	}
+
 	if (pssr & MAKPHY_PSSR_LINK)
 		mii->mii_media_status |= IFM_ACTIVE;
 
@@ -488,8 +512,6 @@ makphy_status(struct mii_softc *sc)
 		mii->mii_media_active |= IFM_1000_SX;
 	} else if ((sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1011) ||
 	(sc->mii_mpd_model == MII_MODEL_xxMARVELL_E)) {
-		struct makphy_softc *maksc = (struct makphy_softc *)sc;
-
 		if ((maksc->sc_flags & MAKPHY_F_FICO_AUTOSEL) != 0) {
 			/* Fiber/Copper auto select mode */
 			PHY_READ(sc, MAKPHY_ESSR, );

Index: src/sys/dev/mii/makphyvar.h
diff -u src/sys/dev/mii/makphyvar.h:1.3 src/sys/dev/mii/makphyvar.h:1.4
--- src/sys/dev/mii/makphyvar.h:1.3	Tue Dec 28 06:36:29 2021
+++ src/sys/dev/mii/makphyvar.h	Thu Jan  6 07:39:10 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: makphyvar.h,v 1.3 2021/12/28 06:36:29 msaitoh Exp $ */
+/* $NetBSD: makphyvar.h,v 1.4 2022/01/06 07:39:10 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -39,5 +39,9 @@ struct makphy_softc {
 
 #define MAKPHY_F_I210		__BIT(0) /* Identify I210 (mii_model == 0) */
 #define MAKPHY_F_FICO_AUTOSEL	__BIT(1) /* Fiber/Copper autoselect mode */
+#define MAKPHY_QUIRK_PSSR_LINK	__BIT(2) /*
+	  * For emulator which doesn't support
+	  * PSSR_LINK (e.g. QEMU).
+	  */
 
 #endif /* _MII_MAKPHYVAR_H_ */



CVS commit: src/sys/dev/mii

2022-01-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jan  3 17:18:12 UTC 2022

Modified Files:
src/sys/dev/mii: files.mii
Added Files:
src/sys/dev/mii: mcommphy.c

Log Message:
Add driver for Motorcomm YT8511 GbE PHY


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/mii/files.mii
cvs rdiff -u -r0 -r1.1 src/sys/dev/mii/mcommphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2022-01-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jan  3 17:18:12 UTC 2022

Modified Files:
src/sys/dev/mii: files.mii
Added Files:
src/sys/dev/mii: mcommphy.c

Log Message:
Add driver for Motorcomm YT8511 GbE PHY


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/mii/files.mii
cvs rdiff -u -r0 -r1.1 src/sys/dev/mii/mcommphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/files.mii
diff -u src/sys/dev/mii/files.mii:1.54 src/sys/dev/mii/files.mii:1.55
--- src/sys/dev/mii/files.mii:1.54	Wed Dec 11 02:22:38 2019
+++ src/sys/dev/mii/files.mii	Mon Jan  3 17:18:12 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: files.mii,v 1.54 2019/12/11 02:22:38 msaitoh Exp $
+#	$NetBSD: files.mii,v 1.55 2022/01/03 17:18:12 jmcneill Exp $
 
 defflag	opt_mii.h	MIIVERBOSE
 
@@ -170,3 +170,7 @@ file	dev/mii/micphy.c			micphy
 device	smscphy: mii_phy
 attach	smscphy at mii
 file	dev/mii/smscphy.c			smscphy
+
+device	mcommphy: mii_phy, ukphy_subr
+attach	mcommphy at mii
+file	dev/mii/mcommphy.c			mcommphy

Added files:

Index: src/sys/dev/mii/mcommphy.c
diff -u /dev/null src/sys/dev/mii/mcommphy.c:1.1
--- /dev/null	Mon Jan  3 17:18:12 2022
+++ src/sys/dev/mii/mcommphy.c	Mon Jan  3 17:18:12 2022
@@ -0,0 +1,200 @@
+/* $NetBSD: mcommphy.c,v 1.1 2022/01/03 17:18:12 jmcneill Exp $ */
+
+/*
+ * Copyright (c) 2022 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Motorcomm YT8511C / YT8511H Integrated 10/100/1000 Gigabit Ethernet
+ * Transceiver.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: mcommphy.c,v 1.1 2022/01/03 17:18:12 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define	MCOMMPHY_OUI			0x00
+#define	MCOMMPHY_MODEL			0x10
+#define	MCOMMPHY_REV			0x0a
+
+#define	EXT_REG_ADDR			0x1e
+#define	EXT_REG_DATA			0x1f
+
+/* Extended registers */
+#define	PHY_CLOCK_GATING_REG		0x0c
+#define	 TX_CLK_DELAY_SEL		__BITS(7,4)
+#define	 CLK_25M_SEL			__BITS(2,1)
+#define	 CLK_25M_SEL_125M		3
+#define	 RX_CLK_DELAY_EN		__BIT(0)
+#define	PHY_SLEEP_CONTROL1_REG		0x27
+#define	 PLLON_IN_SLP			__BIT(14)
+
+static int	mcommphymatch(device_t, cfdata_t, void *);
+static void	mcommphyattach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(mcommphy, sizeof(struct mii_softc),
+mcommphymatch, mcommphyattach, mii_phy_detach, mii_phy_activate);
+
+static int	mcommphy_service(struct mii_softc *, struct mii_data *, int);
+
+static const struct mii_phy_funcs mcommphy_funcs = {
+	mcommphy_service, ukphy_status, mii_phy_reset,
+};
+
+static int
+mcommphymatch(device_t parent, cfdata_t match, void *aux)
+{
+	struct mii_attach_args *ma = aux;
+
+	/*
+	 * The YT8511C reports an OUI of 0. Best we can do here is to match
+	 * exactly the contents of the PHY identification registers.
+	 */
+	if (MII_OUI(ma->mii_id1, ma->mii_id2) == MCOMMPHY_OUI &&
+	MII_MODEL(ma->mii_id2) == MCOMMPHY_MODEL &&
+	MII_REV(ma->mii_id2) == MCOMMPHY_REV) {
+		return 10;
+	}
+
+	return 0;
+}
+
+static void
+mcommphyattach(device_t parent, device_t self, void *aux)
+{
+	struct mii_softc *sc = device_private(self);
+	struct mii_attach_args *ma = aux;
+	struct mii_data *mii = ma->mii_data;
+	uint16_t oldaddr, data;
+
+	aprint_normal(": Motorcomm YT8511 GbE PHY\n");
+	aprint_naive(": Media interface\n");
+
+	sc->mii_dev = self;
+	sc->mii_inst = mii->mii_instance;
+	sc->mii_phy = ma->mii_phyno;
+	sc->mii_mpd_oui = MII_OUI(ma->mii_id1, ma->mii_id2);
+	sc->mii_mpd_model = MII_MODEL(ma->mii_id2);
+	sc->mii_mpd_rev = 

CVS commit: src/sys/dev/mii

2021-12-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Dec 28 12:00:48 UTC 2021

Modified Files:
src/sys/dev/mii: mii_physubr.c

Log Message:
mii(9): Fix callout race between mii_phy_down and mii_phy_detach.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/mii/mii_physubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/mii_physubr.c
diff -u src/sys/dev/mii/mii_physubr.c:1.96 src/sys/dev/mii/mii_physubr.c:1.97
--- src/sys/dev/mii/mii_physubr.c:1.96	Wed Dec 15 08:28:22 2021
+++ src/sys/dev/mii/mii_physubr.c	Tue Dec 28 12:00:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii_physubr.c,v 1.96 2021/12/15 08:28:22 msaitoh Exp $	*/
+/*	$NetBSD: mii_physubr.c,v 1.97 2021/12/28 12:00:48 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.96 2021/12/15 08:28:22 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.97 2021/12/28 12:00:48 riastradh Exp $");
 
 #include 
 #include 
@@ -429,8 +429,20 @@ mii_phy_down(struct mii_softc *sc)
 	KASSERT(mii_locked(sc->mii_pdata));
 
 	if (sc->mii_flags & MIIF_DOINGAUTO) {
-		sc->mii_flags &= ~MIIF_DOINGAUTO;
-		callout_stop(>mii_nway_ch);
+		/*
+		 * Try to stop it.
+		 *
+		 * - If we stopped it before it expired, callout_stop
+		 *   returns 0, and it is our responsibility to clear
+		 *   MIIF_DOINGAUTO.
+		 *
+		 * - Otherwise, we're too late -- the callout has
+		 *   already begun, and we must leave MIIF_DOINGAUTO
+		 *   set so mii_phy_detach will wait for it to
+		 *   complete.
+		 */
+		if (!callout_stop(>mii_nway_ch))
+			sc->mii_flags &= ~MIIF_DOINGAUTO;
 	}
 }
 



CVS commit: src/sys/dev/mii

2021-12-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Dec 28 12:00:48 UTC 2021

Modified Files:
src/sys/dev/mii: mii_physubr.c

Log Message:
mii(9): Fix callout race between mii_phy_down and mii_phy_detach.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/mii/mii_physubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2021-12-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Dec 28 06:36:30 UTC 2021

Modified Files:
src/sys/dev/mii: makphy.c makphyvar.h

Log Message:
Reduce the access of the ESSR register.

 - makphyattach() have a code to detect the Fiber/Copper auto selection
   feature. Save the info to sc_flags to reduce the access
   to the ESSR register. One of the reason is that the register is not
   implemented on QEMU. Another reason is that it's not required to
   access the register if the device is in the copper only mode.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/mii/makphy.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/mii/makphyvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/makphy.c
diff -u src/sys/dev/mii/makphy.c:1.70 src/sys/dev/mii/makphy.c:1.71
--- src/sys/dev/mii/makphy.c:1.70	Tue Dec 28 06:35:37 2021
+++ src/sys/dev/mii/makphy.c	Tue Dec 28 06:36:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: makphy.c,v 1.70 2021/12/28 06:35:37 msaitoh Exp $	*/
+/*	$NetBSD: makphy.c,v 1.71 2021/12/28 06:36:29 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.70 2021/12/28 06:35:37 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.71 2021/12/28 06:36:29 msaitoh Exp $");
 
 #include 
 #include 
@@ -259,7 +259,8 @@ page0:
 default:
 	break;
 }
-			}
+			} else
+maksc->sc_flags |= MAKPHY_F_FICO_AUTOSEL;
 			break;
 		default:
 			break;
@@ -487,14 +488,19 @@ makphy_status(struct mii_softc *sc)
 		mii->mii_media_active |= IFM_1000_SX;
 	} else if ((sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1011) ||
 	(sc->mii_mpd_model == MII_MODEL_xxMARVELL_E)) {
-		/* Fiber/Copper auto select mode */
+		struct makphy_softc *maksc = (struct makphy_softc *)sc;
 
-		PHY_READ(sc, MAKPHY_ESSR, );
-		if ((essr & ESSR_FIBER_LINK) == 0)
+		if ((maksc->sc_flags & MAKPHY_F_FICO_AUTOSEL) != 0) {
+			/* Fiber/Copper auto select mode */
+			PHY_READ(sc, MAKPHY_ESSR, );
+			if ((essr & ESSR_FIBER_LINK) == 0)
+goto copper;
+			else {
+/* Regard as 1000BASE-SX */
+mii->mii_media_active |= IFM_1000_SX;
+			}
+		} else
 			goto copper;
-
-		/* XXX Assume 1000BASE-SX only */
-		mii->mii_media_active |= IFM_1000_SX;
 	} else if (sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1112) {
 		/* Fiber/Copper auto select mode */
 

Index: src/sys/dev/mii/makphyvar.h
diff -u src/sys/dev/mii/makphyvar.h:1.2 src/sys/dev/mii/makphyvar.h:1.3
--- src/sys/dev/mii/makphyvar.h:1.2	Mon Mar 25 06:17:56 2019
+++ src/sys/dev/mii/makphyvar.h	Tue Dec 28 06:36:29 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: makphyvar.h,v 1.2 2019/03/25 06:17:56 msaitoh Exp $ */
+/* $NetBSD: makphyvar.h,v 1.3 2021/12/28 06:36:29 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -37,6 +37,7 @@ struct makphy_softc {
 	uint32_t sc_flags;
 };
 
-#define MAKPHY_F_I210	__BIT(0)	/* Identify I210 (mii_model == 0) */
+#define MAKPHY_F_I210		__BIT(0) /* Identify I210 (mii_model == 0) */
+#define MAKPHY_F_FICO_AUTOSEL	__BIT(1) /* Fiber/Copper autoselect mode */
 
 #endif /* _MII_MAKPHYVAR_H_ */



CVS commit: src/sys/dev/mii

2021-12-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Dec 28 06:36:30 UTC 2021

Modified Files:
src/sys/dev/mii: makphy.c makphyvar.h

Log Message:
Reduce the access of the ESSR register.

 - makphyattach() have a code to detect the Fiber/Copper auto selection
   feature. Save the info to sc_flags to reduce the access
   to the ESSR register. One of the reason is that the register is not
   implemented on QEMU. Another reason is that it's not required to
   access the register if the device is in the copper only mode.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/mii/makphy.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/mii/makphyvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2021-12-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Dec 28 06:35:37 UTC 2021

Modified Files:
src/sys/dev/mii: makphy.c

Log Message:
QEMU e1000's PHY code doesn't implement register 16. Do workaround.

 - Marvell 88E1[01]11 (and many other Marvell PHYs) have the Fiber/Copper
   auto selection feature. Our makphy(4) implement it but QEMU doesn't.
   If it fails, a garbage data is used in the attach function and unexpected
   media may be used. Fix this behavior by checking the return value of
   PHY_READ(MAKPHY_ESSR). If the access failed, the media is regarded
   as copper only. It's just a cosmetic change. It's not affected to the
   packet processing.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/mii/makphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/makphy.c
diff -u src/sys/dev/mii/makphy.c:1.69 src/sys/dev/mii/makphy.c:1.70
--- src/sys/dev/mii/makphy.c:1.69	Tue Dec 28 06:34:40 2021
+++ src/sys/dev/mii/makphy.c	Tue Dec 28 06:35:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: makphy.c,v 1.69 2021/12/28 06:34:40 msaitoh Exp $	*/
+/*	$NetBSD: makphy.c,v 1.70 2021/12/28 06:35:37 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.69 2021/12/28 06:34:40 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.70 2021/12/28 06:35:37 msaitoh Exp $");
 
 #include 
 #include 
@@ -230,8 +230,18 @@ page0:
 		case MII_MODEL_xxMARVELL_E1011:
 		case MII_MODEL_xxMARVELL_E:
 			/* These devices have ESSR register */
-			PHY_READ(sc, MAKPHY_ESSR, );
-			if ((reg & ESSR_AUTOSEL_DISABLE) != 0) {
+			rv = PHY_READ(sc, MAKPHY_ESSR, );
+			if (rv != 0) {
+/*
+ * XXX Emulator (e.g qemu) may not implement
+ * the ESSR register. If so, regard as copper
+ * media.
+ */
+copperonly = true;
+aprint_verbose_dev(self, "Failed to access "
+"ESSR. Are you an emulator? Regard as "
+"copper only media.\n");
+			} else if ((reg & ESSR_AUTOSEL_DISABLE) != 0) {
 switch (reg & ESSR_HWCFG_MODE) {
 case ESSR_RTBI_FIBER:
 case ESSR_RGMII_FIBER:



CVS commit: src/sys/dev/mii

2021-12-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Dec 28 06:34:40 UTC 2021

Modified Files:
src/sys/dev/mii: makphy.c

Log Message:
QEMU e1000's PHY code doesn't implement page 0 register 15. Do workaround.

 - The BMSR register bit 8 (BMSR_EXTSTAT) denote the existence of page 0
   register 15. qemu's e1000 sets BMSR_EXTSTAT but the access to register 15
   fails. It doesn't conforms to the IEEE standard. Our makphy automatically
   check the existence of 1000BASE-T or 1000BASE-SX by accessing the register
   15. If the access failed, neither 1000BASE-T nor 1000BASE-SX is set to
   the ability(mii_extcapabilities). Set EXTSR_1000TFDX and EXTSR_1000THDX
   if the access failed in the attach function. It's just a cosmetic change.
   It's not affected to the packet processing.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/mii/makphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/makphy.c
diff -u src/sys/dev/mii/makphy.c:1.68 src/sys/dev/mii/makphy.c:1.69
--- src/sys/dev/mii/makphy.c:1.68	Wed Nov  4 09:15:10 2020
+++ src/sys/dev/mii/makphy.c	Tue Dec 28 06:34:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: makphy.c,v 1.68 2020/11/04 09:15:10 msaitoh Exp $	*/
+/*	$NetBSD: makphy.c,v 1.69 2021/12/28 06:34:40 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.68 2020/11/04 09:15:10 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.69 2021/12/28 06:34:40 msaitoh Exp $");
 
 #include 
 #include 
@@ -160,6 +160,7 @@ makphyattach(device_t parent, device_t s
 	struct makphy_softc *maksc = (struct makphy_softc *)sc;
 	const char *name;
 	uint16_t reg, model;
+	int rv;
 
 	mpd = mii_phy_match(ma, makphys);
 	aprint_naive(": Media interface\n");
@@ -207,8 +208,16 @@ page0:
 
 	PHY_READ(sc, MII_BMSR, >mii_capabilities);
 	sc->mii_capabilities &= ma->mii_capmask;
-	if (sc->mii_capabilities & BMSR_EXTSTAT)
-		PHY_READ(sc, MII_EXTSR, >mii_extcapabilities);
+	if (sc->mii_capabilities & BMSR_EXTSTAT) {
+		rv = PHY_READ(sc, MII_EXTSR, >mii_extcapabilities);
+		if (rv != 0) {
+			aprint_verbose_dev(self, "Failed to read EXTSR. "
+			"Are you an emulator?. "
+			"Regard as 1000BASE-T.\n");
+			sc->mii_extcapabilities
+			|= EXTSR_1000TFDX | EXTSR_1000THDX;
+		}
+	}
 
 	if (((sc->mii_extcapabilities & (EXTSR_1000TFDX | EXTSR_1000THDX))
 		!= 0)



CVS commit: src/sys/dev/mii

2021-12-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Dec 28 06:34:40 UTC 2021

Modified Files:
src/sys/dev/mii: makphy.c

Log Message:
QEMU e1000's PHY code doesn't implement page 0 register 15. Do workaround.

 - The BMSR register bit 8 (BMSR_EXTSTAT) denote the existence of page 0
   register 15. qemu's e1000 sets BMSR_EXTSTAT but the access to register 15
   fails. It doesn't conforms to the IEEE standard. Our makphy automatically
   check the existence of 1000BASE-T or 1000BASE-SX by accessing the register
   15. If the access failed, neither 1000BASE-T nor 1000BASE-SX is set to
   the ability(mii_extcapabilities). Set EXTSR_1000TFDX and EXTSR_1000THDX
   if the access failed in the attach function. It's just a cosmetic change.
   It's not affected to the packet processing.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/mii/makphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2021-12-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Dec 15 08:28:22 UTC 2021

Modified Files:
src/sys/dev/mii: mii_physubr.c

Log Message:
Cosmetic change for the output of mii_get_descr().


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/mii/mii_physubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/mii_physubr.c
diff -u src/sys/dev/mii/mii_physubr.c:1.95 src/sys/dev/mii/mii_physubr.c:1.96
--- src/sys/dev/mii/mii_physubr.c:1.95	Tue Jun 29 21:03:36 2021
+++ src/sys/dev/mii/mii_physubr.c	Wed Dec 15 08:28:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii_physubr.c,v 1.95 2021/06/29 21:03:36 pgoyette Exp $	*/
+/*	$NetBSD: mii_physubr.c,v 1.96 2021/12/15 08:28:22 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.95 2021/06/29 21:03:36 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.96 2021/12/15 08:28:22 msaitoh Exp $");
 
 #include 
 #include 
@@ -79,7 +79,7 @@ mii_get_descr(char *descr, size_t len, u
 		strlcat(descr, temp, len);
 		return descr;
 	}
-	snprintf(descr, len, "oui 0x%6x model 0x%04x", oui, model);
+	snprintf(descr, len, "OUI 0x%06x model 0x%04x", oui, model);
 	return NULL;
 }
 



CVS commit: src/sys/dev/mii

2021-12-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Dec 15 08:28:22 UTC 2021

Modified Files:
src/sys/dev/mii: mii_physubr.c

Log Message:
Cosmetic change for the output of mii_get_descr().


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/mii/mii_physubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2021-11-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Nov  5 01:53:30 UTC 2021

Modified Files:
src/sys/dev/mii: ihphy.c

Log Message:
Don't power down the PHY when the interface goes down.

 - All of other PHY drivers don't power down the PHY. Do the same way.
 - At least, keeping the link is required for Intel AMT and WoL.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/mii/ihphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/ihphy.c
diff -u src/sys/dev/mii/ihphy.c:1.19 src/sys/dev/mii/ihphy.c:1.20
--- src/sys/dev/mii/ihphy.c:1.19	Wed Nov  4 09:15:10 2020
+++ src/sys/dev/mii/ihphy.c	Fri Nov  5 01:53:30 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ihphy.c,v 1.19 2020/11/04 09:15:10 msaitoh Exp $	*/
+/*	$NetBSD: ihphy.c,v 1.20 2021/11/05 01:53:30 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ihphy.c,v 1.19 2020/11/04 09:15:10 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ihphy.c,v 1.20 2021/11/05 01:53:30 msaitoh Exp $");
 
 #include 
 #include 
@@ -211,7 +211,6 @@ ihphy_service(struct mii_softc *sc, stru
 
 	case MII_DOWN:
 		mii_phy_down(sc);
-		PHY_WRITE(sc, MII_BMCR, BMCR_PDOWN);
 		return 0;
 	}
 



CVS commit: src/sys/dev/mii

2021-11-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Nov  5 01:53:30 UTC 2021

Modified Files:
src/sys/dev/mii: ihphy.c

Log Message:
Don't power down the PHY when the interface goes down.

 - All of other PHY drivers don't power down the PHY. Do the same way.
 - At least, keeping the link is required for Intel AMT and WoL.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/mii/ihphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2021-06-05 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Jun  5 22:45:03 UTC 2021

Modified Files:
src/sys/dev/mii: mii_verbose.c

Log Message:
Ooopppsss - typo!


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/mii/mii_verbose.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/mii_verbose.c
diff -u src/sys/dev/mii/mii_verbose.c:1.7 src/sys/dev/mii/mii_verbose.c:1.8
--- src/sys/dev/mii/mii_verbose.c:1.7	Sat Jun  5 22:21:15 2021
+++ src/sys/dev/mii/mii_verbose.c	Sat Jun  5 22:45:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii_verbose.c,v 1.7 2021/06/05 22:21:15 pgoyette Exp $ */
+/*	$NetBSD: mii_verbose.c,v 1.8 2021/06/05 22:45:03 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mii_verbose.c,v 1.7 2021/06/05 22:21:15 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_verbose.c,v 1.8 2021/06/05 22:45:03 pgoyette Exp $");
 
 #include 
 #include 
@@ -81,7 +81,7 @@ miiverbose_modcmd(modcmd_t cmd, void *ar
 		mii_get_descr = saved_mii_get_descr;
 		mii_verbose_loaded = 0;
 		return 0;
-	casce MODULE_CMD_AUTOUNLOAD:
+	case MODULE_CMD_AUTOUNLOAD:
 		return EBUSY;
 	default:
 		return ENOTTY;



CVS commit: src/sys/dev/mii

2021-06-05 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Jun  5 22:45:03 UTC 2021

Modified Files:
src/sys/dev/mii: mii_verbose.c

Log Message:
Ooopppsss - typo!


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/mii/mii_verbose.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-11-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov  4 09:15:10 UTC 2020

Modified Files:
src/sys/dev/mii: igphy.c ihphy.c makphy.c

Log Message:
 Fix a bug that "ifconfig xx0 media none" set LINK_STATE_UNKNOWN instead of
LINK_STATE_DOWN.

XXX We should check for other PHY drivers, too.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/mii/igphy.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/mii/ihphy.c
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/mii/makphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/igphy.c
diff -u src/sys/dev/mii/igphy.c:1.36 src/sys/dev/mii/igphy.c:1.37
--- src/sys/dev/mii/igphy.c:1.36	Mon Aug  3 07:25:59 2020
+++ src/sys/dev/mii/igphy.c	Wed Nov  4 09:15:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: igphy.c,v 1.36 2020/08/03 07:25:59 msaitoh Exp $	*/
+/*	$NetBSD: igphy.c,v 1.37 2020/11/04 09:15:10 msaitoh Exp $	*/
 
 /*
  * The Intel copyright applies to the analog register setup, and the
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.36 2020/08/03 07:25:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.37 2020/11/04 09:15:10 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mii.h"
@@ -437,7 +437,6 @@ igphy_status(struct mii_softc *sc)
 	PHY_READ(sc, MII_BMCR, );
 	if (bmcr & BMCR_ISO) {
 		mii->mii_media_active |= IFM_NONE;
-		mii->mii_media_status = 0;
 		return;
 	}
 

Index: src/sys/dev/mii/ihphy.c
diff -u src/sys/dev/mii/ihphy.c:1.18 src/sys/dev/mii/ihphy.c:1.19
--- src/sys/dev/mii/ihphy.c:1.18	Sat Mar 28 18:37:18 2020
+++ src/sys/dev/mii/ihphy.c	Wed Nov  4 09:15:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ihphy.c,v 1.18 2020/03/28 18:37:18 thorpej Exp $	*/
+/*	$NetBSD: ihphy.c,v 1.19 2020/11/04 09:15:10 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ihphy.c,v 1.18 2020/03/28 18:37:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ihphy.c,v 1.19 2020/11/04 09:15:10 msaitoh Exp $");
 
 #include 
 #include 
@@ -242,7 +242,6 @@ ihphy_status(struct mii_softc *sc)
 	PHY_READ(sc, MII_BMCR, );
 	if (bmcr & (BMCR_ISO | BMCR_PDOWN)) {
 		mii->mii_media_active |= IFM_NONE;
-		mii->mii_media_status = 0;
 		return;
 	}
 

Index: src/sys/dev/mii/makphy.c
diff -u src/sys/dev/mii/makphy.c:1.67 src/sys/dev/mii/makphy.c:1.68
--- src/sys/dev/mii/makphy.c:1.67	Tue Oct 20 08:53:34 2020
+++ src/sys/dev/mii/makphy.c	Wed Nov  4 09:15:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: makphy.c,v 1.67 2020/10/20 08:53:34 msaitoh Exp $	*/
+/*	$NetBSD: makphy.c,v 1.68 2020/11/04 09:15:10 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.67 2020/10/20 08:53:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.68 2020/11/04 09:15:10 msaitoh Exp $");
 
 #include 
 #include 
@@ -436,9 +436,8 @@ makphy_status(struct mii_softc *sc)
 	if (bmcr & BMCR_LOOP)
 		mii->mii_media_active |= IFM_LOOP;
 
-	if (bmcr & BMCR_ISO) {
+	if (bmcr & (BMCR_ISO | BMCR_PDOWN)) {
 		mii->mii_media_active |= IFM_NONE;
-		mii->mii_media_status = 0;
 		return;
 	}
 



CVS commit: src/sys/dev/mii

2020-11-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov  4 09:15:10 UTC 2020

Modified Files:
src/sys/dev/mii: igphy.c ihphy.c makphy.c

Log Message:
 Fix a bug that "ifconfig xx0 media none" set LINK_STATE_UNKNOWN instead of
LINK_STATE_DOWN.

XXX We should check for other PHY drivers, too.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/mii/igphy.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/mii/ihphy.c
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/mii/makphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-10-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 20 08:53:34 UTC 2020

Modified Files:
src/sys/dev/mii: makphy.c

Log Message:
Add Intel I347-AT4.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/mii/makphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/makphy.c
diff -u src/sys/dev/mii/makphy.c:1.66 src/sys/dev/mii/makphy.c:1.67
--- src/sys/dev/mii/makphy.c:1.66	Mon Aug  3 07:25:59 2020
+++ src/sys/dev/mii/makphy.c	Tue Oct 20 08:53:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: makphy.c,v 1.66 2020/08/03 07:25:59 msaitoh Exp $	*/
+/*	$NetBSD: makphy.c,v 1.67 2020/10/20 08:53:34 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.66 2020/08/03 07:25:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.67 2020/10/20 08:53:34 msaitoh Exp $");
 
 #include 
 #include 
@@ -117,6 +117,7 @@ static const struct mii_phydesc makphys[
 	MII_PHY_DESC(xxMARVELL, E3016),
 	MII_PHY_DESC(xxMARVELL, E3082),
 	MII_PHY_DESC(xxMARVELL, PHYG65G),
+	MII_PHY_DESC(xxMARVELL, I347),
 	MII_PHY_END,
 };
 



CVS commit: src/sys/dev/mii

2020-10-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 20 08:53:34 UTC 2020

Modified Files:
src/sys/dev/mii: makphy.c

Log Message:
Add Intel I347-AT4.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/mii/makphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-08-27 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Thu Aug 27 10:10:23 UTC 2020

Modified Files:
src/sys/dev/mii: mii_physubr.c

Log Message:
Move mii_phy_statusmsg(sc) back to its original position. Fixes
deafness bug on macppc reported and tested by martin@
Thanks !


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/mii/mii_physubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/mii_physubr.c
diff -u src/sys/dev/mii/mii_physubr.c:1.93 src/sys/dev/mii/mii_physubr.c:1.94
--- src/sys/dev/mii/mii_physubr.c:1.93	Mon Aug 24 12:46:04 2020
+++ src/sys/dev/mii/mii_physubr.c	Thu Aug 27 10:10:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii_physubr.c,v 1.93 2020/08/24 12:46:04 kardel Exp $	*/
+/*	$NetBSD: mii_physubr.c,v 1.94 2020/08/27 10:10:23 kardel Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.93 2020/08/24 12:46:04 kardel Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.94 2020/08/27 10:10:23 kardel Exp $");
 
 #include 
 #include 
@@ -451,10 +451,10 @@ mii_phy_update(struct mii_softc *sc, int
 	if (sc->mii_media_active != mii_media_active ||
 	sc->mii_media_status != mii_media_status ||
 	cmd == MII_MEDIACHG) {
+		mii_phy_statusmsg(sc);
 		(*mii->mii_statchg)(mii->mii_ifp);
 		sc->mii_media_active = mii_media_active;
 		sc->mii_media_status = mii_media_status;
-		mii_phy_statusmsg(sc);
 	}
 }
 



CVS commit: src/sys/dev/mii

2020-08-27 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Thu Aug 27 10:10:23 UTC 2020

Modified Files:
src/sys/dev/mii: mii_physubr.c

Log Message:
Move mii_phy_statusmsg(sc) back to its original position. Fixes
deafness bug on macppc reported and tested by martin@
Thanks !


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/mii/mii_physubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/sys/dev/mii (PR/kern 55538)

2020-08-27 Thread Frank Kardel

Hi Martin !

That is strange - I didn't expect that, especially as the previous code 
was wrong with respect to state tracking.

Can you check whether the addresses do not have the DEtACHED flag?
You could try the dtrace script from the PR - it shows a little bit what 
is going on.
There was also some mii fixing just before my patch, but I assume you 
testes with reverting just

this commit.

Sorry for the issue - I have yet to find an explaination for that behavior.

Maybe comparing the dtrace outputs for both varainst can shed a light on 
what happens.


Frank

On 08/27/20 10:20, Martin Husemann wrote:

On Mon, Aug 24, 2020 at 12:46:04PM +, Frank Kardel wrote:

Module Name:src
Committed By:   kardel
Date:   Mon Aug 24 12:46:04 UTC 2020

Modified Files:
src/sys/dev/mii: mii_physubr.c

Log Message:
Keep the change check invariant intact. The previous code could miss
status updates by picking up a new status different from the tested
status. This left addresses in the DETACHED state although the
link status is already UP again.

addresses PR/kern 55538


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/mii/mii_physubr.c

Hi Frank,

this change breaks the network on my macppc, with r1.93 it only seems to be
able to send packets, but never receives answers (ARP does not complete,
but other hosts see the ARP requests).

gem0 at pci2 dev 15 function 0: Apple Computer GMAC Ethernet (rev. 0x01)
gem0: interrupting at irq 41
brgphy0 at gem0 phy 0: BCM5411 1000BASE-T media interface, rev. 1
brgphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 
1000baseT-FDX, auto
gem0: Ethernet address 00:03:93:71:ff:cc, 10KB RX fifo, 4KB TX fifo

It is connected to a gige switch:

 media: Ethernet autoselect (1000baseT full-duplex,master)
 status: active

(which looks the same in the non-working kernel).

Any ideas how to debug?

Martin




Re: CVS commit: src/sys/dev/mii (PR/kern 55538)

2020-08-27 Thread Martin Husemann
On Mon, Aug 24, 2020 at 12:46:04PM +, Frank Kardel wrote:
> Module Name:  src
> Committed By: kardel
> Date: Mon Aug 24 12:46:04 UTC 2020
> 
> Modified Files:
>   src/sys/dev/mii: mii_physubr.c
> 
> Log Message:
> Keep the change check invariant intact. The previous code could miss
> status updates by picking up a new status different from the tested
> status. This left addresses in the DETACHED state although the
> link status is already UP again.
> 
> addresses PR/kern 55538
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.92 -r1.93 src/sys/dev/mii/mii_physubr.c

Hi Frank,

this change breaks the network on my macppc, with r1.93 it only seems to be
able to send packets, but never receives answers (ARP does not complete,
but other hosts see the ARP requests).

gem0 at pci2 dev 15 function 0: Apple Computer GMAC Ethernet (rev. 0x01)
gem0: interrupting at irq 41
brgphy0 at gem0 phy 0: BCM5411 1000BASE-T media interface, rev. 1
brgphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 
1000baseT-FDX, auto
gem0: Ethernet address 00:03:93:71:ff:cc, 10KB RX fifo, 4KB TX fifo

It is connected to a gige switch:

media: Ethernet autoselect (1000baseT full-duplex,master)
status: active

(which looks the same in the non-working kernel).

Any ideas how to debug?

Martin


CVS commit: src/sys/dev/mii

2020-08-24 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Mon Aug 24 12:46:04 UTC 2020

Modified Files:
src/sys/dev/mii: mii_physubr.c

Log Message:
Keep the change check invariant intact. The previous code could miss
status updates by picking up a new status different from the tested
status. This left addresses in the DETACHED state although the
link status is already UP again.

addresses PR/kern 55538


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/mii/mii_physubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-08-24 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Mon Aug 24 12:46:04 UTC 2020

Modified Files:
src/sys/dev/mii: mii_physubr.c

Log Message:
Keep the change check invariant intact. The previous code could miss
status updates by picking up a new status different from the tested
status. This left addresses in the DETACHED state although the
link status is already UP again.

addresses PR/kern 55538


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/mii/mii_physubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/mii_physubr.c
diff -u src/sys/dev/mii/mii_physubr.c:1.92 src/sys/dev/mii/mii_physubr.c:1.93
--- src/sys/dev/mii/mii_physubr.c:1.92	Mon Aug 24 04:23:41 2020
+++ src/sys/dev/mii/mii_physubr.c	Mon Aug 24 12:46:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii_physubr.c,v 1.92 2020/08/24 04:23:41 msaitoh Exp $	*/
+/*	$NetBSD: mii_physubr.c,v 1.93 2020/08/24 12:46:04 kardel Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.92 2020/08/24 04:23:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.93 2020/08/24 12:46:04 kardel Exp $");
 
 #include 
 #include 
@@ -440,16 +440,21 @@ void
 mii_phy_update(struct mii_softc *sc, int cmd)
 {
 	struct mii_data *mii = sc->mii_pdata;
+	u_int mii_media_active;
+	int   mii_media_status;
 
 	KASSERT(mii_locked(mii));
 
-	if (sc->mii_media_active != mii->mii_media_active ||
-	sc->mii_media_status != mii->mii_media_status ||
+	mii_media_active = mii->mii_media_active;
+	mii_media_status = mii->mii_media_status;
+
+	if (sc->mii_media_active != mii_media_active ||
+	sc->mii_media_status != mii_media_status ||
 	cmd == MII_MEDIACHG) {
-		mii_phy_statusmsg(sc);
 		(*mii->mii_statchg)(mii->mii_ifp);
-		sc->mii_media_active = mii->mii_media_active;
-		sc->mii_media_status = mii->mii_media_status;
+		sc->mii_media_active = mii_media_active;
+		sc->mii_media_status = mii_media_status;
+		mii_phy_statusmsg(sc);
 	}
 }
 



CVS commit: src/sys/dev/mii

2020-08-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug 24 04:49:05 UTC 2020

Modified Files:
src/sys/dev/mii: urlphy.c

Log Message:
 Remove extra PHY_RESET(sc) in the MII_TICK path because it's not requierd
to just restart autonego.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/mii/urlphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/urlphy.c
diff -u src/sys/dev/mii/urlphy.c:1.37 src/sys/dev/mii/urlphy.c:1.38
--- src/sys/dev/mii/urlphy.c:1.37	Mon Aug 24 04:23:41 2020
+++ src/sys/dev/mii/urlphy.c	Mon Aug 24 04:49:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: urlphy.c,v 1.37 2020/08/24 04:23:41 msaitoh Exp $	*/
+/*	$NetBSD: urlphy.c,v 1.38 2020/08/24 04:49:05 msaitoh Exp $	*/
 /*
  * Copyright (c) 2001, 2002
  * Shingo WATANABE .  All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.37 2020/08/24 04:23:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.38 2020/08/24 04:49:05 msaitoh Exp $");
 
 #include 
 #include 
@@ -197,8 +197,6 @@ urlphy_service(struct mii_softc *sc, str
 		if (sc->mii_ticks <= sc->mii_anegticks)
 			return 0;
 
-		PHY_RESET(sc);
-
 		if (mii_phy_auto_restart(sc) == EJUSTRETURN)
 			return 0;
 



CVS commit: src/sys/dev/mii

2020-08-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug 24 04:49:05 UTC 2020

Modified Files:
src/sys/dev/mii: urlphy.c

Log Message:
 Remove extra PHY_RESET(sc) in the MII_TICK path because it's not requierd
to just restart autonego.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/mii/urlphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-08-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug 24 04:23:41 UTC 2020

Modified Files:
src/sys/dev/mii: ciphy.c mii_physubr.c miivar.h urlphy.c

Log Message:
 Don't do full initialization for autonego when just restarting autonego
because it's not required.

 This change reduce extra initialization which include PHY_RESET() which
caused long delay(max 500ms).


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/mii/ciphy.c
cvs rdiff -u -r1.91 -r1.92 src/sys/dev/mii/mii_physubr.c
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/mii/miivar.h
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/mii/urlphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-08-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug 24 04:23:41 UTC 2020

Modified Files:
src/sys/dev/mii: ciphy.c mii_physubr.c miivar.h urlphy.c

Log Message:
 Don't do full initialization for autonego when just restarting autonego
because it's not required.

 This change reduce extra initialization which include PHY_RESET() which
caused long delay(max 500ms).


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/mii/ciphy.c
cvs rdiff -u -r1.91 -r1.92 src/sys/dev/mii/mii_physubr.c
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/mii/miivar.h
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/mii/urlphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/ciphy.c
diff -u src/sys/dev/mii/ciphy.c:1.40 src/sys/dev/mii/ciphy.c:1.41
--- src/sys/dev/mii/ciphy.c:1.40	Tue Jul  7 08:44:12 2020
+++ src/sys/dev/mii/ciphy.c	Mon Aug 24 04:23:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ciphy.c,v 1.40 2020/07/07 08:44:12 msaitoh Exp $ */
+/* $NetBSD: ciphy.c,v 1.41 2020/08/24 04:23:41 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.40 2020/07/07 08:44:12 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.41 2020/08/24 04:23:41 msaitoh Exp $");
 
 /*
  * Driver for the Cicada CS8201 10/100/1000 copper PHY.
@@ -273,7 +273,7 @@ setit:
 		if (sc->mii_ticks <= sc->mii_anegticks)
 			break;
 
-		mii_phy_auto(sc);
+		mii_phy_auto_restart(sc);
 		return 0;
 	}
 

Index: src/sys/dev/mii/mii_physubr.c
diff -u src/sys/dev/mii/mii_physubr.c:1.91 src/sys/dev/mii/mii_physubr.c:1.92
--- src/sys/dev/mii/mii_physubr.c:1.91	Tue Jul  7 08:44:12 2020
+++ src/sys/dev/mii/mii_physubr.c	Mon Aug 24 04:23:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii_physubr.c,v 1.91 2020/07/07 08:44:12 msaitoh Exp $	*/
+/*	$NetBSD: mii_physubr.c,v 1.92 2020/08/24 04:23:41 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.91 2020/07/07 08:44:12 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.92 2020/08/24 04:23:41 msaitoh Exp $");
 
 #include 
 #include 
@@ -198,6 +198,7 @@ mii_phy_setmedia(struct mii_softc *sc)
 		PHY_WRITE(sc, MII_BMCR, bmcr);
 }
 
+/* Setup autonegotiation and start it. */
 int
 mii_phy_auto(struct mii_softc *sc)
 {
@@ -283,6 +284,20 @@ mii_phy_auto(struct mii_softc *sc)
 	return EJUSTRETURN;
 }
 
+/* Just restart autonegotiation without changing any setting */
+int
+mii_phy_auto_restart(struct mii_softc *sc)
+{
+	uint16_t reg;
+
+	PHY_READ(sc, MII_BMCR, );
+	reg |= BMCR_STARTNEG;
+	PHY_WRITE(sc, MII_BMCR, reg);
+	sc->mii_ticks = 0;
+
+	return EJUSTRETURN;
+}
+
 static void
 mii_phy_auto_timeout_locked(struct mii_softc *sc)
 {
@@ -365,9 +380,7 @@ mii_phy_tick(struct mii_softc *sc)
 	if (sc->mii_ticks <= sc->mii_anegticks)
 		return EJUSTRETURN;
 
-	PHY_RESET(sc);
-
-	if (mii_phy_auto(sc) == EJUSTRETURN)
+	if (mii_phy_auto_restart(sc) == EJUSTRETURN)
 		return EJUSTRETURN;
 
 	/*

Index: src/sys/dev/mii/miivar.h
diff -u src/sys/dev/mii/miivar.h:1.72 src/sys/dev/mii/miivar.h:1.73
--- src/sys/dev/mii/miivar.h:1.72	Tue Jul  7 08:44:12 2020
+++ src/sys/dev/mii/miivar.h	Mon Aug 24 04:23:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: miivar.h,v 1.72 2020/07/07 08:44:12 msaitoh Exp $	*/
+/*	$NetBSD: miivar.h,v 1.73 2020/08/24 04:23:41 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2020 The NetBSD Foundation, Inc.
@@ -332,6 +332,7 @@ void	mii_phy_delete_media(struct mii_sof
 /* MII must be LOCKED */
 void	mii_phy_setmedia(struct mii_softc *);
 int	mii_phy_auto(struct mii_softc *);
+int	mii_phy_auto_restart(struct mii_softc *);
 void	mii_phy_reset(struct mii_softc *);
 void	mii_phy_down(struct mii_softc *);
 int	mii_phy_tick(struct mii_softc *);

Index: src/sys/dev/mii/urlphy.c
diff -u src/sys/dev/mii/urlphy.c:1.36 src/sys/dev/mii/urlphy.c:1.37
--- src/sys/dev/mii/urlphy.c:1.36	Tue Jul  7 08:44:12 2020
+++ src/sys/dev/mii/urlphy.c	Mon Aug 24 04:23:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: urlphy.c,v 1.36 2020/07/07 08:44:12 msaitoh Exp $	*/
+/*	$NetBSD: urlphy.c,v 1.37 2020/08/24 04:23:41 msaitoh Exp $	*/
 /*
  * Copyright (c) 2001, 2002
  * Shingo WATANABE .  All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.36 2020/07/07 08:44:12 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.37 2020/08/24 04:23:41 msaitoh Exp $");
 
 #include 
 #include 
@@ -199,7 +199,7 @@ urlphy_service(struct mii_softc *sc, str
 
 		PHY_RESET(sc);
 
-		if (mii_phy_auto(sc) == EJUSTRETURN)
+		if (mii_phy_auto_restart(sc) == EJUSTRETURN)
 			return 0;
 
 		break;



Re: CVS commit: src/sys/dev/mii

2020-08-03 Thread Valery Ushakov
On Tue, Aug 04, 2020 at 07:12:54 +0300, Valery Ushakov wrote:

> On Tue, Aug 04, 2020 at 12:50:11 +0900, SAITOH Masanobu wrote:
> 
> > On 2020/08/03 23:00, Valeriy E. Ushakov wrote:
> > > Module Name:  src
> > > Committed By: uwe
> > > Date: Mon Aug  3 14:00:41 UTC 2020
> > > 
> > > Modified Files:
> > >   src/sys/dev/mii: miidevs_data.h
> > > 
> > > Log Message:
> > > mii_knowndevs[] is de facto const, define it as such.
> > 
> > This file is auto-generated by Makefile.miidevs. make -f Makefile.miidevs
> > deletes this change. If the change is required, modify Makefile.miidevs.
> 
> Oh, thank you for the heads up.  I was really working on something
> else and didn't pay attention to the comment that was out off view.

I have fixed the devlist2h.awk script that generates them to emit that
const.  As the generated files come out exactly the same modulo the
rcs id (script emits unexpanded one) I think we can pretend I have
committed the script change first and then regenerated the
miidevs_data.h header :)

-uwe


Re: CVS commit: src/sys/dev/mii

2020-08-03 Thread SAITOH Masanobu

On 2020/08/04 12:50, SAITOH Masanobu wrote:

Hi.

On 2020/08/03 23:00, Valeriy E. Ushakov wrote:

Module Name:    src
Committed By:    uwe
Date:    Mon Aug  3 14:00:41 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs_data.h

Log Message:
mii_knowndevs[] is de facto const, define it as such.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/dev/mii/miidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



This file is auto-generated by Makefile.miidevs. make -f Makefile.miidevs
deletes this change. If the change is required, modify Makefile.miidevs.


s/modify Makefile.miidevs/modify devlist2h.awk/


Thanks.




--
---
SAITOH Masanobu (msai...@execsw.org
 msai...@netbsd.org)


CVS commit: src/sys/dev/mii

2020-08-03 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Aug  4 04:22:03 UTC 2020

Modified Files:
src/sys/dev/mii: devlist2h.awk

Log Message:
mii_knowndevs[] is de facto const, define it as such.

This time for real.  On my first try I did it in the generated
miidevs_data.h file.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/mii/devlist2h.awk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-08-03 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Aug  4 04:22:03 UTC 2020

Modified Files:
src/sys/dev/mii: devlist2h.awk

Log Message:
mii_knowndevs[] is de facto const, define it as such.

This time for real.  On my first try I did it in the generated
miidevs_data.h file.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/mii/devlist2h.awk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/devlist2h.awk
diff -u src/sys/dev/mii/devlist2h.awk:1.10 src/sys/dev/mii/devlist2h.awk:1.11
--- src/sys/dev/mii/devlist2h.awk:1.10	Mon Dec  2 21:24:50 2019
+++ src/sys/dev/mii/devlist2h.awk	Tue Aug  4 04:22:02 2020
@@ -1,5 +1,5 @@
 #! /usr/bin/awk -f
-#	$NetBSD: devlist2h.awk,v 1.10 2019/12/02 21:24:50 uwe Exp $
+#	$NetBSD: devlist2h.awk,v 1.11 2020/08/04 04:22:02 uwe Exp $
 #
 # Copyright (c) 1998 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -147,7 +147,7 @@ NF > 0 && $1 == "model" {
 		printf("	int model;\n") > dfile
 		printf("	const char *descr;\n") > dfile
 		printf("};\n") > dfile
-		printf("struct mii_knowndev mii_knowndevs[] = {\n") > dfile
+		printf("const struct mii_knowndev mii_knowndevs[] = {\n") > dfile
 		firstdone = 1
 	}
 



Re: CVS commit: src/sys/dev/mii

2020-08-03 Thread Valery Ushakov
On Tue, Aug 04, 2020 at 12:50:11 +0900, SAITOH Masanobu wrote:

> On 2020/08/03 23:00, Valeriy E. Ushakov wrote:
> > Module Name:src
> > Committed By:   uwe
> > Date:   Mon Aug  3 14:00:41 UTC 2020
> > 
> > Modified Files:
> > src/sys/dev/mii: miidevs_data.h
> > 
> > Log Message:
> > mii_knowndevs[] is de facto const, define it as such.
> 
> This file is auto-generated by Makefile.miidevs. make -f Makefile.miidevs
> deletes this change. If the change is required, modify Makefile.miidevs.

Oh, thank you for the heads up.  I was really working on something
else and didn't pay attention to the comment that was out off view.

-uwe


Re: CVS commit: src/sys/dev/mii

2020-08-03 Thread SAITOH Masanobu

Hi.

On 2020/08/03 23:00, Valeriy E. Ushakov wrote:

Module Name:src
Committed By:   uwe
Date:   Mon Aug  3 14:00:41 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs_data.h

Log Message:
mii_knowndevs[] is de facto const, define it as such.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/dev/mii/miidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



This file is auto-generated by Makefile.miidevs. make -f Makefile.miidevs
deletes this change. If the change is required, modify Makefile.miidevs.

Thanks.

--
---
SAITOH Masanobu (msai...@execsw.org
 msai...@netbsd.org)


CVS commit: src/sys/dev/mii

2020-08-03 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Mon Aug  3 14:00:41 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs_data.h

Log Message:
mii_knowndevs[] is de facto const, define it as such.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/dev/mii/miidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.153 src/sys/dev/mii/miidevs_data.h:1.154
--- src/sys/dev/mii/miidevs_data.h:1.153	Tue Jun 23 14:35:59 2020
+++ src/sys/dev/mii/miidevs_data.h	Mon Aug  3 14:00:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: miidevs_data.h,v 1.153 2020/06/23 14:35:59 msaitoh Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.154 2020/08/03 14:00:41 uwe Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -41,7 +41,7 @@ struct mii_knowndev {
 	int model;
 	const char *descr;
 };
-struct mii_knowndev mii_knowndevs[] = {
+const struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_AGERE, MII_MODEL_AGERE_ET1011, MII_STR_AGERE_ET1011 },
  { MII_OUI_AGERE, MII_MODEL_AGERE_ET1011C, MII_STR_AGERE_ET1011C },
  { MII_OUI_xxASIX, MII_MODEL_xxASIX_AX88X9X, MII_STR_xxASIX_AX88X9X },



CVS commit: src/sys/dev/mii

2020-08-03 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Mon Aug  3 14:00:41 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs_data.h

Log Message:
mii_knowndevs[] is de facto const, define it as such.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/dev/mii/miidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-08-03 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  3 07:25:59 UTC 2020

Modified Files:
src/sys/dev/mii: igphy.c igphyreg.h makphy.c makphyreg.h

Log Message:
Rename PSSR_* to MAKPHY_PSSR_* and IGPHY_PSSR_* to avoid conflict.
No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/mii/igphy.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/mii/igphyreg.h
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/mii/makphy.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/mii/makphyreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/igphy.c
diff -u src/sys/dev/mii/igphy.c:1.35 src/sys/dev/mii/igphy.c:1.36
--- src/sys/dev/mii/igphy.c:1.35	Mon Aug  3 07:16:51 2020
+++ src/sys/dev/mii/igphy.c	Mon Aug  3 07:25:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: igphy.c,v 1.35 2020/08/03 07:16:51 msaitoh Exp $	*/
+/*	$NetBSD: igphy.c,v 1.36 2020/08/03 07:25:59 msaitoh Exp $	*/
 
 /*
  * The Intel copyright applies to the analog register setup, and the
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.35 2020/08/03 07:16:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.36 2020/08/03 07:25:59 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mii.h"
@@ -431,7 +431,7 @@ igphy_status(struct mii_softc *sc)
 
 	PHY_READ(sc, IGPHY_PORT_STATUS, );
 
-	if (pssr & PSSR_LINK_UP)
+	if (pssr & IGPHY_PSSR_LINK_UP)
 		mii->mii_media_status |= IFM_ACTIVE;
 
 	PHY_READ(sc, MII_BMCR, );
@@ -453,19 +453,19 @@ igphy_status(struct mii_softc *sc)
 			mii->mii_media_active |= IFM_NONE;
 			return;
 		}
-		switch (pssr & PSSR_SPEED_MASK) {
-		case PSSR_SPEED_1000MBPS:
+		switch (pssr & IGPHY_PSSR_SPEED_MASK) {
+		case IGPHY_PSSR_SPEED_1000MBPS:
 			mii->mii_media_active |= IFM_1000_T;
 			PHY_READ(sc, MII_100T2SR, );
 			if (gtsr & GTSR_MS_RES)
 mii->mii_media_active |= IFM_ETH_MASTER;
 			break;
 
-		case PSSR_SPEED_100MBPS:
+		case IGPHY_PSSR_SPEED_100MBPS:
 			mii->mii_media_active |= IFM_100_TX;
 			break;
 
-		case PSSR_SPEED_10MBPS:
+		case IGPHY_PSSR_SPEED_10MBPS:
 			mii->mii_media_active |= IFM_10_T;
 			break;
 
@@ -475,7 +475,7 @@ igphy_status(struct mii_softc *sc)
 			return;
 		}
 
-		if (pssr & PSSR_FULL_DUPLEX)
+		if (pssr & IGPHY_PSSR_FULL_DUPLEX)
 			mii->mii_media_active |=
 			IFM_FDX | mii_phy_flowstatus(sc);
 		else

Index: src/sys/dev/mii/igphyreg.h
diff -u src/sys/dev/mii/igphyreg.h:1.12 src/sys/dev/mii/igphyreg.h:1.13
--- src/sys/dev/mii/igphyreg.h:1.12	Mon Aug  3 07:16:51 2020
+++ src/sys/dev/mii/igphyreg.h	Mon Aug  3 07:25:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: igphyreg.h,v 1.12 2020/08/03 07:16:51 msaitoh Exp $	*/
+/*	$NetBSD: igphyreg.h,v 1.13 2020/08/03 07:25:59 msaitoh Exp $	*/
 
 /***
 
@@ -53,18 +53,18 @@
 
 /* IGP01E1000 Specific Port Status Register - R/O */
 #define IGPHY_PORT_STATUS		0x11
-#define PSSR_AUTONEG_FAILED		0x0001 /* RO LH SC */
-#define PSSR_POLARITY_REVERSED		0x0002
-#define PSSR_CABLE_LENGTH		0x007C
-#define PSSR_FULL_DUPLEX		0x0200
-#define PSSR_LINK_UP			0x0400
-#define PSSR_MDIX			0x0800
-#define PSSR_SPEED_MASK			0xC000 /* speed bits mask */
-#define PSSR_SPEED_10MBPS		0x4000
-#define PSSR_SPEED_100MBPS		0x8000
-#define PSSR_SPEED_1000MBPS		0xC000
-#define PSSR_CABLE_LENGTH_SHIFT 	0x0002 /* shift right 2 */
-#define PSSR_MDIX_SHIFT			0x000B /* shift right 11 */
+#define IGPHY_PSSR_AUTONEG_FAILED	0x0001 /* RO LH SC */
+#define IGPHY_PSSR_POLARITY_REVERSED	0x0002
+#define IGPHY_PSSR_CABLE_LENGTH		0x007C
+#define IGPHY_PSSR_FULL_DUPLEX		0x0200
+#define IGPHY_PSSR_LINK_UP		0x0400
+#define IGPHY_PSSR_MDIX			0x0800
+#define IGPHY_PSSR_SPEED_MASK		0xC000 /* speed bits mask */
+#define IGPHY_PSSR_SPEED_10MBPS		0x4000
+#define IGPHY_PSSR_SPEED_100MBPS	0x8000
+#define IGPHY_PSSR_SPEED_1000MBPS	0xC000
+#define IGPHY_PSSR_CABLE_LENGTH_SHIFT 	0x0002 /* shift right 2 */
+#define IGPHY_PSSR_MDIX_SHIFT		0x000B /* shift right 11 */
 
 /* IGP01E1000 Specific Port Control Register - R/W */
 #define IGPHY_PORT_CTRL			0x12

Index: src/sys/dev/mii/makphy.c
diff -u src/sys/dev/mii/makphy.c:1.65 src/sys/dev/mii/makphy.c:1.66
--- src/sys/dev/mii/makphy.c:1.65	Sun Mar 15 23:04:50 2020
+++ src/sys/dev/mii/makphy.c	Mon Aug  3 07:25:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: makphy.c,v 1.65 2020/03/15 23:04:50 thorpej Exp $	*/
+/*	$NetBSD: makphy.c,v 1.66 2020/08/03 07:25:59 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.65 2020/03/15 23:04:50 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.66 2020/08/03 07:25:59 msaitoh Exp $");
 
 #include 
 #include 
@@ -429,7 +429,7 @@ makphy_status(struct mii_softc *sc)
 	/* XXX FIXME: Use different page for Fiber on newer chips */
 	PHY_READ(sc, MAKPHY_PSSR, );
 
-	if (pssr & PSSR_LINK)
+	if (pssr & 

CVS commit: src/sys/dev/mii

2020-08-03 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  3 07:25:59 UTC 2020

Modified Files:
src/sys/dev/mii: igphy.c igphyreg.h makphy.c makphyreg.h

Log Message:
Rename PSSR_* to MAKPHY_PSSR_* and IGPHY_PSSR_* to avoid conflict.
No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/mii/igphy.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/mii/igphyreg.h
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/mii/makphy.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/mii/makphyreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-07-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jul  7 08:44:12 UTC 2020

Modified Files:
src/sys/dev/mii: ciphy.c igphy.c mii_physubr.c miivar.h tlphy.c
urlphy.c

Log Message:
- Remove the waitfor argument from mii_phy_auto().
- Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/mii/ciphy.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/mii/igphy.c
cvs rdiff -u -r1.90 -r1.91 src/sys/dev/mii/mii_physubr.c
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/mii/miivar.h
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/mii/tlphy.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/mii/urlphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/ciphy.c
diff -u src/sys/dev/mii/ciphy.c:1.39 src/sys/dev/mii/ciphy.c:1.40
--- src/sys/dev/mii/ciphy.c:1.39	Sun Mar 15 23:04:50 2020
+++ src/sys/dev/mii/ciphy.c	Tue Jul  7 08:44:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ciphy.c,v 1.39 2020/03/15 23:04:50 thorpej Exp $ */
+/* $NetBSD: ciphy.c,v 1.40 2020/07/07 08:44:12 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.39 2020/03/15 23:04:50 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.40 2020/07/07 08:44:12 msaitoh Exp $");
 
 /*
  * Driver for the Cicada CS8201 10/100/1000 copper PHY.
@@ -173,7 +173,7 @@ ciphy_service(struct mii_softc *sc, stru
 			if (reg & BMCR_AUTOEN)
 return 0;
 #endif
-			(void) mii_phy_auto(sc, 0);
+			(void) mii_phy_auto(sc);
 			break;
 		case IFM_1000_T:
 			speed = BMCR_S1000;
@@ -273,7 +273,7 @@ setit:
 		if (sc->mii_ticks <= sc->mii_anegticks)
 			break;
 
-		mii_phy_auto(sc, 0);
+		mii_phy_auto(sc);
 		return 0;
 	}
 

Index: src/sys/dev/mii/igphy.c
diff -u src/sys/dev/mii/igphy.c:1.33 src/sys/dev/mii/igphy.c:1.34
--- src/sys/dev/mii/igphy.c:1.33	Sun Mar 15 23:04:50 2020
+++ src/sys/dev/mii/igphy.c	Tue Jul  7 08:44:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: igphy.c,v 1.33 2020/03/15 23:04:50 thorpej Exp $	*/
+/*	$NetBSD: igphy.c,v 1.34 2020/07/07 08:44:12 msaitoh Exp $	*/
 
 /*
  * The Intel copyright applies to the analog register setup, and the
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.33 2020/03/15 23:04:50 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.34 2020/07/07 08:44:12 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mii.h"
@@ -523,14 +523,14 @@ igphy_smartspeed_workaround(struct mii_s
 	gtcr &= ~GTCR_MAN_MS;
 	PHY_WRITE(sc, MII_100T2CR, gtcr);
 }
-mii_phy_auto(sc, 0);
+mii_phy_auto(sc);
 			}
 			break;
 		case IGPHY_TICK_DOWNSHIFT:
 			PHY_READ(sc, MII_100T2CR, );
 			gtcr |= GTCR_MAN_MS;
 			PHY_WRITE(sc, MII_100T2CR, gtcr);
-			mii_phy_auto(sc, 0);
+			mii_phy_auto(sc);
 			break;
 		default:
 			break;

Index: src/sys/dev/mii/mii_physubr.c
diff -u src/sys/dev/mii/mii_physubr.c:1.90 src/sys/dev/mii/mii_physubr.c:1.91
--- src/sys/dev/mii/mii_physubr.c:1.90	Sun Mar 15 23:04:50 2020
+++ src/sys/dev/mii/mii_physubr.c	Tue Jul  7 08:44:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii_physubr.c,v 1.90 2020/03/15 23:04:50 thorpej Exp $	*/
+/*	$NetBSD: mii_physubr.c,v 1.91 2020/07/07 08:44:12 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.90 2020/03/15 23:04:50 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.91 2020/07/07 08:44:12 msaitoh Exp $");
 
 #include 
 #include 
@@ -147,7 +147,7 @@ mii_phy_setmedia(struct mii_softc *sc)
 		PHY_READ(sc, MII_BMCR, );
 		if ((bmcr & BMCR_AUTOEN) == 0 ||
 		(sc->mii_flags & (MIIF_FORCEANEG | MIIF_DOPAUSE)))
-			(void) mii_phy_auto(sc, 1);
+			(void) mii_phy_auto(sc);
 		return;
 	}
 
@@ -193,15 +193,14 @@ mii_phy_setmedia(struct mii_softc *sc)
 	if (sc->mii_flags & MIIF_HAVE_GTCR)
 		PHY_WRITE(sc, MII_100T2CR, gtcr);
 	if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T)
-		mii_phy_auto(sc, 0);
+		mii_phy_auto(sc);
 	else
 		PHY_WRITE(sc, MII_BMCR, bmcr);
 }
 
 int
-mii_phy_auto(struct mii_softc *sc, int waitfor)
+mii_phy_auto(struct mii_softc *sc)
 {
-	int i;
 	struct mii_data *mii = sc->mii_pdata;
 	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
 
@@ -266,24 +265,6 @@ mii_phy_auto(struct mii_softc *sc, int w
 		PHY_WRITE(sc, MII_BMCR, BMCR_AUTOEN | BMCR_STARTNEG);
 	}
 
-	if (waitfor) {
-		/* Wait 500ms for it to complete. */
-		for (i = 0; i < 500; i++) {
-			uint16_t bmsr;
-
-			PHY_READ(sc, MII_BMSR, );
-			if (bmsr & BMSR_ACOMP)
-return 0;
-			delay(1000);
-		}
-
-		/*
-		 * Don't need to worry about clearing MIIF_DOINGAUTO. If that's
-		 * set, a timeout is pending, and it will clear the flag.
-		 */
-		return EIO;
-	}
-
 	/*
 	 * Just let it finish asynchronously.  This is for the benefit of
 	 * the tick handler driving autonegotiation.  Don't want 500ms
@@ -308,7 +289,7 @@ mii_phy_auto_timeout_locked(struct mii_s
 

CVS commit: src/sys/dev/mii

2020-07-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jul  7 08:44:12 UTC 2020

Modified Files:
src/sys/dev/mii: ciphy.c igphy.c mii_physubr.c miivar.h tlphy.c
urlphy.c

Log Message:
- Remove the waitfor argument from mii_phy_auto().
- Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/mii/ciphy.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/mii/igphy.c
cvs rdiff -u -r1.90 -r1.91 src/sys/dev/mii/mii_physubr.c
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/mii/miivar.h
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/mii/tlphy.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/mii/urlphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-07-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jul  7 08:35:16 UTC 2020

Modified Files:
src/sys/dev/mii: tlphy.c

Log Message:
- Call tlphy_auto correctly.
- It's not required to do busy-wait by mii_phy_auto(sc, 1). Now there is
 no any PHY driver which calls mii_phy_auto(sc, 1).


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/mii/tlphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-07-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jul  7 08:35:16 UTC 2020

Modified Files:
src/sys/dev/mii: tlphy.c

Log Message:
- Call tlphy_auto correctly.
- It's not required to do busy-wait by mii_phy_auto(sc, 1). Now there is
 no any PHY driver which calls mii_phy_auto(sc, 1).


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/mii/tlphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/tlphy.c
diff -u src/sys/dev/mii/tlphy.c:1.69 src/sys/dev/mii/tlphy.c:1.70
--- src/sys/dev/mii/tlphy.c:1.69	Tue Jul  7 06:59:22 2020
+++ src/sys/dev/mii/tlphy.c	Tue Jul  7 08:35:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tlphy.c,v 1.69 2020/07/07 06:59:22 msaitoh Exp $	*/
+/*	$NetBSD: tlphy.c,v 1.70 2020/07/07 08:35:16 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tlphy.c,v 1.69 2020/07/07 06:59:22 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tlphy.c,v 1.70 2020/07/07 08:35:16 msaitoh Exp $");
 
 #include 
 #include 
@@ -98,7 +98,7 @@ CFATTACH_DECL_NEW(tlphy, sizeof(struct t
 tlphymatch, tlphyattach, mii_phy_detach, mii_phy_activate);
 
 static int	tlphy_service(struct mii_softc *, struct mii_data *, int);
-static int	tlphy_auto(struct tlphy_softc *, int);
+static int	tlphy_auto(struct tlphy_softc *);
 static void	tlphy_acomp(struct tlphy_softc *);
 static void	tlphy_status(struct mii_softc *);
 
@@ -239,12 +239,7 @@ tlphy_service(struct mii_softc *sc, stru
 
 		switch (IFM_SUBTYPE(ife->ifm_media)) {
 		case IFM_AUTO:
-			/*
-			 * The ThunderLAN PHY doesn't self-configure after
-			 * an autonegotiation cycle, so there's no such
-			 * thing as "already in auto mode".
-			 */
-			(void) tlphy_auto(tsc, 1);
+			(void) tlphy_auto(tsc);
 			break;
 		case IFM_10_2:
 		case IFM_10_5:
@@ -268,8 +263,37 @@ tlphy_service(struct mii_softc *sc, stru
 		 * XXX WHAT ABOUT CHECKING LINK ON THE BNC/AUI?!
 		 */
 
-		if (mii_phy_tick(sc) == EJUSTRETURN)
-			return 0;
+		/* Only used for autonegotiation. */
+		if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) {
+			sc->mii_ticks = 0;
+			break;
+		}
+
+		/*
+		 * Check for link.
+		 * Read the status register twice; BMSR_LINK is latch-low.
+		 */
+		PHY_READ(sc, MII_BMSR, );
+		PHY_READ(sc, MII_BMSR, );
+		if (reg & BMSR_LINK) {
+			sc->mii_ticks = 0;
+			break;
+		}
+
+		/*
+		 * mii_ticks == 0 means it's the first tick after changing the
+		 * media or the link became down since the last tick
+		 * (see above), so break to update the status.
+		 */
+		if (sc->mii_ticks++ == 0)
+			break;
+
+		/* Only retry autonegotiation every mii_anegticks seconds. */
+		KASSERT(sc->mii_anegticks != 0);
+		if (sc->mii_ticks <= sc->mii_anegticks)
+			break;
+
+		tlphy_auto(tsc);
 		break;
 
 	case MII_DOWN:
@@ -338,12 +362,12 @@ tlphy_status(struct mii_softc *sc)
 }
 
 static int
-tlphy_auto(struct tlphy_softc *tsc, int waitfor)
+tlphy_auto(struct tlphy_softc *tsc)
 {
 	struct mii_softc *sc = >sc_mii;
 	int error;
 
-	switch ((error = mii_phy_auto(sc, waitfor))) {
+	switch ((error = mii_phy_auto(sc, 0))) {
 	case EIO:
 		/*
 		 * Just assume we're not in full-duplex mode.



CVS commit: src/sys/dev/mii

2020-07-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jul  7 06:59:22 UTC 2020

Modified Files:
src/sys/dev/mii: tlphy.c

Log Message:
"no media present" is intended case on tlphy(4), so don't use
aprint_error_dev().


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/mii/tlphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-07-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jul  7 06:59:22 UTC 2020

Modified Files:
src/sys/dev/mii: tlphy.c

Log Message:
"no media present" is intended case on tlphy(4), so don't use
aprint_error_dev().


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/mii/tlphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/tlphy.c
diff -u src/sys/dev/mii/tlphy.c:1.68 src/sys/dev/mii/tlphy.c:1.69
--- src/sys/dev/mii/tlphy.c:1.68	Sun Mar 15 23:04:50 2020
+++ src/sys/dev/mii/tlphy.c	Tue Jul  7 06:59:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tlphy.c,v 1.68 2020/03/15 23:04:50 thorpej Exp $	*/
+/*	$NetBSD: tlphy.c,v 1.69 2020/07/07 06:59:22 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tlphy.c,v 1.68 2020/03/15 23:04:50 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tlphy.c,v 1.69 2020/07/07 06:59:22 msaitoh Exp $");
 
 #include 
 #include 
@@ -164,7 +164,11 @@ tlphyattach(device_t parent, device_t se
 	mii_unlock(mii);
 
 #define	ADD(m, c)	ifmedia_add(>mii_media, (m), (c), NULL)
-#define	PRINT(str)	aprint_normal("%s%s", sep, str); sep = ", "
+#define	PRINT(str)	 \
+	do {		 \
+		aprint_normal("%s%s", sep, str);	 \
+		sep = ", "; \
+	} while (/* CONSTCOND */0)
 
 	if (tsc->sc_tlphycap) {
 		mii_lock(mii);
@@ -179,15 +183,13 @@ tlphyattach(device_t parent, device_t se
 			ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_5, 0, sc->mii_inst),
 			0);
 			PRINT("10base5");
-		}
+		} else
+			PRINT("no media present");
 		aprint_normal("\n");
 	}
 	if (sc->mii_capabilities & BMSR_MEDIAMASK)
 		mii_phy_add_media(sc);
 	else {
-		if ((tsc->sc_tlphycap &
-		(TLPHY_MEDIA_10_2 | TLPHY_MEDIA_10_5)) == 0)
-			aprint_error_dev(self, "no media present\n");
 		/*
 		 * mii_phy_add_media() automatically install power handler,
 		 * but if_media_add() doesn't. Do it now.



CVS commit: src/sys/dev/mii

2020-06-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jun 23 14:36:00 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.165 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.152 -r1.153 src/sys/dev/mii/miidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.164 src/sys/dev/mii/miidevs.h:1.165
--- src/sys/dev/mii/miidevs.h:1.164	Wed Apr  8 03:01:28 2020
+++ src/sys/dev/mii/miidevs.h	Tue Jun 23 14:35:59 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.164 2020/04/08 03:01:28 msaitoh Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.165 2020/06/23 14:35:59 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.167 2020/04/08 03:01:05 msaitoh Exp
+ *	NetBSD: miidevs,v 1.168 2020/06/23 14:35:36 msaitoh Exp
  */
 
 /*-
@@ -630,8 +630,28 @@
 #define	MII_STR_xxVITESSE_VSC8601	"VSC8601 10/100/1000 PHY"
 #define	MII_MODEL_xxVITESSE_VSC8641	0x0003
 #define	MII_STR_xxVITESSE_VSC8641	"Vitesse VSC8641 10/100/1000TX PHY"
+#define	MII_MODEL_xxVITESSE_VSC8504	0x000c
+#define	MII_STR_xxVITESSE_VSC8504	"Vitesse VSC8504 quad 10/100/1000TX PHY"
+#define	MII_MODEL_xxVITESSE_VSC8552	0x000e
+#define	MII_STR_xxVITESSE_VSC8552	"Vitesse VSC8552 dual 10/100/1000TX PHY"
+#define	MII_MODEL_xxVITESSE_VSC8502	0x0012
+#define	MII_STR_xxVITESSE_VSC8502	"Vitesse VSC8502 dual 10/100/1000TX PHY"
 #define	MII_MODEL_xxVITESSE_VSC8501	0x0013
 #define	MII_STR_xxVITESSE_VSC8501	"Vitesse VSC8501 10/100/1000TX PHY"
+#define	MII_MODEL_xxVITESSE_VSC8531	0x0017
+#define	MII_STR_xxVITESSE_VSC8531	"Vitesse VSC8531 10/100/1000TX PHY"
+#define	MII_MODEL_xxVITESSE_VSC8662	0x0026
+#define	MII_STR_xxVITESSE_VSC8662	"Vitesse VSC866[24] dual/quad 1000T 100FX 1000X PHY"
+#define	MII_MODEL_xxVITESSE_VSC8514	0x0027
+#define	MII_STR_xxVITESSE_VSC8514	"Vitesse VSC8514 quad 1000T PHY"
+#define	MII_MODEL_xxVITESSE_VSC8512	0x002e
+#define	MII_STR_xxVITESSE_VSC8512	"Vitesse VSC8512 12port 1000T PHY"
+#define	MII_MODEL_xxVITESSE_VSC8522	0x002f
+#define	MII_STR_xxVITESSE_VSC8522	"Vitesse VSC8522 12port 1000T PHY"
+#define	MII_MODEL_xxVITESSE_VSC8658	0x0035
+#define	MII_STR_xxVITESSE_VSC8658	"Vitesse VSC8658 octal 1000T 100FX 1000X PHY"
+#define	MII_MODEL_xxVITESSE_VSC8541	0x0037
+#define	MII_STR_xxVITESSE_VSC8541	"Vitesse VSC8541 1000T PHY"
 
 /* XaQti Corp. PHYs */
 #define	MII_MODEL_xxXAQTI_XMACII	0x

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.152 src/sys/dev/mii/miidevs_data.h:1.153
--- src/sys/dev/mii/miidevs_data.h:1.152	Wed Apr  8 03:01:28 2020
+++ src/sys/dev/mii/miidevs_data.h	Tue Jun 23 14:35:59 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.152 2020/04/08 03:01:28 msaitoh Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.153 2020/06/23 14:35:59 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.167 2020/04/08 03:01:05 msaitoh Exp
+ *	NetBSD: miidevs,v 1.168 2020/06/23 14:35:36 msaitoh Exp
  */
 
 /*-
@@ -258,7 +258,17 @@ struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_xxVIA, MII_MODEL_xxVIA_VT6103_2, MII_STR_xxVIA_VT6103_2 },
  { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8601, MII_STR_xxVITESSE_VSC8601 },
  { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8641, MII_STR_xxVITESSE_VSC8641 },
+ { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8504, MII_STR_xxVITESSE_VSC8504 },
+ { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8552, MII_STR_xxVITESSE_VSC8552 },
+ { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8502, MII_STR_xxVITESSE_VSC8502 },
  { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8501, MII_STR_xxVITESSE_VSC8501 },
+ { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8531, MII_STR_xxVITESSE_VSC8531 },
+ { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8662, MII_STR_xxVITESSE_VSC8662 },
+ { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8514, MII_STR_xxVITESSE_VSC8514 },
+ { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8512, MII_STR_xxVITESSE_VSC8512 },
+ { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8522, MII_STR_xxVITESSE_VSC8522 },
+ { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8658, MII_STR_xxVITESSE_VSC8658 },
+ { MII_OUI_xxVITESSE, MII_MODEL_xxVITESSE_VSC8541, MII_STR_xxVITESSE_VSC8541 },
  { MII_OUI_xxXAQTI, MII_MODEL_xxXAQTI_XMACII, MII_STR_xxXAQTI_XMACII },
  { 0, 0, NULL }
 };



CVS commit: src/sys/dev/mii

2020-06-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jun 23 14:36:00 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.165 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.152 -r1.153 src/sys/dev/mii/miidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-06-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jun 23 14:35:37 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
 Add some Microsemi (Vitesse) devices.


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/sys/dev/mii/miidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-06-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jun 23 14:35:37 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
 Add some Microsemi (Vitesse) devices.


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/sys/dev/mii/miidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.167 src/sys/dev/mii/miidevs:1.168
--- src/sys/dev/mii/miidevs:1.167	Wed Apr  8 03:01:05 2020
+++ src/sys/dev/mii/miidevs	Tue Jun 23 14:35:36 2020
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.167 2020/04/08 03:01:05 msaitoh Exp $
+$NetBSD: miidevs,v 1.168 2020/06/23 14:35:36 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -407,7 +407,17 @@ model xxVIA VT6103_2		0x0034	VT6103 10/1
 /* Vitesse PHYs (Now Microsemi) */
 model xxVITESSE VSC8601		0x0002 VSC8601 10/100/1000 PHY
 model xxVITESSE VSC8641		0x0003 Vitesse VSC8641 10/100/1000TX PHY
+model xxVITESSE VSC8504		0x000c Vitesse VSC8504 quad 10/100/1000TX PHY
+model xxVITESSE VSC8552		0x000e Vitesse VSC8552 dual 10/100/1000TX PHY
+model xxVITESSE VSC8502		0x0012 Vitesse VSC8502 dual 10/100/1000TX PHY
 model xxVITESSE VSC8501		0x0013 Vitesse VSC8501 10/100/1000TX PHY
+model xxVITESSE VSC8531		0x0017 Vitesse VSC8531 10/100/1000TX PHY
+model xxVITESSE VSC8662		0x0026 Vitesse VSC866[24] dual/quad 1000T 100FX 1000X PHY
+model xxVITESSE VSC8514		0x0027 Vitesse VSC8514 quad 1000T PHY
+model xxVITESSE VSC8512		0x002e Vitesse VSC8512 12port 1000T PHY
+model xxVITESSE VSC8522		0x002f Vitesse VSC8522 12port 1000T PHY
+model xxVITESSE VSC8658		0x0035 Vitesse VSC8658 octal 1000T 100FX 1000X PHY
+model xxVITESSE VSC8541		0x0037 Vitesse VSC8541 1000T PHY
 
 /* XaQti Corp. PHYs */
 model xxXAQTI XMACII		0x XaQti Corp. XMAC II gigabit interface



CVS commit: src/sys/dev/mii

2020-05-25 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon May 25 19:48:38 UTC 2020

Modified Files:
src/sys/dev/mii: brgphy.c brgphyreg.h

Log Message:
Add support for BCM54213PE RGMII clock delays, from OpenBSD


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/dev/mii/brgphy.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/mii/brgphyreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-05-25 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon May 25 19:48:38 UTC 2020

Modified Files:
src/sys/dev/mii: brgphy.c brgphyreg.h

Log Message:
Add support for BCM54213PE RGMII clock delays, from OpenBSD


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/dev/mii/brgphy.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/mii/brgphyreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/brgphy.c
diff -u src/sys/dev/mii/brgphy.c:1.89 src/sys/dev/mii/brgphy.c:1.90
--- src/sys/dev/mii/brgphy.c:1.89	Sat Mar 28 18:37:18 2020
+++ src/sys/dev/mii/brgphy.c	Mon May 25 19:48:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: brgphy.c,v 1.89 2020/03/28 18:37:18 thorpej Exp $	*/
+/*	$NetBSD: brgphy.c,v 1.90 2020/05/25 19:48:38 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.89 2020/03/28 18:37:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.90 2020/05/25 19:48:38 jmcneill Exp $");
 
 #include 
 #include 
@@ -118,7 +118,7 @@ static void	brgphy_crc_bug(struct mii_so
 static void	brgphy_disable_early_dac(struct mii_softc *);
 static void	brgphy_jumbo_settings(struct mii_softc *);
 static void	brgphy_eth_wirespeed(struct mii_softc *);
-
+static void	brgphy_bcm54xx_clock_delay(struct mii_softc *);
 
 static const struct mii_phy_funcs brgphy_copper_funcs = {
 	brgphy_service, brgphy_copper_status, brgphy_reset,
@@ -460,6 +460,12 @@ setit:
 break;
 			}
 			break;
+		case MII_OUI_BROADCOM4:
+			switch (sc->mii_mpd_model) {
+			case MII_MODEL_BROADCOM4_BCM54213PE:
+brgphy_bcm54xx_clock_delay(sc);
+break;
+			}
 		}
 	}
 
@@ -1242,3 +1248,30 @@ brgphy_eth_wirespeed(struct mii_softc *s
 	PHY_READ(sc, BRGPHY_MII_AUXCTL, );
 	PHY_WRITE(sc, BRGPHY_MII_AUXCTL, val | (1 << 15) | (1 << 4));
 }
+
+static void
+brgphy_bcm54xx_clock_delay(struct mii_softc *sc)
+{
+	uint16_t val;
+
+	PHY_WRITE(sc, BRGPHY_MII_AUXCTL, BRGPHY_AUXCTL_SHADOW_MISC |
+	BRGPHY_AUXCTL_SHADOW_MISC << BRGPHY_AUXCTL_MISC_READ_SHIFT);
+	PHY_READ(sc, BRGPHY_MII_AUXCTL, );
+	val &= BRGPHY_AUXCTL_MISC_DATA_MASK;
+	if (sc->mii_flags & MIIF_RXID)
+		val |= BRGPHY_AUXCTL_MISC_RGMII_SKEW_EN;
+	else
+		val &= ~BRGPHY_AUXCTL_MISC_RGMII_SKEW_EN;
+	PHY_WRITE(sc, BRGPHY_MII_AUXCTL, BRGPHY_AUXCTL_MISC_WRITE_EN |
+	BRGPHY_AUXCTL_SHADOW_MISC | val);
+
+	PHY_WRITE(sc, BRGPHY_MII_SHADOW_1C, BRGPHY_SHADOW_1C_CLK_CTRL);
+	PHY_READ(sc, BRGPHY_MII_SHADOW_1C, );
+	val &= BRGPHY_SHADOW_1C_DATA_MASK;
+	if (sc->mii_flags & MIIF_TXID)
+		val |= BRGPHY_SHADOW_1C_GTXCLK_EN;
+	else
+		val &= ~BRGPHY_SHADOW_1C_GTXCLK_EN;
+	PHY_WRITE(sc, BRGPHY_MII_SHADOW_1C, BRGPHY_SHADOW_1C_WRITE_EN |
+	BRGPHY_SHADOW_1C_CLK_CTRL | val);
+}

Index: src/sys/dev/mii/brgphyreg.h
diff -u src/sys/dev/mii/brgphyreg.h:1.11 src/sys/dev/mii/brgphyreg.h:1.12
--- src/sys/dev/mii/brgphyreg.h:1.11	Thu Apr 11 09:14:07 2019
+++ src/sys/dev/mii/brgphyreg.h	Mon May 25 19:48:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: brgphyreg.h,v 1.11 2019/04/11 09:14:07 msaitoh Exp $	*/
+/*	$NetBSD: brgphyreg.h,v 1.12 2020/05/25 19:48:38 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2000
@@ -192,6 +192,17 @@
 /* Begin: PHY register values for the 5706 PHY */
 /***/
 
+/*
+ * Aux control shadow register, bits 0-2 select function (0x00 to
+ * 0x07).
+ */
+#define BRGPHY_AUXCTL_SHADOW_MISC	0x07
+#define BRGPHY_AUXCTL_MISC_DATA_MASK	0x7ff8
+#define BRGPHY_AUXCTL_MISC_READ_SHIFT	12
+#define BRGPHY_AUXCTL_MISC_WRITE_EN	0x8000
+#define BRGPHY_AUXCTL_MISC_RGMII_SKEW_EN 0x0200
+#define BRGPHY_AUXCTL_MISC_WIRESPEED_EN	0x0010
+
 /* 
  * Shadow register 0x1C, bit 15 is write enable,
  * bits 14-10 select function (0x00 to 0x1F).
@@ -199,6 +210,11 @@
 #define BRGPHY_MII_SHADOW_1C		0x1C
 #define BRGPHY_SHADOW_1C_WRITE_EN	0x8000
 #define BRGPHY_SHADOW_1C_SELECT_MASK	0x7C00
+#define BRGPHY_SHADOW_1C_DATA_MASK	0x03FF
+
+/* Shadow 0x1C Clock Alignment Control Register (select value 0x03) */
+#define BRGPHY_SHADOW_1C_CLK_CTRL	(0x03 << 10)
+#define BRGPHY_SHADOW_1C_GTXCLK_EN	0x0200
 
 /* Shadow 0x1C Mode Control Register (select value 0x1F) */
 #define BRGPHY_SHADOW_1C_MODE_CTRL	(0x1F << 10)



CVS commit: src/sys/dev/mii

2020-05-25 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon May 25 19:47:59 UTC 2020

Modified Files:
src/sys/dev/mii: miivar.h

Log Message:
Add MIIF_RXID and MIIF_TXID flags to signal that RX or TX delays are required, 
from OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/mii/miivar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-05-25 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon May 25 19:47:59 UTC 2020

Modified Files:
src/sys/dev/mii: miivar.h

Log Message:
Add MIIF_RXID and MIIF_TXID flags to signal that RX or TX delays are required, 
from OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/mii/miivar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/miivar.h
diff -u src/sys/dev/mii/miivar.h:1.70 src/sys/dev/mii/miivar.h:1.71
--- src/sys/dev/mii/miivar.h:1.70	Sun Mar 15 23:04:50 2020
+++ src/sys/dev/mii/miivar.h	Mon May 25 19:47:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: miivar.h,v 1.70 2020/03/15 23:04:50 thorpej Exp $	*/
+/*	$NetBSD: miivar.h,v 1.71 2020/05/25 19:47:58 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2020 The NetBSD Foundation, Inc.
@@ -175,6 +175,8 @@ typedef struct mii_softc mii_softc_t;
 #define	MIIF_FORCEANEG	0x0400		/* force auto-negotiation */
 #define	MIIF_PROBING	0x0800		/* PHY probe in-progress */
 #define	MIIF_EXITING	0x1000		/* MII is exiting */
+#define	MIIF_RXID	0x2000		/* add RX delay */
+#define	MIIF_TXID	0x4000		/* add TX delay */
 
 #define	MIIF_INHERIT_MASK (MIIF_NOISOLATE | MIIF_NOLOOP | MIIF_AUTOTSLEEP)
 



CVS commit: src/sys/dev/mii

2020-04-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr  8 03:01:58 UTC 2020

Modified Files:
src/sys/dev/mii: rdcphy.c

Log Message:
 Add two new RDC PHYs from Andrius V.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/mii/rdcphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-04-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr  8 03:01:58 UTC 2020

Modified Files:
src/sys/dev/mii: rdcphy.c

Log Message:
 Add two new RDC PHYs from Andrius V.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/mii/rdcphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/rdcphy.c
diff -u src/sys/dev/mii/rdcphy.c:1.7 src/sys/dev/mii/rdcphy.c:1.8
--- src/sys/dev/mii/rdcphy.c:1.7	Sun Mar 15 23:04:50 2020
+++ src/sys/dev/mii/rdcphy.c	Wed Apr  8 03:01:58 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: rdcphy.c,v 1.7 2020/03/15 23:04:50 thorpej Exp $*/
+/*  $NetBSD: rdcphy.c,v 1.8 2020/04/08 03:01:58 msaitoh Exp $*/
 
 /*-
  * Copyright (c) 2010, Pyun YongHyeon 
@@ -33,7 +33,7 @@
  * Driver for the RDC Semiconductor R6040 10/100 PHY.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rdcphy.c,v 1.7 2020/03/15 23:04:50 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rdcphy.c,v 1.8 2020/04/08 03:01:58 msaitoh Exp $");
 
 #include 
 #include 
@@ -75,6 +75,8 @@ static const struct mii_phy_funcs rdcphy
 
 static const struct mii_phydesc rdcphys[] = {
 	MII_PHY_DESC(xxRDC, R6040),
+	MII_PHY_DESC(xxRDC, R6040_2),
+	MII_PHY_DESC(xxRDC, R6040_3),
 	MII_PHY_END,
 };
 



CVS commit: src/sys/dev/mii

2020-04-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr  8 03:01:28 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
 Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.151 -r1.152 src/sys/dev/mii/miidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.163 src/sys/dev/mii/miidevs.h:1.164
--- src/sys/dev/mii/miidevs.h:1.163	Fri Mar 13 04:44:58 2020
+++ src/sys/dev/mii/miidevs.h	Wed Apr  8 03:01:28 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.163 2020/03/13 04:44:58 msaitoh Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.164 2020/04/08 03:01:28 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.166 2020/03/13 04:44:34 msaitoh Exp
+ *	NetBSD: miidevs,v 1.167 2020/04/08 03:01:05 msaitoh Exp
  */
 
 /*-
@@ -554,6 +554,10 @@
 /* RDC Semiconductor PHYs */
 #define	MII_MODEL_xxRDC_R6040	0x0003
 #define	MII_STR_xxRDC_R6040	"R6040 10/100 media interface"
+#define	MII_MODEL_xxRDC_R6040_2	0x0005
+#define	MII_STR_xxRDC_R6040_2	"R6040 10/100 media interface"
+#define	MII_MODEL_xxRDC_R6040_3	0x0006
+#define	MII_STR_xxRDC_R6040_3	"R6040 10/100 media interface"
 
 /* RealTek PHYs */
 #define	MII_MODEL_xxREALTEK_RTL8169S	0x0011

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.151 src/sys/dev/mii/miidevs_data.h:1.152
--- src/sys/dev/mii/miidevs_data.h:1.151	Fri Mar 13 04:44:58 2020
+++ src/sys/dev/mii/miidevs_data.h	Wed Apr  8 03:01:28 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.151 2020/03/13 04:44:58 msaitoh Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.152 2020/04/08 03:01:28 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.166 2020/03/13 04:44:34 msaitoh Exp
+ *	NetBSD: miidevs,v 1.167 2020/04/08 03:01:05 msaitoh Exp
  */
 
 /*-
@@ -229,6 +229,8 @@ struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_PMCSIERRA, MII_MODEL_PMCSIERRA_PM8354, MII_STR_PMCSIERRA_PM8354 },
  { MII_OUI_xxQUALSEMI, MII_MODEL_xxQUALSEMI_QS6612, MII_STR_xxQUALSEMI_QS6612 },
  { MII_OUI_xxRDC, MII_MODEL_xxRDC_R6040, MII_STR_xxRDC_R6040 },
+ { MII_OUI_xxRDC, MII_MODEL_xxRDC_R6040_2, MII_STR_xxRDC_R6040_2 },
+ { MII_OUI_xxRDC, MII_MODEL_xxRDC_R6040_3, MII_STR_xxRDC_R6040_3 },
  { MII_OUI_xxREALTEK, MII_MODEL_xxREALTEK_RTL8169S, MII_STR_xxREALTEK_RTL8169S },
  { MII_OUI_yyREALTEK, MII_MODEL_yyREALTEK_RTL8201L, MII_STR_yyREALTEK_RTL8201L },
  { MII_OUI_REALTEK, MII_MODEL_REALTEK_RTL8251, MII_STR_REALTEK_RTL8251 },



CVS commit: src/sys/dev/mii

2020-04-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr  8 03:01:05 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
 Add two new RDC PHYs from Andrius V.


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/sys/dev/mii/miidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.166 src/sys/dev/mii/miidevs:1.167
--- src/sys/dev/mii/miidevs:1.166	Fri Mar 13 04:44:34 2020
+++ src/sys/dev/mii/miidevs	Wed Apr  8 03:01:05 2020
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.166 2020/03/13 04:44:34 msaitoh Exp $
+$NetBSD: miidevs,v 1.167 2020/04/08 03:01:05 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -360,6 +360,8 @@ model xxQUALSEMI QS6612		0x QS6612 1
 
 /* RDC Semiconductor PHYs */
 model xxRDC R6040		0x0003 R6040 10/100 media interface
+model xxRDC R6040_2		0x0005 R6040 10/100 media interface
+model xxRDC R6040_3		0x0006 R6040 10/100 media interface
 
 /* RealTek PHYs */
 model xxREALTEK RTL8169S	0x0011 RTL8169S/8110S/8211 1000BASE-T media interface



CVS commit: src/sys/dev/mii

2020-04-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr  8 03:01:28 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
 Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.151 -r1.152 src/sys/dev/mii/miidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-04-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr  8 03:01:05 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
 Add two new RDC PHYs from Andrius V.


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/sys/dev/mii/miidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-03-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Mar 13 18:57:49 UTC 2020

Modified Files:
src/sys/dev/mii: atphy.c

Log Message:
Fix a bug that atphy(4) doesn't work with Attansic L2 rev. 1.
Reported by Rocky Hotas.

- On ASUS M2N-MX SE Plus (NVIDIA MCP61 with Attansic L2 rev. 1), changing
  debug port 0x29's value makes the next PHY read fail with error.  Read any
  register to ignore this problem if the PHY is Attansic L2 revision 1.
  I don't know if this problem is from L2 rev. 1 itself or from the
  combination because I have only one machine which has L2 rev. "1".
  At least, ASUS eee pc 900 (Attansic L2 rev. "2") has no this problem.
- Add comment. AR8021 document has no description about the power saving
  control register(debug port 0x29).
- Add comment. AR8031 document says the lower 14 bits are reserved and the
  default value is 0x36d0. Shouldn't we clear those bits?
- I have no document neither L1(F1) nor L2(F2), so I don't know whether the
  debug port access is correct or not.

Tested with the following machines:
- ASUS P5B SE, L1 rev. 5,age(4)
- ASUS K50IJ,  L1 rev. 9,ale(4)
- ASUS eee pc 900, L2 rev. 2,lii(4)
- ASUS M2N-MX SE Plus, L2 rev. 1,nfe(4)
- Intel DP55WB,82578(AR8021 rev. 2), wm(4)
- Dell inspiron 14z,   AR0835 rev. 9,alc(4)


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/mii/atphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-03-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Mar 13 18:57:49 UTC 2020

Modified Files:
src/sys/dev/mii: atphy.c

Log Message:
Fix a bug that atphy(4) doesn't work with Attansic L2 rev. 1.
Reported by Rocky Hotas.

- On ASUS M2N-MX SE Plus (NVIDIA MCP61 with Attansic L2 rev. 1), changing
  debug port 0x29's value makes the next PHY read fail with error.  Read any
  register to ignore this problem if the PHY is Attansic L2 revision 1.
  I don't know if this problem is from L2 rev. 1 itself or from the
  combination because I have only one machine which has L2 rev. "1".
  At least, ASUS eee pc 900 (Attansic L2 rev. "2") has no this problem.
- Add comment. AR8021 document has no description about the power saving
  control register(debug port 0x29).
- Add comment. AR8031 document says the lower 14 bits are reserved and the
  default value is 0x36d0. Shouldn't we clear those bits?
- I have no document neither L1(F1) nor L2(F2), so I don't know whether the
  debug port access is correct or not.

Tested with the following machines:
- ASUS P5B SE, L1 rev. 5,age(4)
- ASUS K50IJ,  L1 rev. 9,ale(4)
- ASUS eee pc 900, L2 rev. 2,lii(4)
- ASUS M2N-MX SE Plus, L2 rev. 1,nfe(4)
- Intel DP55WB,82578(AR8021 rev. 2), wm(4)
- Dell inspiron 14z,   AR0835 rev. 9,alc(4)


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/mii/atphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/atphy.c
diff -u src/sys/dev/mii/atphy.c:1.28 src/sys/dev/mii/atphy.c:1.29
--- src/sys/dev/mii/atphy.c:1.28	Fri Mar 13 04:44:34 2020
+++ src/sys/dev/mii/atphy.c	Fri Mar 13 18:57:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: atphy.c,v 1.28 2020/03/13 04:44:34 msaitoh Exp $ */
+/*	$NetBSD: atphy.c,v 1.29 2020/03/13 18:57:49 msaitoh Exp $ */
 /*	$OpenBSD: atphy.c,v 1.1 2008/09/25 20:47:16 brad Exp $	*/
 
 /*-
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.28 2020/03/13 04:44:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.29 2020/03/13 18:57:49 msaitoh Exp $");
 
 #include 
 #include 
@@ -404,10 +404,30 @@ atphy_reset(struct mii_softc *sc)
 	uint16_t reg;
 	int i;
 
-	/* Take PHY out of power down mode. */
+	/*
+	 * Take PHY out of power down mode.
+	 *
+	 * XXX AR8021 document has no description about the power saving
+	 * control register. Shouldn't we write it?
+	 */
 	PHY_WRITE(sc, 29, 0x29);
+	/*
+	 * XXX AR8031 document says the lower 14 bits are reserved and the
+	 * default value is 0x36d0. Shouldn't we clear those bits?
+	 * I have no document neither L1(F1) nor L2(F2).
+	 */
 	PHY_WRITE(sc, 30, 0);
 
+	if ((sc->mii_mpd_model == MII_MODEL_ATTANSIC_L2)
+	&& (sc->mii_mpd_rev == 1)) {
+		/*
+		 * On NVIDIA MCP61 with Attansic L2 rev. 1, changing debug
+		 * port 0x29's value makes the next PHY read fail with error.
+		 * This is observed on ASUS M2N-MX SE Plus. Read any register
+		 * to ignore this problem.
+		 */
+		(void)PHY_READ(sc, ATPHY_SCR, );
+	}
 	PHY_READ(sc, ATPHY_SCR, );
 	/* Enable automatic crossover. */
 	reg |= ATPHY_SCR_AUTO_X_MODE;



CVS commit: src/sys/dev/mii

2020-03-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Mar 13 04:44:58 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.150 -r1.151 src/sys/dev/mii/miidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.162 src/sys/dev/mii/miidevs.h:1.163
--- src/sys/dev/mii/miidevs.h:1.162	Thu Feb 27 06:17:50 2020
+++ src/sys/dev/mii/miidevs.h	Fri Mar 13 04:44:58 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.162 2020/02/27 06:17:50 msaitoh Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.163 2020/03/13 04:44:58 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.164 2020/02/27 06:17:28 msaitoh Exp
+ *	NetBSD: miidevs,v 1.166 2020/03/13 04:44:34 msaitoh Exp
  */
 
 /*-
@@ -60,10 +60,12 @@
 #define	MII_OUI_TRIDIUM	0x0001f0	/* Tridium */
 #define	MII_OUI_DATATRACK	0x0002c6	/* Data Track Technology */
 #define	MII_OUI_AGERE	0x00053d	/* Agere */
+#define	MII_OUI_QUAKE	0x000897	/* Quake Technologies */
 #define	MII_OUI_BANKSPEED	0x0006b8	/* Bankspeed Pty */
 #define	MII_OUI_NETEXCELL	0x0008bb	/* NetExcell */
 #define	MII_OUI_NETAS	0x0009c3	/* Netas */
 #define	MII_OUI_BROADCOM2	0x000af7	/* Broadcom Corporation */
+#define	MII_OUI_AELUROS	0x000b25	/* Aeluros */
 #define	MII_OUI_RALINK	0x000c43	/* Ralink Technology */
 #define	MII_OUI_ASIX	0x000ec6	/* ASIX */
 #define	MII_OUI_BROADCOM	0x001018	/* Broadcom Corporation */
@@ -71,7 +73,6 @@
 #define	MII_OUI_ALTIMA	0x0010a9	/* Altima Communications */
 #define	MII_OUI_ENABLESEMI	0x0010dd	/* Enable Semiconductor */
 #define	MII_OUI_SUNPLUS	0x001105	/* Sunplus Technology */
-#define	MII_OUI_ATHEROS	0x001374	/* Atheros */
 #define	MII_OUI_TERANETICS	0x0014a6	/* Teranetics */
 #define	MII_OUI_RALINK2	0x0017a5	/* Ralink Technology */
 #define	MII_OUI_AQUANTIA	0x0017b6	/* Aquantia Corporation */
@@ -168,13 +169,7 @@
 #define	MII_MODEL_xxAMLOGIC_GXL	0x
 #define	MII_STR_xxAMLOGIC_GXL	"Meson GXL internal PHY"
 
-/* Atheros PHYs */
-#define	MII_MODEL_ATHEROS_F1	0x0001
-#define	MII_STR_ATHEROS_F1	"F1 10/100/1000 PHY"
-#define	MII_MODEL_ATHEROS_F2	0x0002
-#define	MII_STR_ATHEROS_F2	"F2 10/100 PHY"
-
-/* Attansic PHYs */
+/* Attansic/Atheros PHYs */
 #define	MII_MODEL_ATTANSIC_L1	0x0001
 #define	MII_STR_ATTANSIC_L1	"L1 10/100/1000 PHY"
 #define	MII_MODEL_ATTANSIC_L2	0x0002
@@ -602,6 +597,10 @@
 #define	MII_MODEL_SMSC_LAN8742	0x0013
 #define	MII_STR_SMSC_LAN8742	"SMSC LAN8742 10/100 media interface"
 
+/* Teranetics PHY */
+#define	MII_MODEL_TERANETICS_TN1010	0x0001
+#define	MII_STR_TERANETICS_TN1010	"Teranetics TN1010 10GBase-T PHY"
+
 /* Texas Instruments PHYs */
 #define	MII_MODEL_TI_TLAN10T	0x0001
 #define	MII_STR_TI_TLAN10T	"ThunderLAN 10BASE-T media interface"

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.150 src/sys/dev/mii/miidevs_data.h:1.151
--- src/sys/dev/mii/miidevs_data.h:1.150	Thu Feb 27 06:17:50 2020
+++ src/sys/dev/mii/miidevs_data.h	Fri Mar 13 04:44:58 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.150 2020/02/27 06:17:50 msaitoh Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.151 2020/03/13 04:44:58 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.164 2020/02/27 06:17:28 msaitoh Exp
+ *	NetBSD: miidevs,v 1.166 2020/03/13 04:44:34 msaitoh Exp
  */
 
 /*-
@@ -55,8 +55,6 @@ struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_ALTIMA, MII_MODEL_ALTIMA_Am79C874, MII_STR_ALTIMA_Am79C874 },
  { MII_OUI_AMLOGIC, MII_MODEL_AMLOGIC_GXL, MII_STR_AMLOGIC_GXL },
  { MII_OUI_xxAMLOGIC, MII_MODEL_xxAMLOGIC_GXL, MII_STR_xxAMLOGIC_GXL },
- { MII_OUI_ATHEROS, MII_MODEL_ATHEROS_F1, MII_STR_ATHEROS_F1 },
- { MII_OUI_ATHEROS, MII_MODEL_ATHEROS_F2, MII_STR_ATHEROS_F2 },
  { MII_OUI_ATTANSIC, MII_MODEL_ATTANSIC_L1, MII_STR_ATTANSIC_L1 },
  { MII_OUI_ATTANSIC, MII_MODEL_ATTANSIC_L2, MII_STR_ATTANSIC_L2 },
  { MII_OUI_ATTANSIC, MII_MODEL_ATTANSIC_AR8021, MII_STR_ATTANSIC_AR8021 },
@@ -248,6 +246,7 @@ struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_SMSC, MII_MODEL_SMSC_LAN8740, MII_STR_SMSC_LAN8740 },
  { MII_OUI_SMSC, MII_MODEL_SMSC_LAN8741A, MII_STR_SMSC_LAN8741A },
  { MII_OUI_SMSC, MII_MODEL_SMSC_LAN8742, MII_STR_SMSC_LAN8742 },
+ { MII_OUI_TERANETICS, MII_MODEL_TERANETICS_TN1010, MII_STR_TERANETICS_TN1010 },
  { MII_OUI_TI, MII_MODEL_TI_TLAN10T, MII_STR_TI_TLAN10T },
  { MII_OUI_TI, MII_MODEL_TI_100VGPMI, MII_STR_TI_100VGPMI },
  { MII_OUI_TI, MII_MODEL_TI_TNETE2101, MII_STR_TI_TNETE2101 },



CVS commit: src/sys/dev/mii

2020-03-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Mar 13 04:44:34 UTC 2020

Modified Files:
src/sys/dev/mii: atphy.c miidevs

Log Message:
0x001374 is non-bitreversed value of Attansic OUI(0x00c82e).

Attansic/Atheros correctly uses ID1 and ID2 register, so delete all 0x001374
related entries.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/mii/atphy.c
cvs rdiff -u -r1.165 -r1.166 src/sys/dev/mii/miidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/atphy.c
diff -u src/sys/dev/mii/atphy.c:1.27 src/sys/dev/mii/atphy.c:1.28
--- src/sys/dev/mii/atphy.c:1.27	Fri Dec 13 08:30:26 2019
+++ src/sys/dev/mii/atphy.c	Fri Mar 13 04:44:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: atphy.c,v 1.27 2019/12/13 08:30:26 msaitoh Exp $ */
+/*	$NetBSD: atphy.c,v 1.28 2020/03/13 04:44:34 msaitoh Exp $ */
 /*	$OpenBSD: atphy.c,v 1.1 2008/09/25 20:47:16 brad Exp $	*/
 
 /*-
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.27 2019/12/13 08:30:26 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.28 2020/03/13 04:44:34 msaitoh Exp $");
 
 #include 
 #include 
@@ -103,7 +103,6 @@ const struct mii_phy_funcs atphy_funcs =
 };
 
 static const struct mii_phydesc atphys[] = {
-	MII_PHY_DESC(ATHEROS, F1),
 	MII_PHY_DESC(ATTANSIC, L1),
 	MII_PHY_DESC(ATTANSIC, L2),
 	MII_PHY_DESC(ATTANSIC, AR8021),

Index: src/sys/dev/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.165 src/sys/dev/mii/miidevs:1.166
--- src/sys/dev/mii/miidevs:1.165	Fri Mar 13 04:43:03 2020
+++ src/sys/dev/mii/miidevs	Fri Mar 13 04:44:34 2020
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.165 2020/03/13 04:43:03 msaitoh Exp $
+$NetBSD: miidevs,v 1.166 2020/03/13 04:44:34 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -66,7 +66,6 @@ oui MICREL			0x0010a1	Micrel
 oui ALTIMA			0x0010a9	Altima Communications
 oui ENABLESEMI			0x0010dd	Enable Semiconductor
 oui SUNPLUS			0x001105	Sunplus Technology
-oui ATHEROS			0x001374	Atheros
 oui TERANETICS			0x0014a6	Teranetics
 oui RALINK2			0x0017a5	Ralink Technology
 oui AQUANTIA			0x0017b6	Aquantia Corporation
@@ -150,11 +149,7 @@ model ALTIMA Am79C874		0x0021 Am79C874 1
 model AMLOGIC GXL		0x Meson GXL internal PHY
 model xxAMLOGIC GXL		0x Meson GXL internal PHY
 
-/* Atheros PHYs */
-model ATHEROS F1		0x0001 F1 10/100/1000 PHY
-model ATHEROS F2		0x0002 F2 10/100 PHY
-
-/* Attansic PHYs */
+/* Attansic/Atheros PHYs */
 model ATTANSIC L1		0x0001 L1 10/100/1000 PHY
 model ATTANSIC L2		0x0002 L2 10/100 PHY
 model ATTANSIC AR8021		0x0004 Atheros AR8021 10/100/1000 PHY



CVS commit: src/sys/dev/mii

2020-03-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Mar 13 04:44:58 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.150 -r1.151 src/sys/dev/mii/miidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-03-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Mar 13 04:44:34 UTC 2020

Modified Files:
src/sys/dev/mii: atphy.c miidevs

Log Message:
0x001374 is non-bitreversed value of Attansic OUI(0x00c82e).

Attansic/Atheros correctly uses ID1 and ID2 register, so delete all 0x001374
related entries.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/mii/atphy.c
cvs rdiff -u -r1.165 -r1.166 src/sys/dev/mii/miidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-03-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Mar 13 04:43:04 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
- Add Quake Technologies and Aeluros' OUI
- Add Teranetics TN1010 10GBase-T PHY


To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.165 src/sys/dev/mii/miidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-03-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Mar 13 04:43:04 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
- Add Quake Technologies and Aeluros' OUI
- Add Teranetics TN1010 10GBase-T PHY


To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.165 src/sys/dev/mii/miidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.164 src/sys/dev/mii/miidevs:1.165
--- src/sys/dev/mii/miidevs:1.164	Thu Feb 27 06:17:28 2020
+++ src/sys/dev/mii/miidevs	Fri Mar 13 04:43:03 2020
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.164 2020/02/27 06:17:28 msaitoh Exp $
+$NetBSD: miidevs,v 1.165 2020/03/13 04:43:03 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -53,10 +53,12 @@ oui AMD0x1a	Advanced Micro Devic
 oui TRIDIUM			0x0001f0	Tridium
 oui DATATRACK			0x0002c6	Data Track Technology
 oui AGERE			0x00053d	Agere
+oui QUAKE			0x000897	Quake Technologies
 oui BANKSPEED			0x0006b8	Bankspeed Pty
 oui NETEXCELL			0x0008bb	NetExcell
 oui NETAS			0x0009c3	Netas
 oui BROADCOM2			0x000af7	Broadcom Corporation
+oui AELUROS			0x000b25	Aeluros
 oui RALINK			0x000c43	Ralink Technology
 oui ASIX			0x000ec6	ASIX
 oui BROADCOM			0x001018	Broadcom Corporation
@@ -389,6 +391,9 @@ model SMSC LAN8740		0x0011 SMSC LAN8740 
 model SMSC LAN8741A		0x0012 SMSC LAN8741A 10/100 media interface
 model SMSC LAN8742		0x0013 SMSC LAN8742 10/100 media interface
 
+/* Teranetics PHY */
+model TERANETICS TN1010		0x0001 Teranetics TN1010 10GBase-T PHY
+
 /* Texas Instruments PHYs */
 model TI TLAN10T		0x0001 ThunderLAN 10BASE-T media interface
 model TI 100VGPMI		0x0002 ThunderLAN 100VG-AnyLan media interface



Re: CVS commit: src/sys/dev/mii

2020-02-26 Thread Masanobu SAITOH
On 2020/02/27 15:17, SAITOH Masanobu wrote:
> Module Name:  src
> Committed By: msaitoh
> Date: Thu Feb 27 06:17:28 UTC 2020
> 
> Modified Files:
>   src/sys/dev/mii: miidevs
> 
> Log Message:
>  Use xxVIA instead of VIA.
> 
>  0x004063 is VIA's official OUI but VT6103 use 0x0002c6.
> 0x0002c6 is non-bitreversed value of 0x004063. Reported by Andrius

It was PR kern/55016.

> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.163 -r1.164 src/sys/dev/mii/miidevs
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
> 


-- 
---
SAITOH Masanobu (msai...@execsw.org
 msai...@netbsd.org)


CVS commit: src/sys/dev/mii

2020-02-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Feb 27 06:17:50 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
 Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.149 -r1.150 src/sys/dev/mii/miidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/mii

2020-02-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Feb 27 06:17:28 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
 Use xxVIA instead of VIA.

 0x004063 is VIA's official OUI but VT6103 use 0x0002c6.
0x0002c6 is non-bitreversed value of 0x004063. Reported by Andrius V.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/dev/mii/miidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



  1   2   3   4   5   6   7   8   >