summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@chromium.org>2019-06-25 12:44:16 -0600
committerCommit Bot <commit-bot@chromium.org>2019-07-19 21:11:02 +0000
commitd1a18f82ed831d4e640336ff5571f5fa64bc7b36 (patch)
treec46aeb6136de1c27c66e3d5f662e9620161bef7b /board
parent1f14229fa7e499dfcee07d17add187598ff0a46c (diff)
downloadchrome-ec-d1a18f82ed831d4e640336ff5571f5fa64bc7b36.tar.gz
Use 7bit I2C/SPI slave addresses in EC
Opt for 7bit slave addresses in EC code. If 8bit is expected by a driver, make it local and show this in the naming. Use __7b, __7bf and __8b as name extensions for i2c/spi addresses used in the EC codebase. __7b indicates a 7bit address by itself. __7bf indicates a 7bit address with optional flags attached. __8b indicates a 8bit address by itself. Allow space for 10bit addresses, even though this is not currently being used by any of our attached devices. These extensions are for verification purposes only and will be removed in the last pass of this ticket. I want to make sure the variable names reflect the type to help eliminate future 7/8/7-flags confusion. BUG=chromium:971296 BRANCH=none TEST=make buildall -j Change-Id: I2fc3d1b52ce76184492b2aaff3060f486ca45f45 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1699893 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/ampton/board.c10
-rw-r--r--board/arcada_ish/board.c8
-rw-r--r--board/atlas/board.c48
-rw-r--r--board/atlas/board.h8
-rw-r--r--board/bloog/board.c6
-rw-r--r--board/bobba/board.c6
-rw-r--r--board/casta/board.c11
-rw-r--r--board/chell/board.c25
-rw-r--r--board/cheza/board.c12
-rw-r--r--board/cheza/board.h2
-rw-r--r--board/coral/board.c20
-rw-r--r--board/elm/board.c15
-rw-r--r--board/elm/board.h4
-rw-r--r--board/eve/board.c42
-rw-r--r--board/eve/board.h6
-rw-r--r--board/fizz/board.c8
-rw-r--r--board/fizz/board.h4
-rw-r--r--board/flapjack/battery.c4
-rw-r--r--board/flapjack/board.c20
-rw-r--r--board/flapjack/board.h4
-rw-r--r--board/fleex/board.c6
-rw-r--r--board/fluffy/board.c16
-rw-r--r--board/garg/board.c6
-rw-r--r--board/glados/battery.c8
-rw-r--r--board/glados/board.c18
-rw-r--r--board/glados/board.h2
-rw-r--r--board/glados_pd/board.h2
-rw-r--r--board/glkrvp/battery.c6
-rw-r--r--board/glkrvp/board.c16
-rw-r--r--board/glkrvp/chg_usb_pd.c8
-rw-r--r--board/glkrvp_ite/battery.c4
-rw-r--r--board/glkrvp_ite/board.c41
-rw-r--r--board/glkrvp_ite/board.h2
-rw-r--r--board/glkrvp_ite/chg_usb_pd.c8
-rw-r--r--board/hammer/board.h2
-rw-r--r--board/hatch/board.c16
-rw-r--r--board/helios/board.c16
-rw-r--r--board/helios/board.h2
-rw-r--r--board/host/battery.c7
-rw-r--r--board/kindred/board.c16
-rw-r--r--board/kindred/board.h2
-rw-r--r--board/kohaku/board.c14
-rw-r--r--board/kukui/board.c14
-rw-r--r--board/kukui/board.h4
-rw-r--r--board/mchpevb1/battery.c8
-rw-r--r--board/mchpevb1/board.c34
-rw-r--r--board/mchpevb1/board.h2
-rw-r--r--board/meep/board.c6
-rw-r--r--board/nami/board.c22
-rw-r--r--board/nami/board.h4
-rw-r--r--board/nautilus/board.c57
-rw-r--r--board/nautilus/board.h4
-rw-r--r--board/nocturne/board.c54
-rw-r--r--board/nocturne/board.h6
-rw-r--r--board/nucleo-f411re/board.c4
-rw-r--r--board/oak/battery.c8
-rw-r--r--board/oak/board.c16
-rw-r--r--board/oak/board.h2
-rw-r--r--board/pdeval-stm32f072/board.c4
-rw-r--r--board/pdeval-stm32f072/usb_pd_policy.c2
-rw-r--r--board/phaser/board.c6
-rw-r--r--board/plankton/board.c30
-rw-r--r--board/poppy/board.c83
-rw-r--r--board/poppy/board.h8
-rw-r--r--board/rainier/board.c8
-rw-r--r--board/rammus/board.c45
-rw-r--r--board/rammus/board.h6
-rw-r--r--board/reef/board.c30
-rw-r--r--board/reef/board.h2
-rw-r--r--board/reef_it8320/board.c4
-rw-r--r--board/reef_mchp/board.c30
-rw-r--r--board/reef_mchp/board.h2
-rw-r--r--board/samus/battery.c8
-rw-r--r--board/samus/board.c56
-rw-r--r--board/samus/extpower.c4
-rw-r--r--board/samus/panel.c10
-rw-r--r--board/samus_pd/board.h2
-rw-r--r--board/scarlet/board.c6
-rw-r--r--board/scarlet/board.h2
-rw-r--r--board/servo_micro/board.c17
-rw-r--r--board/servo_v4/board.c18
-rw-r--r--board/strago/board.c8
-rw-r--r--board/sweetberry/board.c2
-rw-r--r--board/yorp/board.c6
84 files changed, 583 insertions, 542 deletions
diff --git a/board/ampton/board.c b/board/ampton/board.c
index 9a9ed5c3c7..15b3af652a 100644
--- a/board/ampton/board.c
+++ b/board/ampton/board.c
@@ -72,7 +72,7 @@ struct usb_mux ampton_usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
[USB_PD_PORT_ITE_0] = {
/* Use PS8751 as mux only */
.port_addr = MUX_PORT_AND_ADDR(
- I2C_PORT_USBC0, PS8751_I2C_ADDR1),
+ I2C_PORT_USBC0, PS8751_I2C_ADDR1__7bf),
.flags = USB_MUX_FLAG_NOT_TCPC,
.driver = &ps8xxx_usb_mux_driver,
.hpd_update = &ps8xxx_tcpc_update_hpd_status,
@@ -81,7 +81,7 @@ struct usb_mux ampton_usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
[USB_PD_PORT_ITE_1] = {
/* Use PS8751 as mux only */
.port_addr = MUX_PORT_AND_ADDR(
- I2C_PORT_USBC1, PS8751_I2C_ADDR1),
+ I2C_PORT_USBC1, PS8751_I2C_ADDR1__7bf),
.flags = USB_MUX_FLAG_NOT_TCPC,
.driver = &ps8xxx_usb_mux_driver,
.hpd_update = &ps8xxx_tcpc_update_hpd_status,
@@ -188,7 +188,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_SENSOR,
- .addr = KX022_ADDR1,
+ .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
.rot_standard_ref = &lid_standard_ref,
.default_range = 4, /* g */
.config = {
@@ -212,7 +212,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = &base_standard_ref,
.default_range = 4, /* g */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -240,7 +240,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = 1000, /* dps */
.rot_standard_ref = &gyro_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
diff --git a/board/arcada_ish/board.c b/board/arcada_ish/board.c
index 911dc6a290..f18a530568 100644
--- a/board/arcada_ish/board.c
+++ b/board/arcada_ish/board.c
@@ -63,7 +63,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_ACCEL_GYRO_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .addr = LSM6DSM_ADDR1,
+ .i2c_spi_addr__7bf = LSM6DSM_ADDR1__7bf,
.rot_standard_ref = &lid_rot_ref,
.default_range = 4, /* g */
.min_frequency = LSM6DSM_ODR_MIN_VAL,
@@ -93,7 +93,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_ACCEL_GYRO_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .addr = LSM6DSM_ADDR1,
+ .i2c_spi_addr__7bf = LSM6DSM_ADDR1__7bf,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
.rot_standard_ref = &lid_rot_ref,
.min_frequency = LSM6DSM_ODR_MIN_VAL,
@@ -110,7 +110,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_lis2dh_data,
.port = I2C_PORT_SENSOR,
- .addr = LNG2DM_ADDR0,
+ .i2c_spi_addr__7bf = LNG2DM_ADDR0__7bf,
.rot_standard_ref = NULL, /* Identity matrix */
/* We only use 2g because its resolution is only 8-bits */
.default_range = 2, /* g */
@@ -138,7 +138,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mag_mutex,
.drv_data = LIS2MDL_ST_DATA(lis2mdl_a_data),
.port = I2C_PORT_SENSOR,
- .addr = LIS2MDL_ADDR,
+ .i2c_spi_addr__7bf = LIS2MDL_ADDR__7bf,
.default_range = 1 << 11, /* 16LSB / uT, fixed */
.rot_standard_ref = &lid_rot_ref,
.min_frequency = LIS2MDL_ODR_MIN_VAL,
diff --git a/board/atlas/board.c b/board/atlas/board.c
index c72ba963bb..3d6e52ed89 100644
--- a/board/atlas/board.c
+++ b/board/atlas/board.c
@@ -159,7 +159,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr = I2C_ADDR_TCPC,
+ .addr__7bf = I2C_ADDR_TCPC__7bf,
},
.drv = &ps8xxx_tcpm_drv,
/* Alert is active-low, push-pull */
@@ -170,7 +170,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC1,
- .addr = I2C_ADDR_TCPC,
+ .addr__7bf = I2C_ADDR_TCPC__7bf,
},
.drv = &ps8xxx_tcpm_drv,
/* Alert is active-low, push-pull */
@@ -262,7 +262,7 @@ static void board_report_pmic_fault(const char *str)
uint32_t info;
/* RESETIRQ1 -- Bit 4: VRFAULT */
- if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ if (i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_RESETIRQ1, &vrfault) != EC_SUCCESS)
return;
@@ -272,11 +272,11 @@ static void board_report_pmic_fault(const char *str)
/* VRFAULT has occurred, print VRFAULT status bits. */
/* PWRSTAT1 */
- i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_PWRSTAT1, &pwrstat1);
/* PWRSTAT2 */
- i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_PWRSTAT2, &pwrstat2);
CPRINTS("PMIC VRFAULT: %s", str);
@@ -284,11 +284,11 @@ static void board_report_pmic_fault(const char *str)
pwrstat2);
/* Clear all faults -- Write 1 to clear. */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_RESETIRQ1, BIT(4));
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_PWRSTAT1, pwrstat1);
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_PWRSTAT2, pwrstat2);
/*
@@ -308,7 +308,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_VCCIOCNT, 0x3a);
/*
@@ -318,7 +318,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_V18ACNT, 0x2a);
/*
@@ -328,7 +328,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_V085ACNT, 0x2a);
}
@@ -341,7 +341,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_VCCIOCNT, 0x7a);
/*
@@ -351,7 +351,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_V18ACNT, 0x6a);
/*
@@ -361,7 +361,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_V085ACNT, 0x6a);
}
@@ -378,25 +378,25 @@ static void board_pmic_init(void)
board_report_pmic_fault("SYSJUMP");
/* Clear power source events */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_PWRSRCINT, 0xff);
/* Disable power button shutdown timer */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_PBCONFIG, 0x00);
if (system_jumped_to_this_image())
return;
/* DISCHGCNT1 - enable 100 ohm discharge on VCCIO */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_DISCHGCNT1, 0x01);
/*
* DISCHGCNT2 - enable 100 ohm discharge on
* V5.0A, V3.3DSW, V3.3A and V1.8A
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_DISCHGCNT2, 0x55);
/*
@@ -405,19 +405,19 @@ static void board_pmic_init(void)
* DISCHGCNT3 - enable 100 ohm discharge on
* V12U, V1.00A, V0.85A
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_DISCHGCNT3, 0xd5);
/* DISCHGCNT4 - enable 100 ohm discharge on V33S, V18S, V100S */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_DISCHGCNT4, 0x15);
/* VRMODECTRL - disable low-power mode for all rails */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_VRMODECTRL, 0x1f);
/* V5ADS3CNT - boost V5A_DS3 by 2% */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_V5ADS3CNT, 0x1a);
board_pmic_disable_slp_s0_vr_decay();
@@ -440,7 +440,7 @@ void board_hibernate(void)
system_enter_psl_mode();
/* Cut off DSW power via the ROP PMIC. */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992,
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
BD99992GW_REG_SDWNCTRL, BD99992GW_SDWNCTRL_SWDN);
/* Wait for power to be cut. */
@@ -593,7 +593,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &opt3001_drv,
.drv_data = &g_opt3001_data,
.port = I2C_PORT_SENSOR,
- .addr = OPT3001_I2C_ADDR,
+ .i2c_spi_addr__7bf = OPT3001_I2C_ADDR__7bf,
.rot_standard_ref = NULL,
.default_range = 0x2b11a1, /* from nocturne */
.min_frequency = OPT3001_LIGHT_MIN_FREQ,
diff --git a/board/atlas/board.h b/board/atlas/board.h
index b9d9ca5eae..2d27e89314 100644
--- a/board/atlas/board.h
+++ b/board/atlas/board.h
@@ -113,7 +113,7 @@
#define CONFIG_ALS
#define CONFIG_ALS_OPT3001
#define ALS_COUNT 1
-#define OPT3001_I2C_ADDR OPT3001_I2C_ADDR1
+#define OPT3001_I2C_ADDR__7bf OPT3001_I2C_ADDR1__7bf
#define CONFIG_ACCEL_FIFO 1024
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO / 3)
#define CONFIG_ACCEL_INTERRUPTS
@@ -166,9 +166,9 @@
#define I2C_PORT_THERMAL I2C_PORT_POWER
/* I2C addresses */
-#define I2C_ADDR_TCPC 0x16
-#define I2C_ADDR_MP2949 0x40
-#define I2C_ADDR_BD99992 0x60
+#define I2C_ADDR_TCPC__7bf 0x0B
+#define I2C_ADDR_MP2949__7bf 0x20
+#define I2C_ADDR_BD99992__7bf 0x30
#ifndef __ASSEMBLER__
diff --git a/board/bloog/board.c b/board/bloog/board.c
index 6bf29ed642..f14989ad73 100644
--- a/board/bloog/board.c
+++ b/board/bloog/board.c
@@ -138,7 +138,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &kx022_data,
.port = I2C_PORT_SENSOR,
- .addr = KX022_ADDR1,
+ .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
.rot_standard_ref = &lid_standrd_ref,
.default_range = 2, /* g */
.config = {
@@ -166,7 +166,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_BASE_SIXAXIS_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .addr = LSM6DSM_ADDR0,
+ .i2c_spi_addr__7bf = LSM6DSM_ADDR0__7bf,
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g */
.min_frequency = LSM6DSM_ODR_MIN_VAL,
@@ -198,7 +198,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_BASE_SIXAXIS_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .addr = LSM6DSM_ADDR0,
+ .i2c_spi_addr__7bf = LSM6DSM_ADDR0__7bf,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = LSM6DSM_ODR_MIN_VAL,
diff --git a/board/bobba/board.c b/board/bobba/board.c
index 32b79e886e..251c545290 100644
--- a/board/bobba/board.c
+++ b/board/bobba/board.c
@@ -168,7 +168,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_SENSOR,
- .addr = KX022_ADDR1,
+ .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 4, /* g */
.config = {
@@ -192,7 +192,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = &base_standard_ref,
.default_range = 4, /* g */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -220,7 +220,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
diff --git a/board/casta/board.c b/board/casta/board.c
index 64c2d86003..ae3f61e0c1 100644
--- a/board/casta/board.c
+++ b/board/casta/board.c
@@ -95,9 +95,10 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
#define BATTERY_FREE_MIN_DELTA_US (5 * MSEC)
static timestamp_t battery_last_i2c_time;
-static int is_battery_i2c(int port, int slave_addr)
+static int is_battery_i2c__7bf(const int port, const uint16_t slave_addr__7bf)
{
- return (port == I2C_PORT_BATTERY) && (slave_addr == BATTERY_ADDR);
+ return (port == I2C_PORT_BATTERY)
+ && (slave_addr__7bf == BATTERY_ADDR__7bf);
}
static int is_battery_port(int port)
@@ -105,11 +106,11 @@ static int is_battery_port(int port)
return (port == I2C_PORT_BATTERY);
}
-void i2c_start_xfer_notify(int port, int slave_addr)
+void i2c_start_xfer_notify__7bf(const int port, const uint16_t slave_addr__7bf)
{
unsigned int time_delta_us;
- if (!is_battery_i2c(port, slave_addr))
+ if (!is_battery_i2c__7bf(port, slave_addr__7bf))
return;
time_delta_us = time_since32(battery_last_i2c_time);
@@ -119,7 +120,7 @@ void i2c_start_xfer_notify(int port, int slave_addr)
usleep(BATTERY_FREE_MIN_DELTA_US - time_delta_us);
}
-void i2c_end_xfer_notify(int port, int slave_addr)
+void i2c_end_xfer_notify__7bf(const int port, const uint16_t slave_addr__7bf)
{
/*
* The bus free time needs to be maintained from last transaction
diff --git a/board/chell/board.c b/board/chell/board.c
index 6311dc6c9c..7ecad3f1c1 100644
--- a/board/chell/board.c
+++ b/board/chell/board.c
@@ -42,7 +42,7 @@
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
-#define I2C_ADDR_BD99992 0x60
+#define I2C_ADDR_BD99992__7bf 0x30
/* Exchange status with PD MCU. */
static void pd_mcu_interrupt(enum gpio_signal signal)
@@ -111,7 +111,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC,
- .addr = CONFIG_TCPC_I2C_BASE_ADDR,
+ .addr__7bf = CONFIG_TCPC_I2C_BASE_ADDR__7BF,
},
.drv = &tcpci_tcpm_drv,
},
@@ -119,7 +119,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC,
- .addr = CONFIG_TCPC_I2C_BASE_ADDR + 2,
+ .addr__7bf = CONFIG_TCPC_I2C_BASE_ADDR__7BF + 1,
},
.drv = &tcpci_tcpm_drv,
@@ -183,12 +183,12 @@ static int ps874x_tune_mux(int port)
struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
{
- .port_addr = 0x34,
+ .port_addr = 0x1A,
.driver = &ps874x_usb_mux_driver,
.board_init = &ps874x_tune_mux,
},
{
- .port_addr = 0x20,
+ .port_addr = 0x10,
.driver = &ps874x_usb_mux_driver,
.board_init = &ps874x_tune_mux,
}
@@ -230,7 +230,7 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
static void board_pmic_init(void)
{
/* DISCHGCNT3 - enable 100 ohm discharge on V1.00A */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x3e, 0x04);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3e, 0x04);
/*
* No need to re-init below settings since they are present on all MP
@@ -240,23 +240,23 @@ static void board_pmic_init(void)
return;
/* Set CSDECAYEN / VCCIO decays to 0V at assertion of SLP_S0# */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x30, 0x4a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x4a);
/*
* Set V100ACNT / V1.00A Control Register:
* Nominal output = 1.0V.
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x37, 0x1a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x37, 0x1a);
/*
* Set V085ACNT / V0.85A Control Register:
* Lower power mode = 0.7V.
* Nominal output = 1.0V.
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x38, 0x7a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x7a);
/* VRMODECTRL - enable low-power mode for VCCIO and V0.85A */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x3b, 0x18);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3b, 0x18);
}
DECLARE_HOOK(HOOK_INIT, board_pmic_init, HOOK_PRIO_DEFAULT);
@@ -394,7 +394,7 @@ void board_hibernate(void)
uart_flush_output();
/* Trigger PMIC shutdown. */
- if (i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x49, 0x01)) {
+ if (i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x49, 0x01)) {
/*
* If we can't tell the PMIC to shutdown, instead reset
* and don't start the AP. Hopefully we'll be able to
@@ -466,7 +466,8 @@ void chipset_set_pmic_slp_sus_l(int level)
if (!level)
msleep(25);
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x43, val);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ 0x43, val);
previous_level = level;
}
}
diff --git a/board/cheza/board.c b/board/cheza/board.c
index d13f06e61f..8f11d0150b 100644
--- a/board/cheza/board.c
+++ b/board/cheza/board.c
@@ -242,7 +242,7 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
struct ppc_config_t ppc_chips[] = {
{
.i2c_port = I2C_PORT_TCPC0,
- .i2c_addr = SN5S330_ADDR0,
+ .i2c_addr__7bf = SN5S330_ADDR0__7bf,
.drv = &sn5s330_drv
},
/*
@@ -261,7 +261,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr = 0x50,
+ .addr__7bf = 0x28,
},
.drv = &anx74xx_tcpm_drv,
.flags = TCPC_FLAGS_ALERT_OD,
@@ -270,7 +270,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC1,
- .addr = 0x16,
+ .addr__7bf = 0x0B,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -649,7 +649,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = &base_standard_ref,
.default_range = 4, /* g */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -670,7 +670,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -685,7 +685,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &opt3001_drv,
.drv_data = &g_opt3001_data,
.port = I2C_PORT_SENSOR,
- .addr = OPT3001_I2C_ADDR,
+ .i2c_spi_addr__7bf = OPT3001_I2C_ADDR__7bf,
.rot_standard_ref = NULL,
.default_range = 0x10000, /* scale = 1; uscale = 0 */
.min_frequency = OPT3001_LIGHT_MIN_FREQ,
diff --git a/board/cheza/board.h b/board/cheza/board.h
index 983316e062..e35502fa57 100644
--- a/board/cheza/board.h
+++ b/board/cheza/board.h
@@ -138,7 +138,7 @@
#define CONFIG_ALS
#define CONFIG_ALS_OPT3001
#define ALS_COUNT 1
-#define OPT3001_I2C_ADDR OPT3001_I2C_ADDR1
+#define OPT3001_I2C_ADDR__7bf OPT3001_I2C_ADDR1__7bf
/* PD */
#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
diff --git a/board/coral/board.c b/board/coral/board.c
index 6b0c613567..936817db76 100644
--- a/board/coral/board.c
+++ b/board/coral/board.c
@@ -174,7 +174,7 @@ struct i2c_stress_test i2c_stress_tests[] = {
#ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC
{
.port = NPCX_I2C_PORT0_0,
- .addr = ANX74XX_I2C_ADDR1,
+ .addr__7bf = ANX74XX_I2C_ADDR1__7bf,
.i2c_test = &anx74xx_i2c_stress_test_dev,
},
#endif
@@ -183,7 +183,7 @@ struct i2c_stress_test i2c_stress_tests[] = {
#ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC
{
.port = NPCX_I2C_PORT0_1,
- .addr = PS8751_I2C_ADDR1,
+ .addr__7bf = PS8751_I2C_ADDR1__7bf,
.i2c_test = &ps8xxx_i2c_stress_test_dev,
},
#endif
@@ -192,7 +192,7 @@ struct i2c_stress_test i2c_stress_tests[] = {
#ifdef CONFIG_CMD_I2C_STRESS_TEST_ACCEL
{
.port = I2C_PORT_GYRO,
- .addr = BMI160_ADDR0,
+ .addr__7bf = BMI160_ADDR0__7bf,
.i2c_test = &bmi160_i2c_stress_test_dev,
},
#endif
@@ -201,7 +201,7 @@ struct i2c_stress_test i2c_stress_tests[] = {
#ifdef CONFIG_CMD_I2C_STRESS_TEST_ACCEL
{
.port = I2C_PORT_LID_ACCEL,
- .addr = KX022_ADDR1,
+ .addr__7bf = KX022_ADDR1__7bf,
.i2c_test = &kionix_i2c_stress_test_dev,
},
#endif
@@ -226,7 +226,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_0,
- .addr = ANX74XX_I2C_ADDR1,
+ .addr__7bf = ANX74XX_I2C_ADDR1__7bf,
},
.drv = &anx74xx_tcpm_drv,
},
@@ -234,7 +234,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_1,
- .addr = PS8751_I2C_ADDR1,
+ .addr__7bf = PS8751_I2C_ADDR1__7bf,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -373,7 +373,7 @@ static void board_tcpc_init(void)
*
* NOTE: PS8751 A3 will wake on any I2C access.
*/
- i2c_read8(NPCX_I2C_PORT0_1, 0x10, 0xA0, &reg);
+ i2c_read8__7bf(NPCX_I2C_PORT0_1, 0x08, 0xA0, &reg);
/* Enable TCPC0 interrupt */
gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL);
@@ -723,7 +723,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_LID_ACCEL,
- .addr = KX022_ADDR1,
+ .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 2, /* g, enough for laptop. */
.config = {
@@ -748,7 +748,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.config = {
@@ -775,7 +775,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
},
diff --git a/board/elm/board.c b/board/elm/board.c
index cdd0a0f998..3568564621 100644
--- a/board/elm/board.c
+++ b/board/elm/board.c
@@ -92,13 +92,14 @@ const struct adc_t adc_channels[] = {
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-int anx7688_passthru_allowed(const struct i2c_port_t *port, uint16_t address)
+int anx7688_passthru_allowed__7bf(const struct i2c_port_t *port,
+ const uint16_t addr__7bf)
{
/* Allow access to 0x2c (TCPC) */
- if (address == 0x2c)
+ if (I2C_GET_ADDR__7b(addr__7bf) == 0x2c)
return 1;
- CPRINTF("Passthru rejected on %x", address);
+ CPRINTF("Passthru rejected on %x", I2C_GET_ADDR__7b(addr__7bf));
return 0;
}
@@ -107,7 +108,7 @@ int anx7688_passthru_allowed(const struct i2c_port_t *port, uint16_t address)
const struct i2c_port_t i2c_ports[] = {
{"battery", I2C_PORT_BATTERY, 100, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
{"pd", I2C_PORT_PD_MCU, 1000, GPIO_I2C1_SCL, GPIO_I2C1_SDA,
- anx7688_passthru_allowed}
+ anx7688_passthru_allowed__7bf}
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -125,7 +126,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC,
- .addr = CONFIG_TCPC_I2C_BASE_ADDR,
+ .addr__7bf = CONFIG_TCPC_I2C_BASE_ADDR__7BF,
},
.drv = &anx7688_tcpm_drv,
},
@@ -466,7 +467,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &kionix_accel_drv,
.mutex = &g_kx022_mutex[0],
.drv_data = &g_kx022_data[0],
- .addr = 1, /* SPI, device ID 0 */
+ .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(0),
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KX022_ACCEL_MIN_FREQ,
@@ -489,7 +490,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &kionix_accel_drv,
.mutex = &g_kx022_mutex[1],
.drv_data = &g_kx022_data[1],
- .addr = 3, /* SPI, device ID 1 */
+ .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(1),
.rot_standard_ref = &lid_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KX022_ACCEL_MIN_FREQ,
diff --git a/board/elm/board.h b/board/elm/board.h
index ffd54aacc6..d9e336f720 100644
--- a/board/elm/board.h
+++ b/board/elm/board.h
@@ -99,8 +99,8 @@
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_TRY_SRC
#define CONFIG_USB_PD_VBUS_DETECT_TCPC
-#undef CONFIG_TCPC_I2C_BASE_ADDR
-#define CONFIG_TCPC_I2C_BASE_ADDR 0x58
+#undef CONFIG_TCPC_I2C_BASE_ADDR__7BF
+#define CONFIG_TCPC_I2C_BASE_ADDR__7BF 0x2C
#define CONFIG_USB_PD_ANX7688
/* UART DMA */
diff --git a/board/eve/board.c b/board/eve/board.c
index fbca0c09e3..72877fd100 100644
--- a/board/eve/board.c
+++ b/board/eve/board.c
@@ -207,7 +207,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr = ANX74XX_I2C_ADDR1,
+ .addr__7bf = ANX74XX_I2C_ADDR1__7bf,
},
.drv = &anx74xx_tcpm_drv,
},
@@ -215,7 +215,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC1,
- .addr = ANX74XX_I2C_ADDR1,
+ .addr__7bf = ANX74XX_I2C_ADDR1__7bf,
},
.drv = &anx74xx_tcpm_drv,
},
@@ -363,7 +363,7 @@ static void board_report_pmic_fault(const char *str)
uint32_t info;
/* RESETIRQ1 -- Bit 4: VRFAULT */
- if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x8, &vrfault)
+ if (i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x8, &vrfault)
!= EC_SUCCESS)
return;
@@ -373,19 +373,19 @@ static void board_report_pmic_fault(const char *str)
/* VRFAULT has occurred, print VRFAULT status bits. */
/* PWRSTAT1 */
- i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x16, &pwrstat1);
+ i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x16, &pwrstat1);
/* PWRSTAT2 */
- i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x17, &pwrstat2);
+ i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x17, &pwrstat2);
CPRINTS("PMIC VRFAULT: %s", str);
CPRINTS("PMIC VRFAULT: PWRSTAT1=0x%02x PWRSTAT2=0x%02x", pwrstat1,
pwrstat2);
/* Clear all faults -- Write 1 to clear. */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x8, BIT(4));
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x16, pwrstat1);
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x17, pwrstat2);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x8, BIT(4));
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x16, pwrstat1);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x17, pwrstat2);
/*
* Status of the fault registers can be checked in the OS by looking at
@@ -403,32 +403,32 @@ static void board_pmic_init(void)
return;
/* DISCHGCNT2 - enable 100 ohm discharge on V3.3A and V1.8A */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x3d, 0x05);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3d, 0x05);
/* DISCHGCNT3 - enable 100 ohm discharge on V1.00A */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x3e, 0x04);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3e, 0x04);
/* Set CSDECAYEN / VCCIO decays to 0V at assertion of SLP_S0# */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x30, 0x7a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x7a);
/*
* Set V100ACNT / V1.00A Control Register:
* Nominal output = 1.0V.
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x37, 0x1a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x37, 0x1a);
/*
* Set V085ACNT / V0.85A Control Register:
* Lower power mode = 0.7V.
* Nominal output = 1.0V.
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x38, 0x7a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x7a);
/* VRMODECTRL - disable low-power mode for all rails */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x3b, 0x1f);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3b, 0x1f);
/* Clear power source events */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x04, 0xff);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x04, 0xff);
}
DECLARE_HOOK(HOOK_INIT, board_pmic_init, HOOK_PRIO_DEFAULT);
@@ -722,7 +722,7 @@ void board_hibernate(void)
/* Shut down PMIC */
CPRINTS("Triggering PMIC shutdown");
uart_flush_output();
- if (i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x49, 0x01)) {
+ if (i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x49, 0x01)) {
/*
* If we can't tell the PMIC to shutdown, instead reset
* and don't start the AP. Hopefully we'll be able to
@@ -815,7 +815,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kxcj9_data,
.port = I2C_PORT_LID_ACCEL,
- .addr = KXCJ9_ADDR0,
+ .i2c_spi_addr__7bf = KXCJ9_ADDR0__7bf,
.rot_standard_ref = &lid_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KXCJ9_ACCEL_MIN_FREQ,
@@ -842,7 +842,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = NULL,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -876,7 +876,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = 1000, /* dps */
.rot_standard_ref = NULL,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -893,7 +893,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = BIT(11), /* 16LSB / uT, fixed */
.rot_standard_ref = &mag_standard_ref,
.min_frequency = BMM150_MAG_MIN_FREQ,
@@ -910,7 +910,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_si114x_data,
.port = I2C_PORT_ALS,
- .addr = SI114X_ADDR,
+ .i2c_spi_addr__7bf = SI114X_ADDR__7bf,
.rot_standard_ref = NULL,
.default_range = 3088, /* 30.88%: int = 0 - frac = 3088/10000 */
.min_frequency = SI114X_LIGHT_MIN_FREQ,
diff --git a/board/eve/board.h b/board/eve/board.h
index 84a4dc2cef..88938e9719 100644
--- a/board/eve/board.h
+++ b/board/eve/board.h
@@ -128,7 +128,7 @@
#define CONFIG_ACCEL_INTERRUPTS
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
-#define CONFIG_ACCELGYRO_SEC_ADDR BMM150_ADDR0 /* 8-bit address */
+#define CONFIG_ACCELGYRO_SEC_ADDR__7BF BMM150_ADDR0__7bf
#define CONFIG_ACCELGYRO_BMI160_INT2_OUTPUT /* Unused */
#define CONFIG_MAG_CALIBRATE
#define CONFIG_LID_ANGLE
@@ -195,8 +195,8 @@
#define I2C_PORT_MP2949 NPCX_I2C_PORT3
/* I2C addresses */
-#define I2C_ADDR_BD99992 0x60
-#define I2C_ADDR_MP2949 0x40
+#define I2C_ADDR_BD99992__7bf 0x30
+#define I2C_ADDR_MP2949__7bf 0x20
#ifndef __ASSEMBLER__
diff --git a/board/fizz/board.c b/board/fizz/board.c
index 70ee2a70c7..405d34cbb4 100644
--- a/board/fizz/board.c
+++ b/board/fizz/board.c
@@ -179,7 +179,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_0,
- .addr = I2C_ADDR_TCPC0,
+ .addr__7bf = I2C_ADDR_TCPC0__7bf,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -229,7 +229,7 @@ void board_tcpc_init(void)
* TCPM_INIT will fail due to not able to access PS8751.
* Note PS8751 A3 will wake on any I2C access.
*/
- i2c_read8(I2C_PORT_TCPC0, I2C_ADDR_TCPC0, 0xA0, &reg);
+ i2c_read8__7bf(I2C_PORT_TCPC0, I2C_ADDR_TCPC0__7bf, 0xA0, &reg);
/* Enable TCPC interrupts */
gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL);
@@ -289,10 +289,10 @@ BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
/* Initialize PMIC */
#define I2C_PMIC_READ(reg, data) \
- i2c_read8(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1, (reg), (data))
+ i2c_read8__7bf(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1__7bf, (reg), (data))
#define I2C_PMIC_WRITE(reg, data) \
- i2c_write8(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1, (reg), (data))
+ i2c_write8__7bf(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1__7bf, (reg), (data))
static void board_pmic_init(void)
{
diff --git a/board/fizz/board.h b/board/fizz/board.h
index 92d2ae05f1..40aa840d59 100644
--- a/board/fizz/board.h
+++ b/board/fizz/board.h
@@ -139,8 +139,8 @@
#define I2C_PORT_THERMAL NPCX_I2C_PORT3
/* I2C addresses */
-#define I2C_ADDR_TCPC0 0x16
-#define I2C_ADDR_EEPROM 0xa0
+#define I2C_ADDR_TCPC0__7bf 0x0b
+#define I2C_ADDR_EEPROM__7bf 0x50
/* Verify and jump to RW image on boot */
#define CONFIG_VBOOT_EFS
diff --git a/board/flapjack/battery.c b/board/flapjack/battery.c
index 3c3825d5cf..5bb6b07a9f 100644
--- a/board/flapjack/battery.c
+++ b/board/flapjack/battery.c
@@ -398,10 +398,10 @@ int charger_profile_override(struct charge_state_data *curr)
* Pull down WPC VBUS. Need to use raw i2c APIs because RO
* doesn't have p9221 driver. If WPC is off, this is a no-op.
*/
- if (i2c_read_offset16(I2C_PORT_WPC, P9221_R7_ADDR,
+ if (i2c_read_offset16__7bf(I2C_PORT_WPC, P9221_R7_ADDR__7bf,
P9221R7_VOUT_SET_REG, &val, 1) == EC_SUCCESS
&& val * 100 != wpc_mv)
- i2c_write_offset16(I2C_PORT_WPC, P9221_R7_ADDR,
+ i2c_write_offset16__7bf(I2C_PORT_WPC, P9221_R7_ADDR__7bf,
P9221R7_VOUT_SET_REG, wpc_mv / 100, 1);
if ((curr->batt.flags & BATT_FLAG_BAD_TEMPERATURE) ||
diff --git a/board/flapjack/board.c b/board/flapjack/board.c
index 5549e7b97e..fcbf71938c 100644
--- a/board/flapjack/board.c
+++ b/board/flapjack/board.c
@@ -138,12 +138,12 @@ static void board_setup_panel(void)
dim = sku & SKU_ID_PANEL_SIZE_MASK ? 0xc4 : 0xc8;
}
- rv |= i2c_write8(I2C_PORT_CHARGER, RT946X_ADDR, MT6370_BACKLIGHT_BLEN,
- channel);
- rv |= i2c_write8(I2C_PORT_CHARGER, RT946X_ADDR, MT6370_BACKLIGHT_BLDIM,
- dim);
- rv |= i2c_write8(I2C_PORT_CHARGER, RT946X_ADDR, MT6370_BACKLIGHT_BLPWM,
- 0xac);
+ rv |= i2c_write8__7bf(I2C_PORT_CHARGER, RT946X_ADDR__7bf,
+ MT6370_BACKLIGHT_BLEN, channel);
+ rv |= i2c_write8__7bf(I2C_PORT_CHARGER, RT946X_ADDR__7bf,
+ MT6370_BACKLIGHT_BLDIM, dim);
+ rv |= i2c_write8__7bf(I2C_PORT_CHARGER, RT946X_ADDR__7bf,
+ MT6370_BACKLIGHT_BLPWM, 0xac);
if (rv)
CPRINTS("Board setup panel failed");
}
@@ -288,7 +288,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr = MT6370_TCPC_I2C_ADDR,
+ .addr__7bf = MT6370_TCPC_I2C_ADDR__7bf,
},
.drv = &mt6370_tcpm_drv},
};
@@ -500,7 +500,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = &lid_standard_ref,
.default_range = 4, /* g */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -523,7 +523,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = 1000, /* dps */
.rot_standard_ref = &lid_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -538,7 +538,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &tcs3400_drv,
.drv_data = &g_tcs3400_data,
.port = I2C_PORT_ALS,
- .addr = TCS3400_I2C_ADDR,
+ .i2c_spi_addr__7bf = TCS3400_I2C_ADDR__7bf,
.rot_standard_ref = NULL,
.default_range = 0x10000, /* scale = 1x, uscale = 0 */
.min_frequency = TCS3400_LIGHT_MIN_FREQ,
diff --git a/board/flapjack/board.h b/board/flapjack/board.h
index 693a1bb8a9..13a010f416 100644
--- a/board/flapjack/board.h
+++ b/board/flapjack/board.h
@@ -225,10 +225,10 @@
#define I2C_PORT_EEPROM 1
/* I2C addresses */
-#define I2C_ADDR_EEPROM 0xA0
+#define I2C_ADDR_EEPROM__7bf 0x50
/* Route sbs host requests to virtual battery driver */
-#define VIRTUAL_BATTERY_ADDR 0x16
+#define VIRTUAL_BATTERY_ADDR__7bf 0x0B
/* Enable Accel over SPI */
#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master port (SPI2) */
diff --git a/board/fleex/board.c b/board/fleex/board.c
index 386d8ad61b..444d585308 100644
--- a/board/fleex/board.c
+++ b/board/fleex/board.c
@@ -133,7 +133,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_lis2dh_data,
.port = I2C_PORT_SENSOR,
- .addr = LIS2DH_ADDR1,
+ .i2c_spi_addr__7bf = LIS2DH_ADDR1__7bf,
.rot_standard_ref = &lid_standard_ref,
.default_range = 2, /* g */
/* We only use 2g because its resolution is only 8-bits */
@@ -164,7 +164,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_BASE_SIXAXIS_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .addr = LSM6DSM_ADDR0,
+ .i2c_spi_addr__7bf = LSM6DSM_ADDR0__7bf,
.rot_standard_ref = &base_standard_ref,
.default_range = 4, /* g */
.min_frequency = LSM6DSM_ODR_MIN_VAL,
@@ -196,7 +196,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_BASE_SIXAXIS_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .addr = LSM6DSM_ADDR0,
+ .i2c_spi_addr__7bf = LSM6DSM_ADDR0__7bf,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = LSM6DSM_ODR_MIN_VAL,
diff --git a/board/fluffy/board.c b/board/fluffy/board.c
index a409bc4a89..4631b4a851 100644
--- a/board/fluffy/board.c
+++ b/board/fluffy/board.c
@@ -113,7 +113,7 @@ DECLARE_CONSOLE_COMMAND(ccflip, command_cc_flip,
/*
* Support tca6416 I2C ioexpander.
*/
-#define GPIOX_I2C_ADDR 0x40
+#define GPIOX_I2C_ADDR__7bf 0x20
#define GPIOX_IN_PORT_A 0x0
#define GPIOX_IN_PORT_B 0x1
#define GPIOX_OUT_PORT_A 0x2
@@ -129,8 +129,10 @@ static void i2c_expander_init(void)
/*
* Setup P00, P02, P04, P10, and P12 on the I/O expander as an output.
*/
- i2c_write8(I2C_PORT_MASTER, GPIOX_I2C_ADDR, GPIOX_DIR_PORT_A, 0xea);
- i2c_write8(I2C_PORT_MASTER, GPIOX_I2C_ADDR, GPIOX_DIR_PORT_B, 0xfa);
+ i2c_write8__7bf(I2C_PORT_MASTER, GPIOX_I2C_ADDR__7bf,
+ GPIOX_DIR_PORT_A, 0xea);
+ i2c_write8__7bf(I2C_PORT_MASTER, GPIOX_I2C_ADDR__7bf,
+ GPIOX_DIR_PORT_B, 0xfa);
}
DECLARE_HOOK(HOOK_INIT, i2c_expander_init, HOOK_PRIO_INIT_I2C+1);
@@ -140,15 +142,15 @@ static void write_ioexpander(int bank, int gpio, int reg, int val)
int tmp;
/* Read output port register */
- i2c_read8(I2C_PORT_MASTER, GPIOX_I2C_ADDR, reg + bank,
- &tmp);
+ i2c_read8__7bf(I2C_PORT_MASTER, GPIOX_I2C_ADDR__7bf,
+ reg + bank, &tmp);
if (val)
tmp |= BIT(gpio);
else
tmp &= ~BIT(gpio);
/* Write back modified output port register */
- i2c_write8(I2C_PORT_MASTER, GPIOX_I2C_ADDR, reg + bank,
- tmp);
+ i2c_write8__7bf(I2C_PORT_MASTER, GPIOX_I2C_ADDR__7bf,
+ reg + bank, tmp);
}
enum led_ch {
diff --git a/board/garg/board.c b/board/garg/board.c
index 5947e23f8e..b0ec0ef955 100644
--- a/board/garg/board.c
+++ b/board/garg/board.c
@@ -154,7 +154,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_SENSOR,
- .addr = KX022_ADDR1,
+ .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 4, /* g */
.config = {
@@ -178,7 +178,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = &base_standard_ref,
.default_range = 4, /* g */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -206,7 +206,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
diff --git a/board/glados/battery.c b/board/glados/battery.c
index 016d225950..d6c702127e 100644
--- a/board/glados/battery.c
+++ b/board/glados/battery.c
@@ -47,10 +47,10 @@ int board_cut_off_battery(void)
buf[2] = PARAM_CUT_OFF_HIGH;
i2c_lock(I2C_PORT_BATTERY, 1);
- rv = i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR, buf, 3, NULL, 0,
- I2C_XFER_SINGLE);
- rv |= i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR, buf, 3, NULL, 0,
- I2C_XFER_SINGLE);
+ rv = i2c_xfer_unlocked__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ buf, 3, NULL, 0, I2C_XFER_SINGLE);
+ rv |= i2c_xfer_unlocked__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ buf, 3, NULL, 0, I2C_XFER_SINGLE);
i2c_lock(I2C_PORT_BATTERY, 0);
return rv;
diff --git a/board/glados/board.c b/board/glados/board.c
index 1521800439..c3a05289ad 100644
--- a/board/glados/board.c
+++ b/board/glados/board.c
@@ -48,7 +48,7 @@
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
-#define I2C_ADDR_BD99992 0x60
+#define I2C_ADDR_BD99992__7bf 0x30
/* Exchange status with PD MCU. */
static void pd_mcu_interrupt(enum gpio_signal signal)
@@ -123,7 +123,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC,
- .addr = CONFIG_TCPC_I2C_BASE_ADDR,
+ .addr__7bf = CONFIG_TCPC_I2C_BASE_ADDR__7BF,
},
.drv = &tcpci_tcpm_drv,
},
@@ -131,7 +131,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC,
- .addr = CONFIG_TCPC_I2C_BASE_ADDR + 2,
+ .addr__7bf = CONFIG_TCPC_I2C_BASE_ADDR__7BF + 1,
},
.drv = &tcpci_tcpm_drv,
},
@@ -166,11 +166,11 @@ BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) ==
struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
{
- .port_addr = 0xa8,
+ .port_addr = 0x54,
.driver = &pi3usb30532_usb_mux_driver,
},
{
- .port_addr = 0x20,
+ .port_addr = 0x10,
.driver = &ps874x_usb_mux_driver,
}
};
@@ -213,23 +213,23 @@ static void board_pmic_init(void)
return;
/* Set CSDECAYEN / VCCIO decays to 0V at assertion of SLP_S0# */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x30, 0x4a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x4a);
/*
* Set V100ACNT / V1.00A Control Register:
* Nominal output = 1.0V.
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x37, 0x1a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x37, 0x1a);
/*
* Set V085ACNT / V0.85A Control Register:
* Lower power mode = 0.7V.
* Nominal output = 1.0V.
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x38, 0x7a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x7a);
/* VRMODECTRL - enable low-power mode for VCCIO and V0.85A */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x3b, 0x18);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3b, 0x18);
}
DECLARE_HOOK(HOOK_INIT, board_pmic_init, HOOK_PRIO_DEFAULT);
diff --git a/board/glados/board.h b/board/glados/board.h
index 2fa9662b0b..93c5bbd500 100644
--- a/board/glados/board.h
+++ b/board/glados/board.h
@@ -134,7 +134,7 @@
#define I2C_PORT_THERMAL I2C_PORT_PMIC
/* Ambient Light Sensor address */
-#define OPT3001_I2C_ADDR OPT3001_I2C_ADDR1
+#define OPT3001_I2C_ADDR__7bf OPT3001_I2C_ADDR1__7bf
/* Modules we want to exclude */
#undef CONFIG_CMD_HASH
diff --git a/board/glados_pd/board.h b/board/glados_pd/board.h
index 9310ee8715..0d513b6e67 100644
--- a/board/glados_pd/board.h
+++ b/board/glados_pd/board.h
@@ -97,7 +97,7 @@
/* slave address for host commands */
#ifdef HAS_TASK_HOSTCMD
-#define CONFIG_HOSTCMD_I2C_SLAVE_ADDR CONFIG_USB_PD_I2C_SLAVE_ADDR
+#define CONFIG_HOSTCMD_I2C_SLAVE_ADDR__7BF CONFIG_USB_PD_I2C_SLAVE_ADDR__7BF
#endif
#ifndef __ASSEMBLER__
diff --git a/board/glkrvp/battery.c b/board/glkrvp/battery.c
index bb49336ecf..36dec46702 100644
--- a/board/glkrvp/battery.c
+++ b/board/glkrvp/battery.c
@@ -14,10 +14,10 @@
#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
#define I2C_PORT_PCA555_BATT_PRESENT_GPIO NPCX_I2C_PORT0_0
-#define I2C_ADDR_PCA555_BATT_PRESENT_GPIO 0x42
+#define I2C_ADDR_PCA555_BATT_PRESENT_GPIO__7bf 0x21
#define PCA555_BATT_PRESENT_GPIO_READ(reg, data) \
- pca9555_read(I2C_PORT_PCA555_BATT_PRESENT_GPIO, \
- I2C_ADDR_PCA555_BATT_PRESENT_GPIO, (reg), (data))
+ pca9555_read__7bf(I2C_PORT_PCA555_BATT_PRESENT_GPIO, \
+ I2C_ADDR_PCA555_BATT_PRESENT_GPIO__7bf, (reg), (data))
/* Shutdown mode parameter to write to manufacturer access register */
#define SB_SHUTDOWN_DATA 0x0010
diff --git a/board/glkrvp/board.c b/board/glkrvp/board.c
index c7445d19a3..e748373ad0 100644
--- a/board/glkrvp/board.c
+++ b/board/glkrvp/board.c
@@ -29,19 +29,19 @@
#include "gpio_list.h"
#define I2C_PORT_PCA555_PMIC_GPIO NPCX_I2C_PORT0_0
-#define I2C_ADDR_PCA555_PMIC_GPIO 0x42
+#define I2C_ADDR_PCA555_PMIC_GPIO__7bf 0x21
#define PCA555_PMIC_GPIO_WRITE(reg, data) \
- pca9555_write(I2C_PORT_PCA555_PMIC_GPIO, \
- I2C_ADDR_PCA555_PMIC_GPIO, (reg), (data))
+ pca9555_write__7bf(I2C_PORT_PCA555_PMIC_GPIO, \
+ I2C_ADDR_PCA555_PMIC_GPIO__7bf, (reg), (data))
#define PCA555_PMIC_GPIO_READ(reg, data) \
- pca9555_read(I2C_PORT_PCA555_PMIC_GPIO, \
- I2C_ADDR_PCA555_PMIC_GPIO, (reg), (data))
+ pca9555_read__7bf(I2C_PORT_PCA555_PMIC_GPIO, \
+ I2C_ADDR_PCA555_PMIC_GPIO__7bf, (reg), (data))
#define I2C_PORT_PCA555_BOARD_ID_GPIO NPCX_I2C_PORT0_0
-#define I2C_ADDR_PCA555_BOARD_ID_GPIO 0x40
+#define I2C_ADDR_PCA555_BOARD_ID_GPIO__7bf 0x20
#define PCA555_BOARD_ID_GPIO_READ(reg, data) \
- pca9555_read(I2C_PORT_PCA555_BOARD_ID_GPIO, \
- I2C_ADDR_PCA555_BOARD_ID_GPIO, (reg), (data))
+ pca9555_read__7bf(I2C_PORT_PCA555_BOARD_ID_GPIO, \
+ I2C_ADDR_PCA555_BOARD_ID_GPIO__7bf, (reg), (data))
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
diff --git a/board/glkrvp/chg_usb_pd.c b/board/glkrvp/chg_usb_pd.c
index bba185202f..fd4b1fd0e2 100644
--- a/board/glkrvp/chg_usb_pd.c
+++ b/board/glkrvp/chg_usb_pd.c
@@ -35,7 +35,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT7_0,
- .addr = 0xa0,
+ .addr__7bf = 0x50,
},
.drv = &tcpci_tcpm_drv,
},
@@ -43,7 +43,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT7_0,
- .addr = 0xa4,
+ .addr__7bf = 0x52,
},
.drv = &tcpci_tcpm_drv,
},
@@ -52,11 +52,11 @@ BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == CONFIG_USB_PD_PORT_COUNT);
struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
{
- .port_addr = 0x20,
+ .port_addr = 0x10,
.driver = &ps874x_usb_mux_driver,
},
{
- .port_addr = 0x22,
+ .port_addr = 0x11,
.driver = &ps874x_usb_mux_driver,
},
};
diff --git a/board/glkrvp_ite/battery.c b/board/glkrvp_ite/battery.c
index d9d4bf9bf3..5665b1f557 100644
--- a/board/glkrvp_ite/battery.c
+++ b/board/glkrvp_ite/battery.c
@@ -199,8 +199,8 @@ enum battery_present battery_hw_present(void)
int data;
int rv;
- rv = pca9555_read(I2C_PORT_PCA555_PMIC_BATT_GPIO,
- I2C_ADDR_PCA555_PMIC_BATT_GPIO,
+ rv = pca9555_read__7bf(I2C_PORT_PCA555_PMIC_BATT_GPIO,
+ I2C_ADDR_PCA555_PMIC_BATT_GPIO__7bf,
PCA9555_CMD_INPUT_PORT_0, &data);
/* GPIO is low when the battery is physically present */
diff --git a/board/glkrvp_ite/board.c b/board/glkrvp_ite/board.c
index 4127a29634..9721549b14 100644
--- a/board/glkrvp_ite/board.c
+++ b/board/glkrvp_ite/board.c
@@ -31,7 +31,7 @@
#include "gpio_list.h"
#define I2C_PORT_PCA555_BOARD_ID_GPIO IT83XX_I2C_CH_C
-#define I2C_ADDR_PCA555_BOARD_ID_GPIO 0x40
+#define I2C_ADDR_PCA555_BOARD_ID_GPIO__7bf 0x20
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
@@ -55,8 +55,8 @@ void chipset_pre_init_callback(void)
{
int data;
- if (pca9555_read(I2C_PORT_PCA555_PMIC_BATT_GPIO,
- I2C_ADDR_PCA555_PMIC_BATT_GPIO,
+ if (pca9555_read__7bf(I2C_PORT_PCA555_PMIC_BATT_GPIO,
+ I2C_ADDR_PCA555_PMIC_BATT_GPIO__7bf,
PCA9555_CMD_OUTPUT_PORT_0, &data))
return;
@@ -70,16 +70,17 @@ void chipset_pre_init_callback(void)
/* Enable SOC_3P3_EN_L: Set the Output port O0.1 to low level */
data &= ~PCA9555_IO_1;
- pca9555_write(I2C_PORT_PCA555_PMIC_BATT_GPIO,
- I2C_ADDR_PCA555_PMIC_BATT_GPIO,
+ pca9555_write__7bf(I2C_PORT_PCA555_PMIC_BATT_GPIO,
+ I2C_ADDR_PCA555_PMIC_BATT_GPIO__7bf,
PCA9555_CMD_OUTPUT_PORT_0, data);
/* TODO: Find out from the spec */
msleep(10);
/* Enable PMIC_EN: Set the Output port O0.0 to high level */
- pca9555_write(I2C_PORT_PCA555_PMIC_BATT_GPIO,
- I2C_ADDR_PCA555_PMIC_BATT_GPIO, PCA9555_CMD_OUTPUT_PORT_0,
+ pca9555_write__7bf(I2C_PORT_PCA555_PMIC_BATT_GPIO,
+ I2C_ADDR_PCA555_PMIC_BATT_GPIO__7bf,
+ PCA9555_CMD_OUTPUT_PORT_0,
data | PCA9555_IO_0);
}
@@ -105,23 +106,24 @@ void chipset_do_shutdown(void)
{
int data;
- if (pca9555_read(I2C_PORT_PCA555_PMIC_BATT_GPIO,
- I2C_ADDR_PCA555_PMIC_BATT_GPIO,
+ if (pca9555_read__7bf(I2C_PORT_PCA555_PMIC_BATT_GPIO,
+ I2C_ADDR_PCA555_PMIC_BATT_GPIO__7bf,
PCA9555_CMD_OUTPUT_PORT_0, &data))
return;
/* Disable SOC_3P3_EN_L: Set the Output port O0.1 to high level */
data |= PCA9555_IO_1;
- pca9555_write(I2C_PORT_PCA555_PMIC_BATT_GPIO,
- I2C_ADDR_PCA555_PMIC_BATT_GPIO,
+ pca9555_write__7bf(I2C_PORT_PCA555_PMIC_BATT_GPIO,
+ I2C_ADDR_PCA555_PMIC_BATT_GPIO__7bf,
PCA9555_CMD_OUTPUT_PORT_0, data);
/* TODO: Find out from the spec */
msleep(10);
/* Disable PMIC_EN: Set the Output port O0.0 to low level */
- pca9555_write(I2C_PORT_PCA555_PMIC_BATT_GPIO,
- I2C_ADDR_PCA555_PMIC_BATT_GPIO, PCA9555_CMD_OUTPUT_PORT_0,
+ pca9555_write__7bf(I2C_PORT_PCA555_PMIC_BATT_GPIO,
+ I2C_ADDR_PCA555_PMIC_BATT_GPIO__7bf,
+ PCA9555_CMD_OUTPUT_PORT_0,
data & ~PCA9555_IO_0);
}
@@ -145,8 +147,9 @@ int board_get_version(void)
{
int data;
- if (pca9555_read(I2C_PORT_PCA555_BOARD_ID_GPIO,
- I2C_ADDR_PCA555_BOARD_ID_GPIO, PCA9555_CMD_INPUT_PORT_1, &data))
+ if (pca9555_read__7bf(I2C_PORT_PCA555_BOARD_ID_GPIO,
+ I2C_ADDR_PCA555_BOARD_ID_GPIO__7bf,
+ PCA9555_CMD_INPUT_PORT_1, &data))
return -1;
return data & 0x0f;
@@ -163,8 +166,8 @@ static void pmic_init(void)
* Configure Port O0.0 as Output port - PMIC_EN
* Configure Port O0.1 as Output port - SOC_3P3_EN_L
*/
- pca9555_write(I2C_PORT_PCA555_PMIC_BATT_GPIO,
- I2C_ADDR_PCA555_PMIC_BATT_GPIO,
+ pca9555_write__7bf(I2C_PORT_PCA555_PMIC_BATT_GPIO,
+ I2C_ADDR_PCA555_PMIC_BATT_GPIO__7bf,
PCA9555_CMD_CONFIGURATION_PORT_0, 0xfc);
/*
@@ -174,8 +177,8 @@ static void pmic_init(void)
* POR of PCA9555 port is input with high impedance hence explicitly
* configure the SOC_3P3_EN_L to high level.
*/
- pca9555_write(I2C_PORT_PCA555_PMIC_BATT_GPIO,
- I2C_ADDR_PCA555_PMIC_BATT_GPIO,
+ pca9555_write__7bf(I2C_PORT_PCA555_PMIC_BATT_GPIO,
+ I2C_ADDR_PCA555_PMIC_BATT_GPIO__7bf,
PCA9555_CMD_OUTPUT_PORT_0, 0xfe);
}
DECLARE_HOOK(HOOK_INIT, pmic_init, HOOK_PRIO_INIT_I2C + 1);
diff --git a/board/glkrvp_ite/board.h b/board/glkrvp_ite/board.h
index d1d3b7be7d..7c7834353c 100644
--- a/board/glkrvp_ite/board.h
+++ b/board/glkrvp_ite/board.h
@@ -115,7 +115,7 @@
#define I2C_PORT_USB_MUX IT83XX_I2C_CH_B
#define I2C_PORT_PCA555_PMIC_BATT_GPIO IT83XX_I2C_CH_C
-#define I2C_ADDR_PCA555_PMIC_BATT_GPIO 0x42
+#define I2C_ADDR_PCA555_PMIC_BATT_GPIO__7bf 0x21
/* EC exclude modules */
#undef CONFIG_ADC
diff --git a/board/glkrvp_ite/chg_usb_pd.c b/board/glkrvp_ite/chg_usb_pd.c
index 01c8f43f1e..7f3d049b29 100644
--- a/board/glkrvp_ite/chg_usb_pd.c
+++ b/board/glkrvp_ite/chg_usb_pd.c
@@ -35,7 +35,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = IT83XX_I2C_CH_B,
- .addr = 0xa0,
+ .addr__7bf = 0x50,
},
.drv = &tcpci_tcpm_drv,
},
@@ -43,7 +43,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = IT83XX_I2C_CH_B,
- .addr = 0xa4,
+ .addr__7bf = 0x52,
},
.drv = &tcpci_tcpm_drv,
},
@@ -52,11 +52,11 @@ BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == CONFIG_USB_PD_PORT_COUNT);
struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
{
- .port_addr = 0x20,
+ .port_addr = 0x10,
.driver = &ps874x_usb_mux_driver,
},
{
- .port_addr = 0x22,
+ .port_addr = 0x11,
.driver = &ps874x_usb_mux_driver,
},
};
diff --git a/board/hammer/board.h b/board/hammer/board.h
index 7811ab7973..0e43ac877c 100644
--- a/board/hammer/board.h
+++ b/board/hammer/board.h
@@ -275,7 +275,7 @@
#define CONFIG_TOUCHPAD
#define CONFIG_TOUCHPAD_ELAN
#define CONFIG_TOUCHPAD_I2C_PORT I2C_PORT_MASTER
-#define CONFIG_TOUCHPAD_I2C_ADDR (0x15 << 1)
+#define CONFIG_TOUCHPAD_I2C_ADDR__7BF 0x15
#endif /* BOARD_WHISKERS */
#define CONFIG_CURVE25519
diff --git a/board/hatch/board.c b/board/hatch/board.c
index da1349208a..364c9e3d31 100644
--- a/board/hatch/board.c
+++ b/board/hatch/board.c
@@ -130,7 +130,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr = AN7447_TCPC0_I2C_ADDR,
+ .addr__7bf = AN7447_TCPC0_I2C_ADDR__7bf,
},
.drv = &anx7447_tcpm_drv,
.flags = TCPC_FLAGS_RESET_ACTIVE_HIGH,
@@ -139,7 +139,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC1,
- .addr = PS8751_I2C_ADDR1,
+ .addr__7bf = PS8751_I2C_ADDR1__7bf,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -159,12 +159,12 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
const struct pi3usb2901_config_t pi3usb2901_bc12_chips[] = {
[USB_PD_PORT_TCPC_0] = {
.i2c_port = I2C_PORT_PPC0,
- .i2c_addr = PI3USB9201_I2C_ADDR_3,
+ .i2c_addr__7bf = PI3USB9201_I2C_ADDR_3__7bf,
},
[USB_PD_PORT_TCPC_1] = {
.i2c_port = I2C_PORT_TCPC1,
- .i2c_addr = PI3USB9201_I2C_ADDR_3,
+ .i2c_addr__7bf = PI3USB9201_I2C_ADDR_3__7bf,
},
};
@@ -233,7 +233,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bma255_data,
.port = I2C_PORT_ACCEL,
- .addr = BMA2x2_I2C_ADDR1,
+ .i2c_spi_addr__7bf = BMA2x2_I2C_ADDR1__7bf,
.rot_standard_ref = &lid_standard_ref,
.min_frequency = BMA255_ACCEL_MIN_FREQ,
.max_frequency = BMA255_ACCEL_MAX_FREQ,
@@ -260,7 +260,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_ACCEL_MIN_FREQ,
.max_frequency = BMI160_ACCEL_MAX_FREQ,
@@ -286,7 +286,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -302,7 +302,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &tcs3400_drv,
.drv_data = &g_tcs3400_data,
.port = I2C_PORT_ALS,
- .addr = TCS3400_I2C_ADDR,
+ .i2c_spi_addr__7bf = TCS3400_I2C_ADDR__7bf,
.rot_standard_ref = NULL,
.default_range = 0x10000, /* scale = 1x, uscale = 0 */
.min_frequency = TCS3400_LIGHT_MIN_FREQ,
diff --git a/board/helios/board.c b/board/helios/board.c
index e40833f2a9..6a47979565 100644
--- a/board/helios/board.c
+++ b/board/helios/board.c
@@ -119,7 +119,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr = PS8751_I2C_ADDR1,
+ .addr__7bf = PS8751_I2C_ADDR1__7bf,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -127,7 +127,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC1,
- .addr = PS8751_I2C_ADDR1,
+ .addr__7bf = PS8751_I2C_ADDR1__7bf,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -147,12 +147,12 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
const struct pi3usb2901_config_t pi3usb2901_bc12_chips[] = {
[USB_PD_PORT_TCPC_0] = {
.i2c_port = I2C_PORT_PPC0,
- .i2c_addr = PI3USB9201_I2C_ADDR_3,
+ .i2c_addr__7bf = PI3USB9201_I2C_ADDR_3__7bf,
},
[USB_PD_PORT_TCPC_1] = {
.i2c_port = I2C_PORT_TCPC1,
- .i2c_addr = PI3USB9201_I2C_ADDR_3,
+ .i2c_addr__7bf = PI3USB9201_I2C_ADDR_3__7bf,
},
};
@@ -198,7 +198,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bma255_data,
.port = I2C_PORT_ACCEL,
- .addr = BMA2x2_I2C_ADDR1,
+ .i2c_spi_addr__7bf = BMA2x2_I2C_ADDR1__7bf,
.rot_standard_ref = &lid_standard_ref,
.min_frequency = BMA255_ACCEL_MIN_FREQ,
.max_frequency = BMA255_ACCEL_MAX_FREQ,
@@ -225,7 +225,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_ACCEL_MIN_FREQ,
.max_frequency = BMI160_ACCEL_MAX_FREQ,
@@ -251,7 +251,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -267,7 +267,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &opt3001_drv,
.drv_data = &g_opt3001_data,
.port = I2C_PORT_ACCEL,
- .addr = OPT3001_I2C_ADDR,
+ .i2c_spi_addr__7bf = OPT3001_I2C_ADDR__7bf,
.rot_standard_ref = NULL,
.default_range = 0x2b11a1,
.min_frequency = OPT3001_LIGHT_MIN_FREQ,
diff --git a/board/helios/board.h b/board/helios/board.h
index ac4e0432dd..b85299e19d 100644
--- a/board/helios/board.h
+++ b/board/helios/board.h
@@ -48,7 +48,7 @@
#define CONFIG_ALS
#define ALS_COUNT 1
#define CONFIG_ALS_OPT3001
-#define OPT3001_I2C_ADDR OPT3001_I2C_ADDR1
+#define OPT3001_I2C_ADDR__7bf OPT3001_I2C_ADDR1__7bf
/* USB Type C and USB PD defines */
#define CONFIG_USB_PD_TCPM_PS8751
diff --git a/board/host/battery.c b/board/host/battery.c
index d1d2cdc3e0..6ec74c61b4 100644
--- a/board/host/battery.c
+++ b/board/host/battery.c
@@ -14,13 +14,14 @@
static uint16_t mock_smart_battery[SB_MANUFACTURER_DATA + 1];
-int sb_i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_size,
+int sb_i2c_xfer__7bf(int port, uint16_t slave_addr__7bf,
+ const uint8_t *out, int out_size,
uint8_t *in, int in_size, int flags)
{
if (out_size == 0)
return EC_SUCCESS;
- if (port != I2C_PORT_BATTERY || slave_addr != BATTERY_ADDR)
+ if (port != I2C_PORT_BATTERY || slave_addr__7bf != BATTERY_ADDR__7bf)
return EC_ERROR_INVAL;
if (out[0] >= ARRAY_SIZE(mock_smart_battery))
return EC_ERROR_UNIMPLEMENTED;
@@ -41,7 +42,7 @@ int sb_i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_size,
}
return EC_SUCCESS;
}
-DECLARE_TEST_I2C_XFER(sb_i2c_xfer);
+DECLARE_TEST_I2C_XFER(sb_i2c_xfer__7bf);
int battery_time_at_rate(int rate, int *minutes)
{
diff --git a/board/kindred/board.c b/board/kindred/board.c
index 3bbfe47529..66862f706a 100644
--- a/board/kindred/board.c
+++ b/board/kindred/board.c
@@ -130,7 +130,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr = AN7447_TCPC0_I2C_ADDR,
+ .addr__7bf = AN7447_TCPC0_I2C_ADDR__7bf,
},
.drv = &anx7447_tcpm_drv,
.flags = TCPC_FLAGS_RESET_ACTIVE_HIGH,
@@ -139,7 +139,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC1,
- .addr = PS8751_I2C_ADDR1,
+ .addr__7bf = PS8751_I2C_ADDR1__7bf,
},
.drv = &ps8xxx_tcpm_drv,
.flags = 0,
@@ -160,12 +160,12 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
const struct pi3usb2901_config_t pi3usb2901_bc12_chips[] = {
[USB_PD_PORT_TCPC_0] = {
.i2c_port = I2C_PORT_PPC0,
- .i2c_addr = PI3USB9201_I2C_ADDR_3,
+ .i2c_addr__7bf = PI3USB9201_I2C_ADDR_3__7bf,
},
[USB_PD_PORT_TCPC_1] = {
.i2c_port = I2C_PORT_TCPC1,
- .i2c_addr = PI3USB9201_I2C_ADDR_3,
+ .i2c_addr__7bf = PI3USB9201_I2C_ADDR_3__7bf,
},
};
@@ -216,7 +216,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bma255_data,
.port = I2C_PORT_ACCEL,
- .addr = BMA2x2_I2C_ADDR1,
+ .i2c_spi_addr__7bf = BMA2x2_I2C_ADDR1__7bf,
.rot_standard_ref = &lid_standard_ref,
.min_frequency = BMA255_ACCEL_MIN_FREQ,
.max_frequency = BMA255_ACCEL_MAX_FREQ,
@@ -243,7 +243,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_ACCEL_MIN_FREQ,
.max_frequency = BMI160_ACCEL_MAX_FREQ,
@@ -269,7 +269,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -285,7 +285,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &opt3001_drv,
.drv_data = &g_opt3001_data,
.port = I2C_PORT_ACCEL,
- .addr = OPT3001_I2C_ADDR,
+ .i2c_spi_addr__7bf = OPT3001_I2C_ADDR__7bf,
.rot_standard_ref = NULL,
.default_range = 0x2b11a1,
.min_frequency = OPT3001_LIGHT_MIN_FREQ,
diff --git a/board/kindred/board.h b/board/kindred/board.h
index 057270ff28..1d327abbcf 100644
--- a/board/kindred/board.h
+++ b/board/kindred/board.h
@@ -47,7 +47,7 @@
#define CONFIG_ALS
#define ALS_COUNT 1
#define CONFIG_ALS_OPT3001
-#define OPT3001_I2C_ADDR OPT3001_I2C_ADDR1
+#define OPT3001_I2C_ADDR__7bf OPT3001_I2C_ADDR1__7bf
/* USB Type C and USB PD defines */
#define CONFIG_USB_PD_TCPM_ANX7447
diff --git a/board/kohaku/board.c b/board/kohaku/board.c
index 10b33691f3..0fa7b42ac7 100644
--- a/board/kohaku/board.c
+++ b/board/kohaku/board.c
@@ -117,7 +117,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr = PS8751_I2C_ADDR1,
+ .addr__7bf = PS8751_I2C_ADDR1__7bf,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -125,7 +125,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC1,
- .addr = PS8751_I2C_ADDR1,
+ .addr__7bf = PS8751_I2C_ADDR1__7bf,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -224,7 +224,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bma255_data,
.port = I2C_PORT_ACCEL,
- .addr = BMA2x2_I2C_ADDR1,
+ .i2c_spi_addr__7bf = BMA2x2_I2C_ADDR1__7bf,
.rot_standard_ref = &lid_standard_ref,
.min_frequency = BMA255_ACCEL_MIN_FREQ,
.max_frequency = BMA255_ACCEL_MAX_FREQ,
@@ -251,7 +251,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_ACCEL_MIN_FREQ,
.max_frequency = BMI160_ACCEL_MAX_FREQ,
@@ -277,7 +277,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -293,7 +293,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &bh1730_drv,
.drv_data = &g_bh1730_data,
.port = I2C_PORT_ACCEL,
- .addr = BH1730_I2C_ADDR,
+ .i2c_spi_addr__7bf = BH1730_I2C_ADDR__7bf,
.rot_standard_ref = NULL,
.default_range = 65535,
.min_frequency = 10,
@@ -327,7 +327,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &tcs3400_drv,
.drv_data = &g_tcs3400_data,
.port = I2C_PORT_ALS,
- .addr = TCS3400_I2C_ADDR,
+ .i2c_spi_addr__7bf = TCS3400_I2C_ADDR__7bf,
.rot_standard_ref = NULL,
.default_range = 0x10000, /* scale = 1x, uscale = 0 */
.min_frequency = TCS3400_LIGHT_MIN_FREQ,
diff --git a/board/kukui/board.c b/board/kukui/board.c
index 5b44578362..95f177bf6b 100644
--- a/board/kukui/board.c
+++ b/board/kukui/board.c
@@ -80,7 +80,7 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-#define BC12_I2C_ADDR PI3USB9201_I2C_ADDR_3
+#define BC12_I2C_ADDR__7bf PI3USB9201_I2C_ADDR_3__7bf
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
@@ -101,7 +101,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr = MT6370_TCPC_I2C_ADDR,
+ .addr__7bf = MT6370_TCPC_I2C_ADDR__7bf,
},
.drv = &mt6370_tcpm_drv,
},
@@ -303,7 +303,7 @@ static void board_rev_init(void)
if (board_get_version() == 2) {
/* configure PI3USB9201 to USB Path ON Mode */
- i2c_write8(I2C_PORT_BC12, BC12_I2C_ADDR,
+ i2c_write8__7bf(I2C_PORT_BC12, BC12_I2C_ADDR__7bf,
PI3USB9201_REG_CTRL_1,
(PI3USB9201_USB_PATH_ON <<
PI3USB9201_REG_CTRL_1_MODE_SHIFT));
@@ -470,7 +470,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = &lid_standard_ref,
.default_range = 4, /* g */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -493,7 +493,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = 1000, /* dps */
.rot_standard_ref = &lid_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -510,7 +510,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = BIT(11), /* 16LSB / uT, fixed */
.rot_standard_ref = &mag_standard_ref,
.min_frequency = BMM150_MAG_MIN_FREQ,
@@ -526,7 +526,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &tcs3400_drv,
.drv_data = &g_tcs3400_data,
.port = I2C_PORT_ALS,
- .addr = TCS3400_I2C_ADDR,
+ .i2c_spi_addr__7bf = TCS3400_I2C_ADDR__7bf,
.rot_standard_ref = NULL,
.default_range = 0x10000, /* scale = 1x, uscale = 0 */
.min_frequency = TCS3400_LIGHT_MIN_FREQ,
diff --git a/board/kukui/board.h b/board/kukui/board.h
index e6862f6c78..95378757bc 100644
--- a/board/kukui/board.h
+++ b/board/kukui/board.h
@@ -91,7 +91,7 @@
#ifdef SECTION_IS_RW
#ifndef BOARD_KRANE
#define CONFIG_MAG_BMI160_BMM150
-#define CONFIG_ACCELGYRO_SEC_ADDR BMM150_ADDR0 /* 8-bit address */
+#define CONFIG_ACCELGYRO_SEC_ADDR__7BF BMM150_ADDR0__7bf
#define CONFIG_MAG_CALIBRATE
#endif /* !BOARD_KRANE */
#define CONFIG_ACCELGYRO_BMI160
@@ -221,7 +221,7 @@
#define I2C_PORT_ALS 1
/* Route sbs host requests to virtual battery driver */
-#define VIRTUAL_BATTERY_ADDR 0x16
+#define VIRTUAL_BATTERY_ADDR__7bf 0x0B
/* Enable Accel over SPI */
#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master port (SPI2) */
diff --git a/board/mchpevb1/battery.c b/board/mchpevb1/battery.c
index 016d225950..d6c702127e 100644
--- a/board/mchpevb1/battery.c
+++ b/board/mchpevb1/battery.c
@@ -47,10 +47,10 @@ int board_cut_off_battery(void)
buf[2] = PARAM_CUT_OFF_HIGH;
i2c_lock(I2C_PORT_BATTERY, 1);
- rv = i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR, buf, 3, NULL, 0,
- I2C_XFER_SINGLE);
- rv |= i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR, buf, 3, NULL, 0,
- I2C_XFER_SINGLE);
+ rv = i2c_xfer_unlocked__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ buf, 3, NULL, 0, I2C_XFER_SINGLE);
+ rv |= i2c_xfer_unlocked__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ buf, 3, NULL, 0, I2C_XFER_SINGLE);
i2c_lock(I2C_PORT_BATTERY, 0);
return rv;
diff --git a/board/mchpevb1/board.c b/board/mchpevb1/board.c
index 7f4bb26c46..f11e65302b 100644
--- a/board/mchpevb1/board.c
+++ b/board/mchpevb1/board.c
@@ -66,14 +66,14 @@
/* NOTE: MEC17xx EVB + SKL RVP3 does not use BD99992 PMIC.
* RVP3 PMIC controlled by RVP3 logic.
*/
-#define I2C_ADDR_BD99992 0x60
+#define I2C_ADDR_BD99992__7bf 0x30
/*
* Maxim DS1624 I2C temperature sensor used for testing I2C.
* DS1624 contains one internal temperature sensor
* and EEPROM. It has no external temperature inputs.
*/
-#define DS1624_I2C_ADDR 0x90 /* 7-bit address is 0x48 */
+#define DS1624_I2C_ADDR__7bf (0x48 | I2C_FLAG_BIG_ENDIAN)
#define DS1624_IDX_LOCAL 0
#define DS1624_READ_TEMP16 0xAA /* read 16-bit temperature */
#define DS1624_ACCESS_CFG 0xAC /* read/write 8-bit config */
@@ -264,8 +264,13 @@ int board_i2c_p2c(int port)
#ifdef CONFIG_USB_POWER_DELIVERY
const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
- {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR, &tcpci_tcpm_drv},
- {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR + 2, &tcpci_tcpm_drv},
+ {I2C_PORT_TCPC,
+ CONFIG_TCPC_I2C_BASE_ADDR__7BF,
+ &tcpci_tcpm_drv},
+
+ {I2C_PORT_TCPC,
+ CONFIG_TCPC_I2C_BASE_ADDR__7BF + 1,
+ &tcpci_tcpm_drv},
};
#endif
@@ -384,11 +389,11 @@ BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) ==
struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
{
- .port_addr = 0xa8,
+ .port_addr = 0x54,
.driver = &pi3usb30532_usb_mux_driver,
},
{
- .port_addr = 0x20,
+ .port_addr = 0x10,
.driver = &ps874x_usb_mux_driver,
}
};
@@ -505,14 +510,14 @@ static void board_pmic_init(void)
/* Config DS1624 temperature sensor for continuous conversion */
cfg = 0x66;
- rv = i2c_read8(I2C_PORT_THERMAL, DS1624_I2C_ADDR,
+ rv = i2c_read8__7bf(I2C_PORT_THERMAL, DS1624_I2C_ADDR__7bf,
DS1624_ACCESS_CFG, &cfg);
trace2(0, BRD, 0, "Read DS1624 Config rv = %d cfg = 0x%02X",
rv, cfg);
if ((rv == EC_SUCCESS) && (cfg & (1u << 0))) {
/* one-shot mode switch to continuous */
- rv = i2c_write8(I2C_PORT_THERMAL, DS1624_I2C_ADDR,
+ rv = i2c_write8__7bf(I2C_PORT_THERMAL, DS1624_I2C_ADDR__7bf,
DS1624_ACCESS_CFG, 0);
trace1(0, BRD, 0, "Write DS1624 Config to 0, rv = %d", rv);
/* writes to config require 10ms until next I2C command */
@@ -521,7 +526,7 @@ static void board_pmic_init(void)
}
/* Send start command */
- rv = i2c_write8(I2C_PORT_THERMAL, DS1624_I2C_ADDR,
+ rv = i2c_write8__7bf(I2C_PORT_THERMAL, DS1624_I2C_ADDR__7bf,
DS1624_CMD_START, 1);
trace1(0, BRD, 0, "Send Start command to DS1624 rv = %d", rv);
@@ -864,8 +869,7 @@ static void ds1624_update(void)
int temp;
int rv __attribute__((unused));
- rv = i2c_read16(I2C_PORT_THERMAL,
- (DS1624_I2C_ADDR | I2C_FLAG_BIG_ENDIAN),
+ rv = i2c_read16__7bf(I2C_PORT_THERMAL, DS1624_I2C_ADDR__7bf,
DS1624_READ_TEMP16, &temp);
d = (temp & 0x7FFF) >> 8;
@@ -928,7 +932,8 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = CONFIG_SPI_ACCEL_PORT,
- .addr = BMI160_SET_SPI_ADDRESS(CONFIG_SPI_ACCEL_PORT),
+ .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(
+ CONFIG_SPI_ACCEL_PORT),
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 2, /* g, enough for laptop. */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -952,7 +957,8 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = CONFIG_SPI_ACCEL_PORT,
- .addr = BMI160_SET_SPI_ADDRESS(CONFIG_SPI_ACCEL_PORT),
+ .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(
+ CONFIG_SPI_ACCEL_PORT),
.default_range = 1000, /* dps */
.rot_standard_ref = NULL, /* Identity Matrix. */
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -969,7 +975,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_ACCEL,
- .addr = KX022_ADDR1,
+ .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KX022_ACCEL_MIN_FREQ,
diff --git a/board/mchpevb1/board.h b/board/mchpevb1/board.h
index 0dbfe2bb3c..8fcaadc4bf 100644
--- a/board/mchpevb1/board.h
+++ b/board/mchpevb1/board.h
@@ -400,7 +400,7 @@
#endif
/* Ambient Light Sensor address */
-#define OPT3001_I2C_ADDR OPT3001_I2C_ADDR1
+#define OPT3001_I2C_ADDR__7bf OPT3001_I2C_ADDR1__7bf
/* Modules we want to exclude */
#undef CONFIG_CMD_HASH
diff --git a/board/meep/board.c b/board/meep/board.c
index 8c44bda737..a5e37b69ed 100644
--- a/board/meep/board.c
+++ b/board/meep/board.c
@@ -138,7 +138,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &kx022_data,
.port = I2C_PORT_SENSOR,
- .addr = KX022_ADDR1,
+ .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
.rot_standard_ref = &lid_standrd_ref,
.default_range = 2, /* g */
.config = {
@@ -166,7 +166,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_BASE_SIXAXIS_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .addr = LSM6DSM_ADDR0,
+ .i2c_spi_addr__7bf = LSM6DSM_ADDR0__7bf,
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g */
.min_frequency = LSM6DSM_ODR_MIN_VAL,
@@ -198,7 +198,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_BASE_SIXAXIS_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .addr = LSM6DSM_ADDR0,
+ .i2c_spi_addr__7bf = LSM6DSM_ADDR0__7bf,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = LSM6DSM_ODR_MIN_VAL,
diff --git a/board/nami/board.c b/board/nami/board.c
index ac66f10307..ba9bb571aa 100644
--- a/board/nami/board.c
+++ b/board/nami/board.c
@@ -233,7 +233,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_0,
- .addr = PS8751_I2C_ADDR1,
+ .addr__7bf = PS8751_I2C_ADDR1__7bf,
},
.drv = &ps8xxx_tcpm_drv,
/* Alert is active-low, push-pull */
@@ -243,7 +243,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_1,
- .addr = AN7447_TCPC3_I2C_ADDR,
+ .addr__7bf = AN7447_TCPC3_I2C_ADDR__7bf,
},
.drv = &anx7447_tcpm_drv,
/* Alert is active-low, push-pull */
@@ -487,9 +487,11 @@ const static struct ec_thermal_config thermal_d2 = {
};
#define I2C_PMIC_READ(reg, data) \
- i2c_read8(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1, (reg), (data))
+ i2c_read8__7bf(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1__7bf,\
+ (reg), (data))
#define I2C_PMIC_WRITE(reg, data) \
- i2c_write8(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1, (reg), (data))
+ i2c_write8__7bf(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1__7bf,\
+ (reg), (data))
static void board_pmic_init(void)
{
@@ -749,7 +751,7 @@ const struct motion_sensor_t lid_accel_1 = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_ACCEL,
- .addr = KX022_ADDR1,
+ .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
.rot_standard_ref = &rotation_x180_z90,
.min_frequency = KX022_ACCEL_MIN_FREQ,
.max_frequency = KX022_ACCEL_MAX_FREQ,
@@ -777,7 +779,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bma255_data,
.port = I2C_PORT_ACCEL,
- .addr = BMA2x2_I2C_ADDR1,
+ .i2c_spi_addr__7bf = BMA2x2_I2C_ADDR1__7bf,
.rot_standard_ref = &lid_standard_ref,
.min_frequency = BMA255_ACCEL_MIN_FREQ,
.max_frequency = BMA255_ACCEL_MAX_FREQ,
@@ -805,7 +807,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_ACCEL_MIN_FREQ,
.max_frequency = BMI160_ACCEL_MAX_FREQ,
@@ -833,7 +835,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -989,10 +991,10 @@ static void board_init(void)
gpio_set_level(GPIO_PCH_ACPRESENT, extpower_is_present());
/* Reduce Buck-boost mode switching frequency to reduce heat */
- if (i2c_read16(I2C_PORT_CHARGER, I2C_ADDR_CHARGER,
+ if (i2c_read16__7bf(I2C_PORT_CHARGER, I2C_ADDR_CHARGER__7bf,
ISL9238_REG_CONTROL3, &reg) == EC_SUCCESS) {
reg |= ISL9238_C3_BB_SWITCHING_PERIOD;
- if (i2c_write16(I2C_PORT_CHARGER, I2C_ADDR_CHARGER,
+ if (i2c_write16__7bf(I2C_PORT_CHARGER, I2C_ADDR_CHARGER__7bf,
ISL9238_REG_CONTROL3, reg))
CPRINTF("Failed to set isl9238\n");
}
diff --git a/board/nami/board.h b/board/nami/board.h
index 20c9628d9d..04dfef4eff 100644
--- a/board/nami/board.h
+++ b/board/nami/board.h
@@ -210,8 +210,8 @@
#define I2C_PORT_ALS NPCX_I2C_PORT3
/* I2C addresses */
-#define I2C_ADDR_MP2949 0x40
-#define I2C_ADDR_EEPROM 0xa0
+#define I2C_ADDR_MP2949__7bf 0x20
+#define I2C_ADDR_EEPROM__7bf 0x50
#ifndef __ASSEMBLER__
diff --git a/board/nautilus/board.c b/board/nautilus/board.c
index 5dc1df0328..bf89d0edad 100644
--- a/board/nautilus/board.c
+++ b/board/nautilus/board.c
@@ -151,7 +151,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_0,
- .addr = PS8751_I2C_ADDR1,
+ .addr__7bf = PS8751_I2C_ADDR1__7bf,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -159,7 +159,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_1,
- .addr = PS8751_I2C_ADDR1,
+ .addr__7bf = PS8751_I2C_ADDR1__7bf,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -268,7 +268,7 @@ static void board_report_pmic_fault(const char *str)
uint32_t info;
/* RESETIRQ1 -- Bit 4: VRFAULT */
- if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x8, &vrfault)
+ if (i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x8, &vrfault)
!= EC_SUCCESS)
return;
@@ -278,19 +278,19 @@ static void board_report_pmic_fault(const char *str)
/* VRFAULT has occurred, print VRFAULT status bits. */
/* PWRSTAT1 */
- i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x16, &pwrstat1);
+ i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x16, &pwrstat1);
/* PWRSTAT2 */
- i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x17, &pwrstat2);
+ i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x17, &pwrstat2);
CPRINTS("PMIC VRFAULT: %s", str);
CPRINTS("PMIC VRFAULT: PWRSTAT1=0x%02x PWRSTAT2=0x%02x", pwrstat1,
pwrstat2);
/* Clear all faults -- Write 1 to clear. */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x8, BIT(4));
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x16, pwrstat1);
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x17, pwrstat2);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x8, BIT(4));
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x16, pwrstat1);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x17, pwrstat2);
/*
* Status of the fault registers can be checked in the OS by looking at
@@ -309,7 +309,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x30, 0x3a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x3a);
/*
* V18ACNT:
@@ -318,7 +318,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x34, 0x2a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x34, 0x2a);
/*
* V100ACNT:
@@ -327,7 +327,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x37, 0x1a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x37, 0x1a);
/*
* V085ACNT:
@@ -336,7 +336,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x38, 0x3a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x3a);
}
static void board_pmic_enable_slp_s0_vr_decay(void)
@@ -348,7 +348,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x30, 0x7a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x7a);
/*
* V18ACNT:
@@ -357,7 +357,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x34, 0x6a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x34, 0x6a);
/*
* V100ACNT:
@@ -366,7 +366,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x37, 0x5a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x37, 0x5a);
/*
* V085ACNT:
@@ -375,7 +375,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x38, 0x7a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x7a);
}
void power_board_handle_host_sleep_event(enum host_sleep_event state)
@@ -394,12 +394,12 @@ static void board_pmic_init(void)
return;
/* DISCHGCNT3 - enable 100 ohm discharge on V1.00A */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x3e, 0x04);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3e, 0x04);
board_pmic_disable_slp_s0_vr_decay();
/* VRMODECTRL - disable low-power mode for all rails */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x3b, 0x1f);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3b, 0x1f);
}
DECLARE_DEFERRED(board_pmic_init);
@@ -535,7 +535,7 @@ void board_hibernate(void)
uart_flush_output();
/* Trigger PMIC shutdown. */
- if (i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x49, 0x01)) {
+ if (i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x49, 0x01)) {
/*
* If we can't tell the PMIC to shutdown, instead reset
* and don't start the AP. Hopefully we'll be able to
@@ -611,7 +611,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bma255_data,
.port = I2C_PORT_ACCEL,
- .addr = BMA2x2_I2C_ADDR1,
+ .i2c_spi_addr__7bf = BMA2x2_I2C_ADDR1__7bf,
.rot_standard_ref = &lid_standard_ref,
.min_frequency = BMA255_ACCEL_MIN_FREQ,
.max_frequency = BMA255_ACCEL_MAX_FREQ,
@@ -637,7 +637,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_ACCEL_MIN_FREQ,
.max_frequency = BMI160_ACCEL_MAX_FREQ,
@@ -664,7 +664,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -747,16 +747,17 @@ int board_has_working_reset_flags(void)
#define BATTERY_FREE_MIN_DELTA_US (5 * MSEC)
static timestamp_t battery_last_i2c_time;
-static int is_battery_i2c(int port, int slave_addr)
+static int is_battery_i2c__7bf(const int port, const uint16_t slave_addr__7bf)
{
- return (port == I2C_PORT_BATTERY) && (slave_addr == BATTERY_ADDR);
+ return (port == I2C_PORT_BATTERY)
+ && (slave_addr__7bf == BATTERY_ADDR__7bf);
}
-void i2c_start_xfer_notify(int port, int slave_addr)
+void i2c_start_xfer_notify__7bf(const int port, const uint16_t slave_addr__7bf)
{
unsigned int time_delta_us;
- if (!is_battery_i2c(port, slave_addr))
+ if (!is_battery_i2c__7bf(port, slave_addr__7bf))
return;
time_delta_us = time_since32(battery_last_i2c_time);
@@ -766,9 +767,9 @@ void i2c_start_xfer_notify(int port, int slave_addr)
usleep(BATTERY_FREE_MIN_DELTA_US - time_delta_us);
}
-void i2c_end_xfer_notify(int port, int slave_addr)
+void i2c_end_xfer_notify__7bf(const int port, const uint16_t slave_addr__7bf)
{
- if (!is_battery_i2c(port, slave_addr))
+ if (!is_battery_i2c__7bf(port, slave_addr__7bf))
return;
battery_last_i2c_time = get_time();
diff --git a/board/nautilus/board.h b/board/nautilus/board.h
index 014f821482..ff5a4c586e 100644
--- a/board/nautilus/board.h
+++ b/board/nautilus/board.h
@@ -181,8 +181,8 @@
#define I2C_PORT_THERMAL I2C_PORT_PMIC
/* I2C addresses */
-#define I2C_ADDR_BD99992 0x60
-#define I2C_ADDR_MP2949 0x40
+#define I2C_ADDR_BD99992__7bf 0x30
+#define I2C_ADDR_MP2949__7bf 0x20
#ifndef __ASSEMBLER__
diff --git a/board/nocturne/board.c b/board/nocturne/board.c
index 8fe2a58e66..5df9e338ed 100644
--- a/board/nocturne/board.c
+++ b/board/nocturne/board.c
@@ -190,7 +190,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ALS_GYRO,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = &lid_standard_ref,
.default_range = 4, /* g */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -213,7 +213,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ALS_GYRO,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = &lid_standard_ref,
.default_range = 1000, /* dps */
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -229,7 +229,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &opt3001_drv,
.drv_data = &g_opt3001_data,
.port = I2C_PORT_ALS_GYRO,
- .addr = OPT3001_I2C_ADDR,
+ .i2c_spi_addr__7bf = OPT3001_I2C_ADDR__7bf,
.rot_standard_ref = NULL,
/* scale = 43.4513 http://b/111528815#comment14 */
.default_range = 0x2b11a1,
@@ -287,12 +287,12 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, enable_sensor_irqs, HOOK_PRIO_DEFAULT);
struct ppc_config_t ppc_chips[] = {
{
.i2c_port = I2C_PORT_USB_C0,
- .i2c_addr = SN5S330_ADDR0,
+ .i2c_addr__7bf = SN5S330_ADDR0__7bf,
.drv = &sn5s330_drv
},
{
.i2c_port = I2C_PORT_USB_C1,
- .i2c_addr = SN5S330_ADDR0,
+ .i2c_addr__7bf = SN5S330_ADDR0__7bf,
.drv = &sn5s330_drv,
},
};
@@ -303,7 +303,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_USB_C0,
- .addr = PS8751_I2C_ADDR1,
+ .addr__7bf = PS8751_I2C_ADDR1__7bf,
},
.drv = &tcpci_tcpm_drv,
},
@@ -311,7 +311,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_USB_C1,
- .addr = PS8751_I2C_ADDR1,
+ .addr__7bf = PS8751_I2C_ADDR1__7bf,
},
.drv = &tcpci_tcpm_drv,
},
@@ -342,7 +342,8 @@ DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT);
static void imvp8_tune_deferred(void)
{
/* For the IMVP8, reduce the steps during decay from 3 to 1. */
- if (i2c_write16(I2C_PORT_POWER, I2C_ADDR_MP2949, 0xFA, 0x0AC5))
+ if (i2c_write16__7bf(I2C_PORT_POWER, I2C_ADDR_MP2949__7bf,
+ 0xFA, 0x0AC5))
CPRINTS("Failed to change step decay!");
}
DECLARE_DEFERRED(imvp8_tune_deferred);
@@ -400,7 +401,7 @@ void board_hibernate(void)
system_enter_psl_mode();
/* Cut off DSW power via the ROP PMIC. */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x49, 0x1);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x49, 0x1);
/* Wait for power to be cut. */
while (1)
@@ -450,7 +451,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x30, 0x3a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x3a);
/*
* V18ACNT:
@@ -459,7 +460,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x34, 0x2a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x34, 0x2a);
/*
* V100ACNT:
@@ -468,7 +469,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x37, 0x1a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x37, 0x1a);
/*
* V085ACNT:
@@ -477,7 +478,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x38, 0x2a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x2a);
}
static void board_pmic_enable_slp_s0_vr_decay(void)
@@ -489,7 +490,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x30, 0x7a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x7a);
/*
* V18ACNT:
@@ -498,7 +499,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x34, 0x6a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x34, 0x6a);
/*
* V100ACNT:
@@ -507,7 +508,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x37, 0x5a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x37, 0x5a);
/*
* V085ACNT:
@@ -516,7 +517,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x38, 0x6a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x6a);
}
void power_board_handle_host_sleep_event(enum host_sleep_event state)
@@ -532,15 +533,16 @@ static void board_pmic_init(void)
int pgmask1;
/* Mask V5A_DS3_PG from PMIC PGMASK1. */
- if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x18, &pgmask1))
+ if (i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ 0x18, &pgmask1))
return;
pgmask1 |= BIT(2);
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x18, pgmask1);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x18, pgmask1);
board_pmic_disable_slp_s0_vr_decay();
/* Enable active discharge (100 ohms) on V33A_PCH and V1.8A. */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x3D, 0x5);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3D, 0x5);
}
DECLARE_HOOK(HOOK_INIT, board_pmic_init, HOOK_PRIO_DEFAULT);
@@ -631,7 +633,7 @@ static void board_report_pmic_fault(const char *str)
uint32_t info;
/* RESETIRQ1 -- Bit 4: VRFAULT */
- if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x8, &vrfault)
+ if (i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x8, &vrfault)
!= EC_SUCCESS)
return;
@@ -641,19 +643,19 @@ static void board_report_pmic_fault(const char *str)
/* VRFAULT has occurred, print VRFAULT status bits. */
/* PWRSTAT1 */
- i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x16, &pwrstat1);
+ i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x16, &pwrstat1);
/* PWRSTAT2 */
- i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x17, &pwrstat2);
+ i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x17, &pwrstat2);
CPRINTS("PMIC VRFAULT: %s", str);
CPRINTS("PMIC VRFAULT: PWRSTAT1=0x%02x PWRSTAT2=0x%02x", pwrstat1,
pwrstat2);
/* Clear all faults -- Write 1 to clear. */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x8, BIT(4));
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x16, pwrstat1);
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x17, pwrstat2);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x8, BIT(4));
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x16, pwrstat1);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x17, pwrstat2);
/*
* Status of the fault registers can be checked in the OS by looking at
diff --git a/board/nocturne/board.h b/board/nocturne/board.h
index c1eec1d179..d678f70a3e 100644
--- a/board/nocturne/board.h
+++ b/board/nocturne/board.h
@@ -93,7 +93,7 @@
#define CONFIG_ALS
#define ALS_COUNT 1
#define CONFIG_ALS_OPT3001
-#define OPT3001_I2C_ADDR OPT3001_I2C_ADDR1
+#define OPT3001_I2C_ADDR__7bf OPT3001_I2C_ADDR1__7bf
#define CONFIG_ACCEL_FIFO 512 /* Must be a power of 2 */
/* Depends on how fast the AP boots and typical ODRs */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO / 3)
@@ -175,8 +175,8 @@
#define GPIO_USB_C1_SCL GPIO_EC_I2C2_USB_C1_SCL
#define GPIO_USB_C1_SDA GPIO_EC_I2C2_USB_C1_SDA
-#define I2C_ADDR_MP2949 0x40
-#define I2C_ADDR_BD99992 0x60
+#define I2C_ADDR_MP2949__7bf 0x20
+#define I2C_ADDR_BD99992__7bf 0x30
/*
* Remapping of schematic GPIO names to common GPIO names expected (hardcoded)
diff --git a/board/nucleo-f411re/board.c b/board/nucleo-f411re/board.c
index 0f7c57f1e3..d2f587321f 100644
--- a/board/nucleo-f411re/board.c
+++ b/board/nucleo-f411re/board.c
@@ -75,7 +75,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = NULL,
.default_range = 2, /* g, enough for laptop. */
.config = {
@@ -102,7 +102,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = 1000, /* dps */
.rot_standard_ref = NULL,
},
diff --git a/board/oak/battery.c b/board/oak/battery.c
index a868e20bc0..25d6b6e46d 100644
--- a/board/oak/battery.c
+++ b/board/oak/battery.c
@@ -57,10 +57,10 @@ static int cutoff(void)
buf[2] = PARAM_CUT_OFF_HIGH;
i2c_lock(I2C_PORT_BATTERY, 1);
- rv = i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR, buf, 3, NULL, 0,
- I2C_XFER_SINGLE);
- rv |= i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR, buf, 3, NULL, 0,
- I2C_XFER_SINGLE);
+ rv = i2c_xfer_unlocked__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ buf, 3, NULL, 0, I2C_XFER_SINGLE);
+ rv |= i2c_xfer_unlocked__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ buf, 3, NULL, 0, I2C_XFER_SINGLE);
i2c_lock(I2C_PORT_BATTERY, 0);
return rv;
diff --git a/board/oak/board.c b/board/oak/board.c
index 4e7d317a4b..2f0046fac6 100644
--- a/board/oak/board.c
+++ b/board/oak/board.c
@@ -117,7 +117,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC,
- .addr = CONFIG_TCPC_I2C_BASE_ADDR,
+ .addr__7bf = CONFIG_TCPC_I2C_BASE_ADDR__7BF,
},
.drv = &tcpci_tcpm_drv,
},
@@ -125,7 +125,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC,
- .addr = CONFIG_TCPC_I2C_BASE_ADDR + 2,
+ .addr__7bf = CONFIG_TCPC_I2C_BASE_ADDR__7BF + 1,
},
.drv = &tcpci_tcpm_drv,
},
@@ -176,17 +176,17 @@ BUILD_ASSERT(ARRAY_SIZE(als) == ALS_COUNT);
struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
{
- .port_addr = 0x54 << 1,
+ .port_addr = 0x54,
.driver = &pi3usb30532_usb_mux_driver,
},
#if (BOARD_REV <= OAK_REV4)
{
- .port_addr = 0x55 << 1,
+ .port_addr = 0x55,
.driver = &pi3usb30532_usb_mux_driver,
},
#else
{
- .port_addr = 0x20,
+ .port_addr = 0x10,
.driver = &ps874x_usb_mux_driver,
},
#endif
@@ -647,7 +647,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = 1,
+ .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(0),
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -671,7 +671,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = 1,
+ .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(0),
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -689,7 +689,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_ACCEL,
- .addr = KX022_ADDR1,
+ .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KX022_ACCEL_MIN_FREQ,
diff --git a/board/oak/board.h b/board/oak/board.h
index b8ebe7c8e6..bc1e71c98f 100644
--- a/board/oak/board.h
+++ b/board/oak/board.h
@@ -160,7 +160,7 @@
#define CONFIG_SPI_ACCEL_PORT 0 /* First SPI master port (SPI2) */
/* Ambient Light Sensor address */
-#define OPT3001_I2C_ADDR OPT3001_I2C_ADDR1
+#define OPT3001_I2C_ADDR__7bf OPT3001_I2C_ADDR1__7bf
/* Timer selection */
#define TIM_CLOCK32 2
diff --git a/board/pdeval-stm32f072/board.c b/board/pdeval-stm32f072/board.c
index 5a632ced06..e2e6bc63b6 100644
--- a/board/pdeval-stm32f072/board.c
+++ b/board/pdeval-stm32f072/board.c
@@ -4,8 +4,8 @@
*/
/* STM32F072-discovery board based USB PD evaluation configuration */
-#include "anx7447.h"
#include "common.h"
+#include "anx7447.h"
#include "ec_version.h"
#include "gpio.h"
#include "hooks.h"
@@ -62,7 +62,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC,
- .addr = AN7447_TCPC3_I2C_ADDR,
+ .addr__7bf = AN7447_TCPC3_I2C_ADDR__7bf,
},
.drv = &anx7447_tcpm_drv,
},
diff --git a/board/pdeval-stm32f072/usb_pd_policy.c b/board/pdeval-stm32f072/usb_pd_policy.c
index 86062725fe..283483d566 100644
--- a/board/pdeval-stm32f072/usb_pd_policy.c
+++ b/board/pdeval-stm32f072/usb_pd_policy.c
@@ -3,8 +3,8 @@
* found in the LICENSE file.
*/
-#include "anx7447.h"
#include "common.h"
+#include "anx7447.h"
#include "console.h"
#include "gpio.h"
#include "hooks.h"
diff --git a/board/phaser/board.c b/board/phaser/board.c
index 68d5bbd633..353eeed9e5 100644
--- a/board/phaser/board.c
+++ b/board/phaser/board.c
@@ -120,7 +120,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_lis2dh_data,
.port = I2C_PORT_SENSOR,
- .addr = LIS2DH_ADDR1,
+ .i2c_spi_addr__7bf = LIS2DH_ADDR1__7bf,
.rot_standard_ref = &standard_rot_ref,
/* We only use 2g because its resolution is only 8-bits */
.default_range = 2, /* g */
@@ -151,7 +151,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_BASE_SIXAXIS_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .addr = LSM6DSM_ADDR0,
+ .i2c_spi_addr__7bf = LSM6DSM_ADDR0__7bf,
.rot_standard_ref = &standard_rot_ref,
.default_range = 4, /* g */
.min_frequency = LSM6DSM_ODR_MIN_VAL,
@@ -183,7 +183,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_BASE_SIXAXIS_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .addr = LSM6DSM_ADDR0,
+ .i2c_spi_addr__7bf = LSM6DSM_ADDR0__7bf,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
.rot_standard_ref = &standard_rot_ref,
.min_frequency = LSM6DSM_ODR_MIN_VAL,
diff --git a/board/plankton/board.c b/board/plankton/board.c
index 925a036c7f..886e8776ef 100644
--- a/board/plankton/board.c
+++ b/board/plankton/board.c
@@ -467,7 +467,7 @@ const struct i2c_port_t i2c_ports[] = {
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* 8-bit address */
-#define SN75DP130_I2C_ADDR 0x5c
+#define SN75DP130_I2C_ADDR__7bf 0x2e
/*
* Pin number for active-high reset from PCA9534 to CMOS pull-down to
* SN75DP130's RSTN (active-low)
@@ -476,7 +476,8 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
static int sn75dp130_i2c_write(uint8_t index, uint8_t value)
{
- return i2c_write8(I2C_PORT_MASTER, SN75DP130_I2C_ADDR, index, value);
+ return i2c_write8__7bf(I2C_PORT_MASTER, SN75DP130_I2C_ADDR__7bf,
+ index, value);
}
/**
@@ -489,15 +490,17 @@ static int sn75dp130_reset(void)
{
int rv;
- rv = pca9534_config_pin(I2C_PORT_MASTER, 0x40, REDRIVER_RST_PIN,
- PCA9534_OUTPUT);
+ rv = pca9534_config_pin__7bf(I2C_PORT_MASTER, 0x20,
+ REDRIVER_RST_PIN, PCA9534_OUTPUT);
/* Assert (its active high) */
- rv |= pca9534_set_level(I2C_PORT_MASTER, 0x40, REDRIVER_RST_PIN, 1);
+ rv |= pca9534_set_level__7bf(I2C_PORT_MASTER, 0x20,
+ REDRIVER_RST_PIN, 1);
/* datasheet recommends > 100usec */
usleep(200);
/* De-assert */
- rv |= pca9534_set_level(I2C_PORT_MASTER, 0x40, REDRIVER_RST_PIN, 0);
+ rv |= pca9534_set_level__7bf(I2C_PORT_MASTER, 0x20,
+ REDRIVER_RST_PIN, 0);
/* datasheet recommends > 400msec */
usleep(450 * MSEC);
return rv;
@@ -593,10 +596,12 @@ int board_in_hub_mode(void)
int ret;
int level;
- ret = pca9534_config_pin(I2C_PORT_MASTER, 0x40, 6, PCA9534_INPUT);
+ ret = pca9534_config_pin__7bf(I2C_PORT_MASTER, 0x20,
+ 6, PCA9534_INPUT);
if (ret)
return -1;
- ret = pca9534_get_level(I2C_PORT_MASTER, 0x40, 6, &level);
+ ret = pca9534_get_level__7bf(I2C_PORT_MASTER, 0x20,
+ 6, &level);
if (ret)
return -1;
return level;
@@ -606,14 +611,17 @@ static int board_usb_hub_reset(void)
{
int ret;
- ret = pca9534_config_pin(I2C_PORT_MASTER, 0x40, 7, PCA9534_OUTPUT);
+ ret = pca9534_config_pin__7bf(I2C_PORT_MASTER, 0x20,
+ 7, PCA9534_OUTPUT);
if (ret)
return ret;
- ret = pca9534_set_level(I2C_PORT_MASTER, 0x40, 7, 0);
+ ret = pca9534_set_level__7bf(I2C_PORT_MASTER, 0x20,
+ 7, 0);
if (ret)
return ret;
usleep(100 * MSEC);
- return pca9534_set_level(I2C_PORT_MASTER, 0x40, 7, 1);
+ return pca9534_set_level__7bf(I2C_PORT_MASTER, 0x20,
+ 7, 1);
}
void board_maybe_reset_usb_hub(void)
diff --git a/board/poppy/board.c b/board/poppy/board.c
index cc26a6206d..90e56b6fa8 100644
--- a/board/poppy/board.c
+++ b/board/poppy/board.c
@@ -193,7 +193,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_0,
- .addr = ANX74XX_I2C_ADDR1,
+ .addr__7bf = ANX74XX_I2C_ADDR1__7bf,
},
.drv = &anx74xx_tcpm_drv,
},
@@ -201,7 +201,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_0,
- .addr = PS8751_I2C_ADDR1,
+ .addr__7bf = PS8751_I2C_ADDR1__7bf,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -291,7 +291,7 @@ void board_tcpc_init(void)
*
* NOTE: PS8751 A3 will wake on any I2C access.
*/
- i2c_read8(NPCX_I2C_PORT0_1, 0x10, 0xA0, &reg);
+ i2c_read8__7bf(NPCX_I2C_PORT0_1, 0x08, 0xA0, &reg);
/* Enable TCPC interrupts */
gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL);
@@ -358,7 +358,7 @@ static void board_report_pmic_fault(const char *str)
uint32_t info;
/* RESETIRQ1 -- Bit 4: VRFAULT */
- if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x8, &vrfault)
+ if (i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x8, &vrfault)
!= EC_SUCCESS)
return;
@@ -368,19 +368,19 @@ static void board_report_pmic_fault(const char *str)
/* VRFAULT has occurred, print VRFAULT status bits. */
/* PWRSTAT1 */
- i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x16, &pwrstat1);
+ i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x16, &pwrstat1);
/* PWRSTAT2 */
- i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x17, &pwrstat2);
+ i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x17, &pwrstat2);
CPRINTS("PMIC VRFAULT: %s", str);
CPRINTS("PMIC VRFAULT: PWRSTAT1=0x%02x PWRSTAT2=0x%02x", pwrstat1,
pwrstat2);
/* Clear all faults -- Write 1 to clear. */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x8, BIT(4));
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x16, pwrstat1);
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x17, pwrstat2);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x8, BIT(4));
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x16, pwrstat1);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x17, pwrstat2);
/*
* Status of the fault registers can be checked in the OS by looking at
@@ -399,7 +399,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x30, 0x3a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x3a);
/*
* V18ACNT:
@@ -408,7 +408,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x34, 0x2a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x34, 0x2a);
/*
* V100ACNT:
@@ -417,7 +417,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x37, 0x1a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x37, 0x1a);
/*
* V085ACNT:
@@ -426,7 +426,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x38, 0x3a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x3a);
}
static void board_pmic_enable_slp_s0_vr_decay(void)
@@ -438,7 +438,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x30, 0x7a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x7a);
/*
* V18ACNT:
@@ -447,7 +447,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x34, 0x6a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x34, 0x6a);
/*
* V100ACNT:
@@ -456,7 +456,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x37, 0x5a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x37, 0x5a);
/*
* V085ACNT:
@@ -465,7 +465,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x38, 0x7a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x7a);
}
void power_board_handle_host_sleep_event(enum host_sleep_event state)
@@ -484,15 +484,15 @@ static void board_pmic_init(void)
return;
/* DISCHGCNT3 - enable 100 ohm discharge on V1.00A */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x3e, 0x04);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3e, 0x04);
board_pmic_disable_slp_s0_vr_decay();
/* VRMODECTRL - disable low-power mode for all rails */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x3b, 0x1f);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3b, 0x1f);
/* Disable power button shutdown timer. */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x14, 0x00);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x14, 0x00);
}
DECLARE_DEFERRED(board_pmic_init);
@@ -652,23 +652,24 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
void board_hibernate(void)
{
- CPRINTS("Triggering PMIC shutdown.");
- uart_flush_output();
-
- /* Trigger PMIC shutdown. */
- if (i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x49, 0x01)) {
- /*
- * If we can't tell the PMIC to shutdown, instead reset
- * and don't start the AP. Hopefully we'll be able to
- * communicate with the PMIC next time.
- */
- CPRINTS("PMIC i2c failed.");
- system_reset(SYSTEM_RESET_LEAVE_AP_OFF);
- }
-
- /* Await shutdown. */
- while (1)
- ;
+ CPRINTS("Triggering PMIC shutdown.");
+ uart_flush_output();
+
+ /* Trigger PMIC shutdown. */
+ if (i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ 0x49, 0x01)) {
+ /*
+ * If we can't tell the PMIC to shutdown, instead reset
+ * and don't start the AP. Hopefully we'll be able to
+ * communicate with the PMIC next time.
+ */
+ CPRINTS("PMIC i2c failed.");
+ system_reset(SYSTEM_RESET_LEAVE_AP_OFF);
+ }
+
+ /* Await shutdown. */
+ while (1)
+ ;
}
int board_get_version(void)
@@ -750,7 +751,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = &lid_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -774,7 +775,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = 1000, /* dps */
.rot_standard_ref = &lid_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -791,7 +792,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = BIT(11), /* 16LSB / uT, fixed */
.rot_standard_ref = &mag_standard_ref,
.min_frequency = BMM150_MAG_MIN_FREQ,
@@ -806,7 +807,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &opt3001_drv,
.drv_data = &g_opt3001_data,
.port = I2C_PORT_ALS,
- .addr = OPT3001_I2C_ADDR,
+ .i2c_spi_addr__7bf = OPT3001_I2C_ADDR__7bf,
.rot_standard_ref = NULL,
.default_range = 0x10000, /* scale = 1; uscale = 0 */
.min_frequency = OPT3001_LIGHT_MIN_FREQ,
diff --git a/board/poppy/board.h b/board/poppy/board.h
index 39e0f1796f..fc8a7c255c 100644
--- a/board/poppy/board.h
+++ b/board/poppy/board.h
@@ -115,7 +115,7 @@
#define CONFIG_ALS
#define CONFIG_ALS_OPT3001
#define ALS_COUNT 1
-#define OPT3001_I2C_ADDR OPT3001_I2C_ADDR1
+#define OPT3001_I2C_ADDR__7bf OPT3001_I2C_ADDR1__7bf
#define CONFIG_TEMP_SENSOR
#define CONFIG_TEMP_SENSOR_BD99992GW
#define CONFIG_THERMISTOR_NCP15WB
@@ -128,7 +128,7 @@
#define CONFIG_ACCEL_INTERRUPTS
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL)
-#define CONFIG_ACCELGYRO_SEC_ADDR BMM150_ADDR0 /* 8-bit address */
+#define CONFIG_ACCELGYRO_SEC_ADDR__7BF BMM150_ADDR0__7bf
#define CONFIG_MAG_CALIBRATE
/* Lower maximal ODR to 100Hz */
#define CONFIG_EC_MAX_SENSOR_FREQ_MILLIHZ 100000
@@ -192,8 +192,8 @@
#define I2C_PORT_THERMAL I2C_PORT_PMIC
/* I2C addresses */
-#define I2C_ADDR_BD99992 0x60
-#define I2C_ADDR_MP2949 0x40
+#define I2C_ADDR_BD99992__7bf 0x30
+#define I2C_ADDR_MP2949__7bf 0x20
#ifndef __ASSEMBLER__
diff --git a/board/rainier/board.c b/board/rainier/board.c
index 890aa8be80..8173414bf7 100644
--- a/board/rainier/board.c
+++ b/board/rainier/board.c
@@ -131,7 +131,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr = FUSB302_I2C_SLAVE_ADDR,
+ .addr__7bf = FUSB302_I2C_SLAVE_ADDR__7bf,
},
.drv = &fusb302_tcpm_drv,
},
@@ -377,7 +377,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = CONFIG_SPI_ACCEL_PORT,
- .addr = BMI160_SET_SPI_ADDRESS(CONFIG_SPI_ACCEL_PORT),
+ .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(CONFIG_SPI_ACCEL_PORT),
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -400,7 +400,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = CONFIG_SPI_ACCEL_PORT,
- .addr = BMI160_SET_SPI_ADDRESS(CONFIG_SPI_ACCEL_PORT),
+ .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(CONFIG_SPI_ACCEL_PORT),
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -422,7 +422,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &bmp280_drv,
.drv_data = &bmp280_drv_data,
.port = CONFIG_SPI_ACCEL_PORT,
- .addr = BMI160_SET_SPI_ADDRESS(CONFIG_SPI_ACCEL_PORT),
+ .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(CONFIG_SPI_ACCEL_PORT),
.default_range = BIT(18), /* 1bit = 4 Pa, 16bit ~= 2600 hPa */
.min_frequency = BMP280_BARO_MIN_FREQ,
.max_frequency = BMP280_BARO_MAX_FREQ,
diff --git a/board/rammus/board.c b/board/rammus/board.c
index 1596407718..82af7a2667 100644
--- a/board/rammus/board.c
+++ b/board/rammus/board.c
@@ -151,7 +151,7 @@ struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC1,
- .addr = PS8751_I2C_ADDR1,
+ .addr__7bf = PS8751_I2C_ADDR1__7bf,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -159,7 +159,8 @@ struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr = AN7447_TCPC3_I2C_ADDR, /* Verified on v1.1 */
+ /* Verified on v1.1 */
+ .addr__7bf = AN7447_TCPC3_I2C_ADDR__7bf,
},
.drv = &anx7447_tcpm_drv,
},
@@ -297,7 +298,7 @@ static void board_report_pmic_fault(const char *str)
uint32_t info;
/* RESETIRQ1 -- Bit 4: VRFAULT */
- if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x8, &vrfault)
+ if (i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x8, &vrfault)
!= EC_SUCCESS)
return;
@@ -307,19 +308,19 @@ static void board_report_pmic_fault(const char *str)
/* VRFAULT has occurred, print VRFAULT status bits. */
/* PWRSTAT1 */
- i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x16, &pwrstat1);
+ i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x16, &pwrstat1);
/* PWRSTAT2 */
- i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x17, &pwrstat2);
+ i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x17, &pwrstat2);
CPRINTS("PMIC VRFAULT: %s", str);
CPRINTS("PMIC VRFAULT: PWRSTAT1=0x%02x PWRSTAT2=0x%02x", pwrstat1,
pwrstat2);
/* Clear all faults -- Write 1 to clear. */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x8, BIT(4));
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x16, pwrstat1);
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x17, pwrstat2);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x8, BIT(4));
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x16, pwrstat1);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x17, pwrstat2);
/*
* Status of the fault registers can be checked in the OS by looking at
@@ -338,7 +339,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x30, 0x3a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x3a);
/*
* V18ACNT:
@@ -347,7 +348,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x34, 0x2a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x34, 0x2a);
/*
* V085ACNT:
@@ -356,7 +357,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x38, 0x3a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x3a);
}
static void board_pmic_enable_slp_s0_vr_decay(void)
@@ -368,7 +369,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x30, 0x7a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x7a);
/*
* V18ACNT:
@@ -377,7 +378,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x34, 0x6a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x34, 0x6a);
/*
* V085ACNT:
@@ -386,7 +387,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x38, 0x7a);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x7a);
}
void power_board_handle_host_sleep_event(enum host_sleep_event state)
@@ -408,16 +409,16 @@ static void board_pmic_init(void)
* DISCHGCNT2 - enable 100 ohm discharge on
* V5A_DS3/V33A_DSW/V33A_PCH/V1.8A
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x3d, 0x55);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3d, 0x55);
/* DISCHGCNT3 - enable 100 ohm discharge on V1.8U_25U/V1.00A */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x3e, 0x44);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3e, 0x44);
/* DISCHGCNT4 - enable 100 ohm discharge on v1.8S */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x3f, 0x04);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3f, 0x04);
board_pmic_disable_slp_s0_vr_decay();
/* VRMODECTRL - disable low-power mode for all rails */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x3b, 0x1f);
+ i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3b, 0x1f);
}
DECLARE_DEFERRED(board_pmic_init);
@@ -543,7 +544,7 @@ void board_hibernate(void)
uart_flush_output();
/* Trigger PMIC shutdown. */
- if (i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x49, 0x01)) {
+ if (i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x49, 0x01)) {
/*
* If we can't tell the PMIC to shutdown, instead reset
* and don't start the AP. Hopefully we'll be able to
@@ -601,7 +602,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bma255_data,
.port = I2C_PORT_ACCEL,
- .addr = BMA2x2_I2C_ADDR1,
+ .i2c_spi_addr__7bf = BMA2x2_I2C_ADDR1__7bf,
.rot_standard_ref = &lid_standard_ref,
.min_frequency = BMA255_ACCEL_MIN_FREQ,
.max_frequency = BMA255_ACCEL_MAX_FREQ,
@@ -629,7 +630,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_ACCEL_MIN_FREQ,
.max_frequency = BMI160_ACCEL_MAX_FREQ,
@@ -657,7 +658,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
diff --git a/board/rammus/board.h b/board/rammus/board.h
index 8c36ca46b9..5d577be79d 100644
--- a/board/rammus/board.h
+++ b/board/rammus/board.h
@@ -187,9 +187,9 @@
#define I2C_PORT_THERMAL I2C_PORT_PMIC
/* I2C addresses */
-#define I2C_ADDR_BD99992 0x60
-#define I2C_ADDR_MP2949 0x40
-#define I2C_ADDR_EEPROM 0xa0
+#define I2C_ADDR_BD99992__7bf 0x30
+#define I2C_ADDR_MP2949__7bf 0x20
+#define I2C_ADDR_EEPROM__7bf 0x50
/* Rename GPIOs */
#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
diff --git a/board/reef/board.c b/board/reef/board.c
index 2189146e34..ea9e8e9e43 100644
--- a/board/reef/board.c
+++ b/board/reef/board.c
@@ -167,7 +167,7 @@ struct i2c_stress_test i2c_stress_tests[] = {
#ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC
{
.port = NPCX_I2C_PORT0_0,
- .addr = ANX74XX_I2C_ADDR1,
+ .addr__7bf = ANX74XX_I2C_ADDR1__7bf,
.i2c_test = &anx74xx_i2c_stress_test_dev,
},
#endif
@@ -176,7 +176,7 @@ struct i2c_stress_test i2c_stress_tests[] = {
#ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC
{
.port = NPCX_I2C_PORT0_1,
- .addr = PS8751_I2C_ADDR1,
+ .addr__7bf = PS8751_I2C_ADDR1__7bf,
.i2c_test = &ps8xxx_i2c_stress_test_dev,
},
#endif
@@ -185,7 +185,7 @@ struct i2c_stress_test i2c_stress_tests[] = {
#ifdef CONFIG_CMD_I2C_STRESS_TEST_ACCEL
{
.port = I2C_PORT_GYRO,
- .addr = BMI160_ADDR0,
+ .addr__7bf = BMI160_ADDR0__7bf,
.i2c_test = &bmi160_i2c_stress_test_dev,
},
#endif
@@ -194,19 +194,19 @@ struct i2c_stress_test i2c_stress_tests[] = {
#ifdef CONFIG_CMD_I2C_STRESS_TEST_ACCEL
{
.port = I2C_PORT_BARO,
- .addr = BMP280_I2C_ADDRESS1,
+ .addr__7bf = BMP280_I2C_ADDRESS1__7bf,
.i2c_test = &bmp280_i2c_stress_test_dev,
},
{
.port = I2C_PORT_LID_ACCEL,
- .addr = KX022_ADDR1,
+ .addr__7bf = KX022_ADDR1__7bf,
.i2c_test = &kionix_i2c_stress_test_dev,
},
#endif
#ifdef CONFIG_CMD_I2C_STRESS_TEST_ALS
{
.port = I2C_PORT_ALS,
- .addr = OPT3001_I2C_ADDR1,
+ .addr__7bf = OPT3001_I2C_ADDR1__7bf,
.i2c_test = &opt3001_i2c_stress_test_dev,
},
#endif
@@ -231,7 +231,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_0,
- .addr = ANX74XX_I2C_ADDR1,
+ .addr__7bf = ANX74XX_I2C_ADDR1__7bf,
},
.drv = &anx74xx_tcpm_drv,
},
@@ -239,7 +239,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_1,
- .addr = PS8751_I2C_ADDR1,
+ .addr__7bf = PS8751_I2C_ADDR1__7bf,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -367,7 +367,7 @@ void board_tcpc_init(void)
*
* NOTE: PS8751 A3 will wake on any I2C access.
*/
- i2c_read8(NPCX_I2C_PORT0_1, 0x10, 0xA0, &reg);
+ i2c_read8__7bf(NPCX_I2C_PORT0_1, 0x08, 0xA0, &reg);
/* Enable TCPC0 interrupt */
gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL);
@@ -715,7 +715,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_LID_ACCEL,
- .addr = KX022_ADDR1,
+ .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KX022_ACCEL_MIN_FREQ,
@@ -742,7 +742,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -771,7 +771,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -787,7 +787,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = BIT(11), /* 16LSB / uT, fixed */
.rot_standard_ref = &mag_standard_ref,
.min_frequency = BMM150_MAG_MIN_FREQ,
@@ -802,7 +802,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &bmp280_drv,
.drv_data = &bmp280_drv_data,
.port = I2C_PORT_BARO,
- .addr = BMP280_I2C_ADDRESS1,
+ .i2c_spi_addr__7bf = BMP280_I2C_ADDRESS1__7bf,
.default_range = BIT(18), /* 1bit = 4 Pa, 16bit ~= 2600 hPa */
.min_frequency = BMP280_BARO_MIN_FREQ,
.max_frequency = BMP280_BARO_MAX_FREQ,
@@ -816,7 +816,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &opt3001_drv,
.drv_data = &g_opt3001_data,
.port = I2C_PORT_ALS,
- .addr = OPT3001_I2C_ADDR1,
+ .i2c_spi_addr__7bf = OPT3001_I2C_ADDR1__7bf,
.rot_standard_ref = NULL,
.default_range = 0x10000, /* scale = 1; uscale = 0 */
.min_frequency = OPT3001_LIGHT_MIN_FREQ,
diff --git a/board/reef/board.h b/board/reef/board.h
index 5dd0a3bf06..245ccaf7e4 100644
--- a/board/reef/board.h
+++ b/board/reef/board.h
@@ -196,7 +196,7 @@
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_MAG_BMI160_BMM150
-#define CONFIG_ACCELGYRO_SEC_ADDR BMM150_ADDR0 /* 8-bit address */
+#define CONFIG_ACCELGYRO_SEC_ADDR__7BF BMM150_ADDR0__7bf
#define CONFIG_MAG_CALIBRATE
#define CONFIG_ACCEL_KX022
#define CONFIG_ALS_OPT3001
diff --git a/board/reef_it8320/board.c b/board/reef_it8320/board.c
index 6174e7e24b..82c094095c 100644
--- a/board/reef_it8320/board.c
+++ b/board/reef_it8320/board.c
@@ -161,12 +161,12 @@ static void it83xx_tcpc_update_hpd_status(int port, int hpd_lvl, int hpd_irq)
struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
{
- .port_addr = 0xa8,
+ .port_addr = 0x54,
.driver = &pi3usb30532_usb_mux_driver,
.hpd_update = &it83xx_tcpc_update_hpd_status,
},
{
- .port_addr = 0x20,
+ .port_addr = 0x10,
.driver = &ps874x_usb_mux_driver,
.hpd_update = &it83xx_tcpc_update_hpd_status,
},
diff --git a/board/reef_mchp/board.c b/board/reef_mchp/board.c
index b66b5eaa27..206d6dd1d0 100644
--- a/board/reef_mchp/board.c
+++ b/board/reef_mchp/board.c
@@ -283,7 +283,7 @@ struct i2c_stress_test i2c_stress_tests[] = {
#ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC
{
.port = MCHP_I2C_PORT0,
- .addr = 0x50,
+ .addr__7bf = 0x28,
.i2c_test = &anx74xx_i2c_stress_test_dev,
},
#endif
@@ -291,33 +291,33 @@ struct i2c_stress_test i2c_stress_tests[] = {
#ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC
{
.port = MCHP_I2C_PORT2,
- .addr = 0x16,
+ .addr__7bf = 0x0B,
.i2c_test = &ps8xxx_i2c_stress_test_dev,
},
#endif
#ifdef CONFIG_CMD_I2C_STRESS_TEST_ACCEL
{
.port = I2C_PORT_GYRO,
- .addr = BMI160_ADDR0,
+ .addr__7bf = BMI160_ADDR0__7bf,
.i2c_test = &bmi160_i2c_stress_test_dev,
},
#endif
#ifdef CONFIG_CMD_I2C_STRESS_TEST_ACCEL
{
.port = I2C_PORT_BARO,
- .addr = BMP280_I2C_ADDRESS1,
+ .addr__7bf = BMP280_I2C_ADDRESS1__7bf,
.i2c_test = &bmp280_i2c_stress_test_dev,
},
{
.port = I2C_PORT_LID_ACCEL,
- .addr = KX022_ADDR1,
+ .addr__7bf = KX022_ADDR1__7bf,
.i2c_test = &kionix_i2c_stress_test_dev,
},
#endif
#ifdef CONFIG_CMD_I2C_STRESS_TEST_ALS
{
.port = I2C_PORT_ALS,
- .addr = OPT3001_I2C_ADDR1,
+ .addr__7bf = OPT3001_I2C_ADDR1__7bf,
.i2c_test = &opt3001_i2c_stress_test_dev,
},
#endif
@@ -342,7 +342,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = MCHP_I2C_PORT0,
- .addr = 0x50,
+ .addr__7bf = 0x28,
},
.drv = &anx74xx_tcpm_drv,
},
@@ -350,7 +350,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = MCHP_I2C_PORT2,
- .addr = 0x16,
+ .addr__7bf = 0x0B,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -513,7 +513,7 @@ void board_tcpc_init(void)
* address 0x10. Is this another attempt at waking PS8751
* from DRP low power idle mode?
*/
- i2c_read8(MCHP_I2C_PORT2, 0x10, 0xA0, &reg);
+ i2c_read8__7bf(MCHP_I2C_PORT2, 0x08, 0xA0, &reg);
/* Enable TCPC0 interrupt */
gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL);
@@ -961,7 +961,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_LID_ACCEL,
- .addr = KX022_ADDR1,
+ .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KX022_ACCEL_MIN_FREQ,
@@ -988,7 +988,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -1017,7 +1017,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -1033,7 +1033,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .addr = BMI160_ADDR0,
+ .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
.default_range = BIT(11), /* 16LSB / uT, fixed */
.rot_standard_ref = &mag_standard_ref,
.min_frequency = BMM150_MAG_MIN_FREQ,
@@ -1048,7 +1048,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &bmp280_drv,
.drv_data = &bmp280_drv_data,
.port = I2C_PORT_BARO,
- .addr = BMP280_I2C_ADDRESS1,
+ .i2c_spi_addr__7bf = BMP280_I2C_ADDRESS1__7bf,
.default_range = BIT(18), /* 1bit = 4 Pa, 16bit ~= 2600 hPa */
.min_frequency = BMP280_BARO_MIN_FREQ,
.max_frequency = BMP280_BARO_MAX_FREQ,
@@ -1062,7 +1062,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &opt3001_drv,
.drv_data = &g_opt3001_data,
.port = I2C_PORT_ALS,
- .addr = OPT3001_I2C_ADDR1,
+ .i2c_spi_addr__7bf = OPT3001_I2C_ADDR1__7bf,
.rot_standard_ref = NULL,
.default_range = 0x10000, /* scale = 1; uscale = 0 */
.min_frequency = OPT3001_LIGHT_MIN_FREQ,
diff --git a/board/reef_mchp/board.h b/board/reef_mchp/board.h
index dabdabb587..7c4189e4b5 100644
--- a/board/reef_mchp/board.h
+++ b/board/reef_mchp/board.h
@@ -203,7 +203,7 @@
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_MAG_BMI160_BMM150
-#define CONFIG_ACCELGYRO_SEC_ADDR BMM150_ADDR0 /* 8-bit address */
+#define CONFIG_ACCELGYRO_SEC_ADDR__7BF BMM150_ADDR0__7bf
#define CONFIG_MAG_CALIBRATE
#define CONFIG_ACCEL_KX022
#define CONFIG_ALS_OPT3001
diff --git a/board/samus/battery.c b/board/samus/battery.c
index dcbd4f0964..e21f51e3b5 100644
--- a/board/samus/battery.c
+++ b/board/samus/battery.c
@@ -290,10 +290,10 @@ int board_cut_off_battery(void)
buf[2] = PARAM_CUT_OFF_HIGH;
i2c_lock(I2C_PORT_BATTERY, 1);
- rv = i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR, buf, 3, NULL, 0,
- I2C_XFER_SINGLE);
- rv |= i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR, buf, 3, NULL, 0,
- I2C_XFER_SINGLE);
+ rv = i2c_xfer_unlocked__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ buf, 3, NULL, 0, I2C_XFER_SINGLE);
+ rv |= i2c_xfer_unlocked__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ buf, 3, NULL, 0, I2C_XFER_SINGLE);
i2c_lock(I2C_PORT_BATTERY, 0);
return rv;
diff --git a/board/samus/board.c b/board/samus/board.c
index 2804799994..323789a7a3 100644
--- a/board/samus/board.c
+++ b/board/samus/board.c
@@ -132,29 +132,35 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-#define TEMP_U40_REG_ADDR ((0x40 << 1) | I2C_FLAG_BIG_ENDIAN)
-#define TEMP_U41_REG_ADDR ((0x44 << 1) | I2C_FLAG_BIG_ENDIAN)
-#define TEMP_U42_REG_ADDR ((0x41 << 1) | I2C_FLAG_BIG_ENDIAN)
-#define TEMP_U43_REG_ADDR ((0x45 << 1) | I2C_FLAG_BIG_ENDIAN)
-#define TEMP_U115_REG_ADDR ((0x42 << 1) | I2C_FLAG_BIG_ENDIAN)
-#define TEMP_U116_REG_ADDR ((0x43 << 1) | I2C_FLAG_BIG_ENDIAN)
-
-#define TEMP_U40_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_U40_REG_ADDR)
-#define TEMP_U41_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_U41_REG_ADDR)
-#define TEMP_U42_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_U42_REG_ADDR)
-#define TEMP_U43_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_U43_REG_ADDR)
-#define TEMP_U115_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_U115_REG_ADDR)
-#define TEMP_U116_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_U116_REG_ADDR)
-
-const struct tmp006_t tmp006_sensors[TMP006_COUNT] = {
- {"Charger", TEMP_U40_ADDR},
- {"CPU", TEMP_U41_ADDR},
- {"Left C", TEMP_U42_ADDR},
- {"Right C", TEMP_U43_ADDR},
- {"Right D", TEMP_U115_ADDR},
- {"Left D", TEMP_U116_ADDR},
+#define TEMP_U40_REG_ADDR__7bf (0x40 | I2C_FLAG_BIG_ENDIAN)
+#define TEMP_U41_REG_ADDR__7bf (0x44 | I2C_FLAG_BIG_ENDIAN)
+#define TEMP_U42_REG_ADDR__7bf (0x41 | I2C_FLAG_BIG_ENDIAN)
+#define TEMP_U43_REG_ADDR__7bf (0x45 | I2C_FLAG_BIG_ENDIAN)
+#define TEMP_U115_REG_ADDR__7bf (0x42 | I2C_FLAG_BIG_ENDIAN)
+#define TEMP_U116_REG_ADDR__7bf (0x43 | I2C_FLAG_BIG_ENDIAN)
+
+#define TEMP_U40_ADDR__7bf TMP006_ADDR__7bf(I2C_PORT_THERMAL,\
+ TEMP_U40_REG_ADDR__7bf)
+#define TEMP_U41_ADDR__7bf TMP006_ADDR__7bf(I2C_PORT_THERMAL,\
+ TEMP_U41_REG_ADDR__7bf)
+#define TEMP_U42_ADDR__7bf TMP006_ADDR__7bf(I2C_PORT_THERMAL,\
+ TEMP_U42_REG_ADDR__7bf)
+#define TEMP_U43_ADDR__7bf TMP006_ADDR__7bf(I2C_PORT_THERMAL,\
+ TEMP_U43_REG_ADDR__7bf)
+#define TEMP_U115_ADDR__7bf TMP006_ADDR__7bf(I2C_PORT_THERMAL,\
+ TEMP_U115_REG_ADDR__7bf)
+#define TEMP_U116_ADDR__7bf TMP006_ADDR__7bf(I2C_PORT_THERMAL,\
+ TEMP_U116_REG_ADDR__7bf)
+
+const struct tmp006_t tmp006_sensors__7bf[TMP006_COUNT] = {
+ {"Charger", TEMP_U40_ADDR__7bf},
+ {"CPU", TEMP_U41_ADDR__7bf},
+ {"Left C", TEMP_U42_ADDR__7bf},
+ {"Right C", TEMP_U43_ADDR__7bf},
+ {"Right D", TEMP_U115_ADDR__7bf},
+ {"Left D", TEMP_U116_ADDR__7bf},
};
-BUILD_ASSERT(ARRAY_SIZE(tmp006_sensors) == TMP006_COUNT);
+BUILD_ASSERT(ARRAY_SIZE(tmp006_sensors__7bf) == TMP006_COUNT);
/* Temperature sensors data; must be in same order as enum temp_sensor_id. */
const struct temp_sensor_t temp_sensors[] = {
@@ -326,7 +332,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_saved_data[0],
.port = I2C_PORT_ACCEL,
- .addr = LSM6DS0_ADDR1,
+ .i2c_spi_addr__7bf = LSM6DS0_ADDR1__7bf,
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = LSM6DS0_ACCEL_MIN_FREQ,
@@ -358,7 +364,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kxcj9_data,
.port = I2C_PORT_ACCEL,
- .addr = KXCJ9_ADDR0,
+ .i2c_spi_addr__7bf = KXCJ9_ADDR0__7bf,
.rot_standard_ref = &lid_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KXCJ9_ACCEL_MIN_FREQ,
@@ -381,7 +387,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_saved_data[1],
.port = I2C_PORT_ACCEL,
- .addr = LSM6DS0_ADDR1,
+ .i2c_spi_addr__7bf = LSM6DS0_ADDR1__7bf,
.rot_standard_ref = NULL,
.default_range = 2000, /* g, enough for laptop. */
.min_frequency = LSM6DS0_GYRO_MIN_FREQ,
diff --git a/board/samus/extpower.c b/board/samus/extpower.c
index 9307463cbf..cddb4a76e1 100644
--- a/board/samus/extpower.c
+++ b/board/samus/extpower.c
@@ -159,7 +159,7 @@ static void allow_max_request(void)
int prochot_status;
if (charge_circuit_state == CHARGE_CIRCUIT_WEDGED) {
/* Read PROCHOT status register to clear it */
- i2c_read8(I2C_PORT_CHARGER, BQ24773_ADDR,
+ i2c_read8__7bf(I2C_PORT_CHARGER, BQ24773_ADDR__7bf,
BQ24773_PROCHOT_STATUS, &prochot_status);
charge_circuit_state = CHARGE_CIRCUIT_OK;
}
@@ -301,7 +301,7 @@ static void check_charge_wedged(void)
if (charge_circuit_state == CHARGE_CIRCUIT_OK) {
/* Check PROCHOT warning */
- rv = i2c_read8(I2C_PORT_CHARGER, BQ24773_ADDR,
+ rv = i2c_read8__7bf(I2C_PORT_CHARGER, BQ24773_ADDR__7bf,
BQ24773_PROCHOT_STATUS, &prochot_status);
if (rv)
prochot_status = 0;
diff --git a/board/samus/panel.c b/board/samus/panel.c
index ccb43f1fcb..0c60b2a492 100644
--- a/board/samus/panel.c
+++ b/board/samus/panel.c
@@ -15,7 +15,7 @@
#define CPRINTS(format, args...) cprints(CC_I2C, format, ## args)
-#define I2C_ADDR_BACKLIGHT ((0x2C << 1) | I2C_FLAG_BIG_ENDIAN)
+#define I2C_ADDR_BACKLIGHT__7bf (0x2C | I2C_FLAG_BIG_ENDIAN)
#define I2C_RETRIES 3
#define I2C_RETRY_DELAY (5*MSEC)
@@ -61,7 +61,8 @@ static int lp8555_read_with_retry(int reg, int *data)
int i, rv;
for (i = 0; i < I2C_RETRIES; i++) {
- rv = i2c_read8(I2C_PORT_BACKLIGHT, I2C_ADDR_BACKLIGHT,
+ rv = i2c_read8__7bf(I2C_PORT_BACKLIGHT,
+ I2C_ADDR_BACKLIGHT__7bf,
reg, data);
if (rv == EC_SUCCESS)
return EC_SUCCESS;
@@ -78,8 +79,9 @@ static int lp8555_write_with_retry(int reg, int data)
int i, rv;
for (i = 0; i < I2C_RETRIES; i++) {
- rv = i2c_write8(I2C_PORT_BACKLIGHT, I2C_ADDR_BACKLIGHT,
- reg, data);
+ rv = i2c_write8__7bf(I2C_PORT_BACKLIGHT,
+ I2C_ADDR_BACKLIGHT__7bf,
+ reg, data);
if (rv == EC_SUCCESS)
return EC_SUCCESS;
usleep(I2C_RETRY_DELAY);
diff --git a/board/samus_pd/board.h b/board/samus_pd/board.h
index 649feb3fd3..032e0bf0f2 100644
--- a/board/samus_pd/board.h
+++ b/board/samus_pd/board.h
@@ -89,7 +89,7 @@
/* slave address for host commands */
#ifdef HAS_TASK_HOSTCMD
-#define CONFIG_HOSTCMD_I2C_SLAVE_ADDR CONFIG_USB_PD_I2C_SLAVE_ADDR
+#define CONFIG_HOSTCMD_I2C_SLAVE_ADDR__7BF CONFIG_USB_PD_I2C_SLAVE_ADDR__7BF
#endif
#ifndef __ASSEMBLER__
diff --git a/board/scarlet/board.c b/board/scarlet/board.c
index 4e100b3ed7..061e2d62dc 100644
--- a/board/scarlet/board.c
+++ b/board/scarlet/board.c
@@ -127,7 +127,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr = FUSB302_I2C_SLAVE_ADDR,
+ .addr__7bf = FUSB302_I2C_SLAVE_ADDR__7bf,
},
.drv = &fusb302_tcpm_drv,
},
@@ -401,7 +401,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = CONFIG_SPI_ACCEL_PORT,
- .addr = BMI160_SET_SPI_ADDRESS(CONFIG_SPI_ACCEL_PORT),
+ .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(CONFIG_SPI_ACCEL_PORT),
.rot_standard_ref = &base_standard_ref,
.default_range = 4, /* g */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -424,7 +424,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = CONFIG_SPI_ACCEL_PORT,
- .addr = BMI160_SET_SPI_ADDRESS(CONFIG_SPI_ACCEL_PORT),
+ .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(CONFIG_SPI_ACCEL_PORT),
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
diff --git a/board/scarlet/board.h b/board/scarlet/board.h
index 5cd82e573c..a9bc49fdc9 100644
--- a/board/scarlet/board.h
+++ b/board/scarlet/board.h
@@ -174,7 +174,7 @@
#define I2C_PORT_TCPC0 1
/* Route sbs host requests to virtual battery driver */
-#define VIRTUAL_BATTERY_ADDR 0x16
+#define VIRTUAL_BATTERY_ADDR__7bf 0x0B
/* Enable Accel over SPI */
#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master port (SPI2) */
diff --git a/board/servo_micro/board.c b/board/servo_micro/board.c
index e717d6207b..b5384ba8ca 100644
--- a/board/servo_micro/board.c
+++ b/board/servo_micro/board.c
@@ -248,8 +248,8 @@ DECLARE_CONSOLE_COMMAND(baud, command_uart_baud,
* enable_ite_dfu stops working, or does not work on a new ITE EC chip revision.
*/
-#define ITE_DFU_I2C_CMD_ADDR 0xB4 /* 7 bit form is 0x5A */
-#define ITE_DFU_I2C_DATA_ADDR 0x6A /* 7 bit form is 0x35 */
+#define ITE_DFU_I2C_CMD_ADDR__7bf 0x5A
+#define ITE_DFU_I2C_DATA_ADDR__7bf 0x35
#define SMCLK_WAVEFORM_PERIOD_HZ (100 * KHz)
#define SMDAT_WAVEFORM_PERIOD_HZ (200 * KHz)
@@ -287,14 +287,17 @@ static int ite_i2c_read_register(uint8_t register_offset, uint8_t *output)
*/
int ret;
/* Tell the ITE EC which register we want to read. */
- ret = i2c_xfer_unlocked(I2C_PORT_MASTER, ITE_DFU_I2C_CMD_ADDR,
- &register_offset, sizeof(register_offset),
- NULL, 0, I2C_XFER_SINGLE);
+ ret = i2c_xfer_unlocked__7bf(I2C_PORT_MASTER,
+ ITE_DFU_I2C_CMD_ADDR__7bf,
+ &register_offset, sizeof(register_offset),
+ NULL, 0, I2C_XFER_SINGLE);
if (ret != EC_SUCCESS)
return ret;
/* Read in the 1 byte register value. */
- ret = i2c_xfer_unlocked(I2C_PORT_MASTER, ITE_DFU_I2C_DATA_ADDR, NULL, 0,
- output, sizeof(*output), I2C_XFER_SINGLE);
+ ret = i2c_xfer_unlocked__7bf(I2C_PORT_MASTER,
+ ITE_DFU_I2C_DATA_ADDR__7bf,
+ NULL, 0,
+ output, sizeof(*output), I2C_XFER_SINGLE);
return ret;
}
diff --git a/board/servo_v4/board.c b/board/servo_v4/board.c
index 405c90c7aa..b26d86abf6 100644
--- a/board/servo_v4/board.c
+++ b/board/servo_v4/board.c
@@ -211,7 +211,7 @@ int usb_i2c_board_is_enabled(void) { return 1; }
/*
* Support tca6416 I2C ioexpander.
*/
-#define GPIOX_I2C_ADDR 0x40
+#define GPIOX_I2C_ADDR__7bf 0x20
#define GPIOX_IN_PORT_A 0x0
#define GPIOX_IN_PORT_B 0x1
#define GPIOX_OUT_PORT_A 0x2
@@ -226,13 +226,13 @@ static void write_ioexpander(int bank, int gpio, int val)
int tmp;
/* Read output port register */
- i2c_read8(1, GPIOX_I2C_ADDR, GPIOX_OUT_PORT_A + bank, &tmp);
+ i2c_read8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_OUT_PORT_A + bank, &tmp);
if (val)
tmp |= BIT(gpio);
else
tmp &= ~BIT(gpio);
/* Write back modified output port register */
- i2c_write8(1, GPIOX_I2C_ADDR, GPIOX_OUT_PORT_A + bank, tmp);
+ i2c_write8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_OUT_PORT_A + bank, tmp);
}
/* Read a single GPIO input on the tca6416 I2C ioexpander. */
@@ -242,7 +242,7 @@ static int read_ioexpander_bit(int bank, int bit)
int mask = 1 << bit;
/* Read input port register */
- i2c_read8(1, GPIOX_I2C_ADDR, GPIOX_IN_PORT_A + bank, &tmp);
+ i2c_read8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_IN_PORT_A + bank, &tmp);
return (tmp & mask) >> bit;
}
@@ -271,15 +271,15 @@ static void init_usb3_port(void)
static void init_ioexpander(void)
{
/* Write all GPIO to output 0 */
- i2c_write8(1, GPIOX_I2C_ADDR, GPIOX_OUT_PORT_A, 0x0);
- i2c_write8(1, GPIOX_I2C_ADDR, GPIOX_OUT_PORT_B, 0x0);
+ i2c_write8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_OUT_PORT_A, 0x0);
+ i2c_write8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_OUT_PORT_B, 0x0);
/*
* Write GPIO direction: strap resistors to input,
* all others to output.
*/
- i2c_write8(1, GPIOX_I2C_ADDR, GPIOX_DIR_PORT_A, 0x0);
- i2c_write8(1, GPIOX_I2C_ADDR, GPIOX_DIR_PORT_B, 0x18);
+ i2c_write8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_DIR_PORT_A, 0x0);
+ i2c_write8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_DIR_PORT_B, 0x18);
}
/*
@@ -429,7 +429,7 @@ static void board_init(void)
* Write USB3 Mode to PS8742 USB/DP Mux.
* 0x0:disable 0x20:enable.
*/
- i2c_write8(1, 0x20, 0x0, 0x0);
+ i2c_write8__7bf(1, 0x10, 0x0, 0x0);
/* Enable uservo USB by default. */
init_ioexpander();
diff --git a/board/strago/board.c b/board/strago/board.c
index 45761a5a8a..8764c4a84b 100644
--- a/board/strago/board.c
+++ b/board/strago/board.c
@@ -110,7 +110,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC,
- .addr = CONFIG_TCPC_I2C_BASE_ADDR,
+ .addr__7bf = CONFIG_TCPC_I2C_BASE_ADDR__7BF,
},
.drv = &tcpci_tcpm_drv,
},
@@ -141,7 +141,7 @@ BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) ==
struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
{
- .port_addr = 0xaa,
+ .port_addr = 0x55,
.driver = &pi3usb30532_usb_mux_driver,
},
};
@@ -213,7 +213,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_kxcj9_mutex[0],
.drv_data = &g_kxcj9_data[0],
.port = I2C_PORT_ACCEL,
- .addr = KXCJ9_ADDR1,
+ .i2c_spi_addr__7bf = KXCJ9_ADDR1__7bf,
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KXCJ9_ACCEL_MIN_FREQ,
@@ -236,7 +236,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_kxcj9_mutex[1],
.drv_data = &g_kxcj9_data[1],
.port = I2C_PORT_ACCEL,
- .addr = KXCJ9_ADDR0,
+ .i2c_spi_addr__7bf = KXCJ9_ADDR0__7bf,
.rot_standard_ref = &lid_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KXCJ9_ACCEL_MIN_FREQ,
diff --git a/board/sweetberry/board.c b/board/sweetberry/board.c
index 66b21a81b9..943cb1c1ae 100644
--- a/board/sweetberry/board.c
+++ b/board/sweetberry/board.c
@@ -121,6 +121,6 @@ static void board_init(void)
uint8_t tmp;
/* i2c 0 has a tendancy to get wedged. TODO(nsanders): why? */
- i2c_xfer(0, 0, NULL, 0, &tmp, 1);
+ i2c_xfer__7bf(0, 0, NULL, 0, &tmp, 1);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
diff --git a/board/yorp/board.c b/board/yorp/board.c
index 65653ac168..409914c898 100644
--- a/board/yorp/board.c
+++ b/board/yorp/board.c
@@ -119,7 +119,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_SENSOR,
- .addr = KX022_ADDR1,
+ .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 4, /* g */
.config = {
@@ -147,7 +147,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_BASE_SIXAXIS_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .addr = LSM6DSM_ADDR0,
+ .i2c_spi_addr__7bf = LSM6DSM_ADDR0__7bf,
.rot_standard_ref = &base_standard_ref,
.default_range = 4, /* g */
.min_frequency = LSM6DSM_ODR_MIN_VAL,
@@ -179,7 +179,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_BASE_SIXAXIS_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .addr = LSM6DSM_ADDR0,
+ .i2c_spi_addr__7bf = LSM6DSM_ADDR0__7bf,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = LSM6DSM_ODR_MIN_VAL,