summaryrefslogtreecommitdiff
path: root/board/banshee/i2c.c
blob: ea3fd38e62a0e759684a853930058aa126ea0fc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* Copyright 2022 The ChromiumOS Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "common.h"
#include "compile_time_macros.h"
#include "hooks.h"
#include "i2c.h"
#include "i2c_bitbang.h"

#define BOARD_ID_FAST_PLUS_CAPABLE 2

/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
	{
		/* I2C0 */
		.name = "sensor",
		.port = I2C_PORT_SENSOR,
		.kbps = 400,
		.scl = GPIO_EC_I2C_SENSOR_SCL,
		.sda = GPIO_EC_I2C_SENSOR_SDA,
	},
	{
		/* I2C1 */
		.name = "tcpc0,1",
		.port = I2C_PORT_USB_C0_C1_TCPC,
		.kbps = 400,
		.scl = GPIO_EC_I2C_USB_C0_C1_TCPC_SCL,
		.sda = GPIO_EC_I2C_USB_C0_C1_TCPC_SDA,
	},
	{
		/* I2C2 */
		.name = "ppc, bc12",
		.port = I2C_PORT_USB_PPC_BC12,
		.kbps = 400,
		.scl = GPIO_EC_I2C_USB_PPC_BC_SCL,
		.sda = GPIO_EC_I2C_USB_PPC_BC_SDA,
	},
	{
		/* I2C3 */
		.name = "retimer0,1",
		.port = I2C_PORT_USB_C0_C1_MUX,
		.kbps = 400,
		.scl = GPIO_EC_I2C_USB_C0_C1_RT_SCL,
		.sda = GPIO_EC_I2C_USB_C0_C1_RT_SDA,
	},
	{
		/* I2C4 */
		.name = "tcpc2,3",
		.port = I2C_PORT_USB_C2_C3_TCPC,
		.kbps = 400,
		.scl = GPIO_EC_I2C_USB_C2_C3_TCPC_SCL,
		.sda = GPIO_EC_I2C_USB_C2_C3_TCPC_SDA,
	},
	{
		/* I2C5 */
		.name = "battery",
		.port = I2C_PORT_BATTERY,
		.kbps = 100,
		.scl = GPIO_EC_I2C_BAT_SCL,
		.sda = GPIO_EC_I2C_BAT_SDA,
	},
	{
		/* I2C6 */
		.name = "retimer2,3",
		.port = I2C_PORT_USB_C2_C3_MUX,
		.kbps = 400,
		.scl = GPIO_EC_I2C_USB_C2_C3_RT_SCL,
		.sda = GPIO_EC_I2C_USB_C2_C3_RT_SDA,
	},
	{
		/* I2C7 */
		.name = "eeprom",
		.port = I2C_PORT_EEPROM,
		.kbps = 400,
		.scl = GPIO_EC_I2C_MISC_SCL_R,
		.sda = GPIO_EC_I2C_MISC_SDA_R,
	},
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);

const struct i2c_port_t i2c_bitbang_ports[] = {
	[I2C_BITBANG_CHAN_BRD_ID] = {
		.name = "bitbang_brd_id",
		.port = I2C_PORT_EEPROM,
		.kbps = 100,
		.scl = GPIO_EC_I2C_MISC_SCL_R,
		.sda = GPIO_EC_I2C_MISC_SDA_R,
		.drv = &bitbang_drv,
	},
};
BUILD_ASSERT(ARRAY_SIZE(i2c_bitbang_ports) == I2C_BITBANG_CHAN_COUNT);
const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);