soc/intel/ptl: Update ME specification version to 21
[coreboot.git] / src / mainboard / google / gale / blsp.c
blob8b76c3b4b119adef8fe641d6ac68da707405d13a
1 /* SPDX-License-Identifier: BSD-3-Clause */
3 #include <gpio.h>
4 #include <soc/blsp.h>
5 #include <soc/qup.h>
7 #define IPQ40XX_I2C0_PINGROUP_1 1
8 #define IPQ40XX_I2C0_PINGROUP_2 (!IPQ40XX_I2C0_PINGROUP_1)
9 #define IPQ40XX_I2C1_PINGROUP_1 1
11 #if IPQ40XX_I2C0_PINGROUP_1
13 #define SCL_GPIO 20
14 #define SDA_GPIO 21
15 #define GPIO_FUNC_SCL 0x1
16 #define GPIO_FUNC_SDA 0x1
18 #elif IPQ40XX_I2C0_PINGROUP_2
20 #define SCL_GPIO 58
21 #define SDA_GPIO 59
22 #define GPIO_FUNC_SCL 0x3
23 #define GPIO_FUNC_SDA 0x2
25 #else
27 #warning "TPM: I2C pingroup not specified"
29 #endif
31 #if IPQ40XX_I2C1_PINGROUP_1
33 #define SCL_GPIO_I2C1 34
34 #define SDA_GPIO_I2C1 35
35 #define GPIO_I2C1_FUNC_SCL 0x1
36 #define GPIO_I2C1_FUNC_SDA 0x1
38 #endif
40 int blsp_i2c_init_board(blsp_qup_id_t id)
42 switch (id) {
43 case BLSP_QUP_ID_0:
44 case BLSP_QUP_ID_1:
45 case BLSP_QUP_ID_2:
46 case BLSP_QUP_ID_3:
47 #if defined(IPQ40XX_I2C0_PINGROUP_1) || defined(IPQ40XX_I2C0_PINGROUP_2)
48 gpio_tlmm_config_set(SDA_GPIO, GPIO_FUNC_SDA,
49 GPIO_NO_PULL, GPIO_2MA, 1);
50 gpio_tlmm_config_set(SCL_GPIO, GPIO_FUNC_SCL,
51 GPIO_NO_PULL, GPIO_2MA, 1);
52 #endif /* Pin Group 1 or 2 */
54 #if defined(IPQ40XX_I2C1_PINGROUP_1)
55 gpio_tlmm_config_set(SDA_GPIO_I2C1, GPIO_I2C1_FUNC_SDA,
56 GPIO_NO_PULL, GPIO_2MA, 1);
57 gpio_tlmm_config_set(SCL_GPIO_I2C1, GPIO_I2C1_FUNC_SCL,
58 GPIO_NO_PULL, GPIO_2MA, 1);
59 #endif
60 break;
61 default:
62 return 1;
65 return 0;