cxgb4: Add warning msg when attaching to adapters which have FLASHes smaller than 2Mb
authorHariprasad Shenai <hariprasad@chelsio.com>
Wed, 10 Sep 2014 12:14:30 +0000 (17:44 +0530)
committerDavid S. Miller <davem@davemloft.net>
Wed, 10 Sep 2014 21:01:54 +0000 (14:01 -0700)
Based on original work by Casey Leedom <leedom@chelsio.com>

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
drivers/net/ethernet/chelsio/cxgb4/t4_hw.h

index 586a5f1fba0f73bee7e6a1457631df361ca5cf95..22d7581341a912a3fb1329fdf7445677aa27f2cd 100644 (file)
@@ -3897,6 +3897,10 @@ static int get_flash_params(struct adapter *adap)
        adap->params.sf_size = 1 << info;
        adap->params.sf_fw_start =
                t4_read_reg(adap, CIM_BOOT_CFG) & BOOTADDR_MASK;
+
+       if (adap->params.sf_size < FLASH_MIN_SIZE)
+               dev_warn(adap->pdev_dev, "WARNING!!! FLASH size %#x < %#x!!!\n",
+                        adap->params.sf_size, FLASH_MIN_SIZE);
        return 0;
 }
 
index 06fa583bf914c3710fc8137be5618bbceaf912b2..6833a7b02137d227a3ba6d883902d8b26b119bbe 100644 (file)
@@ -206,6 +206,12 @@ enum {
        FLASH_CFG_START = FLASH_START(FLASH_CFG_START_SEC),
        FLASH_CFG_MAX_SIZE = FLASH_MAX_SIZE(FLASH_CFG_NSECS),
 
+       /* We don't support FLASH devices which can't support the full
+        * standard set of sections which we need for normal
+        * operations.
+        */
+       FLASH_MIN_SIZE = FLASH_CFG_START + FLASH_CFG_MAX_SIZE,
+
        FLASH_FPGA_CFG_START_SEC = 15,
        FLASH_FPGA_CFG_START = FLASH_START(FLASH_FPGA_CFG_START_SEC),