npcx: i2c: Remove needless controller state pre-check

We're now locking i2c at the controller (not port) level, so it's not
necessary to check if a given controller is busy before doing an i2c
transaction.

BUG=None
TEST=Manual on kevin, verify i2c is still functional.
BRANCH=gru

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ic0cda34f9a58c76083699990a0dc3e761bcdec4f
Reviewed-on: https://chromium-review.googlesource.com/393107
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
(cherry picked from commit 7d2e2f565b79a035a270ca083af97c6a14983739)
Reviewed-on: https://chromium-review.googlesource.com/396138
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
Shawn Nematbakhsh
2016-10-04 17:04:30 -07:00
committed by chrome-bot
parent d9b7d25b86
commit 38cf4fccfb

View File

@@ -79,7 +79,7 @@ enum smb_oper_state_t {
};
/* IRQ for each port */
const uint32_t i2c_irqs[I2C_CONTROLLER_COUNT] = {
static const uint32_t i2c_irqs[I2C_CONTROLLER_COUNT] = {
NPCX_IRQ_SMB1, NPCX_IRQ_SMB2, NPCX_IRQ_SMB3, NPCX_IRQ_SMB4};
BUILD_ASSERT(ARRAY_SIZE(i2c_irqs) == I2C_CONTROLLER_COUNT);
@@ -616,16 +616,8 @@ int chip_i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_size,
p_status = i2c_stsobjs + ctrl;
interrupt_disable();
/* make sure bus is not occupied by the other task */
if (p_status->task_waiting != TASK_ID_INVALID) {
interrupt_enable();
return EC_ERROR_BUSY;
}
/* Assign current task ID */
p_status->task_waiting = task_get_current();
interrupt_enable();
/* Select port for multi-ports i2c controller */
i2c_select_port(port);