diff options
author | Rajan Vaja <rajan.vaja@xilinx.com> | 2019-03-05 00:18:08 +0100 |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2019-03-18 13:45:27 +0100 |
commit | 3d0313786470acb414b7d5fdd2202f061acffb02 (patch) | |
tree | 7e34a492da0da9cab34389dfa8125d2e741085ae /drivers/nvmem | |
parent | firmware: xilinx: fix debugfs write handler (diff) | |
download | linux-3d0313786470acb414b7d5fdd2202f061acffb02.tar.xz linux-3d0313786470acb414b7d5fdd2202f061acffb02.zip |
drivers: Defer probe if firmware is not ready
Driver needs ZynqMP firmware interface to call EEMI
APIs. In case firmware is not ready, dependent drivers
should wait until the firmware is ready.
Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com>
Signed-off-by: Jolly Shah <jollys@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'drivers/nvmem')
-rw-r--r-- | drivers/nvmem/zynqmp_nvmem.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/nvmem/zynqmp_nvmem.c b/drivers/nvmem/zynqmp_nvmem.c index 490c8fcaec80..5893543918c8 100644 --- a/drivers/nvmem/zynqmp_nvmem.c +++ b/drivers/nvmem/zynqmp_nvmem.c @@ -16,6 +16,8 @@ struct zynqmp_nvmem_data { struct nvmem_device *nvmem; }; +static const struct zynqmp_eemi_ops *eemi_ops; + static int zynqmp_nvmem_read(void *context, unsigned int offset, void *val, size_t bytes) { @@ -23,9 +25,7 @@ static int zynqmp_nvmem_read(void *context, unsigned int offset, int idcode, version; struct zynqmp_nvmem_data *priv = context; - const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops(); - - if (!eemi_ops || !eemi_ops->get_chipid) + if (!eemi_ops->get_chipid) return -ENXIO; ret = eemi_ops->get_chipid(&idcode, &version); @@ -61,6 +61,10 @@ static int zynqmp_nvmem_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; + eemi_ops = zynqmp_pm_get_eemi_ops(); + if (IS_ERR(eemi_ops)) + return PTR_ERR(eemi_ops); + priv->dev = dev; econfig.dev = dev; econfig.reg_read = zynqmp_nvmem_read; |