1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2019-2021, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #include "config_clock.h"
9 #include "n1sdp_scp_mmap.h"
10 
11 #include <mod_n1sdp_dmc620.h>
12 
13 #include <fwk_element.h>
14 #include <fwk_id.h>
15 #include <fwk_module.h>
16 #include <fwk_module_idx.h>
17 
18 /* Table of DMC620 elements descriptions. */
19 static struct fwk_element dmc620_element_table[] = {
20     [0] = { .name = "DMC620-0",
21             .data = &((struct mod_dmc620_element_config) {
22                 .dmc = SCP_DMC0,
23                 .ddr_id = FWK_ID_ELEMENT_INIT(
24                     FWK_MODULE_IDX_N1SDP_DDR_PHY, 0),
25                 .clock_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_CLOCK,
26                     CLOCK_IDX_INTERCONNECT),
27         }),
28     },
29     [1] = { .name = "DMC620-1",
30             .data = &((struct mod_dmc620_element_config) {
31                 .dmc = SCP_DMC1,
32                 .ddr_id = FWK_ID_ELEMENT_INIT(
33                     FWK_MODULE_IDX_N1SDP_DDR_PHY, 1),
34                 .clock_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_CLOCK,
35                     CLOCK_IDX_INTERCONNECT),
36         }),
37     },
38     [2] = { 0 }, /* Termination description. */
39 };
40 
dmc620_get_element_table(fwk_id_t module_id)41 static const struct fwk_element *dmc620_get_element_table(fwk_id_t module_id)
42 {
43     return dmc620_element_table;
44 }
45 
46 /* Configuration of the DMC620 module. */
47 const struct fwk_module_config config_n1sdp_dmc620 = {
48     .data =
49         &(struct mod_dmc620_module_config){
50             .ddr_module_id = FWK_ID_MODULE_INIT(FWK_MODULE_IDX_N1SDP_DDR_PHY),
51             .ddr_api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_N1SDP_DDR_PHY, 0),
52             .ddr_speed = DDR_CLOCK_MHZ,
53         },
54 
55     .elements = FWK_MODULE_DYNAMIC_ELEMENTS(dmc620_get_element_table),
56 };
57