Ejemplo n.º 1
0
static int i2c_pxa_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
{
	struct pxa_i2c *i2c = adap->algo_data;
	int ret, i;

	/* If the I2C controller is disabled we need to reset it (probably due
 	   to a suspend/resume destroying state). We do this here as we can then
 	   avoid worrying about resuming the controller before its users. */
	if (!(readl(_ICR(i2c)) & ICR_IUE))
		i2c_pxa_reset(i2c);

	for (i = adap->retries; i >= 0; i--) {
		ret = i2c_pxa_do_xfer(i2c, msgs, num);
		if (ret != I2C_RETRY)
			goto out;

		if (i2c_debug)
			dev_dbg(&adap->dev, "Retrying transmission\n");
		udelay(100);
	}
	i2c_pxa_scream_blue_murder(i2c, "exhausted retries");
	ret = -EREMOTEIO;
 out:
	i2c_pxa_set_slave(i2c, ret);
	return ret;
}
Ejemplo n.º 2
0
static int i2c_pxa_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num)
{
	int retval = i2c_pxa_valid_messages( msgs, num);
	if( retval > 0)
	{
		int i;
		for (i=i2c_adap->retries; i>=0; i--){
			int retval = i2c_pxa_do_xfer(i2c_adap,msgs,num);
			if (retval!=I2C_RETRY){
				return retval;
			}
			if( i2c_debug)printk(KERN_INFO"Retrying transmission \n");
			udelay(100);
		}   
		if( i2c_debug)printk(KERN_INFO"Retried %i times\n",i2c_adap->retries);
		return -EREMOTEIO;

	}
	return retval;
}