Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
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
5c92aeab
Commit
5c92aeab
authored
5 years ago
by
Antonio Niño Díaz
Committed by
TrustedFirmware Code Review
5 years ago
Browse files
Options
Download
Plain Diff
Merge "hikey960: Fix race condition between hotplug and idles" into integration
parents
c554e1ad
7d76df7d
master
v2.5
v2.5-rc1
v2.5-rc0
v2.4
v2.4-rc2
v2.4-rc1
v2.4-rc0
v2.3
v2.3-rc2
v2.3-rc1
v2.3-rc0
v2.2
v2.2-rc2
v2.2-rc1
v2.2-rc0
arm_cca_v0.2
arm_cca_v0.1
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
plat/hisilicon/hikey960/drivers/pwrc/hisi_pwrc.c
+26
-7
plat/hisilicon/hikey960/drivers/pwrc/hisi_pwrc.c
plat/hisilicon/hikey960/drivers/pwrc/hisi_pwrc.h
+1
-1
plat/hisilicon/hikey960/drivers/pwrc/hisi_pwrc.h
plat/hisilicon/hikey960/hikey960_pm.c
+2
-2
plat/hisilicon/hikey960/hikey960_pm.c
with
29 additions
and
10 deletions
+29
-10
plat/hisilicon/hikey960/drivers/pwrc/hisi_pwrc.c
View file @
5c92aeab
...
@@ -147,13 +147,19 @@ void hisi_clear_cpuidle_flag(unsigned int cluster, unsigned int core)
...
@@ -147,13 +147,19 @@ void hisi_clear_cpuidle_flag(unsigned int cluster, unsigned int core)
}
}
int
hisi_test_ap_suspend_flag
(
unsigned
int
cluster
)
int
hisi_test_ap_suspend_flag
(
void
)
{
{
unsigned
int
val
;
unsigned
int
val1
;
unsigned
int
val2
;
val
=
mmio_read_32
(
CPUIDLE_FLAG_REG
(
cluster
));
val1
=
mmio_read_32
(
CPUIDLE_FLAG_REG
(
0
));
val
&=
AP_SUSPEND_FLAG
;
val1
&=
AP_SUSPEND_FLAG
;
return
!!
val
;
val2
=
mmio_read_32
(
CPUIDLE_FLAG_REG
(
1
));
val2
&=
AP_SUSPEND_FLAG
;
val1
|=
val2
;
return
(
val1
!=
0
);
}
}
void
hisi_set_cluster_pwdn_flag
(
unsigned
int
cluster
,
void
hisi_set_cluster_pwdn_flag
(
unsigned
int
cluster
,
...
@@ -164,7 +170,8 @@ void hisi_set_cluster_pwdn_flag(unsigned int cluster,
...
@@ -164,7 +170,8 @@ void hisi_set_cluster_pwdn_flag(unsigned int cluster,
hisi_cpuhotplug_lock
(
cluster
,
core
);
hisi_cpuhotplug_lock
(
cluster
,
core
);
val
=
mmio_read_32
(
REG_SCBAKDATA3_OFFSET
);
val
=
mmio_read_32
(
REG_SCBAKDATA3_OFFSET
);
val
=
(
value
<<
(
cluster
<<
1
))
|
(
val
&
0xFFFFFFF
);
val
&=
~
(
0x3U
<<
((
2
*
cluster
)
+
28
));
val
|=
(
value
<<
(
2
*
cluster
));
mmio_write_32
(
REG_SCBAKDATA3_OFFSET
,
val
);
mmio_write_32
(
REG_SCBAKDATA3_OFFSET
,
val
);
hisi_cpuhotplug_unlock
(
cluster
,
core
);
hisi_cpuhotplug_unlock
(
cluster
,
core
);
...
@@ -258,6 +265,17 @@ static unsigned int hisi_get_pdc_stat(unsigned int cluster)
...
@@ -258,6 +265,17 @@ static unsigned int hisi_get_pdc_stat(unsigned int cluster)
return
val
;
return
val
;
}
}
static
int
check_hotplug
(
unsigned
int
cluster
,
unsigned
int
boot_flag
)
{
unsigned
int
mask
=
0xF
;
if
(
hisi_test_ap_suspend_flag
()
||
((
boot_flag
&
mask
)
==
mask
))
return
0
;
return
1
;
}
int
hisi_test_pwrdn_allcores
(
unsigned
int
cluster
,
unsigned
int
core
)
int
hisi_test_pwrdn_allcores
(
unsigned
int
cluster
,
unsigned
int
core
)
{
{
unsigned
int
mask
=
0xf
<<
(
core
*
4
);
unsigned
int
mask
=
0xf
<<
(
core
*
4
);
...
@@ -268,7 +286,8 @@ int hisi_test_pwrdn_allcores(unsigned int cluster, unsigned int core)
...
@@ -268,7 +286,8 @@ int hisi_test_pwrdn_allcores(unsigned int cluster, unsigned int core)
mask
=
(
PDC_COREPWRSTAT_MASK
&
(
~
mask
));
mask
=
(
PDC_COREPWRSTAT_MASK
&
(
~
mask
));
pdc_stat
&=
mask
;
pdc_stat
&=
mask
;
if
((
boot_flag
^
cpuidle_flag
)
||
pdc_stat
)
if
((
boot_flag
^
cpuidle_flag
)
||
pdc_stat
||
check_hotplug
(
cluster
,
boot_flag
))
return
0
;
return
0
;
else
else
return
1
;
return
1
;
...
...
This diff is collapsed.
Click to expand it.
plat/hisilicon/hikey960/drivers/pwrc/hisi_pwrc.h
View file @
5c92aeab
...
@@ -39,7 +39,7 @@ void hisi_clear_cpu_boot_flag(unsigned int cluster, unsigned int core);
...
@@ -39,7 +39,7 @@ void hisi_clear_cpu_boot_flag(unsigned int cluster, unsigned int core);
int
cluster_is_powered_on
(
unsigned
int
cluster
);
int
cluster_is_powered_on
(
unsigned
int
cluster
);
void
hisi_enter_core_idle
(
unsigned
int
cluster
,
unsigned
int
core
);
void
hisi_enter_core_idle
(
unsigned
int
cluster
,
unsigned
int
core
);
void
hisi_enter_cluster_idle
(
unsigned
int
cluster
,
unsigned
int
core
);
void
hisi_enter_cluster_idle
(
unsigned
int
cluster
,
unsigned
int
core
);
int
hisi_test_ap_suspend_flag
(
unsigned
int
cluster
);
int
hisi_test_ap_suspend_flag
(
void
);
void
hisi_enter_ap_suspend
(
unsigned
int
cluster
,
unsigned
int
core
);
void
hisi_enter_ap_suspend
(
unsigned
int
cluster
,
unsigned
int
core
);
...
...
This diff is collapsed.
Click to expand it.
plat/hisilicon/hikey960/hikey960_pm.c
View file @
5c92aeab
...
@@ -228,7 +228,7 @@ static void hikey960_pwr_domain_suspend(const psci_power_state_t *target_state)
...
@@ -228,7 +228,7 @@ static void hikey960_pwr_domain_suspend(const psci_power_state_t *target_state)
/* check the SR flag bit to determine
/* check the SR flag bit to determine
* CLUSTER_IDLE_IPC or AP_SR_IPC to send
* CLUSTER_IDLE_IPC or AP_SR_IPC to send
*/
*/
if
(
hisi_test_ap_suspend_flag
(
cluster
))
if
(
hisi_test_ap_suspend_flag
())
hisi_enter_ap_suspend
(
cluster
,
core
);
hisi_enter_ap_suspend
(
cluster
,
core
);
else
else
hisi_enter_cluster_idle
(
cluster
,
core
);
hisi_enter_cluster_idle
(
cluster
,
core
);
...
@@ -268,7 +268,7 @@ hikey960_pwr_domain_suspend_finish(const psci_power_state_t *target_state)
...
@@ -268,7 +268,7 @@ hikey960_pwr_domain_suspend_finish(const psci_power_state_t *target_state)
hisi_clear_cpuidle_flag
(
cluster
,
core
);
hisi_clear_cpuidle_flag
(
cluster
,
core
);
hisi_cpuidle_unlock
(
cluster
,
core
);
hisi_cpuidle_unlock
(
cluster
,
core
);
if
(
hisi_test_ap_suspend_flag
(
cluster
))
{
if
(
hisi_test_ap_suspend_flag
())
{
hikey960_sr_dma_reinit
();
hikey960_sr_dma_reinit
();
gicv2_cpuif_enable
();
gicv2_cpuif_enable
();
console_pl011_register
(
uart_base
,
PL011_UART_CLK_IN_HZ
,
console_pl011_register
(
uart_base
,
PL011_UART_CLK_IN_HZ
,
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help