mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
memory: renesas-rpc-if: Improve Runtime PM handling
[ Upstream commit bb0b025d72 ]
Convert from the deprecated pm_runtime_get_sync() to the new
pm_runtime_resume_and_get(), and add error checking.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/6f2bd3b2b3d98c5bed541d969900b2ad04f93943.1669213027.git.geert+renesas@glider.be
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Stable-dep-of: 7d189579a287 ("mtd: hyperbus: rpc-if: Add missing MODULE_DEVICE_TABLE")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
aabef6301d
commit
f7ef1b97ce
@@ -303,12 +303,13 @@ int rpcif_hw_init(struct rpcif *rpcif, bool hyperflash)
|
|||||||
{
|
{
|
||||||
struct rpcif_priv *rpc = dev_get_drvdata(rpcif->dev);
|
struct rpcif_priv *rpc = dev_get_drvdata(rpcif->dev);
|
||||||
u32 dummy;
|
u32 dummy;
|
||||||
|
int ret;
|
||||||
|
|
||||||
pm_runtime_get_sync(rpc->dev);
|
ret = pm_runtime_resume_and_get(rpc->dev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
if (rpc->type == RPCIF_RZ_G2L) {
|
if (rpc->type == RPCIF_RZ_G2L) {
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = reset_control_reset(rpc->rstc);
|
ret = reset_control_reset(rpc->rstc);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
@@ -478,7 +479,9 @@ int rpcif_manual_xfer(struct rpcif *rpcif)
|
|||||||
u32 smenr, smcr, pos = 0, max = rpc->bus_size == 2 ? 8 : 4;
|
u32 smenr, smcr, pos = 0, max = rpc->bus_size == 2 ? 8 : 4;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
pm_runtime_get_sync(rpc->dev);
|
ret = pm_runtime_resume_and_get(rpc->dev);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
regmap_update_bits(rpc->regmap, RPCIF_PHYCNT,
|
regmap_update_bits(rpc->regmap, RPCIF_PHYCNT,
|
||||||
RPCIF_PHYCNT_CAL, RPCIF_PHYCNT_CAL);
|
RPCIF_PHYCNT_CAL, RPCIF_PHYCNT_CAL);
|
||||||
@@ -646,11 +649,14 @@ ssize_t rpcif_dirmap_read(struct rpcif *rpcif, u64 offs, size_t len, void *buf)
|
|||||||
struct rpcif_priv *rpc = dev_get_drvdata(rpcif->dev);
|
struct rpcif_priv *rpc = dev_get_drvdata(rpcif->dev);
|
||||||
loff_t from = offs & (rpc->size - 1);
|
loff_t from = offs & (rpc->size - 1);
|
||||||
size_t size = rpc->size - from;
|
size_t size = rpc->size - from;
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (len > size)
|
if (len > size)
|
||||||
len = size;
|
len = size;
|
||||||
|
|
||||||
pm_runtime_get_sync(rpc->dev);
|
ret = pm_runtime_resume_and_get(rpc->dev);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
regmap_update_bits(rpc->regmap, RPCIF_CMNCR, RPCIF_CMNCR_MD, 0);
|
regmap_update_bits(rpc->regmap, RPCIF_CMNCR, RPCIF_CMNCR_MD, 0);
|
||||||
regmap_write(rpc->regmap, RPCIF_DRCR, 0);
|
regmap_write(rpc->regmap, RPCIF_DRCR, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user