aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlge
diff options
context:
space:
mode:
authorRon Mercer <ron.mercer@qlogic.com>2009-10-21 07:07:39 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-22 00:45:40 -0400
commitd8eb59dc8b9e77bb4fa5420ff80142759ad5cd7b (patch)
treed0b331eca84dabceae8463ec119743907fabcd3b /drivers/net/qlge
parent1d30df24ec85477368e6e38fe1b4d1b67b3be9d4 (diff)
qlge: Add ethtool blink function.
Signed-off-by: Ron Mercer <ron.mercer@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlge')
-rw-r--r--drivers/net/qlge/qlge.h6
-rw-r--r--drivers/net/qlge/qlge_ethtool.c28
-rw-r--r--drivers/net/qlge/qlge_mpi.c55
3 files changed, 89 insertions, 0 deletions
diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h
index 6118f50b00a2..a5bb3a536538 100644
--- a/drivers/net/qlge/qlge.h
+++ b/drivers/net/qlge/qlge.h
@@ -805,6 +805,9 @@ enum {
805 MB_CMD_SET_PORT_CFG = 0x00000122, 805 MB_CMD_SET_PORT_CFG = 0x00000122,
806 MB_CMD_GET_PORT_CFG = 0x00000123, 806 MB_CMD_GET_PORT_CFG = 0x00000123,
807 MB_CMD_GET_LINK_STS = 0x00000124, 807 MB_CMD_GET_LINK_STS = 0x00000124,
808 MB_CMD_SET_LED_CFG = 0x00000125, /* Set LED Configuration Register */
809 QL_LED_BLINK = 0x03e803e8,
810 MB_CMD_GET_LED_CFG = 0x00000126, /* Get LED Configuration Register */
808 MB_CMD_SET_MGMNT_TFK_CTL = 0x00000160, /* Set Mgmnt Traffic Control */ 811 MB_CMD_SET_MGMNT_TFK_CTL = 0x00000160, /* Set Mgmnt Traffic Control */
809 MB_SET_MPI_TFK_STOP = (1 << 0), 812 MB_SET_MPI_TFK_STOP = (1 << 0),
810 MB_SET_MPI_TFK_RESUME = (1 << 1), 813 MB_SET_MPI_TFK_RESUME = (1 << 1),
@@ -1551,6 +1554,7 @@ struct ql_adapter {
1551 u32 port_init; 1554 u32 port_init;
1552 u32 link_status; 1555 u32 link_status;
1553 u32 link_config; 1556 u32 link_config;
1557 u32 led_config;
1554 u32 max_frame_size; 1558 u32 max_frame_size;
1555 1559
1556 union flash_params flash; 1560 union flash_params flash;
@@ -1642,6 +1646,8 @@ int ql_mb_get_fw_state(struct ql_adapter *qdev);
1642int ql_cam_route_initialize(struct ql_adapter *qdev); 1646int ql_cam_route_initialize(struct ql_adapter *qdev);
1643int ql_read_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 *data); 1647int ql_read_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 *data);
1644int ql_mb_about_fw(struct ql_adapter *qdev); 1648int ql_mb_about_fw(struct ql_adapter *qdev);
1649int ql_mb_set_led_cfg(struct ql_adapter *qdev, u32 led_config);
1650int ql_mb_get_led_cfg(struct ql_adapter *qdev);
1645void ql_link_on(struct ql_adapter *qdev); 1651void ql_link_on(struct ql_adapter *qdev);
1646void ql_link_off(struct ql_adapter *qdev); 1652void ql_link_off(struct ql_adapter *qdev);
1647int ql_mb_set_mgmnt_traffic_ctl(struct ql_adapter *qdev, u32 control); 1653int ql_mb_set_mgmnt_traffic_ctl(struct ql_adapter *qdev, u32 control);
diff --git a/drivers/net/qlge/qlge_ethtool.c b/drivers/net/qlge/qlge_ethtool.c
index dfb5c800cea2..0c0549bc7bde 100644
--- a/drivers/net/qlge/qlge_ethtool.c
+++ b/drivers/net/qlge/qlge_ethtool.c
@@ -371,6 +371,33 @@ static void ql_get_drvinfo(struct net_device *ndev,
371 drvinfo->eedump_len = 0; 371 drvinfo->eedump_len = 0;
372} 372}
373 373
374
375static int ql_phys_id(struct net_device *ndev, u32 data)
376{
377 struct ql_adapter *qdev = netdev_priv(ndev);
378 u32 led_reg, i;
379 int status;
380
381 /* Save the current LED settings */
382 status = ql_mb_get_led_cfg(qdev);
383 if (status)
384 return status;
385 led_reg = qdev->led_config;
386
387 /* Start blinking the led */
388 if (!data || data > 300)
389 data = 300;
390
391 for (i = 0; i < (data * 10); i++)
392 ql_mb_set_led_cfg(qdev, QL_LED_BLINK);
393
394 /* Restore LED settings */
395 status = ql_mb_set_led_cfg(qdev, led_reg);
396 if (status)
397 return status;
398
399 return 0;
400}
374static int ql_get_coalesce(struct net_device *dev, struct ethtool_coalesce *c) 401static int ql_get_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
375{ 402{
376 struct ql_adapter *qdev = netdev_priv(dev); 403 struct ql_adapter *qdev = netdev_priv(dev);
@@ -499,6 +526,7 @@ const struct ethtool_ops qlge_ethtool_ops = {
499 .get_msglevel = ql_get_msglevel, 526 .get_msglevel = ql_get_msglevel,
500 .set_msglevel = ql_set_msglevel, 527 .set_msglevel = ql_set_msglevel,
501 .get_link = ethtool_op_get_link, 528 .get_link = ethtool_op_get_link,
529 .phys_id = ql_phys_id,
502 .get_pauseparam = ql_get_pauseparam, 530 .get_pauseparam = ql_get_pauseparam,
503 .set_pauseparam = ql_set_pauseparam, 531 .set_pauseparam = ql_set_pauseparam,
504 .get_rx_csum = ql_get_rx_csum, 532 .get_rx_csum = ql_get_rx_csum,
diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c
index 81a8489fe21a..14d76f13d1db 100644
--- a/drivers/net/qlge/qlge_mpi.c
+++ b/drivers/net/qlge/qlge_mpi.c
@@ -751,6 +751,61 @@ static int ql_idc_wait(struct ql_adapter *qdev)
751 return status; 751 return status;
752} 752}
753 753
754int ql_mb_set_led_cfg(struct ql_adapter *qdev, u32 led_config)
755{
756 struct mbox_params mbc;
757 struct mbox_params *mbcp = &mbc;
758 int status;
759
760 memset(mbcp, 0, sizeof(struct mbox_params));
761
762 mbcp->in_count = 2;
763 mbcp->out_count = 1;
764
765 mbcp->mbox_in[0] = MB_CMD_SET_LED_CFG;
766 mbcp->mbox_in[1] = led_config;
767
768
769 status = ql_mailbox_command(qdev, mbcp);
770 if (status)
771 return status;
772
773 if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) {
774 QPRINTK(qdev, DRV, ERR,
775 "Failed to set LED Configuration.\n");
776 status = -EIO;
777 }
778
779 return status;
780}
781
782int ql_mb_get_led_cfg(struct ql_adapter *qdev)
783{
784 struct mbox_params mbc;
785 struct mbox_params *mbcp = &mbc;
786 int status;
787
788 memset(mbcp, 0, sizeof(struct mbox_params));
789
790 mbcp->in_count = 1;
791 mbcp->out_count = 2;
792
793 mbcp->mbox_in[0] = MB_CMD_GET_LED_CFG;
794
795 status = ql_mailbox_command(qdev, mbcp);
796 if (status)
797 return status;
798
799 if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) {
800 QPRINTK(qdev, DRV, ERR,
801 "Failed to get LED Configuration.\n");
802 status = -EIO;
803 } else
804 qdev->led_config = mbcp->mbox_out[1];
805
806 return status;
807}
808
754int ql_mb_set_mgmnt_traffic_ctl(struct ql_adapter *qdev, u32 control) 809int ql_mb_set_mgmnt_traffic_ctl(struct ql_adapter *qdev, u32 control)
755{ 810{
756 struct mbox_params mbc; 811 struct mbox_params mbc;