mirror of https://gitee.com/openkylin/linux.git
cxgb3: Support for Aeluros 2005 PHY
Add support for SR PHY. Auto-detect phy module type, and report type changes. Signed-off-by: Divy Le Ray <divy@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9b1e36566c
commit
1e8820256f
File diff suppressed because it is too large
Load Diff
|
@ -547,7 +547,19 @@ enum {
|
|||
/* PHY interrupt types */
|
||||
enum {
|
||||
cphy_cause_link_change = 1,
|
||||
cphy_cause_fifo_error = 2
|
||||
cphy_cause_fifo_error = 2,
|
||||
cphy_cause_module_change = 4,
|
||||
};
|
||||
|
||||
/* PHY module types */
|
||||
enum {
|
||||
phy_modtype_none,
|
||||
phy_modtype_sr,
|
||||
phy_modtype_lr,
|
||||
phy_modtype_lrm,
|
||||
phy_modtype_twinax,
|
||||
phy_modtype_twinax_long,
|
||||
phy_modtype_unknown
|
||||
};
|
||||
|
||||
/* PHY operations */
|
||||
|
@ -572,7 +584,9 @@ struct cphy_ops {
|
|||
|
||||
/* A PHY instance */
|
||||
struct cphy {
|
||||
int addr; /* PHY address */
|
||||
u8 addr; /* PHY address */
|
||||
u8 modtype; /* PHY module type */
|
||||
short priv; /* scratch pad */
|
||||
unsigned int caps; /* PHY capabilities */
|
||||
struct adapter *adapter; /* associated adapter */
|
||||
const char *desc; /* PHY description */
|
||||
|
@ -794,6 +808,8 @@ int t3_ael1002_phy_prep(struct cphy *phy, struct adapter *adapter,
|
|||
int phy_addr, const struct mdio_ops *mdio_ops);
|
||||
int t3_ael1006_phy_prep(struct cphy *phy, struct adapter *adapter,
|
||||
int phy_addr, const struct mdio_ops *mdio_ops);
|
||||
int t3_ael2005_phy_prep(struct cphy *phy, struct adapter *adapter,
|
||||
int phy_addr, const struct mdio_ops *mdio_ops);
|
||||
int t3_qt2045_phy_prep(struct cphy *phy, struct adapter *adapter, int phy_addr,
|
||||
const struct mdio_ops *mdio_ops);
|
||||
int t3_xaui_direct_phy_prep(struct cphy *phy, struct adapter *adapter,
|
||||
|
|
|
@ -208,6 +208,31 @@ void t3_os_link_changed(struct adapter *adapter, int port_id, int link_stat,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t3_os_phymod_changed - handle PHY module changes
|
||||
* @phy: the PHY reporting the module change
|
||||
* @mod_type: new module type
|
||||
*
|
||||
* This is the OS-dependent handler for PHY module changes. It is
|
||||
* invoked when a PHY module is removed or inserted for any OS-specific
|
||||
* processing.
|
||||
*/
|
||||
void t3_os_phymod_changed(struct adapter *adap, int port_id)
|
||||
{
|
||||
static const char *mod_str[] = {
|
||||
NULL, "SR", "LR", "LRM", "TWINAX", "TWINAX", "unknown"
|
||||
};
|
||||
|
||||
const struct net_device *dev = adap->port[port_id];
|
||||
const struct port_info *pi = netdev_priv(dev);
|
||||
|
||||
if (pi->phy.modtype == phy_modtype_none)
|
||||
printk(KERN_INFO "%s: PHY module unplugged\n", dev->name);
|
||||
else
|
||||
printk(KERN_INFO "%s: %s PHY module inserted\n", dev->name,
|
||||
mod_str[pi->phy.modtype]);
|
||||
}
|
||||
|
||||
static void cxgb_set_rxmode(struct net_device *dev)
|
||||
{
|
||||
struct t3_rx_mode rm;
|
||||
|
|
|
@ -511,7 +511,7 @@ static const struct port_type_info port_types[] = {
|
|||
{ t3_vsc8211_phy_prep },
|
||||
{ NULL},
|
||||
{ t3_xaui_direct_phy_prep },
|
||||
{ NULL },
|
||||
{ t3_ael2005_phy_prep },
|
||||
{ t3_qt2045_phy_prep },
|
||||
{ t3_ael1006_phy_prep },
|
||||
{ NULL },
|
||||
|
@ -1728,6 +1728,8 @@ int t3_phy_intr_handler(struct adapter *adapter)
|
|||
t3_link_changed(adapter, i);
|
||||
if (phy_cause & cphy_cause_fifo_error)
|
||||
p->phy.fifo_errors++;
|
||||
if (phy_cause & cphy_cause_module_change)
|
||||
t3_os_phymod_changed(adapter, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue