MLK-20886-10 imx8-power-domain: Check resource partition in probing the PD

If the resource is not owned by current partition, we can't power on/off
it, so we'd better return probe failure.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 327115c1d490d35afd94ae416ad91bebd595cfe2)
This commit is contained in:
Ye Li 2019-01-30 22:37:25 -08:00
parent 4d4715081c
commit 2795341aaa
1 changed files with 9 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2017 NXP
* Copyright 2017-2019 NXP
*
* SPDX-License-Identifier: GPL-2.0
*/
@ -262,6 +262,7 @@ static int imx8_power_domain_ofdata_to_platdata(struct udevice *dev)
{
int reg;
struct imx8_power_domain_platdata *pdata = dev_get_platdata(dev);
sc_ipc_t ipcHndl = gd->arch.ipc_channel_handle;
reg = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg", -1);
if (reg == -1) {
@ -272,6 +273,13 @@ static int imx8_power_domain_ofdata_to_platdata(struct udevice *dev)
debug("%s resource_id %d\n", __func__, pdata->resource_id);
if (pdata->resource_id != SC_R_LAST) {
if (!sc_rm_is_resource_owned(ipcHndl, pdata->resource_id)) {
debug("%s [%d] not owned by curr partition\n", dev->name, pdata->resource_id);
return -EINVAL;
}
}
return 0;
}