diff options
author | martin yan <martin.yan@microchip.corp-partner.google.com> | 2021-04-01 03:57:18 -0400 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-04-05 19:21:04 +0000 |
commit | 26c5b9897f23ea07633ee3eb156b1e5928eb67b1 (patch) | |
tree | b6fd90c565be254619d0d1f6a8d489bcac005bac /chip/mchp/i2c.c | |
parent | c580c2225e055ceda79ced0fd7a08f6447ce987f (diff) | |
download | chrome-ec-26c5b9897f23ea07633ee3eb156b1e5928eb67b1.tar.gz |
mchp: Add i2c_chip.h and board_i2c_p2c() in chip
Add board_i2c_p2c() which returns default I2C controller for i2c
but this function can be overridden by board
BRANCH=none
BUG=none
TEST=Build sklrvp_mchp172x.
Signed-off-by: martin yan <martin.yan@microchip.corp-partner.google.com>
Change-Id: I88740517f11c6afcfc1edb37a59bbf04f336f655
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2800091
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'chip/mchp/i2c.c')
-rw-r--r-- | chip/mchp/i2c.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/chip/mchp/i2c.c b/chip/mchp/i2c.c index cc8eae7960..6125a893ef 100644 --- a/chip/mchp/i2c.c +++ b/chip/mchp/i2c.c @@ -10,6 +10,7 @@ #include "gpio.h" #include "hooks.h" #include "i2c.h" +#include "i2c_chip.h" #include "registers.h" #include "task.h" #include "tfdp_chip.h" @@ -927,6 +928,17 @@ int i2c_get_line_levels(int port) } /* + * this function returns the controller for I2C + * return mod of MCHP_I2C_CTRL_MAX + */ +__overridable int board_i2c_p2c(int port) +{ + if (port < 0 || port >= I2C_PORT_COUNT) + return -1; + return port % MCHP_I2C_CTRL_MAX; +} + +/* * I2C port must be a zero based number. * MCHP I2C can map any port to any of the 4 controllers. * Call board level function as board designs may choose |