i2c: Bug fix for the semaphore locking mechanism for i2c

The locking and synch mechanisms were configured after the interrupts
for the I2C controller are enabled, now the configuration is done before
the enabling of the interrupts.
Jira: ZEP-419
Change-Id: Ia1b0e790b9f5f8e7560cc3556b7a0f394048d171
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
This commit is contained in:
Sergio Rodriguez 2016-05-31 12:29:15 -07:00 committed by Anas Nashif
parent 7c00c4d3be
commit 10e33ff779

View file

@ -197,6 +197,10 @@ static int i2c_qmsi_init(struct device *dev)
qm_i2c_t instance = GET_CONTROLLER_INSTANCE(dev);
int err;
device_sync_call_init(&driver_data->sync);
nano_sem_init(&driver_data->sem);
nano_sem_give(&driver_data->sem);
switch (instance) {
case QM_I2C_0:
/* Register interrupt handler, unmask IRQ and route it
@ -232,9 +236,6 @@ static int i2c_qmsi_init(struct device *dev)
return err;
}
device_sync_call_init(&driver_data->sync);
nano_sem_init(&driver_data->sem);
nano_sem_give(&driver_data->sem);
dev->driver_api = &api;
return 0;
}