2 * drivers/net/phy/micrel.c
4 * Driver for Micrel PHYs
6 * Author: David J. Choi
8 * Copyright (c) 2010-2013 Micrel, Inc.
9 * Copyright (c) 2014 Johan Hovold <johan@kernel.org>
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
16 * Support : Micrel Phys:
17 * Giga phys: ksz9021, ksz9031
18 * 100/10 Phys : ksz8001, ksz8721, ksz8737, ksz8041
19 * ksz8021, ksz8031, ksz8051,
22 * Switch : ksz8873, ksz886x
25 #include <linux/kernel.h>
26 #include <linux/module.h>
27 #include <linux/phy.h>
28 #include <linux/micrel_phy.h>
30 #include <linux/clk.h>
32 /* Operation Mode Strap Override */
33 #define MII_KSZPHY_OMSO 0x16
34 #define KSZPHY_OMSO_B_CAST_OFF BIT(9)
35 #define KSZPHY_OMSO_RMII_OVERRIDE BIT(1)
36 #define KSZPHY_OMSO_MII_OVERRIDE BIT(0)
38 /* general Interrupt control/status reg in vendor specific block. */
39 #define MII_KSZPHY_INTCS 0x1B
40 #define KSZPHY_INTCS_JABBER BIT(15)
41 #define KSZPHY_INTCS_RECEIVE_ERR BIT(14)
42 #define KSZPHY_INTCS_PAGE_RECEIVE BIT(13)
43 #define KSZPHY_INTCS_PARELLEL BIT(12)
44 #define KSZPHY_INTCS_LINK_PARTNER_ACK BIT(11)
45 #define KSZPHY_INTCS_LINK_DOWN BIT(10)
46 #define KSZPHY_INTCS_REMOTE_FAULT BIT(9)
47 #define KSZPHY_INTCS_LINK_UP BIT(8)
48 #define KSZPHY_INTCS_ALL (KSZPHY_INTCS_LINK_UP |\
49 KSZPHY_INTCS_LINK_DOWN)
52 #define MII_KSZPHY_CTRL_1 0x1e
54 /* PHY Control 2 / PHY Control (if no PHY Control 1) */
55 #define MII_KSZPHY_CTRL_2 0x1f
56 #define MII_KSZPHY_CTRL MII_KSZPHY_CTRL_2
57 /* bitmap of PHY register to set interrupt mode */
58 #define KSZPHY_CTRL_INT_ACTIVE_HIGH BIT(9)
59 #define KSZPHY_RMII_REF_CLK_SEL BIT(7)
61 /* Write/read to/from extended registers */
62 #define MII_KSZPHY_EXTREG 0x0b
63 #define KSZPHY_EXTREG_WRITE 0x8000
65 #define MII_KSZPHY_EXTREG_WRITE 0x0c
66 #define MII_KSZPHY_EXTREG_READ 0x0d
68 /* Extended registers */
69 #define MII_KSZPHY_CLK_CONTROL_PAD_SKEW 0x104
70 #define MII_KSZPHY_RX_DATA_PAD_SKEW 0x105
71 #define MII_KSZPHY_TX_DATA_PAD_SKEW 0x106
77 u16 interrupt_level_mask
;
78 bool has_broadcast_disable
;
79 bool has_rmii_ref_clk_sel
;
83 const struct kszphy_type
*type
;
85 bool rmii_ref_clk_sel
;
86 bool rmii_ref_clk_sel_val
;
89 static const struct kszphy_type ksz8021_type
= {
90 .led_mode_reg
= MII_KSZPHY_CTRL_2
,
91 .has_rmii_ref_clk_sel
= true,
94 static const struct kszphy_type ksz8041_type
= {
95 .led_mode_reg
= MII_KSZPHY_CTRL_1
,
98 static const struct kszphy_type ksz8051_type
= {
99 .led_mode_reg
= MII_KSZPHY_CTRL_2
,
102 static const struct kszphy_type ksz8081_type
= {
103 .led_mode_reg
= MII_KSZPHY_CTRL_2
,
104 .has_broadcast_disable
= true,
105 .has_rmii_ref_clk_sel
= true,
108 static const struct kszphy_type ks8737_type
= {
109 .interrupt_level_mask
= BIT(14),
112 static const struct kszphy_type ksz9021_type
= {
113 .interrupt_level_mask
= BIT(14),
116 static int kszphy_extended_write(struct phy_device
*phydev
,
119 phy_write(phydev
, MII_KSZPHY_EXTREG
, KSZPHY_EXTREG_WRITE
| regnum
);
120 return phy_write(phydev
, MII_KSZPHY_EXTREG_WRITE
, val
);
123 static int kszphy_extended_read(struct phy_device
*phydev
,
126 phy_write(phydev
, MII_KSZPHY_EXTREG
, regnum
);
127 return phy_read(phydev
, MII_KSZPHY_EXTREG_READ
);
130 static int kszphy_ack_interrupt(struct phy_device
*phydev
)
132 /* bit[7..0] int status, which is a read and clear register. */
135 rc
= phy_read(phydev
, MII_KSZPHY_INTCS
);
137 return (rc
< 0) ? rc
: 0;
140 static int kszphy_config_intr(struct phy_device
*phydev
)
142 const struct kszphy_type
*type
= phydev
->drv
->driver_data
;
146 if (type
&& type
->interrupt_level_mask
)
147 mask
= type
->interrupt_level_mask
;
149 mask
= KSZPHY_CTRL_INT_ACTIVE_HIGH
;
151 /* set the interrupt pin active low */
152 temp
= phy_read(phydev
, MII_KSZPHY_CTRL
);
156 phy_write(phydev
, MII_KSZPHY_CTRL
, temp
);
158 /* enable / disable interrupts */
159 if (phydev
->interrupts
== PHY_INTERRUPT_ENABLED
)
160 temp
= KSZPHY_INTCS_ALL
;
164 return phy_write(phydev
, MII_KSZPHY_INTCS
, temp
);
167 static int kszphy_rmii_clk_sel(struct phy_device
*phydev
, bool val
)
171 ctrl
= phy_read(phydev
, MII_KSZPHY_CTRL
);
176 ctrl
|= KSZPHY_RMII_REF_CLK_SEL
;
178 ctrl
&= ~KSZPHY_RMII_REF_CLK_SEL
;
180 return phy_write(phydev
, MII_KSZPHY_CTRL
, ctrl
);
183 static int kszphy_setup_led(struct phy_device
*phydev
, u32 reg
, int val
)
188 case MII_KSZPHY_CTRL_1
:
191 case MII_KSZPHY_CTRL_2
:
198 temp
= phy_read(phydev
, reg
);
204 temp
&= ~(3 << shift
);
205 temp
|= val
<< shift
;
206 rc
= phy_write(phydev
, reg
, temp
);
209 dev_err(&phydev
->dev
, "failed to set led mode\n");
214 /* Disable PHY address 0 as the broadcast address, so that it can be used as a
215 * unique (non-broadcast) address on a shared bus.
217 static int kszphy_broadcast_disable(struct phy_device
*phydev
)
221 ret
= phy_read(phydev
, MII_KSZPHY_OMSO
);
225 ret
= phy_write(phydev
, MII_KSZPHY_OMSO
, ret
| KSZPHY_OMSO_B_CAST_OFF
);
228 dev_err(&phydev
->dev
, "failed to disable broadcast address\n");
233 static int kszphy_config_init(struct phy_device
*phydev
)
235 struct kszphy_priv
*priv
= phydev
->priv
;
236 const struct kszphy_type
*type
;
244 if (type
->has_broadcast_disable
)
245 kszphy_broadcast_disable(phydev
);
247 if (priv
->rmii_ref_clk_sel
) {
248 ret
= kszphy_rmii_clk_sel(phydev
, priv
->rmii_ref_clk_sel_val
);
250 dev_err(&phydev
->dev
, "failed to set rmii reference clock\n");
255 if (priv
->led_mode
>= 0)
256 kszphy_setup_led(phydev
, type
->led_mode_reg
, priv
->led_mode
);
261 static int ksz8021_config_init(struct phy_device
*phydev
)
265 rc
= kszphy_config_init(phydev
);
269 rc
= kszphy_broadcast_disable(phydev
);
271 return rc
< 0 ? rc
: 0;
274 static int ksz9021_load_values_from_of(struct phy_device
*phydev
,
275 struct device_node
*of_node
, u16 reg
,
276 char *field1
, char *field2
,
277 char *field3
, char *field4
)
286 if (!of_property_read_u32(of_node
, field1
, &val1
))
289 if (!of_property_read_u32(of_node
, field2
, &val2
))
292 if (!of_property_read_u32(of_node
, field3
, &val3
))
295 if (!of_property_read_u32(of_node
, field4
, &val4
))
302 newval
= kszphy_extended_read(phydev
, reg
);
307 newval
= ((newval
& 0xfff0) | ((val1
/ PS_TO_REG
) & 0xf) << 0);
310 newval
= ((newval
& 0xff0f) | ((val2
/ PS_TO_REG
) & 0xf) << 4);
313 newval
= ((newval
& 0xf0ff) | ((val3
/ PS_TO_REG
) & 0xf) << 8);
316 newval
= ((newval
& 0x0fff) | ((val4
/ PS_TO_REG
) & 0xf) << 12);
318 return kszphy_extended_write(phydev
, reg
, newval
);
321 static int ksz9021_config_init(struct phy_device
*phydev
)
323 struct device
*dev
= &phydev
->dev
;
324 struct device_node
*of_node
= dev
->of_node
;
326 if (!of_node
&& dev
->parent
->of_node
)
327 of_node
= dev
->parent
->of_node
;
330 ksz9021_load_values_from_of(phydev
, of_node
,
331 MII_KSZPHY_CLK_CONTROL_PAD_SKEW
,
332 "txen-skew-ps", "txc-skew-ps",
333 "rxdv-skew-ps", "rxc-skew-ps");
334 ksz9021_load_values_from_of(phydev
, of_node
,
335 MII_KSZPHY_RX_DATA_PAD_SKEW
,
336 "rxd0-skew-ps", "rxd1-skew-ps",
337 "rxd2-skew-ps", "rxd3-skew-ps");
338 ksz9021_load_values_from_of(phydev
, of_node
,
339 MII_KSZPHY_TX_DATA_PAD_SKEW
,
340 "txd0-skew-ps", "txd1-skew-ps",
341 "txd2-skew-ps", "txd3-skew-ps");
346 #define MII_KSZ9031RN_MMD_CTRL_REG 0x0d
347 #define MII_KSZ9031RN_MMD_REGDATA_REG 0x0e
349 #define KSZ9031_PS_TO_REG 60
351 /* Extended registers */
352 #define MII_KSZ9031RN_CONTROL_PAD_SKEW 4
353 #define MII_KSZ9031RN_RX_DATA_PAD_SKEW 5
354 #define MII_KSZ9031RN_TX_DATA_PAD_SKEW 6
355 #define MII_KSZ9031RN_CLK_PAD_SKEW 8
357 static int ksz9031_extended_write(struct phy_device
*phydev
,
358 u8 mode
, u32 dev_addr
, u32 regnum
, u16 val
)
360 phy_write(phydev
, MII_KSZ9031RN_MMD_CTRL_REG
, dev_addr
);
361 phy_write(phydev
, MII_KSZ9031RN_MMD_REGDATA_REG
, regnum
);
362 phy_write(phydev
, MII_KSZ9031RN_MMD_CTRL_REG
, (mode
<< 14) | dev_addr
);
363 return phy_write(phydev
, MII_KSZ9031RN_MMD_REGDATA_REG
, val
);
366 static int ksz9031_extended_read(struct phy_device
*phydev
,
367 u8 mode
, u32 dev_addr
, u32 regnum
)
369 phy_write(phydev
, MII_KSZ9031RN_MMD_CTRL_REG
, dev_addr
);
370 phy_write(phydev
, MII_KSZ9031RN_MMD_REGDATA_REG
, regnum
);
371 phy_write(phydev
, MII_KSZ9031RN_MMD_CTRL_REG
, (mode
<< 14) | dev_addr
);
372 return phy_read(phydev
, MII_KSZ9031RN_MMD_REGDATA_REG
);
375 static int ksz9031_of_load_skew_values(struct phy_device
*phydev
,
376 struct device_node
*of_node
,
377 u16 reg
, size_t field_sz
,
378 char *field
[], u8 numfields
)
380 int val
[4] = {-1, -2, -3, -4};
387 for (i
= 0; i
< numfields
; i
++)
388 if (!of_property_read_u32(of_node
, field
[i
], val
+ i
))
394 if (matches
< numfields
)
395 newval
= ksz9031_extended_read(phydev
, OP_DATA
, 2, reg
);
399 maxval
= (field_sz
== 4) ? 0xf : 0x1f;
400 for (i
= 0; i
< numfields
; i
++)
401 if (val
[i
] != -(i
+ 1)) {
403 mask
^= maxval
<< (field_sz
* i
);
404 newval
= (newval
& mask
) |
405 (((val
[i
] / KSZ9031_PS_TO_REG
) & maxval
)
409 return ksz9031_extended_write(phydev
, OP_DATA
, 2, reg
, newval
);
412 static int ksz9031_config_init(struct phy_device
*phydev
)
414 struct device
*dev
= &phydev
->dev
;
415 struct device_node
*of_node
= dev
->of_node
;
416 char *clk_skews
[2] = {"rxc-skew-ps", "txc-skew-ps"};
417 char *rx_data_skews
[4] = {
418 "rxd0-skew-ps", "rxd1-skew-ps",
419 "rxd2-skew-ps", "rxd3-skew-ps"
421 char *tx_data_skews
[4] = {
422 "txd0-skew-ps", "txd1-skew-ps",
423 "txd2-skew-ps", "txd3-skew-ps"
425 char *control_skews
[2] = {"txen-skew-ps", "rxdv-skew-ps"};
427 if (!of_node
&& dev
->parent
->of_node
)
428 of_node
= dev
->parent
->of_node
;
431 ksz9031_of_load_skew_values(phydev
, of_node
,
432 MII_KSZ9031RN_CLK_PAD_SKEW
, 5,
435 ksz9031_of_load_skew_values(phydev
, of_node
,
436 MII_KSZ9031RN_CONTROL_PAD_SKEW
, 4,
439 ksz9031_of_load_skew_values(phydev
, of_node
,
440 MII_KSZ9031RN_RX_DATA_PAD_SKEW
, 4,
443 ksz9031_of_load_skew_values(phydev
, of_node
,
444 MII_KSZ9031RN_TX_DATA_PAD_SKEW
, 4,
450 #define KSZ8873MLL_GLOBAL_CONTROL_4 0x06
451 #define KSZ8873MLL_GLOBAL_CONTROL_4_DUPLEX BIT(6)
452 #define KSZ8873MLL_GLOBAL_CONTROL_4_SPEED BIT(4)
453 static int ksz8873mll_read_status(struct phy_device
*phydev
)
458 regval
= phy_read(phydev
, KSZ8873MLL_GLOBAL_CONTROL_4
);
460 regval
= phy_read(phydev
, KSZ8873MLL_GLOBAL_CONTROL_4
);
462 if (regval
& KSZ8873MLL_GLOBAL_CONTROL_4_DUPLEX
)
463 phydev
->duplex
= DUPLEX_HALF
;
465 phydev
->duplex
= DUPLEX_FULL
;
467 if (regval
& KSZ8873MLL_GLOBAL_CONTROL_4_SPEED
)
468 phydev
->speed
= SPEED_10
;
470 phydev
->speed
= SPEED_100
;
473 phydev
->pause
= phydev
->asym_pause
= 0;
478 static int ksz8873mll_config_aneg(struct phy_device
*phydev
)
483 /* This routine returns -1 as an indication to the caller that the
484 * Micrel ksz9021 10/100/1000 PHY does not support standard IEEE
485 * MMD extended PHY registers.
488 ksz9021_rd_mmd_phyreg(struct phy_device
*phydev
, int ptrad
, int devnum
,
494 /* This routine does nothing since the Micrel ksz9021 does not support
495 * standard IEEE MMD extended PHY registers.
498 ksz9021_wr_mmd_phyreg(struct phy_device
*phydev
, int ptrad
, int devnum
,
503 static int kszphy_probe(struct phy_device
*phydev
)
505 const struct kszphy_type
*type
= phydev
->drv
->driver_data
;
506 struct device_node
*np
= phydev
->dev
.of_node
;
507 struct kszphy_priv
*priv
;
511 priv
= devm_kzalloc(&phydev
->dev
, sizeof(*priv
), GFP_KERNEL
);
519 if (type
->led_mode_reg
) {
520 ret
= of_property_read_u32(np
, "micrel,led-mode",
525 if (priv
->led_mode
> 3) {
526 dev_err(&phydev
->dev
, "invalid led mode: 0x%02x\n",
534 clk
= devm_clk_get(&phydev
->dev
, "rmii-ref");
536 unsigned long rate
= clk_get_rate(clk
);
537 bool rmii_ref_clk_sel_25_mhz
;
539 priv
->rmii_ref_clk_sel
= type
->has_rmii_ref_clk_sel
;
540 rmii_ref_clk_sel_25_mhz
= of_property_read_bool(np
,
541 "micrel,rmii-reference-clock-select-25-mhz");
543 if (rate
> 24500000 && rate
< 25500000) {
544 priv
->rmii_ref_clk_sel_val
= rmii_ref_clk_sel_25_mhz
;
545 } else if (rate
> 49500000 && rate
< 50500000) {
546 priv
->rmii_ref_clk_sel_val
= !rmii_ref_clk_sel_25_mhz
;
548 dev_err(&phydev
->dev
, "Clock rate out of range: %ld\n", rate
);
553 /* Support legacy board-file configuration */
554 if (phydev
->dev_flags
& MICREL_PHY_50MHZ_CLK
) {
555 priv
->rmii_ref_clk_sel
= true;
556 priv
->rmii_ref_clk_sel_val
= true;
562 static struct phy_driver ksphy_driver
[] = {
564 .phy_id
= PHY_ID_KS8737
,
565 .phy_id_mask
= 0x00fffff0,
566 .name
= "Micrel KS8737",
567 .features
= (PHY_BASIC_FEATURES
| SUPPORTED_Pause
),
568 .flags
= PHY_HAS_MAGICANEG
| PHY_HAS_INTERRUPT
,
569 .driver_data
= &ks8737_type
,
570 .config_init
= kszphy_config_init
,
571 .config_aneg
= genphy_config_aneg
,
572 .read_status
= genphy_read_status
,
573 .ack_interrupt
= kszphy_ack_interrupt
,
574 .config_intr
= kszphy_config_intr
,
575 .suspend
= genphy_suspend
,
576 .resume
= genphy_resume
,
577 .driver
= { .owner
= THIS_MODULE
,},
579 .phy_id
= PHY_ID_KSZ8021
,
580 .phy_id_mask
= 0x00ffffff,
581 .name
= "Micrel KSZ8021 or KSZ8031",
582 .features
= (PHY_BASIC_FEATURES
| SUPPORTED_Pause
|
583 SUPPORTED_Asym_Pause
),
584 .flags
= PHY_HAS_MAGICANEG
| PHY_HAS_INTERRUPT
,
585 .driver_data
= &ksz8021_type
,
586 .probe
= kszphy_probe
,
587 .config_init
= ksz8021_config_init
,
588 .config_aneg
= genphy_config_aneg
,
589 .read_status
= genphy_read_status
,
590 .ack_interrupt
= kszphy_ack_interrupt
,
591 .config_intr
= kszphy_config_intr
,
592 .suspend
= genphy_suspend
,
593 .resume
= genphy_resume
,
594 .driver
= { .owner
= THIS_MODULE
,},
596 .phy_id
= PHY_ID_KSZ8031
,
597 .phy_id_mask
= 0x00ffffff,
598 .name
= "Micrel KSZ8031",
599 .features
= (PHY_BASIC_FEATURES
| SUPPORTED_Pause
|
600 SUPPORTED_Asym_Pause
),
601 .flags
= PHY_HAS_MAGICANEG
| PHY_HAS_INTERRUPT
,
602 .driver_data
= &ksz8021_type
,
603 .probe
= kszphy_probe
,
604 .config_init
= ksz8021_config_init
,
605 .config_aneg
= genphy_config_aneg
,
606 .read_status
= genphy_read_status
,
607 .ack_interrupt
= kszphy_ack_interrupt
,
608 .config_intr
= kszphy_config_intr
,
609 .suspend
= genphy_suspend
,
610 .resume
= genphy_resume
,
611 .driver
= { .owner
= THIS_MODULE
,},
613 .phy_id
= PHY_ID_KSZ8041
,
614 .phy_id_mask
= 0x00fffff0,
615 .name
= "Micrel KSZ8041",
616 .features
= (PHY_BASIC_FEATURES
| SUPPORTED_Pause
617 | SUPPORTED_Asym_Pause
),
618 .flags
= PHY_HAS_MAGICANEG
| PHY_HAS_INTERRUPT
,
619 .driver_data
= &ksz8041_type
,
620 .probe
= kszphy_probe
,
621 .config_init
= kszphy_config_init
,
622 .config_aneg
= genphy_config_aneg
,
623 .read_status
= genphy_read_status
,
624 .ack_interrupt
= kszphy_ack_interrupt
,
625 .config_intr
= kszphy_config_intr
,
626 .suspend
= genphy_suspend
,
627 .resume
= genphy_resume
,
628 .driver
= { .owner
= THIS_MODULE
,},
630 .phy_id
= PHY_ID_KSZ8041RNLI
,
631 .phy_id_mask
= 0x00fffff0,
632 .name
= "Micrel KSZ8041RNLI",
633 .features
= PHY_BASIC_FEATURES
|
634 SUPPORTED_Pause
| SUPPORTED_Asym_Pause
,
635 .flags
= PHY_HAS_MAGICANEG
| PHY_HAS_INTERRUPT
,
636 .driver_data
= &ksz8041_type
,
637 .probe
= kszphy_probe
,
638 .config_init
= kszphy_config_init
,
639 .config_aneg
= genphy_config_aneg
,
640 .read_status
= genphy_read_status
,
641 .ack_interrupt
= kszphy_ack_interrupt
,
642 .config_intr
= kszphy_config_intr
,
643 .suspend
= genphy_suspend
,
644 .resume
= genphy_resume
,
645 .driver
= { .owner
= THIS_MODULE
,},
647 .phy_id
= PHY_ID_KSZ8051
,
648 .phy_id_mask
= 0x00fffff0,
649 .name
= "Micrel KSZ8051",
650 .features
= (PHY_BASIC_FEATURES
| SUPPORTED_Pause
651 | SUPPORTED_Asym_Pause
),
652 .flags
= PHY_HAS_MAGICANEG
| PHY_HAS_INTERRUPT
,
653 .driver_data
= &ksz8051_type
,
654 .probe
= kszphy_probe
,
655 .config_init
= kszphy_config_init
,
656 .config_aneg
= genphy_config_aneg
,
657 .read_status
= genphy_read_status
,
658 .ack_interrupt
= kszphy_ack_interrupt
,
659 .config_intr
= kszphy_config_intr
,
660 .suspend
= genphy_suspend
,
661 .resume
= genphy_resume
,
662 .driver
= { .owner
= THIS_MODULE
,},
664 .phy_id
= PHY_ID_KSZ8001
,
665 .name
= "Micrel KSZ8001 or KS8721",
666 .phy_id_mask
= 0x00ffffff,
667 .features
= (PHY_BASIC_FEATURES
| SUPPORTED_Pause
),
668 .flags
= PHY_HAS_MAGICANEG
| PHY_HAS_INTERRUPT
,
669 .driver_data
= &ksz8041_type
,
670 .probe
= kszphy_probe
,
671 .config_init
= kszphy_config_init
,
672 .config_aneg
= genphy_config_aneg
,
673 .read_status
= genphy_read_status
,
674 .ack_interrupt
= kszphy_ack_interrupt
,
675 .config_intr
= kszphy_config_intr
,
676 .suspend
= genphy_suspend
,
677 .resume
= genphy_resume
,
678 .driver
= { .owner
= THIS_MODULE
,},
680 .phy_id
= PHY_ID_KSZ8081
,
681 .name
= "Micrel KSZ8081 or KSZ8091",
682 .phy_id_mask
= 0x00fffff0,
683 .features
= (PHY_BASIC_FEATURES
| SUPPORTED_Pause
),
684 .flags
= PHY_HAS_MAGICANEG
| PHY_HAS_INTERRUPT
,
685 .driver_data
= &ksz8081_type
,
686 .probe
= kszphy_probe
,
687 .config_init
= kszphy_config_init
,
688 .config_aneg
= genphy_config_aneg
,
689 .read_status
= genphy_read_status
,
690 .ack_interrupt
= kszphy_ack_interrupt
,
691 .config_intr
= kszphy_config_intr
,
692 .suspend
= genphy_suspend
,
693 .resume
= genphy_resume
,
694 .driver
= { .owner
= THIS_MODULE
,},
696 .phy_id
= PHY_ID_KSZ8061
,
697 .name
= "Micrel KSZ8061",
698 .phy_id_mask
= 0x00fffff0,
699 .features
= (PHY_BASIC_FEATURES
| SUPPORTED_Pause
),
700 .flags
= PHY_HAS_MAGICANEG
| PHY_HAS_INTERRUPT
,
701 .config_init
= kszphy_config_init
,
702 .config_aneg
= genphy_config_aneg
,
703 .read_status
= genphy_read_status
,
704 .ack_interrupt
= kszphy_ack_interrupt
,
705 .config_intr
= kszphy_config_intr
,
706 .suspend
= genphy_suspend
,
707 .resume
= genphy_resume
,
708 .driver
= { .owner
= THIS_MODULE
,},
710 .phy_id
= PHY_ID_KSZ9021
,
711 .phy_id_mask
= 0x000ffffe,
712 .name
= "Micrel KSZ9021 Gigabit PHY",
713 .features
= (PHY_GBIT_FEATURES
| SUPPORTED_Pause
),
714 .flags
= PHY_HAS_MAGICANEG
| PHY_HAS_INTERRUPT
,
715 .driver_data
= &ksz9021_type
,
716 .config_init
= ksz9021_config_init
,
717 .config_aneg
= genphy_config_aneg
,
718 .read_status
= genphy_read_status
,
719 .ack_interrupt
= kszphy_ack_interrupt
,
720 .config_intr
= kszphy_config_intr
,
721 .suspend
= genphy_suspend
,
722 .resume
= genphy_resume
,
723 .read_mmd_indirect
= ksz9021_rd_mmd_phyreg
,
724 .write_mmd_indirect
= ksz9021_wr_mmd_phyreg
,
725 .driver
= { .owner
= THIS_MODULE
, },
727 .phy_id
= PHY_ID_KSZ9031
,
728 .phy_id_mask
= 0x00fffff0,
729 .name
= "Micrel KSZ9031 Gigabit PHY",
730 .features
= (PHY_GBIT_FEATURES
| SUPPORTED_Pause
),
731 .flags
= PHY_HAS_MAGICANEG
| PHY_HAS_INTERRUPT
,
732 .driver_data
= &ksz9021_type
,
733 .config_init
= ksz9031_config_init
,
734 .config_aneg
= genphy_config_aneg
,
735 .read_status
= genphy_read_status
,
736 .ack_interrupt
= kszphy_ack_interrupt
,
737 .config_intr
= kszphy_config_intr
,
738 .suspend
= genphy_suspend
,
739 .resume
= genphy_resume
,
740 .driver
= { .owner
= THIS_MODULE
, },
742 .phy_id
= PHY_ID_KSZ8873MLL
,
743 .phy_id_mask
= 0x00fffff0,
744 .name
= "Micrel KSZ8873MLL Switch",
745 .features
= (SUPPORTED_Pause
| SUPPORTED_Asym_Pause
),
746 .flags
= PHY_HAS_MAGICANEG
,
747 .config_init
= kszphy_config_init
,
748 .config_aneg
= ksz8873mll_config_aneg
,
749 .read_status
= ksz8873mll_read_status
,
750 .suspend
= genphy_suspend
,
751 .resume
= genphy_resume
,
752 .driver
= { .owner
= THIS_MODULE
, },
754 .phy_id
= PHY_ID_KSZ886X
,
755 .phy_id_mask
= 0x00fffff0,
756 .name
= "Micrel KSZ886X Switch",
757 .features
= (PHY_BASIC_FEATURES
| SUPPORTED_Pause
),
758 .flags
= PHY_HAS_MAGICANEG
| PHY_HAS_INTERRUPT
,
759 .config_init
= kszphy_config_init
,
760 .config_aneg
= genphy_config_aneg
,
761 .read_status
= genphy_read_status
,
762 .suspend
= genphy_suspend
,
763 .resume
= genphy_resume
,
764 .driver
= { .owner
= THIS_MODULE
, },
767 module_phy_driver(ksphy_driver
);
769 MODULE_DESCRIPTION("Micrel PHY driver");
770 MODULE_AUTHOR("David J. Choi");
771 MODULE_LICENSE("GPL");
773 static struct mdio_device_id __maybe_unused micrel_tbl
[] = {
774 { PHY_ID_KSZ9021
, 0x000ffffe },
775 { PHY_ID_KSZ9031
, 0x00fffff0 },
776 { PHY_ID_KSZ8001
, 0x00ffffff },
777 { PHY_ID_KS8737
, 0x00fffff0 },
778 { PHY_ID_KSZ8021
, 0x00ffffff },
779 { PHY_ID_KSZ8031
, 0x00ffffff },
780 { PHY_ID_KSZ8041
, 0x00fffff0 },
781 { PHY_ID_KSZ8051
, 0x00fffff0 },
782 { PHY_ID_KSZ8061
, 0x00fffff0 },
783 { PHY_ID_KSZ8081
, 0x00fffff0 },
784 { PHY_ID_KSZ8873MLL
, 0x00fffff0 },
785 { PHY_ID_KSZ886X
, 0x00fffff0 },
789 MODULE_DEVICE_TABLE(mdio
, micrel_tbl
);