diff options
author | Jon Mason <mason@myri.com> | 2011-06-27 01:05:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-06-29 09:02:05 -0400 |
commit | 5dcd846712046d68020e9dfddd7ca491dc138f0d (patch) | |
tree | d0402842baa9dd00e8d37aa02f1abf6e30aa2fbe /drivers/net/myri10ge/myri10ge.c | |
parent | 4b47638ab25d90faf4e5499aecd8812f247181fd (diff) |
myri10ge: add support for set_phys_id
Add myri10ge driver support for the ethtool identify operation.
NOTE: Rather than blinking (which is the normal case), when identify is
used, the yellow LED turns solid.
Signed-off-by: Jon Mason <mason@myri.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/myri10ge/myri10ge.c')
-rw-r--r-- | drivers/net/myri10ge/myri10ge.c | 55 |
1 files changed, 55 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 | */ | ||
1919 | static 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 | |||
1946 | static int | ||
1947 | myri10ge_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 | |||
1914 | static const struct ethtool_ops myri10ge_ethtool_ops = { | 1968 | static 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 | ||
1930 | static int myri10ge_allocate_rings(struct myri10ge_slice_state *ss) | 1985 | static int myri10ge_allocate_rings(struct myri10ge_slice_state *ss) |