Blame view
drivers/net/phy/bcm63xx.c
2.35 KB
a2443fd1a net: phy: Convert... |
1 |
// SPDX-License-Identifier: GPL-2.0+ |
09bb9aa0e MIPS: BCM63XX: Ad... |
2 3 |
/* * Driver for Broadcom 63xx SOCs integrated PHYs |
09bb9aa0e MIPS: BCM63XX: Ad... |
4 |
*/ |
a1cba5613 net: phy: Add Bro... |
5 |
#include "bcm-phy-lib.h" |
09bb9aa0e MIPS: BCM63XX: Ad... |
6 7 8 9 10 11 12 13 14 15 16 17 18 |
#include <linux/module.h> #include <linux/phy.h> #define MII_BCM63XX_IR 0x1a /* interrupt register */ #define MII_BCM63XX_IR_EN 0x4000 /* global interrupt enable */ #define MII_BCM63XX_IR_DUPLEX 0x0800 /* duplex changed */ #define MII_BCM63XX_IR_SPEED 0x0400 /* speed changed */ #define MII_BCM63XX_IR_LINK 0x0200 /* link changed */ #define MII_BCM63XX_IR_GMASK 0x0100 /* global interrupt mask */ MODULE_DESCRIPTION("Broadcom 63xx internal PHY driver"); MODULE_AUTHOR("Maxime Bizon <mbizon@freebox.fr>"); MODULE_LICENSE("GPL"); |
cd33b3e0d net: phy: bcm63xx... |
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
static int bcm63xx_config_intr(struct phy_device *phydev) { int reg, err; reg = phy_read(phydev, MII_BCM63XX_IR); if (reg < 0) return reg; if (phydev->interrupts == PHY_INTERRUPT_ENABLED) reg &= ~MII_BCM63XX_IR_GMASK; else reg |= MII_BCM63XX_IR_GMASK; err = phy_write(phydev, MII_BCM63XX_IR, reg); return err; } |
09bb9aa0e MIPS: BCM63XX: Ad... |
35 36 37 |
static int bcm63xx_config_init(struct phy_device *phydev) { int reg, err; |
719655a14 net: phy: Replace... |
38 |
/* ASYM_PAUSE bit is marked RO in datasheet, so don't cheat */ |
3c1bcc861 net: ethernet: Co... |
39 |
linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, phydev->supported); |
719655a14 net: phy: Replace... |
40 |
|
09bb9aa0e MIPS: BCM63XX: Ad... |
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
reg = phy_read(phydev, MII_BCM63XX_IR); if (reg < 0) return reg; /* Mask interrupts globally. */ reg |= MII_BCM63XX_IR_GMASK; err = phy_write(phydev, MII_BCM63XX_IR, reg); if (err < 0) return err; /* Unmask events we are interested in */ reg = ~(MII_BCM63XX_IR_DUPLEX | MII_BCM63XX_IR_SPEED | MII_BCM63XX_IR_LINK) | MII_BCM63XX_IR_EN; |
a25cc43eb net:phy:bcm63xx: ... |
56 |
return phy_write(phydev, MII_BCM63XX_IR, reg); |
09bb9aa0e MIPS: BCM63XX: Ad... |
57 |
} |
d5bf9071e phylib: Support r... |
58 59 |
static struct phy_driver bcm63xx_driver[] = { { |
09bb9aa0e MIPS: BCM63XX: Ad... |
60 61 62 |
.phy_id = 0x00406000, .phy_id_mask = 0xfffffc00, .name = "Broadcom BCM63XX (1)", |
dcdecdcfe net: phy: switch ... |
63 |
/* PHY_BASIC_FEATURES */ |
a4307c0ec net: phy: remove ... |
64 |
.flags = PHY_IS_INTERNAL, |
09bb9aa0e MIPS: BCM63XX: Ad... |
65 |
.config_init = bcm63xx_config_init, |
a1cba5613 net: phy: Add Bro... |
66 |
.ack_interrupt = bcm_phy_ack_intr, |
cd33b3e0d net: phy: bcm63xx... |
67 |
.config_intr = bcm63xx_config_intr, |
d5bf9071e phylib: Support r... |
68 69 |
}, { /* same phy as above, with just a different OUI */ |
09bb9aa0e MIPS: BCM63XX: Ad... |
70 71 |
.phy_id = 0x002bdc00, .phy_id_mask = 0xfffffc00, |
43de81b06 net: phy: bcm63xx... |
72 |
.name = "Broadcom BCM63XX (2)", |
dcdecdcfe net: phy: switch ... |
73 |
/* PHY_BASIC_FEATURES */ |
a4307c0ec net: phy: remove ... |
74 |
.flags = PHY_IS_INTERNAL, |
09bb9aa0e MIPS: BCM63XX: Ad... |
75 |
.config_init = bcm63xx_config_init, |
a1cba5613 net: phy: Add Bro... |
76 |
.ack_interrupt = bcm_phy_ack_intr, |
cd33b3e0d net: phy: bcm63xx... |
77 |
.config_intr = bcm63xx_config_intr, |
d5bf9071e phylib: Support r... |
78 |
} }; |
09bb9aa0e MIPS: BCM63XX: Ad... |
79 |
|
50fd71507 net: phy: replace... |
80 |
module_phy_driver(bcm63xx_driver); |
4e4f10f64 phylib: Add modul... |
81 |
|
cf93c9458 net/phy: fix many... |
82 |
static struct mdio_device_id __maybe_unused bcm63xx_tbl[] = { |
4e4f10f64 phylib: Add modul... |
83 84 85 86 |
{ 0x00406000, 0xfffffc00 }, { 0x002bdc00, 0xfffffc00 }, { } }; |
0de8655ab PHY: fix typo in ... |
87 |
MODULE_DEVICE_TABLE(mdio, bcm63xx_tbl); |