diff options
author | Han Xu <han.xu@nxp.com> | 2017-11-07 16:25:17 -0600 |
---|---|---|
committer | Leonard Crestez <leonard.crestez@nxp.com> | 2018-08-24 12:41:33 +0300 |
commit | 6df9c073cb10a0f10d2fc2bea28f8133b5a89a66 (patch) | |
tree | be4570347871713a081d78c4233eb8d74de93cec /drivers/mtd | |
parent | 983f0e31701aa573512f3d6c2f103e5a452fb82a (diff) |
MLK-16769-5: mtd: gpmi-nand runtime pm code change
acquire/release dma in runtime pm resume/suspend to proper get/put dma
resources.
BuildInfo:
- SCFW 60e110f9, IMX-MKIMAGE e131af10, ATF
- U-Boot 2017.03-imx_4.9.51_8qm_beta1_8qxp_alpha+gfcc9bdc
Signed-off-by: Han Xu <han.xu@nxp.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index 9c370a2f273e..9446a1f9a539 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c @@ -900,10 +900,6 @@ static int acquire_resources(struct gpmi_nand_data *this) if (ret) goto exit_regs; - ret = acquire_dma_channels(this); - if (ret) - goto exit_regs; - ret = gpmi_get_clks(this); if (ret) goto exit_clock; @@ -2472,11 +2468,12 @@ static int gpmi_nand_remove(struct platform_device *pdev) #ifdef CONFIG_PM_SLEEP static int gpmi_pm_suspend(struct device *dev) { - struct gpmi_nand_data *this = dev_get_drvdata(dev); + int ret; - release_dma_channels(this); pinctrl_pm_select_sleep_state(dev); - return 0; + ret = pm_runtime_force_suspend(dev); + + return ret; } static int gpmi_pm_resume(struct device *dev) @@ -2484,11 +2481,14 @@ static int gpmi_pm_resume(struct device *dev) struct gpmi_nand_data *this = dev_get_drvdata(dev); int ret; - pinctrl_pm_select_default_state(dev); - - ret = acquire_dma_channels(this); - if (ret < 0) + /* enable clock, acquire dma */ + ret = pm_runtime_force_resume(dev); + if (ret) { + dev_err(this->dev, "Error in resume: %d\n", ret); return ret; + } + + pinctrl_pm_select_default_state(dev); /* re-init the GPMI registers */ this->flags &= ~GPMI_TIMING_INIT_OK; @@ -2521,6 +2521,8 @@ int gpmi_runtime_suspend(struct device *dev) gpmi_disable_clk(this); release_bus_freq(BUS_FREQ_HIGH); + release_dma_channels(this); + return 0; } @@ -2534,6 +2536,11 @@ int gpmi_runtime_resume(struct device *dev) return ret; request_bus_freq(BUS_FREQ_HIGH); + + ret = acquire_dma_channels(this); + if (ret < 0) + return ret; + return 0; } |