bna: Implement FW Download for New HW
authorRasesh Mody <rmody@brocade.com>
Tue, 27 Sep 2011 10:39:07 +0000 (10:39 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 29 Sep 2011 23:36:35 +0000 (19:36 -0400)
Add new device ID 0x22 and new asic generation BFI_ASIC_GEN_CT2 for 1860.
Implement FW download from user space for new Brocade HW.

Signed-off-by: Gurunatha Karaje <gkaraje@brocade.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/brocade/bna/bfa_defs.h
drivers/net/ethernet/brocade/bna/bfi.h
drivers/net/ethernet/brocade/bna/bnad.c
drivers/net/ethernet/brocade/bna/cna.h
drivers/net/ethernet/brocade/bna/cna_fwimg.c

index 66a62072c05d8694efcedbc4dfe753bf439cbd88..f9d4100f919d8be7e94deda837ff68628c598f14 100644 (file)
@@ -261,6 +261,13 @@ struct bfa_mfg_block {
  * ---------------------- pci definitions ------------
  */
 
+/*
+ * PCI device ID information
+ */
+enum {
+       BFA_PCI_DEVICE_ID_CT2           = 0x22,
+};
+
 #define bfa_asic_id_ct(device)                 \
        ((device) == PCI_DEVICE_ID_BROCADE_CT ||        \
         (device) == PCI_DEVICE_ID_BROCADE_CT_FC)
index 4e04c140c84c97503b0e74ca7cab71ed5da65514..54bcafe4d5577941190d522f4305b5375fe15fca 100644 (file)
@@ -159,6 +159,7 @@ enum bfi_mclass {
 enum bfi_asic_gen {
        BFI_ASIC_GEN_CB         = 1,
        BFI_ASIC_GEN_CT         = 2,
+       BFI_ASIC_GEN_CT2        = 3,
 };
 
 enum bfi_asic_mode {
index db6c0978899b20db9401fa37a5219957296842fc..320f11c76e149e66244b04b940032a21eea75897 100644 (file)
@@ -3477,3 +3477,4 @@ MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Brocade 10G PCIe Ethernet driver");
 MODULE_VERSION(BNAD_VERSION);
 MODULE_FIRMWARE(CNA_FW_FILE_CT);
+MODULE_FIRMWARE(CNA_FW_FILE_CT2);
index cb4874210aa3d20009715b60bbf23bc0885ab8bf..1b3e90dfbd9a40d4cb9c0614411e83f1605b2d7b 100644 (file)
@@ -38,6 +38,7 @@
 extern char bfa_version[];
 
 #define        CNA_FW_FILE_CT  "ctfw.bin"
+#define        CNA_FW_FILE_CT2 "ct2fw.bin"
 #define FC_SYMNAME_MAX 256     /*!< max name server symbolic name size */
 
 #pragma pack(1)
index e8f4ecd9ebb5cd8c70235d891899673059bb76a3..725b9fff337f8bbd5d3c95358bee976521147318 100644 (file)
  * www.brocade.com
  */
 #include <linux/firmware.h>
+#include "bfi.h"
 #include "cna.h"
 
 const struct firmware *bfi_fw;
-static u32 *bfi_image_ct_cna;
-static u32 bfi_image_ct_cna_size;
+static u32 *bfi_image_ct_cna, *bfi_image_ct2_cna;
+static u32 bfi_image_ct_cna_size, bfi_image_ct2_cna_size;
 
 static u32 *
 cna_read_firmware(struct pci_dev *pdev, u32 **bfi_image,
@@ -45,20 +46,47 @@ error:
 u32 *
 cna_get_firmware_buf(struct pci_dev *pdev)
 {
-       if (bfi_image_ct_cna_size == 0)
-               cna_read_firmware(pdev, &bfi_image_ct_cna,
-                       &bfi_image_ct_cna_size, CNA_FW_FILE_CT);
-       return bfi_image_ct_cna;
+       if (pdev->device == BFA_PCI_DEVICE_ID_CT2) {
+               if (bfi_image_ct2_cna_size == 0)
+                       cna_read_firmware(pdev, &bfi_image_ct2_cna,
+                               &bfi_image_ct2_cna_size, CNA_FW_FILE_CT2);
+               return bfi_image_ct2_cna;
+       } else if (bfa_asic_id_ct(pdev->device)) {
+               if (bfi_image_ct_cna_size == 0)
+                       cna_read_firmware(pdev, &bfi_image_ct_cna,
+                               &bfi_image_ct_cna_size, CNA_FW_FILE_CT);
+               return bfi_image_ct_cna;
+       }
+
+       return NULL;
 }
 
 u32 *
-bfa_cb_image_get_chunk(int type, u32 off)
+bfa_cb_image_get_chunk(enum bfi_asic_gen asic_gen, u32 off)
 {
-       return (u32 *)(bfi_image_ct_cna + off);
+       switch (asic_gen) {
+       case BFI_ASIC_GEN_CT:
+               return (u32 *)(bfi_image_ct_cna + off);
+               break;
+       case BFI_ASIC_GEN_CT2:
+               return (u32 *)(bfi_image_ct2_cna + off);
+               break;
+       default:
+               return NULL;
+       }
 }
 
 u32
-bfa_cb_image_get_size(int type)
+bfa_cb_image_get_size(enum bfi_asic_gen asic_gen)
 {
-       return bfi_image_ct_cna_size;
+       switch (asic_gen) {
+       case BFI_ASIC_GEN_CT:
+               return bfi_image_ct_cna_size;
+               break;
+       case BFI_ASIC_GEN_CT2:
+               return bfi_image_ct2_cna_size;
+               break;
+       default:
+               return 0;
+       }
 }