Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
9b9c1f3d
Commit
9b9c1f3d
authored
May 28, 2020
by
Mark Dykes
Committed by
TrustedFirmware Code Review
May 28, 2020
Browse files
Merge "drivers: stm32mp1 clocks: prevent crash on always on clocks" into integration
parents
593a43ca
35848200
Changes
1
Hide whitespace changes
Inline
Side-by-side
drivers/st/clk/stm32mp1_clk.c
View file @
9b9c1f3d
...
...
@@ -1029,12 +1029,41 @@ unsigned int stm32mp1_clk_get_refcount(unsigned long id)
return
gate_refcounts
[
i
];
}
/* Oscillators and PLLs are not gated at runtime */
static
bool
clock_is_always_on
(
unsigned
long
id
)
{
switch
(
id
)
{
case
CK_HSE
:
case
CK_CSI
:
case
CK_LSI
:
case
CK_LSE
:
case
CK_HSI
:
case
CK_HSE_DIV2
:
case
PLL1_Q
:
case
PLL1_R
:
case
PLL2_P
:
case
PLL2_Q
:
case
PLL2_R
:
case
PLL3_P
:
case
PLL3_Q
:
case
PLL3_R
:
return
true
;
default:
return
false
;
}
}
void
__stm32mp1_clk_enable
(
unsigned
long
id
,
bool
secure
)
{
const
struct
stm32mp1_clk_gate
*
gate
;
int
i
=
stm32mp1_clk_get_gated_id
(
id
)
;
int
i
;
unsigned
int
*
refcnt
;
if
(
clock_is_always_on
(
id
))
{
return
;
}
i
=
stm32mp1_clk_get_gated_id
(
id
);
if
(
i
<
0
)
{
ERROR
(
"Clock %d can't be enabled
\n
"
,
(
uint32_t
)
id
);
panic
();
...
...
@@ -1055,9 +1084,14 @@ void __stm32mp1_clk_enable(unsigned long id, bool secure)
void
__stm32mp1_clk_disable
(
unsigned
long
id
,
bool
secure
)
{
const
struct
stm32mp1_clk_gate
*
gate
;
int
i
=
stm32mp1_clk_get_gated_id
(
id
)
;
int
i
;
unsigned
int
*
refcnt
;
if
(
clock_is_always_on
(
id
))
{
return
;
}
i
=
stm32mp1_clk_get_gated_id
(
id
);
if
(
i
<
0
)
{
ERROR
(
"Clock %d can't be disabled
\n
"
,
(
uint32_t
)
id
);
panic
();
...
...
@@ -1087,8 +1121,13 @@ void stm32mp_clk_disable(unsigned long id)
bool
stm32mp_clk_is_enabled
(
unsigned
long
id
)
{
int
i
=
stm32mp1_clk_get_gated_id
(
id
)
;
int
i
;
if
(
clock_is_always_on
(
id
))
{
return
true
;
}
i
=
stm32mp1_clk_get_gated_id
(
id
);
if
(
i
<
0
)
{
panic
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment