2 * drivers/net/phy/marvell.c
4 * Driver for Marvell PHYs
8 * Copyright (c) 2004 Freescale Semiconductor, Inc.
10 * Copyright (c) 2013 Michael Stapelberg <michael@stapelberg.de>
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
18 #include <linux/kernel.h>
19 #include <linux/string.h>
20 #include <linux/ctype.h>
21 #include <linux/errno.h>
22 #include <linux/unistd.h>
23 #include <linux/hwmon.h>
24 #include <linux/interrupt.h>
25 #include <linux/init.h>
26 #include <linux/delay.h>
27 #include <linux/netdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 #include <linux/spinlock.h>
32 #include <linux/module.h>
33 #include <linux/mii.h>
34 #include <linux/ethtool.h>
35 #include <linux/phy.h>
36 #include <linux/marvell_phy.h>
41 #include <linux/uaccess.h>
43 #define MII_MARVELL_PHY_PAGE 22
44 #define MII_MARVELL_COPPER_PAGE 0x00
45 #define MII_MARVELL_FIBER_PAGE 0x01
46 #define MII_MARVELL_MSCR_PAGE 0x02
47 #define MII_MARVELL_LED_PAGE 0x03
48 #define MII_MARVELL_MISC_TEST_PAGE 0x06
49 #define MII_MARVELL_WOL_PAGE 0x11
51 #define MII_M1011_IEVENT 0x13
52 #define MII_M1011_IEVENT_CLEAR 0x0000
54 #define MII_M1011_IMASK 0x12
55 #define MII_M1011_IMASK_INIT 0x6400
56 #define MII_M1011_IMASK_CLEAR 0x0000
58 #define MII_M1011_PHY_SCR 0x10
59 #define MII_M1011_PHY_SCR_DOWNSHIFT_EN BIT(11)
60 #define MII_M1011_PHY_SCR_DOWNSHIFT_SHIFT 12
61 #define MII_M1011_PHY_SRC_DOWNSHIFT_MASK 0x7800
62 #define MII_M1011_PHY_SCR_MDI (0x0 << 5)
63 #define MII_M1011_PHY_SCR_MDI_X (0x1 << 5)
64 #define MII_M1011_PHY_SCR_AUTO_CROSS (0x3 << 5)
66 #define MII_M1111_PHY_LED_CONTROL 0x18
67 #define MII_M1111_PHY_LED_DIRECT 0x4100
68 #define MII_M1111_PHY_LED_COMBINE 0x411c
69 #define MII_M1111_PHY_EXT_CR 0x14
70 #define MII_M1111_RGMII_RX_DELAY BIT(7)
71 #define MII_M1111_RGMII_TX_DELAY BIT(1)
72 #define MII_M1111_PHY_EXT_SR 0x1b
74 #define MII_M1111_HWCFG_MODE_MASK 0xf
75 #define MII_M1111_HWCFG_MODE_FIBER_RGMII 0x3
76 #define MII_M1111_HWCFG_MODE_SGMII_NO_CLK 0x4
77 #define MII_M1111_HWCFG_MODE_RTBI 0x7
78 #define MII_M1111_HWCFG_MODE_COPPER_RTBI 0x9
79 #define MII_M1111_HWCFG_MODE_COPPER_RGMII 0xb
80 #define MII_M1111_HWCFG_FIBER_COPPER_RES BIT(13)
81 #define MII_M1111_HWCFG_FIBER_COPPER_AUTO BIT(15)
83 #define MII_88E1121_PHY_MSCR_REG 21
84 #define MII_88E1121_PHY_MSCR_RX_DELAY BIT(5)
85 #define MII_88E1121_PHY_MSCR_TX_DELAY BIT(4)
86 #define MII_88E1121_PHY_MSCR_DELAY_MASK (BIT(5) | BIT(4))
88 #define MII_88E1121_MISC_TEST 0x1a
89 #define MII_88E1510_MISC_TEST_TEMP_THRESHOLD_MASK 0x1f00
90 #define MII_88E1510_MISC_TEST_TEMP_THRESHOLD_SHIFT 8
91 #define MII_88E1510_MISC_TEST_TEMP_IRQ_EN BIT(7)
92 #define MII_88E1510_MISC_TEST_TEMP_IRQ BIT(6)
93 #define MII_88E1121_MISC_TEST_TEMP_SENSOR_EN BIT(5)
94 #define MII_88E1121_MISC_TEST_TEMP_MASK 0x1f
96 #define MII_88E1510_TEMP_SENSOR 0x1b
97 #define MII_88E1510_TEMP_SENSOR_MASK 0xff
99 #define MII_88E6390_MISC_TEST 0x1b
100 #define MII_88E6390_MISC_TEST_SAMPLE_1S 0
101 #define MII_88E6390_MISC_TEST_SAMPLE_10MS BIT(14)
102 #define MII_88E6390_MISC_TEST_SAMPLE_DISABLE BIT(15)
103 #define MII_88E6390_MISC_TEST_SAMPLE_ENABLE 0
104 #define MII_88E6390_MISC_TEST_SAMPLE_MASK (0x3 << 14)
106 #define MII_88E6390_TEMP_SENSOR 0x1c
107 #define MII_88E6390_TEMP_SENSOR_MASK 0xff
108 #define MII_88E6390_TEMP_SENSOR_SAMPLES 10
110 #define MII_88E1318S_PHY_MSCR1_REG 16
111 #define MII_88E1318S_PHY_MSCR1_PAD_ODD BIT(6)
113 /* Copper Specific Interrupt Enable Register */
114 #define MII_88E1318S_PHY_CSIER 0x12
115 /* WOL Event Interrupt Enable */
116 #define MII_88E1318S_PHY_CSIER_WOL_EIE BIT(7)
118 /* LED Timer Control Register */
119 #define MII_88E1318S_PHY_LED_TCR 0x12
120 #define MII_88E1318S_PHY_LED_TCR_FORCE_INT BIT(15)
121 #define MII_88E1318S_PHY_LED_TCR_INTn_ENABLE BIT(7)
122 #define MII_88E1318S_PHY_LED_TCR_INT_ACTIVE_LOW BIT(11)
124 /* Magic Packet MAC address registers */
125 #define MII_88E1318S_PHY_MAGIC_PACKET_WORD2 0x17
126 #define MII_88E1318S_PHY_MAGIC_PACKET_WORD1 0x18
127 #define MII_88E1318S_PHY_MAGIC_PACKET_WORD0 0x19
129 #define MII_88E1318S_PHY_WOL_CTRL 0x10
130 #define MII_88E1318S_PHY_WOL_CTRL_CLEAR_WOL_STATUS BIT(12)
131 #define MII_88E1318S_PHY_WOL_CTRL_MAGIC_PACKET_MATCH_ENABLE BIT(14)
133 #define MII_PHY_LED_CTRL 16
134 #define MII_88E1121_PHY_LED_DEF 0x0030
135 #define MII_88E1510_PHY_LED_DEF 0x1177
137 #define MII_M1011_PHY_STATUS 0x11
138 #define MII_M1011_PHY_STATUS_1000 0x8000
139 #define MII_M1011_PHY_STATUS_100 0x4000
140 #define MII_M1011_PHY_STATUS_SPD_MASK 0xc000
141 #define MII_M1011_PHY_STATUS_FULLDUPLEX 0x2000
142 #define MII_M1011_PHY_STATUS_RESOLVED 0x0800
143 #define MII_M1011_PHY_STATUS_LINK 0x0400
145 #define MII_88E3016_PHY_SPEC_CTRL 0x10
146 #define MII_88E3016_DISABLE_SCRAMBLER 0x0200
147 #define MII_88E3016_AUTO_MDIX_CROSSOVER 0x0030
149 #define MII_88E1510_GEN_CTRL_REG_1 0x14
150 #define MII_88E1510_GEN_CTRL_REG_1_MODE_MASK 0x7
151 #define MII_88E1510_GEN_CTRL_REG_1_MODE_SGMII 0x1 /* SGMII to copper */
152 #define MII_88E1510_GEN_CTRL_REG_1_RESET 0x8000 /* Soft reset */
154 #define LPA_FIBER_1000HALF 0x40
155 #define LPA_FIBER_1000FULL 0x20
157 #define LPA_PAUSE_FIBER 0x180
158 #define LPA_PAUSE_ASYM_FIBER 0x100
160 #define ADVERTISE_FIBER_1000HALF 0x40
161 #define ADVERTISE_FIBER_1000FULL 0x20
163 #define ADVERTISE_PAUSE_FIBER 0x180
164 #define ADVERTISE_PAUSE_ASYM_FIBER 0x100
166 #define REGISTER_LINK_STATUS 0x400
167 #define NB_FIBER_STATS 1
169 MODULE_DESCRIPTION("Marvell PHY driver");
170 MODULE_AUTHOR("Andy Fleming");
171 MODULE_LICENSE("GPL");
173 struct marvell_hw_stat
{
180 static struct marvell_hw_stat marvell_hw_stats
[] = {
181 { "phy_receive_errors_copper", 0, 21, 16},
182 { "phy_idle_errors", 0, 10, 8 },
183 { "phy_receive_errors_fiber", 1, 21, 16},
186 struct marvell_priv
{
187 u64 stats
[ARRAY_SIZE(marvell_hw_stats
)];
189 struct device
*hwmon_dev
;
192 static int marvell_read_page(struct phy_device
*phydev
)
194 return __phy_read(phydev
, MII_MARVELL_PHY_PAGE
);
197 static int marvell_write_page(struct phy_device
*phydev
, int page
)
199 return __phy_write(phydev
, MII_MARVELL_PHY_PAGE
, page
);
202 static int marvell_set_page(struct phy_device
*phydev
, int page
)
204 return phy_write(phydev
, MII_MARVELL_PHY_PAGE
, page
);
207 static int marvell_ack_interrupt(struct phy_device
*phydev
)
211 /* Clear the interrupts by reading the reg */
212 err
= phy_read(phydev
, MII_M1011_IEVENT
);
220 static int marvell_config_intr(struct phy_device
*phydev
)
224 if (phydev
->interrupts
== PHY_INTERRUPT_ENABLED
)
225 err
= phy_write(phydev
, MII_M1011_IMASK
,
226 MII_M1011_IMASK_INIT
);
228 err
= phy_write(phydev
, MII_M1011_IMASK
,
229 MII_M1011_IMASK_CLEAR
);
234 static int marvell_set_polarity(struct phy_device
*phydev
, int polarity
)
240 /* get the current settings */
241 reg
= phy_read(phydev
, MII_M1011_PHY_SCR
);
246 val
&= ~MII_M1011_PHY_SCR_AUTO_CROSS
;
249 val
|= MII_M1011_PHY_SCR_MDI
;
252 val
|= MII_M1011_PHY_SCR_MDI_X
;
254 case ETH_TP_MDI_AUTO
:
255 case ETH_TP_MDI_INVALID
:
257 val
|= MII_M1011_PHY_SCR_AUTO_CROSS
;
262 /* Set the new polarity value in the register */
263 err
= phy_write(phydev
, MII_M1011_PHY_SCR
, val
);
271 static int marvell_set_downshift(struct phy_device
*phydev
, bool enable
,
276 reg
= phy_read(phydev
, MII_M1011_PHY_SCR
);
280 reg
&= MII_M1011_PHY_SRC_DOWNSHIFT_MASK
;
281 reg
|= ((retries
- 1) << MII_M1011_PHY_SCR_DOWNSHIFT_SHIFT
);
283 reg
|= MII_M1011_PHY_SCR_DOWNSHIFT_EN
;
285 return phy_write(phydev
, MII_M1011_PHY_SCR
, reg
);
288 static int marvell_config_aneg(struct phy_device
*phydev
)
292 err
= marvell_set_polarity(phydev
, phydev
->mdix_ctrl
);
296 err
= phy_write(phydev
, MII_M1111_PHY_LED_CONTROL
,
297 MII_M1111_PHY_LED_DIRECT
);
301 err
= genphy_config_aneg(phydev
);
305 if (phydev
->autoneg
!= AUTONEG_ENABLE
) {
306 /* A write to speed/duplex bits (that is performed by
307 * genphy_config_aneg() call above) must be followed by
308 * a software reset. Otherwise, the write has no effect.
310 err
= genphy_soft_reset(phydev
);
318 static int m88e1101_config_aneg(struct phy_device
*phydev
)
322 /* This Marvell PHY has an errata which requires
323 * that certain registers get written in order
324 * to restart autonegotiation
326 err
= genphy_soft_reset(phydev
);
330 err
= phy_write(phydev
, 0x1d, 0x1f);
334 err
= phy_write(phydev
, 0x1e, 0x200c);
338 err
= phy_write(phydev
, 0x1d, 0x5);
342 err
= phy_write(phydev
, 0x1e, 0);
346 err
= phy_write(phydev
, 0x1e, 0x100);
350 return marvell_config_aneg(phydev
);
353 static int m88e1111_config_aneg(struct phy_device
*phydev
)
357 /* The Marvell PHY has an errata which requires
358 * that certain registers get written in order
359 * to restart autonegotiation
361 err
= genphy_soft_reset(phydev
);
363 err
= marvell_set_polarity(phydev
, phydev
->mdix_ctrl
);
367 err
= phy_write(phydev
, MII_M1111_PHY_LED_CONTROL
,
368 MII_M1111_PHY_LED_DIRECT
);
372 err
= genphy_config_aneg(phydev
);
376 if (phydev
->autoneg
!= AUTONEG_ENABLE
) {
377 /* A write to speed/duplex bits (that is performed by
378 * genphy_config_aneg() call above) must be followed by
379 * a software reset. Otherwise, the write has no effect.
381 err
= genphy_soft_reset(phydev
);
389 #ifdef CONFIG_OF_MDIO
390 /* Set and/or override some configuration registers based on the
391 * marvell,reg-init property stored in the of_node for the phydev.
393 * marvell,reg-init = <reg-page reg mask value>,...;
395 * There may be one or more sets of <reg-page reg mask value>:
397 * reg-page: which register bank to use.
399 * mask: if non-zero, ANDed with existing register value.
400 * value: ORed with the masked value and written to the regiser.
403 static int marvell_of_reg_init(struct phy_device
*phydev
)
406 int len
, i
, saved_page
, current_page
, ret
= 0;
408 if (!phydev
->mdio
.dev
.of_node
)
411 paddr
= of_get_property(phydev
->mdio
.dev
.of_node
,
412 "marvell,reg-init", &len
);
413 if (!paddr
|| len
< (4 * sizeof(*paddr
)))
416 saved_page
= phy_save_page(phydev
);
419 current_page
= saved_page
;
421 len
/= sizeof(*paddr
);
422 for (i
= 0; i
< len
- 3; i
+= 4) {
423 u16 page
= be32_to_cpup(paddr
+ i
);
424 u16 reg
= be32_to_cpup(paddr
+ i
+ 1);
425 u16 mask
= be32_to_cpup(paddr
+ i
+ 2);
426 u16 val_bits
= be32_to_cpup(paddr
+ i
+ 3);
429 if (page
!= current_page
) {
431 ret
= marvell_write_page(phydev
, page
);
438 val
= __phy_read(phydev
, reg
);
447 ret
= __phy_write(phydev
, reg
, val
);
452 return phy_restore_page(phydev
, saved_page
, ret
);
455 static int marvell_of_reg_init(struct phy_device
*phydev
)
459 #endif /* CONFIG_OF_MDIO */
461 static int m88e1121_config_aneg_rgmii_delays(struct phy_device
*phydev
)
465 if (phydev
->interface
== PHY_INTERFACE_MODE_RGMII_ID
)
466 mscr
= MII_88E1121_PHY_MSCR_RX_DELAY
|
467 MII_88E1121_PHY_MSCR_TX_DELAY
;
468 else if (phydev
->interface
== PHY_INTERFACE_MODE_RGMII_RXID
)
469 mscr
= MII_88E1121_PHY_MSCR_RX_DELAY
;
470 else if (phydev
->interface
== PHY_INTERFACE_MODE_RGMII_TXID
)
471 mscr
= MII_88E1121_PHY_MSCR_TX_DELAY
;
475 return phy_modify_paged(phydev
, MII_MARVELL_MSCR_PAGE
,
476 MII_88E1121_PHY_MSCR_REG
,
477 MII_88E1121_PHY_MSCR_DELAY_MASK
, mscr
);
480 static int m88e1121_config_aneg(struct phy_device
*phydev
)
484 if (phy_interface_is_rgmii(phydev
)) {
485 err
= m88e1121_config_aneg_rgmii_delays(phydev
);
490 err
= genphy_soft_reset(phydev
);
494 err
= marvell_set_polarity(phydev
, phydev
->mdix_ctrl
);
498 return genphy_config_aneg(phydev
);
501 static int m88e1318_config_aneg(struct phy_device
*phydev
)
505 err
= phy_modify_paged(phydev
, MII_MARVELL_MSCR_PAGE
,
506 MII_88E1318S_PHY_MSCR1_REG
,
507 0, MII_88E1318S_PHY_MSCR1_PAD_ODD
);
511 return m88e1121_config_aneg(phydev
);
515 * ethtool_adv_to_fiber_adv_t
516 * @ethadv: the ethtool advertisement settings
518 * A small helper function that translates ethtool advertisement
519 * settings to phy autonegotiation advertisements for the
520 * MII_ADV register for fiber link.
522 static inline u32
ethtool_adv_to_fiber_adv_t(u32 ethadv
)
526 if (ethadv
& ADVERTISED_1000baseT_Half
)
527 result
|= ADVERTISE_FIBER_1000HALF
;
528 if (ethadv
& ADVERTISED_1000baseT_Full
)
529 result
|= ADVERTISE_FIBER_1000FULL
;
531 if ((ethadv
& ADVERTISE_PAUSE_ASYM
) && (ethadv
& ADVERTISE_PAUSE_CAP
))
532 result
|= LPA_PAUSE_ASYM_FIBER
;
533 else if (ethadv
& ADVERTISE_PAUSE_CAP
)
534 result
|= (ADVERTISE_PAUSE_FIBER
535 & (~ADVERTISE_PAUSE_ASYM_FIBER
));
541 * marvell_config_aneg_fiber - restart auto-negotiation or write BMCR
542 * @phydev: target phy_device struct
544 * Description: If auto-negotiation is enabled, we configure the
545 * advertising, and then restart auto-negotiation. If it is not
546 * enabled, then we write the BMCR. Adapted for fiber link in
547 * some Marvell's devices.
549 static int marvell_config_aneg_fiber(struct phy_device
*phydev
)
556 if (phydev
->autoneg
!= AUTONEG_ENABLE
)
557 return genphy_setup_forced(phydev
);
559 /* Only allow advertising what this PHY supports */
560 phydev
->advertising
&= phydev
->supported
;
561 advertise
= phydev
->advertising
;
563 /* Setup fiber advertisement */
564 adv
= phy_read(phydev
, MII_ADVERTISE
);
569 adv
&= ~(ADVERTISE_FIBER_1000HALF
| ADVERTISE_FIBER_1000FULL
571 adv
|= ethtool_adv_to_fiber_adv_t(advertise
);
574 err
= phy_write(phydev
, MII_ADVERTISE
, adv
);
582 /* Advertisement hasn't changed, but maybe aneg was never on to
583 * begin with? Or maybe phy was isolated?
585 int ctl
= phy_read(phydev
, MII_BMCR
);
590 if (!(ctl
& BMCR_ANENABLE
) || (ctl
& BMCR_ISOLATE
))
591 changed
= 1; /* do restart aneg */
594 /* Only restart aneg if we are advertising something different
595 * than we were before.
598 changed
= genphy_restart_aneg(phydev
);
603 static int m88e1510_config_aneg(struct phy_device
*phydev
)
607 err
= marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
611 /* Configure the copper link first */
612 err
= m88e1318_config_aneg(phydev
);
616 /* Do not touch the fiber page if we're in copper->sgmii mode */
617 if (phydev
->interface
== PHY_INTERFACE_MODE_SGMII
)
620 /* Then the fiber link */
621 err
= marvell_set_page(phydev
, MII_MARVELL_FIBER_PAGE
);
625 err
= marvell_config_aneg_fiber(phydev
);
629 return marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
632 marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
636 static void marvell_config_led(struct phy_device
*phydev
)
641 switch (MARVELL_PHY_FAMILY_ID(phydev
->phy_id
)) {
642 /* Default PHY LED config: LED[0] .. Link, LED[1] .. Activity */
643 case MARVELL_PHY_FAMILY_ID(MARVELL_PHY_ID_88E1121R
):
644 case MARVELL_PHY_FAMILY_ID(MARVELL_PHY_ID_88E1318S
):
645 def_config
= MII_88E1121_PHY_LED_DEF
;
647 /* Default PHY LED config:
648 * LED[0] .. 1000Mbps Link
649 * LED[1] .. 100Mbps Link
650 * LED[2] .. Blink, Activity
652 case MARVELL_PHY_FAMILY_ID(MARVELL_PHY_ID_88E1510
):
653 def_config
= MII_88E1510_PHY_LED_DEF
;
659 err
= phy_write_paged(phydev
, MII_MARVELL_LED_PAGE
, MII_PHY_LED_CTRL
,
662 pr_warn("Fail to config marvell phy LED.\n");
665 static int marvell_config_init(struct phy_device
*phydev
)
667 /* Set defalut LED */
668 marvell_config_led(phydev
);
670 /* Set registers from marvell,reg-init DT property */
671 return marvell_of_reg_init(phydev
);
674 static int m88e1116r_config_init(struct phy_device
*phydev
)
678 err
= genphy_soft_reset(phydev
);
684 err
= marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
688 err
= marvell_set_polarity(phydev
, phydev
->mdix_ctrl
);
692 err
= marvell_set_downshift(phydev
, true, 8);
696 if (phy_interface_is_rgmii(phydev
)) {
697 err
= m88e1121_config_aneg_rgmii_delays(phydev
);
702 err
= genphy_soft_reset(phydev
);
706 return marvell_config_init(phydev
);
709 static int m88e3016_config_init(struct phy_device
*phydev
)
713 /* Enable Scrambler and Auto-Crossover */
714 ret
= phy_modify(phydev
, MII_88E3016_PHY_SPEC_CTRL
,
715 MII_88E3016_DISABLE_SCRAMBLER
,
716 MII_88E3016_AUTO_MDIX_CROSSOVER
);
720 return marvell_config_init(phydev
);
723 static int m88e1111_config_init_hwcfg_mode(struct phy_device
*phydev
,
725 int fibre_copper_auto
)
727 if (fibre_copper_auto
)
728 mode
|= MII_M1111_HWCFG_FIBER_COPPER_AUTO
;
730 return phy_modify(phydev
, MII_M1111_PHY_EXT_SR
,
731 MII_M1111_HWCFG_MODE_MASK
|
732 MII_M1111_HWCFG_FIBER_COPPER_AUTO
|
733 MII_M1111_HWCFG_FIBER_COPPER_RES
,
737 static int m88e1111_config_init_rgmii_delays(struct phy_device
*phydev
)
741 if (phydev
->interface
== PHY_INTERFACE_MODE_RGMII_ID
) {
742 delay
= MII_M1111_RGMII_RX_DELAY
| MII_M1111_RGMII_TX_DELAY
;
743 } else if (phydev
->interface
== PHY_INTERFACE_MODE_RGMII_RXID
) {
744 delay
= MII_M1111_RGMII_RX_DELAY
;
745 } else if (phydev
->interface
== PHY_INTERFACE_MODE_RGMII_TXID
) {
746 delay
= MII_M1111_RGMII_TX_DELAY
;
751 return phy_modify(phydev
, MII_M1111_PHY_EXT_CR
,
752 MII_M1111_RGMII_RX_DELAY
| MII_M1111_RGMII_TX_DELAY
,
756 static int m88e1111_config_init_rgmii(struct phy_device
*phydev
)
761 err
= m88e1111_config_init_rgmii_delays(phydev
);
765 temp
= phy_read(phydev
, MII_M1111_PHY_EXT_SR
);
769 temp
&= ~(MII_M1111_HWCFG_MODE_MASK
);
771 if (temp
& MII_M1111_HWCFG_FIBER_COPPER_RES
)
772 temp
|= MII_M1111_HWCFG_MODE_FIBER_RGMII
;
774 temp
|= MII_M1111_HWCFG_MODE_COPPER_RGMII
;
776 return phy_write(phydev
, MII_M1111_PHY_EXT_SR
, temp
);
779 static int m88e1111_config_init_sgmii(struct phy_device
*phydev
)
783 err
= m88e1111_config_init_hwcfg_mode(
785 MII_M1111_HWCFG_MODE_SGMII_NO_CLK
,
786 MII_M1111_HWCFG_FIBER_COPPER_AUTO
);
790 /* make sure copper is selected */
791 return marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
794 static int m88e1111_config_init_rtbi(struct phy_device
*phydev
)
798 err
= m88e1111_config_init_rgmii_delays(phydev
);
802 err
= m88e1111_config_init_hwcfg_mode(
804 MII_M1111_HWCFG_MODE_RTBI
,
805 MII_M1111_HWCFG_FIBER_COPPER_AUTO
);
810 err
= genphy_soft_reset(phydev
);
814 return m88e1111_config_init_hwcfg_mode(
816 MII_M1111_HWCFG_MODE_RTBI
,
817 MII_M1111_HWCFG_FIBER_COPPER_AUTO
);
820 static int m88e1111_config_init(struct phy_device
*phydev
)
824 if (phy_interface_is_rgmii(phydev
)) {
825 err
= m88e1111_config_init_rgmii(phydev
);
830 if (phydev
->interface
== PHY_INTERFACE_MODE_SGMII
) {
831 err
= m88e1111_config_init_sgmii(phydev
);
836 if (phydev
->interface
== PHY_INTERFACE_MODE_RTBI
) {
837 err
= m88e1111_config_init_rtbi(phydev
);
842 err
= marvell_of_reg_init(phydev
);
846 return genphy_soft_reset(phydev
);
849 static int m88e1318_config_init(struct phy_device
*phydev
)
851 if (phy_interrupt_is_valid(phydev
)) {
852 int err
= phy_modify_paged(
853 phydev
, MII_MARVELL_LED_PAGE
,
854 MII_88E1318S_PHY_LED_TCR
,
855 MII_88E1318S_PHY_LED_TCR_FORCE_INT
,
856 MII_88E1318S_PHY_LED_TCR_INTn_ENABLE
|
857 MII_88E1318S_PHY_LED_TCR_INT_ACTIVE_LOW
);
862 return marvell_config_init(phydev
);
865 static int m88e1510_config_init(struct phy_device
*phydev
)
869 /* SGMII-to-Copper mode initialization */
870 if (phydev
->interface
== PHY_INTERFACE_MODE_SGMII
) {
874 err
= marvell_set_page(phydev
, 18);
878 /* In reg 20, write MODE[2:0] = 0x1 (SGMII to Copper) */
879 err
= phy_modify(phydev
, MII_88E1510_GEN_CTRL_REG_1
,
880 MII_88E1510_GEN_CTRL_REG_1_MODE_MASK
,
881 MII_88E1510_GEN_CTRL_REG_1_MODE_SGMII
);
885 /* PHY reset is necessary after changing MODE[2:0] */
886 err
= phy_modify(phydev
, MII_88E1510_GEN_CTRL_REG_1
, 0,
887 MII_88E1510_GEN_CTRL_REG_1_RESET
);
891 /* Reset page selection */
892 err
= marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
896 /* There appears to be a bug in the 88e1512 when used in
897 * SGMII to copper mode, where the AN advertisement register
898 * clears the pause bits each time a negotiation occurs.
899 * This means we can never be truely sure what was advertised,
900 * so disable Pause support.
902 pause
= SUPPORTED_Pause
| SUPPORTED_Asym_Pause
;
903 phydev
->supported
&= ~pause
;
904 phydev
->advertising
&= ~pause
;
907 return m88e1318_config_init(phydev
);
910 static int m88e1118_config_aneg(struct phy_device
*phydev
)
914 err
= genphy_soft_reset(phydev
);
918 err
= marvell_set_polarity(phydev
, phydev
->mdix_ctrl
);
922 err
= genphy_config_aneg(phydev
);
926 static int m88e1118_config_init(struct phy_device
*phydev
)
931 err
= marvell_set_page(phydev
, MII_MARVELL_MSCR_PAGE
);
935 /* Enable 1000 Mbit */
936 err
= phy_write(phydev
, 0x15, 0x1070);
941 err
= marvell_set_page(phydev
, MII_MARVELL_LED_PAGE
);
945 /* Adjust LED Control */
946 if (phydev
->dev_flags
& MARVELL_PHY_M1118_DNS323_LEDS
)
947 err
= phy_write(phydev
, 0x10, 0x1100);
949 err
= phy_write(phydev
, 0x10, 0x021e);
953 err
= marvell_of_reg_init(phydev
);
958 err
= marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
962 return genphy_soft_reset(phydev
);
965 static int m88e1149_config_init(struct phy_device
*phydev
)
970 err
= marvell_set_page(phydev
, MII_MARVELL_MSCR_PAGE
);
974 /* Enable 1000 Mbit */
975 err
= phy_write(phydev
, 0x15, 0x1048);
979 err
= marvell_of_reg_init(phydev
);
984 err
= marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
988 return genphy_soft_reset(phydev
);
991 static int m88e1145_config_init_rgmii(struct phy_device
*phydev
)
995 err
= m88e1111_config_init_rgmii_delays(phydev
);
999 if (phydev
->dev_flags
& MARVELL_PHY_M1145_FLAGS_RESISTANCE
) {
1000 err
= phy_write(phydev
, 0x1d, 0x0012);
1004 err
= phy_modify(phydev
, 0x1e, 0x0fc0,
1005 2 << 9 | /* 36 ohm */
1006 2 << 6); /* 39 ohm */
1010 err
= phy_write(phydev
, 0x1d, 0x3);
1014 err
= phy_write(phydev
, 0x1e, 0x8000);
1019 static int m88e1145_config_init_sgmii(struct phy_device
*phydev
)
1021 return m88e1111_config_init_hwcfg_mode(
1022 phydev
, MII_M1111_HWCFG_MODE_SGMII_NO_CLK
,
1023 MII_M1111_HWCFG_FIBER_COPPER_AUTO
);
1026 static int m88e1145_config_init(struct phy_device
*phydev
)
1030 /* Take care of errata E0 & E1 */
1031 err
= phy_write(phydev
, 0x1d, 0x001b);
1035 err
= phy_write(phydev
, 0x1e, 0x418f);
1039 err
= phy_write(phydev
, 0x1d, 0x0016);
1043 err
= phy_write(phydev
, 0x1e, 0xa2da);
1047 if (phydev
->interface
== PHY_INTERFACE_MODE_RGMII_ID
) {
1048 err
= m88e1145_config_init_rgmii(phydev
);
1053 if (phydev
->interface
== PHY_INTERFACE_MODE_SGMII
) {
1054 err
= m88e1145_config_init_sgmii(phydev
);
1059 err
= marvell_of_reg_init(phydev
);
1067 * fiber_lpa_to_ethtool_lpa_t
1068 * @lpa: value of the MII_LPA register for fiber link
1070 * A small helper function that translates MII_LPA
1071 * bits to ethtool LP advertisement settings.
1073 static u32
fiber_lpa_to_ethtool_lpa_t(u32 lpa
)
1077 if (lpa
& LPA_FIBER_1000HALF
)
1078 result
|= ADVERTISED_1000baseT_Half
;
1079 if (lpa
& LPA_FIBER_1000FULL
)
1080 result
|= ADVERTISED_1000baseT_Full
;
1086 * marvell_update_link - update link status in real time in @phydev
1087 * @phydev: target phy_device struct
1089 * Description: Update the value in phydev->link to reflect the
1090 * current link value.
1092 static int marvell_update_link(struct phy_device
*phydev
, int fiber
)
1096 /* Use the generic register for copper link, or specific
1097 * register for fiber case
1100 status
= phy_read(phydev
, MII_M1011_PHY_STATUS
);
1104 if ((status
& REGISTER_LINK_STATUS
) == 0)
1109 return genphy_update_link(phydev
);
1115 static int marvell_read_status_page_an(struct phy_device
*phydev
,
1122 status
= phy_read(phydev
, MII_M1011_PHY_STATUS
);
1126 lpa
= phy_read(phydev
, MII_LPA
);
1130 lpagb
= phy_read(phydev
, MII_STAT1000
);
1134 if (status
& MII_M1011_PHY_STATUS_FULLDUPLEX
)
1135 phydev
->duplex
= DUPLEX_FULL
;
1137 phydev
->duplex
= DUPLEX_HALF
;
1139 status
= status
& MII_M1011_PHY_STATUS_SPD_MASK
;
1141 phydev
->asym_pause
= 0;
1144 case MII_M1011_PHY_STATUS_1000
:
1145 phydev
->speed
= SPEED_1000
;
1148 case MII_M1011_PHY_STATUS_100
:
1149 phydev
->speed
= SPEED_100
;
1153 phydev
->speed
= SPEED_10
;
1158 phydev
->lp_advertising
=
1159 mii_stat1000_to_ethtool_lpa_t(lpagb
) |
1160 mii_lpa_to_ethtool_lpa_t(lpa
);
1162 if (phydev
->duplex
== DUPLEX_FULL
) {
1163 phydev
->pause
= lpa
& LPA_PAUSE_CAP
? 1 : 0;
1164 phydev
->asym_pause
= lpa
& LPA_PAUSE_ASYM
? 1 : 0;
1167 /* The fiber link is only 1000M capable */
1168 phydev
->lp_advertising
= fiber_lpa_to_ethtool_lpa_t(lpa
);
1170 if (phydev
->duplex
== DUPLEX_FULL
) {
1171 if (!(lpa
& LPA_PAUSE_FIBER
)) {
1173 phydev
->asym_pause
= 0;
1174 } else if ((lpa
& LPA_PAUSE_ASYM_FIBER
)) {
1176 phydev
->asym_pause
= 1;
1179 phydev
->asym_pause
= 0;
1186 static int marvell_read_status_page_fixed(struct phy_device
*phydev
)
1188 int bmcr
= phy_read(phydev
, MII_BMCR
);
1193 if (bmcr
& BMCR_FULLDPLX
)
1194 phydev
->duplex
= DUPLEX_FULL
;
1196 phydev
->duplex
= DUPLEX_HALF
;
1198 if (bmcr
& BMCR_SPEED1000
)
1199 phydev
->speed
= SPEED_1000
;
1200 else if (bmcr
& BMCR_SPEED100
)
1201 phydev
->speed
= SPEED_100
;
1203 phydev
->speed
= SPEED_10
;
1206 phydev
->asym_pause
= 0;
1207 phydev
->lp_advertising
= 0;
1212 /* marvell_read_status_page
1215 * Check the link, then figure out the current state
1216 * by comparing what we advertise with what the link partner
1217 * advertises. Start by checking the gigabit possibilities,
1218 * then move on to 10/100.
1220 static int marvell_read_status_page(struct phy_device
*phydev
, int page
)
1225 /* Detect and update the link, but return if there
1228 if (page
== MII_MARVELL_FIBER_PAGE
)
1233 err
= marvell_update_link(phydev
, fiber
);
1237 if (phydev
->autoneg
== AUTONEG_ENABLE
)
1238 err
= marvell_read_status_page_an(phydev
, fiber
);
1240 err
= marvell_read_status_page_fixed(phydev
);
1245 /* marvell_read_status
1247 * Some Marvell's phys have two modes: fiber and copper.
1248 * Both need status checked.
1250 * First, check the fiber link and status.
1251 * If the fiber link is down, check the copper link and status which
1252 * will be the default value if both link are down.
1254 static int marvell_read_status(struct phy_device
*phydev
)
1258 /* Check the fiber mode first */
1259 if (phydev
->supported
& SUPPORTED_FIBRE
&&
1260 phydev
->interface
!= PHY_INTERFACE_MODE_SGMII
) {
1261 err
= marvell_set_page(phydev
, MII_MARVELL_FIBER_PAGE
);
1265 err
= marvell_read_status_page(phydev
, MII_MARVELL_FIBER_PAGE
);
1269 /* If the fiber link is up, it is the selected and
1270 * used link. In this case, we need to stay in the
1271 * fiber page. Please to be careful about that, avoid
1272 * to restore Copper page in other functions which
1273 * could break the behaviour for some fiber phy like
1279 /* If fiber link is down, check and save copper mode state */
1280 err
= marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
1285 return marvell_read_status_page(phydev
, MII_MARVELL_COPPER_PAGE
);
1288 marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
1294 * Some Marvell's phys have two modes: fiber and copper.
1295 * Both need to be suspended
1297 static int marvell_suspend(struct phy_device
*phydev
)
1301 /* Suspend the fiber mode first */
1302 if (!(phydev
->supported
& SUPPORTED_FIBRE
)) {
1303 err
= marvell_set_page(phydev
, MII_MARVELL_FIBER_PAGE
);
1307 /* With the page set, use the generic suspend */
1308 err
= genphy_suspend(phydev
);
1312 /* Then, the copper link */
1313 err
= marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
1318 /* With the page set, use the generic suspend */
1319 return genphy_suspend(phydev
);
1322 marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
1328 * Some Marvell's phys have two modes: fiber and copper.
1329 * Both need to be resumed
1331 static int marvell_resume(struct phy_device
*phydev
)
1335 /* Resume the fiber mode first */
1336 if (!(phydev
->supported
& SUPPORTED_FIBRE
)) {
1337 err
= marvell_set_page(phydev
, MII_MARVELL_FIBER_PAGE
);
1341 /* With the page set, use the generic resume */
1342 err
= genphy_resume(phydev
);
1346 /* Then, the copper link */
1347 err
= marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
1352 /* With the page set, use the generic resume */
1353 return genphy_resume(phydev
);
1356 marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
1360 static int marvell_aneg_done(struct phy_device
*phydev
)
1362 int retval
= phy_read(phydev
, MII_M1011_PHY_STATUS
);
1364 return (retval
< 0) ? retval
: (retval
& MII_M1011_PHY_STATUS_RESOLVED
);
1367 static int m88e1121_did_interrupt(struct phy_device
*phydev
)
1371 imask
= phy_read(phydev
, MII_M1011_IEVENT
);
1373 if (imask
& MII_M1011_IMASK_INIT
)
1379 static void m88e1318_get_wol(struct phy_device
*phydev
,
1380 struct ethtool_wolinfo
*wol
)
1382 int oldpage
, ret
= 0;
1384 wol
->supported
= WAKE_MAGIC
;
1387 oldpage
= phy_select_page(phydev
, MII_MARVELL_WOL_PAGE
);
1391 ret
= __phy_read(phydev
, MII_88E1318S_PHY_WOL_CTRL
);
1392 if (ret
& MII_88E1318S_PHY_WOL_CTRL_MAGIC_PACKET_MATCH_ENABLE
)
1393 wol
->wolopts
|= WAKE_MAGIC
;
1396 phy_restore_page(phydev
, oldpage
, ret
);
1399 static int m88e1318_set_wol(struct phy_device
*phydev
,
1400 struct ethtool_wolinfo
*wol
)
1402 int err
= 0, oldpage
;
1404 oldpage
= phy_save_page(phydev
);
1408 if (wol
->wolopts
& WAKE_MAGIC
) {
1409 /* Explicitly switch to page 0x00, just to be sure */
1410 err
= marvell_write_page(phydev
, MII_MARVELL_COPPER_PAGE
);
1414 /* If WOL event happened once, the LED[2] interrupt pin
1415 * will not be cleared unless we reading the interrupt status
1416 * register. If interrupts are in use, the normal interrupt
1417 * handling will clear the WOL event. Clear the WOL event
1418 * before enabling it if !phy_interrupt_is_valid()
1420 if (!phy_interrupt_is_valid(phydev
))
1421 phy_read(phydev
, MII_M1011_IEVENT
);
1423 /* Enable the WOL interrupt */
1424 err
= __phy_modify(phydev
, MII_88E1318S_PHY_CSIER
, 0,
1425 MII_88E1318S_PHY_CSIER_WOL_EIE
);
1429 err
= marvell_write_page(phydev
, MII_MARVELL_LED_PAGE
);
1433 /* Setup LED[2] as interrupt pin (active low) */
1434 err
= __phy_modify(phydev
, MII_88E1318S_PHY_LED_TCR
,
1435 MII_88E1318S_PHY_LED_TCR_FORCE_INT
,
1436 MII_88E1318S_PHY_LED_TCR_INTn_ENABLE
|
1437 MII_88E1318S_PHY_LED_TCR_INT_ACTIVE_LOW
);
1441 err
= marvell_write_page(phydev
, MII_MARVELL_WOL_PAGE
);
1445 /* Store the device address for the magic packet */
1446 err
= __phy_write(phydev
, MII_88E1318S_PHY_MAGIC_PACKET_WORD2
,
1447 ((phydev
->attached_dev
->dev_addr
[5] << 8) |
1448 phydev
->attached_dev
->dev_addr
[4]));
1451 err
= __phy_write(phydev
, MII_88E1318S_PHY_MAGIC_PACKET_WORD1
,
1452 ((phydev
->attached_dev
->dev_addr
[3] << 8) |
1453 phydev
->attached_dev
->dev_addr
[2]));
1456 err
= __phy_write(phydev
, MII_88E1318S_PHY_MAGIC_PACKET_WORD0
,
1457 ((phydev
->attached_dev
->dev_addr
[1] << 8) |
1458 phydev
->attached_dev
->dev_addr
[0]));
1462 /* Clear WOL status and enable magic packet matching */
1463 err
= __phy_modify(phydev
, MII_88E1318S_PHY_WOL_CTRL
, 0,
1464 MII_88E1318S_PHY_WOL_CTRL_CLEAR_WOL_STATUS
|
1465 MII_88E1318S_PHY_WOL_CTRL_MAGIC_PACKET_MATCH_ENABLE
);
1469 err
= marvell_write_page(phydev
, MII_MARVELL_WOL_PAGE
);
1473 /* Clear WOL status and disable magic packet matching */
1474 err
= __phy_modify(phydev
, MII_88E1318S_PHY_WOL_CTRL
,
1475 MII_88E1318S_PHY_WOL_CTRL_MAGIC_PACKET_MATCH_ENABLE
,
1476 MII_88E1318S_PHY_WOL_CTRL_CLEAR_WOL_STATUS
);
1482 return phy_restore_page(phydev
, oldpage
, err
);
1485 static int marvell_get_sset_count(struct phy_device
*phydev
)
1487 if (phydev
->supported
& SUPPORTED_FIBRE
)
1488 return ARRAY_SIZE(marvell_hw_stats
);
1490 return ARRAY_SIZE(marvell_hw_stats
) - NB_FIBER_STATS
;
1493 static void marvell_get_strings(struct phy_device
*phydev
, u8
*data
)
1497 for (i
= 0; i
< ARRAY_SIZE(marvell_hw_stats
); i
++) {
1498 strlcpy(data
+ i
* ETH_GSTRING_LEN
,
1499 marvell_hw_stats
[i
].string
, ETH_GSTRING_LEN
);
1503 static u64
marvell_get_stat(struct phy_device
*phydev
, int i
)
1505 struct marvell_hw_stat stat
= marvell_hw_stats
[i
];
1506 struct marvell_priv
*priv
= phydev
->priv
;
1510 val
= phy_read_paged(phydev
, stat
.page
, stat
.reg
);
1514 val
= val
& ((1 << stat
.bits
) - 1);
1515 priv
->stats
[i
] += val
;
1516 ret
= priv
->stats
[i
];
1522 static void marvell_get_stats(struct phy_device
*phydev
,
1523 struct ethtool_stats
*stats
, u64
*data
)
1527 for (i
= 0; i
< ARRAY_SIZE(marvell_hw_stats
); i
++)
1528 data
[i
] = marvell_get_stat(phydev
, i
);
1532 static int m88e1121_get_temp(struct phy_device
*phydev
, long *temp
)
1540 oldpage
= phy_select_page(phydev
, MII_MARVELL_MISC_TEST_PAGE
);
1544 /* Enable temperature sensor */
1545 ret
= __phy_read(phydev
, MII_88E1121_MISC_TEST
);
1549 ret
= __phy_write(phydev
, MII_88E1121_MISC_TEST
,
1550 ret
| MII_88E1121_MISC_TEST_TEMP_SENSOR_EN
);
1554 /* Wait for temperature to stabilize */
1555 usleep_range(10000, 12000);
1557 val
= __phy_read(phydev
, MII_88E1121_MISC_TEST
);
1563 /* Disable temperature sensor */
1564 ret
= __phy_write(phydev
, MII_88E1121_MISC_TEST
,
1565 ret
& ~MII_88E1121_MISC_TEST_TEMP_SENSOR_EN
);
1569 *temp
= ((val
& MII_88E1121_MISC_TEST_TEMP_MASK
) - 5) * 5000;
1572 return phy_restore_page(phydev
, oldpage
, ret
);
1575 static int m88e1121_hwmon_read(struct device
*dev
,
1576 enum hwmon_sensor_types type
,
1577 u32 attr
, int channel
, long *temp
)
1579 struct phy_device
*phydev
= dev_get_drvdata(dev
);
1583 case hwmon_temp_input
:
1584 err
= m88e1121_get_temp(phydev
, temp
);
1593 static umode_t
m88e1121_hwmon_is_visible(const void *data
,
1594 enum hwmon_sensor_types type
,
1595 u32 attr
, int channel
)
1597 if (type
!= hwmon_temp
)
1601 case hwmon_temp_input
:
1608 static u32 m88e1121_hwmon_chip_config
[] = {
1609 HWMON_C_REGISTER_TZ
,
1613 static const struct hwmon_channel_info m88e1121_hwmon_chip
= {
1615 .config
= m88e1121_hwmon_chip_config
,
1618 static u32 m88e1121_hwmon_temp_config
[] = {
1623 static const struct hwmon_channel_info m88e1121_hwmon_temp
= {
1625 .config
= m88e1121_hwmon_temp_config
,
1628 static const struct hwmon_channel_info
*m88e1121_hwmon_info
[] = {
1629 &m88e1121_hwmon_chip
,
1630 &m88e1121_hwmon_temp
,
1634 static const struct hwmon_ops m88e1121_hwmon_hwmon_ops
= {
1635 .is_visible
= m88e1121_hwmon_is_visible
,
1636 .read
= m88e1121_hwmon_read
,
1639 static const struct hwmon_chip_info m88e1121_hwmon_chip_info
= {
1640 .ops
= &m88e1121_hwmon_hwmon_ops
,
1641 .info
= m88e1121_hwmon_info
,
1644 static int m88e1510_get_temp(struct phy_device
*phydev
, long *temp
)
1650 ret
= phy_read_paged(phydev
, MII_MARVELL_MISC_TEST_PAGE
,
1651 MII_88E1510_TEMP_SENSOR
);
1655 *temp
= ((ret
& MII_88E1510_TEMP_SENSOR_MASK
) - 25) * 1000;
1660 static int m88e1510_get_temp_critical(struct phy_device
*phydev
, long *temp
)
1666 ret
= phy_read_paged(phydev
, MII_MARVELL_MISC_TEST_PAGE
,
1667 MII_88E1121_MISC_TEST
);
1671 *temp
= (((ret
& MII_88E1510_MISC_TEST_TEMP_THRESHOLD_MASK
) >>
1672 MII_88E1510_MISC_TEST_TEMP_THRESHOLD_SHIFT
) * 5) - 25;
1679 static int m88e1510_set_temp_critical(struct phy_device
*phydev
, long temp
)
1682 temp
= clamp_val(DIV_ROUND_CLOSEST(temp
, 5) + 5, 0, 0x1f);
1684 return phy_modify_paged(phydev
, MII_MARVELL_MISC_TEST_PAGE
,
1685 MII_88E1121_MISC_TEST
,
1686 MII_88E1510_MISC_TEST_TEMP_THRESHOLD_MASK
,
1687 temp
<< MII_88E1510_MISC_TEST_TEMP_THRESHOLD_SHIFT
);
1690 static int m88e1510_get_temp_alarm(struct phy_device
*phydev
, long *alarm
)
1696 ret
= phy_read_paged(phydev
, MII_MARVELL_MISC_TEST_PAGE
,
1697 MII_88E1121_MISC_TEST
);
1701 *alarm
= !!(ret
& MII_88E1510_MISC_TEST_TEMP_IRQ
);
1706 static int m88e1510_hwmon_read(struct device
*dev
,
1707 enum hwmon_sensor_types type
,
1708 u32 attr
, int channel
, long *temp
)
1710 struct phy_device
*phydev
= dev_get_drvdata(dev
);
1714 case hwmon_temp_input
:
1715 err
= m88e1510_get_temp(phydev
, temp
);
1717 case hwmon_temp_crit
:
1718 err
= m88e1510_get_temp_critical(phydev
, temp
);
1720 case hwmon_temp_max_alarm
:
1721 err
= m88e1510_get_temp_alarm(phydev
, temp
);
1730 static int m88e1510_hwmon_write(struct device
*dev
,
1731 enum hwmon_sensor_types type
,
1732 u32 attr
, int channel
, long temp
)
1734 struct phy_device
*phydev
= dev_get_drvdata(dev
);
1738 case hwmon_temp_crit
:
1739 err
= m88e1510_set_temp_critical(phydev
, temp
);
1747 static umode_t
m88e1510_hwmon_is_visible(const void *data
,
1748 enum hwmon_sensor_types type
,
1749 u32 attr
, int channel
)
1751 if (type
!= hwmon_temp
)
1755 case hwmon_temp_input
:
1756 case hwmon_temp_max_alarm
:
1758 case hwmon_temp_crit
:
1765 static u32 m88e1510_hwmon_temp_config
[] = {
1766 HWMON_T_INPUT
| HWMON_T_CRIT
| HWMON_T_MAX_ALARM
,
1770 static const struct hwmon_channel_info m88e1510_hwmon_temp
= {
1772 .config
= m88e1510_hwmon_temp_config
,
1775 static const struct hwmon_channel_info
*m88e1510_hwmon_info
[] = {
1776 &m88e1121_hwmon_chip
,
1777 &m88e1510_hwmon_temp
,
1781 static const struct hwmon_ops m88e1510_hwmon_hwmon_ops
= {
1782 .is_visible
= m88e1510_hwmon_is_visible
,
1783 .read
= m88e1510_hwmon_read
,
1784 .write
= m88e1510_hwmon_write
,
1787 static const struct hwmon_chip_info m88e1510_hwmon_chip_info
= {
1788 .ops
= &m88e1510_hwmon_hwmon_ops
,
1789 .info
= m88e1510_hwmon_info
,
1792 static int m88e6390_get_temp(struct phy_device
*phydev
, long *temp
)
1801 oldpage
= phy_select_page(phydev
, MII_MARVELL_MISC_TEST_PAGE
);
1805 /* Enable temperature sensor */
1806 ret
= __phy_read(phydev
, MII_88E6390_MISC_TEST
);
1810 ret
= ret
& ~MII_88E6390_MISC_TEST_SAMPLE_MASK
;
1811 ret
|= MII_88E6390_MISC_TEST_SAMPLE_ENABLE
|
1812 MII_88E6390_MISC_TEST_SAMPLE_1S
;
1814 ret
= __phy_write(phydev
, MII_88E6390_MISC_TEST
, ret
);
1818 /* Wait for temperature to stabilize */
1819 usleep_range(10000, 12000);
1821 /* Reading the temperature sense has an errata. You need to read
1822 * a number of times and take an average.
1824 for (i
= 0; i
< MII_88E6390_TEMP_SENSOR_SAMPLES
; i
++) {
1825 ret
= __phy_read(phydev
, MII_88E6390_TEMP_SENSOR
);
1828 sum
+= ret
& MII_88E6390_TEMP_SENSOR_MASK
;
1831 sum
/= MII_88E6390_TEMP_SENSOR_SAMPLES
;
1832 *temp
= (sum
- 75) * 1000;
1834 /* Disable temperature sensor */
1835 ret
= __phy_read(phydev
, MII_88E6390_MISC_TEST
);
1839 ret
= ret
& ~MII_88E6390_MISC_TEST_SAMPLE_MASK
;
1840 ret
|= MII_88E6390_MISC_TEST_SAMPLE_DISABLE
;
1842 ret
= __phy_write(phydev
, MII_88E6390_MISC_TEST
, ret
);
1845 phy_restore_page(phydev
, oldpage
, ret
);
1850 static int m88e6390_hwmon_read(struct device
*dev
,
1851 enum hwmon_sensor_types type
,
1852 u32 attr
, int channel
, long *temp
)
1854 struct phy_device
*phydev
= dev_get_drvdata(dev
);
1858 case hwmon_temp_input
:
1859 err
= m88e6390_get_temp(phydev
, temp
);
1868 static umode_t
m88e6390_hwmon_is_visible(const void *data
,
1869 enum hwmon_sensor_types type
,
1870 u32 attr
, int channel
)
1872 if (type
!= hwmon_temp
)
1876 case hwmon_temp_input
:
1883 static u32 m88e6390_hwmon_temp_config
[] = {
1888 static const struct hwmon_channel_info m88e6390_hwmon_temp
= {
1890 .config
= m88e6390_hwmon_temp_config
,
1893 static const struct hwmon_channel_info
*m88e6390_hwmon_info
[] = {
1894 &m88e1121_hwmon_chip
,
1895 &m88e6390_hwmon_temp
,
1899 static const struct hwmon_ops m88e6390_hwmon_hwmon_ops
= {
1900 .is_visible
= m88e6390_hwmon_is_visible
,
1901 .read
= m88e6390_hwmon_read
,
1904 static const struct hwmon_chip_info m88e6390_hwmon_chip_info
= {
1905 .ops
= &m88e6390_hwmon_hwmon_ops
,
1906 .info
= m88e6390_hwmon_info
,
1909 static int marvell_hwmon_name(struct phy_device
*phydev
)
1911 struct marvell_priv
*priv
= phydev
->priv
;
1912 struct device
*dev
= &phydev
->mdio
.dev
;
1913 const char *devname
= dev_name(dev
);
1914 size_t len
= strlen(devname
);
1917 priv
->hwmon_name
= devm_kzalloc(dev
, len
, GFP_KERNEL
);
1918 if (!priv
->hwmon_name
)
1921 for (i
= j
= 0; i
< len
&& devname
[i
]; i
++) {
1922 if (isalnum(devname
[i
]))
1923 priv
->hwmon_name
[j
++] = devname
[i
];
1929 static int marvell_hwmon_probe(struct phy_device
*phydev
,
1930 const struct hwmon_chip_info
*chip
)
1932 struct marvell_priv
*priv
= phydev
->priv
;
1933 struct device
*dev
= &phydev
->mdio
.dev
;
1936 err
= marvell_hwmon_name(phydev
);
1940 priv
->hwmon_dev
= devm_hwmon_device_register_with_info(
1941 dev
, priv
->hwmon_name
, phydev
, chip
, NULL
);
1943 return PTR_ERR_OR_ZERO(priv
->hwmon_dev
);
1946 static int m88e1121_hwmon_probe(struct phy_device
*phydev
)
1948 return marvell_hwmon_probe(phydev
, &m88e1121_hwmon_chip_info
);
1951 static int m88e1510_hwmon_probe(struct phy_device
*phydev
)
1953 return marvell_hwmon_probe(phydev
, &m88e1510_hwmon_chip_info
);
1956 static int m88e6390_hwmon_probe(struct phy_device
*phydev
)
1958 return marvell_hwmon_probe(phydev
, &m88e6390_hwmon_chip_info
);
1961 static int m88e1121_hwmon_probe(struct phy_device
*phydev
)
1966 static int m88e1510_hwmon_probe(struct phy_device
*phydev
)
1971 static int m88e6390_hwmon_probe(struct phy_device
*phydev
)
1977 static int marvell_probe(struct phy_device
*phydev
)
1979 struct marvell_priv
*priv
;
1981 priv
= devm_kzalloc(&phydev
->mdio
.dev
, sizeof(*priv
), GFP_KERNEL
);
1985 phydev
->priv
= priv
;
1990 static int m88e1121_probe(struct phy_device
*phydev
)
1994 err
= marvell_probe(phydev
);
1998 return m88e1121_hwmon_probe(phydev
);
2001 static int m88e1510_probe(struct phy_device
*phydev
)
2005 err
= marvell_probe(phydev
);
2009 return m88e1510_hwmon_probe(phydev
);
2012 static int m88e6390_probe(struct phy_device
*phydev
)
2016 err
= marvell_probe(phydev
);
2020 return m88e6390_hwmon_probe(phydev
);
2023 static struct phy_driver marvell_drivers
[] = {
2025 .phy_id
= MARVELL_PHY_ID_88E1101
,
2026 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2027 .name
= "Marvell 88E1101",
2028 .features
= PHY_GBIT_FEATURES
,
2029 .flags
= PHY_HAS_INTERRUPT
,
2030 .probe
= marvell_probe
,
2031 .config_init
= &marvell_config_init
,
2032 .config_aneg
= &m88e1101_config_aneg
,
2033 .ack_interrupt
= &marvell_ack_interrupt
,
2034 .config_intr
= &marvell_config_intr
,
2035 .resume
= &genphy_resume
,
2036 .suspend
= &genphy_suspend
,
2037 .read_page
= marvell_read_page
,
2038 .write_page
= marvell_write_page
,
2039 .get_sset_count
= marvell_get_sset_count
,
2040 .get_strings
= marvell_get_strings
,
2041 .get_stats
= marvell_get_stats
,
2044 .phy_id
= MARVELL_PHY_ID_88E1112
,
2045 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2046 .name
= "Marvell 88E1112",
2047 .features
= PHY_GBIT_FEATURES
,
2048 .flags
= PHY_HAS_INTERRUPT
,
2049 .probe
= marvell_probe
,
2050 .config_init
= &m88e1111_config_init
,
2051 .config_aneg
= &marvell_config_aneg
,
2052 .ack_interrupt
= &marvell_ack_interrupt
,
2053 .config_intr
= &marvell_config_intr
,
2054 .resume
= &genphy_resume
,
2055 .suspend
= &genphy_suspend
,
2056 .read_page
= marvell_read_page
,
2057 .write_page
= marvell_write_page
,
2058 .get_sset_count
= marvell_get_sset_count
,
2059 .get_strings
= marvell_get_strings
,
2060 .get_stats
= marvell_get_stats
,
2063 .phy_id
= MARVELL_PHY_ID_88E1111
,
2064 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2065 .name
= "Marvell 88E1111",
2066 .features
= PHY_GBIT_FEATURES
,
2067 .flags
= PHY_HAS_INTERRUPT
,
2068 .probe
= marvell_probe
,
2069 .config_init
= &m88e1111_config_init
,
2070 .config_aneg
= &m88e1111_config_aneg
,
2071 .read_status
= &marvell_read_status
,
2072 .ack_interrupt
= &marvell_ack_interrupt
,
2073 .config_intr
= &marvell_config_intr
,
2074 .resume
= &genphy_resume
,
2075 .suspend
= &genphy_suspend
,
2076 .read_page
= marvell_read_page
,
2077 .write_page
= marvell_write_page
,
2078 .get_sset_count
= marvell_get_sset_count
,
2079 .get_strings
= marvell_get_strings
,
2080 .get_stats
= marvell_get_stats
,
2083 .phy_id
= MARVELL_PHY_ID_88E1118
,
2084 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2085 .name
= "Marvell 88E1118",
2086 .features
= PHY_GBIT_FEATURES
,
2087 .flags
= PHY_HAS_INTERRUPT
,
2088 .probe
= marvell_probe
,
2089 .config_init
= &m88e1118_config_init
,
2090 .config_aneg
= &m88e1118_config_aneg
,
2091 .ack_interrupt
= &marvell_ack_interrupt
,
2092 .config_intr
= &marvell_config_intr
,
2093 .resume
= &genphy_resume
,
2094 .suspend
= &genphy_suspend
,
2095 .read_page
= marvell_read_page
,
2096 .write_page
= marvell_write_page
,
2097 .get_sset_count
= marvell_get_sset_count
,
2098 .get_strings
= marvell_get_strings
,
2099 .get_stats
= marvell_get_stats
,
2102 .phy_id
= MARVELL_PHY_ID_88E1121R
,
2103 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2104 .name
= "Marvell 88E1121R",
2105 .features
= PHY_GBIT_FEATURES
,
2106 .flags
= PHY_HAS_INTERRUPT
,
2107 .probe
= &m88e1121_probe
,
2108 .config_init
= &marvell_config_init
,
2109 .config_aneg
= &m88e1121_config_aneg
,
2110 .read_status
= &marvell_read_status
,
2111 .ack_interrupt
= &marvell_ack_interrupt
,
2112 .config_intr
= &marvell_config_intr
,
2113 .did_interrupt
= &m88e1121_did_interrupt
,
2114 .resume
= &genphy_resume
,
2115 .suspend
= &genphy_suspend
,
2116 .read_page
= marvell_read_page
,
2117 .write_page
= marvell_write_page
,
2118 .get_sset_count
= marvell_get_sset_count
,
2119 .get_strings
= marvell_get_strings
,
2120 .get_stats
= marvell_get_stats
,
2123 .phy_id
= MARVELL_PHY_ID_88E1318S
,
2124 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2125 .name
= "Marvell 88E1318S",
2126 .features
= PHY_GBIT_FEATURES
,
2127 .flags
= PHY_HAS_INTERRUPT
,
2128 .probe
= marvell_probe
,
2129 .config_init
= &m88e1318_config_init
,
2130 .config_aneg
= &m88e1318_config_aneg
,
2131 .read_status
= &marvell_read_status
,
2132 .ack_interrupt
= &marvell_ack_interrupt
,
2133 .config_intr
= &marvell_config_intr
,
2134 .did_interrupt
= &m88e1121_did_interrupt
,
2135 .get_wol
= &m88e1318_get_wol
,
2136 .set_wol
= &m88e1318_set_wol
,
2137 .resume
= &genphy_resume
,
2138 .suspend
= &genphy_suspend
,
2139 .read_page
= marvell_read_page
,
2140 .write_page
= marvell_write_page
,
2141 .get_sset_count
= marvell_get_sset_count
,
2142 .get_strings
= marvell_get_strings
,
2143 .get_stats
= marvell_get_stats
,
2146 .phy_id
= MARVELL_PHY_ID_88E1145
,
2147 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2148 .name
= "Marvell 88E1145",
2149 .features
= PHY_GBIT_FEATURES
,
2150 .flags
= PHY_HAS_INTERRUPT
,
2151 .probe
= marvell_probe
,
2152 .config_init
= &m88e1145_config_init
,
2153 .config_aneg
= &m88e1101_config_aneg
,
2154 .read_status
= &genphy_read_status
,
2155 .ack_interrupt
= &marvell_ack_interrupt
,
2156 .config_intr
= &marvell_config_intr
,
2157 .resume
= &genphy_resume
,
2158 .suspend
= &genphy_suspend
,
2159 .read_page
= marvell_read_page
,
2160 .write_page
= marvell_write_page
,
2161 .get_sset_count
= marvell_get_sset_count
,
2162 .get_strings
= marvell_get_strings
,
2163 .get_stats
= marvell_get_stats
,
2166 .phy_id
= MARVELL_PHY_ID_88E1149R
,
2167 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2168 .name
= "Marvell 88E1149R",
2169 .features
= PHY_GBIT_FEATURES
,
2170 .flags
= PHY_HAS_INTERRUPT
,
2171 .probe
= marvell_probe
,
2172 .config_init
= &m88e1149_config_init
,
2173 .config_aneg
= &m88e1118_config_aneg
,
2174 .ack_interrupt
= &marvell_ack_interrupt
,
2175 .config_intr
= &marvell_config_intr
,
2176 .resume
= &genphy_resume
,
2177 .suspend
= &genphy_suspend
,
2178 .read_page
= marvell_read_page
,
2179 .write_page
= marvell_write_page
,
2180 .get_sset_count
= marvell_get_sset_count
,
2181 .get_strings
= marvell_get_strings
,
2182 .get_stats
= marvell_get_stats
,
2185 .phy_id
= MARVELL_PHY_ID_88E1240
,
2186 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2187 .name
= "Marvell 88E1240",
2188 .features
= PHY_GBIT_FEATURES
,
2189 .flags
= PHY_HAS_INTERRUPT
,
2190 .probe
= marvell_probe
,
2191 .config_init
= &m88e1111_config_init
,
2192 .config_aneg
= &marvell_config_aneg
,
2193 .ack_interrupt
= &marvell_ack_interrupt
,
2194 .config_intr
= &marvell_config_intr
,
2195 .resume
= &genphy_resume
,
2196 .suspend
= &genphy_suspend
,
2197 .read_page
= marvell_read_page
,
2198 .write_page
= marvell_write_page
,
2199 .get_sset_count
= marvell_get_sset_count
,
2200 .get_strings
= marvell_get_strings
,
2201 .get_stats
= marvell_get_stats
,
2204 .phy_id
= MARVELL_PHY_ID_88E1116R
,
2205 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2206 .name
= "Marvell 88E1116R",
2207 .features
= PHY_GBIT_FEATURES
,
2208 .flags
= PHY_HAS_INTERRUPT
,
2209 .probe
= marvell_probe
,
2210 .config_init
= &m88e1116r_config_init
,
2211 .ack_interrupt
= &marvell_ack_interrupt
,
2212 .config_intr
= &marvell_config_intr
,
2213 .resume
= &genphy_resume
,
2214 .suspend
= &genphy_suspend
,
2215 .read_page
= marvell_read_page
,
2216 .write_page
= marvell_write_page
,
2217 .get_sset_count
= marvell_get_sset_count
,
2218 .get_strings
= marvell_get_strings
,
2219 .get_stats
= marvell_get_stats
,
2222 .phy_id
= MARVELL_PHY_ID_88E1510
,
2223 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2224 .name
= "Marvell 88E1510",
2225 .features
= PHY_GBIT_FEATURES
| SUPPORTED_FIBRE
,
2226 .flags
= PHY_HAS_INTERRUPT
,
2227 .probe
= &m88e1510_probe
,
2228 .config_init
= &m88e1510_config_init
,
2229 .config_aneg
= &m88e1510_config_aneg
,
2230 .read_status
= &marvell_read_status
,
2231 .ack_interrupt
= &marvell_ack_interrupt
,
2232 .config_intr
= &marvell_config_intr
,
2233 .did_interrupt
= &m88e1121_did_interrupt
,
2234 .get_wol
= &m88e1318_get_wol
,
2235 .set_wol
= &m88e1318_set_wol
,
2236 .resume
= &marvell_resume
,
2237 .suspend
= &marvell_suspend
,
2238 .read_page
= marvell_read_page
,
2239 .write_page
= marvell_write_page
,
2240 .get_sset_count
= marvell_get_sset_count
,
2241 .get_strings
= marvell_get_strings
,
2242 .get_stats
= marvell_get_stats
,
2243 .set_loopback
= genphy_loopback
,
2246 .phy_id
= MARVELL_PHY_ID_88E1540
,
2247 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2248 .name
= "Marvell 88E1540",
2249 .features
= PHY_GBIT_FEATURES
,
2250 .flags
= PHY_HAS_INTERRUPT
,
2251 .probe
= m88e1510_probe
,
2252 .config_init
= &marvell_config_init
,
2253 .config_aneg
= &m88e1510_config_aneg
,
2254 .read_status
= &marvell_read_status
,
2255 .ack_interrupt
= &marvell_ack_interrupt
,
2256 .config_intr
= &marvell_config_intr
,
2257 .did_interrupt
= &m88e1121_did_interrupt
,
2258 .resume
= &genphy_resume
,
2259 .suspend
= &genphy_suspend
,
2260 .read_page
= marvell_read_page
,
2261 .write_page
= marvell_write_page
,
2262 .get_sset_count
= marvell_get_sset_count
,
2263 .get_strings
= marvell_get_strings
,
2264 .get_stats
= marvell_get_stats
,
2267 .phy_id
= MARVELL_PHY_ID_88E1545
,
2268 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2269 .name
= "Marvell 88E1545",
2270 .probe
= m88e1510_probe
,
2271 .features
= PHY_GBIT_FEATURES
,
2272 .flags
= PHY_HAS_INTERRUPT
,
2273 .config_init
= &marvell_config_init
,
2274 .config_aneg
= &m88e1510_config_aneg
,
2275 .read_status
= &marvell_read_status
,
2276 .ack_interrupt
= &marvell_ack_interrupt
,
2277 .config_intr
= &marvell_config_intr
,
2278 .did_interrupt
= &m88e1121_did_interrupt
,
2279 .resume
= &genphy_resume
,
2280 .suspend
= &genphy_suspend
,
2281 .read_page
= marvell_read_page
,
2282 .write_page
= marvell_write_page
,
2283 .get_sset_count
= marvell_get_sset_count
,
2284 .get_strings
= marvell_get_strings
,
2285 .get_stats
= marvell_get_stats
,
2288 .phy_id
= MARVELL_PHY_ID_88E3016
,
2289 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2290 .name
= "Marvell 88E3016",
2291 .features
= PHY_BASIC_FEATURES
,
2292 .flags
= PHY_HAS_INTERRUPT
,
2293 .probe
= marvell_probe
,
2294 .config_init
= &m88e3016_config_init
,
2295 .aneg_done
= &marvell_aneg_done
,
2296 .read_status
= &marvell_read_status
,
2297 .ack_interrupt
= &marvell_ack_interrupt
,
2298 .config_intr
= &marvell_config_intr
,
2299 .did_interrupt
= &m88e1121_did_interrupt
,
2300 .resume
= &genphy_resume
,
2301 .suspend
= &genphy_suspend
,
2302 .read_page
= marvell_read_page
,
2303 .write_page
= marvell_write_page
,
2304 .get_sset_count
= marvell_get_sset_count
,
2305 .get_strings
= marvell_get_strings
,
2306 .get_stats
= marvell_get_stats
,
2309 .phy_id
= MARVELL_PHY_ID_88E6390
,
2310 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2311 .name
= "Marvell 88E6390",
2312 .features
= PHY_GBIT_FEATURES
,
2313 .flags
= PHY_HAS_INTERRUPT
,
2314 .probe
= m88e6390_probe
,
2315 .config_init
= &marvell_config_init
,
2316 .config_aneg
= &m88e1510_config_aneg
,
2317 .read_status
= &marvell_read_status
,
2318 .ack_interrupt
= &marvell_ack_interrupt
,
2319 .config_intr
= &marvell_config_intr
,
2320 .did_interrupt
= &m88e1121_did_interrupt
,
2321 .resume
= &genphy_resume
,
2322 .suspend
= &genphy_suspend
,
2323 .read_page
= marvell_read_page
,
2324 .write_page
= marvell_write_page
,
2325 .get_sset_count
= marvell_get_sset_count
,
2326 .get_strings
= marvell_get_strings
,
2327 .get_stats
= marvell_get_stats
,
2331 module_phy_driver(marvell_drivers
);
2333 static struct mdio_device_id __maybe_unused marvell_tbl
[] = {
2334 { MARVELL_PHY_ID_88E1101
, MARVELL_PHY_ID_MASK
},
2335 { MARVELL_PHY_ID_88E1112
, MARVELL_PHY_ID_MASK
},
2336 { MARVELL_PHY_ID_88E1111
, MARVELL_PHY_ID_MASK
},
2337 { MARVELL_PHY_ID_88E1118
, MARVELL_PHY_ID_MASK
},
2338 { MARVELL_PHY_ID_88E1121R
, MARVELL_PHY_ID_MASK
},
2339 { MARVELL_PHY_ID_88E1145
, MARVELL_PHY_ID_MASK
},
2340 { MARVELL_PHY_ID_88E1149R
, MARVELL_PHY_ID_MASK
},
2341 { MARVELL_PHY_ID_88E1240
, MARVELL_PHY_ID_MASK
},
2342 { MARVELL_PHY_ID_88E1318S
, MARVELL_PHY_ID_MASK
},
2343 { MARVELL_PHY_ID_88E1116R
, MARVELL_PHY_ID_MASK
},
2344 { MARVELL_PHY_ID_88E1510
, MARVELL_PHY_ID_MASK
},
2345 { MARVELL_PHY_ID_88E1540
, MARVELL_PHY_ID_MASK
},
2346 { MARVELL_PHY_ID_88E1545
, MARVELL_PHY_ID_MASK
},
2347 { MARVELL_PHY_ID_88E3016
, MARVELL_PHY_ID_MASK
},
2348 { MARVELL_PHY_ID_88E6390
, MARVELL_PHY_ID_MASK
},
2352 MODULE_DEVICE_TABLE(mdio
, marvell_tbl
);