18 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
20 #include <linux/kernel.h>
21 #include <linux/module.h>
22 #include <linux/mii.h>
23 #include <linux/ethtool.h>
25 #include <linux/netdevice.h>
30 #define DP83865_PHY_ID 0x20005c7a
32 #define DP83865_INT_STATUS 0x14
33 #define DP83865_INT_MASK 0x15
34 #define DP83865_INT_CLEAR 0x17
36 #define DP83865_INT_REMOTE_FAULT 0x0008
37 #define DP83865_INT_ANE_COMPLETED 0x0010
38 #define DP83865_INT_LINK_CHANGE 0xe000
39 #define DP83865_INT_MASK_DEFAULT (DP83865_INT_REMOTE_FAULT | \
40 DP83865_INT_ANE_COMPLETED | \
41 DP83865_INT_LINK_CHANGE)
44 #define NS_EXP_MEM_CTL 0x16
45 #define NS_EXP_MEM_DATA 0x1d
46 #define NS_EXP_MEM_ADD 0x1e
48 #define LED_CTRL_REG 0x13
49 #define AN_FALLBACK_AN 0x0001
50 #define AN_FALLBACK_CRC 0x0002
51 #define AN_FALLBACK_IE 0x0004
52 #define ALL_FALLBACK_ON (AN_FALLBACK_AN | AN_FALLBACK_CRC | AN_FALLBACK_IE)
71 static int ns_config_intr(
struct phy_device *phydev)
84 static int ns_ack_interrupt(
struct phy_device *phydev)
97 static void ns_giga_speed_fallback(
struct phy_device *phydev,
int mode)
114 ns_exp_write(phydev, 0x1c0, ns_exp_read(phydev, 0x1c0) | 1);
116 ns_exp_write(phydev, 0x1c0,
117 ns_exp_read(phydev, 0x1c0) & 0xfffe);
119 pr_debug(
"10BASE-T HDX loopback %s\n",
120 (ns_exp_read(phydev, 0x1c0) & 0x0001) ?
"off" :
"on");
123 static int ns_config_init(
struct phy_device *phydev)
129 return ns_ack_interrupt(phydev);
134 .phy_id_mask = 0xfffffff0,
135 .name =
"NatSemi DP83865",
138 .config_init = ns_config_init,
141 .ack_interrupt = ns_ack_interrupt,
142 .config_intr = ns_config_intr,
146 static int __init ns_init(
void)
151 static void __exit ns_exit(
void)