plat: zynqmp: Check for DLL status before doing reset

This patch check for the DLL status before doing the DLL reset.
If DLL reset is already issued then skip the reset inside ATF
otherwise DLL reset will be issued.
By doing this way, all the following cases will be supported.
1. Patched ATF + Patched Linux base.
2. Older ATF + Patched Linux base.
3. Patched ATF + Older Linux base.

Signed-off-by: Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Change-Id: I53a0a27521330f1543275cc9cb44cd1dfc569c65
This commit is contained in:
Sai Krishna Potthuri 2020-10-20 07:00:06 -06:00 committed by Michal Simek
parent d01f31c036
commit 2ab0ef8db9
1 changed files with 21 additions and 6 deletions

View File

@ -282,17 +282,29 @@ static enum pm_ret_status pm_ioctl_sd_set_tapdelay(enum pm_node_id nid,
{
unsigned int shift;
enum pm_ret_status ret;
unsigned int val, mask;
if (nid == NODE_SD_0)
if (nid == NODE_SD_0) {
shift = 0;
else if (nid == NODE_SD_1)
mask = ZYNQMP_SD0_DLL_RST_MASK;
} else if (nid == NODE_SD_1) {
shift = ZYNQMP_SD_TAP_OFFSET;
else
mask = ZYNQMP_SD1_DLL_RST_MASK;
} else {
return PM_RET_ERROR_ARGS;
}
ret = pm_ioctl_sd_dll_reset(nid, PM_DLL_RESET_ASSERT);
if (ret != PM_RET_SUCCESS)
ret = pm_mmio_read(ZYNQMP_SD_DLL_CTRL, &val);
if (ret != PM_RET_SUCCESS) {
return ret;
}
if ((val & mask) == 0) {
ret = pm_ioctl_sd_dll_reset(nid, PM_DLL_RESET_ASSERT);
if (ret != PM_RET_SUCCESS) {
return ret;
}
}
if (type == PM_TAPDELAY_INPUT) {
ret = pm_mmio_write(ZYNQMP_SD_ITAP_DLY,
@ -326,7 +338,10 @@ static enum pm_ret_status pm_ioctl_sd_set_tapdelay(enum pm_node_id nid,
}
reset_release:
pm_ioctl_sd_dll_reset(nid, PM_DLL_RESET_RELEASE);
if ((val & mask) == 0) {
(void)pm_ioctl_sd_dll_reset(nid, PM_DLL_RESET_RELEASE);
}
return ret;
}