diff options
| author | Grant Likely <grant.likely@secretlab.ca> | 2011-04-07 11:15:50 -0700 | 
|---|---|---|
| committer | Grant Likely <grant.likely@secretlab.ca> | 2011-04-07 11:15:50 -0700 | 
| commit | 454abcc57f1d48a976291bc4af73b5f087e21d70 (patch) | |
| tree | 5bba999ea3f31527da02b60604531cc5fb52ea57 /drivers/gpu/drm/i915/intel_i2c.c | |
| parent | 88aab9341a315d81118be6b41c45e4fe32b94bc1 (diff) | |
| parent | 6221f222c0ebf1acdf7abcf927178f40e1a65e2a (diff) | |
| download | olio-linux-3.10-454abcc57f1d48a976291bc4af73b5f087e21d70.tar.xz olio-linux-3.10-454abcc57f1d48a976291bc4af73b5f087e21d70.zip  | |
Merge commit 'v2.6.39-rc2' into spi/merge
Diffstat (limited to 'drivers/gpu/drm/i915/intel_i2c.c')
| -rw-r--r-- | drivers/gpu/drm/i915/intel_i2c.c | 25 | 
1 files changed, 21 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c index 82d04c5899d..d3b903bce7c 100644 --- a/drivers/gpu/drm/i915/intel_i2c.c +++ b/drivers/gpu/drm/i915/intel_i2c.c @@ -259,7 +259,7 @@ gmbus_xfer(struct i2c_adapter *adapter,  				if (wait_for(I915_READ(GMBUS2 + reg_offset) & (GMBUS_SATOER | GMBUS_HW_RDY), 50))  					goto timeout;  				if (I915_READ(GMBUS2 + reg_offset) & GMBUS_SATOER) -					return 0; +					goto clear_err;  				val = I915_READ(GMBUS3 + reg_offset);  				do { @@ -287,7 +287,7 @@ gmbus_xfer(struct i2c_adapter *adapter,  				if (wait_for(I915_READ(GMBUS2 + reg_offset) & (GMBUS_SATOER | GMBUS_HW_RDY), 50))  					goto timeout;  				if (I915_READ(GMBUS2 + reg_offset) & GMBUS_SATOER) -					return 0; +					goto clear_err;  				val = loop = 0;  				do { @@ -302,14 +302,31 @@ gmbus_xfer(struct i2c_adapter *adapter,  		if (i + 1 < num && wait_for(I915_READ(GMBUS2 + reg_offset) & (GMBUS_SATOER | GMBUS_HW_WAIT_PHASE), 50))  			goto timeout;  		if (I915_READ(GMBUS2 + reg_offset) & GMBUS_SATOER) -			return 0; +			goto clear_err;  	} -	return num; +	goto done; + +clear_err: +	/* Toggle the Software Clear Interrupt bit. This has the effect +	 * of resetting the GMBUS controller and so clearing the +	 * BUS_ERROR raised by the slave's NAK. +	 */ +	I915_WRITE(GMBUS1 + reg_offset, GMBUS_SW_CLR_INT); +	I915_WRITE(GMBUS1 + reg_offset, 0); + +done: +	/* Mark the GMBUS interface as disabled. We will re-enable it at the +	 * start of the next xfer, till then let it sleep. +	 */ +	I915_WRITE(GMBUS0 + reg_offset, 0); +	return i;  timeout:  	DRM_INFO("GMBUS timed out, falling back to bit banging on pin %d [%s]\n",  		 bus->reg0 & 0xff, bus->adapter.name); +	I915_WRITE(GMBUS0 + reg_offset, 0); +  	/* Hardware may not support GMBUS over these pins? Try GPIO bitbanging instead. */  	bus->force_bit = intel_gpio_create(dev_priv, bus->reg0 & 0xff);  	if (!bus->force_bit)  |