Skip to content

Commit 2b66f02

Browse files
MrVanabelvesa
authored andcommitted
clk: imx: clk-composite-93: check white_list
The CCM ROOT AUTHEN register WHITE_LIST indicate: Each bit in this field represent for one domain. Bit16~Bit31 represent for DOMAIN0~DOMAIN15 respectively. Only corresponding bit of the domains is set to 1 can change the registers of this Clock Root. i.MX93 DID is 3, so if BIT(3 + WHITE_LIST_SHIFT) is 0, the clk should be set to read only. To make the imx93_clk_composite_flags be reusable, add a new parameter named did(domain id); Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Ye Li <ye.li@nxp.com> Reviewed-by: Jacky Bai <ping.bai@nxp.com> Reviewed-by: Abel Vesa <abel.vesa@linaro.org> Signed-off-by: Abel Vesa <abel.vesa@linaro.org> Link: https://lore.kernel.org/r/20220830033137.4149542-5-peng.fan@oss.nxp.com
1 parent 4a3de5a commit 2b66f02

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

drivers/clk/imx/clk-composite-93.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#define TZ_NS_SHIFT 9
2929
#define TZ_NS_MASK BIT(9)
3030

31+
#define WHITE_LIST_SHIFT 16
32+
3133
static int imx93_clk_composite_wait_ready(struct clk_hw *hw, void __iomem *reg)
3234
{
3335
int ret;
@@ -180,7 +182,7 @@ static const struct clk_ops imx93_clk_composite_mux_ops = {
180182
};
181183

182184
struct clk_hw *imx93_clk_composite_flags(const char *name, const char * const *parent_names,
183-
int num_parents, void __iomem *reg,
185+
int num_parents, void __iomem *reg, u32 domain_id,
184186
unsigned long flags)
185187
{
186188
struct clk_hw *hw = ERR_PTR(-ENOMEM), *mux_hw;
@@ -189,6 +191,7 @@ struct clk_hw *imx93_clk_composite_flags(const char *name, const char * const *p
189191
struct clk_gate *gate = NULL;
190192
struct clk_mux *mux = NULL;
191193
bool clk_ro = false;
194+
u32 authen;
192195

193196
mux = kzalloc(sizeof(*mux), GFP_KERNEL);
194197
if (!mux)
@@ -211,7 +214,8 @@ struct clk_hw *imx93_clk_composite_flags(const char *name, const char * const *p
211214
div->lock = &imx_ccm_lock;
212215
div->flags = CLK_DIVIDER_ROUND_CLOSEST;
213216

214-
if (!(readl(reg + AUTHEN_OFFSET) & TZ_NS_MASK))
217+
authen = readl(reg + AUTHEN_OFFSET);
218+
if (!(authen & TZ_NS_MASK) || !(authen & BIT(WHITE_LIST_SHIFT + domain_id)))
215219
clk_ro = true;
216220

217221
if (clk_ro) {

drivers/clk/imx/clk-imx93.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ static int imx93_clocks_probe(struct platform_device *pdev)
293293
root = &root_array[i];
294294
clks[root->clk] = imx93_clk_composite_flags(root->name,
295295
parent_names[root->sel],
296-
4, base + root->off,
296+
4, base + root->off, 3,
297297
root->flags);
298298
}
299299

drivers/clk/imx/clk.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,10 @@ struct clk_hw *imx93_clk_composite_flags(const char *name,
445445
const char * const *parent_names,
446446
int num_parents,
447447
void __iomem *reg,
448+
u32 domain_id,
448449
unsigned long flags);
449-
#define imx93_clk_composite(name, parent_names, num_parents, reg) \
450-
imx93_clk_composite_flags(name, parent_names, num_parents, reg, \
450+
#define imx93_clk_composite(name, parent_names, num_parents, reg, domain_id) \
451+
imx93_clk_composite_flags(name, parent_names, num_parents, reg, domain_id \
451452
CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE)
452453

453454
struct clk_hw *imx_clk_hw_divider_gate(const char *name, const char *parent_name,

0 commit comments

Comments
 (0)