*/
static void readwriter(struct pl022 *pl022)
{
-
/*
* The FIFO depth is different between primecell variants.
* I believe filling in too much in the FIFO might cause
master->cleanup = pl022_cleanup;
master->setup = pl022_setup;
/* If open CONFIG_PM, auto_runtime_pm should be false when of-platform.*/
- if (platform_flag)
- master->auto_runtime_pm = false;
- else
- master->auto_runtime_pm = true;
+ master->auto_runtime_pm = true;
master->transfer_one_message = pl022_transfer_one_message;
master->unprepare_transfer_hardware = pl022_unprepare_transfer_hardware;
master->rt = platform_info->rt;
/* Register with the SPI framework */
amba_set_drvdata(adev, pl022);
+
if (platform_flag)
status = spi_register_master(master);
else
goto err_spi_register;
}
dev_dbg(dev, "probe succeeded\n");
-
+ if (!platform_flag)
+ platform_info->autosuspend_delay = 100;
/* let runtime pm put suspend */
if (platform_info->autosuspend_delay > 0) {
dev_info(&adev->dev,
platform_info->autosuspend_delay);
pm_runtime_use_autosuspend(dev);
}
- pm_runtime_put(dev);
+ if (platform_flag)
+ clk_disable_unprepare(pl022->clk);
+ else
+ pm_runtime_put(dev);
return 0;
pinctrl_pm_select_sleep_state(dev);
- dev_dbg(dev, "suspended\n");
+ dev_dbg(dev, "starfive spi suspended\n");
+
return 0;
}
/* Start the queue running */
ret = spi_master_resume(pl022->master);
if (!ret)
- dev_dbg(dev, "resumed\n");
+ dev_dbg(dev, "starfive spi resumed\n");
return ret;
}
clk_disable_unprepare(pl022->clk);
pinctrl_pm_select_idle_state(dev);
+ dev_dbg(dev, "starfive spi runtime suspend");
+
return 0;
}
pinctrl_pm_select_default_state(dev);
clk_prepare_enable(pl022->clk);
+ dev_dbg(dev, "stafive spi runtime resume");
return 0;
}
#endif
if (ret)
goto err_probe;
- pm_runtime_get_noresume(dev);
- pm_runtime_set_active(dev);
- pm_runtime_enable(dev);
-
ret = pl022_probe(pcdev, &id);
+ struct pl022 *pl022 = amba_get_drvdata(pcdev);
+
+ pl022->master->dev.parent = &pdev->dev;
+ platform_set_drvdata(pdev, pl022);
+
+ pm_runtime_enable(&pdev->dev);
+ pm_runtime_set_autosuspend_delay(&pdev->dev, 100);
+ pm_runtime_use_autosuspend(&pdev->dev);
+
if (ret) {
pm_runtime_disable(dev);
pm_runtime_set_suspended(dev);
size = resource_size(pdev->resource);
release_mem_region(pdev->resource->start, size);
tasklet_disable(&pl022->pump_transfers);
+ pm_runtime_disable(&pdev->dev);
+
return 0;
}