blob: 3d2d933aff6204162511b86abb84f17fdf5f7e1b [file] [log] [blame]
Nariman Poushinb44cfc62018-02-26 06:52:04 +00001/*
Vijayenthiran Subramaniamc7d4a212019-09-23 19:32:32 +05302 * Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved.
Nariman Poushinb44cfc62018-02-26 06:52:04 +00003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Chandni Cherukuri7c294f92018-10-04 16:32:03 +05307#include <assert.h>
Antonio Nino Diaz09d40e02018-12-14 00:18:21 +00008
Chandni Cherukuri7c294f92018-10-04 16:32:03 +05309#include <libfdt.h>
Antonio Nino Diaz09d40e02018-12-14 00:18:21 +000010
11#include <common/bl_common.h>
12#include <common/debug.h>
Antonio Nino Diazc4113962019-01-23 21:08:43 +000013#include <drivers/arm/css/css_mhu_doorbell.h>
Antonio Nino Diaz14928b82019-01-23 20:37:32 +000014#include <drivers/arm/css/scmi.h>
Antonio Nino Diazbd9344f2019-01-25 14:30:04 +000015#include <plat/arm/common/plat_arm.h>
Ambroise Vincent609e0532019-02-13 15:58:00 +000016#include <plat/common/platform.h>
Antonio Nino Diaz09d40e02018-12-14 00:18:21 +000017
Sughosh Ganu485fc952018-05-16 17:22:35 +053018#include <sgi_ras.h>
Chandni Cherukuri7c294f92018-10-04 16:32:03 +053019#include <sgi_variant.h>
Antonio Nino Diaz09d40e02018-12-14 00:18:21 +000020
Chandni Cherukuri7c294f92018-10-04 16:32:03 +053021sgi_platform_info_t sgi_plat_info;
22
Chandni Cherukurib911ddd2018-10-11 14:08:08 +053023static scmi_channel_plat_info_t sgi575_scmi_plat_info = {
24 .scmi_mbx_mem = CSS_SCMI_PAYLOAD_BASE,
25 .db_reg_addr = PLAT_CSS_MHU_BASE + CSS_SCMI_MHU_DB_REG_OFF,
26 .db_preserve_mask = 0xfffffffe,
27 .db_modify_mask = 0x1,
28 .ring_doorbell = &mhu_ring_doorbell,
29};
30
Chandni Cherukuri27a257d2019-02-27 13:59:11 +053031static scmi_channel_plat_info_t rd_n1e1_edge_scmi_plat_info = {
Chandni Cherukuri7c294f92018-10-04 16:32:03 +053032 .scmi_mbx_mem = CSS_SCMI_PAYLOAD_BASE,
33 .db_reg_addr = PLAT_CSS_MHU_BASE + SENDER_REG_SET(0),
34 .db_preserve_mask = 0xfffffffe,
35 .db_modify_mask = 0x1,
36 .ring_doorbell = &mhuv2_ring_doorbell,
37};
38
Aditya Angadi31e703f2019-12-31 14:23:53 +053039scmi_channel_plat_info_t *plat_css_get_scmi_info(int channel_id)
Chandni Cherukurib911ddd2018-10-11 14:08:08 +053040{
Chandni Cherukuri27a257d2019-02-27 13:59:11 +053041 if (sgi_plat_info.platform_id == RD_N1E1_EDGE_SID_VER_PART_NUM)
42 return &rd_n1e1_edge_scmi_plat_info;
Chandni Cherukuri7c294f92018-10-04 16:32:03 +053043 else if (sgi_plat_info.platform_id == SGI575_SSC_VER_PART_NUM)
44 return &sgi575_scmi_plat_info;
45 else
46 panic();
Ambroise Vincent609e0532019-02-13 15:58:00 +000047}
Chandni Cherukuri7c294f92018-10-04 16:32:03 +053048
Nariman Poushinb44cfc62018-02-26 06:52:04 +000049void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
50 u_register_t arg2, u_register_t arg3)
51{
Chandni Cherukuri699223a2018-11-28 11:31:51 +053052 sgi_plat_info.platform_id = plat_arm_sgi_get_platform_id();
53 sgi_plat_info.config_id = plat_arm_sgi_get_config_id();
Vijayenthiran Subramaniam6daeec72019-10-22 15:46:14 +053054 sgi_plat_info.multi_chip_mode = plat_arm_sgi_get_multi_chip_mode();
Chandni Cherukuri7c294f92018-10-04 16:32:03 +053055
Nariman Poushinb44cfc62018-02-26 06:52:04 +000056 arm_bl31_early_platform_setup((void *)arg0, arg1, arg2, (void *)arg3);
57}
Sughosh Ganu485fc952018-05-16 17:22:35 +053058
Vijayenthiran Subramaniamc7d4a212019-09-23 19:32:32 +053059void sgi_bl31_common_platform_setup(void)
Sughosh Ganu485fc952018-05-16 17:22:35 +053060{
61 arm_bl31_platform_setup();
62
63#if RAS_EXTENSION
64 sgi_ras_intr_handler_setup();
65#endif
66}
Chandni Cherukuri89f2e582018-11-14 13:43:59 +053067
68const plat_psci_ops_t *plat_arm_psci_override_pm_ops(plat_psci_ops_t *ops)
69{
Chandni Cherukuri27a257d2019-02-27 13:59:11 +053070 /* For RD-E1-Edge platform only CPU ON/OFF is supported */
71 if ((sgi_plat_info.platform_id == RD_N1E1_EDGE_SID_VER_PART_NUM) &&
72 (sgi_plat_info.config_id == RD_E1_EDGE_CONFIG_ID)) {
Chandni Cherukuri187ae312018-11-22 10:15:25 +053073 ops->cpu_standby = NULL;
74 ops->system_off = NULL;
75 ops->system_reset = NULL;
76 ops->get_sys_suspend_power_state = NULL;
77 ops->pwr_domain_suspend = NULL;
78 ops->pwr_domain_suspend_finish = NULL;
79 }
80
Chandni Cherukuri89f2e582018-11-14 13:43:59 +053081 return css_scmi_override_pm_ops(ops);
82}