| 1 | /* SPDX-License-Identifier: BSD-3-Clause */ |
| 2 | |
| 3 | #include <device/mmio.h> |
| 4 | #include <soc/blsp.h> |
| 5 | #include <soc/clock.h> |
| 6 | |
| 7 | blsp_return_t blsp_i2c_init(blsp_qup_id_t id) |
| 8 | { |
| 9 | void *base = blsp_qup_base(id); |
| 10 | |
| 11 | if (!base) |
| 12 | return BLSP_ID_ERROR; |
| 13 | |
| 14 | if (blsp_i2c_clock_config(id) != 0) |
| 15 | return BLSP_ID_ERROR; |
| 16 | |
| 17 | if (blsp_i2c_init_board(id)) |
| 18 | return BLSP_UNSUPPORTED; |
| 19 | |
| 20 | /* Configure Mini core to I2C core */ |
| 21 | clrsetbits32(base, BLSP_MINI_CORE_MASK, BLSP_MINI_CORE_I2C); |
| 22 | |
| 23 | return BLSP_SUCCESS; |
| 24 | } |