Re: [PATCH v3 1/2] i2c: Add Imagination Technologies I2C SCB driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 11/06/2014 01:51 PM, Vladimir Zapolskiy wrote:
> Hi Ezequiel,
> 
> On 05.11.2014 22:21, Ezequiel Garcia wrote:
>> From: James Hogan <james.hogan@xxxxxxxxxx>
>>
>> Add support for the IMG I2C Serial Control Bus (SCB) found on the
>> Pistachio and TZ1090 SoCs.
>>
>> Signed-off-by: James Hogan <james.hogan@xxxxxxxxxx>
>> [Ezequiel: code cleaning and rebasing]
>> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@xxxxxxxxxx>
>> ---
>>  drivers/i2c/busses/Kconfig       |   10 +
>>  drivers/i2c/busses/Makefile      |    1 +
>>  drivers/i2c/busses/i2c-img-scb.c | 1397 ++++++++++++++++++++++++++++++++++++++
>>  3 files changed, 1408 insertions(+)
>>  create mode 100644 drivers/i2c/busses/i2c-img-scb.c
>>
> 
> [snip]
> 
>> +static int img_i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
>> +			int num)
>> +{
>> +	struct img_i2c *i2c = i2c_get_adapdata(i2c_adap);
>> +	bool atomic = false;
>> +	int i;
>> +
>> +	if (i2c->mode == MODE_SUSPEND) {
>> +		WARN(1, "refusing to service transaction in suspended state\n");
>> +		return -EIO;
>> +	}
>> +
>> +	if (i2c->mode == MODE_FATAL)
>> +		return -EIO;
>> +
>> +	for (i = 0; i < num; i++) {
>> +		if (likely(msgs[i].len))
>> +			continue;
>> +		/*
>> +		 * 0 byte reads are not possible because the slave could try
>> +		 * and pull the data line low, preventing a stop bit.
>> +		 */
>> +		if (unlikely(msgs[i].flags & I2C_M_RD))
>> +			return -EIO;
>> +		/*
>> +		 * 0 byte writes are possible and used for probing, but we
>> +		 * cannot do them in automatic mode, so use atomic mode
>> +		 * instead.
>> +		 */
>> +		atomic = true;
>> +	}
>> +
>> +	clk_prepare_enable(i2c->scb_clk);
> 
> Does it make sense to add a check for returned error here?
> 

Right, that makes sense.

-- 
Ezequiel
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux