aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/myri10ge/myri10ge.c55
-rw-r--r--drivers/net/myri10ge/myri10ge_mcp_gen_header.h2
2 files changed, 57 insertions, 0 deletions
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 57bb7f782c3c..a0d4c619e859 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -1911,6 +1911,60 @@ static u32 myri10ge_get_msglevel(struct net_device *netdev)
1911 return mgp->msg_enable; 1911 return mgp->msg_enable;
1912} 1912}
1913 1913
1914/*
1915 * Use a low-level command to change the LED behavior. Rather than
1916 * blinking (which is the normal case), when identify is used, the
1917 * yellow LED turns solid.
1918 */
1919static int myri10ge_led(struct myri10ge_priv *mgp, int on)
1920{
1921 struct mcp_gen_header *hdr;
1922 struct device *dev = &mgp->pdev->dev;
1923 size_t hdr_off, pattern_off, hdr_len;
1924 u32 pattern = 0xfffffffe;
1925
1926 /* find running firmware header */
1927 hdr_off = swab32(readl(mgp->sram + MCP_HEADER_PTR_OFFSET));
1928 if ((hdr_off & 3) || hdr_off + sizeof(*hdr) > mgp->sram_size) {
1929 dev_err(dev, "Running firmware has bad header offset (%d)\n",
1930 (int)hdr_off);
1931 return -EIO;
1932 }
1933 hdr_len = swab32(readl(mgp->sram + hdr_off +
1934 offsetof(struct mcp_gen_header, header_length)));
1935 pattern_off = hdr_off + offsetof(struct mcp_gen_header, led_pattern);
1936 if (pattern_off >= (hdr_len + hdr_off)) {
1937 dev_info(dev, "Firmware does not support LED identification\n");
1938 return -EINVAL;
1939 }
1940 if (!on)
1941 pattern = swab32(readl(mgp->sram + pattern_off + 4));
1942 writel(htonl(pattern), mgp->sram + pattern_off);
1943 return 0;
1944}
1945
1946static int
1947myri10ge_phys_id(struct net_device *netdev, enum ethtool_phys_id_state state)
1948{
1949 struct myri10ge_priv *mgp = netdev_priv(netdev);
1950 int rc;
1951
1952 switch (state) {
1953 case ETHTOOL_ID_ACTIVE:
1954 rc = myri10ge_led(mgp, 1);
1955 break;
1956
1957 case ETHTOOL_ID_INACTIVE:
1958 rc = myri10ge_led(mgp, 0);
1959 break;
1960
1961 default:
1962 rc = -EINVAL;
1963 }
1964
1965 return rc;
1966}
1967
1914static const struct ethtool_ops myri10ge_ethtool_ops = { 1968static const struct ethtool_ops myri10ge_ethtool_ops = {
1915 .get_settings = myri10ge_get_settings, 1969 .get_settings = myri10ge_get_settings,
1916 .get_drvinfo = myri10ge_get_drvinfo, 1970 .get_drvinfo = myri10ge_get_drvinfo,
@@ -1925,6 +1979,7 @@ static const struct ethtool_ops myri10ge_ethtool_ops = {
1925 .get_ethtool_stats = myri10ge_get_ethtool_stats, 1979 .get_ethtool_stats = myri10ge_get_ethtool_stats,
1926 .set_msglevel = myri10ge_set_msglevel, 1980 .set_msglevel = myri10ge_set_msglevel,
1927 .get_msglevel = myri10ge_get_msglevel, 1981 .get_msglevel = myri10ge_get_msglevel,
1982 .set_phys_id = myri10ge_phys_id,
1928}; 1983};
1929 1984
1930static int myri10ge_allocate_rings(struct myri10ge_slice_state *ss) 1985static int myri10ge_allocate_rings(struct myri10ge_slice_state *ss)
diff --git a/drivers/net/myri10ge/myri10ge_mcp_gen_header.h b/drivers/net/myri10ge/myri10ge_mcp_gen_header.h
index 62a1cbab603f..7ec4b864a550 100644
--- a/drivers/net/myri10ge/myri10ge_mcp_gen_header.h
+++ b/drivers/net/myri10ge/myri10ge_mcp_gen_header.h
@@ -45,6 +45,8 @@ struct mcp_gen_header {
45 unsigned bss_addr; /* start of bss */ 45 unsigned bss_addr; /* start of bss */
46 unsigned features; 46 unsigned features;
47 unsigned ee_hdr_addr; 47 unsigned ee_hdr_addr;
48 unsigned led_pattern;
49 unsigned led_pattern_dflt;
48 /* 8 */ 50 /* 8 */
49}; 51};
50 52