Re: [PATCHv8 03/13] I2C: OMAP: Remove reset at init

2012-06-26 Thread Tony Lindgren
* Shubhrajyoti shubhrajy...@ti.com [120621 02:35]:
 On Thursday 21 June 2012 12:50 PM, Tony Lindgren wrote:
  * Shubhrajyoti shubhrajy...@ti.com [120621 00:08]:
  On Wednesday 20 June 2012 03:59 PM, Tony Lindgren wrote:
  See the comments regarding driver specific resets in hwmod code.
  you mean omap_hwmod.c
  The way to set this up is to have a shared inline function in
  i2c-omap.h that both the driver and hwmod code can use.
  hwmod reset function uses oh (omap_hwmod).
 
  How could the driver also pass oh ?
  Could we keep a local copy in driver data?
  Eventually hwmod code will do the reset only in late initcall
  if no driver is loaded for the device in question.
  There's no need for the driver to know anything about oh.
  The driver just needs to know the iobase.
 I will rework to make the hwmod and driver use the same function.
 In the meanwhile I will send a minimal/ remaining cleanups/ fixes so that
 it might get some time to bake in the next branch.

OK thanks!

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv8 03/13] I2C: OMAP: Remove reset at init

2012-06-21 Thread Shubhrajyoti
On Wednesday 20 June 2012 03:59 PM, Tony Lindgren wrote:
 See the comments regarding driver specific resets in hwmod code.
you mean omap_hwmod.c

 The way to set this up is to have a shared inline function in
 i2c-omap.h that both the driver and hwmod code can use.
hwmod reset function uses oh (omap_hwmod).

How could the driver also pass oh ?
Could we keep a local copy in driver data?
 Eventually hwmod code will do the reset only in late initcall
 if no driver is loaded for the device in question.

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


Re: [PATCHv8 03/13] I2C: OMAP: Remove reset at init

2012-06-21 Thread Tony Lindgren
* Shubhrajyoti shubhrajy...@ti.com [120621 00:08]:
 On Wednesday 20 June 2012 03:59 PM, Tony Lindgren wrote:
  See the comments regarding driver specific resets in hwmod code.
 you mean omap_hwmod.c
 
  The way to set this up is to have a shared inline function in
  i2c-omap.h that both the driver and hwmod code can use.
 hwmod reset function uses oh (omap_hwmod).
 
 How could the driver also pass oh ?
 Could we keep a local copy in driver data?
  Eventually hwmod code will do the reset only in late initcall
  if no driver is loaded for the device in question.
 

There's no need for the driver to know anything about oh.
The driver just needs to know the iobase.

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv8 03/13] I2C: OMAP: Remove reset at init

2012-06-21 Thread Shubhrajyoti
On Thursday 21 June 2012 12:50 PM, Tony Lindgren wrote:
 * Shubhrajyoti shubhrajy...@ti.com [120621 00:08]:
 On Wednesday 20 June 2012 03:59 PM, Tony Lindgren wrote:
 See the comments regarding driver specific resets in hwmod code.
 you mean omap_hwmod.c
 The way to set this up is to have a shared inline function in
 i2c-omap.h that both the driver and hwmod code can use.
 hwmod reset function uses oh (omap_hwmod).

 How could the driver also pass oh ?
 Could we keep a local copy in driver data?
 Eventually hwmod code will do the reset only in late initcall
 if no driver is loaded for the device in question.
 There's no need for the driver to know anything about oh.
 The driver just needs to know the iobase.
I will rework to make the hwmod and driver use the same function.
In the meanwhile I will send a minimal/ remaining cleanups/ fixes so that
it might get some time to bake in the next branch.



 Tony

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


Re: [PATCHv8 03/13] I2C: OMAP: Remove reset at init

2012-06-20 Thread Tony Lindgren
* Shubhrajyoti D shubhrajy...@ti.com [120618 07:35]:
 The reset in the driver at init is not needed anymore as the
 following patch has removed the HWMOD_INIT_NO_RESET flag.
 6d3c55f [OMAP: hwmod: fix the i2c-reset timeout during bootup]
 
 This patch does the following
 -removes the reset from the probe and implements a omap_i2c_reset
  function to reset.
 - Reset is removed from omap_i2c_init, which was called
  not only during probe, but also after time out and error handling.
  omap_i2c_reset is added in those places to effect the reset.

See the comments regarding driver specific resets in hwmod code.

The way to set this up is to have a shared inline function in
i2c-omap.h that both the driver and hwmod code can use.

Eventually hwmod code will do the reset only in late initcall
if no driver is loaded for the device in question.

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv8 03/13] I2C: OMAP: Remove reset at init

2012-06-18 Thread Shubhrajyoti D
The reset in the driver at init is not needed anymore as the
following patch has removed the HWMOD_INIT_NO_RESET flag.
6d3c55f [OMAP: hwmod: fix the i2c-reset timeout during bootup]

This patch does the following
-removes the reset from the probe and implements a omap_i2c_reset
 function to reset.
- Reset is removed from omap_i2c_init, which was called
 not only during probe, but also after time out and error handling.
 omap_i2c_reset is added in those places to effect the reset.

Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com
---
 drivers/i2c/busses/i2c-omap.c |   38 +++---
 1 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 838a0ae..5da91b5 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -269,15 +269,9 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev 
*i2c_dev, int reg)
(i2c_dev-regs[reg]  i2c_dev-reg_shift));
 }
 
-static int omap_i2c_init(struct omap_i2c_dev *dev)
+static int omap_i2c_reset(struct omap_i2c_dev *dev)
 {
-   u16 psc = 0, scll = 0, sclh = 0, buf = 0;
-   u16 fsscll = 0, fssclh = 0, hsscll = 0, hssclh = 0;
-   unsigned long fclk_rate = 1200;
unsigned long timeout;
-   unsigned long internal_clk = 0;
-   struct clk *fclk;
-
if (dev-rev = OMAP_I2C_OMAP1_REV_2) {
/* Disable I2C controller before soft reset */
omap_i2c_write_reg(dev, OMAP_I2C_CON_REG,
@@ -315,16 +309,18 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
 
omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG,
dev-syscstate);
-   /*
-* Enabling all wakup sources to stop I2C freezing on
-* WFI instruction.
-* REVISIT: Some wkup sources might not be needed.
-*/
-   dev-westate = OMAP_I2C_WE_ALL;
-   omap_i2c_write_reg(dev, OMAP_I2C_WE_REG,
-   dev-westate);
}
}
+}
+
+static int omap_i2c_init(struct omap_i2c_dev *dev)
+{
+   u16 psc = 0, scll = 0, sclh = 0, buf = 0;
+   u16 fsscll = 0, fssclh = 0, hsscll = 0, hssclh = 0;
+   unsigned long fclk_rate = 1200;
+   unsigned long internal_clk = 0;
+   struct clk *fclk;
+
omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
 
if (dev-flags  OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK) {
@@ -433,6 +429,16 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
OMAP_I2C_IE_AL)  | ((dev-fifo_size) ?
(OMAP_I2C_IE_RDR | OMAP_I2C_IE_XDR) : 0);
omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev-iestate);
+   if (dev-rev = OMAP_I2C_REV_ON_3430_3530) {
+   /*
+* Enabling all wakup sources to stop I2C freezing on
+* WFI instruction.
+* REVISIT: Some wkup sources might not be needed.
+*/
+   dev-westate = OMAP_I2C_WE_ALL;
+   omap_i2c_write_reg(dev, OMAP_I2C_WE_REG, dev-westate);
+   }
+
if (dev-flags  OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
dev-pscstate = psc;
dev-scllstate = scll;
@@ -541,6 +547,7 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap,
dev-buf_len = 0;
if (timeout == 0) {
dev_err(dev-dev, controller timed out\n);
+   omap_i2c_reset(dev);
omap_i2c_init(dev);
return -ETIMEDOUT;
}
@@ -551,6 +558,7 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap,
/* We have an error */
if (dev-cmd_err  (OMAP_I2C_STAT_AL | OMAP_I2C_STAT_ROVR |
OMAP_I2C_STAT_XUDF)) {
+   omap_i2c_reset(dev);
omap_i2c_init(dev);
return -EIO;
}
-- 
1.7.5.4

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