Commit 5abbb5ae authored by Mikhail Karpenko's avatar Mikhail Karpenko

Revert "Remove loading deferral from AHCI driver"

This reverts commit 8fc41ee4. Now driver
will wait for sysfs flag to continue loading.
parent e2a9715b
...@@ -96,19 +96,28 @@ static int bitstream_loaded(u32 *ptr) ...@@ -96,19 +96,28 @@ static int bitstream_loaded(u32 *ptr)
return 0; return 0;
} }
static int elphel_check_load(struct device *dev) static void elphel_defer_load(struct device *dev)
{ {
int ret = 0; bool check_flag = true;
u32 *ctrl_ptr = ioremap_nocache(BITSTREAM_CTRL_ADDR, 4); u32 *ctrl_ptr = ioremap_nocache(BITSTREAM_CTRL_ADDR, 4);
if (!bitstream_loaded(ctrl_ptr)) { dev_info(dev, "AHCI driver loading is deferred. Load bitstream and write 1 into "
ret = -1; "/sys/devices/soc0/amba@0/80000000.elphel-ahci/load_module to continue\n");
while (check_flag) {
if (load_driver) {
if (bitstream_loaded(ctrl_ptr)) {
check_flag = false;
} else {
dev_err(dev, "FPGA bitstream is not loaded or bitstream " dev_err(dev, "FPGA bitstream is not loaded or bitstream "
"does not contain AHCI controller. Remove driver, load bitstream and try again\n"); "does not contain AHCI controller\n");
load_driver = false;
}
} else {
msleep(1000);
}
} }
load_driver = false;
iounmap(ctrl_ptr); iounmap(ctrl_ptr);
return ret;
} }
/** Calculate the difference between two time stamps and return it in microseconds */ /** Calculate the difference between two time stamps and return it in microseconds */
...@@ -308,16 +317,12 @@ static int elphel_drv_probe(struct platform_device *pdev) ...@@ -308,16 +317,12 @@ static int elphel_drv_probe(struct platform_device *pdev)
const struct of_device_id *match; const struct of_device_id *match;
struct ata_host *host; struct ata_host *host;
ret = elphel_check_load(dev);
if (ret < 0) {
return ret;
}
if (&dev->kobj) { if (&dev->kobj) {
ret = sysfs_create_group(&dev->kobj, &dev_attr_root_group); ret = sysfs_create_group(&dev->kobj, &dev_attr_root_group);
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
elphel_defer_load(dev);
dev_info(&pdev->dev, "probing Elphel AHCI driver"); dev_info(&pdev->dev, "probing Elphel AHCI driver");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment