aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3/cxgb3_main.c
diff options
context:
space:
mode:
authorDivy Le Ray <divy@chelsio.com>2007-08-29 22:15:52 -0400
committerJeff Garzik <jeff@garzik.org>2007-08-31 07:29:08 -0400
commit47330077650a25d417155848516b2cba97999602 (patch)
treec2e34f0771a34dc74f30806b537b9f9b7a75b311 /drivers/net/cxgb3/cxgb3_main.c
parent5fbf816fe7d72bfdbf22bfec05b4ec3aa6849f72 (diff)
- cxgb3 engine microcode load
Load the engine microcode when an interface is brought up, instead of of doing it when the module is loaded. Loosen up tight binding between the driver and the engine microcode version. There is no need for microcode update with T3A boards. Fix the file naming. Do a better job at logging the loading activity. Signed-off-by: Divy Le Ray <divy@chelsio.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/cxgb3/cxgb3_main.c')
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c126
1 files changed, 81 insertions, 45 deletions
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index f3bf1283c9a7..5ab319cfe5de 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -729,6 +729,7 @@ static void bind_qsets(struct adapter *adap)
729} 729}
730 730
731#define FW_FNAME "t3fw-%d.%d.%d.bin" 731#define FW_FNAME "t3fw-%d.%d.%d.bin"
732#define TPSRAM_NAME "t3%c_protocol_sram-%d.%d.%d.bin"
732 733
733static int upgrade_fw(struct adapter *adap) 734static int upgrade_fw(struct adapter *adap)
734{ 735{
@@ -747,6 +748,71 @@ static int upgrade_fw(struct adapter *adap)
747 } 748 }
748 ret = t3_load_fw(adap, fw->data, fw->size); 749 ret = t3_load_fw(adap, fw->data, fw->size);
749 release_firmware(fw); 750 release_firmware(fw);
751
752 if (ret == 0)
753 dev_info(dev, "successful upgrade to firmware %d.%d.%d\n",
754 FW_VERSION_MAJOR, FW_VERSION_MINOR, FW_VERSION_MICRO);
755 else
756 dev_err(dev, "failed to upgrade to firmware %d.%d.%d\n",
757 FW_VERSION_MAJOR, FW_VERSION_MINOR, FW_VERSION_MICRO);
758
759 return ret;
760}
761
762static inline char t3rev2char(struct adapter *adapter)
763{
764 char rev = 0;
765
766 switch(adapter->params.rev) {
767 case T3_REV_B:
768 case T3_REV_B2:
769 rev = 'b';
770 break;
771 }
772 return rev;
773}
774
775int update_tpsram(struct adapter *adap)
776{
777 const struct firmware *tpsram;
778 char buf[64];
779 struct device *dev = &adap->pdev->dev;
780 int ret;
781 char rev;
782
783 rev = t3rev2char(adap);
784 if (!rev)
785 return 0;
786
787 snprintf(buf, sizeof(buf), TPSRAM_NAME, rev,
788 TP_VERSION_MAJOR, TP_VERSION_MINOR, TP_VERSION_MICRO);
789
790 ret = request_firmware(&tpsram, buf, dev);
791 if (ret < 0) {
792 dev_err(dev, "could not load TP SRAM: unable to load %s\n",
793 buf);
794 return ret;
795 }
796
797 ret = t3_check_tpsram(adap, tpsram->data, tpsram->size);
798 if (ret)
799 goto release_tpsram;
800
801 ret = t3_set_proto_sram(adap, tpsram->data);
802 if (ret == 0)
803 dev_info(dev,
804 "successful update of protocol engine "
805 "to %d.%d.%d\n",
806 TP_VERSION_MAJOR, TP_VERSION_MINOR, TP_VERSION_MICRO);
807 else
808 dev_err(dev, "failed to update of protocol engine %d.%d.%d\n",
809 TP_VERSION_MAJOR, TP_VERSION_MINOR, TP_VERSION_MICRO);
810 if (ret)
811 dev_err(dev, "loading protocol SRAM failed\n");
812
813release_tpsram:
814 release_firmware(tpsram);
815
750 return ret; 816 return ret;
751} 817}
752 818
@@ -763,6 +829,7 @@ static int upgrade_fw(struct adapter *adap)
763static int cxgb_up(struct adapter *adap) 829static int cxgb_up(struct adapter *adap)
764{ 830{
765 int err = 0; 831 int err = 0;
832 int must_load;
766 833
767 if (!(adap->flags & FULL_INIT_DONE)) { 834 if (!(adap->flags & FULL_INIT_DONE)) {
768 err = t3_check_fw_version(adap); 835 err = t3_check_fw_version(adap);
@@ -771,6 +838,13 @@ static int cxgb_up(struct adapter *adap)
771 if (err) 838 if (err)
772 goto out; 839 goto out;
773 840
841 err = t3_check_tpsram_version(adap, &must_load);
842 if (err == -EINVAL) {
843 err = update_tpsram(adap);
844 if (err && must_load)
845 goto out;
846 }
847
774 err = init_dummy_netdevs(adap); 848 err = init_dummy_netdevs(adap);
775 if (err) 849 if (err)
776 goto out; 850 goto out;
@@ -1110,8 +1184,10 @@ static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
1110 struct port_info *pi = netdev_priv(dev); 1184 struct port_info *pi = netdev_priv(dev);
1111 struct adapter *adapter = pi->adapter; 1185 struct adapter *adapter = pi->adapter;
1112 u32 fw_vers = 0; 1186 u32 fw_vers = 0;
1187 u32 tp_vers = 0;
1113 1188
1114 t3_get_fw_version(adapter, &fw_vers); 1189 t3_get_fw_version(adapter, &fw_vers);
1190 t3_get_tp_version(adapter, &tp_vers);
1115 1191
1116 strcpy(info->driver, DRV_NAME); 1192 strcpy(info->driver, DRV_NAME);
1117 strcpy(info->version, DRV_VERSION); 1193 strcpy(info->version, DRV_VERSION);
@@ -1120,11 +1196,14 @@ static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
1120 strcpy(info->fw_version, "N/A"); 1196 strcpy(info->fw_version, "N/A");
1121 else { 1197 else {
1122 snprintf(info->fw_version, sizeof(info->fw_version), 1198 snprintf(info->fw_version, sizeof(info->fw_version),
1123 "%s %u.%u.%u", 1199 "%s %u.%u.%u TP %u.%u.%u",
1124 G_FW_VERSION_TYPE(fw_vers) ? "T" : "N", 1200 G_FW_VERSION_TYPE(fw_vers) ? "T" : "N",
1125 G_FW_VERSION_MAJOR(fw_vers), 1201 G_FW_VERSION_MAJOR(fw_vers),
1126 G_FW_VERSION_MINOR(fw_vers), 1202 G_FW_VERSION_MINOR(fw_vers),
1127 G_FW_VERSION_MICRO(fw_vers)); 1203 G_FW_VERSION_MICRO(fw_vers),
1204 G_TP_VERSION_MAJOR(tp_vers),
1205 G_TP_VERSION_MINOR(tp_vers),
1206 G_TP_VERSION_MICRO(tp_vers));
1128 } 1207 }
1129} 1208}
1130 1209
@@ -2107,42 +2186,6 @@ static void cxgb_netpoll(struct net_device *dev)
2107} 2186}
2108#endif 2187#endif
2109 2188
2110#define TPSRAM_NAME "t3%c_protocol_sram-%d.%d.%d.bin"
2111int update_tpsram(struct adapter *adap)
2112{
2113 const struct firmware *tpsram;
2114 char buf[64];
2115 struct device *dev = &adap->pdev->dev;
2116 int ret;
2117 char rev;
2118
2119 rev = adap->params.rev == T3_REV_B2 ? 'b' : 'a';
2120
2121 snprintf(buf, sizeof(buf), TPSRAM_NAME, rev,
2122 TP_VERSION_MAJOR, TP_VERSION_MINOR, TP_VERSION_MICRO);
2123
2124 ret = request_firmware(&tpsram, buf, dev);
2125 if (ret < 0) {
2126 dev_err(dev, "could not load TP SRAM: unable to load %s\n",
2127 buf);
2128 return ret;
2129 }
2130
2131 ret = t3_check_tpsram(adap, tpsram->data, tpsram->size);
2132 if (ret)
2133 goto release_tpsram;
2134
2135 ret = t3_set_proto_sram(adap, tpsram->data);
2136 if (ret)
2137 dev_err(dev, "loading protocol SRAM failed\n");
2138
2139release_tpsram:
2140 release_firmware(tpsram);
2141
2142 return ret;
2143}
2144
2145
2146/* 2189/*
2147 * Periodic accumulation of MAC statistics. 2190 * Periodic accumulation of MAC statistics.
2148 */ 2191 */
@@ -2491,13 +2534,6 @@ static int __devinit init_one(struct pci_dev *pdev,
2491 err = -ENODEV; 2534 err = -ENODEV;
2492 goto out_free_dev; 2535 goto out_free_dev;
2493 } 2536 }
2494
2495 err = t3_check_tpsram_version(adapter);
2496 if (err == -EINVAL)
2497 err = update_tpsram(adapter);
2498
2499 if (err)
2500 goto out_free_dev;
2501 2537
2502 /* 2538 /*
2503 * The card is now ready to go. If any errors occur during device 2539 * The card is now ready to go. If any errors occur during device