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 "juno_mmap.h"
9 
10 #include <mod_dw_apb_i2c.h>
11 #include <mod_i2c.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 #include <fmw_cmsis.h>
19 
20 #include <stdint.h>
21 
22 static const struct fwk_element dw_apb_i2c_element_table[] = {
23     [0] = {
24         .name = "",
25         .data =
26             &(struct mod_dw_apb_i2c_dev_config){
27                 .timer_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_TIMER, 0),
28                 .i2c_irq = (unsigned int)I2C_IRQ,
29                 .reg = (uintptr_t)I2C_BASE,
30         },
31     },
32     [1] = { 0 },
33 };
34 
dw_apb_i2c_get_element_table(fwk_id_t module_id)35 static const struct fwk_element *dw_apb_i2c_get_element_table(
36     fwk_id_t module_id)
37 {
38     return dw_apb_i2c_element_table;
39 }
40 
41 struct fwk_module_config config_dw_apb_i2c = {
42     .elements = FWK_MODULE_DYNAMIC_ELEMENTS(dw_apb_i2c_get_element_table),
43 };
44 
45 static const struct fwk_element i2c_element_table[] = {
46     [0] = {
47         .name = "I2C",
48         .data = &(struct mod_i2c_dev_config) {
49             .driver_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_DW_APB_I2C, 0),
50             .api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_DW_APB_I2C,
51                 MOD_DW_APB_I2C_API_IDX_DRIVER),
52         },
53     },
54     [1] = {0},
55 };
56 
i2c_get_element_table(fwk_id_t module_id)57 static const struct fwk_element *i2c_get_element_table(fwk_id_t module_id)
58 {
59     return i2c_element_table;
60 }
61 
62 struct fwk_module_config config_i2c = {
63     .elements = FWK_MODULE_DYNAMIC_ELEMENTS(i2c_get_element_table),
64 };
65