1 /*
2  * Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <common/bl_common.h>
8 #include <common/debug.h>
9 #include <drivers/arm/css/css_mhu_doorbell.h>
10 #include <drivers/arm/css/scmi.h>
11 #include <plat/arm/common/plat_arm.h>
12 
13 #include <sgm_plat_config.h>
14 
15 static scmi_channel_plat_info_t sgm775_scmi_plat_info = {
16 		.scmi_mbx_mem = CSS_SCMI_PAYLOAD_BASE,
17 		.db_reg_addr = PLAT_CSS_MHU_BASE + CSS_SCMI_MHU_DB_REG_OFF,
18 		.db_preserve_mask = 0xfffffffe,
19 		.db_modify_mask = 0x1,
20 		.ring_doorbell = &mhu_ring_doorbell,
21 };
22 
plat_css_get_scmi_info(int channel_id)23 scmi_channel_plat_info_t *plat_css_get_scmi_info(int channel_id)
24 {
25 	return &sgm775_scmi_plat_info;
26 }
27 
bl31_early_platform_setup2(u_register_t arg0,u_register_t arg1,u_register_t arg2,u_register_t arg3)28 void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
29 				u_register_t arg2, u_register_t arg3)
30 {
31 	uint32_t plat_version;
32 	bl_params_node_t *bl_params;
33 
34 	bl_params = ((bl_params_t *)arg0)->head;
35 
36 	/* Initialize the platform configuration structure */
37 	plat_config_init();
38 
39 	while (bl_params) {
40 		if (bl_params->image_id == BL33_IMAGE_ID) {
41 			plat_version = mmio_read_32(SSC_VERSION);
42 			bl_params->ep_info->args.arg2 = plat_version;
43 			break;
44 		}
45 
46 		bl_params = bl_params->next_params_info;
47 	}
48 
49 	arm_bl31_early_platform_setup((void *)arg0, arg1, arg2, (void *)arg3);
50 }
51 
plat_arm_psci_override_pm_ops(plat_psci_ops_t * ops)52 const plat_psci_ops_t *plat_arm_psci_override_pm_ops(plat_psci_ops_t *ops)
53 {
54 	return css_scmi_override_pm_ops(ops);
55 }
56