xref: /aosp_15_r20/external/coreboot/src/mainboard/google/storm/gsbi.c (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 
3 #include <soc/gpio.h>
4 #include <soc/gsbi.h>
5 #include <soc/qup.h>
6 
7 #define GPIO_FUNC_I2C		0x1
8 
gsbi_init_board(gsbi_id_t gsbi_id)9 int gsbi_init_board(gsbi_id_t gsbi_id)
10 {
11 	switch (gsbi_id) {
12 	case GSBI_ID_7:
13 			gpio_tlmm_config_set(8, GPIO_FUNC_I2C,
14 					     GPIO_NO_PULL, GPIO_2MA, 1);
15 			gpio_tlmm_config_set(9, GPIO_FUNC_I2C,
16 					     GPIO_NO_PULL, GPIO_2MA, 1);
17 		break;
18 	case GSBI_ID_4:
19 			/* Configure GPIOs 13 - SCL, 12 - SDA, 2mA gpio_en */
20 			gpio_tlmm_config_set(12, GPIO_FUNC_I2C,
21 					     GPIO_NO_PULL, GPIO_2MA, 1);
22 			gpio_tlmm_config_set(13, GPIO_FUNC_I2C,
23 					     GPIO_NO_PULL, GPIO_2MA, 1);
24 		break;
25 	case GSBI_ID_1:
26 			/* Configure GPIOs 54 - SCL, 53 - SDA, 2mA gpio_en */
27 			gpio_tlmm_config_set(54, GPIO_FUNC_I2C,
28 					     GPIO_NO_PULL, GPIO_2MA, 1);
29 			gpio_tlmm_config_set(53, GPIO_FUNC_I2C,
30 					     GPIO_NO_PULL, GPIO_2MA, 1);
31 		break;
32 	default:
33 		return 1;
34 	}
35 
36 	return 0;
37 }
38