Skip to content

Commit 09cbd7a

Browse files
committed
Update EVB-LAN8670-USB kernel driver to latest version released on February 16th 2024.
1 parent 204f906 commit 09cbd7a

File tree

2 files changed

+68
-6
lines changed

2 files changed

+68
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
enable=1
4+
node_id=0
5+
node_count=8
6+
max_bc=0
7+
burst_timer=128
8+
to_timer=32
9+
10+
if [[ $1 == "" ]]
11+
then
12+
echo Proceeding with node id: 0
13+
else
14+
node_id=$1
15+
fi
16+
17+
if [ "$node_id" -ge 0 ] && [ "$node_id" -le 254 ]
18+
then
19+
echo PLCA Parameters:
20+
echo ----------------
21+
echo PLCA: $enable
22+
echo Node id: $node_id
23+
echo Node count: $node_count
24+
echo Max BC: $max_bc
25+
echo Burst Timer: $burst_timer
26+
echo TO Timer: $to_timer
27+
echo ----------------
28+
else
29+
echo Invalid node id: "$node_id"
30+
exit 0
31+
fi
32+
33+
devices=$(ls /sys/bus/usb/drivers/smsc95xx | grep "^[1-9]")
34+
for i in $devices; do
35+
echo Unlinking device: "$i"
36+
echo "$i" | sudo tee /sys/bus/usb/drivers/smsc95xx/unbind > /dev/null
37+
done
38+
39+
if [[ -n $(lsmod | grep microchip_t1s) ]]
40+
then
41+
echo Unloading microchip_t1s driver...
42+
sudo rmmod microchip_t1s
43+
fi
44+
45+
echo Loading microchip_t1s driver...
46+
sudo insmod microchip_t1s.ko enable=$enable node_id=$node_id node_count=$node_count max_bc=$max_bc burst_timer=$burst_timer to_timer=$to_timer
47+
48+
for i in $devices; do
49+
echo Linking device: "$i"
50+
echo "$i" | sudo tee /sys/bus/usb/drivers/smsc95xx/bind > /dev/null
51+
done

extras/evb-lan8670-usb-linux-6.1.21/microchip_t1s.c

+17-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Driver for Microchip 10BASE-T1S PHYs
44
*
55
* Support: Microchip Phys:
6-
* lan8670/1/2 Rev.B1, Rev.C0, Rev.C1
6+
* lan8670/1/2 Rev.B1, Rev.C0, Rev.C1, Rev.C2
77
* lan8650/1 Rev.B0 Internal PHYs
88
*/
99

@@ -14,6 +14,7 @@
1414
#define PHY_ID_LAN867X_REVB1 0x0007C162
1515
#define PHY_ID_LAN867X_REVC0 0x0007C163
1616
#define PHY_ID_LAN867X_REVC1 0x0007C164
17+
#define PHY_ID_LAN867X_REVC2 0x0007C165
1718
#define PHY_ID_LAN865X_REVB0 0x0007C1B3
1819

1920
#define LAN867X_REG_STS2 0x0019
@@ -34,7 +35,8 @@
3435
#define LAN865X_CFGPARAM_READ_ENABLE BIT(1)
3536

3637
#define LAN86XX_DISABLE_COL_DET 0x0000
37-
#define LAN86XX_ENABLE_COL_DET 0x0083
38+
#define LAN86XX_ENABLE_COL_DET 0x8000
39+
#define LAN86XX_COL_DET_MASK 0x8000
3840
#define LAN86XX_REG_COL_DET_CTRL0 0x0087
3941

4042
/* PLCA enable - Could be configured by parameter */
@@ -162,14 +164,16 @@ static int lan86xx_configure_plca(struct phy_device *phydev)
162164
return ret;
163165
}
164166
if (plca_enable) {
165-
ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, LAN86XX_REG_COL_DET_CTRL0, LAN86XX_DISABLE_COL_DET);
166-
if (ret < 0)
167+
ret = phy_modify_mmd(phydev, MDIO_MMD_VEND2, LAN86XX_REG_COL_DET_CTRL0,
168+
LAN86XX_COL_DET_MASK, LAN86XX_DISABLE_COL_DET);
169+
if (ret)
167170
return ret;
168171
phydev_info(phydev, "PLCA mode enabled. Node Id: %d, Node Count: %d, Max BC: %d, Burst Timer: %d, TO Timer: %d\n",
169172
plca_node_id, plca_node_count, max_bc, burst_timer, to_timer);
170173
} else {
171-
ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, LAN86XX_REG_COL_DET_CTRL0, LAN86XX_ENABLE_COL_DET);
172-
if (ret < 0)
174+
ret = phy_modify_mmd(phydev, MDIO_MMD_VEND2, LAN86XX_REG_COL_DET_CTRL0,
175+
LAN86XX_COL_DET_MASK, LAN86XX_ENABLE_COL_DET);
176+
if (ret)
173177
return ret;
174178
phydev_info(phydev, "CSMA/CD mode enabled\n");
175179
}
@@ -521,6 +525,12 @@ static struct phy_driver microchip_t1s_driver[] = {
521525
.config_init = lan867x_revc_config_init,
522526
.read_status = lan86xx_read_status,
523527
},
528+
{
529+
PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVC2),
530+
.name = "LAN867X Rev.C2",
531+
.config_init = lan867x_revc_config_init,
532+
.read_status = lan86xx_read_status,
533+
},
524534
{
525535
PHY_ID_MATCH_EXACT(PHY_ID_LAN865X_REVB0),
526536
.name = "LAN865X Rev.B0 Internal Phy",
@@ -535,6 +545,7 @@ static struct mdio_device_id __maybe_unused tbl[] = {
535545
{ PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVB1) },
536546
{ PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVC0) },
537547
{ PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVC1) },
548+
{ PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVC2) },
538549
{ PHY_ID_MATCH_EXACT(PHY_ID_LAN865X_REVB0) },
539550
{ }
540551
};

0 commit comments

Comments
 (0)