public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 2.6.27-rc4] i2c-davinci: behave with i2cdetect
@ 2008-08-25  6:42 David Brownell
       [not found] ` <200808242342.53944.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: David Brownell @ 2008-08-25  6:42 UTC (permalink / raw)
  To: i2c-GZX6beZjE8VD60Wz+7aTrA
  Cc: Kevin Hilman,
	davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/

From: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>

Make i2c-davinci cope properly with "i2cdetect":  don't spew
syslog spam on perfectly normal behaviors, or respond to any
address other than the one reserved for the SMBus host.

Signed-off-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
---
 drivers/i2c/busses/i2c-davinci.c |   18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -188,6 +188,11 @@ static int i2c_davinci_init(struct davin
 	davinci_i2c_write_reg(dev, DAVINCI_I2C_CLKH_REG, clkh);
 	davinci_i2c_write_reg(dev, DAVINCI_I2C_CLKL_REG, clkl);
 
+	/* Respond at reserved "SMBus Host" slave address" (and zero);
+	 * we seem to have no option to not respond...
+	 */
+	davinci_i2c_write_reg(dev, DAVINCI_I2C_OAR_REG, 0x08);
+
 	dev_dbg(dev->dev, "input_clock = %d, CLK = %d\n", input_clock, clk);
 	dev_dbg(dev->dev, "PSC  = %d\n",
 		davinci_i2c_read_reg(dev, DAVINCI_I2C_PSC_REG));
@@ -400,7 +405,7 @@ static void terminate_write(struct davin
 	davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w);
 
 	if (!dev->terminate)
-		dev_err(dev->dev, "TDR IRQ while no data to send\n");
+		dev_dbg(dev->dev, "TDR IRQ while no data to send\n");
 }
 
 /*
@@ -494,9 +499,14 @@ static irqreturn_t i2c_davinci_isr(int t
 			break;
 
 		case DAVINCI_I2C_IVR_AAS:
-			dev_warn(dev->dev, "Address as slave interrupt\n");
-		}/* switch */
-	}/* while */
+			dev_dbg(dev->dev, "Address as slave interrupt\n");
+			break;
+
+		default:
+			dev_warn(dev->dev, "Unrecognized irq stat %d\n", stat);
+			break;
+		}
+	}
 
 	return count ? IRQ_HANDLED : IRQ_NONE;
 }

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch 2.6.27-rc4] i2c-davinci: behave with i2cdetect
       [not found] ` <200808242342.53944.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
@ 2008-08-28 16:59   ` Kevin Hilman
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Hilman @ 2008-08-28 16:59 UTC (permalink / raw)
  To: David Brownell
  Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
	i2c-GZX6beZjE8VD60Wz+7aTrA

David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org> writes:

> From: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
>
> Make i2c-davinci cope properly with "i2cdetect":  don't spew
> syslog spam on perfectly normal behaviors, or respond to any
> address other than the one reserved for the SMBus host.
>
> Signed-off-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>

Thanks, pushing today.

Kevin

>  drivers/i2c/busses/i2c-davinci.c |   18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
>
> --- a/drivers/i2c/busses/i2c-davinci.c
> +++ b/drivers/i2c/busses/i2c-davinci.c
> @@ -188,6 +188,11 @@ static int i2c_davinci_init(struct davin
>  	davinci_i2c_write_reg(dev, DAVINCI_I2C_CLKH_REG, clkh);
>  	davinci_i2c_write_reg(dev, DAVINCI_I2C_CLKL_REG, clkl);
>  
> +	/* Respond at reserved "SMBus Host" slave address" (and zero);
> +	 * we seem to have no option to not respond...
> +	 */
> +	davinci_i2c_write_reg(dev, DAVINCI_I2C_OAR_REG, 0x08);
> +
>  	dev_dbg(dev->dev, "input_clock = %d, CLK = %d\n", input_clock, clk);
>  	dev_dbg(dev->dev, "PSC  = %d\n",
>  		davinci_i2c_read_reg(dev, DAVINCI_I2C_PSC_REG));
> @@ -400,7 +405,7 @@ static void terminate_write(struct davin
>  	davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w);
>  
>  	if (!dev->terminate)
> -		dev_err(dev->dev, "TDR IRQ while no data to send\n");
> +		dev_dbg(dev->dev, "TDR IRQ while no data to send\n");
>  }
>  
>  /*
> @@ -494,9 +499,14 @@ static irqreturn_t i2c_davinci_isr(int t
>  			break;
>  
>  		case DAVINCI_I2C_IVR_AAS:
> -			dev_warn(dev->dev, "Address as slave interrupt\n");
> -		}/* switch */
> -	}/* while */
> +			dev_dbg(dev->dev, "Address as slave interrupt\n");
> +			break;
> +
> +		default:
> +			dev_warn(dev->dev, "Unrecognized irq stat %d\n", stat);
> +			break;
> +		}
> +	}
>  
>  	return count ? IRQ_HANDLED : IRQ_NONE;
>  }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-08-28 16:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-25  6:42 [patch 2.6.27-rc4] i2c-davinci: behave with i2cdetect David Brownell
     [not found] ` <200808242342.53944.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-08-28 16:59   ` Kevin Hilman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox