提交 1e882025 编写于 作者: D Divy Le Ray 提交者: David S. Miller

cxgb3: Support for Aeluros 2005 PHY

Add support for SR PHY.
Auto-detect phy module type, and report type changes.
Signed-off-by: NDivy Le Ray <divy@chelsio.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 9b1e3656
此差异已折叠。
...@@ -547,7 +547,19 @@ enum { ...@@ -547,7 +547,19 @@ enum {
/* PHY interrupt types */ /* PHY interrupt types */
enum { enum {
cphy_cause_link_change = 1, 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 */ /* PHY operations */
...@@ -572,7 +584,9 @@ struct cphy_ops { ...@@ -572,7 +584,9 @@ struct cphy_ops {
/* A PHY instance */ /* A PHY instance */
struct cphy { struct cphy {
int addr; /* PHY address */ u8 addr; /* PHY address */
u8 modtype; /* PHY module type */
short priv; /* scratch pad */
unsigned int caps; /* PHY capabilities */ unsigned int caps; /* PHY capabilities */
struct adapter *adapter; /* associated adapter */ struct adapter *adapter; /* associated adapter */
const char *desc; /* PHY description */ const char *desc; /* PHY description */
...@@ -794,6 +808,8 @@ int t3_ael1002_phy_prep(struct cphy *phy, struct adapter *adapter, ...@@ -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 phy_addr, const struct mdio_ops *mdio_ops);
int t3_ael1006_phy_prep(struct cphy *phy, struct adapter *adapter, int t3_ael1006_phy_prep(struct cphy *phy, struct adapter *adapter,
int phy_addr, const struct mdio_ops *mdio_ops); 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, int t3_qt2045_phy_prep(struct cphy *phy, struct adapter *adapter, int phy_addr,
const struct mdio_ops *mdio_ops); const struct mdio_ops *mdio_ops);
int t3_xaui_direct_phy_prep(struct cphy *phy, struct adapter *adapter, 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, ...@@ -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) static void cxgb_set_rxmode(struct net_device *dev)
{ {
struct t3_rx_mode rm; struct t3_rx_mode rm;
......
...@@ -511,7 +511,7 @@ static const struct port_type_info port_types[] = { ...@@ -511,7 +511,7 @@ static const struct port_type_info port_types[] = {
{ t3_vsc8211_phy_prep }, { t3_vsc8211_phy_prep },
{ NULL}, { NULL},
{ t3_xaui_direct_phy_prep }, { t3_xaui_direct_phy_prep },
{ NULL }, { t3_ael2005_phy_prep },
{ t3_qt2045_phy_prep }, { t3_qt2045_phy_prep },
{ t3_ael1006_phy_prep }, { t3_ael1006_phy_prep },
{ NULL }, { NULL },
...@@ -1728,6 +1728,8 @@ int t3_phy_intr_handler(struct adapter *adapter) ...@@ -1728,6 +1728,8 @@ int t3_phy_intr_handler(struct adapter *adapter)
t3_link_changed(adapter, i); t3_link_changed(adapter, i);
if (phy_cause & cphy_cause_fifo_error) if (phy_cause & cphy_cause_fifo_error)
p->phy.fifo_errors++; p->phy.fifo_errors++;
if (phy_cause & cphy_cause_module_change)
t3_os_phymod_changed(adapter, i);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册