summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRoshni Shah <roshni.shah@timesys.com>2014-01-05 16:15:28 -0500
committerRoshni Shah <roshni.shah@timesys.com>2014-01-05 16:34:28 -0500
commit5e74d2d05b5543eb7952806e80842a4645e7685a (patch)
treedd41d3876a0ee7aa035c5a5d4f05a60fab78379c /drivers
parent81d90159c6aa14b6c713a1280d19a7ba6f8b9e0c (diff)
Quartz: Fixed Linux-MQX semaphore conflict in the i2c driver for multiple i2c
registrations in Linux.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/busses/i2c-imx.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index e13e020cab2e..8cd88b24a47c 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -59,6 +59,8 @@
/* This will be the driver name the kernel reports */
#define DRIVER_NAME "imx-i2c"
+#define FALSE 0
+#define TRUE 1
/* Default value */
#define IMX_I2C_BIT_RATE 100000 /* 100kHz */
@@ -521,6 +523,7 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
resource_size_t res_size;
int irq;
int ret;
+ static bool sema4Assigned = FALSE;
dev_dbg(&pdev->dev, "<%s>\n", __func__);
@@ -620,10 +623,14 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, i2c_imx);
#ifdef CONFIG_ARCH_MVF
- // for makeing sure not in use by MQX concurrently
- if(mvf_sema4_assign(MVF_I2C_SEMAPHORE_NUMBER, &sema4)) {
- dev_err(&pdev->dev, "could not assign MQX semaphore %d\n", MVF_I2C_SEMAPHORE_NUMBER);
- goto fail5;
+ if(sema4Assigned == FALSE)
+ {
+ // for making sure the i2c port is not in use by MQX concurrently
+ if(mvf_sema4_assign(MVF_I2C_SEMAPHORE_NUMBER, &sema4)) {
+ dev_err(&pdev->dev, "could not assign MQX semaphore %d\n", MVF_I2C_SEMAPHORE_NUMBER);
+ goto fail5;
+ }
+ sema4Assigned = TRUE;
}
#endif