mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-28 02:35:28 +00:00
ryu: gate SCL to PI3USB9281
As a short term workaround for the I2C problem of PI3USB9281, we're gating its SCL input when it's not addressed. This workaround will be removed once we have the silicon fix. BUG=chrome-os-partner:31526 TEST=Sanity check on P0 boards. BRANCH=None Change-Id: I57daf25f2ad2d94ac7e4192050b4d6bbdae9d51d Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/214064 Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
687f9032d1
commit
b22c10ce2e
@@ -35,6 +35,14 @@
|
||||
#undef CONFIG_CONSOLE_CMDHELP
|
||||
#define CONFIG_INDUCTIVE_CHARGING
|
||||
|
||||
/*
|
||||
* Pericom I2C workaround
|
||||
* TODO(crosbug.com/p/31529): Remove this.
|
||||
*/
|
||||
#define CONFIG_I2C_SCL_GATE_PORT I2C_PORT_MASTER
|
||||
#define CONFIG_I2C_SCL_GATE_ADDR 0x4a
|
||||
#define CONFIG_I2C_SCL_GATE_GPIO GPIO_PERICOM_CLK_EN
|
||||
|
||||
/* Charging/Power configuration */
|
||||
#undef CONFIG_BATTERY_RYU /* TODO implement */
|
||||
#define CONFIG_BATTERY_BQ27541
|
||||
|
||||
@@ -90,6 +90,9 @@ GPIO(MASTER_I2C_SDA, B, 9, GPIO_INPUT, NULL)
|
||||
GPIO(SLAVE_I2C_SCL, B, 10, GPIO_INPUT, NULL)
|
||||
GPIO(SLAVE_I2C_SDA, B, 11, GPIO_INPUT, NULL)
|
||||
|
||||
/* SCL gating for PI3USB9281 */
|
||||
GPIO(PERICOM_CLK_EN, C, 15, GPIO_OUT_LOW, NULL)
|
||||
|
||||
/* Case closed debugging. */
|
||||
GPIO(PD_DISABLE_DEBUG, C, 5, GPIO_OUT_HIGH, NULL)
|
||||
GPIO(SPI_FLASH_NSS, B, 12, GPIO_INPUT, NULL)
|
||||
|
||||
@@ -291,6 +291,12 @@ int i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_bytes,
|
||||
int rv = EC_SUCCESS;
|
||||
int i;
|
||||
|
||||
#if defined(CONFIG_I2C_SCL_GATE_ADDR) && defined(CONFIG_I2C_SCL_GATE_PORT)
|
||||
if (port == CONFIG_I2C_SCL_GATE_PORT &&
|
||||
slave_addr == CONFIG_I2C_SCL_GATE_ADDR)
|
||||
gpio_set_level(CONFIG_I2C_SCL_GATE_GPIO, 1);
|
||||
#endif
|
||||
|
||||
ASSERT(out || !out_bytes);
|
||||
ASSERT(in || !in_bytes);
|
||||
|
||||
@@ -367,6 +373,12 @@ xfer_exit:
|
||||
STM32_I2C_CR1(port) |= STM32_I2C_CR1_PE;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_I2C_SCL_GATE_ADDR
|
||||
if (port == CONFIG_I2C_SCL_GATE_PORT &&
|
||||
slave_addr == CONFIG_I2C_SCL_GATE_ADDR)
|
||||
gpio_set_level(CONFIG_I2C_SCL_GATE_GPIO, 0);
|
||||
#endif
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@@ -569,6 +569,17 @@
|
||||
#undef CONFIG_I2C_PASSTHROUGH
|
||||
#undef CONFIG_I2C_PASSTHRU_RESTRICTED
|
||||
|
||||
/*
|
||||
* I2C SCL gating.
|
||||
*
|
||||
* If CONFIG_I2C_SCL_GATE_ADDR/PORT is defined, whenever the defined address
|
||||
* is addressed, CONFIG_I2C_SCL_GATE_GPIO is set to high. When the I2C
|
||||
* transaction is done, the pin is set back to low.
|
||||
*/
|
||||
#undef CONFIG_I2C_SCL_GATE_PORT
|
||||
#undef CONFIG_I2C_SCL_GATE_ADDR
|
||||
#undef CONFIG_I2C_SCL_GATE_GPIO
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Inductive charging */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user