Browse Source

refactor(ti): remove ti_sci_init function

ti_sci_get_revision handles getting the firmware version and ti_sci_init
is just a wrapper around it with no added benefit.

Refactor the ti_sci_get_revision to give the version information and
remove ti_sci_init wrapper.

Change-Id: I39184af5b00bedc8b9220533f1ddac3b6672d2f1
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
pull/1999/merge
Manorit Chawdhry 9 months ago
parent
commit
73d772d87f
  1. 41
      plat/ti/k3/common/drivers/ti_sci/ti_sci.c
  2. 44
      plat/ti/k3/common/drivers/ti_sci/ti_sci.h
  3. 17
      plat/ti/k3/common/k3_bl31_setup.c

41
plat/ti/k3/common/drivers/ti_sci/ti_sci.c

@ -2,7 +2,7 @@
* Texas Instruments System Control Interface Driver
* Based on Linux and U-Boot implementation
*
* Copyright (C) 2018-2022 Texas Instruments Incorporated - https://www.ti.com/
* Copyright (C) 2018-2024 Texas Instruments Incorporated - https://www.ti.com/
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -185,17 +185,20 @@ unlock:
*
* Updates the SCI information in the internal data structure.
*
* @version: Structure containing the version info
*
* Return: 0 if all goes well, else appropriate error message
*/
int ti_sci_get_revision(struct ti_sci_msg_resp_version *rev_info)
int ti_sci_get_revision(struct ti_sci_msg_version *version)
{
struct ti_sci_msg_resp_version rev_info;
struct ti_sci_msg_hdr hdr;
struct ti_sci_xfer xfer;
int ret;
ret = ti_sci_setup_one_xfer(TI_SCI_MSG_VERSION, 0x0,
&hdr, sizeof(hdr),
rev_info, sizeof(*rev_info),
&rev_info, sizeof(rev_info),
&xfer);
if (ret) {
ERROR("Message alloc failed (%d)\n", ret);
@ -208,6 +211,14 @@ int ti_sci_get_revision(struct ti_sci_msg_resp_version *rev_info)
return ret;
}
memcpy(version->firmware_description, rev_info.firmware_description,
sizeof(rev_info.firmware_description));
version->abi_major = rev_info.abi_major;
version->abi_minor = rev_info.abi_minor;
version->firmware_revision = rev_info.firmware_revision;
version->sub_version = rev_info.sub_version;
version->patch_version = rev_info.patch_version;
return 0;
}
@ -1729,27 +1740,3 @@ int ti_sci_enter_sleep(uint8_t proc_id,
return 0;
}
/**
* ti_sci_init() - Basic initialization
*
* Return: 0 if all goes well, else appropriate error message
*/
int ti_sci_init(void)
{
struct ti_sci_msg_resp_version rev_info;
int ret;
ret = ti_sci_get_revision(&rev_info);
if (ret) {
ERROR("Unable to communicate with control firmware (%d)\n", ret);
return ret;
}
INFO("SYSFW ABI: %d.%d (firmware rev 0x%04x '%s')\n",
rev_info.abi_major, rev_info.abi_minor,
rev_info.firmware_revision,
rev_info.firmware_description);
return 0;
}

44
plat/ti/k3/common/drivers/ti_sci/ti_sci.h

@ -2,7 +2,7 @@
* Texas Instruments System Control Interface API
* Based on Linux and U-Boot implementation
*
* Copyright (C) 2018-2022 Texas Instruments Incorporated - https://www.ti.com/
* Copyright (C) 2018-2024 Texas Instruments Incorporated - https://www.ti.com/
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -13,6 +13,41 @@
#include <stdint.h>
#include <stdbool.h>
/**
* User exported structures.
*
* The structures in ti_sci_protocol.h are used by the internal drivers.
* These are the structures that are exported for outside use and populated
* by the internal drivers.
*
* struct ti_sci_msg_version - Structure containing version info
*
* @firmware_description: String describing the firmware
* @firmware_revision: Firmware revision
* @abi_major: Major version of the ABI that firmware supports
* @abi_minor: Minor version of the ABI that firmware supports
* @sub_version: Sub-version number of the firmware
* @patch_version: Patch-version number of the firmware.
*/
struct ti_sci_msg_version {
#define FIRMWARE_DESCRIPTION_LENGTH 32
char firmware_description[FIRMWARE_DESCRIPTION_LENGTH];
uint16_t firmware_revision;
uint8_t abi_major;
uint8_t abi_minor;
uint8_t sub_version;
uint8_t patch_version;
};
/**
* General Message
*
* ti_sci_get_revision - Get the revision of the SCI entity
* @version: Structure containing the version info
*
**/
int ti_sci_get_revision(struct ti_sci_msg_version *version);
/**
* Device control operations
*
@ -225,11 +260,4 @@ int ti_sci_enter_sleep(uint8_t proc_id,
uint8_t mode,
uint64_t core_resume_addr);
/**
* ti_sci_init() - Basic initialization
*
* Return: 0 if all goes good, else appropriate error message.
*/
int ti_sci_init(void);
#endif /* TI_SCI_H */

17
plat/ti/k3/common/k3_bl31_setup.c

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2017-2024, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -119,10 +119,23 @@ void bl31_plat_arch_setup(void)
void bl31_platform_setup(void)
{
struct ti_sci_msg_version version;
int ret;
k3_gic_driver_init(K3_GIC_BASE);
k3_gic_init();
ti_sci_init();
ret = ti_sci_get_revision(&version);
if (ret) {
ERROR("Unable to communicate with the control firmware (%d)\n", ret);
return;
}
INFO("SYSFW ABI: %d.%d (firmware rev 0x%04x '%s')\n",
version.abi_major, version.abi_minor,
version.firmware_revision,
version.firmware_description);
}
void platform_mem_init(void)

Loading…
Cancel
Save