From 5a9ac99043ef1dc18565700d4c46dc2c8fe34e59 Mon Sep 17 00:00:00 2001 From: Ranjani Vaidyanathan Date: Fri, 26 May 2017 17:36:29 -0500 Subject: i.MX8: Update to the latest SCFW API Signed-off-by: Ranjani Vaidyanathan --- plat/freescale/common/include/sci/svc/pad/api.h | 440 +++++++++++++----------- plat/freescale/common/include/sci/svc/pm/api.h | 229 ++++++------ plat/freescale/common/include/sci/svc/rm/api.h | 134 ++++---- 3 files changed, 433 insertions(+), 370 deletions(-) mode change 100755 => 100644 plat/freescale/common/include/sci/svc/pad/api.h mode change 100755 => 100644 plat/freescale/common/include/sci/svc/pm/api.h mode change 100755 => 100644 plat/freescale/common/include/sci/svc/rm/api.h (limited to 'plat/freescale/common/include/sci/svc') diff --git a/plat/freescale/common/include/sci/svc/pad/api.h b/plat/freescale/common/include/sci/svc/pad/api.h old mode 100755 new mode 100644 index d84f3fd8..fb6e78c1 --- a/plat/freescale/common/include/sci/svc/pad/api.h +++ b/plat/freescale/common/include/sci/svc/pad/api.h @@ -1,31 +1,8 @@ /* + * Copyright (C) 2016 Freescale Semiconductor, Inc. * Copyright 2017 NXP * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of NXP nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: GPL-2.0+ */ /*! @@ -36,6 +13,37 @@ * * Module for the Pad Control (PAD) service. * + * @details + * + * Pad configuration is managed by SC firmware. The pad configuration + * features supported by the SC firmware include: + * + * - Configuring the mux, input/output connection, and low-power isolation + mode. + * - Configuring the technology-specific pad setting such as drive strength, + * pullup/pulldown, etc. + * - Configuring compensation for pad groups with dual voltage capability. + * + * Pad functions fall into one of three categories. Generic functions are + * common to all SoCs and all process technologies. SoC functions are raw + * low-level functions. Technology-specific functions are specific to the + * process technology. + * + * The list of pads is SoC specific. Refer to the SoC [Pad List](@ref PADS) + * for valid pad values. Note that all pads exist on a die but may or + * may not be brought out by the specific package. Mapping of pads to + * package pins/balls is documented in the associated Data Sheet. Some pads + * may not be brought out because the part (die+package) is defeatured and + * some pads may connect to the substrate in the package. + * + * Some pads (SC_P_COMP_*) that can be specified are not individual pads + * but are in fact pad groups. These groups have additional configuration + * that can be done using the sc_pad_set_gp_28fdsoi_comp() function. More + * info on these can be found in the associated Reference Manual. + * + * Pads are managed as a resource by the Resource Manager (RM). They have + * assigned owners and only the owners can configure the pads. + * * @{ */ @@ -49,6 +57,13 @@ /* Defines */ +/*! + * @name Defines for type widths + */ +/*@{*/ +#define SC_PAD_MUX_W 3 /*!< Width of mux parameter */ +/*@}*/ + /* Types */ /*! @@ -60,24 +75,24 @@ */ typedef enum sc_pad_config_e { - SC_PAD_CONFIG_NORMAL = 0, //!< Normal - SC_PAD_CONFIG_OD = 1, //!< Open Drain - SC_PAD_CONFIG_OD_IN = 2, //!< Open Drain and input - SC_PAD_CONFIG_OUT_IN = 3 //!< Output and input + SC_PAD_CONFIG_NORMAL = 0, /*!< Normal */ + SC_PAD_CONFIG_OD = 1, /*!< Open Drain */ + SC_PAD_CONFIG_OD_IN = 2, /*!< Open Drain and input */ + SC_PAD_CONFIG_OUT_IN = 3 /*!< Output and input */ } sc_pad_config_t; /*! * This type is used to declare a pad low-power isolation config. * ISO_LATE is the most common setting. ISO_EARLY is only used when - * an output pin is directly determined by another input pin. The + * an output pad is directly determined by another input pad. The * other two are only used when SW wants to directly contol isolation. */ typedef enum sc_pad_iso_e { - SC_PAD_ISO_OFF = 0, //!< ISO latch is transparent - SC_PAD_ISO_EARLY = 1, //!< Follow EARLY_ISO - SC_PAD_ISO_LATE = 2, //!< Follow LATE_ISO - SC_PAD_ISO_ON = 3 //!< ISO latched data is held + SC_PAD_ISO_OFF = 0, /*!< ISO latch is transparent */ + SC_PAD_ISO_EARLY = 1, /*!< Follow EARLY_ISO */ + SC_PAD_ISO_LATE = 2, /*!< Follow LATE_ISO */ + SC_PAD_ISO_ON = 3 /*!< ISO latched data is held */ } sc_pad_iso_t; /*! @@ -86,10 +101,10 @@ typedef enum sc_pad_iso_e */ typedef enum sc_pad_28lpp_dse_e { - SC_PAD_28LPP_DSE_x1 = 0, //!< Drive strength x1 - SC_PAD_28LPP_DSE_x4 = 1, //!< Drive strength x4 - SC_PAD_28LPP_DSE_x2 = 2, //!< Drive strength x2 - SC_PAD_28LPP_DSE_x6 = 3 //!< Drive strength x6 + SC_PAD_28LPP_DSE_x1 = 0, /*!< Drive strength x1 */ + SC_PAD_28LPP_DSE_x4 = 1, /*!< Drive strength x4 */ + SC_PAD_28LPP_DSE_x2 = 2, /*!< Drive strength x2 */ + SC_PAD_28LPP_DSE_x6 = 3 /*!< Drive strength x6 */ } sc_pad_28lpp_dse_t; /*! @@ -98,20 +113,20 @@ typedef enum sc_pad_28lpp_dse_e */ typedef enum sc_pad_28fdsio_dse_e { - SC_PAD_28FDSOI_DSE_18V_1MA = 0, //!< Drive strength of 1mA for 1.8v - SC_PAD_28FDSOI_DSE_33V_2MA = 0, //!< Drive strength of 2mA for 3.3v - SC_PAD_28FDSOI_DSE_DV_HIGH = 0, //!< Drive strength of 12mA for dual volt - SC_PAD_28FDSOI_DSE_18V_2MA = 1, //!< Drive strength of 2mA for 1.8v - SC_PAD_28FDSOI_DSE_33V_4MA = 1, //!< Drive strength of 4mA for 3.3v - SC_PAD_28FDSOI_DSE_DV_LOW = 1, //!< Drive strength of 12mA for dual volt - SC_PAD_28FDSOI_DSE_18V_4MA = 2, //!< Drive strength of 4mA for 1.8v - SC_PAD_28FDSOI_DSE_33V_8MA = 2, //!< Drive strength of 8mA for 3.3v - SC_PAD_28FDSOI_DSE_18V_6MA = 3, //!< Drive strength of 6mA for 1.8v - SC_PAD_28FDSOI_DSE_33V_12MA = 3, //!< Drive strength of 12mA for 3.3v - SC_PAD_28FDSOI_DSE_18V_8MA = 4, //!< Drive strength of 8mA for 1.8v - SC_PAD_28FDSOI_DSE_18V_10MA = 5, //!< Drive strength of 10mA for 1.8v - SC_PAD_28FDSOI_DSE_18V_12MA = 6, //!< Drive strength of 12mA for 1.8v - SC_PAD_28FDSOI_DSE_33V_HS = 7 //!< High-speed drive strength for 1.8v + SC_PAD_28FDSOI_DSE_18V_1MA = 0, /*!< Drive strength of 1mA for 1.8v */ + SC_PAD_28FDSOI_DSE_18V_2MA = 1, /*!< Drive strength of 2mA for 1.8v */ + SC_PAD_28FDSOI_DSE_18V_4MA = 2, /*!< Drive strength of 4mA for 1.8v */ + SC_PAD_28FDSOI_DSE_18V_6MA = 3, /*!< Drive strength of 6mA for 1.8v */ + SC_PAD_28FDSOI_DSE_18V_8MA = 4, /*!< Drive strength of 8mA for 1.8v */ + SC_PAD_28FDSOI_DSE_18V_10MA = 5, /*!< Drive strength of 10mA for 1.8v */ + SC_PAD_28FDSOI_DSE_18V_12MA = 6, /*!< Drive strength of 12mA for 1.8v */ + SC_PAD_28FDSOI_DSE_33V_2MA = 0, /*!< Drive strength of 2mA for 3.3v */ + SC_PAD_28FDSOI_DSE_33V_4MA = 1, /*!< Drive strength of 4mA for 3.3v */ + SC_PAD_28FDSOI_DSE_33V_8MA = 2, /*!< Drive strength of 8mA for 3.3v */ + SC_PAD_28FDSOI_DSE_33V_12MA = 3, /*!< Drive strength of 12mA for 3.3v */ + SC_PAD_28FDSOI_DSE_33V_HS = 7, /*!< High-speed drive strength for 1.8v */ + SC_PAD_28FDSOI_DSE_DV_LOW = 0, /*!< Low drive strength for dual volt */ + SC_PAD_28FDSOI_DSE_DV_HIGH = 1 /*!< High drive strength for dual volt */ } sc_pad_28fdsoi_dse_t; /*! @@ -120,10 +135,10 @@ typedef enum sc_pad_28fdsio_dse_e */ typedef enum sc_pad_28lpp_ps_e { - SC_PAD_28LPP_PS_PD = 0, //!< Pull down - SC_PAD_28LPP_PS_PU_5K = 1, //!< 5K pull up - SC_PAD_28LPP_PS_PU_47K = 2, //!< 47K pull up - SC_PAD_28LPP_PS_PU_100K = 3 //!< 100K pull up + SC_PAD_28LPP_PS_PD = 0, /*!< Pull down */ + SC_PAD_28LPP_PS_PU_5K = 1, /*!< 5K pull up */ + SC_PAD_28LPP_PS_PU_47K = 2, /*!< 47K pull up */ + SC_PAD_28LPP_PS_PU_100K = 3 /*!< 100K pull up */ } sc_pad_28lpp_ps_t; /*! @@ -132,33 +147,38 @@ typedef enum sc_pad_28lpp_ps_e */ typedef enum sc_pad_28fdsoi_ps_e { - SC_PAD_28FDSOI_PS_KEEPER = 0, //!< Bus-keeper (only valid for 1.8v) - SC_PAD_28FDSOI_PS_PU = 1, //!< Pull-up - SC_PAD_28FDSOI_PS_PD = 2, //!< Pull-down - SC_PAD_28FDSOI_PS_NONE = 3 //!< No pull (disabled) + SC_PAD_28FDSOI_PS_KEEPER = 0, /*!< Bus-keeper (only valid for 1.8v) */ + SC_PAD_28FDSOI_PS_PU = 1, /*!< Pull-up */ + SC_PAD_28FDSOI_PS_PD = 2, /*!< Pull-down */ + SC_PAD_28FDSOI_PS_NONE = 3 /*!< No pull (disabled) */ } sc_pad_28fdsoi_ps_t; /*! - * This type is used to declare a wakeup mode of a pin. + * This type is used to declare a wakeup mode of a pad. */ typedef enum sc_pad_wakeup_e { - SC_PAD_WAKEUP_OFF = 0, //!< Off - SC_PAD_WAKEUP_CLEAR = 1, //!< Clears pending flag - SC_PAD_WAKEUP_LOW_LVL = 4, //!< Low level - SC_PAD_WAKEUP_FALL_EDGE = 5, //!< Falling edge - SC_PAD_WAKEUP_RISE_EDGE = 6, //!< Rising edge - SC_PAD_WAKEUP_HIGH_LVL = 7 //!< High-level + SC_PAD_WAKEUP_OFF = 0, /*!< Off */ + SC_PAD_WAKEUP_CLEAR = 1, /*!< Clears pending flag */ + SC_PAD_WAKEUP_LOW_LVL = 4, /*!< Low level */ + SC_PAD_WAKEUP_FALL_EDGE = 5, /*!< Falling edge */ + SC_PAD_WAKEUP_RISE_EDGE = 6, /*!< Rising edge */ + SC_PAD_WAKEUP_HIGH_LVL = 7 /*!< High-level */ } sc_pad_wakeup_t; /* Functions */ /*! - * This function configures the mux settings for a pin. This includes + * @name Generic Functions + * @{ + */ + +/*! + * This function configures the mux settings for a pad. This includes * the signal mux, pad config, and low-power isolation mode. * * @param[in] ipc IPC handle - * @param[in] pin pin to configure + * @param[in] pad pad to configure * @param[in] mux mux setting * @param[in] config pad config * @param[in] iso low-power isolation mode @@ -167,13 +187,34 @@ typedef enum sc_pad_wakeup_e * * Return errors: * - SC_PARM if arguments out of range or invalid, - * - SC_ERR_NOACCESS if caller's partition is not the pin owner + * - SC_ERR_NOACCESS if caller's partition is not the pad owner * - * Refer to the SoC [Pin List](@ref PINS) for valid pin values. + * Refer to the SoC [Pad List](@ref PADS) for valid pad values. */ -sc_err_t sc_pad_set_mux(sc_ipc_t ipc, sc_pin_t pin, +sc_err_t sc_pad_set_mux(sc_ipc_t ipc, sc_pad_t pad, uint8_t mux, sc_pad_config_t config, sc_pad_iso_t iso); +/*! + * This function gets the mux settings for a pad. This includes + * the signal mux, pad config, and low-power isolation mode. + * + * @param[in] ipc IPC handle + * @param[in] pad pad to query + * @param[out] mux pointer to return mux setting + * @param[out] config pointer to return pad config + * @param[out] iso pointer to return low-power isolation mode + * + * @return Returns an error code (SC_ERR_NONE = success). + * + * Return errors: + * - SC_PARM if arguments out of range or invalid, + * - SC_ERR_NOACCESS if caller's partition is not the pad owner + * + * Refer to the SoC [Pad List](@ref PADS) for valid pad values. + */ +sc_err_t sc_pad_get_mux(sc_ipc_t ipc, sc_pad_t pad, + uint8_t *mux, sc_pad_config_t *config, sc_pad_iso_t *iso); + /*! * This function configures the general purpose pad control. This * is technology dependent and includes things like drive strength, @@ -181,66 +222,80 @@ sc_err_t sc_pad_set_mux(sc_ipc_t ipc, sc_pin_t pin, * for bit field details. * * @param[in] ipc IPC handle - * @param[in] pin pin to configure + * @param[in] pad pad to configure * @param[in] ctrl control value to set * * @return Returns an error code (SC_ERR_NONE = success). * * Return errors: * - SC_PARM if arguments out of range or invalid, - * - SC_ERR_NOACCESS if caller's partition is not the pin owner + * - SC_ERR_NOACCESS if caller's partition is not the pad owner * - * Refer to the SoC [Pin List](@ref PINS) for valid pin values. + * Refer to the SoC [Pad List](@ref PADS) for valid pad values. */ -sc_err_t sc_pad_set_gp(sc_ipc_t ipc, sc_pin_t pin, uint32_t ctrl); +sc_err_t sc_pad_set_gp(sc_ipc_t ipc, sc_pad_t pad, uint32_t ctrl); /*! - * This function configures the pad control specific to 28LPP. + * This function gets the general purpose pad control. This + * is technology dependent and includes things like drive strength, + * slew rate, pull up/down, etc. Refer to the SoC Reference Manual + * for bit field details. * * @param[in] ipc IPC handle - * @param[in] pin pin to configure - * @param[in] dse drive strength - * @param[in] sre slew rate - * @param[in] hys hysteresis - * @param[in] pe pull enable - * @param[in] ps pull select + * @param[in] pad pad to query + * @param[out] ctrl pointer to return control value * * @return Returns an error code (SC_ERR_NONE = success). * * Return errors: * - SC_PARM if arguments out of range or invalid, - * - SC_ERR_NOACCESS if caller's partition is not the pin owner, - * - SC_ERR_UNAVAILABLE if process not applicable + * - SC_ERR_NOACCESS if caller's partition is not the pad owner * - * Refer to the SoC [Pin List](@ref PINS) for valid pin values. + * Refer to the SoC [Pad List](@ref PADS) for valid pad values. */ -sc_err_t sc_pad_set_gp_28lpp(sc_ipc_t ipc, sc_pin_t pin, - sc_pad_28lpp_dse_t dse, bool sre, bool hys, bool pe, - sc_pad_28lpp_ps_t ps); +sc_err_t sc_pad_get_gp(sc_ipc_t ipc, sc_pad_t pad, uint32_t *ctrl); /*! - * This function configures the wakeup mode of the pin. + * This function configures the wakeup mode of the pad. * * @param[in] ipc IPC handle - * @param[in] pin pin to configure + * @param[in] pad pad to configure * @param[in] wakeup wakeup to set * * @return Returns an error code (SC_ERR_NONE = success). * * Return errors: * - SC_PARM if arguments out of range or invalid, - * - SC_ERR_NOACCESS if caller's partition is not the pin owner + * - SC_ERR_NOACCESS if caller's partition is not the pad owner * - * Refer to the SoC [Pin List](@ref PINS) for valid pin values. + * Refer to the SoC [Pad List](@ref PADS) for valid pad values. */ -sc_err_t sc_pad_set_wakeup(sc_ipc_t ipc, sc_pin_t pin, +sc_err_t sc_pad_set_wakeup(sc_ipc_t ipc, sc_pad_t pad, sc_pad_wakeup_t wakeup); +/*! + * This function gets the wakeup mode of a pad. + * + * @param[in] ipc IPC handle + * @param[in] pad pad to query + * @param[out] wakeup pointer to return wakeup + * + * @return Returns an error code (SC_ERR_NONE = success). + * + * Return errors: + * - SC_PARM if arguments out of range or invalid, + * - SC_ERR_NOACCESS if caller's partition is not the pad owner + * + * Refer to the SoC [Pad List](@ref PADS) for valid pad values. + */ +sc_err_t sc_pad_get_wakeup(sc_ipc_t ipc, sc_pad_t pad, + sc_pad_wakeup_t *wakeup); + /*! * This function configures a pad. * * @param[in] ipc IPC handle - * @param[in] pin pin to configure + * @param[in] pad pad to configure * @param[in] mux mux setting * @param[in] config pad config * @param[in] iso low-power isolation mode @@ -252,130 +307,145 @@ sc_err_t sc_pad_set_wakeup(sc_ipc_t ipc, sc_pin_t pin, * * Return errors: * - SC_PARM if arguments out of range or invalid, - * - SC_ERR_NOACCESS if caller's partition is not the pin owner + * - SC_ERR_NOACCESS if caller's partition is not the pad owner * * @return Returns an error code (SC_ERR_NONE = success). * - * Refer to the SoC [Pin List](@ref PINS) for valid pin values. + * Refer to the SoC [Pad List](@ref PADS) for valid pad values. */ -sc_err_t sc_pad_set_all(sc_ipc_t ipc, sc_pin_t pin, uint8_t mux, +sc_err_t sc_pad_set_all(sc_ipc_t ipc, sc_pad_t pad, uint8_t mux, sc_pad_config_t config, sc_pad_iso_t iso, uint32_t ctrl, sc_pad_wakeup_t wakeup); /*! - * This function gets the mux settings for a pin. This includes - * the signal mux, pad config, and low-power isolation mode. + * This function gets a pad's config. * * @param[in] ipc IPC handle - * @param[in] pin pin to query + * @param[in] pad pad to query * @param[out] mux pointer to return mux setting * @param[out] config pointer to return pad config * @param[out] iso pointer to return low-power isolation mode + * @param[out] ctrl pointer to return control value + * @param[out] wakeup pointer to return wakeup to set * - * @return Returns an error code (SC_ERR_NONE = success). + * @see sc_pad_set_mux(). + * @see sc_pad_set_gp(). * * Return errors: * - SC_PARM if arguments out of range or invalid, - * - SC_ERR_NOACCESS if caller's partition is not the pin owner + * - SC_ERR_NOACCESS if caller's partition is not the pad owner * - * Refer to the SoC [Pin List](@ref PINS) for valid pin values. + * @return Returns an error code (SC_ERR_NONE = success). + * + * Refer to the SoC [Pad List](@ref PADS) for valid pad values. */ -sc_err_t sc_pad_get_mux(sc_ipc_t ipc, sc_pin_t pin, - uint8_t *mux, sc_pad_config_t *config, sc_pad_iso_t *iso); +sc_err_t sc_pad_get_all(sc_ipc_t ipc, sc_pad_t pad, uint8_t *mux, + sc_pad_config_t *config, sc_pad_iso_t *iso, uint32_t *ctrl, + sc_pad_wakeup_t *wakeup); + +/* @} */ /*! - * This function gets the general purpose pad control. This - * is technology dependent and includes things like drive strength, - * slew rate, pull up/down, etc. Refer to the SoC Reference Manual - * for bit field details. + * @name SoC Specific Functions + * @{ + */ + +/*! + * This function configures the settings for a pad. This setting is SoC + * specific. * * @param[in] ipc IPC handle - * @param[in] pin pin to query - * @param[out] ctrl pointer to return control value + * @param[in] pad pad to configure + * @param[in] val value to set * * @return Returns an error code (SC_ERR_NONE = success). * * Return errors: * - SC_PARM if arguments out of range or invalid, - * - SC_ERR_NOACCESS if caller's partition is not the pin owner + * - SC_ERR_NOACCESS if caller's partition is not the pad owner * - * Refer to the SoC [Pin List](@ref PINS) for valid pin values. + * Refer to the SoC [Pad List](@ref PADS) for valid pad values. */ -sc_err_t sc_pad_get_gp(sc_ipc_t ipc, sc_pin_t pin, uint32_t *ctrl); +sc_err_t sc_pad_set(sc_ipc_t ipc, sc_pad_t pad, uint32_t val); /*! - * This function gets the pad control specific to 28LPP. + * This function gets the settings for a pad. This setting is SoC + * specific. * * @param[in] ipc IPC handle - * @param[in] pin pin to query - * @param[out] dse pointer to return drive strength - * @param[out] sre pointer to return slew rate - * @param[out] hys pointer to return hysteresis - * @param[out] pe pointer to return pull enable - * @param[out] ps pointer to return pull select + * @param[in] pad pad to query + * @param[out] val pointer to return setting * * @return Returns an error code (SC_ERR_NONE = success). * * Return errors: * - SC_PARM if arguments out of range or invalid, - * - SC_ERR_NOACCESS if caller's partition is not the pin owner, - * - SC_ERR_UNAVAILABLE if process not applicable + * - SC_ERR_NOACCESS if caller's partition is not the pad owner * - * Refer to the SoC [Pin List](@ref PINS) for valid pin values. + * Refer to the SoC [Pad List](@ref PADS) for valid pad values. */ -sc_err_t sc_pad_get_gp_28lpp(sc_ipc_t ipc, sc_pin_t pin, - sc_pad_28lpp_dse_t *dse, bool *sre, bool *hys, bool *pe, - sc_pad_28lpp_ps_t *ps); +sc_err_t sc_pad_get(sc_ipc_t ipc, sc_pad_t pad, uint32_t *val); + +/* @} */ /*! - * This function gets the wakeup mode of a pin. + * @name Technology Specific Functions + * @{ + */ + +/*! + * This function configures the pad control specific to 28LPP. * * @param[in] ipc IPC handle - * @param[in] pin pin to query - * @param[out] wakeup pointer to return wakeup + * @param[in] pad pad to configure + * @param[in] dse drive strength + * @param[in] sre slew rate + * @param[in] hys hysteresis + * @param[in] pe pull enable + * @param[in] ps pull select * * @return Returns an error code (SC_ERR_NONE = success). * * Return errors: * - SC_PARM if arguments out of range or invalid, - * - SC_ERR_NOACCESS if caller's partition is not the pin owner + * - SC_ERR_NOACCESS if caller's partition is not the pad owner, + * - SC_ERR_UNAVAILABLE if process not applicable * - * Refer to the SoC [Pin List](@ref PINS) for valid pin values. + * Refer to the SoC [Pad List](@ref PADS) for valid pad values. */ -sc_err_t sc_pad_get_wakeup(sc_ipc_t ipc, sc_pin_t pin, - sc_pad_wakeup_t *wakeup); +sc_err_t sc_pad_set_gp_28lpp(sc_ipc_t ipc, sc_pad_t pad, + sc_pad_28lpp_dse_t dse, bool sre, bool hys, bool pe, + sc_pad_28lpp_ps_t ps); /*! - * This function gets a pad's config. + * This function gets the pad control specific to 28LPP. * * @param[in] ipc IPC handle - * @param[in] pin pin to query - * @param[out] mux pointer to return mux setting - * @param[out] config pointer to return pad config - * @param[out] iso pointer to return low-power isolation mode - * @param[out] ctrl pointer to return control value - * @param[out] wakeup pointer to return wakeup to set + * @param[in] pad pad to query + * @param[out] dse pointer to return drive strength + * @param[out] sre pointer to return slew rate + * @param[out] hys pointer to return hysteresis + * @param[out] pe pointer to return pull enable + * @param[out] ps pointer to return pull select * - * @see sc_pad_set_mux(). - * @see sc_pad_set_gp(). + * @return Returns an error code (SC_ERR_NONE = success). * * Return errors: * - SC_PARM if arguments out of range or invalid, - * - SC_ERR_NOACCESS if caller's partition is not the pin owner - * - * @return Returns an error code (SC_ERR_NONE = success). + * - SC_ERR_NOACCESS if caller's partition is not the pad owner, + * - SC_ERR_UNAVAILABLE if process not applicable * - * Refer to the SoC [Pin List](@ref PINS) for valid pin values. + * Refer to the SoC [Pad List](@ref PADS) for valid pad values. */ -sc_err_t sc_pad_get_all(sc_ipc_t ipc, sc_pin_t pin, uint8_t *mux, - sc_pad_config_t *config, sc_pad_iso_t *iso, uint32_t *ctrl, - sc_pad_wakeup_t *wakeup); +sc_err_t sc_pad_get_gp_28lpp(sc_ipc_t ipc, sc_pad_t pad, + sc_pad_28lpp_dse_t *dse, bool *sre, bool *hys, bool *pe, + sc_pad_28lpp_ps_t *ps); /*! * This function configures the pad control specific to 28FDSOI. * * @param[in] ipc IPC handle - * @param[in] pin pin to configure + * @param[in] pad pad to configure * @param[in] dse drive strength * @param[in] ps pull select * @@ -383,19 +453,19 @@ sc_err_t sc_pad_get_all(sc_ipc_t ipc, sc_pin_t pin, uint8_t *mux, * * Return errors: * - SC_PARM if arguments out of range or invalid, - * - SC_ERR_NOACCESS if caller's partition is not the pin owner, + * - SC_ERR_NOACCESS if caller's partition is not the pad owner, * - SC_ERR_UNAVAILABLE if process not applicable * - * Refer to the SoC [Pin List](@ref PINS) for valid pin values. + * Refer to the SoC [Pad List](@ref PADS) for valid pad values. */ -sc_err_t sc_pad_set_gp_28fdsoi(sc_ipc_t ipc, sc_pin_t pin, +sc_err_t sc_pad_set_gp_28fdsoi(sc_ipc_t ipc, sc_pad_t pad, sc_pad_28fdsoi_dse_t dse, sc_pad_28fdsoi_ps_t ps); /*! * This function gets the pad control specific to 28FDSOI. * * @param[in] ipc IPC handle - * @param[in] pin pin to query + * @param[in] pad pad to query * @param[out] dse pointer to return drive strength * @param[out] ps pointer to return pull select * @@ -403,19 +473,19 @@ sc_err_t sc_pad_set_gp_28fdsoi(sc_ipc_t ipc, sc_pin_t pin, * * Return errors: * - SC_PARM if arguments out of range or invalid, - * - SC_ERR_NOACCESS if caller's partition is not the pin owner, + * - SC_ERR_NOACCESS if caller's partition is not the pad owner, * - SC_ERR_UNAVAILABLE if process not applicable * - * Refer to the SoC [Pin List](@ref PINS) for valid pin values. + * Refer to the SoC [Pad List](@ref PADS) for valid pad values. */ -sc_err_t sc_pad_get_gp_28fdsoi(sc_ipc_t ipc, sc_pin_t pin, +sc_err_t sc_pad_get_gp_28fdsoi(sc_ipc_t ipc, sc_pad_t pad, sc_pad_28fdsoi_dse_t *dse, sc_pad_28fdsoi_ps_t *ps); /*! * This function configures the compensation control specific to 28FDSOI. * * @param[in] ipc IPC handle - * @param[in] pin pin to configure + * @param[in] pad pad to configure * @param[in] compen compensation/freeze mode * @param[in] fastfrz fast freeze * @param[in] rasrcp compensation code for PMOS @@ -426,12 +496,12 @@ sc_err_t sc_pad_get_gp_28fdsoi(sc_ipc_t ipc, sc_pin_t pin, * * Return errors: * - SC_PARM if arguments out of range or invalid, - * - SC_ERR_NOACCESS if caller's partition is not the pin owner, + * - SC_ERR_NOACCESS if caller's partition is not the pad owner, * - SC_ERR_UNAVAILABLE if process not applicable * - * Refer to the SoC [Pin List](@ref PINS) for valid pin values. + * Refer to the SoC [Pad List](@ref PADS) for valid pad values. */ -sc_err_t sc_pad_set_gp_28fdsoi_comp(sc_ipc_t ipc, sc_pin_t pin, +sc_err_t sc_pad_set_gp_28fdsoi_comp(sc_ipc_t ipc, sc_pad_t pad, uint8_t compen, bool fastfrz, uint8_t rasrcp, uint8_t rasrcn, bool nasrc_sel); @@ -439,7 +509,7 @@ sc_err_t sc_pad_set_gp_28fdsoi_comp(sc_ipc_t ipc, sc_pin_t pin, * This function gets the compensation control specific to 28FDSOI. * * @param[in] ipc IPC handle - * @param[in] pin pin to query + * @param[in] pad pad to query * @param[in] compen pointer to return compensation/freeze mode * @param[in] fastfrz pointer to return fast freeze * @param[in] rasrcp pointer to return compensation code for PMOS @@ -452,50 +522,16 @@ sc_err_t sc_pad_set_gp_28fdsoi_comp(sc_ipc_t ipc, sc_pin_t pin, * * Return errors: * - SC_PARM if arguments out of range or invalid, - * - SC_ERR_NOACCESS if caller's partition is not the pin owner, + * - SC_ERR_NOACCESS if caller's partition is not the pad owner, * - SC_ERR_UNAVAILABLE if process not applicable * - * Refer to the SoC [Pin List](@ref PINS) for valid pin values. + * Refer to the SoC [Pad List](@ref PADS) for valid pad values. */ -sc_err_t sc_pad_get_gp_28fdsoi_comp(sc_ipc_t ipc, sc_pin_t pin, +sc_err_t sc_pad_get_gp_28fdsoi_comp(sc_ipc_t ipc, sc_pad_t pad, uint8_t *compen, bool *fastfrz, uint8_t *rasrcp, uint8_t *rasrcn, bool *nasrc_sel, bool *compok, uint8_t *nasrc); -/*! - * This function configures the settings for a pin. This setting is SoC - * specific. - * - * @param[in] ipc IPC handle - * @param[in] pin pin to configure - * @param[in] val value to set - * - * @return Returns an error code (SC_ERR_NONE = success). - * - * Return errors: - * - SC_PARM if arguments out of range or invalid, - * - SC_ERR_NOACCESS if caller's partition is not the pin owner - * - * Refer to the SoC [Pin List](@ref PINS) for valid pin values. - */ -sc_err_t sc_pad_set(sc_ipc_t ipc, sc_pin_t pin, uint32_t val); - -/*! - * This function gets the settings for a pin. This setting is SoC - * specific. - * - * @param[in] ipc IPC handle - * @param[in] pin pin to query - * @param[out] val pointer to return setting - * - * @return Returns an error code (SC_ERR_NONE = success). - * - * Return errors: - * - SC_PARM if arguments out of range or invalid, - * - SC_ERR_NOACCESS if caller's partition is not the pin owner - * - * Refer to the SoC [Pin List](@ref PINS) for valid pin values. - */ -sc_err_t sc_pad_get(sc_ipc_t ipc, sc_pin_t pin, uint32_t *val); +/* @} */ #endif /* _SC_PAD_API_H */ diff --git a/plat/freescale/common/include/sci/svc/pm/api.h b/plat/freescale/common/include/sci/svc/pm/api.h old mode 100755 new mode 100644 index a65fdb20..d6751289 --- a/plat/freescale/common/include/sci/svc/pm/api.h +++ b/plat/freescale/common/include/sci/svc/pm/api.h @@ -1,31 +1,8 @@ /* + * Copyright (C) 2016 Freescale Semiconductor, Inc. * Copyright 2017 NXP * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of NXP nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: GPL-2.0+ */ /*! @@ -54,10 +31,10 @@ * @name Defines for type widths */ /*@{*/ -#define SC_PM_POWER_MODE_W 2 //!< Width of sc_pm_power_mode_t -#define SC_PM_CLOCK_MODE_W 2 //!< Width of sc_pm_clock_mode_t -#define SC_PM_RESET_TYPE_W 1 //!< Width of sc_pm_reset_type_t -#define SC_PM_RESET_REASON_W 3 //!< Width of sc_pm_reset_reason_t +#define SC_PM_POWER_MODE_W 2 /*!< Width of sc_pm_power_mode_t */ +#define SC_PM_CLOCK_MODE_W 3 /*!< Width of sc_pm_clock_mode_t */ +#define SC_PM_RESET_TYPE_W 1 /*!< Width of sc_pm_reset_type_t */ +#define SC_PM_RESET_REASON_W 3 /*!< Width of sc_pm_reset_reason_t */ /*@}*/ /*! @@ -70,7 +47,7 @@ * @name Defines for ALL parameters */ /*@{*/ -#define SC_PM_CLK_ALL UINT8_MAX //!< All clocks +#define SC_PM_CLK_ALL UINT8_MAX /*!< All clocks */ /*@}*/ /* Types */ @@ -82,10 +59,10 @@ */ typedef enum sc_pm_power_mode_e { - SC_PM_PW_MODE_OFF = 0, //!< Power off - SC_PM_PW_MODE_STBY = 1, //!< Power in standby - SC_PM_PW_MODE_LP = 2, //!< Power in low-power - SC_PM_PW_MODE_ON = 3 //!< Power on + SC_PM_PW_MODE_OFF = 0, /*!< Power off */ + SC_PM_PW_MODE_STBY = 1, /*!< Power in standby */ + SC_PM_PW_MODE_LP = 2, /*!< Power in low-power */ + SC_PM_PW_MODE_ON = 3 /*!< Power on */ } sc_pm_power_mode_t; /*! @@ -93,19 +70,19 @@ typedef enum sc_pm_power_mode_e */ typedef enum sc_pm_clk_e { - SC_PM_CLK_SLV_BUS = 0, //!< Slave bus clock - SC_PM_CLK_MST_BUS = 1, //!< Master bus clock - SC_PM_CLK_PER = 2, //!< Peripheral clock - SC_PM_CLK_PHY = 3, //!< Phy clock - SC_PM_CLK_MISC = 4, //!< Misc clock - SC_PM_CLK_MISC0 = 0, //!< Misc 0 clock - SC_PM_CLK_MISC1 = 1, //!< Misc 1 clock - SC_PM_CLK_MISC2 = 2, //!< Misc 2 clock - SC_PM_CLK_MISC3 = 3, //!< Misc 3 clock - SC_PM_CLK_MISC4 = 4, //!< Misc 4 clock - SC_PM_CLK_CPU = 2, //!< CPU clock - SC_PM_CLK_PLL = 4, //!< PLL - SC_PM_CLK_BYPASS = 4 //!< Bypass clock + SC_PM_CLK_SLV_BUS = 0, /*!< Slave bus clock */ + SC_PM_CLK_MST_BUS = 1, /*!< Master bus clock */ + SC_PM_CLK_PER = 2, /*!< Peripheral clock */ + SC_PM_CLK_PHY = 3, /*!< Phy clock */ + SC_PM_CLK_MISC = 4, /*!< Misc clock */ + SC_PM_CLK_MISC0 = 0, /*!< Misc 0 clock */ + SC_PM_CLK_MISC1 = 1, /*!< Misc 1 clock */ + SC_PM_CLK_MISC2 = 2, /*!< Misc 2 clock */ + SC_PM_CLK_MISC3 = 3, /*!< Misc 3 clock */ + SC_PM_CLK_MISC4 = 4, /*!< Misc 4 clock */ + SC_PM_CLK_CPU = 2, /*!< CPU clock */ + SC_PM_CLK_PLL = 4, /*!< PLL */ + SC_PM_CLK_BYPASS = 4 /*!< Bypass clock */ } sc_pm_clk_t; /*! @@ -113,12 +90,26 @@ typedef enum sc_pm_clk_e */ typedef enum sc_pm_clk_mode_e { - SC_PM_CLK_MODE_OFF = 0, //!< Clock is disabled - SC_PM_CLK_MODE_AUTOGATE_SW = 1, //!< Clock is in SW autogate mode - SC_PM_CLK_MODE_AUTOGATE_HW = 2, //!< Clock is in HW autogate mode - SC_PM_CLK_MODE_ON = 3 //!< Clock is enabled. + SC_PM_CLK_MODE_ROM_INIT = 0, /*!< Clock is initialized by ROM. */ + SC_PM_CLK_MODE_OFF = 1, /*!< Clock is disabled */ + SC_PM_CLK_MODE_ON = 2, /*!< Clock is enabled. */ + SC_PM_CLK_MODE_AUTOGATE_SW = 3, /*!< Clock is in SW autogate mode */ + SC_PM_CLK_MODE_AUTOGATE_HW = 4, /*!< Clock is in HW autogate mode */ + SC_PM_CLK_MODE_AUTOGATE_SW_HW = 5, /*!< Clock is in SW-HW autogate mode */ } sc_pm_clk_mode_t; +/*! + * This type is used to declare the clock parent. + */ +typedef enum sc_pm_clk_parent_e +{ + XTAL = 0, /*! < Parent is XTAL. */ + PLL0 = 1, /*! < Parent is PLL0 */ + PLL1 = 2, /*! < Parent is PLL1 or PLL0/2 */ + PLL2 = 3, /*! < Parent in PLL2 or PLL0/4 */ + BYPS = 4 /*! < Parent is a bypass clock. */ +} sc_pm_clk_parent_t; + /*! * This type is used to declare clock rates. */ @@ -129,8 +120,8 @@ typedef uint32_t sc_pm_clock_rate_t; */ typedef enum sc_pm_reset_type_e { - SC_PM_RESET_TYPE_COLD = 0, //!< Cold reset - SC_PM_RESET_TYPE_WARM = 1 //!< Warm reset + SC_PM_RESET_TYPE_COLD = 0, /*!< Cold reset */ + SC_PM_RESET_TYPE_WARM = 1 /*!< Warm reset */ } sc_pm_reset_type_t; /*! @@ -138,14 +129,14 @@ typedef enum sc_pm_reset_type_e */ typedef enum sc_pm_reset_reason_e { - SC_PM_RESET_REASON_POR = 0, //!< Power on reset - SC_PM_RESET_REASON_WARM = 1, //!< Warm reset - SC_PM_RESET_REASON_SW = 2, //!< Software reset - SC_PM_RESET_REASON_WDOG = 3, //!< Watchdog reset - SC_PM_RESET_REASON_LOCKUP = 4, //!< Lockup reset - SC_PM_RESET_REASON_TAMPER = 5, //!< Tamper reset - SC_PM_RESET_REASON_TEMP = 6, //!< Temp reset - SC_PM_RESET_REASON_LOW_VOLT = 7, //!< Low voltage reset + SC_PM_RESET_REASON_POR = 0, /*!< Power on reset */ + SC_PM_RESET_REASON_WARM = 1, /*!< Warm reset */ + SC_PM_RESET_REASON_SW = 2, /*!< Software reset */ + SC_PM_RESET_REASON_WDOG = 3, /*!< Watchdog reset */ + SC_PM_RESET_REASON_LOCKUP = 4, /*!< Lockup reset */ + SC_PM_RESET_REASON_TAMPER = 5, /*!< Tamper reset */ + SC_PM_RESET_REASON_TEMP = 6, /*!< Temp reset */ + SC_PM_RESET_REASON_LOW_VOLT = 7, /*!< Low voltage reset */ } sc_pm_reset_reason_t; /* Functions */ @@ -302,6 +293,51 @@ sc_err_t sc_pm_get_clock_rate(sc_ipc_t ipc, sc_rsrc_t resource, sc_err_t sc_pm_clock_enable(sc_ipc_t ipc, sc_rsrc_t resource, sc_pm_clk_t clk, bool enable, bool autog); + +/*! + * This function sets the parent of a resource's clock. + * This function should only be called when the clock is disabled. + * + * @param[in] ipc IPC handle + * @param[in] resource ID of the resource + * @param[in] clk clock to affect + * @param[in] parent New parent of the clock. + * + * @return Returns an error code (SC_ERR_NONE = success). + * + * Return errors: + * - SC_ERR_PARM if invalid resource or clock, + * - SC_ERR_NOACCESS if caller's partition is not the resource owner + * or parent of the owner, + * - SC_ERR_UNAVAILABLE if clock not applicable to this resource + * - SC_ERR_BUSY if clock is currently enabled. + * + * Refer to the [Clock List](@ref CLOCKS) for valid clock values. + */ +sc_err_t sc_pm_set_clock_parent(sc_ipc_t ipc, sc_rsrc_t resource, + sc_pm_clk_t clk, sc_pm_clk_parent_t parent); + +/*! + * This function gets the parent of a resource's clock. + * + * @param[in] ipc IPC handle + * @param[in] resource ID of the resource + * @param[in] clk clock to affect + * @param[out] parent pointer to return parent of clock. + * + * @return Returns an error code (SC_ERR_NONE = success). + * + * Return errors: + * - SC_ERR_PARM if invalid resource or clock, + * - SC_ERR_NOACCESS if caller's partition is not the resource owner + * or parent of the owner, + * - SC_ERR_UNAVAILABLE if clock not applicable to this resource + * + * Refer to the [Clock List](@ref CLOCKS) for valid clock values. + */ +sc_err_t sc_pm_get_clock_parent(sc_ipc_t ipc, sc_rsrc_t resource, + sc_pm_clk_t clk, sc_pm_clk_parent_t *parent); + /* @} */ /*! @@ -309,6 +345,31 @@ sc_err_t sc_pm_clock_enable(sc_ipc_t ipc, sc_rsrc_t resource, * @{ */ +/*! + * This function is used to reset the system. Only the owner of the + * SC_R_SYSTEM resource can do this. + * + * @param[in] ipc IPC handle + * @param[in] type reset type + * + * @return Returns an error code (SC_ERR_NONE = success). + * + * Return errors: + * - SC_ERR_PARM if invalid type + * + * If this function returns, then the reset did not occur due to an + * invalid parameter. + */ +sc_err_t sc_pm_reset(sc_ipc_t ipc, sc_pm_reset_type_t type); + +/*! + * This function gets a caller's reset reason. + * + * @param[in] ipc IPC handle + * @param[out] reason pointer to return reset reason + */ +sc_err_t sc_pm_reset_reason(sc_ipc_t ipc, sc_pm_reset_reason_t *reason); + /*! * This function is used to boot a partition. * @@ -317,6 +378,7 @@ sc_err_t sc_pm_clock_enable(sc_ipc_t ipc, sc_rsrc_t resource, * @param[in] resource_cpu ID of the CPU resource to start * @param[in] boot_addr 64-bit boot address * @param[in] resource_mu ID of the MU that must be powered + * @param[in] resource_dev ID of the boot device that must be powered * * @return Returns an error code (SC_ERR_NONE = success). * @@ -327,7 +389,7 @@ sc_err_t sc_pm_clock_enable(sc_ipc_t ipc, sc_rsrc_t resource, */ sc_err_t sc_pm_boot(sc_ipc_t ipc, sc_rm_pt_t pt, sc_rsrc_t resource_cpu, sc_faddr_t boot_addr, - sc_rsrc_t resource_mu); + sc_rsrc_t resource_mu, sc_rsrc_t resource_dev); /*! * This function is used to reboot the caller's partition. @@ -350,32 +412,6 @@ sc_err_t sc_pm_boot(sc_ipc_t ipc, sc_rm_pt_t pt, */ void sc_pm_reboot(sc_ipc_t ipc, sc_pm_reset_type_t type); -/*! - * This function gets a caller's reset reason. - * - * @param[in] ipc IPC handle - * @param[out] reason pointer to return reset reason - */ -void sc_pm_reset_reason(sc_ipc_t ipc, sc_pm_reset_reason_t *reason); - -/*! - * This function is used to start/stop a CPU. - * - * @param[in] ipc IPC handle - * @param[in] resource ID of the CPU resource - * @param[in] enable start if true; otherwise stop - * @param[in] address 64-bit boot address - * - * @return Returns an error code (SC_ERR_NONE = success). - * - * Return errors: - * - SC_ERR_PARM if invalid resource or address, - * - SC_ERR_NOACCESS if caller's partition is not the parent of the - * resource (CPU) owner - */ -sc_err_t sc_pm_cpu_start(sc_ipc_t ipc, sc_rsrc_t resource, bool enable, - sc_faddr_t address); - /*! * This function is used to reboot a partition. * @@ -408,21 +444,22 @@ sc_err_t sc_pm_reboot_partition(sc_ipc_t ipc, sc_rm_pt_t pt, sc_pm_reset_type_t type); /*! - * This function is used to reset the system. Only the owner of the - * SC_R_SYSTEM resource can do this. + * This function is used to start/stop a CPU. * * @param[in] ipc IPC handle - * @param[in] type reset type + * @param[in] resource ID of the CPU resource + * @param[in] enable start if true; otherwise stop + * @param[in] address 64-bit boot address * * @return Returns an error code (SC_ERR_NONE = success). * * Return errors: - * - SC_ERR_PARM if invalid type - * - * If this function returns, then the reset did not occur due to an - * invalid parameter. + * - SC_ERR_PARM if invalid resource or address, + * - SC_ERR_NOACCESS if caller's partition is not the parent of the + * resource (CPU) owner */ -sc_err_t sc_pm_reset(sc_ipc_t ipc, sc_pm_reset_type_t type); +sc_err_t sc_pm_cpu_start(sc_ipc_t ipc, sc_rsrc_t resource, bool enable, + sc_faddr_t address); /* @} */ diff --git a/plat/freescale/common/include/sci/svc/rm/api.h b/plat/freescale/common/include/sci/svc/rm/api.h old mode 100755 new mode 100644 index 887bf479..eb472414 --- a/plat/freescale/common/include/sci/svc/rm/api.h +++ b/plat/freescale/common/include/sci/svc/rm/api.h @@ -1,37 +1,14 @@ /* + * Copyright (C) 2016 Freescale Semiconductor, Inc. * Copyright 2017 NXP * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of NXP nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: GPL-2.0+ */ /*! * Header file containing the public API for the System Controller (SC) * Resource Management (RM) function. This includes functions for - * partitioning resources, pins, and memory regions. + * partitioning resources, pads, and memory regions. * * @addtogroup RM_SVC (SVC) Resource Management Service * @@ -53,20 +30,20 @@ * @name Defines for type widths */ /*@{*/ -#define SC_RM_PARTITION_W 5 //!< Width of sc_rm_pt_t -#define SC_RM_MEMREG_W 6 //!< Width of sc_rm_mr_t -#define SC_RM_DID_W 4 //!< Width of sc_rm_did_t -#define SC_RM_SID_W 6 //!< Width of sc_rm_sid_t -#define SC_RM_SPA_W 2 //!< Width of sc_rm_spa_t -#define SC_RM_PERM_W 3 //!< Width of sc_rm_perm_t +#define SC_RM_PARTITION_W 5 /*!< Width of sc_rm_pt_t */ +#define SC_RM_MEMREG_W 6 /*!< Width of sc_rm_mr_t */ +#define SC_RM_DID_W 4 /*!< Width of sc_rm_did_t */ +#define SC_RM_SID_W 6 /*!< Width of sc_rm_sid_t */ +#define SC_RM_SPA_W 2 /*!< Width of sc_rm_spa_t */ +#define SC_RM_PERM_W 3 /*!< Width of sc_rm_perm_t */ /*@}*/ /*! * @name Defines for ALL parameters */ /*@{*/ -#define SC_RM_PT_ALL UINT8_MAX //!< All partitions -#define SC_RM_MR_ALL UINT8_MAX //!< All memory regions +#define SC_RM_PT_ALL UINT8_MAX /*!< All partitions */ +#define SC_RM_MR_ALL UINT8_MAX /*!< All memory regions */ /*@}*/ /* Types */ @@ -97,10 +74,10 @@ typedef uint16_t sc_rm_sid_t; */ typedef enum sc_rm_spa_e { - SC_RM_SPA_PASSTHRU = 0, //!< Pass through (attribute driven by master) - SC_RM_SPA_PASSSID = 1, //!< Pass through and output on SID - SC_RM_SPA_ASSERT = 2, //!< Assert (force to be secure/privileged) - SC_RM_SPA_NEGATE = 3 //!< Negate (force to be non-secure/user) + SC_RM_SPA_PASSTHRU = 0, /*!< Pass through (attribute driven by master) */ + SC_RM_SPA_PASSSID = 1, /*!< Pass through and output on SID */ + SC_RM_SPA_ASSERT = 2, /*!< Assert (force to be secure/privileged) */ + SC_RM_SPA_NEGATE = 3 /*!< Negate (force to be non-secure/user) */ } sc_rm_spa_t; /*! @@ -109,14 +86,14 @@ typedef enum sc_rm_spa_e */ typedef enum sc_rm_perm_e { - SC_RM_PERM_NONE = 0, //!< No access - SC_RM_PERM_SEC_R = 1, //!< Secure RO - SC_RM_PERM_SECPRIV_RW = 2, //!< Secure privilege R/W - SC_RM_PERM_SEC_RW = 3, //!< Secure R/W - SC_RM_PERM_NSPRIV_R = 4, //!< Secure R/W, non-secure privilege RO - SC_RM_PERM_NS_R = 5, //!< Secure R/W, non-secure RO - SC_RM_PERM_NSPRIV_RW = 6, //!< Secure R/W, non-secure privilege R/W - SC_RM_PERM_FULL = 7 //!< Full access + SC_RM_PERM_NONE = 0, /*!< No access */ + SC_RM_PERM_SEC_R = 1, /*!< Secure RO */ + SC_RM_PERM_SECPRIV_RW = 2, /*!< Secure privilege R/W */ + SC_RM_PERM_SEC_RW = 3, /*!< Secure R/W */ + SC_RM_PERM_NSPRIV_R = 4, /*!< Secure R/W, non-secure privilege RO */ + SC_RM_PERM_NS_R = 5, /*!< Secure R/W, non-secure RO */ + SC_RM_PERM_NSPRIV_RW = 6, /*!< Secure R/W, non-secure privilege R/W */ + SC_RM_PERM_FULL = 7 /*!< Full access */ } sc_rm_perm_t; /* Functions */ @@ -175,11 +152,24 @@ sc_err_t sc_rm_partition_alloc(sc_ipc_t ipc, sc_rm_pt_t *pt, bool secure, * - SC_ERR_NOACCESS if caller's partition is not the parent of \a pt, * - SC_ERR_LOCKED if \a pt or caller's partition is locked * - * All resources, memory regions, and pins are assigned to the caller/parent. + * All resources, memory regions, and pads are assigned to the caller/parent. * The partition watchdog is disabled (even if locked). DID is freed. */ sc_err_t sc_rm_partition_free(sc_ipc_t ipc, sc_rm_pt_t pt); +/*! + * This function returns the DID of a partition. + * + * @param[in] ipc IPC handle + * + * @return Returns the domain ID (DID) of the caller's partition. + * + * The DID is a SoC-specific internal ID used by the HW resource + * protection mechanism. It is only required by clients when using the + * SEMA42 module as the DID is sometimes connected to the master ID. + */ +sc_rm_did_t sc_rm_get_did(sc_ipc_t ipc); + /*! * This function forces a partition to use a specific static DID. * @@ -213,7 +203,7 @@ sc_err_t sc_rm_partition_static(sc_ipc_t ipc, sc_rm_pt_t pt, * - SC_PARM if \a pt out of range, * - SC_ERR_NOACCESS if caller's partition is not the parent of \a pt * - * If a partition is locked it cannot be freed, have resources/pins assigned + * If a partition is locked it cannot be freed, have resources/pads assigned * to/from it, memory regions created/assigned, DID changed, or parent changed. */ sc_err_t sc_rm_partition_lock(sc_ipc_t ipc, sc_rm_pt_t pt); @@ -248,7 +238,7 @@ sc_err_t sc_rm_set_parent(sc_ipc_t ipc, sc_rm_pt_t pt, sc_rm_pt_t pt_parent); /*! - * This function moves all movable resources/pins owned by a source partition + * This function moves all movable resources/pads owned by a source partition * to a destination partition. It can be used to more quickly set up a new * partition if a majority of the caller's resources are to be moved to a * new partition. @@ -259,7 +249,7 @@ sc_err_t sc_rm_set_parent(sc_ipc_t ipc, sc_rm_pt_t pt, * @param[in] pt_dst handle of partition to which resources should be * moved to * @param[in] move_rsrc boolean to indicate if resources should be moved - * @param[in] move_pins boolean to indicate if pins should be moved + * @param[in] move_pads boolean to indicate if pads should be moved * * @return Returns an error code (SC_ERR_NONE = success). * @@ -275,7 +265,7 @@ sc_err_t sc_rm_set_parent(sc_ipc_t ipc, sc_rm_pt_t pt, * - SC_ERR_LOCKED if either partition is locked */ sc_err_t sc_rm_move_all(sc_ipc_t ipc, sc_rm_pt_t pt_src, sc_rm_pt_t pt_dst, - bool move_rsrc, bool move_pins); + bool move_rsrc, bool move_pads); /* @} */ @@ -576,63 +566,63 @@ sc_err_t sc_rm_get_memreg_info(sc_ipc_t ipc, sc_rm_mr_t mr, /* @} */ /*! - * @name Pin Functions + * @name Pad Functions * @{ */ /*! - * This function assigns ownership of a pin to a partition. + * This function assigns ownership of a pad to a partition. * * @param[in] ipc IPC handle - * @param[in] pt handle of partition to which pin should + * @param[in] pt handle of partition to which pad should * be assigned - * @param[in] pin pin to assign + * @param[in] pad pad to assign * * @return Returns an error code (SC_ERR_NONE = success). * * Return errors: * - SC_ERR_NOACCESS if caller's partition is restricted, * - SC_PARM if arguments out of range or invalid, - * - SC_ERR_NOACCESS if caller's partition is not the pin owner or parent + * - SC_ERR_NOACCESS if caller's partition is not the pad owner or parent * of the owner, * - SC_ERR_LOCKED if the owning partition or \a pt is locked */ -sc_err_t sc_rm_assign_pin(sc_ipc_t ipc, sc_rm_pt_t pt, sc_pin_t pin); +sc_err_t sc_rm_assign_pad(sc_ipc_t ipc, sc_rm_pt_t pt, sc_pad_t pad); /*! - * This function flags pins as movable or not. + * This function flags pads as movable or not. * * @param[in] ipc IPC handle - * @param[in] pin_fst first pin for which flag should be set - * @param[in] pin_lst last pin for which flag should be set + * @param[in] pad_fst first pad for which flag should be set + * @param[in] pad_lst last pad for which flag should be set * @param[in] movable movable flag (true) is movable * * @return Returns an error code (SC_ERR_NONE = success). * * Return errors: - * - SC_PARM if pins are out of range, - * - SC_ERR_NOACCESS if caller's partition is not a parent of a pin owner, + * - SC_PARM if pads are out of range, + * - SC_ERR_NOACCESS if caller's partition is not a parent of a pad owner, * - SC_ERR_LOCKED if the owning partition is locked * - * This function is used to determine the set of pins that will be - * moved using the sc_rm_move_all() function. All pins are movable + * This function is used to determine the set of pads that will be + * moved using the sc_rm_move_all() function. All pads are movable * by default so this function is normally used to prevent a set of - * pins from moving. + * pads from moving. */ -sc_err_t sc_rm_set_pin_movable(sc_ipc_t ipc, sc_pin_t pin_fst, - sc_pin_t pin_lst, bool movable); +sc_err_t sc_rm_set_pad_movable(sc_ipc_t ipc, sc_pad_t pad_fst, + sc_pad_t pad_lst, bool movable); /*! - * This function gets ownership status of a pin. + * This function gets ownership status of a pad. * * @param[in] ipc IPC handle - * @param[in] pin pin to check + * @param[in] pad pad to check * - * @return Returns a boolean (true if caller's partition owns the pin). + * @return Returns a boolean (true if caller's partition owns the pad). * - * If \a pin is out of range then false is returned. + * If \a pad is out of range then false is returned. */ -bool sc_rm_is_pin_owned(sc_ipc_t ipc, sc_pin_t pin); +bool sc_rm_is_pad_owned(sc_ipc_t ipc, sc_pad_t pad); /* @} */ -- cgit v1.2.3