coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
blsp.c
Go to the documentation of this file.
1
/* SPDX-License-Identifier: BSD-3-Clause */
2
3
#include <gpio.h>
4
#include <soc/gpio.h>
5
#include <soc/blsp.h>
6
#include <soc/qup.h>
7
8
#define IPQ40XX_I2C0_PINGROUP_1 1
9
#define IPQ40XX_I2C0_PINGROUP_2 (!IPQ40XX_I2C0_PINGROUP_1)
10
#define IPQ40XX_I2C1_PINGROUP_1 1
11
12
#if IPQ40XX_I2C0_PINGROUP_1
13
14
#define SCL_GPIO 20
15
#define SDA_GPIO 21
16
#define GPIO_FUNC_SCL 0x1
17
#define GPIO_FUNC_SDA 0x1
18
19
#elif IPQ40XX_I2C0_PINGROUP_2
20
21
#define SCL_GPIO 58
22
#define SDA_GPIO 59
23
#define GPIO_FUNC_SCL 0x3
24
#define GPIO_FUNC_SDA 0x2
25
26
#else
27
28
#warning "TPM: I2C pingroup not specified"
29
30
#endif
31
32
#if IPQ40XX_I2C1_PINGROUP_1
33
34
#define SCL_GPIO_I2C1 34
35
#define SDA_GPIO_I2C1 35
36
#define GPIO_I2C1_FUNC_SCL 0x1
37
#define GPIO_I2C1_FUNC_SDA 0x1
38
39
#endif
40
41
int
blsp_i2c_init_board
(
blsp_qup_id_t
id
)
42
{
43
switch
(
id
) {
44
case
BLSP_QUP_ID_0
:
45
case
BLSP_QUP_ID_1
:
46
case
BLSP_QUP_ID_2
:
47
case
BLSP_QUP_ID_3
:
48
#if defined(IPQ40XX_I2C0_PINGROUP_1) || defined(IPQ40XX_I2C0_PINGROUP_2)
49
gpio_tlmm_config_set
(
SDA_GPIO
,
GPIO_FUNC_SDA
,
50
GPIO_NO_PULL
,
GPIO_2MA
, 1);
51
gpio_tlmm_config_set
(
SCL_GPIO
,
GPIO_FUNC_SCL
,
52
GPIO_NO_PULL
,
GPIO_2MA
, 1);
53
#endif
/* Pin Group 1 or 2 */
54
55
#if defined(IPQ40XX_I2C1_PINGROUP_1)
56
gpio_tlmm_config_set
(
SDA_GPIO_I2C1
,
GPIO_I2C1_FUNC_SDA
,
57
GPIO_NO_PULL
,
GPIO_2MA
, 1);
58
gpio_tlmm_config_set
(
SCL_GPIO_I2C1
,
GPIO_I2C1_FUNC_SCL
,
59
GPIO_NO_PULL
,
GPIO_2MA
, 1);
60
#endif
61
break
;
62
default
:
63
return
1;
64
}
65
66
return
0;
67
}
blsp_qup_id_t
blsp_qup_id_t
Definition:
blsp.h:6
BLSP_QUP_ID_1
@ BLSP_QUP_ID_1
Definition:
blsp.h:8
BLSP_QUP_ID_3
@ BLSP_QUP_ID_3
Definition:
blsp.h:10
BLSP_QUP_ID_0
@ BLSP_QUP_ID_0
Definition:
blsp.h:7
BLSP_QUP_ID_2
@ BLSP_QUP_ID_2
Definition:
blsp.h:9
SDA_GPIO_I2C1
#define SDA_GPIO_I2C1
Definition:
blsp.c:35
GPIO_FUNC_SCL
#define GPIO_FUNC_SCL
Definition:
blsp.c:16
SCL_GPIO_I2C1
#define SCL_GPIO_I2C1
Definition:
blsp.c:34
GPIO_FUNC_SDA
#define GPIO_FUNC_SDA
Definition:
blsp.c:17
GPIO_I2C1_FUNC_SCL
#define GPIO_I2C1_FUNC_SCL
Definition:
blsp.c:36
blsp_i2c_init_board
int blsp_i2c_init_board(blsp_qup_id_t id)
Definition:
blsp.c:41
GPIO_I2C1_FUNC_SDA
#define GPIO_I2C1_FUNC_SDA
Definition:
blsp.c:37
SDA_GPIO
#define SDA_GPIO
Definition:
blsp.c:15
SCL_GPIO
#define SCL_GPIO
Definition:
blsp.c:14
GPIO_2MA
@ GPIO_2MA
Definition:
gpio_common.h:70
GPIO_NO_PULL
@ GPIO_NO_PULL
Definition:
gpio_common.h:62
gpio_tlmm_config_set
void gpio_tlmm_config_set(gpio_t gpio, unsigned int func, unsigned int pull, unsigned int drvstr, unsigned int enable)
Definition:
gpio.c:32
src
mainboard
google
gale
blsp.c
Generated by
1.9.1