broadcom.c 18.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/*
 *	drivers/net/phy/broadcom.c
 *
 *	Broadcom BCM5411, BCM5421 and BCM5461 Gigabit Ethernet
 *	transceivers.
 *
 *	Copyright (c) 2006  Maciej W. Rozycki
 *
 *	Inspired by code written by Amy Fong.
 *
 *	This program is free software; you can redistribute it and/or
 *	modify it under the terms of the GNU General Public License
 *	as published by the Free Software Foundation; either version
 *	2 of the License, or (at your option) any later version.
 */

17
#include "bcm-phy-lib.h"
18 19
#include <linux/module.h>
#include <linux/phy.h>
20
#include <linux/brcmphy.h>
21
#include <linux/of.h>
22 23 24 25

#define BRCM_PHY_MODEL(phydev) \
	((phydev)->drv->phy_id & (phydev)->drv->phy_id_mask)

26 27 28
#define BRCM_PHY_REV(phydev) \
	((phydev)->drv->phy_id & ~((phydev)->drv->phy_id_mask))

29 30 31 32
MODULE_DESCRIPTION("Broadcom PHY driver");
MODULE_AUTHOR("Maciej W. Rozycki");
MODULE_LICENSE("GPL");

33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
static int bcm54810_config(struct phy_device *phydev)
{
	int rc, val;

	val = bcm_phy_read_exp(phydev, BCM54810_EXP_BROADREACH_LRE_MISC_CTL);
	val &= ~BCM54810_EXP_BROADREACH_LRE_MISC_CTL_EN;
	rc = bcm_phy_write_exp(phydev, BCM54810_EXP_BROADREACH_LRE_MISC_CTL,
			       val);
	if (rc < 0)
		return rc;

	val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC);
	val &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN;
	val |= MII_BCM54XX_AUXCTL_MISC_WREN;
	rc = bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC,
				  val);
	if (rc < 0)
		return rc;

	val = bcm_phy_read_shadow(phydev, BCM54810_SHD_CLK_CTL);
	val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN;
	rc = bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val);
	if (rc < 0)
		return rc;

	return 0;
}

M
Matt Carlson 已提交
61
/* Needs SMDSP clock enabled via bcm54xx_phydsp_config() */
M
Matt Carlson 已提交
62 63 64 65
static int bcm50610_a0_workaround(struct phy_device *phydev)
{
	int err;

66
	err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_AADJ1CH0,
M
Matt Carlson 已提交
67 68 69
				MII_BCM54XX_EXP_AADJ1CH0_SWP_ABCD_OEN |
				MII_BCM54XX_EXP_AADJ1CH0_SWSEL_THPF);
	if (err < 0)
M
Matt Carlson 已提交
70
		return err;
M
Matt Carlson 已提交
71

72 73
	err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_AADJ1CH3,
				MII_BCM54XX_EXP_AADJ1CH3_ADCCKADJ);
M
Matt Carlson 已提交
74
	if (err < 0)
M
Matt Carlson 已提交
75
		return err;
M
Matt Carlson 已提交
76

77
	err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP75,
M
Matt Carlson 已提交
78 79
				MII_BCM54XX_EXP_EXP75_VDACCTRL);
	if (err < 0)
M
Matt Carlson 已提交
80
		return err;
M
Matt Carlson 已提交
81

82
	err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP96,
M
Matt Carlson 已提交
83 84
				MII_BCM54XX_EXP_EXP96_MYST);
	if (err < 0)
M
Matt Carlson 已提交
85
		return err;
M
Matt Carlson 已提交
86

87
	err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP97,
M
Matt Carlson 已提交
88 89
				MII_BCM54XX_EXP_EXP97_MYST);

M
Matt Carlson 已提交
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
	return err;
}

static int bcm54xx_phydsp_config(struct phy_device *phydev)
{
	int err, err2;

	/* Enable the SMDSP clock */
	err = bcm54xx_auxctl_write(phydev,
				   MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL,
				   MII_BCM54XX_AUXCTL_ACTL_SMDSP_ENA |
				   MII_BCM54XX_AUXCTL_ACTL_TX_6DB);
	if (err < 0)
		return err;

M
Matt Carlson 已提交
105 106 107
	if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610 ||
	    BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610M) {
		/* Clear bit 9 to fix a phy interop issue. */
108
		err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP08,
M
Matt Carlson 已提交
109 110 111 112 113 114 115 116 117 118
					MII_BCM54XX_EXP_EXP08_RJCT_2MHZ);
		if (err < 0)
			goto error;

		if (phydev->drv->phy_id == PHY_ID_BCM50610) {
			err = bcm50610_a0_workaround(phydev);
			if (err < 0)
				goto error;
		}
	}
M
Matt Carlson 已提交
119 120 121 122

	if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM57780) {
		int val;

123
		val = bcm_phy_read_exp(phydev, MII_BCM54XX_EXP_EXP75);
M
Matt Carlson 已提交
124 125 126 127
		if (val < 0)
			goto error;

		val |= MII_BCM54XX_EXP_EXP75_CM_OSC;
128
		err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP75, val);
M
Matt Carlson 已提交
129 130
	}

M
Matt Carlson 已提交
131
error:
M
Matt Carlson 已提交
132 133 134 135
	/* Disable the SMDSP clock */
	err2 = bcm54xx_auxctl_write(phydev,
				    MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL,
				    MII_BCM54XX_AUXCTL_ACTL_TX_6DB);
M
Matt Carlson 已提交
136

M
Matt Carlson 已提交
137 138
	/* Return the first error reported. */
	return err ? err : err2;
M
Matt Carlson 已提交
139 140
}

141 142
static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev)
{
143 144
	u32 orig;
	int val;
145
	bool clk125en = true;
146 147

	/* Abort if we are using an untested phy. */
148 149
	if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 &&
	    BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 &&
150 151 152
	    BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610M)
		return;

153
	val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_SCR3);
154 155 156 157 158
	if (val < 0)
		return;

	orig = val;

159 160 161 162 163 164 165 166 167 168
	if ((BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610 ||
	     BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610M) &&
	    BRCM_PHY_REV(phydev) >= 0x3) {
		/*
		 * Here, bit 0 _disables_ CLK125 when set.
		 * This bit is set by default.
		 */
		clk125en = false;
	} else {
		if (phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED) {
169 170
			/* Here, bit 0 _enables_ CLK125 when set */
			val &= ~BCM54XX_SHD_SCR3_DEF_CLK125;
171
			clk125en = false;
172 173 174
		}
	}

175
	if (!clk125en || (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE))
176 177 178 179
		val &= ~BCM54XX_SHD_SCR3_DLLAPD_DIS;
	else
		val |= BCM54XX_SHD_SCR3_DLLAPD_DIS;

180 181 182
	if (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY)
		val |= BCM54XX_SHD_SCR3_TRDDAPD;

183
	if (orig != val)
184
		bcm_phy_write_shadow(phydev, BCM54XX_SHD_SCR3, val);
185

186
	val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_APD);
187 188 189 190 191
	if (val < 0)
		return;

	orig = val;

192
	if (!clk125en || (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE))
193 194 195 196 197
		val |= BCM54XX_SHD_APD_EN;
	else
		val &= ~BCM54XX_SHD_APD_EN;

	if (orig != val)
198
		bcm_phy_write_shadow(phydev, BCM54XX_SHD_APD, val);
199 200
}

201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
static int bcm54xx_config_init(struct phy_device *phydev)
{
	int reg, err;

	reg = phy_read(phydev, MII_BCM54XX_ECR);
	if (reg < 0)
		return reg;

	/* Mask interrupts globally.  */
	reg |= MII_BCM54XX_ECR_IM;
	err = phy_write(phydev, MII_BCM54XX_ECR, reg);
	if (err < 0)
		return err;

	/* Unmask events we are interested in.  */
	reg = ~(MII_BCM54XX_INT_DUPLEX |
		MII_BCM54XX_INT_SPEED |
		MII_BCM54XX_INT_LINK);
	err = phy_write(phydev, MII_BCM54XX_IMR, reg);
	if (err < 0)
		return err;
M
Matt Carlson 已提交
222

223 224 225
	if ((BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610 ||
	     BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610M) &&
	    (phydev->dev_flags & PHY_BRCM_CLEAR_RGMII_MODE))
226
		bcm_phy_write_shadow(phydev, BCM54XX_SHD_RGMII_MODE, 0);
227

228
	if ((phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED) ||
229
	    (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY) ||
230
	    (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE))
231 232
		bcm54xx_adjust_rxrefclk(phydev);

233 234 235 236 237 238
	if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810) {
		err = bcm54810_config(phydev);
		if (err)
			return err;
	}

M
Matt Carlson 已提交
239
	bcm54xx_phydsp_config(phydev);
240

241 242 243
	return 0;
}

244 245 246 247 248 249 250 251 252 253
static int bcm5482_config_init(struct phy_device *phydev)
{
	int err, reg;

	err = bcm54xx_config_init(phydev);

	if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX) {
		/*
		 * Enable secondary SerDes and its use as an LED source
		 */
254 255
		reg = bcm_phy_read_shadow(phydev, BCM5482_SHD_SSD);
		bcm_phy_write_shadow(phydev, BCM5482_SHD_SSD,
256 257 258 259 260 261 262
				     reg |
				     BCM5482_SHD_SSD_LEDM |
				     BCM5482_SHD_SSD_EN);

		/*
		 * Enable SGMII slave mode and auto-detection
		 */
263
		reg = BCM5482_SSD_SGMII_SLAVE | MII_BCM54XX_EXP_SEL_SSD;
264
		err = bcm_phy_read_exp(phydev, reg);
265 266
		if (err < 0)
			return err;
267
		err = bcm_phy_write_exp(phydev, reg, err |
268 269 270 271
					BCM5482_SSD_SGMII_SLAVE_EN |
					BCM5482_SSD_SGMII_SLAVE_AD);
		if (err < 0)
			return err;
272 273 274 275

		/*
		 * Disable secondary SerDes powerdown
		 */
276
		reg = BCM5482_SSD_1000BX_CTL | MII_BCM54XX_EXP_SEL_SSD;
277
		err = bcm_phy_read_exp(phydev, reg);
278 279
		if (err < 0)
			return err;
280
		err = bcm_phy_write_exp(phydev, reg,
281 282 283
					err & ~BCM5482_SSD_1000BX_CTL_PWRDOWN);
		if (err < 0)
			return err;
284 285 286 287

		/*
		 * Select 1000BASE-X register set (primary SerDes)
		 */
288 289
		reg = bcm_phy_read_shadow(phydev, BCM5482_SHD_MODE);
		bcm_phy_write_shadow(phydev, BCM5482_SHD_MODE,
290 291 292 293 294 295
				     reg | BCM5482_SHD_MODE_1000BX);

		/*
		 * LED1=ACTIVITYLED, LED3=LINKSPD[2]
		 * (Use LED1 as secondary SerDes ACTIVITY LED)
		 */
296
		bcm_phy_write_shadow(phydev, BCM5482_SHD_LEDS1,
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333
			BCM5482_SHD_LEDS1_LED1(BCM_LED_SRC_ACTIVITYLED) |
			BCM5482_SHD_LEDS1_LED3(BCM_LED_SRC_LINKSPD2));

		/*
		 * Auto-negotiation doesn't seem to work quite right
		 * in this mode, so we disable it and force it to the
		 * right speed/duplex setting.  Only 'link status'
		 * is important.
		 */
		phydev->autoneg = AUTONEG_DISABLE;
		phydev->speed = SPEED_1000;
		phydev->duplex = DUPLEX_FULL;
	}

	return err;
}

static int bcm5482_read_status(struct phy_device *phydev)
{
	int err;

	err = genphy_read_status(phydev);

	if (phydev->dev_flags & PHY_BCM_FLAGS_MODE_1000BX) {
		/*
		 * Only link status matters for 1000Base-X mode, so force
		 * 1000 Mbit/s full-duplex status
		 */
		if (phydev->link) {
			phydev->speed = SPEED_1000;
			phydev->duplex = DUPLEX_FULL;
		}
	}

	return err;
}

334 335
static int bcm5481_config_aneg(struct phy_device *phydev)
{
336
	struct device_node *np = phydev->mdio.dev.of_node;
337 338 339 340 341 342 343 344 345 346 347 348
	int ret;

	/* Aneg firsly. */
	ret = genphy_config_aneg(phydev);

	/* Then we can set up the delay. */
	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) {
		u16 reg;

		/*
		 * There is no BCM5481 specification available, so down
		 * here is everything we know about "register 0x18". This
349
		 * at least helps BCM5481 to successfully receive packets
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366
		 * on MPC8360E-RDK board. Peter Barada <peterb@logicpd.com>
		 * says: "This sets delay between the RXD and RXC signals
		 * instead of using trace lengths to achieve timing".
		 */

		/* Set RDX clk delay. */
		reg = 0x7 | (0x7 << 12);
		phy_write(phydev, 0x18, reg);

		reg = phy_read(phydev, 0x18);
		/* Set RDX-RXC skew. */
		reg |= (1 << 8);
		/* Write bits 14:0. */
		reg |= (1 << 15);
		phy_write(phydev, 0x18, reg);
	}

367 368 369 370 371 372 373 374
	if (of_property_read_bool(np, "enet-phy-lane-swap")) {
		/* Lane Swap - Undocumented register...magic! */
		ret = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_SEL_ER + 0x9,
					0x11B);
		if (ret < 0)
			return ret;
	}

375 376 377
	return ret;
}

378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397
static int bcm54612e_config_aneg(struct phy_device *phydev)
{
	int ret;

	/* First, auto-negotiate. */
	ret = genphy_config_aneg(phydev);

	/* Clear TX internal delay unless requested. */
	if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) &&
	    (phydev->interface != PHY_INTERFACE_MODE_RGMII_TXID)) {
		/* Disable TXD to GTXCLK clock delay (default set) */
		/* Bit 9 is the only field in shadow register 00011 */
		bcm_phy_write_shadow(phydev, 0x03, 0);
	}

	/* Clear RX internal delay unless requested. */
	if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) &&
	    (phydev->interface != PHY_INTERFACE_MODE_RGMII_RXID)) {
		u16 reg;

398 399
		reg = bcm54xx_auxctl_read(phydev,
					  MII_BCM54XX_AUXCTL_SHDWSEL_MISC);
400
		/* Disable RXD to RXC delay (default set) */
401
		reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN;
402 403 404 405 406 407 408 409 410
		/* Clear shadow selector field */
		reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MASK;
		bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC,
				     MII_BCM54XX_AUXCTL_MISC_WREN | reg);
	}

	return ret;
}

M
Matt Carlson 已提交
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476
static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set)
{
	int val;

	val = phy_read(phydev, reg);
	if (val < 0)
		return val;

	return phy_write(phydev, reg, val | set);
}

static int brcm_fet_config_init(struct phy_device *phydev)
{
	int reg, err, err2, brcmtest;

	/* Reset the PHY to bring it to a known state. */
	err = phy_write(phydev, MII_BMCR, BMCR_RESET);
	if (err < 0)
		return err;

	reg = phy_read(phydev, MII_BRCM_FET_INTREG);
	if (reg < 0)
		return reg;

	/* Unmask events we are interested in and mask interrupts globally. */
	reg = MII_BRCM_FET_IR_DUPLEX_EN |
	      MII_BRCM_FET_IR_SPEED_EN |
	      MII_BRCM_FET_IR_LINK_EN |
	      MII_BRCM_FET_IR_ENABLE |
	      MII_BRCM_FET_IR_MASK;

	err = phy_write(phydev, MII_BRCM_FET_INTREG, reg);
	if (err < 0)
		return err;

	/* Enable shadow register access */
	brcmtest = phy_read(phydev, MII_BRCM_FET_BRCMTEST);
	if (brcmtest < 0)
		return brcmtest;

	reg = brcmtest | MII_BRCM_FET_BT_SRE;

	err = phy_write(phydev, MII_BRCM_FET_BRCMTEST, reg);
	if (err < 0)
		return err;

	/* Set the LED mode */
	reg = phy_read(phydev, MII_BRCM_FET_SHDW_AUXMODE4);
	if (reg < 0) {
		err = reg;
		goto done;
	}

	reg &= ~MII_BRCM_FET_SHDW_AM4_LED_MASK;
	reg |= MII_BRCM_FET_SHDW_AM4_LED_MODE1;

	err = phy_write(phydev, MII_BRCM_FET_SHDW_AUXMODE4, reg);
	if (err < 0)
		goto done;

	/* Enable auto MDIX */
	err = brcm_phy_setbits(phydev, MII_BRCM_FET_SHDW_MISCCTRL,
				       MII_BRCM_FET_SHDW_MC_FAME);
	if (err < 0)
		goto done;

477 478 479 480 481
	if (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE) {
		/* Enable auto power down */
		err = brcm_phy_setbits(phydev, MII_BRCM_FET_SHDW_AUXSTAT2,
					       MII_BRCM_FET_SHDW_AS2_APDE);
	}
M
Matt Carlson 已提交
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520

done:
	/* Disable shadow register access */
	err2 = phy_write(phydev, MII_BRCM_FET_BRCMTEST, brcmtest);
	if (!err)
		err = err2;

	return err;
}

static int brcm_fet_ack_interrupt(struct phy_device *phydev)
{
	int reg;

	/* Clear pending interrupts.  */
	reg = phy_read(phydev, MII_BRCM_FET_INTREG);
	if (reg < 0)
		return reg;

	return 0;
}

static int brcm_fet_config_intr(struct phy_device *phydev)
{
	int reg, err;

	reg = phy_read(phydev, MII_BRCM_FET_INTREG);
	if (reg < 0)
		return reg;

	if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
		reg &= ~MII_BRCM_FET_IR_MASK;
	else
		reg |= MII_BRCM_FET_IR_MASK;

	err = phy_write(phydev, MII_BRCM_FET_INTREG, reg);
	return err;
}

521 522
static struct phy_driver broadcom_drivers[] = {
{
523
	.phy_id		= PHY_ID_BCM5411,
524 525
	.phy_id_mask	= 0xfffffff0,
	.name		= "Broadcom BCM5411",
526
	.features	= PHY_GBIT_FEATURES,
527 528 529 530
	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
	.config_init	= bcm54xx_config_init,
	.config_aneg	= genphy_config_aneg,
	.read_status	= genphy_read_status,
531 532
	.ack_interrupt	= bcm_phy_ack_intr,
	.config_intr	= bcm_phy_config_intr,
533
}, {
534
	.phy_id		= PHY_ID_BCM5421,
535 536
	.phy_id_mask	= 0xfffffff0,
	.name		= "Broadcom BCM5421",
537
	.features	= PHY_GBIT_FEATURES,
538 539 540 541
	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
	.config_init	= bcm54xx_config_init,
	.config_aneg	= genphy_config_aneg,
	.read_status	= genphy_read_status,
542 543
	.ack_interrupt	= bcm_phy_ack_intr,
	.config_intr	= bcm_phy_config_intr,
544
}, {
545
	.phy_id		= PHY_ID_BCM5461,
546 547
	.phy_id_mask	= 0xfffffff0,
	.name		= "Broadcom BCM5461",
548
	.features	= PHY_GBIT_FEATURES,
549 550 551 552
	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
	.config_init	= bcm54xx_config_init,
	.config_aneg	= genphy_config_aneg,
	.read_status	= genphy_read_status,
553 554
	.ack_interrupt	= bcm_phy_ack_intr,
	.config_intr	= bcm_phy_config_intr,
555 556 557 558
}, {
	.phy_id		= PHY_ID_BCM54612E,
	.phy_id_mask	= 0xfffffff0,
	.name		= "Broadcom BCM54612E",
559
	.features	= PHY_GBIT_FEATURES,
560 561 562 563 564 565
	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
	.config_init	= bcm54xx_config_init,
	.config_aneg	= bcm54612e_config_aneg,
	.read_status	= genphy_read_status,
	.ack_interrupt	= bcm_phy_ack_intr,
	.config_intr	= bcm_phy_config_intr,
566 567 568 569
}, {
	.phy_id		= PHY_ID_BCM54616S,
	.phy_id_mask	= 0xfffffff0,
	.name		= "Broadcom BCM54616S",
570
	.features	= PHY_GBIT_FEATURES,
571 572 573 574
	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
	.config_init	= bcm54xx_config_init,
	.config_aneg	= genphy_config_aneg,
	.read_status	= genphy_read_status,
575 576
	.ack_interrupt	= bcm_phy_ack_intr,
	.config_intr	= bcm_phy_config_intr,
577
}, {
578
	.phy_id		= PHY_ID_BCM5464,
579 580
	.phy_id_mask	= 0xfffffff0,
	.name		= "Broadcom BCM5464",
581
	.features	= PHY_GBIT_FEATURES,
582 583 584 585
	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
	.config_init	= bcm54xx_config_init,
	.config_aneg	= genphy_config_aneg,
	.read_status	= genphy_read_status,
586 587
	.ack_interrupt	= bcm_phy_ack_intr,
	.config_intr	= bcm_phy_config_intr,
588
}, {
589
	.phy_id		= PHY_ID_BCM5481,
590 591
	.phy_id_mask	= 0xfffffff0,
	.name		= "Broadcom BCM5481",
592
	.features	= PHY_GBIT_FEATURES,
593 594 595 596
	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
	.config_init	= bcm54xx_config_init,
	.config_aneg	= bcm5481_config_aneg,
	.read_status	= genphy_read_status,
597 598
	.ack_interrupt	= bcm_phy_ack_intr,
	.config_intr	= bcm_phy_config_intr,
599 600 601 602
}, {
	.phy_id         = PHY_ID_BCM54810,
	.phy_id_mask    = 0xfffffff0,
	.name           = "Broadcom BCM54810",
603
	.features       = PHY_GBIT_FEATURES,
604 605 606 607 608 609
	.flags          = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
	.config_init    = bcm54xx_config_init,
	.config_aneg    = bcm5481_config_aneg,
	.read_status    = genphy_read_status,
	.ack_interrupt  = bcm_phy_ack_intr,
	.config_intr    = bcm_phy_config_intr,
610
}, {
611
	.phy_id		= PHY_ID_BCM5482,
N
Nate Case 已提交
612 613
	.phy_id_mask	= 0xfffffff0,
	.name		= "Broadcom BCM5482",
614
	.features	= PHY_GBIT_FEATURES,
N
Nate Case 已提交
615
	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
616
	.config_init	= bcm5482_config_init,
N
Nate Case 已提交
617
	.config_aneg	= genphy_config_aneg,
618
	.read_status	= bcm5482_read_status,
619 620
	.ack_interrupt	= bcm_phy_ack_intr,
	.config_intr	= bcm_phy_config_intr,
621
}, {
M
Matt Carlson 已提交
622 623 624
	.phy_id		= PHY_ID_BCM50610,
	.phy_id_mask	= 0xfffffff0,
	.name		= "Broadcom BCM50610",
625
	.features	= PHY_GBIT_FEATURES,
M
Matt Carlson 已提交
626 627 628 629
	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
	.config_init	= bcm54xx_config_init,
	.config_aneg	= genphy_config_aneg,
	.read_status	= genphy_read_status,
630 631
	.ack_interrupt	= bcm_phy_ack_intr,
	.config_intr	= bcm_phy_config_intr,
632
}, {
M
Matt Carlson 已提交
633 634 635
	.phy_id		= PHY_ID_BCM50610M,
	.phy_id_mask	= 0xfffffff0,
	.name		= "Broadcom BCM50610M",
636
	.features	= PHY_GBIT_FEATURES,
M
Matt Carlson 已提交
637 638 639 640
	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
	.config_init	= bcm54xx_config_init,
	.config_aneg	= genphy_config_aneg,
	.read_status	= genphy_read_status,
641 642
	.ack_interrupt	= bcm_phy_ack_intr,
	.config_intr	= bcm_phy_config_intr,
643
}, {
644
	.phy_id		= PHY_ID_BCM57780,
M
Matt Carlson 已提交
645 646
	.phy_id_mask	= 0xfffffff0,
	.name		= "Broadcom BCM57780",
647
	.features	= PHY_GBIT_FEATURES,
M
Matt Carlson 已提交
648 649 650 651
	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
	.config_init	= bcm54xx_config_init,
	.config_aneg	= genphy_config_aneg,
	.read_status	= genphy_read_status,
652 653
	.ack_interrupt	= bcm_phy_ack_intr,
	.config_intr	= bcm_phy_config_intr,
654
}, {
655
	.phy_id		= PHY_ID_BCMAC131,
M
Matt Carlson 已提交
656 657
	.phy_id_mask	= 0xfffffff0,
	.name		= "Broadcom BCMAC131",
658
	.features	= PHY_BASIC_FEATURES,
M
Matt Carlson 已提交
659 660 661 662 663 664
	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
	.config_init	= brcm_fet_config_init,
	.config_aneg	= genphy_config_aneg,
	.read_status	= genphy_read_status,
	.ack_interrupt	= brcm_fet_ack_interrupt,
	.config_intr	= brcm_fet_config_intr,
665
}, {
D
Dmitry Baryshkov 已提交
666 667 668
	.phy_id		= PHY_ID_BCM5241,
	.phy_id_mask	= 0xfffffff0,
	.name		= "Broadcom BCM5241",
669
	.features	= PHY_BASIC_FEATURES,
D
Dmitry Baryshkov 已提交
670 671 672 673 674 675
	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
	.config_init	= brcm_fet_config_init,
	.config_aneg	= genphy_config_aneg,
	.read_status	= genphy_read_status,
	.ack_interrupt	= brcm_fet_ack_interrupt,
	.config_intr	= brcm_fet_config_intr,
676
} };
D
Dmitry Baryshkov 已提交
677

678
module_phy_driver(broadcom_drivers);
679

680
static struct mdio_device_id __maybe_unused broadcom_tbl[] = {
681 682 683
	{ PHY_ID_BCM5411, 0xfffffff0 },
	{ PHY_ID_BCM5421, 0xfffffff0 },
	{ PHY_ID_BCM5461, 0xfffffff0 },
684
	{ PHY_ID_BCM54612E, 0xfffffff0 },
685
	{ PHY_ID_BCM54616S, 0xfffffff0 },
686
	{ PHY_ID_BCM5464, 0xfffffff0 },
687
	{ PHY_ID_BCM5481, 0xfffffff0 },
688
	{ PHY_ID_BCM54810, 0xfffffff0 },
689
	{ PHY_ID_BCM5482, 0xfffffff0 },
690 691 692 693
	{ PHY_ID_BCM50610, 0xfffffff0 },
	{ PHY_ID_BCM50610M, 0xfffffff0 },
	{ PHY_ID_BCM57780, 0xfffffff0 },
	{ PHY_ID_BCMAC131, 0xfffffff0 },
D
Dmitry Baryshkov 已提交
694
	{ PHY_ID_BCM5241, 0xfffffff0 },
695 696 697 698
	{ }
};

MODULE_DEVICE_TABLE(mdio, broadcom_tbl);