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
1eed1b98
Unverified
Commit
1eed1b98
authored
Feb 13, 2019
by
Antonio Niño Díaz
Committed by
GitHub
Feb 13, 2019
Browse files
Merge pull request #1814 from glneo/ti-sci-async
TI-SCI asynchronous power down sequencing
parents
3e310f30
34b3eb14
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
plat/ti/k3/common/drivers/ti_sci/ti_sci.c
View file @
1eed1b98
This diff is collapsed.
Click to expand it.
plat/ti/k3/common/drivers/ti_sci/ti_sci.h
View file @
1eed1b98
...
@@ -16,17 +16,12 @@
...
@@ -16,17 +16,12 @@
/**
/**
* Device control operations
* Device control operations
*
*
* - ti_sci_device_set_state - Set device state helper
* @flags: flags to setup for the device
* @state: State to move the device to
* - ti_sci_device_get_state - Get device state helper
* @clcnt: Pointer to Context Loss Count
* @resets: pointer to resets
* @p_state: pointer to p_state
* @c_state: pointer to c_state
* - ti_sci_device_get - command to request for device managed by TISCI
* - ti_sci_device_get - command to request for device managed by TISCI
* - ti_sci_device_get_exclusive - exclusively request a device
* - ti_sci_device_idle - Command to idle a device managed by TISCI
* - ti_sci_device_idle - Command to idle a device managed by TISCI
* - ti_sci_device_idle_exclusive - exclusively idle a device
* - ti_sci_device_put - command to release a device managed by TISCI
* - ti_sci_device_put - command to release a device managed by TISCI
* - ti_sci_device_put_no_wait - release a device without waiting for response
* - ti_sci_device_is_valid - Is the device valid
* - ti_sci_device_is_valid - Is the device valid
* - ti_sci_device_get_clcnt - Get context loss counter
* - ti_sci_device_get_clcnt - Get context loss counter
* @count: Pointer to Context Loss counter to populate
* @count: Pointer to Context Loss counter to populate
...
@@ -54,12 +49,12 @@
...
@@ -54,12 +49,12 @@
* usage count by balancing get_device with put_device. No refcounting is
* usage count by balancing get_device with put_device. No refcounting is
* managed by driver for that purpose.
* managed by driver for that purpose.
*/
*/
int
ti_sci_device_set_state
(
uint32_t
id
,
uint32_t
flags
,
uint8_t
state
);
int
ti_sci_device_get_state
(
uint32_t
id
,
uint32_t
*
clcnt
,
uint32_t
*
resets
,
uint8_t
*
p_state
,
uint8_t
*
c_state
);
int
ti_sci_device_get
(
uint32_t
id
);
int
ti_sci_device_get
(
uint32_t
id
);
int
ti_sci_device_get_exclusive
(
uint32_t
id
);
int
ti_sci_device_idle
(
uint32_t
id
);
int
ti_sci_device_idle
(
uint32_t
id
);
int
ti_sci_device_idle_exclusive
(
uint32_t
id
);
int
ti_sci_device_put
(
uint32_t
id
);
int
ti_sci_device_put
(
uint32_t
id
);
int
ti_sci_device_put_no_wait
(
uint32_t
id
);
int
ti_sci_device_is_valid
(
uint32_t
id
);
int
ti_sci_device_is_valid
(
uint32_t
id
);
int
ti_sci_device_get_clcnt
(
uint32_t
id
,
uint32_t
*
count
);
int
ti_sci_device_get_clcnt
(
uint32_t
id
,
uint32_t
*
count
);
int
ti_sci_device_is_idle
(
uint32_t
id
,
bool
*
r_state
);
int
ti_sci_device_is_idle
(
uint32_t
id
,
bool
*
r_state
);
...
@@ -72,12 +67,6 @@ int ti_sci_device_get_resets(uint32_t id, uint32_t *reset_state);
...
@@ -72,12 +67,6 @@ int ti_sci_device_get_resets(uint32_t id, uint32_t *reset_state);
/**
/**
* Clock control operations
* Clock control operations
*
*
* - ti_sci_clock_set_state - Set clock state helper
* @flags: Header flags as needed
* @state: State to request for the clock.
* - ti_sci_clock_get_state - Get clock state helper
* @programmed_state: State requested for clock to move to
* @current_state: State that the clock is currently in
* - ti_sci_clock_get - Get control of a clock from TI SCI
* - ti_sci_clock_get - Get control of a clock from TI SCI
* @needs_ssc: 'true' iff Spread Spectrum clock is desired
* @needs_ssc: 'true' iff Spread Spectrum clock is desired
* @can_change_freq: 'true' iff frequency change is desired
* @can_change_freq: 'true' iff frequency change is desired
...
@@ -123,10 +112,6 @@ int ti_sci_device_get_resets(uint32_t id, uint32_t *reset_state);
...
@@ -123,10 +112,6 @@ int ti_sci_device_get_resets(uint32_t id, uint32_t *reset_state);
* usage count by balancing get_clock with put_clock. No refcounting is
* usage count by balancing get_clock with put_clock. No refcounting is
* managed by driver for that purpose.
* managed by driver for that purpose.
*/
*/
int
ti_sci_clock_set_state
(
uint32_t
dev_id
,
uint8_t
clk_id
,
uint32_t
flags
,
uint8_t
state
);
int
ti_sci_clock_get_state
(
uint32_t
dev_id
,
uint8_t
clk_id
,
uint8_t
*
programmed_state
,
uint8_t
*
current_state
);
int
ti_sci_clock_get
(
uint32_t
dev_id
,
uint8_t
clk_id
,
int
ti_sci_clock_get
(
uint32_t
dev_id
,
uint8_t
clk_id
,
bool
needs_ssc
,
bool
can_change_freq
,
bool
needs_ssc
,
bool
can_change_freq
,
bool
enable_input_term
);
bool
enable_input_term
);
...
@@ -175,11 +160,13 @@ int ti_sci_core_reboot(void);
...
@@ -175,11 +160,13 @@ int ti_sci_core_reboot(void);
* - ti_sci_proc_set_boot_ctrl - Command to set the processor boot control flags
* - ti_sci_proc_set_boot_ctrl - Command to set the processor boot control flags
* @control_flags_set: Control flags to be set
* @control_flags_set: Control flags to be set
* @control_flags_clear: Control flags to be cleared
* @control_flags_clear: Control flags to be cleared
* - ti_sci_proc_set_boot_ctrl_no_wait - Same as above without waiting for response
* - ti_sci_proc_auth_boot_image - Command to authenticate and load the image
* - ti_sci_proc_auth_boot_image - Command to authenticate and load the image
* and then set the processor configuration flags.
* and then set the processor configuration flags.
* @cert_addr: Memory address at which payload image certificate is located.
* @cert_addr: Memory address at which payload image certificate is located.
* - ti_sci_proc_get_boot_status - Command to get the processor boot status
* - ti_sci_proc_get_boot_status - Command to get the processor boot status
* - ti_sci_proc_wait_boot_status - Command to wait for a processor boot status
* - ti_sci_proc_wait_boot_status - Command to wait for a processor boot status
* - ti_sci_proc_wait_boot_status_no_wait - Same as above without waiting for response
*
*
* NOTE: for all these functions, the following are generic in nature:
* NOTE: for all these functions, the following are generic in nature:
* @proc_id: Processor ID
* @proc_id: Processor ID
...
@@ -193,6 +180,9 @@ int ti_sci_proc_set_boot_cfg(uint8_t proc_id, uint64_t bootvector,
...
@@ -193,6 +180,9 @@ int ti_sci_proc_set_boot_cfg(uint8_t proc_id, uint64_t bootvector,
uint32_t
config_flags_clear
);
uint32_t
config_flags_clear
);
int
ti_sci_proc_set_boot_ctrl
(
uint8_t
proc_id
,
uint32_t
control_flags_set
,
int
ti_sci_proc_set_boot_ctrl
(
uint8_t
proc_id
,
uint32_t
control_flags_set
,
uint32_t
control_flags_clear
);
uint32_t
control_flags_clear
);
int
ti_sci_proc_set_boot_ctrl_no_wait
(
uint8_t
proc_id
,
uint32_t
control_flags_set
,
uint32_t
control_flags_clear
);
int
ti_sci_proc_auth_boot_image
(
uint8_t
proc_id
,
uint64_t
cert_addr
);
int
ti_sci_proc_auth_boot_image
(
uint8_t
proc_id
,
uint64_t
cert_addr
);
int
ti_sci_proc_get_boot_status
(
uint8_t
proc_id
,
uint64_t
*
bv
,
int
ti_sci_proc_get_boot_status
(
uint8_t
proc_id
,
uint64_t
*
bv
,
uint32_t
*
cfg_flags
,
uint32_t
*
cfg_flags
,
...
@@ -206,7 +196,15 @@ int ti_sci_proc_wait_boot_status(uint8_t proc_id, uint8_t num_wait_iterations,
...
@@ -206,7 +196,15 @@ int ti_sci_proc_wait_boot_status(uint8_t proc_id, uint8_t num_wait_iterations,
uint32_t
status_flags_1_set_any_wait
,
uint32_t
status_flags_1_set_any_wait
,
uint32_t
status_flags_1_clr_all_wait
,
uint32_t
status_flags_1_clr_all_wait
,
uint32_t
status_flags_1_clr_any_wait
);
uint32_t
status_flags_1_clr_any_wait
);
int
ti_sci_proc_shutdown
(
uint8_t
proc_id
,
uint32_t
dev_id
);
int
ti_sci_proc_wait_boot_status_no_wait
(
uint8_t
proc_id
,
uint8_t
num_wait_iterations
,
uint8_t
num_match_iterations
,
uint8_t
delay_per_iteration_us
,
uint8_t
delay_before_iterations_us
,
uint32_t
status_flags_1_set_all_wait
,
uint32_t
status_flags_1_set_any_wait
,
uint32_t
status_flags_1_clr_all_wait
,
uint32_t
status_flags_1_clr_any_wait
);
/**
/**
* ti_sci_init() - Basic initialization
* ti_sci_init() - Basic initialization
...
...
plat/ti/k3/common/k3_psci.c
View file @
1eed1b98
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#include <lib/psci/psci.h>
#include <lib/psci/psci.h>
#include <plat/common/platform.h>
#include <plat/common/platform.h>
#include <ti_sci_protocol.h>
#include <k3_gicv3.h>
#include <k3_gicv3.h>
#include <ti_sci.h>
#include <ti_sci.h>
...
@@ -70,12 +71,6 @@ static int k3_pwr_domain_on(u_register_t mpidr)
...
@@ -70,12 +71,6 @@ static int k3_pwr_domain_on(u_register_t mpidr)
return
PSCI_E_INTERN_FAIL
;
return
PSCI_E_INTERN_FAIL
;
}
}
ret
=
ti_sci_proc_release
(
proc
);
if
(
ret
)
{
/* this is not fatal */
WARN
(
"Could not release processor control: %d
\n
"
,
ret
);
}
return
PSCI_E_SUCCESS
;
return
PSCI_E_SUCCESS
;
}
}
...
@@ -90,9 +85,24 @@ void k3_pwr_domain_off(const psci_power_state_t *target_state)
...
@@ -90,9 +85,24 @@ void k3_pwr_domain_off(const psci_power_state_t *target_state)
proc
=
PLAT_PROC_START_ID
+
core_id
;
proc
=
PLAT_PROC_START_ID
+
core_id
;
device
=
PLAT_PROC_DEVICE_START_ID
+
core_id
;
device
=
PLAT_PROC_DEVICE_START_ID
+
core_id
;
ret
=
ti_sci_proc_shutdown
(
proc
,
device
);
/* Start by sending wait for WFI command */
ret
=
ti_sci_proc_wait_boot_status_no_wait
(
proc
,
/*
* Wait maximum time to give us the best chance to get
* to WFI before this command timeouts
*/
UINT8_MAX
,
100
,
UINT8_MAX
,
UINT8_MAX
,
/* Wait for WFI */
PROC_BOOT_STATUS_FLAG_ARMV8_WFI
,
0
,
0
,
0
);
if
(
ret
)
{
ERROR
(
"Sending wait for WFI failed (%d)
\n
"
,
ret
);
return
;
}
/* Now queue up the core shutdown request */
ret
=
ti_sci_device_put_no_wait
(
device
);
if
(
ret
)
{
if
(
ret
)
{
ERROR
(
"
Request to stop cor
e failed
:
%d
\n
"
,
ret
);
ERROR
(
"
Sending core shutdown messag
e failed
(
%d
)
\n
"
,
ret
);
return
;
return
;
}
}
}
}
...
...
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