From: Brett Creeley There's a chance the register signature value is set before the firmware is ready to respond to the driver. This doesn't mean the device isn't there, but just means it's not yet ready. If the first devcmd fails, then return -EPROBE_DEFER so the device can be probed at a later time. As part of this make sure the reset devcmd, which is the first devcmd, is not so alarming when it fails by printing an information message instead of the standard devcmd failure messages. Note, that the ionic_reset() function could be reworked a bit to keep retrying if err is -EAGAIN or -ETIMEDOUT, but for now I chose not to change this as 5 seconds should be enough for the firmware to come up after the devcmd registers are initialized. Fixes: fbfb8031533c ("ionic: Add hardware init and device commands") Signed-off-by: Brett Creeley Signed-off-by: Eric Joyner --- drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c | 8 ++++++-- drivers/net/ethernet/pensando/ionic/ionic_main.c | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c index 05f19489ec5c..59ce35404e53 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c @@ -260,7 +260,8 @@ static int ionic_setup_one(struct ionic *ionic) /* Configure the device */ err = ionic_setup(ionic); if (err) { - dev_err(dev, "Cannot setup device: %d, aborting\n", err); + if (err != -EPROBE_DEFER) + dev_err(dev, "Cannot setup device: %d, aborting\n", err); goto err_out_clear_pci; } pci_set_master(pdev); @@ -335,8 +336,11 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) #endif err = ionic_setup_one(ionic); - if (err) + if (err) { + if (err == -EPROBE_DEFER) + dev_info(dev, "Device isn't ready, deferring probe\n"); goto err_out; + } /* Allocate and init the LIF */ err = ionic_lif_size(ionic); diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c index 3c5200e2fdb7..91f89b9ff807 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_main.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c @@ -603,7 +603,11 @@ int ionic_setup(struct ionic *ionic) err = ionic_dev_setup(ionic); if (err) return err; - ionic_reset(ionic); + + err = ionic_reset(ionic); + /* firmware may not be ready to respond yet */ + if (err == -EAGAIN || err == -ETIMEDOUT) + return -EPROBE_DEFER; return 0; } @@ -687,7 +691,7 @@ int ionic_reset(struct ionic *ionic) mutex_lock(&ionic->dev_cmd_lock); ionic_dev_cmd_reset(idev); - err = ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT); + err = ionic_dev_cmd_wait_nomsg(ionic, DEVCMD_TIMEOUT); mutex_unlock(&ionic->dev_cmd_lock); return err; -- 2.17.1