9 #include <linux/module.h>
13 #define PHY_ID_BCM8706 0x0143bdc1
14 #define PHY_ID_BCM8727 0x0143bff0
16 #define BCM87XX_PMD_RX_SIGNAL_DETECT (MII_ADDR_C45 | 0x1000a)
17 #define BCM87XX_10GBASER_PCS_STATUS (MII_ADDR_C45 | 0x30020)
18 #define BCM87XX_XGXS_LANE_STATUS (MII_ADDR_C45 | 0x40018)
20 #define BCM87XX_LASI_CONTROL (MII_ADDR_C45 | 0x39002)
21 #define BCM87XX_LASI_STATUS (MII_ADDR_C45 | 0x39005)
23 #if IS_ENABLED(CONFIG_OF_MDIO)
37 static int bcm87xx_of_reg_init(
struct phy_device *phydev)
43 if (!phydev->
dev.of_node)
47 "broadcom,c45-reg-init", &len);
51 paddr_end = paddr + (len /=
sizeof(*paddr));
55 while (paddr + 3 < paddr_end) {
81 static int bcm87xx_of_reg_init(
struct phy_device *phydev)
87 static int bcm87xx_config_init(
struct phy_device *phydev)
94 bcm87xx_of_reg_init(phydev);
99 static int bcm87xx_config_aneg(
struct phy_device *phydev)
104 static int bcm87xx_read_status(
struct phy_device *phydev)
106 int rx_signal_detect;
108 int xgxs_lane_status;
111 if (rx_signal_detect < 0)
112 return rx_signal_detect;
114 if ((rx_signal_detect & 1) == 0)
121 if ((pcs_status & 1) == 0)
125 if (xgxs_lane_status < 0)
126 return xgxs_lane_status;
128 if ((xgxs_lane_status & 0x1000) == 0)
131 phydev->
speed = 10000;
141 static int bcm87xx_config_intr(
struct phy_device *phydev)
159 static int bcm87xx_did_interrupt(
struct phy_device *phydev)
167 "Error: Read of BCM87XX_LASI_STATUS failed: %d\n", reg);
170 return (reg & 1) != 0;
173 static int bcm87xx_ack_interrupt(
struct phy_device *phydev)
176 bcm87xx_did_interrupt(phydev);
180 static int bcm8706_match_phy_device(
struct phy_device *phydev)
185 static int bcm8727_match_phy_device(
struct phy_device *phydev)
193 .phy_id_mask = 0xffffffff,
194 .name =
"Broadcom BCM8706",
196 .config_init = bcm87xx_config_init,
197 .config_aneg = bcm87xx_config_aneg,
198 .read_status = bcm87xx_read_status,
199 .ack_interrupt = bcm87xx_ack_interrupt,
200 .config_intr = bcm87xx_config_intr,
201 .did_interrupt = bcm87xx_did_interrupt,
202 .match_phy_device = bcm8706_match_phy_device,
206 .phy_id_mask = 0xffffffff,
207 .name =
"Broadcom BCM8727",
209 .config_init = bcm87xx_config_init,
210 .config_aneg = bcm87xx_config_aneg,
211 .read_status = bcm87xx_read_status,
212 .ack_interrupt = bcm87xx_ack_interrupt,
213 .config_intr = bcm87xx_config_intr,
214 .did_interrupt = bcm87xx_did_interrupt,
215 .match_phy_device = bcm8727_match_phy_device,
219 static int __init bcm87xx_init(
void)
226 static void __exit bcm87xx_exit(
void)