CVS commit: src/sys/dev/mii

2024-06-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Jun  6 21:28:31 UTC 2024

Modified Files:
src/sys/dev/mii: bmtphyreg.h icsphyreg.h

Log Message:
s/dupled/duplex/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/mii/bmtphyreg.h \
src/sys/dev/mii/icsphyreg.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

2024-06-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Jun  6 21:17:37 UTC 2024

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

Log Message:
s/chane/change/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/mii/amhphyreg.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

2024-06-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Jun  6 21:17:37 UTC 2024

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

Log Message:
s/chane/change/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/mii/amhphyreg.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/amhphyreg.h
diff -u src/sys/dev/mii/amhphyreg.h:1.1 src/sys/dev/mii/amhphyreg.h:1.2
--- src/sys/dev/mii/amhphyreg.h:1.1	Sat Aug 25 04:06:26 2001
+++ src/sys/dev/mii/amhphyreg.h	Thu Jun  6 21:17:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: amhphyreg.h,v 1.1 2001/08/25 04:06:26 thorpej Exp $	*/
+/*	$NetBSD: amhphyreg.h,v 1.2 2024/06/06 21:17:37 andvar Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -50,7 +50,7 @@
 #define	SER_SCE			0x0200	/* speed change enable */
 #define	SER_GE			0x0100	/* global enable */
 #define	SER_LSC			0x0010	/* link status change */
-#define	SER_DMC			0x0008	/* duplex mode chane */
+#define	SER_DMC			0x0008	/* duplex mode change */
 #define	SER_ANC			0x0004	/* auto-negotiation change */
 #define	SER_SC			0x0002	/* speed change */
 #define	SER_G			0x0001	/* global event pending */



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.



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


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)


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)


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

2019-11-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov 27 08:53:32 UTC 2019

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

Log Message:
 Print dmesg correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/mii/ipgphy.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/ipgphy.c
diff -u src/sys/dev/mii/ipgphy.c:1.6 src/sys/dev/mii/ipgphy.c:1.7
--- src/sys/dev/mii/ipgphy.c:1.6	Thu Nov 21 09:48:57 2019
+++ src/sys/dev/mii/ipgphy.c	Wed Nov 27 08:53:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipgphy.c,v 1.6 2019/11/21 09:48:57 msaitoh Exp $ */
+/*	$NetBSD: ipgphy.c,v 1.7 2019/11/27 08:53:32 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.6 2019/11/21 09:48:57 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipgphy.c,v 1.7 2019/11/27 08:53:32 msaitoh Exp $");
 
 #include 
 #include 
@@ -119,6 +119,7 @@ ipgphy_attach(device_t parent, device_t 
 	if (sc->mii_capabilities & BMSR_EXTSTAT)
 		PHY_READ(sc, MII_EXTSR, >mii_extcapabilities);
 
+	aprint_normal_dev(self, "");
 	mii_phy_add_media(sc);
 	aprint_normal("\n");
 }



CVS commit: src/sys/dev/mii

2019-11-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov 27 08:53:32 UTC 2019

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

Log Message:
 Print dmesg correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/mii/ipgphy.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

2019-11-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Nov 26 08:21:03 UTC 2019

Modified Files:
src/sys/dev/mii: amhphy.c brgphy.c glxtphy.c gphyter.c ikphy.c

Log Message:
 Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/mii/amhphy.c
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/mii/brgphy.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/mii/glxtphy.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/mii/gphyter.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/mii/ikphy.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/amhphy.c
diff -u src/sys/dev/mii/amhphy.c:1.23 src/sys/dev/mii/amhphy.c:1.24
--- src/sys/dev/mii/amhphy.c:1.23	Mon Mar 25 07:34:13 2019
+++ src/sys/dev/mii/amhphy.c	Tue Nov 26 08:21:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: amhphy.c,v 1.23 2019/03/25 07:34:13 msaitoh Exp $	*/
+/*	$NetBSD: amhphy.c,v 1.24 2019/11/26 08:21:03 msaitoh Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amhphy.c,v 1.23 2019/03/25 07:34:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amhphy.c,v 1.24 2019/11/26 08:21:03 msaitoh Exp $");
 
 #include 
 #include 
@@ -200,7 +200,7 @@ amhphy_status(struct mii_softc *sc)
 
 	if (bmcr & BMCR_AUTOEN) {
 		/*
-		 * The media status bits are only valid of autonegotiation
+		 * The media status bits are only valid if autonegotiation
 		 * has completed (or it's disabled).
 		 */
 		if ((bmsr & BMSR_ACOMP) == 0) {

Index: src/sys/dev/mii/brgphy.c
diff -u src/sys/dev/mii/brgphy.c:1.84 src/sys/dev/mii/brgphy.c:1.85
--- src/sys/dev/mii/brgphy.c:1.84	Thu Apr 11 08:50:20 2019
+++ src/sys/dev/mii/brgphy.c	Tue Nov 26 08:21:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: brgphy.c,v 1.84 2019/04/11 08:50:20 msaitoh Exp $	*/
+/*	$NetBSD: brgphy.c,v 1.85 2019/11/26 08:21:03 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.84 2019/04/11 08:50:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.85 2019/11/26 08:21:03 msaitoh Exp $");
 
 #include 
 #include 
@@ -491,7 +491,7 @@ brgphy_copper_status(struct mii_softc *s
 
 	if (bmcr & BMCR_AUTOEN) {
 		/*
-		 * The media status bits are only valid of autonegotiation
+		 * The media status bits are only valid if autonegotiation
 		 * has completed (or it's disabled).
 		 */
 		if ((bmsr & BMSR_ACOMP) == 0) {

Index: src/sys/dev/mii/glxtphy.c
diff -u src/sys/dev/mii/glxtphy.c:1.29 src/sys/dev/mii/glxtphy.c:1.30
--- src/sys/dev/mii/glxtphy.c:1.29	Mon Mar 25 07:34:13 2019
+++ src/sys/dev/mii/glxtphy.c	Tue Nov 26 08:21:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: glxtphy.c,v 1.29 2019/03/25 07:34:13 msaitoh Exp $	*/
+/*	$NetBSD: glxtphy.c,v 1.30 2019/11/26 08:21:03 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: glxtphy.c,v 1.29 2019/03/25 07:34:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: glxtphy.c,v 1.30 2019/11/26 08:21:03 msaitoh Exp $");
 
 #include 
 #include 
@@ -223,7 +223,7 @@ glxtphy_status(struct mii_softc *sc)
 
 	if (bmcr & BMCR_AUTOEN) {
 		/*
-		 * The media status bits are only valid of autonegotiation
+		 * The media status bits are only valid if autonegotiation
 		 * has completed (or it's disabled).
 		 */
 		if ((qsr & QSR_ACOMP) == 0) {

Index: src/sys/dev/mii/gphyter.c
diff -u src/sys/dev/mii/gphyter.c:1.34 src/sys/dev/mii/gphyter.c:1.35
--- src/sys/dev/mii/gphyter.c:1.34	Thu Nov 21 09:48:57 2019
+++ src/sys/dev/mii/gphyter.c	Tue Nov 26 08:21:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: gphyter.c,v 1.34 2019/11/21 09:48:57 msaitoh Exp $	*/
+/*	$NetBSD: gphyter.c,v 1.35 2019/11/26 08:21:03 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gphyter.c,v 1.34 2019/11/21 09:48:57 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gphyter.c,v 1.35 2019/11/26 08:21:03 msaitoh Exp $");
 
 #include 
 #include 
@@ -255,7 +255,7 @@ gphyter_status(struct mii_softc *sc)
 
 	if (bmcr & BMCR_AUTOEN) {
 		/*
-		 * The media status bits are only valid of autonegotiation
+		 * The media status bits are only valid if autonegotiation
 		 * has completed (or it's disabled).
 		 */
 		if ((bmsr & BMSR_ACOMP) == 0) {

Index: src/sys/dev/mii/ikphy.c
diff -u src/sys/dev/mii/ikphy.c:1.16 src/sys/dev/mii/ikphy.c:1.17
--- src/sys/dev/mii/ikphy.c:1.16	Wed Sep  4 06:28:30 2019
+++ src/sys/dev/mii/ikphy.c	Tue Nov 26 08:21:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ikphy.c,v 1.16 2019/09/04 06:28:30 msaitoh Exp $	*/
+/*	$NetBSD: ikphy.c,v 1.17 2019/11/26 08:21:03 msaitoh Exp $	*/
 
 /***
 Copyright (c) 2001-2005, Intel Corporation 
@@ -59,7 +59,7 @@ POSSIBILITY OF SUCH 

CVS commit: src/sys/dev/mii

2019-11-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Nov 26 08:21:03 UTC 2019

Modified Files:
src/sys/dev/mii: amhphy.c brgphy.c glxtphy.c gphyter.c ikphy.c

Log Message:
 Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/mii/amhphy.c
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/mii/brgphy.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/mii/glxtphy.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/mii/gphyter.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/mii/ikphy.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

2019-11-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Nov 26 08:19:51 UTC 2019

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

Log Message:
 KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/mii/jmphy.c
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/mii/makphy.c
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/mii/qsphy.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

2019-11-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Nov 26 08:19:51 UTC 2019

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

Log Message:
 KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/mii/jmphy.c
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/mii/makphy.c
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/mii/qsphy.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/jmphy.c
diff -u src/sys/dev/mii/jmphy.c:1.1 src/sys/dev/mii/jmphy.c:1.2
--- src/sys/dev/mii/jmphy.c:1.1	Wed Oct 30 12:06:26 2019
+++ src/sys/dev/mii/jmphy.c	Tue Nov 26 08:19:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: jmphy.c,v 1.1 2019/10/30 12:06:26 msaitoh Exp $ */
+/*	$NetBSD: jmphy.c,v 1.2 2019/11/26 08:19:51 msaitoh Exp $ */
 /*	$OpenBSD: jmphy.c,v 1.6 2015/03/14 03:38:48 jsg Exp $	*/
 /*-
  * Copyright (c) 2008, Pyun YongHyeon 
@@ -127,9 +127,7 @@ jmphy_service(struct mii_softc *sc, stru
 
 	switch (cmd) {
 	case MII_POLLSTAT:
-		/*
-		 * If we're not polling our PHY instance, just return.
-		 */
+		/* If we're not polling our PHY instance, just return. */
 		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
 			return 0;
 		break;
@@ -145,9 +143,7 @@ jmphy_service(struct mii_softc *sc, stru
 			return 0;
 		}
 
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
+		/* If the interface is not up, don't do anything. */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
 			break;
 
@@ -156,21 +152,15 @@ jmphy_service(struct mii_softc *sc, stru
 		break;
 
 	case MII_TICK:
-		/*
-		 * If we're not currently selected, just return.
-		 */
+		/* If we're not currently selected, just return. */
 		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
 			return 0;
 
-		/*
-		 * Is the interface even up?
-		 */
+		/* Is the interface even up? */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
 			return 0;
 
-		/*
-		 * Only used for autonegotiation.
-		 */
+		/* Only used for autonegotiation. */
 		if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO)
 			break;
 

Index: src/sys/dev/mii/makphy.c
diff -u src/sys/dev/mii/makphy.c:1.60 src/sys/dev/mii/makphy.c:1.61
--- src/sys/dev/mii/makphy.c:1.60	Wed Jul  3 17:40:29 2019
+++ src/sys/dev/mii/makphy.c	Tue Nov 26 08:19:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: makphy.c,v 1.60 2019/07/03 17:40:29 maxv Exp $	*/
+/*	$NetBSD: makphy.c,v 1.61 2019/11/26 08:19:51 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.60 2019/07/03 17:40:29 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.61 2019/11/26 08:19:51 msaitoh Exp $");
 
 #include 
 #include 
@@ -240,9 +240,7 @@ makphy_reset(struct mii_softc *sc)
 
 	mii_phy_reset(sc);
 
-	/*
-	 * Initialize PHY Specific Control Register.
-	 */
+	/* Initialize PHY Specific Control Register. */
 	PHY_READ(sc, MAKPHY_PSCR, );
 
 	/* Assert CRS on transmit. */

Index: src/sys/dev/mii/qsphy.c
diff -u src/sys/dev/mii/qsphy.c:1.52 src/sys/dev/mii/qsphy.c:1.53
--- src/sys/dev/mii/qsphy.c:1.52	Mon Mar 25 09:20:46 2019
+++ src/sys/dev/mii/qsphy.c	Tue Nov 26 08:19:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: qsphy.c,v 1.52 2019/03/25 09:20:46 msaitoh Exp $	*/
+/*	$NetBSD: qsphy.c,v 1.53 2019/11/26 08:19:51 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: qsphy.c,v 1.52 2019/03/25 09:20:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: qsphy.c,v 1.53 2019/11/26 08:19:51 msaitoh Exp $");
 
 #include 
 #include 
@@ -147,9 +147,7 @@ qsphy_service(struct mii_softc *sc, stru
 
 	switch (cmd) {
 	case MII_POLLSTAT:
-		/*
-		 * If we're not polling our PHY instance, just return.
-		 */
+		/* If we're not polling our PHY instance, just return. */
 		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
 			return 0;
 		break;
@@ -165,9 +163,7 @@ qsphy_service(struct mii_softc *sc, stru
 			return 0;
 		}
 
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
+		/* If the interface is not up, don't do anything. */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
 			break;
 
@@ -175,9 +171,7 @@ qsphy_service(struct mii_softc *sc, stru
 		break;
 
 	case MII_TICK:
-		/*
-		 * If we're not currently selected, just return.
-		 */
+		/* If we're not currently selected, just return. */
 		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
 			return 0;
 



CVS commit: src/sys/dev/mii

2019-11-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov 21 09:48:57 UTC 2019

Modified Files:
src/sys/dev/mii: gphyter.c ipgphy.c

Log Message:
 Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/mii/gphyter.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/mii/ipgphy.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/gphyter.c
diff -u src/sys/dev/mii/gphyter.c:1.33 src/sys/dev/mii/gphyter.c:1.34
--- src/sys/dev/mii/gphyter.c:1.33	Mon Mar 25 07:34:13 2019
+++ src/sys/dev/mii/gphyter.c	Thu Nov 21 09:48:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: gphyter.c,v 1.33 2019/03/25 07:34:13 msaitoh Exp $	*/
+/*	$NetBSD: gphyter.c,v 1.34 2019/11/21 09:48:57 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gphyter.c,v 1.33 2019/03/25 07:34:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gphyter.c,v 1.34 2019/11/21 09:48:57 msaitoh Exp $");
 
 #include 
 #include 
@@ -264,7 +264,7 @@ gphyter_status(struct mii_softc *sc)
 			return;
 		}
 
-		switch (physup & (PHY_SUP_SPEED1|PHY_SUP_SPEED0)) {
+		switch (physup & (PHY_SUP_SPEED1 | PHY_SUP_SPEED0)) {
 		case PHY_SUP_SPEED1:
 			mii->mii_media_active |= IFM_1000_T;
 			PHY_READ(sc, MII_100T2SR, );

Index: src/sys/dev/mii/ipgphy.c
diff -u src/sys/dev/mii/ipgphy.c:1.5 src/sys/dev/mii/ipgphy.c:1.6
--- src/sys/dev/mii/ipgphy.c:1.5	Thu Nov 21 03:04:21 2019
+++ src/sys/dev/mii/ipgphy.c	Thu Nov 21 09:48:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipgphy.c,v 1.5 2019/11/21 03:04:21 msaitoh Exp $ */
+/*	$NetBSD: ipgphy.c,v 1.6 2019/11/21 09:48:57 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.5 2019/11/21 03:04:21 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipgphy.c,v 1.6 2019/11/21 09:48:57 msaitoh Exp $");
 
 #include 
 #include 
@@ -118,7 +118,7 @@ ipgphy_attach(device_t parent, device_t 
 	//sc->mii_capabilities &= ~BMSR_ANEG;
 	if (sc->mii_capabilities & BMSR_EXTSTAT)
 		PHY_READ(sc, MII_EXTSR, >mii_extcapabilities);
- 
+
 	mii_phy_add_media(sc);
 	aprint_normal("\n");
 }
@@ -256,7 +256,7 @@ ipgphy_status(struct mii_softc *sc)
 
 	PHY_READ(sc, MII_BMSR, );
 	PHY_READ(sc, MII_BMSR, );
-	if (bmsr & BMSR_LINK) 
+	if (bmsr & BMSR_LINK)
 		mii->mii_media_status |= IFM_ACTIVE;
 
 	PHY_READ(sc, MII_BMCR, );



CVS commit: src/sys/dev/mii

2019-11-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov 21 09:48:57 UTC 2019

Modified Files:
src/sys/dev/mii: gphyter.c ipgphy.c

Log Message:
 Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/mii/gphyter.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/mii/ipgphy.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

2019-11-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov 21 03:04:22 UTC 2019

Modified Files:
src/sys/dev/mii: ipgphy.c ipgphyreg.h

Log Message:
 Add missing NetBSD RCS Id. Reported by Andrius V.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/mii/ipgphy.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/mii/ipgphyreg.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

2019-11-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov 21 03:04:22 UTC 2019

Modified Files:
src/sys/dev/mii: ipgphy.c ipgphyreg.h

Log Message:
 Add missing NetBSD RCS Id. Reported by Andrius V.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/mii/ipgphy.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/mii/ipgphyreg.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/ipgphy.c
diff -u src/sys/dev/mii/ipgphy.c:1.4 src/sys/dev/mii/ipgphy.c:1.5
--- src/sys/dev/mii/ipgphy.c:1.4	Thu Nov 14 09:06:21 2019
+++ src/sys/dev/mii/ipgphy.c	Thu Nov 21 03:04:21 2019
@@ -1,3 +1,4 @@
+/*	$NetBSD: ipgphy.c,v 1.5 2019/11/21 03:04:21 msaitoh Exp $ */
 /*	$OpenBSD: ipgphy.c,v 1.19 2015/07/19 06:28:12 yuo Exp $	*/
 
 /*-
@@ -32,7 +33,7 @@
  * Driver for the IC Plus IP1000A/IP1001 10/100/1000 PHY.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipgphy.c,v 1.4 2019/11/14 09:06:21 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipgphy.c,v 1.5 2019/11/21 03:04:21 msaitoh Exp $");
 
 #include 
 #include 

Index: src/sys/dev/mii/ipgphyreg.h
diff -u src/sys/dev/mii/ipgphyreg.h:1.2 src/sys/dev/mii/ipgphyreg.h:1.3
--- src/sys/dev/mii/ipgphyreg.h:1.2	Tue Nov 12 14:07:09 2019
+++ src/sys/dev/mii/ipgphyreg.h	Thu Nov 21 03:04:21 2019
@@ -1,3 +1,4 @@
+/*	$NetBSD: ipgphyreg.h,v 1.3 2019/11/21 03:04:21 msaitoh Exp $ */
 /*	$OpenBSD: ipgphyreg.h,v 1.3 2015/07/19 06:28:12 yuo Exp $	*/
 
 /*-



CVS commit: src/sys/dev/mii

2019-11-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov 20 08:51:00 UTC 2019

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

Log Message:
 Fix a bug that atphy(4) can't negotiate correctly when the media setting is
neither auto nor 1000baseT. Use correct index for mii_media_table[].

 History: mii_anar() is first added in OpenBSD and ported to NetBSD. On NetBSD,
only atphy(4) use this function. mii_physubr.c rev. 1.75 changed mii_anar()
for simplify. It changed the argument from the ifmedia word to ifm_data used
in our MII API, but the caller have not been changed. And then, PR kern/50206
was reported and the caller was modified by me to prevent panic but it was not
correct fix.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/mii/atphy.c
cvs rdiff -u -r1.87 -r1.88 src/sys/dev/mii/mii_physubr.c
cvs rdiff -u -r1.68 -r1.69 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/atphy.c
diff -u src/sys/dev/mii/atphy.c:1.24 src/sys/dev/mii/atphy.c:1.25
--- src/sys/dev/mii/atphy.c:1.24	Fri Oct 18 12:53:08 2019
+++ src/sys/dev/mii/atphy.c	Wed Nov 20 08:50:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: atphy.c,v 1.24 2019/10/18 12:53:08 hkenken Exp $ */
+/*	$NetBSD: atphy.c,v 1.25 2019/11/20 08:50:59 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.24 2019/10/18 12:53:08 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.25 2019/11/20 08:50:59 msaitoh Exp $");
 
 #include 
 #include 
@@ -273,7 +273,7 @@ atphy_service(struct mii_softc *sc, stru
 			return EINVAL;
 		}
 
-		anar = mii_anar(IFM_SUBTYPE(ife->ifm_media));
+		anar = mii_anar(ife);
 		if ((ife->ifm_media & IFM_FDX) != 0) {
 			bmcr |= BMCR_FDX;
 			/* Enable pause. */

Index: src/sys/dev/mii/mii_physubr.c
diff -u src/sys/dev/mii/mii_physubr.c:1.87 src/sys/dev/mii/mii_physubr.c:1.88
--- src/sys/dev/mii/mii_physubr.c:1.87	Tue Apr  9 11:28:45 2019
+++ src/sys/dev/mii/mii_physubr.c	Wed Nov 20 08:50:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii_physubr.c,v 1.87 2019/04/09 11:28:45 msaitoh Exp $	*/
+/*	$NetBSD: mii_physubr.c,v 1.88 2019/11/20 08:50:59 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.87 2019/04/09 11:28:45 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.88 2019/11/20 08:50:59 msaitoh Exp $");
 
 #include 
 #include 
@@ -697,19 +697,16 @@ mii_phy_resume(device_t dv, const pmf_qu
 
 
 /*
- * Given an ifmedia word, return the corresponding ANAR value.
+ * Given an ifmedia_entry, return the corresponding ANAR value.
  */
 uint16_t
-mii_anar(int media)
+mii_anar(struct ifmedia_entry *ife)
 {
-	int rv;
 
 #ifdef DIAGNOSTIC
-	if (/* media < 0 || */ media >= MII_NMEDIA)
+	if (ife->ifm_data >= MII_NMEDIA)
 		panic("mii_anar");
 #endif
 
-	rv = mii_media_table[media].mm_anar;
-
-	return rv;
+	return mii_media_table[ife->ifm_data].mm_anar;
 }

Index: src/sys/dev/mii/miivar.h
diff -u src/sys/dev/mii/miivar.h:1.68 src/sys/dev/mii/miivar.h:1.69
--- src/sys/dev/mii/miivar.h:1.68	Thu Apr 11 09:14:07 2019
+++ src/sys/dev/mii/miivar.h	Wed Nov 20 08:50:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: miivar.h,v 1.68 2019/04/11 09:14:07 msaitoh Exp $	*/
+/*	$NetBSD: miivar.h,v 1.69 2019/11/20 08:50:59 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -287,7 +287,7 @@ int	mii_mediachg(struct mii_data *);
 void	mii_tick(struct mii_data *);
 void	mii_pollstat(struct mii_data *);
 void	mii_down(struct mii_data *);
-uint16_t mii_anar(int);
+uint16_t mii_anar(struct ifmedia_entry *);
 
 int	mii_ifmedia_change(struct mii_data *);
 



CVS commit: src/sys/dev/mii

2019-11-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov 20 08:51:00 UTC 2019

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

Log Message:
 Fix a bug that atphy(4) can't negotiate correctly when the media setting is
neither auto nor 1000baseT. Use correct index for mii_media_table[].

 History: mii_anar() is first added in OpenBSD and ported to NetBSD. On NetBSD,
only atphy(4) use this function. mii_physubr.c rev. 1.75 changed mii_anar()
for simplify. It changed the argument from the ifmedia word to ifm_data used
in our MII API, but the caller have not been changed. And then, PR kern/50206
was reported and the caller was modified by me to prevent panic but it was not
correct fix.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/mii/atphy.c
cvs rdiff -u -r1.87 -r1.88 src/sys/dev/mii/mii_physubr.c
cvs rdiff -u -r1.68 -r1.69 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

2019-11-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Nov 18 15:09:59 UTC 2019

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

Log Message:
 Remove extra 10ms delay in ihphy_reset(). The delay are in if_wm.c side.
It's required for hardware full reset and it't not requred on soft reset.
 When ihphy.c was added in 9 years ago, some workaround code were not in
if_wm.c yet and the initialization code was not good.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 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

2019-11-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov 14 09:06:21 UTC 2019

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

Log Message:
- Use auto-negotiation when forcing 1000BASE-T.
- Add XXX comment for strange pause setting code. I suspect this is wrong.
- On my environments, 1000BASE-T half duplex doesn't work, so we might remove
  IFM_1000T_HDX from this device in future.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/mii/ipgphy.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/ipgphy.c
diff -u src/sys/dev/mii/ipgphy.c:1.3 src/sys/dev/mii/ipgphy.c:1.4
--- src/sys/dev/mii/ipgphy.c:1.3	Thu Nov 14 09:00:23 2019
+++ src/sys/dev/mii/ipgphy.c	Thu Nov 14 09:06:21 2019
@@ -32,7 +32,7 @@
  * Driver for the IC Plus IP1000A/IP1001 10/100/1000 PHY.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipgphy.c,v 1.3 2019/11/14 09:00:23 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipgphy.c,v 1.4 2019/11/14 09:06:21 msaitoh Exp $");
 
 #include 
 #include 
@@ -60,7 +60,7 @@ CFATTACH_DECL_NEW(ipgphy, sizeof(struct 
 
 static int	ipgphy_service(struct mii_softc *, struct mii_data *, int);
 static void	ipgphy_status(struct mii_softc *);
-static int	ipgphy_mii_phy_auto(struct mii_softc *);
+static int	ipgphy_mii_phy_auto(struct mii_softc *, u_int);
 static void	ipgphy_load_dspcode(struct mii_softc *);
 static void	ipgphy_reset(struct mii_softc *);
 
@@ -126,7 +126,7 @@ static int
 ipgphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
 {
 	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
-	uint16_t gig, reg, speed;
+	uint16_t reg, speed;
 
 	switch (cmd) {
 	case MII_POLLSTAT:
@@ -154,16 +154,13 @@ ipgphy_service(struct mii_softc *sc, str
 
 		switch (IFM_SUBTYPE(ife->ifm_media)) {
 		case IFM_AUTO:
-			(void)ipgphy_mii_phy_auto(sc);
-			goto done;
-			break;
-
 		case IFM_1000_T:
 			/*
-			 * XXX
-			 * Manual 1000baseT setting doesn't seem to work.
+			 * This device is required to do auto negotiation
+			 * on 1000BASE-T.
 			 */
-			speed = BMCR_S1000;
+			(void)ipgphy_mii_phy_auto(sc, ife->ifm_media);
+			goto done;
 			break;
 
 		case IFM_100_TX:
@@ -178,26 +175,11 @@ ipgphy_service(struct mii_softc *sc, str
 			return EINVAL;
 		}
 
-		if (((ife->ifm_media & IFM_GMASK) & IFM_FDX) != 0) {
+		if ((ife->ifm_media & IFM_FDX) != 0)
 			speed |= BMCR_FDX;
-			gig = GTCR_ADV_1000TFDX;
-		} else
-			gig = GTCR_ADV_1000THDX;
 
 		PHY_WRITE(sc, MII_100T2CR, 0);
 		PHY_WRITE(sc, MII_BMCR, speed);
-
-		if (IFM_SUBTYPE(ife->ifm_media) != IFM_1000_T)
-			break;
-
-		PHY_WRITE(sc, MII_100T2CR, gig);
-		PHY_WRITE(sc, MII_BMCR, speed);
-
-		if (mii->mii_media.ifm_media & IFM_ETH_MASTER)
-			gig |= GTCR_MAN_MS | GTCR_ADV_MS;
-
-		PHY_WRITE(sc, MII_100T2CR, gig);
-
 done:
 		break;
 
@@ -211,7 +193,8 @@ done:
 			return 0;
 
 		/* Only used for autonegotiation. */
-		if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) {
+		if ((IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) &&
+		(IFM_SUBTYPE(ife->ifm_media) != IFM_1000_T)) {
 			sc->mii_ticks = 0;
 			break;
 		}
@@ -242,7 +225,7 @@ done:
 			break;
 
 		sc->mii_ticks = 0;
-		ipgphy_mii_phy_auto(sc);
+		ipgphy_mii_phy_auto(sc, ife->ifm_media);
 		break;
 	}
 
@@ -320,26 +303,36 @@ ipgphy_status(struct mii_softc *sc)
 }
 
 static int
-ipgphy_mii_phy_auto(struct mii_softc *sc)
+ipgphy_mii_phy_auto(struct mii_softc *sc, u_int media)
 {
 	uint16_t reg = 0;
+	u_int subtype = IFM_SUBTYPE(media);
 
+	/* XXX Is it requreid ? */
 	if (sc->mii_mpd_model == MII_MODEL_xxICPLUS_IP1001) {
 		PHY_READ(sc, MII_ANAR, );
 		reg &= ~(ANAR_PAUSE_SYM | ANAR_PAUSE_ASYM);
 		reg |= ANAR_NP;
 	}
 
-	reg |= ANAR_10 | ANAR_10_FD | ANAR_TX | ANAR_TX_FD;
+	if (subtype == IFM_AUTO)
+		reg |= ANAR_10 | ANAR_10_FD | ANAR_TX | ANAR_TX_FD;
 
 	if (sc->mii_flags & MIIF_DOPAUSE)
 		reg |= ANAR_PAUSE_SYM | ANAR_PAUSE_ASYM;
 
 	PHY_WRITE(sc, MII_ANAR, reg | ANAR_CSMA);
 
-	reg = GTCR_ADV_1000TFDX | GTCR_ADV_1000THDX;
-	if (sc->mii_mpd_model != MII_MODEL_xxICPLUS_IP1001)
-		reg |= GTCR_ADV_MS;
+	if (subtype == IFM_AUTO)
+		reg = GTCR_ADV_1000TFDX | GTCR_ADV_1000THDX;
+	else if (subtype == IFM_1000_T) {
+		if ((media & IFM_FDX) != 0)
+			reg = GTCR_ADV_1000TFDX;
+		else
+			reg = GTCR_ADV_1000THDX;
+	} else
+		reg = 0;
+
 	PHY_WRITE(sc, MII_100T2CR, reg);
 
 	PHY_WRITE(sc, MII_BMCR, BMCR_FDX | BMCR_AUTOEN | BMCR_STARTNEG);



CVS commit: src/sys/dev/mii

2019-11-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov 14 09:06:21 UTC 2019

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

Log Message:
- Use auto-negotiation when forcing 1000BASE-T.
- Add XXX comment for strange pause setting code. I suspect this is wrong.
- On my environments, 1000BASE-T half duplex doesn't work, so we might remove
  IFM_1000T_HDX from this device in future.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/mii/ipgphy.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

2019-11-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov 14 09:00:23 UTC 2019

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

Log Message:
 STGE_PhyCtrl is not PHY register but MAC register, so use ukphy_status()
for IP1000A device.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/mii/ipgphy.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/ipgphy.c
diff -u src/sys/dev/mii/ipgphy.c:1.2 src/sys/dev/mii/ipgphy.c:1.3
--- src/sys/dev/mii/ipgphy.c:1.2	Thu Nov 14 08:52:34 2019
+++ src/sys/dev/mii/ipgphy.c	Thu Nov 14 09:00:23 2019
@@ -32,7 +32,7 @@
  * Driver for the IC Plus IP1000A/IP1001 10/100/1000 PHY.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipgphy.c,v 1.2 2019/11/14 08:52:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipgphy.c,v 1.3 2019/11/14 09:00:23 msaitoh Exp $");
 
 #include 
 #include 
@@ -261,6 +261,12 @@ ipgphy_status(struct mii_softc *sc)
 	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
 	uint16_t bmsr, bmcr, stat, gtsr;
 
+	/* For IP1000A, use generic way */
+	if (sc->mii_mpd_model == MII_MODEL_xxICPLUS_IP1000A) {
+		ukphy_status(sc);
+		return;
+	}
+
 	mii->mii_media_status = IFM_AVALID;
 	mii->mii_media_active = IFM_ETHER;
 
@@ -280,53 +286,27 @@ ipgphy_status(struct mii_softc *sc)
 			return;
 		}
 
-		if (sc->mii_mpd_model == MII_MODEL_xxICPLUS_IP1001) {
-			PHY_READ(sc, IPGPHY_LSR, );
-			switch (stat & IPGPHY_LSR_SPEED_MASK) {
-			case IPGPHY_LSR_SPEED_10:
-mii->mii_media_active |= IFM_10_T;
-break;
-			case IPGPHY_LSR_SPEED_100:
-mii->mii_media_active |= IFM_100_TX;
-break;
-			case IPGPHY_LSR_SPEED_1000:
-mii->mii_media_active |= IFM_1000_T;
-break;
-			default:
-mii->mii_media_active |= IFM_NONE;
-return;
-			}
-
-			if (stat & IPGPHY_LSR_FULL_DUPLEX)
-mii->mii_media_active |= IFM_FDX;
-			else
-mii->mii_media_active |= IFM_HDX;
-		} else {
-			PHY_READ(sc, STGE_PhyCtrl, );
-			switch (PC_LinkSpeed(stat)) {
-			case PC_LinkSpeed_Down:
-mii->mii_media_active |= IFM_NONE;
-return;
-			case PC_LinkSpeed_10:
-mii->mii_media_active |= IFM_10_T;
-break;
-			case PC_LinkSpeed_100:
-mii->mii_media_active |= IFM_100_TX;
-break;
-			case PC_LinkSpeed_1000:
-mii->mii_media_active |= IFM_1000_T;
-break;
-			default:
-mii->mii_media_active |= IFM_NONE;
-return;
-			}
-
-			if (stat & PC_PhyDuplexStatus)
-mii->mii_media_active |= IFM_FDX;
-			else
-mii->mii_media_active |= IFM_HDX;
+		PHY_READ(sc, IPGPHY_LSR, );
+		switch (stat & IPGPHY_LSR_SPEED_MASK) {
+		case IPGPHY_LSR_SPEED_10:
+			mii->mii_media_active |= IFM_10_T;
+			break;
+		case IPGPHY_LSR_SPEED_100:
+			mii->mii_media_active |= IFM_100_TX;
+			break;
+		case IPGPHY_LSR_SPEED_1000:
+			mii->mii_media_active |= IFM_1000_T;
+			break;
+		default:
+			mii->mii_media_active |= IFM_NONE;
+			return;
 		}
 
+		if (stat & IPGPHY_LSR_FULL_DUPLEX)
+			mii->mii_media_active |= IFM_FDX;
+		else
+			mii->mii_media_active |= IFM_HDX;
+
 		if (mii->mii_media_active & IFM_FDX)
 			mii->mii_media_active |= mii_phy_flowstatus(sc);
 



CVS commit: src/sys/dev/mii

2019-11-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov 14 09:00:23 UTC 2019

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

Log Message:
 STGE_PhyCtrl is not PHY register but MAC register, so use ukphy_status()
for IP1000A device.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/mii/ipgphy.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

2019-11-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov 14 08:52:34 UTC 2019

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

Log Message:
 KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/mii/ipgphy.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

2019-11-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov 14 08:52:34 UTC 2019

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

Log Message:
 KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/mii/ipgphy.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/ipgphy.c
diff -u src/sys/dev/mii/ipgphy.c:1.1 src/sys/dev/mii/ipgphy.c:1.2
--- src/sys/dev/mii/ipgphy.c:1.1	Mon Oct  7 11:53:40 2019
+++ src/sys/dev/mii/ipgphy.c	Thu Nov 14 08:52:34 2019
@@ -32,7 +32,7 @@
  * Driver for the IC Plus IP1000A/IP1001 10/100/1000 PHY.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipgphy.c,v 1.1 2019/10/07 11:53:40 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipgphy.c,v 1.2 2019/11/14 08:52:34 msaitoh Exp $");
 
 #include 
 #include 
@@ -79,9 +79,9 @@ ipgphy_match(device_t parent, cfdata_t m
 {
 	struct mii_attach_args *ma = aux;
 
-	if (mii_phy_match(ma, ipgphys) != NULL) {
+	if (mii_phy_match(ma, ipgphys) != NULL)
 		return 10;
-	}
+
 	return 0;
 }
 
@@ -130,9 +130,7 @@ ipgphy_service(struct mii_softc *sc, str
 
 	switch (cmd) {
 	case MII_POLLSTAT:
-		/*
-		 * If we're not polling our PHY instance, just return.
-		 */
+		/* If we're not polling our PHY instance, just return. */
 		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
 			return 0;
 		break;
@@ -148,9 +146,7 @@ ipgphy_service(struct mii_softc *sc, str
 			return 0;
 		}
 
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
+		/* If the interface is not up, don't do anything. */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
 			break;
 
@@ -206,21 +202,15 @@ done:
 		break;
 
 	case MII_TICK:
-		/*
-		 * If we're not currently selected, just return.
-		 */
+		/* If we're not currently selected, just return. */
 		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
 			return 0;
 
-		/*
-		 * Is the interface even up?
-		 */
+		/* Is the interface even up? */
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
 			return 0;
 
-		/*
-		 * Only used for autonegotiation.
-		 */
+		/* Only used for autonegotiation. */
 		if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) {
 			sc->mii_ticks = 0;
 			break;
@@ -247,9 +237,7 @@ done:
 		if (sc->mii_ticks++ == 0)
 			break;
 
-		/*
-		 * Only retry autonegotiation every mii_anegticks seconds.
-		 */
+		/* Only retry autonegotiation every mii_anegticks seconds. */
 		if (sc->mii_ticks <= sc->mii_anegticks)
 			break;
 
@@ -401,7 +389,7 @@ ipgphy_reset(struct mii_softc *sc)
 
 	mii_phy_reset(sc);
 
-	/* clear autoneg/full-duplex as we don't want it after reset */
+	/* Clear autoneg/full-duplex as we don't want it after reset */
 	PHY_READ(sc, MII_BMCR, );
 	reg &= ~(BMCR_AUTOEN | BMCR_FDX);
 	PHY_WRITE(sc, MII_BMCR, reg);



CVS commit: src/sys/dev/mii

2019-11-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Nov 12 14:07:09 UTC 2019

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

Log Message:
- Define IPGPHY_SCR's address.
- Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/mii/ipgphyreg.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

2019-11-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Nov 12 14:07:09 UTC 2019

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

Log Message:
- Define IPGPHY_SCR's address.
- Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/mii/ipgphyreg.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/ipgphyreg.h
diff -u src/sys/dev/mii/ipgphyreg.h:1.1 src/sys/dev/mii/ipgphyreg.h:1.2
--- src/sys/dev/mii/ipgphyreg.h:1.1	Mon Oct  7 11:53:40 2019
+++ src/sys/dev/mii/ipgphyreg.h	Tue Nov 12 14:07:09 2019
@@ -36,48 +36,48 @@
  */
 
 /* PHY specific control & status register. IP1001 only. */
-#define IPGPHY_SCSR			0x10
-#define IPGPHY_SCSR_RXPHASE_SEL	0x0001
-#define IPGPHY_SCSR_TXPHASE_SEL	0x0002
+#define IPGPHY_SCSR		0x10
+#define IPGPHY_SCSR_RXPHASE_SEL		0x0001
+#define IPGPHY_SCSR_TXPHASE_SEL		0x0002
 #define IPGPHY_SCSR_REPEATOR_MODE	0x0004
 #define IPGPHY_SCSR_RESERVED1_DEF	0x0008
 #define IPGPHY_SCSR_RXCLK_DRV_MASK	0x0060
 #define IPGPHY_SCSR_RXCLK_DRV_DEF	0x0040
 #define IPGPHY_SCSR_RXD_DRV_MASK	0x0180
-#define IPGPHY_SCSR_RXD_DRV_DEF	0x0100
-#define IPGPHY_SCSR_JABBER_ENB	0x0200
+#define IPGPHY_SCSR_RXD_DRV_DEF		0x0100
+#define IPGPHY_SCSR_JABBER_ENB		0x0200
 #define IPGPHY_SCSR_HEART_BEAT_ENB	0x0400
 #define IPGPHY_SCSR_DOWNSHIFT_ENB	0x0800
 #define IPGPHY_SCSR_RESERVED2_DEF	0x1000
-#define IPGPHY_SCSR_LED_DRV_4MA	0x
-#define IPGPHY_SCSR_LED_DRV_8MA	0x2000
+#define IPGPHY_SCSR_LED_DRV_4MA		0x
+#define IPGPHY_SCSR_LED_DRV_8MA		0x2000
 #define IPGPHY_SCSR_LED_MODE_MASK	0xC000
 #define IPGPHY_SCSR_LED_MODE_DEF	0x
 
 /* PHY link status register. IP1001 only. */
-#define IPGPHY_LSR			0x11
-#define IPGPHY_LSR_JABBER_DET	0x0200
+#define IPGPHY_LSR		0x11
+#define IPGPHY_LSR_JABBER_DET		0x0200
 #define IPGPHY_LSR_APS_SLEEP		0x0400
-#define IPGPHY_LSR_MDIX		0x0800
-#define IPGPHY_LSR_FULL_DUPLEX	0x1000
+#define IPGPHY_LSR_MDIX			0x0800
+#define IPGPHY_LSR_FULL_DUPLEX		0x1000
 #define IPGPHY_LSR_SPEED_10		0x
 #define IPGPHY_LSR_SPEED_100		0x2000
-#define IPGPHY_LSR_SPEED_1000	0x4000
-#define IPGPHY_LSR_SPEED_MASK	0x6000
+#define IPGPHY_LSR_SPEED_1000		0x4000
+#define IPGPHY_LSR_SPEED_MASK		0x6000
 #define IPGPHY_LSR_LINKUP		0x8000
 
 /* PHY specific control register 2. IP1001 only. */
-#define IPGPHY_SCR
+#define IPGPHY_SCR		0x14
 #define IPGPHY_SCR_SEW_RATE_MASK	0x0003
-#define IPGPHY_SCR_SEW_RATE_DEF	0x0003
-#define IPGPHY_SCR_AUTO_XOVER	0x0004
+#define IPGPHY_SCR_SEW_RATE_DEF		0x0003
+#define IPGPHY_SCR_AUTO_XOVER		0x0004
 #define IPGPHY_SCR_SPEED_10_100_ENB	0x0040
 #define IPGPHY_SCR_FIFO_LATENCY_2	0x
 #define IPGPHY_SCR_FIFO_LATENCY_3	0x0080
 #define IPGPHY_SCR_FIFO_LATENCY_4	0x0100
 #define IPGPHY_SCR_FIFO_LATENCY_5	0x0180
 #define IPGPHY_SCR_MDIX_ENB		0x0200
-#define IPGPHY_SCR_RESERVED_DEF	0x0400
+#define IPGPHY_SCR_RESERVED_DEF		0x0400
 #define IPGPHY_SCR_APS_ON		0x0800
 
 #endif /* _DEV_MII_IPGPHYREG_H_ */



CVS commit: src/sys/dev/mii

2019-11-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov  6 16:00:33 UTC 2019

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.158 -r1.159 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.146 -r1.147 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.158 src/sys/dev/mii/miidevs.h:1.159
--- src/sys/dev/mii/miidevs.h:1.158	Wed Oct 30 12:02:01 2019
+++ src/sys/dev/mii/miidevs.h	Wed Nov  6 16:00:33 2019
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.158 2019/10/30 12:02:01 msaitoh Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.159 2019/11/06 16:00:33 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.160 2019/10/30 12:01:36 msaitoh Exp
+ *	NetBSD: miidevs,v 1.161 2019/11/06 16:00:02 msaitoh Exp
  */
 
 /*-
@@ -494,13 +494,27 @@
 #define	MII_MODEL_MARVELL_E	0x000c
 #define	MII_STR_MARVELL_E	"Marvell 88E Gigabit PHY"
 
-/* Micrel PHYs */
+/* Micrel PHYs (Kendin and Microchip) */
+#define	MII_MODEL_MICREL_KSZ8041	0x0011
+#define	MII_STR_MICREL_KSZ8041	"Micrel KSZ8041TL/FTL/MLL 10/100 PHY"
+#define	MII_MODEL_MICREL_KSZ8041RNLI	0x0013
+#define	MII_STR_MICREL_KSZ8041RNLI	"Micrel KSZ8041RNLI 10/100 PHY"
+#define	MII_MODEL_MICREL_KSZ8051	0x0015
+#define	MII_STR_MICREL_KSZ8051	"Micrel KSZ80[235]1 10/100 PHY"
 #define	MII_MODEL_MICREL_KSZ8081	0x0016
-#define	MII_STR_MICREL_KSZ8081	"Micrel KSZ8081 10/100 PHY"
-#define	MII_MODEL_MICREL_KSZ9021RNI	0x0021
-#define	MII_STR_MICREL_KSZ9021RNI	"Micrel KSZ9021RNI 10/100/1000 PHY"
+#define	MII_STR_MICREL_KSZ8081	"Micrel KSZ80[89]1 10/100 PHY"
+#define	MII_MODEL_MICREL_KSZ8061	0x0017
+#define	MII_STR_MICREL_KSZ8061	"Micrel KSZ8061 10/100 PHY"
+#define	MII_MODEL_MICREL_KSZ9021_8001_8721	0x0021
+#define	MII_STR_MICREL_KSZ9021_8001_8721	"Micrel KSZ9021 Gb & KSZ8001/8721 10/100 PHY"
 #define	MII_MODEL_MICREL_KSZ9031	0x0022
 #define	MII_STR_MICREL_KSZ9031	"Micrel KSZ9031 10/100/1000 PHY"
+#define	MII_MODEL_MICREL_KSZ9477	0x0023
+#define	MII_STR_MICREL_KSZ9477	"Micrel KSZ9477 10/100/1000 PHY"
+#define	MII_MODEL_MICREL_KSZ9131	0x0024
+#define	MII_STR_MICREL_KSZ9131	"Micrel KSZ9131 10/100/1000 PHY"
+#define	MII_MODEL_MICREL_KS8737	0x0032
+#define	MII_STR_MICREL_KS8737	"Micrel KS8737 10/100 PHY"
 
 /* Myson Technology PHYs */
 #define	MII_MODEL_xxMYSON_MTD972	0x

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.146 src/sys/dev/mii/miidevs_data.h:1.147
--- src/sys/dev/mii/miidevs_data.h:1.146	Wed Oct 30 12:02:01 2019
+++ src/sys/dev/mii/miidevs_data.h	Wed Nov  6 16:00:33 2019
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.146 2019/10/30 12:02:01 msaitoh Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.147 2019/11/06 16:00:33 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.160 2019/10/30 12:01:36 msaitoh Exp
+ *	NetBSD: miidevs,v 1.161 2019/11/06 16:00:02 msaitoh Exp
  */
 
 /*-
@@ -204,9 +204,16 @@ struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_MARVELL, MII_MODEL_MARVELL_E1000_5, MII_STR_MARVELL_E1000_5 },
  { MII_OUI_MARVELL, MII_MODEL_MARVELL_E1000_6, MII_STR_MARVELL_E1000_6 },
  { MII_OUI_MARVELL, MII_MODEL_MARVELL_E, MII_STR_MARVELL_E },
+ { MII_OUI_MICREL, MII_MODEL_MICREL_KSZ8041, MII_STR_MICREL_KSZ8041 },
+ { MII_OUI_MICREL, MII_MODEL_MICREL_KSZ8041RNLI, MII_STR_MICREL_KSZ8041RNLI },
+ { MII_OUI_MICREL, MII_MODEL_MICREL_KSZ8051, MII_STR_MICREL_KSZ8051 },
  { MII_OUI_MICREL, MII_MODEL_MICREL_KSZ8081, MII_STR_MICREL_KSZ8081 },
- { MII_OUI_MICREL, MII_MODEL_MICREL_KSZ9021RNI, MII_STR_MICREL_KSZ9021RNI },
+ { MII_OUI_MICREL, MII_MODEL_MICREL_KSZ8061, MII_STR_MICREL_KSZ8061 },
+ { MII_OUI_MICREL, MII_MODEL_MICREL_KSZ9021_8001_8721, MII_STR_MICREL_KSZ9021_8001_8721 },
  { MII_OUI_MICREL, MII_MODEL_MICREL_KSZ9031, MII_STR_MICREL_KSZ9031 },
+ { MII_OUI_MICREL, MII_MODEL_MICREL_KSZ9477, MII_STR_MICREL_KSZ9477 },
+ { MII_OUI_MICREL, MII_MODEL_MICREL_KSZ9131, MII_STR_MICREL_KSZ9131 },
+ { MII_OUI_MICREL, MII_MODEL_MICREL_KS8737, MII_STR_MICREL_KS8737 },
  { MII_OUI_xxMYSON, MII_MODEL_xxMYSON_MTD972, MII_STR_xxMYSON_MTD972 },
  { MII_OUI_MYSON, MII_MODEL_MYSON_MTD803, MII_STR_MYSON_MTD803 },
  { MII_OUI_xxNATSEMI, MII_MODEL_xxNATSEMI_DP83840, MII_STR_xxNATSEMI_DP83840 },



CVS commit: src/sys/dev/mii

2019-11-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov  6 16:00:33 UTC 2019

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.158 -r1.159 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.146 -r1.147 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

2019-11-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov  6 16:00:02 UTC 2019

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

Log Message:
 Add Micrel (now Microchip) KSZ80[0456]1, KSZ8721, KSZ9[01]31, KS8731 and
KSZ9477.


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 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

2019-11-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov  6 16:00:02 UTC 2019

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

Log Message:
 Add Micrel (now Microchip) KSZ80[0456]1, KSZ8721, KSZ9[01]31, KS8731 and
KSZ9477.


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 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.160 src/sys/dev/mii/miidevs:1.161
--- src/sys/dev/mii/miidevs:1.160	Wed Oct 30 12:01:36 2019
+++ src/sys/dev/mii/miidevs	Wed Nov  6 16:00:02 2019
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.160 2019/10/30 12:01:36 msaitoh Exp $
+$NetBSD: miidevs,v 1.161 2019/11/06 16:00:02 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -325,10 +325,17 @@ model MARVELL E1000_5		0x0005 Marvell 88
 model MARVELL E1000_6		0x0006 Marvell 88E1000 Gigabit PHY
 model MARVELL E		0x000c Marvell 88E Gigabit PHY
 
-/* Micrel PHYs */
-model MICREL KSZ8081		0x0016 Micrel KSZ8081 10/100 PHY
-model MICREL KSZ9021RNI		0x0021 Micrel KSZ9021RNI 10/100/1000 PHY
+/* Micrel PHYs (Kendin and Microchip) */
+model MICREL KSZ8041		0x0011 Micrel KSZ8041TL/FTL/MLL 10/100 PHY
+model MICREL KSZ8041RNLI	0x0013 Micrel KSZ8041RNLI 10/100 PHY
+model MICREL KSZ8051		0x0015 Micrel KSZ80[235]1 10/100 PHY
+model MICREL KSZ8081		0x0016 Micrel KSZ80[89]1 10/100 PHY
+model MICREL KSZ8061		0x0017 Micrel KSZ8061 10/100 PHY
+model MICREL KSZ9021_8001_8721	0x0021 Micrel KSZ9021 Gb & KSZ8001/8721 10/100 PHY
 model MICREL KSZ9031		0x0022 Micrel KSZ9031 10/100/1000 PHY
+model MICREL KSZ9477		0x0023 Micrel KSZ9477 10/100/1000 PHY
+model MICREL KSZ9131		0x0024 Micrel KSZ9131 10/100/1000 PHY
+model MICREL KS8737		0x0032 Micrel KS8737 10/100 PHY
 
 /* Myson Technology PHYs */
 model xxMYSON MTD972		0x MTD972 10/100 media interface



CVS commit: src/sys/dev/mii

2019-10-30 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Oct 30 12:02:01 UTC 2019

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.157 -r1.158 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.145 -r1.146 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.157 src/sys/dev/mii/miidevs.h:1.158
--- src/sys/dev/mii/miidevs.h:1.157	Fri Oct 18 20:42:10 2019
+++ src/sys/dev/mii/miidevs.h	Wed Oct 30 12:02:01 2019
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.157 2019/10/18 20:42:10 maya Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.158 2019/10/30 12:02:01 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.158 2019/10/17 09:21:40 msaitoh Exp
+ *	NetBSD: miidevs,v 1.160 2019/10/30 12:01:36 msaitoh Exp
  */
 
 /*-
@@ -411,10 +411,10 @@
 
 
 /* JMicron PHYs */
-#define	MII_MODEL_JMICRON_JMC250	0x0021
-#define	MII_STR_JMICRON_JMC250	"JMC250 10/100/1000 media interface"
-#define	MII_MODEL_JMICRON_JMC260	0x0022
-#define	MII_STR_JMICRON_JMC260	"JMC260 10/100 media interface"
+#define	MII_MODEL_JMICRON_JMP211	0x0021
+#define	MII_STR_JMICRON_JMP211	"JMP211 10/100/1000 media interface"
+#define	MII_MODEL_JMICRON_JMP202	0x0022
+#define	MII_STR_JMICRON_JMP202	"JMP202 10/100 media interface"
 
 /* Level 1 PHYs */
 #define	MII_MODEL_xxLEVEL1_LXT970	0x

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.145 src/sys/dev/mii/miidevs_data.h:1.146
--- src/sys/dev/mii/miidevs_data.h:1.145	Fri Oct 18 20:42:10 2019
+++ src/sys/dev/mii/miidevs_data.h	Wed Oct 30 12:02:01 2019
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.145 2019/10/18 20:42:10 maya Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.146 2019/10/30 12:02:01 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.158 2019/10/17 09:21:40 msaitoh Exp
+ *	NetBSD: miidevs,v 1.160 2019/10/30 12:01:36 msaitoh Exp
  */
 
 /*-
@@ -165,8 +165,8 @@ struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_I210, MII_STR_xxMARVELL_I210 },
  { MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_I82563, MII_STR_xxMARVELL_I82563 },
  { MII_OUI_ATTANSIC, MII_MODEL_ATTANSIC_I82578, MII_STR_ATTANSIC_I82578 },
- { MII_OUI_JMICRON, MII_MODEL_JMICRON_JMC250, MII_STR_JMICRON_JMC250 },
- { MII_OUI_JMICRON, MII_MODEL_JMICRON_JMC260, MII_STR_JMICRON_JMC260 },
+ { MII_OUI_JMICRON, MII_MODEL_JMICRON_JMP211, MII_STR_JMICRON_JMP211 },
+ { MII_OUI_JMICRON, MII_MODEL_JMICRON_JMP202, MII_STR_JMICRON_JMP202 },
  { MII_OUI_xxLEVEL1, MII_MODEL_xxLEVEL1_LXT970, MII_STR_xxLEVEL1_LXT970 },
  { MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT1000_OLD, MII_STR_LEVEL1_LXT1000_OLD },
  { MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT974, MII_STR_LEVEL1_LXT974 },



CVS commit: src/sys/dev/mii

2019-10-30 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Oct 30 12:01:36 UTC 2019

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

Log Message:
- Rename JMICRON 0x0021 from JMC250 to JMP211
- Rename JMICRON 0x0022 from JMC260 to JMP202


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 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.159 src/sys/dev/mii/miidevs:1.160
--- src/sys/dev/mii/miidevs:1.159	Fri Oct 18 20:42:10 2019
+++ src/sys/dev/mii/miidevs	Wed Oct 30 12:01:36 2019
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.159 2019/10/18 20:42:10 maya Exp $
+$NetBSD: miidevs,v 1.160 2019/10/30 12:01:36 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -281,8 +281,8 @@ model ATTANSIC I82578		0x0004 Intel 8257
 
 
 /* JMicron PHYs */
-model JMICRON JMC250		0x0021 JMC250 10/100/1000 media interface
-model JMICRON JMC260		0x0022 JMC260 10/100 media interface
+model JMICRON JMP211		0x0021 JMP211 10/100/1000 media interface
+model JMICRON JMP202		0x0022 JMP202 10/100 media interface
 
 /* Level 1 PHYs */
 model xxLEVEL1 LXT970		0x LXT970 10/100 media interface



CVS commit: src/sys/dev/mii

2019-10-30 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Oct 30 12:01:36 UTC 2019

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

Log Message:
- Rename JMICRON 0x0021 from JMC250 to JMP211
- Rename JMICRON 0x0022 from JMC260 to JMP202


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 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

2019-10-30 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Oct 30 12:02:01 UTC 2019

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.157 -r1.158 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.145 -r1.146 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

2019-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct 24 03:37:58 UTC 2019

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

Log Message:
 Fix a bug that ukphy_status() misunderstand master mode.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/mii/ukphy_subr.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

2019-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct 24 03:37:58 UTC 2019

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

Log Message:
 Fix a bug that ukphy_status() misunderstand master mode.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/mii/ukphy_subr.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/ukphy_subr.c
diff -u src/sys/dev/mii/ukphy_subr.c:1.15 src/sys/dev/mii/ukphy_subr.c:1.16
--- src/sys/dev/mii/ukphy_subr.c:1.15	Mon Mar 25 09:20:46 2019
+++ src/sys/dev/mii/ukphy_subr.c	Thu Oct 24 03:37:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ukphy_subr.c,v 1.15 2019/03/25 09:20:46 msaitoh Exp $	*/
+/*	$NetBSD: ukphy_subr.c,v 1.16 2019/10/24 03:37:58 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ukphy_subr.c,v 1.15 2019/03/25 09:20:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukphy_subr.c,v 1.16 2019/10/24 03:37:58 msaitoh Exp $");
 
 #include 
 #include 
@@ -119,7 +119,7 @@ ukphy_status(struct mii_softc *phy)
 		else
 			mii->mii_media_active |= IFM_NONE;
 
-		if ((mii->mii_media_active & IFM_1000_T) &&
+		if ((IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) &&
 		(gtsr & GTSR_MS_RES))
 			mii->mii_media_active |= IFM_ETH_MASTER;
 



CVS commit: src/sys/dev/mii

2019-10-18 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Oct 18 20:42:10 UTC 2019

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

Log Message:
Fix typo. from vezhlys


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/dev/mii/miidevs
cvs rdiff -u -r1.156 -r1.157 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.144 -r1.145 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
diff -u src/sys/dev/mii/miidevs:1.158 src/sys/dev/mii/miidevs:1.159
--- src/sys/dev/mii/miidevs:1.158	Thu Oct 17 09:21:40 2019
+++ src/sys/dev/mii/miidevs	Fri Oct 18 20:42:10 2019
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.158 2019/10/17 09:21:40 msaitoh Exp $
+$NetBSD: miidevs,v 1.159 2019/10/18 20:42:10 maya Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -94,7 +94,7 @@ oui TI0x080028	Texas Instruments
 oui BROADCOM4			0x18c086	Broadcom Corporation
 oui RENESAS			0x749050	Renesas
 
-/* Unregisterd or wrong OUI */
+/* Unregistered or wrong OUI */
 oui yyREALTEK			0x04	Realtek
 oui yyAMD			0x58	Advanced Micro Devices
 oui xxMYSON			0x00032d	Myson Technology

Index: src/sys/dev/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.156 src/sys/dev/mii/miidevs.h:1.157
--- src/sys/dev/mii/miidevs.h:1.156	Thu Oct 17 09:22:00 2019
+++ src/sys/dev/mii/miidevs.h	Fri Oct 18 20:42:10 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: miidevs.h,v 1.156 2019/10/17 09:22:00 msaitoh Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.157 2019/10/18 20:42:10 maya Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -101,7 +101,7 @@
 #define	MII_OUI_BROADCOM4	0x18c086	/* Broadcom Corporation */
 #define	MII_OUI_RENESAS	0x749050	/* Renesas */
 
-/* Unregisterd or wrong OUI */
+/* Unregistered or wrong OUI */
 #define	MII_OUI_yyREALTEK	0x04	/* Realtek */
 #define	MII_OUI_yyAMD	0x58	/* Advanced Micro Devices */
 #define	MII_OUI_xxMYSON	0x00032d	/* Myson Technology */

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.144 src/sys/dev/mii/miidevs_data.h:1.145
--- src/sys/dev/mii/miidevs_data.h:1.144	Thu Oct 17 09:22:00 2019
+++ src/sys/dev/mii/miidevs_data.h	Fri Oct 18 20:42:10 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: miidevs_data.h,v 1.144 2019/10/17 09:22:00 msaitoh Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.145 2019/10/18 20:42:10 maya Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.



CVS commit: src/sys/dev/mii

2019-10-18 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Oct 18 20:42:10 UTC 2019

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

Log Message:
Fix typo. from vezhlys


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/dev/mii/miidevs
cvs rdiff -u -r1.156 -r1.157 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.144 -r1.145 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

2019-10-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct 17 09:22:49 UTC 2019

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

Log Message:
- Match a lot of Cicada and Vitesse devices correctly. This change also fixes
  a bug that ciphy_fixup() didn't work.
- Match VSC8221, VSC8234 and VSC8641.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/mii/ciphy.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.36 src/sys/dev/mii/ciphy.c:1.37
--- src/sys/dev/mii/ciphy.c:1.36	Fri Oct 11 09:31:52 2019
+++ src/sys/dev/mii/ciphy.c	Thu Oct 17 09:22:49 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ciphy.c,v 1.36 2019/10/11 09:31:52 msaitoh Exp $ */
+/* $NetBSD: ciphy.c,v 1.37 2019/10/17 09:22:49 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.36 2019/10/11 09:31:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.37 2019/10/17 09:22:49 msaitoh Exp $");
 
 /*
  * Driver for the Cicada CS8201 10/100/1000 copper PHY.
@@ -74,16 +74,16 @@ static const struct mii_phy_funcs ciphy_
 };
 
 static const struct mii_phydesc ciphys[] = {
-	MII_PHY_DESC(CICADA, CS8201),
-	MII_PHY_DESC(CICADA, CS8201A),
-	MII_PHY_DESC(CICADA, CS8201B),
-	MII_PHY_DESC(CICADA, CS8204),
-	MII_PHY_DESC(CICADA, VSC8211),
-	MII_PHY_DESC(CICADA, CS8244),
-	MII_PHY_DESC(CICADA, CS8201),
-	MII_PHY_DESC(CICADA, CS8201A),
-	MII_PHY_DESC(xxCICADA, CS8201B),
-	MII_PHY_DESC(VITESSE, VSC8601),
+	MII_PHY_DESC(xxCICADA, CIS8201),
+	MII_PHY_DESC(xxCICADA, CIS8201A),
+	MII_PHY_DESC(xxCICADA, CIS8201B),
+	MII_PHY_DESC(xxCICADA, CIS8204),
+	MII_PHY_DESC(xxCICADA, VSC8211),
+	MII_PHY_DESC(xxCICADA, VSC8221),
+	MII_PHY_DESC(xxCICADA, VSC8234),
+	MII_PHY_DESC(xxCICADA, VSC8244),
+	MII_PHY_DESC(xxVITESSE, VSC8601),
+	MII_PHY_DESC(xxVITESSE, VSC8641),
 	MII_PHY_END,
 };
 
@@ -398,8 +398,8 @@ ciphy_fixup(struct mii_softc *sc)
 	}
 
 	switch (model) {
-	case MII_MODEL_CICADA_CS8201:
-	case MII_MODEL_CICADA_CS8204:
+	case MII_MODEL_xxCICADA_CIS8201:
+	case MII_MODEL_xxCICADA_CIS8204:
 		/* Turn off "aux mode" (whatever that means) */
 		PHY_SETBIT(sc, CIPHY_MII_AUXCSR, CIPHY_AUXCSR_MDPPS);
 
@@ -418,8 +418,8 @@ ciphy_fixup(struct mii_softc *sc)
 
 		break;
 
-	case MII_MODEL_CICADA_CS8201A:
-	case MII_MODEL_CICADA_CS8201B:
+	case MII_MODEL_xxCICADA_CIS8201A:
+	case MII_MODEL_xxCICADA_CIS8201B:
 		/*
 		 * Work around speed polling bug in VT3119/VT3216
 		 * when using MII in full duplex mode.
@@ -431,9 +431,12 @@ ciphy_fixup(struct mii_softc *sc)
 			PHY_CLRBIT(sc, CIPHY_MII_10BTCSR, CIPHY_10BTCSR_ECHO);
 
 		break;
-	case MII_MODEL_CICADA_VSC8211:
-	case MII_MODEL_CICADA_CS8244:
-	case MII_MODEL_VITESSE_VSC8601:
+	case MII_MODEL_xxCICADA_VSC8211:
+	case MII_MODEL_xxCICADA_VSC8221:
+	case MII_MODEL_xxCICADA_VSC8234:
+	case MII_MODEL_xxCICADA_VSC8244:
+	case MII_MODEL_xxVITESSE_VSC8601:
+	case MII_MODEL_xxVITESSE_VSC8641:
 		break;
 	default:
 		aprint_error_dev(sc->mii_dev, "unknown CICADA PHY model %x\n",



CVS commit: src/sys/dev/mii

2019-10-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct 17 09:22:49 UTC 2019

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

Log Message:
- Match a lot of Cicada and Vitesse devices correctly. This change also fixes
  a bug that ciphy_fixup() didn't work.
- Match VSC8221, VSC8234 and VSC8641.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/mii/ciphy.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

2019-10-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct 17 09:22:00 UTC 2019

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.155 -r1.156 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.143 -r1.144 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.155 src/sys/dev/mii/miidevs.h:1.156
--- src/sys/dev/mii/miidevs.h:1.155	Thu Sep 19 14:39:08 2019
+++ src/sys/dev/mii/miidevs.h	Thu Oct 17 09:22:00 2019
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.155 2019/09/19 14:39:08 msaitoh Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.156 2019/10/17 09:22:00 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.157 2019/09/19 14:38:45 msaitoh Exp
+ *	NetBSD: miidevs,v 1.158 2019/10/17 09:21:40 msaitoh Exp
  */
 
 /*-
@@ -57,10 +57,8 @@
  */
 
 #define	MII_OUI_AMD	0x1a	/* Advanced Micro Devices */
-#define	MII_OUI_VITESSE	0x0001c1	/* Vitesse */
 #define	MII_OUI_TRIDIUM	0x0001f0	/* Tridium */
 #define	MII_OUI_DATATRACK	0x0002c6	/* Data Track Technology */
-#define	MII_OUI_CICADA	0x0003f1	/* Cicada Semiconductor */
 #define	MII_OUI_AGERE	0x00053d	/* Agere */
 #define	MII_OUI_BANKSPEED	0x0006b8	/* Bankspeed Pty */
 #define	MII_OUI_NETEXCELL	0x0008bb	/* NetExcell */
@@ -121,6 +119,7 @@
 #define	MII_OUI_xxBROADCOM_ALT1	0x0050ef	/* Broadcom Corporation */
 #define	MII_OUI_yyINTEL	0x005500	/* Intel */
 #define	MII_OUI_yyASIX	0x007063	/* Asix Semiconductor */
+#define	MII_OUI_xxVITESSE	0x008083	/* Vitesse Semiconductor */
 #define	MII_OUI_xxPMCSIERRA2	0x009057	/* PMC-Sierra */
 #define	MII_OUI_xxCICADA	0x00c08f	/* Cicada Semiconductor */
 #define	MII_OUI_xxNATSEMI	0x1000e8	/* National Semiconductor */
@@ -308,23 +307,26 @@
 #define	MII_MODEL_xxBROADCOM_ALT1_BCM5906	0x0004
 #define	MII_STR_xxBROADCOM_ALT1_BCM5906	"BCM5906 10/100baseTX media interface"
 
-/* Cicada Semiconductor PHYs (now owned by Vitesse?) */
-#define	MII_MODEL_CICADA_CS8201	0x0001
-#define	MII_STR_CICADA_CS8201	"Cicada CS8201 10/100/1000TX PHY"
-#define	MII_MODEL_CICADA_CS8204	0x0004
-#define	MII_STR_CICADA_CS8204	"Cicada CS8204 10/100/1000TX PHY"
-#define	MII_MODEL_CICADA_VSC8211	0x000b
-#define	MII_STR_CICADA_VSC8211	"Cicada VSC8211 10/100/1000TX PHY"
-#define	MII_MODEL_CICADA_CS8201A	0x0020
-#define	MII_STR_CICADA_CS8201A	"Cicada CS8201 10/100/1000TX PHY"
-#define	MII_MODEL_CICADA_CS8201B	0x0021
-#define	MII_STR_CICADA_CS8201B	"Cicada CS8201 10/100/1000TX PHY"
-#define	MII_MODEL_CICADA_CS8244	0x002c
-#define	MII_STR_CICADA_CS8244	"Vitesse VSC8244 Quad 10/100/1000BASE-T PHY"
+/* Cicada Semiconductor PHYs (-> Vitesse -> Microsemi) */
+
+#define	MII_MODEL_xxCICADA_CIS8201	0x0001
+#define	MII_STR_xxCICADA_CIS8201	"Cicada CIS8201 10/100/1000TX PHY"
+#define	MII_MODEL_xxCICADA_CIS8204	0x0004
+#define	MII_STR_xxCICADA_CIS8204	"Cicada CIS8204 10/100/1000TX PHY"
+#define	MII_MODEL_xxCICADA_VSC8211	0x000b
+#define	MII_STR_xxCICADA_VSC8211	"Cicada VSC8211 10/100/1000TX PHY"
 #define	MII_MODEL_xxCICADA_VSC8221	0x0015
 #define	MII_STR_xxCICADA_VSC8221	"Vitesse VSC8221 10/100/1000BASE-T PHY"
-#define	MII_MODEL_xxCICADA_CS8201B	0x0021
-#define	MII_STR_xxCICADA_CS8201B	"Cicada CS8201 10/100/1000TX PHY"
+#define	MII_MODEL_xxCICADA_VSC8224	0x0018
+#define	MII_STR_xxCICADA_VSC8224	"Vitesse VSC8224 10/100/1000BASE-T PHY"
+#define	MII_MODEL_xxCICADA_CIS8201A	0x0020
+#define	MII_STR_xxCICADA_CIS8201A	"Cicada CIS8201 10/100/1000TX PHY"
+#define	MII_MODEL_xxCICADA_CIS8201B	0x0021
+#define	MII_STR_xxCICADA_CIS8201B	"Cicada CIS8201 10/100/1000TX PHY"
+#define	MII_MODEL_xxCICADA_VSC8234	0x0022
+#define	MII_STR_xxCICADA_VSC8234	"Vitesse VSC8234 10/100/1000TX PHY"
+#define	MII_MODEL_xxCICADA_VSC8244	0x002c
+#define	MII_STR_xxCICADA_VSC8244	"Vitesse VSC8244 Quad 10/100/1000BASE-T PHY"
 
 /* Davicom Semiconductor PHYs */
 /* AMD Am79C873 seems to be a relabeled DM9101 */
@@ -604,9 +606,13 @@
 #define	MII_MODEL_VIA_VT6103_2	0x0034
 #define	MII_STR_VIA_VT6103_2	"VT6103 10/100 PHY"
 
-/* Vitesse PHYs */
-#define	MII_MODEL_VITESSE_VSC8601	0x0002
-#define	MII_STR_VITESSE_VSC8601	"VSC8601 10/100/1000 PHY"
+/* Vitesse PHYs (Now Microsemi) */
+#define	MII_MODEL_xxVITESSE_VSC8601	0x0002
+#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_VSC8501	0x0013
+#define	MII_STR_xxVITESSE_VSC8501	"Vitesse VSC8501 10/100/1000TX 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.143 src/sys/dev/mii/miidevs_data.h:1.144
--- src/sys/dev/mii/miidevs_data.h:1.143	Thu Sep 19 14:39:08 2019
+++ src/sys/dev/mii/miidevs_data.h	Thu Oct 

CVS commit: src/sys/dev/mii

2019-10-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct 17 09:21:40 UTC 2019

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

Log Message:
- All of Cicada and Vitesse devices' OUI are not bit-reversed, so use "xx".
- Rename CS82xx -> CIS82xx
- Add Vitesse VSC8224, VSC8234, VSC8641 and VSC8501.


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 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

2019-10-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct 17 09:22:00 UTC 2019

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.155 -r1.156 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.143 -r1.144 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

2019-10-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct 17 09:21:40 UTC 2019

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

Log Message:
- All of Cicada and Vitesse devices' OUI are not bit-reversed, so use "xx".
- Rename CS82xx -> CIS82xx
- Add Vitesse VSC8224, VSC8234, VSC8641 and VSC8501.


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 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.157 src/sys/dev/mii/miidevs:1.158
--- src/sys/dev/mii/miidevs:1.157	Thu Sep 19 14:38:45 2019
+++ src/sys/dev/mii/miidevs	Thu Oct 17 09:21:40 2019
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.157 2019/09/19 14:38:45 msaitoh Exp $
+$NetBSD: miidevs,v 1.158 2019/10/17 09:21:40 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -50,10 +50,8 @@ $NetBSD: miidevs,v 1.157 2019/09/19 14:3
  */
 
 oui AMD0x1a	Advanced Micro Devices
-oui VITESSE			0x0001c1	Vitesse
 oui TRIDIUM			0x0001f0	Tridium
 oui DATATRACK			0x0002c6	Data Track Technology
-oui CICADA			0x0003f1	Cicada Semiconductor
 oui AGERE			0x00053d	Agere
 oui BANKSPEED			0x0006b8	Bankspeed Pty
 oui NETEXCELL			0x0008bb	NetExcell
@@ -114,6 +112,7 @@ oui xxINTEL			0x001f00	Intel
 oui xxBROADCOM_ALT1		0x0050ef	Broadcom Corporation
 oui yyINTEL			0x005500	Intel
 oui yyASIX			0x007063	Asix Semiconductor
+oui xxVITESSE			0x008083	Vitesse Semiconductor
 oui xxPMCSIERRA2		0x009057	PMC-Sierra
 oui xxCICADA			0x00c08f	Cicada Semiconductor
 oui xxNATSEMI			0x1000e8	National Semiconductor
@@ -223,15 +222,17 @@ model BROADCOM3 BCM5720C	0x0036 BCM5720C
 model BROADCOM4 BCM5725C	0x0038 BCM5725C 1000BASE-T media interface
 model xxBROADCOM_ALT1 BCM5906	0x0004 BCM5906 10/100baseTX media interface
 
-/* Cicada Semiconductor PHYs (now owned by Vitesse?) */
-model CICADA CS8201		0x0001 Cicada CS8201 10/100/1000TX PHY
-model CICADA CS8204		0x0004 Cicada CS8204 10/100/1000TX PHY
-model CICADA VSC8211		0x000b Cicada VSC8211 10/100/1000TX PHY
-model CICADA CS8201A		0x0020 Cicada CS8201 10/100/1000TX PHY
-model CICADA CS8201B		0x0021 Cicada CS8201 10/100/1000TX PHY
-model CICADA CS8244		0x002c Vitesse VSC8244 Quad 10/100/1000BASE-T PHY
+/* Cicada Semiconductor PHYs (-> Vitesse -> Microsemi) */
+
+model xxCICADA CIS8201		0x0001 Cicada CIS8201 10/100/1000TX PHY
+model xxCICADA CIS8204		0x0004 Cicada CIS8204 10/100/1000TX PHY
+model xxCICADA VSC8211		0x000b Cicada VSC8211 10/100/1000TX PHY
 model xxCICADA VSC8221		0x0015 Vitesse VSC8221 10/100/1000BASE-T PHY
-model xxCICADA CS8201B		0x0021 Cicada CS8201 10/100/1000TX PHY
+model xxCICADA VSC8224		0x0018 Vitesse VSC8224 10/100/1000BASE-T PHY
+model xxCICADA CIS8201A		0x0020 Cicada CIS8201 10/100/1000TX PHY
+model xxCICADA CIS8201B		0x0021 Cicada CIS8201 10/100/1000TX PHY
+model xxCICADA VSC8234		0x0022 Vitesse VSC8234 10/100/1000TX PHY
+model xxCICADA VSC8244		0x002c Vitesse VSC8244 Quad 10/100/1000BASE-T PHY
 
 /* Davicom Semiconductor PHYs */
 /* AMD Am79C873 seems to be a relabeled DM9101 */
@@ -393,8 +394,10 @@ model xxTSC 78Q2121		0x0015 78Q2121 100B
 model VIA VT6103		0x0032	VT6103 10/100 PHY
 model VIA VT6103_2		0x0034	VT6103 10/100 PHY
 
-/* Vitesse PHYs */
-model VITESSE VSC8601		0x0002	VSC8601 10/100/1000 PHY
+/* 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 VSC8501		0x0013 Vitesse VSC8501 10/100/1000TX PHY
 
 /* XaQti Corp. PHYs */
 model xxXAQTI XMACII		0x XaQti Corp. XMAC II gigabit interface



CVS commit: src/sys/dev/mii

2019-10-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Oct 11 09:31:52 UTC 2019

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

Log Message:
 Call mii_phy_flowstatus() to show the flow setting.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/mii/ciphy.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.35 src/sys/dev/mii/ciphy.c:1.36
--- src/sys/dev/mii/ciphy.c:1.35	Fri Oct 11 09:29:04 2019
+++ src/sys/dev/mii/ciphy.c	Fri Oct 11 09:31:52 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ciphy.c,v 1.35 2019/10/11 09:29:04 msaitoh Exp $ */
+/* $NetBSD: ciphy.c,v 1.36 2019/10/11 09:31:52 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.35 2019/10/11 09:29:04 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.36 2019/10/11 09:31:52 msaitoh Exp $");
 
 /*
  * Driver for the Cicada CS8201 10/100/1000 copper PHY.
@@ -339,7 +339,7 @@ ciphy_status(struct mii_softc *sc)
 	}
 
 	if (bmsr & CIPHY_AUXCSR_FDX)
-		mii->mii_media_active |= IFM_FDX;
+		mii->mii_media_active |= IFM_FDX | mii_phy_flowstatus(sc);
 	else
 		mii->mii_media_active |= IFM_HDX;
 



CVS commit: src/sys/dev/mii

2019-10-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Oct 11 09:31:52 UTC 2019

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

Log Message:
 Call mii_phy_flowstatus() to show the flow setting.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/mii/ciphy.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

2019-10-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Oct 11 09:29:04 UTC 2019

Modified Files:
src/sys/dev/mii: ciphy.c rgephy.c

Log Message:
- Indicat master mode if the negotiated result say so.
- KNF


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/mii/ciphy.c
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/mii/rgephy.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.34 src/sys/dev/mii/ciphy.c:1.35
--- src/sys/dev/mii/ciphy.c:1.34	Thu Apr 11 09:14:07 2019
+++ src/sys/dev/mii/ciphy.c	Fri Oct 11 09:29:04 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ciphy.c,v 1.34 2019/04/11 09:14:07 msaitoh Exp $ */
+/* $NetBSD: ciphy.c,v 1.35 2019/10/11 09:29:04 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.34 2019/04/11 09:14:07 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.35 2019/10/11 09:29:04 msaitoh Exp $");
 
 /*
  * Driver for the Cicada CS8201 10/100/1000 copper PHY.
@@ -297,7 +297,7 @@ static void
 ciphy_status(struct mii_softc *sc)
 {
 	struct mii_data *mii = sc->mii_pdata;
-	uint16_t bmsr, bmcr;
+	uint16_t bmsr, bmcr, gtsr;
 
 	mii->mii_media_status = IFM_AVALID;
 	mii->mii_media_active = IFM_ETHER;
@@ -343,16 +343,19 @@ ciphy_status(struct mii_softc *sc)
 	else
 		mii->mii_media_active |= IFM_HDX;
 
-	return;
+	if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) {
+		PHY_READ(sc, MII_GTSR, );
+		if ((gtsr & GTSR_MS_RES) != 0)
+			mii->mii_media_active |= IFM_ETH_MASTER;
+	}
 }
 
 static void
 ciphy_reset(struct mii_softc *sc)
 {
+
 	mii_phy_reset(sc);
 	DELAY(1000);
-
-	return;
 }
 
 static inline int
@@ -437,6 +440,4 @@ ciphy_fixup(struct mii_softc *sc)
 		model);
 		break;
 	}
-
-	return;
 }

Index: src/sys/dev/mii/rgephy.c
diff -u src/sys/dev/mii/rgephy.c:1.56 src/sys/dev/mii/rgephy.c:1.57
--- src/sys/dev/mii/rgephy.c:1.56	Fri Oct 11 03:40:01 2019
+++ src/sys/dev/mii/rgephy.c	Fri Oct 11 09:29:04 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rgephy.c,v 1.56 2019/10/11 03:40:01 msaitoh Exp $	*/
+/*	$NetBSD: rgephy.c,v 1.57 2019/10/11 09:29:04 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2003
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.56 2019/10/11 03:40:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.57 2019/10/11 09:29:04 msaitoh Exp $");
 
 
 /*
@@ -356,7 +356,7 @@ static void
 rgephy_status(struct mii_softc *sc)
 {
 	struct mii_data *mii = sc->mii_pdata;
-	uint16_t gstat, bmsr, bmcr, physr, ssr;
+	uint16_t gstat, bmsr, bmcr, gtsr, physr, ssr;
 
 	mii->mii_media_status = IFM_AVALID;
 	mii->mii_media_active = IFM_ETHER;
@@ -442,6 +442,12 @@ rgephy_status(struct mii_softc *sc)
 		else
 			mii->mii_media_active |= IFM_HDX;
 	}
+
+	if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) {
+		PHY_READ(sc, MII_GTSR, );
+		if ((gtsr & GTSR_MS_RES) != 0)
+			mii->mii_media_active |= IFM_ETH_MASTER;
+	}
 }
 
 static int



CVS commit: src/sys/dev/mii

2019-10-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Oct 11 09:29:04 UTC 2019

Modified Files:
src/sys/dev/mii: ciphy.c rgephy.c

Log Message:
- Indicat master mode if the negotiated result say so.
- KNF


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/mii/ciphy.c
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/mii/rgephy.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

2019-10-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Oct 11 03:40:01 UTC 2019

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

Log Message:
Make new rgephy_linkup() function and share it like FreeBSD.
No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/mii/rgephy.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/rgephy.c
diff -u src/sys/dev/mii/rgephy.c:1.55 src/sys/dev/mii/rgephy.c:1.56
--- src/sys/dev/mii/rgephy.c:1.55	Wed Jun  5 17:50:06 2019
+++ src/sys/dev/mii/rgephy.c	Fri Oct 11 03:40:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rgephy.c,v 1.55 2019/06/05 17:50:06 triaxx Exp $	*/
+/*	$NetBSD: rgephy.c,v 1.56 2019/10/11 03:40:01 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2003
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.55 2019/06/05 17:50:06 triaxx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.56 2019/10/11 03:40:01 msaitoh Exp $");
 
 
 /*
@@ -75,6 +75,7 @@ static int	rgephy_service(struct mii_sof
 static void	rgephy_status(struct mii_softc *);
 static int	rgephy_mii_phy_auto(struct mii_softc *);
 static void	rgephy_reset(struct mii_softc *);
+static bool	rgephy_linkup(struct mii_softc *);
 static void	rgephy_loop(struct mii_softc *);
 static void	rgephy_load_dspcode(struct mii_softc *);
 
@@ -295,26 +296,9 @@ rgephy_service(struct mii_softc *sc, str
 		 * need to restart the autonegotiation process.  Read
 		 * the BMSR twice in case it's latched.
 		 */
-		if (sc->mii_mpd_rev >= RGEPHY_8211F) {
-			/* RTL8211F */
-			PHY_READ(sc, RGEPHY_MII_PHYSR, );
-			if (reg & RGEPHY_PHYSR_LINK) {
-sc->mii_ticks = 0;
-break;
-			}
-		} else if (sc->mii_mpd_rev >= RGEPHY_8211B) {
-			/* RTL8211B(L) */
-			PHY_READ(sc, RGEPHY_MII_SSR, );
-			if (reg & RGEPHY_SSR_LINK) {
-sc->mii_ticks = 0;
-break;
-			}
-		} else {
-			PHY_READ(sc, RTK_GMEDIASTAT, );
-			if ((reg & RTK_GMEDIASTAT_LINK) != 0) {
-sc->mii_ticks = 0;
-break;
-			}
+		if (rgephy_linkup(sc)) {
+			sc->mii_ticks = 0;
+			break;
 		}
 
 		/* Announce link loss right after it happens. */
@@ -345,6 +329,29 @@ rgephy_service(struct mii_softc *sc, str
 	return 0;
 }
 
+static bool
+rgephy_linkup(struct mii_softc *sc)
+{
+	bool linkup = false;
+	uint16_t reg;
+
+	if (sc->mii_mpd_rev >= RGEPHY_8211F) {
+		PHY_READ(sc, RGEPHY_MII_PHYSR, );
+		if (reg & RGEPHY_PHYSR_LINK)
+			linkup = true;
+	} else if (sc->mii_mpd_rev >= RGEPHY_8211B) {
+		PHY_READ(sc, RGEPHY_MII_SSR, );
+		if (reg & RGEPHY_SSR_LINK)
+			linkup = true;
+	} else {
+		PHY_READ(sc, RTK_GMEDIASTAT, );
+		if ((reg & RTK_GMEDIASTAT_LINK) != 0)
+			linkup = true;
+	}
+
+	return linkup;
+}
+
 static void
 rgephy_status(struct mii_softc *sc)
 {
@@ -354,19 +361,8 @@ rgephy_status(struct mii_softc *sc)
 	mii->mii_media_status = IFM_AVALID;
 	mii->mii_media_active = IFM_ETHER;
 
-	if (sc->mii_mpd_rev >= RGEPHY_8211F) {
-		PHY_READ(sc, RGEPHY_MII_PHYSR, );
-		if (physr & RGEPHY_PHYSR_LINK)
-			mii->mii_media_status |= IFM_ACTIVE;
-	} else if (sc->mii_mpd_rev >= RGEPHY_8211B) {
-		PHY_READ(sc, RGEPHY_MII_SSR, );
-		if (ssr & RGEPHY_SSR_LINK)
-			mii->mii_media_status |= IFM_ACTIVE;
-	} else {
-		PHY_READ(sc, RTK_GMEDIASTAT, );
-		if ((gstat & RTK_GMEDIASTAT_LINK) != 0)
-			mii->mii_media_status |= IFM_ACTIVE;
-	}
+	if (rgephy_linkup(sc))
+		mii->mii_media_status |= IFM_ACTIVE;
 
 	PHY_READ(sc, MII_BMSR, );
 	PHY_READ(sc, MII_BMCR, );



CVS commit: src/sys/dev/mii

2019-10-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Oct 11 03:40:01 UTC 2019

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

Log Message:
Make new rgephy_linkup() function and share it like FreeBSD.
No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/mii/rgephy.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

2019-09-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Sep 19 14:41:28 UTC 2019

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

Log Message:
- ICPLUS -> xxICPLUS
- Print model name if it's ICPLUS IP101 to avoid "Realtek internal PHY".


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/mii/rlphy.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/rlphy.c
diff -u src/sys/dev/mii/rlphy.c:1.36 src/sys/dev/mii/rlphy.c:1.37
--- src/sys/dev/mii/rlphy.c:1.36	Mon Mar 25 09:20:46 2019
+++ src/sys/dev/mii/rlphy.c	Thu Sep 19 14:41:28 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rlphy.c,v 1.36 2019/03/25 09:20:46 msaitoh Exp $	*/
+/*	$NetBSD: rlphy.c,v 1.37 2019/09/19 14:41:28 msaitoh Exp $	*/
 /*	$OpenBSD: rlphy.c,v 1.20 2005/07/31 05:27:30 pvalchev Exp $	*/
 
 /*
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rlphy.c,v 1.36 2019/03/25 09:20:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rlphy.c,v 1.37 2019/09/19 14:41:28 msaitoh Exp $");
 
 #include 
 #include 
@@ -78,7 +78,7 @@ const struct mii_phy_funcs rlphy_funcs =
 static const struct mii_phydesc rlphys[] = {
 	MII_PHY_DESC(yyREALTEK, RTL8201L),
 	MII_PHY_DESC(REALTEK, RTL8201E),
-	MII_PHY_DESC(ICPLUS, IP101),
+	MII_PHY_DESC(xxICPLUS, IP101),
 	MII_PHY_END,
 };
 
@@ -125,6 +125,9 @@ rlphyattach(device_t parent, device_t se
 		rsc->sc_rtl8201 = 1;
 		aprint_normal(": %s, rev. %d\n", MII_STR_REALTEK_RTL8201E,
 		MII_REV(ma->mii_id2));
+	} else if (MII_MODEL(ma->mii_id2) == MII_MODEL_xxICPLUS_IP101) {
+		aprint_normal(": %s, rev. %d\n", MII_STR_xxICPLUS_IP101,
+		MII_REV(ma->mii_id2));
 	} else
 		aprint_normal(": Realtek internal PHY\n");
 



CVS commit: src/sys/dev/mii

2019-09-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Sep 19 14:41:28 UTC 2019

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

Log Message:
- ICPLUS -> xxICPLUS
- Print model name if it's ICPLUS IP101 to avoid "Realtek internal PHY".


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

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



  1   2   >