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
) {
872 err
= marvell_set_page(phydev
, 18);
876 /* In reg 20, write MODE[2:0] = 0x1 (SGMII to Copper) */
877 err
= phy_modify(phydev
, MII_88E1510_GEN_CTRL_REG_1
,
878 MII_88E1510_GEN_CTRL_REG_1_MODE_MASK
,
879 MII_88E1510_GEN_CTRL_REG_1_MODE_SGMII
);
883 /* PHY reset is necessary after changing MODE[2:0] */
884 err
= phy_modify(phydev
, MII_88E1510_GEN_CTRL_REG_1
, 0,
885 MII_88E1510_GEN_CTRL_REG_1_RESET
);
889 /* Reset page selection */
890 err
= marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
895 return m88e1318_config_init(phydev
);
898 static int m88e1118_config_aneg(struct phy_device
*phydev
)
902 err
= genphy_soft_reset(phydev
);
906 err
= marvell_set_polarity(phydev
, phydev
->mdix_ctrl
);
910 err
= genphy_config_aneg(phydev
);
914 static int m88e1118_config_init(struct phy_device
*phydev
)
919 err
= marvell_set_page(phydev
, MII_MARVELL_MSCR_PAGE
);
923 /* Enable 1000 Mbit */
924 err
= phy_write(phydev
, 0x15, 0x1070);
929 err
= marvell_set_page(phydev
, MII_MARVELL_LED_PAGE
);
933 /* Adjust LED Control */
934 if (phydev
->dev_flags
& MARVELL_PHY_M1118_DNS323_LEDS
)
935 err
= phy_write(phydev
, 0x10, 0x1100);
937 err
= phy_write(phydev
, 0x10, 0x021e);
941 err
= marvell_of_reg_init(phydev
);
946 err
= marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
950 return genphy_soft_reset(phydev
);
953 static int m88e1149_config_init(struct phy_device
*phydev
)
958 err
= marvell_set_page(phydev
, MII_MARVELL_MSCR_PAGE
);
962 /* Enable 1000 Mbit */
963 err
= phy_write(phydev
, 0x15, 0x1048);
967 err
= marvell_of_reg_init(phydev
);
972 err
= marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
976 return genphy_soft_reset(phydev
);
979 static int m88e1145_config_init_rgmii(struct phy_device
*phydev
)
983 err
= m88e1111_config_init_rgmii_delays(phydev
);
987 if (phydev
->dev_flags
& MARVELL_PHY_M1145_FLAGS_RESISTANCE
) {
988 err
= phy_write(phydev
, 0x1d, 0x0012);
992 err
= phy_modify(phydev
, 0x1e, 0x0fc0,
993 2 << 9 | /* 36 ohm */
994 2 << 6); /* 39 ohm */
998 err
= phy_write(phydev
, 0x1d, 0x3);
1002 err
= phy_write(phydev
, 0x1e, 0x8000);
1007 static int m88e1145_config_init_sgmii(struct phy_device
*phydev
)
1009 return m88e1111_config_init_hwcfg_mode(
1010 phydev
, MII_M1111_HWCFG_MODE_SGMII_NO_CLK
,
1011 MII_M1111_HWCFG_FIBER_COPPER_AUTO
);
1014 static int m88e1145_config_init(struct phy_device
*phydev
)
1018 /* Take care of errata E0 & E1 */
1019 err
= phy_write(phydev
, 0x1d, 0x001b);
1023 err
= phy_write(phydev
, 0x1e, 0x418f);
1027 err
= phy_write(phydev
, 0x1d, 0x0016);
1031 err
= phy_write(phydev
, 0x1e, 0xa2da);
1035 if (phydev
->interface
== PHY_INTERFACE_MODE_RGMII_ID
) {
1036 err
= m88e1145_config_init_rgmii(phydev
);
1041 if (phydev
->interface
== PHY_INTERFACE_MODE_SGMII
) {
1042 err
= m88e1145_config_init_sgmii(phydev
);
1047 err
= marvell_of_reg_init(phydev
);
1054 /* The VOD can be out of specification on link up. Poke an
1055 * undocumented register, in an undocumented page, with a magic value
1058 static int m88e6390_errata(struct phy_device
*phydev
)
1062 err
= phy_write(phydev
, MII_BMCR
,
1063 BMCR_ANENABLE
| BMCR_SPEED1000
| BMCR_FULLDPLX
);
1067 usleep_range(300, 400);
1069 err
= phy_write_paged(phydev
, 0xf8, 0x08, 0x36);
1073 return genphy_soft_reset(phydev
);
1076 static int m88e6390_config_aneg(struct phy_device
*phydev
)
1080 err
= m88e6390_errata(phydev
);
1084 return m88e1510_config_aneg(phydev
);
1088 * fiber_lpa_to_ethtool_lpa_t
1089 * @lpa: value of the MII_LPA register for fiber link
1091 * A small helper function that translates MII_LPA
1092 * bits to ethtool LP advertisement settings.
1094 static u32
fiber_lpa_to_ethtool_lpa_t(u32 lpa
)
1098 if (lpa
& LPA_FIBER_1000HALF
)
1099 result
|= ADVERTISED_1000baseT_Half
;
1100 if (lpa
& LPA_FIBER_1000FULL
)
1101 result
|= ADVERTISED_1000baseT_Full
;
1107 * marvell_update_link - update link status in real time in @phydev
1108 * @phydev: target phy_device struct
1110 * Description: Update the value in phydev->link to reflect the
1111 * current link value.
1113 static int marvell_update_link(struct phy_device
*phydev
, int fiber
)
1117 /* Use the generic register for copper link, or specific
1118 * register for fiber case
1121 status
= phy_read(phydev
, MII_M1011_PHY_STATUS
);
1125 if ((status
& REGISTER_LINK_STATUS
) == 0)
1130 return genphy_update_link(phydev
);
1136 static int marvell_read_status_page_an(struct phy_device
*phydev
,
1143 status
= phy_read(phydev
, MII_M1011_PHY_STATUS
);
1147 lpa
= phy_read(phydev
, MII_LPA
);
1151 lpagb
= phy_read(phydev
, MII_STAT1000
);
1155 if (status
& MII_M1011_PHY_STATUS_FULLDUPLEX
)
1156 phydev
->duplex
= DUPLEX_FULL
;
1158 phydev
->duplex
= DUPLEX_HALF
;
1160 status
= status
& MII_M1011_PHY_STATUS_SPD_MASK
;
1162 phydev
->asym_pause
= 0;
1165 case MII_M1011_PHY_STATUS_1000
:
1166 phydev
->speed
= SPEED_1000
;
1169 case MII_M1011_PHY_STATUS_100
:
1170 phydev
->speed
= SPEED_100
;
1174 phydev
->speed
= SPEED_10
;
1179 phydev
->lp_advertising
=
1180 mii_stat1000_to_ethtool_lpa_t(lpagb
) |
1181 mii_lpa_to_ethtool_lpa_t(lpa
);
1183 if (phydev
->duplex
== DUPLEX_FULL
) {
1184 phydev
->pause
= lpa
& LPA_PAUSE_CAP
? 1 : 0;
1185 phydev
->asym_pause
= lpa
& LPA_PAUSE_ASYM
? 1 : 0;
1188 /* The fiber link is only 1000M capable */
1189 phydev
->lp_advertising
= fiber_lpa_to_ethtool_lpa_t(lpa
);
1191 if (phydev
->duplex
== DUPLEX_FULL
) {
1192 if (!(lpa
& LPA_PAUSE_FIBER
)) {
1194 phydev
->asym_pause
= 0;
1195 } else if ((lpa
& LPA_PAUSE_ASYM_FIBER
)) {
1197 phydev
->asym_pause
= 1;
1200 phydev
->asym_pause
= 0;
1207 static int marvell_read_status_page_fixed(struct phy_device
*phydev
)
1209 int bmcr
= phy_read(phydev
, MII_BMCR
);
1214 if (bmcr
& BMCR_FULLDPLX
)
1215 phydev
->duplex
= DUPLEX_FULL
;
1217 phydev
->duplex
= DUPLEX_HALF
;
1219 if (bmcr
& BMCR_SPEED1000
)
1220 phydev
->speed
= SPEED_1000
;
1221 else if (bmcr
& BMCR_SPEED100
)
1222 phydev
->speed
= SPEED_100
;
1224 phydev
->speed
= SPEED_10
;
1227 phydev
->asym_pause
= 0;
1228 phydev
->lp_advertising
= 0;
1233 /* marvell_read_status_page
1236 * Check the link, then figure out the current state
1237 * by comparing what we advertise with what the link partner
1238 * advertises. Start by checking the gigabit possibilities,
1239 * then move on to 10/100.
1241 static int marvell_read_status_page(struct phy_device
*phydev
, int page
)
1246 /* Detect and update the link, but return if there
1249 if (page
== MII_MARVELL_FIBER_PAGE
)
1254 err
= marvell_update_link(phydev
, fiber
);
1258 if (phydev
->autoneg
== AUTONEG_ENABLE
)
1259 err
= marvell_read_status_page_an(phydev
, fiber
);
1261 err
= marvell_read_status_page_fixed(phydev
);
1266 /* marvell_read_status
1268 * Some Marvell's phys have two modes: fiber and copper.
1269 * Both need status checked.
1271 * First, check the fiber link and status.
1272 * If the fiber link is down, check the copper link and status which
1273 * will be the default value if both link are down.
1275 static int marvell_read_status(struct phy_device
*phydev
)
1279 /* Check the fiber mode first */
1280 if (phydev
->supported
& SUPPORTED_FIBRE
&&
1281 phydev
->interface
!= PHY_INTERFACE_MODE_SGMII
) {
1282 err
= marvell_set_page(phydev
, MII_MARVELL_FIBER_PAGE
);
1286 err
= marvell_read_status_page(phydev
, MII_MARVELL_FIBER_PAGE
);
1290 /* If the fiber link is up, it is the selected and
1291 * used link. In this case, we need to stay in the
1292 * fiber page. Please to be careful about that, avoid
1293 * to restore Copper page in other functions which
1294 * could break the behaviour for some fiber phy like
1300 /* If fiber link is down, check and save copper mode state */
1301 err
= marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
1306 return marvell_read_status_page(phydev
, MII_MARVELL_COPPER_PAGE
);
1309 marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
1315 * Some Marvell's phys have two modes: fiber and copper.
1316 * Both need to be suspended
1318 static int marvell_suspend(struct phy_device
*phydev
)
1322 /* Suspend the fiber mode first */
1323 if (!(phydev
->supported
& SUPPORTED_FIBRE
)) {
1324 err
= marvell_set_page(phydev
, MII_MARVELL_FIBER_PAGE
);
1328 /* With the page set, use the generic suspend */
1329 err
= genphy_suspend(phydev
);
1333 /* Then, the copper link */
1334 err
= marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
1339 /* With the page set, use the generic suspend */
1340 return genphy_suspend(phydev
);
1343 marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
1349 * Some Marvell's phys have two modes: fiber and copper.
1350 * Both need to be resumed
1352 static int marvell_resume(struct phy_device
*phydev
)
1356 /* Resume the fiber mode first */
1357 if (!(phydev
->supported
& SUPPORTED_FIBRE
)) {
1358 err
= marvell_set_page(phydev
, MII_MARVELL_FIBER_PAGE
);
1362 /* With the page set, use the generic resume */
1363 err
= genphy_resume(phydev
);
1367 /* Then, the copper link */
1368 err
= marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
1373 /* With the page set, use the generic resume */
1374 return genphy_resume(phydev
);
1377 marvell_set_page(phydev
, MII_MARVELL_COPPER_PAGE
);
1381 static int marvell_aneg_done(struct phy_device
*phydev
)
1383 int retval
= phy_read(phydev
, MII_M1011_PHY_STATUS
);
1385 return (retval
< 0) ? retval
: (retval
& MII_M1011_PHY_STATUS_RESOLVED
);
1388 static int m88e1121_did_interrupt(struct phy_device
*phydev
)
1392 imask
= phy_read(phydev
, MII_M1011_IEVENT
);
1394 if (imask
& MII_M1011_IMASK_INIT
)
1400 static void m88e1318_get_wol(struct phy_device
*phydev
,
1401 struct ethtool_wolinfo
*wol
)
1403 int oldpage
, ret
= 0;
1405 wol
->supported
= WAKE_MAGIC
;
1408 oldpage
= phy_select_page(phydev
, MII_MARVELL_WOL_PAGE
);
1412 ret
= __phy_read(phydev
, MII_88E1318S_PHY_WOL_CTRL
);
1413 if (ret
& MII_88E1318S_PHY_WOL_CTRL_MAGIC_PACKET_MATCH_ENABLE
)
1414 wol
->wolopts
|= WAKE_MAGIC
;
1417 phy_restore_page(phydev
, oldpage
, ret
);
1420 static int m88e1318_set_wol(struct phy_device
*phydev
,
1421 struct ethtool_wolinfo
*wol
)
1423 int err
= 0, oldpage
;
1425 oldpage
= phy_save_page(phydev
);
1429 if (wol
->wolopts
& WAKE_MAGIC
) {
1430 /* Explicitly switch to page 0x00, just to be sure */
1431 err
= marvell_write_page(phydev
, MII_MARVELL_COPPER_PAGE
);
1435 /* If WOL event happened once, the LED[2] interrupt pin
1436 * will not be cleared unless we reading the interrupt status
1437 * register. If interrupts are in use, the normal interrupt
1438 * handling will clear the WOL event. Clear the WOL event
1439 * before enabling it if !phy_interrupt_is_valid()
1441 if (!phy_interrupt_is_valid(phydev
))
1442 __phy_read(phydev
, MII_M1011_IEVENT
);
1444 /* Enable the WOL interrupt */
1445 err
= __phy_modify(phydev
, MII_88E1318S_PHY_CSIER
, 0,
1446 MII_88E1318S_PHY_CSIER_WOL_EIE
);
1450 err
= marvell_write_page(phydev
, MII_MARVELL_LED_PAGE
);
1454 /* Setup LED[2] as interrupt pin (active low) */
1455 err
= __phy_modify(phydev
, MII_88E1318S_PHY_LED_TCR
,
1456 MII_88E1318S_PHY_LED_TCR_FORCE_INT
,
1457 MII_88E1318S_PHY_LED_TCR_INTn_ENABLE
|
1458 MII_88E1318S_PHY_LED_TCR_INT_ACTIVE_LOW
);
1462 err
= marvell_write_page(phydev
, MII_MARVELL_WOL_PAGE
);
1466 /* Store the device address for the magic packet */
1467 err
= __phy_write(phydev
, MII_88E1318S_PHY_MAGIC_PACKET_WORD2
,
1468 ((phydev
->attached_dev
->dev_addr
[5] << 8) |
1469 phydev
->attached_dev
->dev_addr
[4]));
1472 err
= __phy_write(phydev
, MII_88E1318S_PHY_MAGIC_PACKET_WORD1
,
1473 ((phydev
->attached_dev
->dev_addr
[3] << 8) |
1474 phydev
->attached_dev
->dev_addr
[2]));
1477 err
= __phy_write(phydev
, MII_88E1318S_PHY_MAGIC_PACKET_WORD0
,
1478 ((phydev
->attached_dev
->dev_addr
[1] << 8) |
1479 phydev
->attached_dev
->dev_addr
[0]));
1483 /* Clear WOL status and enable magic packet matching */
1484 err
= __phy_modify(phydev
, MII_88E1318S_PHY_WOL_CTRL
, 0,
1485 MII_88E1318S_PHY_WOL_CTRL_CLEAR_WOL_STATUS
|
1486 MII_88E1318S_PHY_WOL_CTRL_MAGIC_PACKET_MATCH_ENABLE
);
1490 err
= marvell_write_page(phydev
, MII_MARVELL_WOL_PAGE
);
1494 /* Clear WOL status and disable magic packet matching */
1495 err
= __phy_modify(phydev
, MII_88E1318S_PHY_WOL_CTRL
,
1496 MII_88E1318S_PHY_WOL_CTRL_MAGIC_PACKET_MATCH_ENABLE
,
1497 MII_88E1318S_PHY_WOL_CTRL_CLEAR_WOL_STATUS
);
1503 return phy_restore_page(phydev
, oldpage
, err
);
1506 static int marvell_get_sset_count(struct phy_device
*phydev
)
1508 if (phydev
->supported
& SUPPORTED_FIBRE
)
1509 return ARRAY_SIZE(marvell_hw_stats
);
1511 return ARRAY_SIZE(marvell_hw_stats
) - NB_FIBER_STATS
;
1514 static void marvell_get_strings(struct phy_device
*phydev
, u8
*data
)
1516 int count
= marvell_get_sset_count(phydev
);
1519 for (i
= 0; i
< count
; i
++) {
1520 strlcpy(data
+ i
* ETH_GSTRING_LEN
,
1521 marvell_hw_stats
[i
].string
, ETH_GSTRING_LEN
);
1525 static u64
marvell_get_stat(struct phy_device
*phydev
, int i
)
1527 struct marvell_hw_stat stat
= marvell_hw_stats
[i
];
1528 struct marvell_priv
*priv
= phydev
->priv
;
1532 val
= phy_read_paged(phydev
, stat
.page
, stat
.reg
);
1536 val
= val
& ((1 << stat
.bits
) - 1);
1537 priv
->stats
[i
] += val
;
1538 ret
= priv
->stats
[i
];
1544 static void marvell_get_stats(struct phy_device
*phydev
,
1545 struct ethtool_stats
*stats
, u64
*data
)
1547 int count
= marvell_get_sset_count(phydev
);
1550 for (i
= 0; i
< count
; i
++)
1551 data
[i
] = marvell_get_stat(phydev
, i
);
1555 static int m88e1121_get_temp(struct phy_device
*phydev
, long *temp
)
1563 oldpage
= phy_select_page(phydev
, MII_MARVELL_MISC_TEST_PAGE
);
1567 /* Enable temperature sensor */
1568 ret
= __phy_read(phydev
, MII_88E1121_MISC_TEST
);
1572 ret
= __phy_write(phydev
, MII_88E1121_MISC_TEST
,
1573 ret
| MII_88E1121_MISC_TEST_TEMP_SENSOR_EN
);
1577 /* Wait for temperature to stabilize */
1578 usleep_range(10000, 12000);
1580 val
= __phy_read(phydev
, MII_88E1121_MISC_TEST
);
1586 /* Disable temperature sensor */
1587 ret
= __phy_write(phydev
, MII_88E1121_MISC_TEST
,
1588 ret
& ~MII_88E1121_MISC_TEST_TEMP_SENSOR_EN
);
1592 *temp
= ((val
& MII_88E1121_MISC_TEST_TEMP_MASK
) - 5) * 5000;
1595 return phy_restore_page(phydev
, oldpage
, ret
);
1598 static int m88e1121_hwmon_read(struct device
*dev
,
1599 enum hwmon_sensor_types type
,
1600 u32 attr
, int channel
, long *temp
)
1602 struct phy_device
*phydev
= dev_get_drvdata(dev
);
1606 case hwmon_temp_input
:
1607 err
= m88e1121_get_temp(phydev
, temp
);
1616 static umode_t
m88e1121_hwmon_is_visible(const void *data
,
1617 enum hwmon_sensor_types type
,
1618 u32 attr
, int channel
)
1620 if (type
!= hwmon_temp
)
1624 case hwmon_temp_input
:
1631 static u32 m88e1121_hwmon_chip_config
[] = {
1632 HWMON_C_REGISTER_TZ
,
1636 static const struct hwmon_channel_info m88e1121_hwmon_chip
= {
1638 .config
= m88e1121_hwmon_chip_config
,
1641 static u32 m88e1121_hwmon_temp_config
[] = {
1646 static const struct hwmon_channel_info m88e1121_hwmon_temp
= {
1648 .config
= m88e1121_hwmon_temp_config
,
1651 static const struct hwmon_channel_info
*m88e1121_hwmon_info
[] = {
1652 &m88e1121_hwmon_chip
,
1653 &m88e1121_hwmon_temp
,
1657 static const struct hwmon_ops m88e1121_hwmon_hwmon_ops
= {
1658 .is_visible
= m88e1121_hwmon_is_visible
,
1659 .read
= m88e1121_hwmon_read
,
1662 static const struct hwmon_chip_info m88e1121_hwmon_chip_info
= {
1663 .ops
= &m88e1121_hwmon_hwmon_ops
,
1664 .info
= m88e1121_hwmon_info
,
1667 static int m88e1510_get_temp(struct phy_device
*phydev
, long *temp
)
1673 ret
= phy_read_paged(phydev
, MII_MARVELL_MISC_TEST_PAGE
,
1674 MII_88E1510_TEMP_SENSOR
);
1678 *temp
= ((ret
& MII_88E1510_TEMP_SENSOR_MASK
) - 25) * 1000;
1683 static int m88e1510_get_temp_critical(struct phy_device
*phydev
, long *temp
)
1689 ret
= phy_read_paged(phydev
, MII_MARVELL_MISC_TEST_PAGE
,
1690 MII_88E1121_MISC_TEST
);
1694 *temp
= (((ret
& MII_88E1510_MISC_TEST_TEMP_THRESHOLD_MASK
) >>
1695 MII_88E1510_MISC_TEST_TEMP_THRESHOLD_SHIFT
) * 5) - 25;
1702 static int m88e1510_set_temp_critical(struct phy_device
*phydev
, long temp
)
1705 temp
= clamp_val(DIV_ROUND_CLOSEST(temp
, 5) + 5, 0, 0x1f);
1707 return phy_modify_paged(phydev
, MII_MARVELL_MISC_TEST_PAGE
,
1708 MII_88E1121_MISC_TEST
,
1709 MII_88E1510_MISC_TEST_TEMP_THRESHOLD_MASK
,
1710 temp
<< MII_88E1510_MISC_TEST_TEMP_THRESHOLD_SHIFT
);
1713 static int m88e1510_get_temp_alarm(struct phy_device
*phydev
, long *alarm
)
1719 ret
= phy_read_paged(phydev
, MII_MARVELL_MISC_TEST_PAGE
,
1720 MII_88E1121_MISC_TEST
);
1724 *alarm
= !!(ret
& MII_88E1510_MISC_TEST_TEMP_IRQ
);
1729 static int m88e1510_hwmon_read(struct device
*dev
,
1730 enum hwmon_sensor_types type
,
1731 u32 attr
, int channel
, long *temp
)
1733 struct phy_device
*phydev
= dev_get_drvdata(dev
);
1737 case hwmon_temp_input
:
1738 err
= m88e1510_get_temp(phydev
, temp
);
1740 case hwmon_temp_crit
:
1741 err
= m88e1510_get_temp_critical(phydev
, temp
);
1743 case hwmon_temp_max_alarm
:
1744 err
= m88e1510_get_temp_alarm(phydev
, temp
);
1753 static int m88e1510_hwmon_write(struct device
*dev
,
1754 enum hwmon_sensor_types type
,
1755 u32 attr
, int channel
, long temp
)
1757 struct phy_device
*phydev
= dev_get_drvdata(dev
);
1761 case hwmon_temp_crit
:
1762 err
= m88e1510_set_temp_critical(phydev
, temp
);
1770 static umode_t
m88e1510_hwmon_is_visible(const void *data
,
1771 enum hwmon_sensor_types type
,
1772 u32 attr
, int channel
)
1774 if (type
!= hwmon_temp
)
1778 case hwmon_temp_input
:
1779 case hwmon_temp_max_alarm
:
1781 case hwmon_temp_crit
:
1788 static u32 m88e1510_hwmon_temp_config
[] = {
1789 HWMON_T_INPUT
| HWMON_T_CRIT
| HWMON_T_MAX_ALARM
,
1793 static const struct hwmon_channel_info m88e1510_hwmon_temp
= {
1795 .config
= m88e1510_hwmon_temp_config
,
1798 static const struct hwmon_channel_info
*m88e1510_hwmon_info
[] = {
1799 &m88e1121_hwmon_chip
,
1800 &m88e1510_hwmon_temp
,
1804 static const struct hwmon_ops m88e1510_hwmon_hwmon_ops
= {
1805 .is_visible
= m88e1510_hwmon_is_visible
,
1806 .read
= m88e1510_hwmon_read
,
1807 .write
= m88e1510_hwmon_write
,
1810 static const struct hwmon_chip_info m88e1510_hwmon_chip_info
= {
1811 .ops
= &m88e1510_hwmon_hwmon_ops
,
1812 .info
= m88e1510_hwmon_info
,
1815 static int m88e6390_get_temp(struct phy_device
*phydev
, long *temp
)
1824 oldpage
= phy_select_page(phydev
, MII_MARVELL_MISC_TEST_PAGE
);
1828 /* Enable temperature sensor */
1829 ret
= __phy_read(phydev
, MII_88E6390_MISC_TEST
);
1833 ret
= ret
& ~MII_88E6390_MISC_TEST_SAMPLE_MASK
;
1834 ret
|= MII_88E6390_MISC_TEST_SAMPLE_ENABLE
|
1835 MII_88E6390_MISC_TEST_SAMPLE_1S
;
1837 ret
= __phy_write(phydev
, MII_88E6390_MISC_TEST
, ret
);
1841 /* Wait for temperature to stabilize */
1842 usleep_range(10000, 12000);
1844 /* Reading the temperature sense has an errata. You need to read
1845 * a number of times and take an average.
1847 for (i
= 0; i
< MII_88E6390_TEMP_SENSOR_SAMPLES
; i
++) {
1848 ret
= __phy_read(phydev
, MII_88E6390_TEMP_SENSOR
);
1851 sum
+= ret
& MII_88E6390_TEMP_SENSOR_MASK
;
1854 sum
/= MII_88E6390_TEMP_SENSOR_SAMPLES
;
1855 *temp
= (sum
- 75) * 1000;
1857 /* Disable temperature sensor */
1858 ret
= __phy_read(phydev
, MII_88E6390_MISC_TEST
);
1862 ret
= ret
& ~MII_88E6390_MISC_TEST_SAMPLE_MASK
;
1863 ret
|= MII_88E6390_MISC_TEST_SAMPLE_DISABLE
;
1865 ret
= __phy_write(phydev
, MII_88E6390_MISC_TEST
, ret
);
1868 phy_restore_page(phydev
, oldpage
, ret
);
1873 static int m88e6390_hwmon_read(struct device
*dev
,
1874 enum hwmon_sensor_types type
,
1875 u32 attr
, int channel
, long *temp
)
1877 struct phy_device
*phydev
= dev_get_drvdata(dev
);
1881 case hwmon_temp_input
:
1882 err
= m88e6390_get_temp(phydev
, temp
);
1891 static umode_t
m88e6390_hwmon_is_visible(const void *data
,
1892 enum hwmon_sensor_types type
,
1893 u32 attr
, int channel
)
1895 if (type
!= hwmon_temp
)
1899 case hwmon_temp_input
:
1906 static u32 m88e6390_hwmon_temp_config
[] = {
1911 static const struct hwmon_channel_info m88e6390_hwmon_temp
= {
1913 .config
= m88e6390_hwmon_temp_config
,
1916 static const struct hwmon_channel_info
*m88e6390_hwmon_info
[] = {
1917 &m88e1121_hwmon_chip
,
1918 &m88e6390_hwmon_temp
,
1922 static const struct hwmon_ops m88e6390_hwmon_hwmon_ops
= {
1923 .is_visible
= m88e6390_hwmon_is_visible
,
1924 .read
= m88e6390_hwmon_read
,
1927 static const struct hwmon_chip_info m88e6390_hwmon_chip_info
= {
1928 .ops
= &m88e6390_hwmon_hwmon_ops
,
1929 .info
= m88e6390_hwmon_info
,
1932 static int marvell_hwmon_name(struct phy_device
*phydev
)
1934 struct marvell_priv
*priv
= phydev
->priv
;
1935 struct device
*dev
= &phydev
->mdio
.dev
;
1936 const char *devname
= dev_name(dev
);
1937 size_t len
= strlen(devname
);
1940 priv
->hwmon_name
= devm_kzalloc(dev
, len
, GFP_KERNEL
);
1941 if (!priv
->hwmon_name
)
1944 for (i
= j
= 0; i
< len
&& devname
[i
]; i
++) {
1945 if (isalnum(devname
[i
]))
1946 priv
->hwmon_name
[j
++] = devname
[i
];
1952 static int marvell_hwmon_probe(struct phy_device
*phydev
,
1953 const struct hwmon_chip_info
*chip
)
1955 struct marvell_priv
*priv
= phydev
->priv
;
1956 struct device
*dev
= &phydev
->mdio
.dev
;
1959 err
= marvell_hwmon_name(phydev
);
1963 priv
->hwmon_dev
= devm_hwmon_device_register_with_info(
1964 dev
, priv
->hwmon_name
, phydev
, chip
, NULL
);
1966 return PTR_ERR_OR_ZERO(priv
->hwmon_dev
);
1969 static int m88e1121_hwmon_probe(struct phy_device
*phydev
)
1971 return marvell_hwmon_probe(phydev
, &m88e1121_hwmon_chip_info
);
1974 static int m88e1510_hwmon_probe(struct phy_device
*phydev
)
1976 return marvell_hwmon_probe(phydev
, &m88e1510_hwmon_chip_info
);
1979 static int m88e6390_hwmon_probe(struct phy_device
*phydev
)
1981 return marvell_hwmon_probe(phydev
, &m88e6390_hwmon_chip_info
);
1984 static int m88e1121_hwmon_probe(struct phy_device
*phydev
)
1989 static int m88e1510_hwmon_probe(struct phy_device
*phydev
)
1994 static int m88e6390_hwmon_probe(struct phy_device
*phydev
)
2000 static int marvell_probe(struct phy_device
*phydev
)
2002 struct marvell_priv
*priv
;
2004 priv
= devm_kzalloc(&phydev
->mdio
.dev
, sizeof(*priv
), GFP_KERNEL
);
2008 phydev
->priv
= priv
;
2013 static int m88e1121_probe(struct phy_device
*phydev
)
2017 err
= marvell_probe(phydev
);
2021 return m88e1121_hwmon_probe(phydev
);
2024 static int m88e1510_probe(struct phy_device
*phydev
)
2028 err
= marvell_probe(phydev
);
2032 return m88e1510_hwmon_probe(phydev
);
2035 static int m88e6390_probe(struct phy_device
*phydev
)
2039 err
= marvell_probe(phydev
);
2043 return m88e6390_hwmon_probe(phydev
);
2046 static struct phy_driver marvell_drivers
[] = {
2048 .phy_id
= MARVELL_PHY_ID_88E1101
,
2049 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2050 .name
= "Marvell 88E1101",
2051 .features
= PHY_GBIT_FEATURES
,
2052 .flags
= PHY_HAS_INTERRUPT
,
2053 .probe
= marvell_probe
,
2054 .config_init
= &marvell_config_init
,
2055 .config_aneg
= &m88e1101_config_aneg
,
2056 .ack_interrupt
= &marvell_ack_interrupt
,
2057 .config_intr
= &marvell_config_intr
,
2058 .resume
= &genphy_resume
,
2059 .suspend
= &genphy_suspend
,
2060 .read_page
= marvell_read_page
,
2061 .write_page
= marvell_write_page
,
2062 .get_sset_count
= marvell_get_sset_count
,
2063 .get_strings
= marvell_get_strings
,
2064 .get_stats
= marvell_get_stats
,
2067 .phy_id
= MARVELL_PHY_ID_88E1112
,
2068 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2069 .name
= "Marvell 88E1112",
2070 .features
= PHY_GBIT_FEATURES
,
2071 .flags
= PHY_HAS_INTERRUPT
,
2072 .probe
= marvell_probe
,
2073 .config_init
= &m88e1111_config_init
,
2074 .config_aneg
= &marvell_config_aneg
,
2075 .ack_interrupt
= &marvell_ack_interrupt
,
2076 .config_intr
= &marvell_config_intr
,
2077 .resume
= &genphy_resume
,
2078 .suspend
= &genphy_suspend
,
2079 .read_page
= marvell_read_page
,
2080 .write_page
= marvell_write_page
,
2081 .get_sset_count
= marvell_get_sset_count
,
2082 .get_strings
= marvell_get_strings
,
2083 .get_stats
= marvell_get_stats
,
2086 .phy_id
= MARVELL_PHY_ID_88E1111
,
2087 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2088 .name
= "Marvell 88E1111",
2089 .features
= PHY_GBIT_FEATURES
,
2090 .flags
= PHY_HAS_INTERRUPT
,
2091 .probe
= marvell_probe
,
2092 .config_init
= &m88e1111_config_init
,
2093 .config_aneg
= &m88e1111_config_aneg
,
2094 .read_status
= &marvell_read_status
,
2095 .ack_interrupt
= &marvell_ack_interrupt
,
2096 .config_intr
= &marvell_config_intr
,
2097 .resume
= &genphy_resume
,
2098 .suspend
= &genphy_suspend
,
2099 .read_page
= marvell_read_page
,
2100 .write_page
= marvell_write_page
,
2101 .get_sset_count
= marvell_get_sset_count
,
2102 .get_strings
= marvell_get_strings
,
2103 .get_stats
= marvell_get_stats
,
2106 .phy_id
= MARVELL_PHY_ID_88E1118
,
2107 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2108 .name
= "Marvell 88E1118",
2109 .features
= PHY_GBIT_FEATURES
,
2110 .flags
= PHY_HAS_INTERRUPT
,
2111 .probe
= marvell_probe
,
2112 .config_init
= &m88e1118_config_init
,
2113 .config_aneg
= &m88e1118_config_aneg
,
2114 .ack_interrupt
= &marvell_ack_interrupt
,
2115 .config_intr
= &marvell_config_intr
,
2116 .resume
= &genphy_resume
,
2117 .suspend
= &genphy_suspend
,
2118 .read_page
= marvell_read_page
,
2119 .write_page
= marvell_write_page
,
2120 .get_sset_count
= marvell_get_sset_count
,
2121 .get_strings
= marvell_get_strings
,
2122 .get_stats
= marvell_get_stats
,
2125 .phy_id
= MARVELL_PHY_ID_88E1121R
,
2126 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2127 .name
= "Marvell 88E1121R",
2128 .features
= PHY_GBIT_FEATURES
,
2129 .flags
= PHY_HAS_INTERRUPT
,
2130 .probe
= &m88e1121_probe
,
2131 .config_init
= &marvell_config_init
,
2132 .config_aneg
= &m88e1121_config_aneg
,
2133 .read_status
= &marvell_read_status
,
2134 .ack_interrupt
= &marvell_ack_interrupt
,
2135 .config_intr
= &marvell_config_intr
,
2136 .did_interrupt
= &m88e1121_did_interrupt
,
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_88E1318S
,
2147 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2148 .name
= "Marvell 88E1318S",
2149 .features
= PHY_GBIT_FEATURES
,
2150 .flags
= PHY_HAS_INTERRUPT
,
2151 .probe
= marvell_probe
,
2152 .config_init
= &m88e1318_config_init
,
2153 .config_aneg
= &m88e1318_config_aneg
,
2154 .read_status
= &marvell_read_status
,
2155 .ack_interrupt
= &marvell_ack_interrupt
,
2156 .config_intr
= &marvell_config_intr
,
2157 .did_interrupt
= &m88e1121_did_interrupt
,
2158 .get_wol
= &m88e1318_get_wol
,
2159 .set_wol
= &m88e1318_set_wol
,
2160 .resume
= &genphy_resume
,
2161 .suspend
= &genphy_suspend
,
2162 .read_page
= marvell_read_page
,
2163 .write_page
= marvell_write_page
,
2164 .get_sset_count
= marvell_get_sset_count
,
2165 .get_strings
= marvell_get_strings
,
2166 .get_stats
= marvell_get_stats
,
2169 .phy_id
= MARVELL_PHY_ID_88E1145
,
2170 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2171 .name
= "Marvell 88E1145",
2172 .features
= PHY_GBIT_FEATURES
,
2173 .flags
= PHY_HAS_INTERRUPT
,
2174 .probe
= marvell_probe
,
2175 .config_init
= &m88e1145_config_init
,
2176 .config_aneg
= &m88e1101_config_aneg
,
2177 .read_status
= &genphy_read_status
,
2178 .ack_interrupt
= &marvell_ack_interrupt
,
2179 .config_intr
= &marvell_config_intr
,
2180 .resume
= &genphy_resume
,
2181 .suspend
= &genphy_suspend
,
2182 .read_page
= marvell_read_page
,
2183 .write_page
= marvell_write_page
,
2184 .get_sset_count
= marvell_get_sset_count
,
2185 .get_strings
= marvell_get_strings
,
2186 .get_stats
= marvell_get_stats
,
2189 .phy_id
= MARVELL_PHY_ID_88E1149R
,
2190 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2191 .name
= "Marvell 88E1149R",
2192 .features
= PHY_GBIT_FEATURES
,
2193 .flags
= PHY_HAS_INTERRUPT
,
2194 .probe
= marvell_probe
,
2195 .config_init
= &m88e1149_config_init
,
2196 .config_aneg
= &m88e1118_config_aneg
,
2197 .ack_interrupt
= &marvell_ack_interrupt
,
2198 .config_intr
= &marvell_config_intr
,
2199 .resume
= &genphy_resume
,
2200 .suspend
= &genphy_suspend
,
2201 .read_page
= marvell_read_page
,
2202 .write_page
= marvell_write_page
,
2203 .get_sset_count
= marvell_get_sset_count
,
2204 .get_strings
= marvell_get_strings
,
2205 .get_stats
= marvell_get_stats
,
2208 .phy_id
= MARVELL_PHY_ID_88E1240
,
2209 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2210 .name
= "Marvell 88E1240",
2211 .features
= PHY_GBIT_FEATURES
,
2212 .flags
= PHY_HAS_INTERRUPT
,
2213 .probe
= marvell_probe
,
2214 .config_init
= &m88e1111_config_init
,
2215 .config_aneg
= &marvell_config_aneg
,
2216 .ack_interrupt
= &marvell_ack_interrupt
,
2217 .config_intr
= &marvell_config_intr
,
2218 .resume
= &genphy_resume
,
2219 .suspend
= &genphy_suspend
,
2220 .read_page
= marvell_read_page
,
2221 .write_page
= marvell_write_page
,
2222 .get_sset_count
= marvell_get_sset_count
,
2223 .get_strings
= marvell_get_strings
,
2224 .get_stats
= marvell_get_stats
,
2227 .phy_id
= MARVELL_PHY_ID_88E1116R
,
2228 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2229 .name
= "Marvell 88E1116R",
2230 .features
= PHY_GBIT_FEATURES
,
2231 .flags
= PHY_HAS_INTERRUPT
,
2232 .probe
= marvell_probe
,
2233 .config_init
= &m88e1116r_config_init
,
2234 .ack_interrupt
= &marvell_ack_interrupt
,
2235 .config_intr
= &marvell_config_intr
,
2236 .resume
= &genphy_resume
,
2237 .suspend
= &genphy_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
,
2245 .phy_id
= MARVELL_PHY_ID_88E1510
,
2246 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2247 .name
= "Marvell 88E1510",
2248 .features
= PHY_GBIT_FEATURES
| SUPPORTED_FIBRE
,
2249 .flags
= PHY_HAS_INTERRUPT
,
2250 .probe
= &m88e1510_probe
,
2251 .config_init
= &m88e1510_config_init
,
2252 .config_aneg
= &m88e1510_config_aneg
,
2253 .read_status
= &marvell_read_status
,
2254 .ack_interrupt
= &marvell_ack_interrupt
,
2255 .config_intr
= &marvell_config_intr
,
2256 .did_interrupt
= &m88e1121_did_interrupt
,
2257 .get_wol
= &m88e1318_get_wol
,
2258 .set_wol
= &m88e1318_set_wol
,
2259 .resume
= &marvell_resume
,
2260 .suspend
= &marvell_suspend
,
2261 .read_page
= marvell_read_page
,
2262 .write_page
= marvell_write_page
,
2263 .get_sset_count
= marvell_get_sset_count
,
2264 .get_strings
= marvell_get_strings
,
2265 .get_stats
= marvell_get_stats
,
2266 .set_loopback
= genphy_loopback
,
2269 .phy_id
= MARVELL_PHY_ID_88E1540
,
2270 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2271 .name
= "Marvell 88E1540",
2272 .features
= PHY_GBIT_FEATURES
,
2273 .flags
= PHY_HAS_INTERRUPT
,
2274 .probe
= m88e1510_probe
,
2275 .config_init
= &marvell_config_init
,
2276 .config_aneg
= &m88e1510_config_aneg
,
2277 .read_status
= &marvell_read_status
,
2278 .ack_interrupt
= &marvell_ack_interrupt
,
2279 .config_intr
= &marvell_config_intr
,
2280 .did_interrupt
= &m88e1121_did_interrupt
,
2281 .resume
= &genphy_resume
,
2282 .suspend
= &genphy_suspend
,
2283 .read_page
= marvell_read_page
,
2284 .write_page
= marvell_write_page
,
2285 .get_sset_count
= marvell_get_sset_count
,
2286 .get_strings
= marvell_get_strings
,
2287 .get_stats
= marvell_get_stats
,
2290 .phy_id
= MARVELL_PHY_ID_88E1545
,
2291 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2292 .name
= "Marvell 88E1545",
2293 .probe
= m88e1510_probe
,
2294 .features
= PHY_GBIT_FEATURES
,
2295 .flags
= PHY_HAS_INTERRUPT
,
2296 .config_init
= &marvell_config_init
,
2297 .config_aneg
= &m88e1510_config_aneg
,
2298 .read_status
= &marvell_read_status
,
2299 .ack_interrupt
= &marvell_ack_interrupt
,
2300 .config_intr
= &marvell_config_intr
,
2301 .did_interrupt
= &m88e1121_did_interrupt
,
2302 .resume
= &genphy_resume
,
2303 .suspend
= &genphy_suspend
,
2304 .read_page
= marvell_read_page
,
2305 .write_page
= marvell_write_page
,
2306 .get_sset_count
= marvell_get_sset_count
,
2307 .get_strings
= marvell_get_strings
,
2308 .get_stats
= marvell_get_stats
,
2311 .phy_id
= MARVELL_PHY_ID_88E3016
,
2312 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2313 .name
= "Marvell 88E3016",
2314 .features
= PHY_BASIC_FEATURES
,
2315 .flags
= PHY_HAS_INTERRUPT
,
2316 .probe
= marvell_probe
,
2317 .config_init
= &m88e3016_config_init
,
2318 .aneg_done
= &marvell_aneg_done
,
2319 .read_status
= &marvell_read_status
,
2320 .ack_interrupt
= &marvell_ack_interrupt
,
2321 .config_intr
= &marvell_config_intr
,
2322 .did_interrupt
= &m88e1121_did_interrupt
,
2323 .resume
= &genphy_resume
,
2324 .suspend
= &genphy_suspend
,
2325 .read_page
= marvell_read_page
,
2326 .write_page
= marvell_write_page
,
2327 .get_sset_count
= marvell_get_sset_count
,
2328 .get_strings
= marvell_get_strings
,
2329 .get_stats
= marvell_get_stats
,
2332 .phy_id
= MARVELL_PHY_ID_88E6390
,
2333 .phy_id_mask
= MARVELL_PHY_ID_MASK
,
2334 .name
= "Marvell 88E6390",
2335 .features
= PHY_GBIT_FEATURES
,
2336 .flags
= PHY_HAS_INTERRUPT
,
2337 .probe
= m88e6390_probe
,
2338 .config_init
= &marvell_config_init
,
2339 .config_aneg
= &m88e6390_config_aneg
,
2340 .read_status
= &marvell_read_status
,
2341 .ack_interrupt
= &marvell_ack_interrupt
,
2342 .config_intr
= &marvell_config_intr
,
2343 .did_interrupt
= &m88e1121_did_interrupt
,
2344 .resume
= &genphy_resume
,
2345 .suspend
= &genphy_suspend
,
2346 .read_page
= marvell_read_page
,
2347 .write_page
= marvell_write_page
,
2348 .get_sset_count
= marvell_get_sset_count
,
2349 .get_strings
= marvell_get_strings
,
2350 .get_stats
= marvell_get_stats
,
2354 module_phy_driver(marvell_drivers
);
2356 static struct mdio_device_id __maybe_unused marvell_tbl
[] = {
2357 { MARVELL_PHY_ID_88E1101
, MARVELL_PHY_ID_MASK
},
2358 { MARVELL_PHY_ID_88E1112
, MARVELL_PHY_ID_MASK
},
2359 { MARVELL_PHY_ID_88E1111
, MARVELL_PHY_ID_MASK
},
2360 { MARVELL_PHY_ID_88E1118
, MARVELL_PHY_ID_MASK
},
2361 { MARVELL_PHY_ID_88E1121R
, MARVELL_PHY_ID_MASK
},
2362 { MARVELL_PHY_ID_88E1145
, MARVELL_PHY_ID_MASK
},
2363 { MARVELL_PHY_ID_88E1149R
, MARVELL_PHY_ID_MASK
},
2364 { MARVELL_PHY_ID_88E1240
, MARVELL_PHY_ID_MASK
},
2365 { MARVELL_PHY_ID_88E1318S
, MARVELL_PHY_ID_MASK
},
2366 { MARVELL_PHY_ID_88E1116R
, MARVELL_PHY_ID_MASK
},
2367 { MARVELL_PHY_ID_88E1510
, MARVELL_PHY_ID_MASK
},
2368 { MARVELL_PHY_ID_88E1540
, MARVELL_PHY_ID_MASK
},
2369 { MARVELL_PHY_ID_88E1545
, MARVELL_PHY_ID_MASK
},
2370 { MARVELL_PHY_ID_88E3016
, MARVELL_PHY_ID_MASK
},
2371 { MARVELL_PHY_ID_88E6390
, MARVELL_PHY_ID_MASK
},
2375 MODULE_DEVICE_TABLE(mdio
, marvell_tbl
);