summaryrefslogtreecommitdiff
path: root/board/atlas
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/atlas
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/atlas')
-rw-r--r--board/atlas/board.c48
-rw-r--r--board/atlas/board.h8
2 files changed, 28 insertions, 28 deletions
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__