summaryrefslogtreecommitdiff
path: root/Platform/Marvell
diff options
context:
space:
mode:
authorDavid Greeson <dgreeson@cisco.com>2017-10-26 01:45:13 +0200
committerLeif Lindholm <leif@developerbox>2017-10-29 16:47:22 +0000
commit80ae9e875df0e72f21ce351fb540ea8d5ca71124 (patch)
tree337d1dca8016a1d8fbb8661dd336af56303636b2 /Platform/Marvell
parentf184f5e08bfe9125f268ddaabef5b187072aa382 (diff)
downloadedk2-platforms-80ae9e875df0e72f21ce351fb540ea8d5ca71124.tar.xz
Marvell/Drivers: MvI2cDxe: Reduce bus occupation time
During each transaction start, clearing the I2C_CONTROL_FLAG was surrounded by 3 uncoditional stalls. This was not necessary, so replace them with one busy-wait loop, whose polling count could be also safely reduced. Above improvements result in faster transfer initialization and allow to reduce the I2C bus occupation. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: David Greeson <dgreeson@cisco.com> Signed-off-by: Marcin Wojtas <mw@semihalf.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Diffstat (limited to 'Platform/Marvell')
-rwxr-xr-xPlatform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c6
-rw-r--r--Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h2
2 files changed, 2 insertions, 6 deletions
diff --git a/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c b/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
index a62383f3a7..d6f590d5bf 100755
--- a/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
+++ b/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
@@ -243,9 +243,8 @@ MvI2cClearIflg (
IN I2C_MASTER_CONTEXT *I2cMasterContext
)
{
- gBS->Stall(I2C_OPERATION_TIMEOUT);
+ MvI2cPollCtrl (I2cMasterContext, I2C_OPERATION_TIMEOUT, I2C_CONTROL_IFLG);
MvI2cControlClear(I2cMasterContext, I2C_CONTROL_IFLG);
- gBS->Stall(I2C_OPERATION_TIMEOUT);
}
/* Timeout is given in us */
@@ -295,9 +294,6 @@ MvI2cLockedStart (
MvI2cClearIflg(I2cMasterContext);
}
- /* Without this delay we Timeout checking IFLG if the Timeout is 0 */
- gBS->Stall(I2C_OPERATION_TIMEOUT);
-
if (MvI2cPollCtrl(I2cMasterContext, Timeout, I2C_CONTROL_IFLG)) {
DEBUG((DEBUG_ERROR, "MvI2cDxe: Timeout sending %sSTART condition\n",
Mask == I2C_STATUS_START ? "" : "repeated "));
diff --git a/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h b/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h
index 028fd5461f..3c9beaf967 100644
--- a/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h
+++ b/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h
@@ -68,7 +68,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define I2C_SOFT_RESET 0x1c
#define I2C_TRANSFER_TIMEOUT 10000
-#define I2C_OPERATION_TIMEOUT 1000
+#define I2C_OPERATION_TIMEOUT 100
#define I2C_UNKNOWN 0x0
#define I2C_SLOW 0x1