liquidio: ddr timeout
authorRaghu Vatsavayi <rvatsavayi@caviumnetworks.com>
Wed, 22 Jun 2016 05:53:15 +0000 (22:53 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 25 Jun 2016 16:08:29 +0000 (12:08 -0400)
Adds support for ddr_timeout during device init.

Signed-off-by: Derek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: Satanand Burla <satananda.burla@caviumnetworks.com>
Signed-off-by: Felix Manlunas <felix.manlunas@caviumnetworks.com>
Signed-off-by: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
Signed-off-by: Raghu Vatsavayi <rvatsavayi@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/liquidio/lio_main.c
drivers/net/ethernet/cavium/liquidio/octeon_device.c

index a8328f2a6747b2634c90c9ec0608678f2e10196e..1a584ebde42cba28b39f6a0a6f1e50f961c84dfa 100644 (file)
@@ -3805,14 +3805,19 @@ static int octeon_device_init(struct octeon_device *octeon_dev)
 
        dev_dbg(&octeon_dev->pci_dev->dev, "Waiting for DDR initialization...\n");
 
-       if (ddr_timeout == 0) {
-               dev_info(&octeon_dev->pci_dev->dev,
-                        "WAITING. Set ddr_timeout to non-zero value to proceed with initialization.\n");
-       }
+       if (ddr_timeout == 0)
+               dev_info(&octeon_dev->pci_dev->dev, "WAITING. Set ddr_timeout to non-zero value to proceed with initialization.\n");
 
        schedule_timeout_uninterruptible(HZ * LIO_RESET_SECS);
 
        /* Wait for the octeon to initialize DDR after the soft-reset. */
+       while (ddr_timeout == 0) {
+               set_current_state(TASK_INTERRUPTIBLE);
+               if (schedule_timeout(HZ / 10)) {
+                       /* user probably pressed Control-C */
+                       return 1;
+               }
+       }
        ret = octeon_wait_for_ddr_init(octeon_dev, &ddr_timeout);
        if (ret) {
                dev_err(&octeon_dev->pci_dev->dev,
index bc4d6af041492928481ba483ca26bf86954841ec..33722072163263e1687b9dde965a7db202abf9e4 100644 (file)
@@ -1284,9 +1284,6 @@ int octeon_wait_for_ddr_init(struct octeon_device *oct, u32 *timeout)
        if (!timeout)
                return ret;
 
-       while (*timeout == 0)
-               schedule_timeout_uninterruptible(HZ / 10);
-
        for (ms = 0; (ret != 0) && ((*timeout == 0) || (ms <= *timeout));
             ms += HZ / 10) {
                ret = octeon_mem_access_ok(oct);