Skip to content
Snippets Groups Projects
Commit 70487ff3 authored by Ye Li's avatar Ye Li Committed by Stefano Babic
Browse files

imx8mm: Load fuse for TMU TCALIV and TASR


On iMX8MM, the default value of TMU registers TCALIV and TASR need
be loaded from fuse. HW won't do this, it expect SW loads them before
using TMU.

Reviewed-by: default avatarBai Ping <ping.bai@nxp.com>
Signed-off-by: default avatarYe Li <ye.li@nxp.com>
Signed-off-by: default avatarPeng Fan <peng.fan@nxp.com>
parent 634fe73e
No related branches found
No related tags found
No related merge requests found
// SPDX-License-Identifier: GPL-2.0+ // SPDX-License-Identifier: GPL-2.0+
/* /*
* Copyright 2017 NXP * Copyright 2017-2019 NXP
* *
* Peng Fan <peng.fan@nxp.com> * Peng Fan <peng.fan@nxp.com>
*/ */
...@@ -448,3 +448,29 @@ int arch_misc_init(void) ...@@ -448,3 +448,29 @@ int arch_misc_init(void)
return 0; return 0;
} }
#endif #endif
void imx_tmu_arch_init(void *reg_base)
{
if (is_imx8mm()) {
/* Load TCALIV and TASR from fuses */
struct ocotp_regs *ocotp =
(struct ocotp_regs *)OCOTP_BASE_ADDR;
struct fuse_bank *bank = &ocotp->bank[3];
struct fuse_bank3_regs *fuse =
(struct fuse_bank3_regs *)bank->fuse_regs;
u32 tca_rt, tca_hr, tca_en;
u32 buf_vref, buf_slope;
tca_rt = fuse->ana0 & 0xFF;
tca_hr = (fuse->ana0 & 0xFF00) >> 8;
tca_en = (fuse->ana0 & 0x2000000) >> 25;
buf_vref = (fuse->ana0 & 0x1F00000) >> 20;
buf_slope = (fuse->ana0 & 0xF0000) >> 16;
writel(buf_vref | (buf_slope << 16), (ulong)reg_base + 0x28);
writel((tca_en << 31) | (tca_hr << 16) | tca_rt,
(ulong)reg_base + 0x30);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment