* [PATCHv6 01/19] I2C: OMAP: make omap_i2c_unidle/idle functions depend on CONFIG_PM_RUNTIME
2012-04-10 10:56 ` Shubhrajyoti D
@ 2012-04-10 10:56 ` Shubhrajyoti D
-1 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti D @ 2012-04-10 10:56 UTC (permalink / raw)
To: linux-omap-u79uwXL29TY76Z2rM5mHXA
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, tony-4v6yS6AI5VpBDgjK7y7TUQ,
w.sang-bIcnvbaLZ9MEGnE8C9+IrQ, Shubhrajyoti D
The functions omap_i2c_unidle/idle are called from omap_i2c_runtime_resume
and omap_i2c_runtime_suspend which is compiled for CONFIG_PM_RUNTIME.
This patch removes the omap_i2c_unidle/idle functions and folds them
into the runtime callbacks.
This fixes the below warn when CONFIG_PM_RUNTIME is not defined
CC arch/arm/mach-omap2/board-ti8168evm.o
drivers/i2c/busses/i2c-omap.c:272: warning: 'omap_i2c_unidle' defined but not used
drivers/i2c/busses/i2c-omap.c:293: warning: 'omap_i2c_idle' defined but not used
CC net/ipv4/ip_forward.o
Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
---
drivers/i2c/busses/i2c-omap.c | 75 +++++++++++++++++-----------------------
1 files changed, 32 insertions(+), 43 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 801df60..4f4188d 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -269,47 +269,6 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)
(i2c_dev->regs[reg] << i2c_dev->reg_shift));
}
-static void omap_i2c_unidle(struct omap_i2c_dev *dev)
-{
- if (dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
- omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
- omap_i2c_write_reg(dev, OMAP_I2C_PSC_REG, dev->pscstate);
- omap_i2c_write_reg(dev, OMAP_I2C_SCLL_REG, dev->scllstate);
- omap_i2c_write_reg(dev, OMAP_I2C_SCLH_REG, dev->sclhstate);
- omap_i2c_write_reg(dev, OMAP_I2C_BUF_REG, dev->bufstate);
- omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG, dev->syscstate);
- omap_i2c_write_reg(dev, OMAP_I2C_WE_REG, dev->westate);
- omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
- }
-
- /*
- * Don't write to this register if the IE state is 0 as it can
- * cause deadlock.
- */
- if (dev->iestate)
- omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
-}
-
-static void omap_i2c_idle(struct omap_i2c_dev *dev)
-{
- u16 iv;
-
- dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
- if (dev->dtrev == OMAP_I2C_IP_VERSION_2)
- omap_i2c_write_reg(dev, OMAP_I2C_IP_V2_IRQENABLE_CLR, 1);
- else
- omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0);
-
- if (dev->rev < OMAP_I2C_OMAP1_REV_2) {
- iv = omap_i2c_read_reg(dev, OMAP_I2C_IV_REG); /* Read clears */
- } else {
- omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, dev->iestate);
-
- /* Flush posted write */
- omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
- }
-}
-
static int omap_i2c_init(struct omap_i2c_dev *dev)
{
u16 psc = 0, scll = 0, sclh = 0, buf = 0;
@@ -1163,8 +1122,22 @@ static int omap_i2c_runtime_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
+ u16 iv;
+
+ _dev->iestate = omap_i2c_read_reg(_dev, OMAP_I2C_IE_REG);
+ if (_dev->dtrev == OMAP_I2C_IP_VERSION_2)
+ omap_i2c_write_reg(_dev, OMAP_I2C_IP_V2_IRQENABLE_CLR, 1);
+ else
+ omap_i2c_write_reg(_dev, OMAP_I2C_IE_REG, 0);
+
+ if (_dev->rev < OMAP_I2C_OMAP1_REV_2) {
+ iv = omap_i2c_read_reg(_dev, OMAP_I2C_IV_REG); /* Read clears */
+ } else {
+ omap_i2c_write_reg(_dev, OMAP_I2C_STAT_REG, _dev->iestate);
- omap_i2c_idle(_dev);
+ /* Flush posted write */
+ omap_i2c_read_reg(_dev, OMAP_I2C_STAT_REG);
+ }
return 0;
}
@@ -1174,7 +1147,23 @@ static int omap_i2c_runtime_resume(struct device *dev)
struct platform_device *pdev = to_platform_device(dev);
struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
- omap_i2c_unidle(_dev);
+ if (_dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
+ omap_i2c_write_reg(_dev, OMAP_I2C_CON_REG, 0);
+ omap_i2c_write_reg(_dev, OMAP_I2C_PSC_REG, _dev->pscstate);
+ omap_i2c_write_reg(_dev, OMAP_I2C_SCLL_REG, _dev->scllstate);
+ omap_i2c_write_reg(_dev, OMAP_I2C_SCLH_REG, _dev->sclhstate);
+ omap_i2c_write_reg(_dev, OMAP_I2C_BUF_REG, _dev->bufstate);
+ omap_i2c_write_reg(_dev, OMAP_I2C_SYSC_REG, _dev->syscstate);
+ omap_i2c_write_reg(_dev, OMAP_I2C_WE_REG, _dev->westate);
+ omap_i2c_write_reg(_dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
+ }
+
+ /*
+ * Don't write to this register if the IE state is 0 as it can
+ * cause deadlock.
+ */
+ if (_dev->iestate)
+ omap_i2c_write_reg(_dev, OMAP_I2C_IE_REG, _dev->iestate);
return 0;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 50+ messages in thread* [PATCHv6 01/19] I2C: OMAP: make omap_i2c_unidle/idle functions depend on CONFIG_PM_RUNTIME
@ 2012-04-10 10:56 ` Shubhrajyoti D
0 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti D @ 2012-04-10 10:56 UTC (permalink / raw)
To: linux-arm-kernel
The functions omap_i2c_unidle/idle are called from omap_i2c_runtime_resume
and omap_i2c_runtime_suspend which is compiled for CONFIG_PM_RUNTIME.
This patch removes the omap_i2c_unidle/idle functions and folds them
into the runtime callbacks.
This fixes the below warn when CONFIG_PM_RUNTIME is not defined
CC arch/arm/mach-omap2/board-ti8168evm.o
drivers/i2c/busses/i2c-omap.c:272: warning: 'omap_i2c_unidle' defined but not used
drivers/i2c/busses/i2c-omap.c:293: warning: 'omap_i2c_idle' defined but not used
CC net/ipv4/ip_forward.o
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
drivers/i2c/busses/i2c-omap.c | 75 +++++++++++++++++-----------------------
1 files changed, 32 insertions(+), 43 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 801df60..4f4188d 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -269,47 +269,6 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)
(i2c_dev->regs[reg] << i2c_dev->reg_shift));
}
-static void omap_i2c_unidle(struct omap_i2c_dev *dev)
-{
- if (dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
- omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
- omap_i2c_write_reg(dev, OMAP_I2C_PSC_REG, dev->pscstate);
- omap_i2c_write_reg(dev, OMAP_I2C_SCLL_REG, dev->scllstate);
- omap_i2c_write_reg(dev, OMAP_I2C_SCLH_REG, dev->sclhstate);
- omap_i2c_write_reg(dev, OMAP_I2C_BUF_REG, dev->bufstate);
- omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG, dev->syscstate);
- omap_i2c_write_reg(dev, OMAP_I2C_WE_REG, dev->westate);
- omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
- }
-
- /*
- * Don't write to this register if the IE state is 0 as it can
- * cause deadlock.
- */
- if (dev->iestate)
- omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
-}
-
-static void omap_i2c_idle(struct omap_i2c_dev *dev)
-{
- u16 iv;
-
- dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
- if (dev->dtrev == OMAP_I2C_IP_VERSION_2)
- omap_i2c_write_reg(dev, OMAP_I2C_IP_V2_IRQENABLE_CLR, 1);
- else
- omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0);
-
- if (dev->rev < OMAP_I2C_OMAP1_REV_2) {
- iv = omap_i2c_read_reg(dev, OMAP_I2C_IV_REG); /* Read clears */
- } else {
- omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, dev->iestate);
-
- /* Flush posted write */
- omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
- }
-}
-
static int omap_i2c_init(struct omap_i2c_dev *dev)
{
u16 psc = 0, scll = 0, sclh = 0, buf = 0;
@@ -1163,8 +1122,22 @@ static int omap_i2c_runtime_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
+ u16 iv;
+
+ _dev->iestate = omap_i2c_read_reg(_dev, OMAP_I2C_IE_REG);
+ if (_dev->dtrev == OMAP_I2C_IP_VERSION_2)
+ omap_i2c_write_reg(_dev, OMAP_I2C_IP_V2_IRQENABLE_CLR, 1);
+ else
+ omap_i2c_write_reg(_dev, OMAP_I2C_IE_REG, 0);
+
+ if (_dev->rev < OMAP_I2C_OMAP1_REV_2) {
+ iv = omap_i2c_read_reg(_dev, OMAP_I2C_IV_REG); /* Read clears */
+ } else {
+ omap_i2c_write_reg(_dev, OMAP_I2C_STAT_REG, _dev->iestate);
- omap_i2c_idle(_dev);
+ /* Flush posted write */
+ omap_i2c_read_reg(_dev, OMAP_I2C_STAT_REG);
+ }
return 0;
}
@@ -1174,7 +1147,23 @@ static int omap_i2c_runtime_resume(struct device *dev)
struct platform_device *pdev = to_platform_device(dev);
struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
- omap_i2c_unidle(_dev);
+ if (_dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
+ omap_i2c_write_reg(_dev, OMAP_I2C_CON_REG, 0);
+ omap_i2c_write_reg(_dev, OMAP_I2C_PSC_REG, _dev->pscstate);
+ omap_i2c_write_reg(_dev, OMAP_I2C_SCLL_REG, _dev->scllstate);
+ omap_i2c_write_reg(_dev, OMAP_I2C_SCLH_REG, _dev->sclhstate);
+ omap_i2c_write_reg(_dev, OMAP_I2C_BUF_REG, _dev->bufstate);
+ omap_i2c_write_reg(_dev, OMAP_I2C_SYSC_REG, _dev->syscstate);
+ omap_i2c_write_reg(_dev, OMAP_I2C_WE_REG, _dev->westate);
+ omap_i2c_write_reg(_dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
+ }
+
+ /*
+ * Don't write to this register if the IE state is 0 as it can
+ * cause deadlock.
+ */
+ if (_dev->iestate)
+ omap_i2c_write_reg(_dev, OMAP_I2C_IE_REG, _dev->iestate);
return 0;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 50+ messages in thread
* [PATCHv6 04/19] I2C: OMAP: I2C register restore only if context is lost
2012-04-10 10:56 ` Shubhrajyoti D
@ 2012-04-10 10:56 ` Shubhrajyoti D
-1 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti D @ 2012-04-10 10:56 UTC (permalink / raw)
To: linux-omap-u79uwXL29TY76Z2rM5mHXA
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, tony-4v6yS6AI5VpBDgjK7y7TUQ,
w.sang-bIcnvbaLZ9MEGnE8C9+IrQ, Shubhrajyoti D
Currently i2c register restore is done always.
Adding conditional restore.
The i2c register restore is done only if the context is lost.
Also remove the definition of SYSS_RESETDONE_MASK and use the
one in omap_hwmod.h.
Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
---
arch/arm/plat-omap/i2c.c | 3 ++
drivers/i2c/busses/i2c-omap.c | 52 ++++++++++++++++++++++++++--------------
include/linux/i2c-omap.h | 1 +
3 files changed, 38 insertions(+), 18 deletions(-)
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index db071bc..4ccab07 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -179,6 +179,9 @@ static inline int omap2_i2c_add_bus(int bus_id)
*/
if (cpu_is_omap34xx())
pdata->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat;
+
+ pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
+
pdev = omap_device_build(name, bus_id, oh, pdata,
sizeof(struct omap_i2c_bus_platform_data),
NULL, 0, 0);
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index a882558..45389db 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -43,6 +43,7 @@
#include <linux/slab.h>
#include <linux/i2c-omap.h>
#include <linux/pm_runtime.h>
+#include <plat/omap_device.h>
/* I2C controller revisions */
#define OMAP_I2C_OMAP1_REV_2 0x20
@@ -157,9 +158,6 @@ enum {
#define OMAP_I2C_SYSTEST_SDA_I (1 << 1) /* SDA line sense in */
#define OMAP_I2C_SYSTEST_SDA_O (1 << 0) /* SDA line drive out */
-/* OCP_SYSSTATUS bit definitions */
-#define SYSS_RESETDONE_MASK (1 << 0)
-
/* OCP_SYSCONFIG bit definitions */
#define SYSC_CLOCKACTIVITY_MASK (0x3 << 8)
#define SYSC_SIDLEMODE_MASK (0x3 << 3)
@@ -184,6 +182,7 @@ struct omap_i2c_dev {
u32 latency; /* maximum mpu wkup latency */
void (*set_mpu_wkup_lat)(struct device *dev,
long latency);
+ int (*get_context_loss_count)(struct device *dev);
u32 speed; /* Speed of bus in kHz */
u32 dtrev; /* extra revision from DT */
u32 flags;
@@ -206,6 +205,7 @@ struct omap_i2c_dev {
u16 syscstate;
u16 westate;
u16 errata;
+ int dev_lost_count;
};
static const u8 reg_map_ip_v1[] = {
@@ -1025,6 +1025,7 @@ omap_i2c_probe(struct platform_device *pdev)
dev->speed = pdata->clkrate;
dev->flags = pdata->flags;
dev->set_mpu_wkup_lat = pdata->set_mpu_wkup_lat;
+ dev->get_context_loss_count = pdata->get_context_loss_count;
dev->dtrev = pdata->rev;
}
@@ -1151,12 +1152,32 @@ omap_i2c_remove(struct platform_device *pdev)
}
#ifdef CONFIG_PM_RUNTIME
+static void omap_i2c_restore(struct omap_i2c_dev *dev)
+{
+ omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
+ omap_i2c_write_reg(dev, OMAP_I2C_PSC_REG, dev->pscstate);
+ omap_i2c_write_reg(dev, OMAP_I2C_SCLL_REG, dev->scllstate);
+ omap_i2c_write_reg(dev, OMAP_I2C_SCLH_REG, dev->sclhstate);
+ omap_i2c_write_reg(dev, OMAP_I2C_BUF_REG, dev->bufstate);
+ omap_i2c_write_reg(dev, OMAP_I2C_WE_REG, dev->westate);
+ omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
+ /*
+ * Don't write to this register if the IE state is 0 as it can
+ * cause deadlock.
+ */
+ if (dev->iestate)
+ omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
+
+}
static int omap_i2c_runtime_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
u16 iv;
+ if (_dev->get_context_loss_count)
+ _dev->dev_lost_count = _dev->get_context_loss_count(dev);
+
_dev->iestate = omap_i2c_read_reg(_dev, OMAP_I2C_IE_REG);
if (_dev->dtrev == OMAP_I2C_IP_VERSION_2)
omap_i2c_write_reg(_dev, OMAP_I2C_IP_V2_IRQENABLE_CLR, 1);
@@ -1179,24 +1200,19 @@ static int omap_i2c_runtime_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
+ int loss_cnt;
- if (_dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
- omap_i2c_write_reg(_dev, OMAP_I2C_CON_REG, 0);
- omap_i2c_write_reg(_dev, OMAP_I2C_PSC_REG, _dev->pscstate);
- omap_i2c_write_reg(_dev, OMAP_I2C_SCLL_REG, _dev->scllstate);
- omap_i2c_write_reg(_dev, OMAP_I2C_SCLH_REG, _dev->sclhstate);
- omap_i2c_write_reg(_dev, OMAP_I2C_BUF_REG, _dev->bufstate);
- omap_i2c_write_reg(_dev, OMAP_I2C_SYSC_REG, _dev->syscstate);
- omap_i2c_write_reg(_dev, OMAP_I2C_WE_REG, _dev->westate);
- omap_i2c_write_reg(_dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
+ if (_dev->get_context_loss_count) {
+ loss_cnt = _dev->get_context_loss_count(dev);
+ if (loss_cnt < 0)
+ return loss_cnt;
+
+ if (_dev->dev_lost_count == loss_cnt && _dev->dev_lost_count)
+ return 0;
}
- /*
- * Don't write to this register if the IE state is 0 as it can
- * cause deadlock.
- */
- if (_dev->iestate)
- omap_i2c_write_reg(_dev, OMAP_I2C_IE_REG, _dev->iestate);
+ if (_dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE)
+ omap_i2c_restore(_dev);
return 0;
}
diff --git a/include/linux/i2c-omap.h b/include/linux/i2c-omap.h
index 92a0dc7..c76cbc0 100644
--- a/include/linux/i2c-omap.h
+++ b/include/linux/i2c-omap.h
@@ -35,6 +35,7 @@ struct omap_i2c_bus_platform_data {
u32 rev;
u32 flags;
void (*set_mpu_wkup_lat)(struct device *dev, long set);
+ int (*get_context_loss_count)(struct device *dev);
};
#endif
--
1.7.4.1
^ permalink raw reply related [flat|nested] 50+ messages in thread* [PATCHv6 04/19] I2C: OMAP: I2C register restore only if context is lost
@ 2012-04-10 10:56 ` Shubhrajyoti D
0 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti D @ 2012-04-10 10:56 UTC (permalink / raw)
To: linux-arm-kernel
Currently i2c register restore is done always.
Adding conditional restore.
The i2c register restore is done only if the context is lost.
Also remove the definition of SYSS_RESETDONE_MASK and use the
one in omap_hwmod.h.
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
arch/arm/plat-omap/i2c.c | 3 ++
drivers/i2c/busses/i2c-omap.c | 52 ++++++++++++++++++++++++++--------------
include/linux/i2c-omap.h | 1 +
3 files changed, 38 insertions(+), 18 deletions(-)
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index db071bc..4ccab07 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -179,6 +179,9 @@ static inline int omap2_i2c_add_bus(int bus_id)
*/
if (cpu_is_omap34xx())
pdata->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat;
+
+ pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
+
pdev = omap_device_build(name, bus_id, oh, pdata,
sizeof(struct omap_i2c_bus_platform_data),
NULL, 0, 0);
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index a882558..45389db 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -43,6 +43,7 @@
#include <linux/slab.h>
#include <linux/i2c-omap.h>
#include <linux/pm_runtime.h>
+#include <plat/omap_device.h>
/* I2C controller revisions */
#define OMAP_I2C_OMAP1_REV_2 0x20
@@ -157,9 +158,6 @@ enum {
#define OMAP_I2C_SYSTEST_SDA_I (1 << 1) /* SDA line sense in */
#define OMAP_I2C_SYSTEST_SDA_O (1 << 0) /* SDA line drive out */
-/* OCP_SYSSTATUS bit definitions */
-#define SYSS_RESETDONE_MASK (1 << 0)
-
/* OCP_SYSCONFIG bit definitions */
#define SYSC_CLOCKACTIVITY_MASK (0x3 << 8)
#define SYSC_SIDLEMODE_MASK (0x3 << 3)
@@ -184,6 +182,7 @@ struct omap_i2c_dev {
u32 latency; /* maximum mpu wkup latency */
void (*set_mpu_wkup_lat)(struct device *dev,
long latency);
+ int (*get_context_loss_count)(struct device *dev);
u32 speed; /* Speed of bus in kHz */
u32 dtrev; /* extra revision from DT */
u32 flags;
@@ -206,6 +205,7 @@ struct omap_i2c_dev {
u16 syscstate;
u16 westate;
u16 errata;
+ int dev_lost_count;
};
static const u8 reg_map_ip_v1[] = {
@@ -1025,6 +1025,7 @@ omap_i2c_probe(struct platform_device *pdev)
dev->speed = pdata->clkrate;
dev->flags = pdata->flags;
dev->set_mpu_wkup_lat = pdata->set_mpu_wkup_lat;
+ dev->get_context_loss_count = pdata->get_context_loss_count;
dev->dtrev = pdata->rev;
}
@@ -1151,12 +1152,32 @@ omap_i2c_remove(struct platform_device *pdev)
}
#ifdef CONFIG_PM_RUNTIME
+static void omap_i2c_restore(struct omap_i2c_dev *dev)
+{
+ omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
+ omap_i2c_write_reg(dev, OMAP_I2C_PSC_REG, dev->pscstate);
+ omap_i2c_write_reg(dev, OMAP_I2C_SCLL_REG, dev->scllstate);
+ omap_i2c_write_reg(dev, OMAP_I2C_SCLH_REG, dev->sclhstate);
+ omap_i2c_write_reg(dev, OMAP_I2C_BUF_REG, dev->bufstate);
+ omap_i2c_write_reg(dev, OMAP_I2C_WE_REG, dev->westate);
+ omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
+ /*
+ * Don't write to this register if the IE state is 0 as it can
+ * cause deadlock.
+ */
+ if (dev->iestate)
+ omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
+
+}
static int omap_i2c_runtime_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
u16 iv;
+ if (_dev->get_context_loss_count)
+ _dev->dev_lost_count = _dev->get_context_loss_count(dev);
+
_dev->iestate = omap_i2c_read_reg(_dev, OMAP_I2C_IE_REG);
if (_dev->dtrev == OMAP_I2C_IP_VERSION_2)
omap_i2c_write_reg(_dev, OMAP_I2C_IP_V2_IRQENABLE_CLR, 1);
@@ -1179,24 +1200,19 @@ static int omap_i2c_runtime_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
+ int loss_cnt;
- if (_dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
- omap_i2c_write_reg(_dev, OMAP_I2C_CON_REG, 0);
- omap_i2c_write_reg(_dev, OMAP_I2C_PSC_REG, _dev->pscstate);
- omap_i2c_write_reg(_dev, OMAP_I2C_SCLL_REG, _dev->scllstate);
- omap_i2c_write_reg(_dev, OMAP_I2C_SCLH_REG, _dev->sclhstate);
- omap_i2c_write_reg(_dev, OMAP_I2C_BUF_REG, _dev->bufstate);
- omap_i2c_write_reg(_dev, OMAP_I2C_SYSC_REG, _dev->syscstate);
- omap_i2c_write_reg(_dev, OMAP_I2C_WE_REG, _dev->westate);
- omap_i2c_write_reg(_dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
+ if (_dev->get_context_loss_count) {
+ loss_cnt = _dev->get_context_loss_count(dev);
+ if (loss_cnt < 0)
+ return loss_cnt;
+
+ if (_dev->dev_lost_count == loss_cnt && _dev->dev_lost_count)
+ return 0;
}
- /*
- * Don't write to this register if the IE state is 0 as it can
- * cause deadlock.
- */
- if (_dev->iestate)
- omap_i2c_write_reg(_dev, OMAP_I2C_IE_REG, _dev->iestate);
+ if (_dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE)
+ omap_i2c_restore(_dev);
return 0;
}
diff --git a/include/linux/i2c-omap.h b/include/linux/i2c-omap.h
index 92a0dc7..c76cbc0 100644
--- a/include/linux/i2c-omap.h
+++ b/include/linux/i2c-omap.h
@@ -35,6 +35,7 @@ struct omap_i2c_bus_platform_data {
u32 rev;
u32 flags;
void (*set_mpu_wkup_lat)(struct device *dev, long set);
+ int (*get_context_loss_count)(struct device *dev);
};
#endif
--
1.7.4.1
^ permalink raw reply related [flat|nested] 50+ messages in thread
* [PATCHv6 07/19] I2C: OMAP: Optimise the remove code
2012-04-10 10:56 ` Shubhrajyoti D
@ 2012-04-10 10:56 ` Shubhrajyoti D
-1 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti D @ 2012-04-10 10:56 UTC (permalink / raw)
To: linux-omap-u79uwXL29TY76Z2rM5mHXA
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, tony-4v6yS6AI5VpBDgjK7y7TUQ,
w.sang-bIcnvbaLZ9MEGnE8C9+IrQ, Shubhrajyoti D
The omap_i2c_remove function may not be needed after
device exit so the memory could be freed.
Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
---
drivers/i2c/busses/i2c-omap.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 3670088..2096726 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1134,8 +1134,7 @@ err_release_region:
return r;
}
-static int
-omap_i2c_remove(struct platform_device *pdev)
+static int __devexit omap_i2c_remove(struct platform_device *pdev)
{
struct omap_i2c_dev *dev = platform_get_drvdata(pdev);
struct resource *mem;
@@ -1228,7 +1227,7 @@ static struct dev_pm_ops omap_i2c_pm_ops = {
static struct platform_driver omap_i2c_driver = {
.probe = omap_i2c_probe,
- .remove = omap_i2c_remove,
+ .remove = __devexit_p(omap_i2c_remove),
.driver = {
.name = "omap_i2c",
.owner = THIS_MODULE,
--
1.7.4.1
^ permalink raw reply related [flat|nested] 50+ messages in thread* [PATCHv6 07/19] I2C: OMAP: Optimise the remove code
@ 2012-04-10 10:56 ` Shubhrajyoti D
0 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti D @ 2012-04-10 10:56 UTC (permalink / raw)
To: linux-arm-kernel
The omap_i2c_remove function may not be needed after
device exit so the memory could be freed.
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
drivers/i2c/busses/i2c-omap.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 3670088..2096726 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1134,8 +1134,7 @@ err_release_region:
return r;
}
-static int
-omap_i2c_remove(struct platform_device *pdev)
+static int __devexit omap_i2c_remove(struct platform_device *pdev)
{
struct omap_i2c_dev *dev = platform_get_drvdata(pdev);
struct resource *mem;
@@ -1228,7 +1227,7 @@ static struct dev_pm_ops omap_i2c_pm_ops = {
static struct platform_driver omap_i2c_driver = {
.probe = omap_i2c_probe,
- .remove = omap_i2c_remove,
+ .remove = __devexit_p(omap_i2c_remove),
.driver = {
.name = "omap_i2c",
.owner = THIS_MODULE,
--
1.7.4.1
^ permalink raw reply related [flat|nested] 50+ messages in thread
* [PATCHv6 08/19] I2C: OMAP: Fix the error handling
2012-04-10 10:56 ` Shubhrajyoti D
@ 2012-04-10 10:56 ` Shubhrajyoti D
-1 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti D @ 2012-04-10 10:56 UTC (permalink / raw)
To: linux-omap-u79uwXL29TY76Z2rM5mHXA
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, tony-4v6yS6AI5VpBDgjK7y7TUQ,
w.sang-bIcnvbaLZ9MEGnE8C9+IrQ, Shubhrajyoti D
Currently in probe
pm_runtime_put(dev->dev);
...
/* i2c device drivers may be active on return from add_adapter() */
adap->nr = pdev->id;
r = i2c_add_numbered_adapter(adap);
if (r) {
dev_err(dev->dev, "failure adding adapter\n");
goto err_free_irq;
}
...
return 0;
err_free_irq:
free_irq(dev->irq, dev);
err_unuse_clocks:
omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
pm_runtime_put(dev->dev);
This may access the i2c registers without the clocks.
Attempting to fix the same by moving the pm_rintime_put after the error check.
Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
---
drivers/i2c/busses/i2c-omap.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 2096726..a461097 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1095,8 +1095,6 @@ omap_i2c_probe(struct platform_device *pdev)
dev_info(dev->dev, "bus %d rev%d.%d.%d at %d kHz\n", pdev->id,
dev->dtrev, dev->rev >> 4, dev->rev & 0xf, dev->speed);
- pm_runtime_put(dev->dev);
-
adap = &dev->adapter;
i2c_set_adapdata(adap, dev);
adap->owner = THIS_MODULE;
@@ -1116,6 +1114,8 @@ omap_i2c_probe(struct platform_device *pdev)
of_i2c_register_devices(adap);
+ pm_runtime_put(dev->dev);
+
return 0;
err_free_irq:
--
1.7.4.1
^ permalink raw reply related [flat|nested] 50+ messages in thread* [PATCHv6 08/19] I2C: OMAP: Fix the error handling
@ 2012-04-10 10:56 ` Shubhrajyoti D
0 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti D @ 2012-04-10 10:56 UTC (permalink / raw)
To: linux-arm-kernel
Currently in probe
pm_runtime_put(dev->dev);
...
/* i2c device drivers may be active on return from add_adapter() */
adap->nr = pdev->id;
r = i2c_add_numbered_adapter(adap);
if (r) {
dev_err(dev->dev, "failure adding adapter\n");
goto err_free_irq;
}
...
return 0;
err_free_irq:
free_irq(dev->irq, dev);
err_unuse_clocks:
omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
pm_runtime_put(dev->dev);
This may access the i2c registers without the clocks.
Attempting to fix the same by moving the pm_rintime_put after the error check.
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
drivers/i2c/busses/i2c-omap.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 2096726..a461097 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1095,8 +1095,6 @@ omap_i2c_probe(struct platform_device *pdev)
dev_info(dev->dev, "bus %d rev%d.%d.%d at %d kHz\n", pdev->id,
dev->dtrev, dev->rev >> 4, dev->rev & 0xf, dev->speed);
- pm_runtime_put(dev->dev);
-
adap = &dev->adapter;
i2c_set_adapdata(adap, dev);
adap->owner = THIS_MODULE;
@@ -1116,6 +1114,8 @@ omap_i2c_probe(struct platform_device *pdev)
of_i2c_register_devices(adap);
+ pm_runtime_put(dev->dev);
+
return 0;
err_free_irq:
--
1.7.4.1
^ permalink raw reply related [flat|nested] 50+ messages in thread
* [PATCHv6 11/19] I2C: OMAP: use devm_* functions
2012-04-10 10:56 ` Shubhrajyoti D
@ 2012-04-10 10:56 ` Shubhrajyoti D
-1 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti D @ 2012-04-10 10:56 UTC (permalink / raw)
To: linux-omap-u79uwXL29TY76Z2rM5mHXA
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, tony-4v6yS6AI5VpBDgjK7y7TUQ,
w.sang-bIcnvbaLZ9MEGnE8C9+IrQ, Shubhrajyoti D
The various devm_ functions allocate memory that is released when a driver
detaches. This patch uses devm_kzalloc, devm_request_mem_region and
devm_ioremap for data that is allocated in the probe function of a platform
device and is only freed in the remove function.
Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
---
drivers/i2c/busses/i2c-omap.c | 29 +++++++++--------------------
1 files changed, 9 insertions(+), 20 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 121c52e..86be475 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -995,17 +995,17 @@ omap_i2c_probe(struct platform_device *pdev)
return -ENODEV;
}
- ioarea = request_mem_region(mem->start, resource_size(mem),
- pdev->name);
+ ioarea = devm_request_mem_region(&pdev->dev, mem->start,
+ resource_size(mem), pdev->name);
if (!ioarea) {
dev_err(&pdev->dev, "I2C region already claimed\n");
return -EBUSY;
}
- dev = kzalloc(sizeof(struct omap_i2c_dev), GFP_KERNEL);
+ dev = devm_kzalloc(&pdev->dev, sizeof(struct omap_i2c_dev), GFP_KERNEL);
if (!dev) {
- r = -ENOMEM;
- goto err_release_region;
+ dev_err(&pdev->dev, "Menory allocation failed\n");
+ return -ENOMEM;
}
match = of_match_device(of_match_ptr(omap_i2c_of_match), &pdev->dev);
@@ -1029,11 +1029,10 @@ omap_i2c_probe(struct platform_device *pdev)
dev->dev = &pdev->dev;
dev->irq = irq->start;
- dev->base = ioremap(mem->start, resource_size(mem));
- if (!dev->base) {
- r = -ENOMEM;
- goto err_free_mem;
- }
+ dev->base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem));
+ if (!dev->base)
+ return -ENOMEM;
+
platform_set_drvdata(pdev, dev);
@@ -1121,13 +1120,8 @@ err_free_irq:
err_unuse_clocks:
omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
pm_runtime_put(dev->dev);
- iounmap(dev->base);
pm_runtime_disable(&pdev->dev);
-err_free_mem:
platform_set_drvdata(pdev, NULL);
- kfree(dev);
-err_release_region:
- release_mem_region(mem->start, resource_size(mem));
return r;
}
@@ -1135,7 +1129,6 @@ err_release_region:
static int __devexit omap_i2c_remove(struct platform_device *pdev)
{
struct omap_i2c_dev *dev = platform_get_drvdata(pdev);
- struct resource *mem;
platform_set_drvdata(pdev, NULL);
@@ -1143,10 +1136,6 @@ static int __devexit omap_i2c_remove(struct platform_device *pdev)
i2c_del_adapter(&dev->adapter);
omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
pm_runtime_disable(&pdev->dev);
- iounmap(dev->base);
- kfree(dev);
- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- release_mem_region(mem->start, resource_size(mem));
return 0;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 50+ messages in thread* [PATCHv6 11/19] I2C: OMAP: use devm_* functions
@ 2012-04-10 10:56 ` Shubhrajyoti D
0 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti D @ 2012-04-10 10:56 UTC (permalink / raw)
To: linux-arm-kernel
The various devm_ functions allocate memory that is released when a driver
detaches. This patch uses devm_kzalloc, devm_request_mem_region and
devm_ioremap for data that is allocated in the probe function of a platform
device and is only freed in the remove function.
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
drivers/i2c/busses/i2c-omap.c | 29 +++++++++--------------------
1 files changed, 9 insertions(+), 20 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 121c52e..86be475 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -995,17 +995,17 @@ omap_i2c_probe(struct platform_device *pdev)
return -ENODEV;
}
- ioarea = request_mem_region(mem->start, resource_size(mem),
- pdev->name);
+ ioarea = devm_request_mem_region(&pdev->dev, mem->start,
+ resource_size(mem), pdev->name);
if (!ioarea) {
dev_err(&pdev->dev, "I2C region already claimed\n");
return -EBUSY;
}
- dev = kzalloc(sizeof(struct omap_i2c_dev), GFP_KERNEL);
+ dev = devm_kzalloc(&pdev->dev, sizeof(struct omap_i2c_dev), GFP_KERNEL);
if (!dev) {
- r = -ENOMEM;
- goto err_release_region;
+ dev_err(&pdev->dev, "Menory allocation failed\n");
+ return -ENOMEM;
}
match = of_match_device(of_match_ptr(omap_i2c_of_match), &pdev->dev);
@@ -1029,11 +1029,10 @@ omap_i2c_probe(struct platform_device *pdev)
dev->dev = &pdev->dev;
dev->irq = irq->start;
- dev->base = ioremap(mem->start, resource_size(mem));
- if (!dev->base) {
- r = -ENOMEM;
- goto err_free_mem;
- }
+ dev->base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem));
+ if (!dev->base)
+ return -ENOMEM;
+
platform_set_drvdata(pdev, dev);
@@ -1121,13 +1120,8 @@ err_free_irq:
err_unuse_clocks:
omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
pm_runtime_put(dev->dev);
- iounmap(dev->base);
pm_runtime_disable(&pdev->dev);
-err_free_mem:
platform_set_drvdata(pdev, NULL);
- kfree(dev);
-err_release_region:
- release_mem_region(mem->start, resource_size(mem));
return r;
}
@@ -1135,7 +1129,6 @@ err_release_region:
static int __devexit omap_i2c_remove(struct platform_device *pdev)
{
struct omap_i2c_dev *dev = platform_get_drvdata(pdev);
- struct resource *mem;
platform_set_drvdata(pdev, NULL);
@@ -1143,10 +1136,6 @@ static int __devexit omap_i2c_remove(struct platform_device *pdev)
i2c_del_adapter(&dev->adapter);
omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
pm_runtime_disable(&pdev->dev);
- iounmap(dev->base);
- kfree(dev);
- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- release_mem_region(mem->start, resource_size(mem));
return 0;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 50+ messages in thread
* [PATCHv6 14/19] I2C: OMAP: Use SET_RUNTIME_PM_OPS
2012-04-10 10:56 ` Shubhrajyoti D
@ 2012-04-10 10:56 ` Shubhrajyoti D
-1 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti D @ 2012-04-10 10:56 UTC (permalink / raw)
To: linux-omap-u79uwXL29TY76Z2rM5mHXA
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, tony-4v6yS6AI5VpBDgjK7y7TUQ,
w.sang-bIcnvbaLZ9MEGnE8C9+IrQ, Shubhrajyoti D
Use SET_RUNTIME_PM_OPS macro to set runtime functions.
Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
---
drivers/i2c/busses/i2c-omap.c | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 95f1b2f..a5b1ec1 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1211,15 +1211,12 @@ static int omap_i2c_runtime_resume(struct device *dev)
return 0;
}
+#endif
static struct dev_pm_ops omap_i2c_pm_ops = {
- .runtime_suspend = omap_i2c_runtime_suspend,
- .runtime_resume = omap_i2c_runtime_resume,
+ SET_RUNTIME_PM_OPS(omap_i2c_runtime_suspend,
+ omap_i2c_runtime_resume, NULL)
};
-#define OMAP_I2C_PM_OPS (&omap_i2c_pm_ops)
-#else
-#define OMAP_I2C_PM_OPS NULL
-#endif
static struct platform_driver omap_i2c_driver = {
.probe = omap_i2c_probe,
@@ -1227,7 +1224,7 @@ static struct platform_driver omap_i2c_driver = {
.driver = {
.name = "omap_i2c",
.owner = THIS_MODULE,
- .pm = OMAP_I2C_PM_OPS,
+ .pm = &omap_i2c_pm_ops,
.of_match_table = of_match_ptr(omap_i2c_of_match),
},
};
--
1.7.4.1
^ permalink raw reply related [flat|nested] 50+ messages in thread* [PATCHv6 14/19] I2C: OMAP: Use SET_RUNTIME_PM_OPS
@ 2012-04-10 10:56 ` Shubhrajyoti D
0 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti D @ 2012-04-10 10:56 UTC (permalink / raw)
To: linux-arm-kernel
Use SET_RUNTIME_PM_OPS macro to set runtime functions.
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
drivers/i2c/busses/i2c-omap.c | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 95f1b2f..a5b1ec1 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1211,15 +1211,12 @@ static int omap_i2c_runtime_resume(struct device *dev)
return 0;
}
+#endif
static struct dev_pm_ops omap_i2c_pm_ops = {
- .runtime_suspend = omap_i2c_runtime_suspend,
- .runtime_resume = omap_i2c_runtime_resume,
+ SET_RUNTIME_PM_OPS(omap_i2c_runtime_suspend,
+ omap_i2c_runtime_resume, NULL)
};
-#define OMAP_I2C_PM_OPS (&omap_i2c_pm_ops)
-#else
-#define OMAP_I2C_PM_OPS NULL
-#endif
static struct platform_driver omap_i2c_driver = {
.probe = omap_i2c_probe,
@@ -1227,7 +1224,7 @@ static struct platform_driver omap_i2c_driver = {
.driver = {
.name = "omap_i2c",
.owner = THIS_MODULE,
- .pm = OMAP_I2C_PM_OPS,
+ .pm = &omap_i2c_pm_ops,
.of_match_table = of_match_ptr(omap_i2c_of_match),
},
};
--
1.7.4.1
^ permalink raw reply related [flat|nested] 50+ messages in thread
* [PATCHv6 15/19] I2C: OMAP: make the read ready processing a separate function
2012-04-10 10:56 ` Shubhrajyoti D
@ 2012-04-10 10:56 ` Shubhrajyoti D
-1 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti D @ 2012-04-10 10:56 UTC (permalink / raw)
To: linux-omap-u79uwXL29TY76Z2rM5mHXA
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, tony-4v6yS6AI5VpBDgjK7y7TUQ,
w.sang-bIcnvbaLZ9MEGnE8C9+IrQ, Shubhrajyoti D
No functional change. Makes the read ready processing a separate
function. This is to avoid extremely long level of indentation.
Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
---
drivers/i2c/busses/i2c-omap.c | 86 +++++++++++++++++++++-------------------
1 files changed, 45 insertions(+), 41 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index a5b1ec1..c113f41 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -784,6 +784,49 @@ static int errata_omap3_1p153(struct omap_i2c_dev *dev, u16 *stat, int *err)
return 0;
}
+static int process_read_rdy(struct omap_i2c_dev *dev)
+{
+ u8 num_bytes = 1;
+ u16 stat, w;
+
+ if (dev->errata & I2C_OMAP_ERRATA_I207)
+ i2c_omap_errata_i207(dev, stat);
+
+ if (dev->fifo_size) {
+ if (stat & OMAP_I2C_STAT_RRDY)
+ num_bytes = dev->fifo_size;
+ else /* read RXSTAT on RDR interrupt */
+ num_bytes = (omap_i2c_read_reg(dev,
+ OMAP_I2C_BUFSTAT_REG) >> 8) & 0x3F;
+ }
+ while (num_bytes) {
+ num_bytes--;
+ w = omap_i2c_read_reg(dev, OMAP_I2C_DATA_REG);
+ if (dev->buf_len) {
+ *dev->buf++ = w;
+ dev->buf_len--;
+ /*
+ * Data reg in 2430, omap3 and omap4 is 8 bit wide
+ */
+ if (dev->flags & OMAP_I2C_FLAG_16BIT_DATA_REG) {
+ if (dev->buf_len) {
+ *dev->buf++ = w >> 8;
+ dev->buf_len--;
+ }
+ }
+ } else {
+ if (stat & OMAP_I2C_STAT_RRDY)
+ dev_err(dev->dev,
+ "RRDY IRQ while no data requested\n");
+ if (stat & OMAP_I2C_STAT_RDR)
+ dev_err(dev->dev,
+ "RDR IRQ while no data requested\n");
+ return -EIO;
+ }
+ }
+ return 0;
+}
+
static irqreturn_t
omap_i2c_isr(int this_irq, void *dev_id)
{
@@ -834,48 +877,9 @@ complete:
return IRQ_HANDLED;
}
if (stat & (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR)) {
- u8 num_bytes = 1;
-
- if (dev->errata & I2C_OMAP_ERRATA_I207)
- i2c_omap_errata_i207(dev, stat);
+ if (process_read_rdy(dev) == -EIO)
+ break;
- if (dev->fifo_size) {
- if (stat & OMAP_I2C_STAT_RRDY)
- num_bytes = dev->fifo_size;
- else /* read RXSTAT on RDR interrupt */
- num_bytes = (omap_i2c_read_reg(dev,
- OMAP_I2C_BUFSTAT_REG)
- >> 8) & 0x3F;
- }
- while (num_bytes) {
- num_bytes--;
- w = omap_i2c_read_reg(dev, OMAP_I2C_DATA_REG);
- if (dev->buf_len) {
- *dev->buf++ = w;
- dev->buf_len--;
- /*
- * Data reg in 2430, omap3 and
- * omap4 is 8 bit wide
- */
- if (dev->flags &
- OMAP_I2C_FLAG_16BIT_DATA_REG) {
- if (dev->buf_len) {
- *dev->buf++ = w >> 8;
- dev->buf_len--;
- }
- }
- } else {
- if (stat & OMAP_I2C_STAT_RRDY)
- dev_err(dev->dev,
- "RRDY IRQ while no data"
- " requested\n");
- if (stat & OMAP_I2C_STAT_RDR)
- dev_err(dev->dev,
- "RDR IRQ while no data"
- " requested\n");
- break;
- }
- }
omap_i2c_ack_stat(dev,
stat & (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR));
continue;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 50+ messages in thread* [PATCHv6 15/19] I2C: OMAP: make the read ready processing a separate function
@ 2012-04-10 10:56 ` Shubhrajyoti D
0 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti D @ 2012-04-10 10:56 UTC (permalink / raw)
To: linux-arm-kernel
No functional change. Makes the read ready processing a separate
function. This is to avoid extremely long level of indentation.
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
drivers/i2c/busses/i2c-omap.c | 86 +++++++++++++++++++++-------------------
1 files changed, 45 insertions(+), 41 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index a5b1ec1..c113f41 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -784,6 +784,49 @@ static int errata_omap3_1p153(struct omap_i2c_dev *dev, u16 *stat, int *err)
return 0;
}
+static int process_read_rdy(struct omap_i2c_dev *dev)
+{
+ u8 num_bytes = 1;
+ u16 stat, w;
+
+ if (dev->errata & I2C_OMAP_ERRATA_I207)
+ i2c_omap_errata_i207(dev, stat);
+
+ if (dev->fifo_size) {
+ if (stat & OMAP_I2C_STAT_RRDY)
+ num_bytes = dev->fifo_size;
+ else /* read RXSTAT on RDR interrupt */
+ num_bytes = (omap_i2c_read_reg(dev,
+ OMAP_I2C_BUFSTAT_REG) >> 8) & 0x3F;
+ }
+ while (num_bytes) {
+ num_bytes--;
+ w = omap_i2c_read_reg(dev, OMAP_I2C_DATA_REG);
+ if (dev->buf_len) {
+ *dev->buf++ = w;
+ dev->buf_len--;
+ /*
+ * Data reg in 2430, omap3 and omap4 is 8 bit wide
+ */
+ if (dev->flags & OMAP_I2C_FLAG_16BIT_DATA_REG) {
+ if (dev->buf_len) {
+ *dev->buf++ = w >> 8;
+ dev->buf_len--;
+ }
+ }
+ } else {
+ if (stat & OMAP_I2C_STAT_RRDY)
+ dev_err(dev->dev,
+ "RRDY IRQ while no data requested\n");
+ if (stat & OMAP_I2C_STAT_RDR)
+ dev_err(dev->dev,
+ "RDR IRQ while no data requested\n");
+ return -EIO;
+ }
+ }
+ return 0;
+}
+
static irqreturn_t
omap_i2c_isr(int this_irq, void *dev_id)
{
@@ -834,48 +877,9 @@ complete:
return IRQ_HANDLED;
}
if (stat & (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR)) {
- u8 num_bytes = 1;
-
- if (dev->errata & I2C_OMAP_ERRATA_I207)
- i2c_omap_errata_i207(dev, stat);
+ if (process_read_rdy(dev) == -EIO)
+ break;
- if (dev->fifo_size) {
- if (stat & OMAP_I2C_STAT_RRDY)
- num_bytes = dev->fifo_size;
- else /* read RXSTAT on RDR interrupt */
- num_bytes = (omap_i2c_read_reg(dev,
- OMAP_I2C_BUFSTAT_REG)
- >> 8) & 0x3F;
- }
- while (num_bytes) {
- num_bytes--;
- w = omap_i2c_read_reg(dev, OMAP_I2C_DATA_REG);
- if (dev->buf_len) {
- *dev->buf++ = w;
- dev->buf_len--;
- /*
- * Data reg in 2430, omap3 and
- * omap4 is 8 bit wide
- */
- if (dev->flags &
- OMAP_I2C_FLAG_16BIT_DATA_REG) {
- if (dev->buf_len) {
- *dev->buf++ = w >> 8;
- dev->buf_len--;
- }
- }
- } else {
- if (stat & OMAP_I2C_STAT_RRDY)
- dev_err(dev->dev,
- "RRDY IRQ while no data"
- " requested\n");
- if (stat & OMAP_I2C_STAT_RDR)
- dev_err(dev->dev,
- "RDR IRQ while no data"
- " requested\n");
- break;
- }
- }
omap_i2c_ack_stat(dev,
stat & (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR));
continue;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 50+ messages in thread
* [PATCHv6 16/19] I2C: OMAP: fix missing handling of errata I2C_OMAP3_1P153
2012-04-10 10:56 ` Shubhrajyoti D
@ 2012-04-10 10:56 ` Shubhrajyoti D
-1 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti D @ 2012-04-10 10:56 UTC (permalink / raw)
To: linux-omap-u79uwXL29TY76Z2rM5mHXA
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, tony-4v6yS6AI5VpBDgjK7y7TUQ,
w.sang-bIcnvbaLZ9MEGnE8C9+IrQ, Tasslehoff Kjappfot,
Shubhrajyoti D
From: Tasslehoff Kjappfot <tasskjapp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
i2c_probe set the dev->errata flag, but omap_i2c_init cleared the flag again.
Move the errata handling to i2c_probe.
Signed-off-by: Tasslehoff Kjappfot <tasskjapp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
---
drivers/i2c/busses/i2c-omap.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index c113f41..51576d6 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -431,11 +431,6 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
/* Take the I2C module out of reset: */
omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
- dev->errata = 0;
-
- if (dev->flags & OMAP_I2C_FLAG_APPLY_ERRATA_I207)
- dev->errata |= I2C_OMAP_ERRATA_I207;
-
/* Enable interrupts */
dev->iestate = (OMAP_I2C_IE_XRDY | OMAP_I2C_IE_RRDY |
OMAP_I2C_IE_ARDY | OMAP_I2C_IE_NACK |
@@ -1056,6 +1051,11 @@ omap_i2c_probe(struct platform_device *pdev)
dev->rev = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) & 0xff;
+ dev->errata = 0;
+
+ if (dev->flags & OMAP_I2C_FLAG_APPLY_ERRATA_I207)
+ dev->errata |= I2C_OMAP_ERRATA_I207;
+
if (dev->rev <= OMAP_I2C_REV_ON_3430_3530)
dev->errata |= I2C_OMAP3_1P153;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 50+ messages in thread
* [PATCHv6 16/19] I2C: OMAP: fix missing handling of errata I2C_OMAP3_1P153
@ 2012-04-10 10:56 ` Shubhrajyoti D
0 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti D @ 2012-04-10 10:56 UTC (permalink / raw)
To: linux-arm-kernel
From: Tasslehoff Kjappfot <tasskjapp@gmail.com>
i2c_probe set the dev->errata flag, but omap_i2c_init cleared the flag again.
Move the errata handling to i2c_probe.
Signed-off-by: Tasslehoff Kjappfot <tasskjapp@gmail.com>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
drivers/i2c/busses/i2c-omap.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index c113f41..51576d6 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -431,11 +431,6 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
/* Take the I2C module out of reset: */
omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
- dev->errata = 0;
-
- if (dev->flags & OMAP_I2C_FLAG_APPLY_ERRATA_I207)
- dev->errata |= I2C_OMAP_ERRATA_I207;
-
/* Enable interrupts */
dev->iestate = (OMAP_I2C_IE_XRDY | OMAP_I2C_IE_RRDY |
OMAP_I2C_IE_ARDY | OMAP_I2C_IE_NACK |
@@ -1056,6 +1051,11 @@ omap_i2c_probe(struct platform_device *pdev)
dev->rev = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) & 0xff;
+ dev->errata = 0;
+
+ if (dev->flags & OMAP_I2C_FLAG_APPLY_ERRATA_I207)
+ dev->errata |= I2C_OMAP_ERRATA_I207;
+
if (dev->rev <= OMAP_I2C_REV_ON_3430_3530)
dev->errata |= I2C_OMAP3_1P153;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 50+ messages in thread
* [PATCHv6 19/19] ARM: OMAP4: hwmod data: I2C: add flag for context restore
2012-04-10 10:56 ` Shubhrajyoti D
@ 2012-04-10 10:56 ` Shubhrajyoti D
-1 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti D @ 2012-04-10 10:56 UTC (permalink / raw)
To: linux-omap-u79uwXL29TY76Z2rM5mHXA
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, tony-4v6yS6AI5VpBDgjK7y7TUQ,
w.sang-bIcnvbaLZ9MEGnE8C9+IrQ, Shubhrajyoti D, Benoit Cousson,
Paul Wamsley
Restore of context is not done for OMAP4. This patch
adds the OMAP_I2C_FLAG_RESET_REGS_POSTIDLE in the OMAP4
hwmod data which activates the restore for OMAP4.
Currently the OMAP4 does not hit device off still the
driver may have support for it.
Cc: Benoit Cousson <b-cousson-l0cyMroinI0@public.gmane.org>
Cc: Paul Wamsley <paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org>
Reviewed-by: Kevin Hilman <khilman-l0cyMroinI0@public.gmane.org>
Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
---
arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 08daa5e..cddce60 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -2262,7 +2262,8 @@ static struct omap_hwmod_class omap44xx_i2c_hwmod_class = {
};
static struct omap_i2c_dev_attr i2c_dev_attr = {
- .flags = OMAP_I2C_FLAG_BUS_SHIFT_NONE,
+ .flags = OMAP_I2C_FLAG_BUS_SHIFT_NONE |
+ OMAP_I2C_FLAG_RESET_REGS_POSTIDLE,
};
/* i2c1 */
--
1.7.4.1
^ permalink raw reply related [flat|nested] 50+ messages in thread* [PATCHv6 19/19] ARM: OMAP4: hwmod data: I2C: add flag for context restore
@ 2012-04-10 10:56 ` Shubhrajyoti D
0 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti D @ 2012-04-10 10:56 UTC (permalink / raw)
To: linux-arm-kernel
Restore of context is not done for OMAP4. This patch
adds the OMAP_I2C_FLAG_RESET_REGS_POSTIDLE in the OMAP4
hwmod data which activates the restore for OMAP4.
Currently the OMAP4 does not hit device off still the
driver may have support for it.
Cc: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Wamsley <paul@pwsan.com>
Reviewed-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 08daa5e..cddce60 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -2262,7 +2262,8 @@ static struct omap_hwmod_class omap44xx_i2c_hwmod_class = {
};
static struct omap_i2c_dev_attr i2c_dev_attr = {
- .flags = OMAP_I2C_FLAG_BUS_SHIFT_NONE,
+ .flags = OMAP_I2C_FLAG_BUS_SHIFT_NONE |
+ OMAP_I2C_FLAG_RESET_REGS_POSTIDLE,
};
/* i2c1 */
--
1.7.4.1
^ permalink raw reply related [flat|nested] 50+ messages in thread* Re: [PATCHv6 19/19] ARM: OMAP4: hwmod data: I2C: add flag for context restore
2012-04-10 10:56 ` Shubhrajyoti D
@ 2012-04-10 18:13 ` Paul Walmsley
-1 siblings, 0 replies; 50+ messages in thread
From: Paul Walmsley @ 2012-04-10 18:13 UTC (permalink / raw)
To: Shubhrajyoti D
Cc: linux-omap, linux-i2c, linux-arm-kernel, ben-linux, tony, w.sang,
Benoit Cousson
On Tue, 10 Apr 2012, Shubhrajyoti D wrote:
> Restore of context is not done for OMAP4. This patch
> adds the OMAP_I2C_FLAG_RESET_REGS_POSTIDLE in the OMAP4
> hwmod data which activates the restore for OMAP4.
> Currently the OMAP4 does not hit device off still the
> driver may have support for it.
>
> Cc: Benoit Cousson <b-cousson@ti.com>
> Cc: Paul Wamsley <paul@pwsan.com>
> Reviewed-by: Kevin Hilman <khilman@ti.com>
> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Thanks, queued for 3.5. You can drop this from your series; it will
likely cause merge conflicts if you don't.
- Paul
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCHv6 19/19] ARM: OMAP4: hwmod data: I2C: add flag for context restore
@ 2012-04-10 18:13 ` Paul Walmsley
0 siblings, 0 replies; 50+ messages in thread
From: Paul Walmsley @ 2012-04-10 18:13 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, 10 Apr 2012, Shubhrajyoti D wrote:
> Restore of context is not done for OMAP4. This patch
> adds the OMAP_I2C_FLAG_RESET_REGS_POSTIDLE in the OMAP4
> hwmod data which activates the restore for OMAP4.
> Currently the OMAP4 does not hit device off still the
> driver may have support for it.
>
> Cc: Benoit Cousson <b-cousson@ti.com>
> Cc: Paul Wamsley <paul@pwsan.com>
> Reviewed-by: Kevin Hilman <khilman@ti.com>
> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Thanks, queued for 3.5. You can drop this from your series; it will
likely cause merge conflicts if you don't.
- Paul
^ permalink raw reply [flat|nested] 50+ messages in thread
[parent not found: <alpine.DEB.2.00.1204101212530.20894-rwI8Ez+7Ko+d5PgPZx9QOdBPR1lH4CV8@public.gmane.org>]
* Re: [PATCHv6 19/19] ARM: OMAP4: hwmod data: I2C: add flag for context restore
2012-04-10 18:13 ` Paul Walmsley
@ 2012-04-11 5:40 ` Shubhrajyoti
-1 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti @ 2012-04-11 5:40 UTC (permalink / raw)
To: Paul Walmsley
Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, tony-4v6yS6AI5VpBDgjK7y7TUQ,
w.sang-bIcnvbaLZ9MEGnE8C9+IrQ, Benoit Cousson
On Tuesday 10 April 2012 11:43 PM, Paul Walmsley wrote:
> On Tue, 10 Apr 2012, Shubhrajyoti D wrote:
>
>> Restore of context is not done for OMAP4. This patch
>> adds the OMAP_I2C_FLAG_RESET_REGS_POSTIDLE in the OMAP4
>> hwmod data which activates the restore for OMAP4.
>> Currently the OMAP4 does not hit device off still the
>> driver may have support for it.
>>
>> Cc: Benoit Cousson <b-cousson-l0cyMroinI0@public.gmane.org>
>> Cc: Paul Wamsley <paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org>
>> Reviewed-by: Kevin Hilman <khilman-l0cyMroinI0@public.gmane.org>
>> Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
> Thanks, queued for 3.5. You can drop this from your series; it will
> likely cause merge conflicts if you don't.
Thanks Paul.
Will drop this patch and resend.
> - Paul
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCHv6 19/19] ARM: OMAP4: hwmod data: I2C: add flag for context restore
@ 2012-04-11 5:40 ` Shubhrajyoti
0 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti @ 2012-04-11 5:40 UTC (permalink / raw)
To: linux-arm-kernel
On Tuesday 10 April 2012 11:43 PM, Paul Walmsley wrote:
> On Tue, 10 Apr 2012, Shubhrajyoti D wrote:
>
>> Restore of context is not done for OMAP4. This patch
>> adds the OMAP_I2C_FLAG_RESET_REGS_POSTIDLE in the OMAP4
>> hwmod data which activates the restore for OMAP4.
>> Currently the OMAP4 does not hit device off still the
>> driver may have support for it.
>>
>> Cc: Benoit Cousson <b-cousson@ti.com>
>> Cc: Paul Wamsley <paul@pwsan.com>
>> Reviewed-by: Kevin Hilman <khilman@ti.com>
>> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
> Thanks, queued for 3.5. You can drop this from your series; it will
> likely cause merge conflicts if you don't.
Thanks Paul.
Will drop this patch and resend.
> - Paul
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 00/19] I2C updates
2012-04-10 10:56 ` Shubhrajyoti D
@ 2012-04-10 11:31 ` S, Venkatraman
-1 siblings, 0 replies; 50+ messages in thread
From: S, Venkatraman @ 2012-04-10 11:31 UTC (permalink / raw)
To: Shubhrajyoti D
Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, tony-4v6yS6AI5VpBDgjK7y7TUQ,
w.sang-bIcnvbaLZ9MEGnE8C9+IrQ, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
ben-linux-elnMNo+KYs3YtjvyW6yDsg,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
On Tue, Apr 10, 2012 at 4:26 PM, Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org> wrote:
> The patch series does the following
>
> - Warn fixes if CONFIG_PM_RUNTIME is not selected.
> - I2C register restore only if context if the context is lost
> - Bus busy recovery mechanism.
> - the reset is not done in init.
>
> v2 changes
> -Adds a patch to use devm_* functions
> -Also checks the return type of the get_sync and in case
> of errors prevents register access.
> - In case of i2c remove register access was done without any
> get_sync fix the same.
> - Adds a pdata function pointer to do context save restore
>
> v3 changes
> - Split the omap_i2c_isr to increase readability
> - Adds the restore flag patch for OMAP4 to the series
> - Make the i2c use SET_RUNTIME_PM_OPS
> v4 changes
> - Folds a patch from Tasslehoff to prevent any merge conflicts.
> - Prevents the XDUF flag to be set if the underflow condition is not met.
>
> v5 changes
> - Add consistency in the subject naming.
>
> v6 changes
> - As per discussion in [1] .Adds a patch to rename the 1p153 errata and
> use the unique id instead as the section number in the recent errata
> docs has changed.
>
>
> [1] http://www.spinics.net/lists/linux-i2c/msg07607.html
>
> Tested on omap4sdp and omap3sdp.
>
>
> The following changes since commit 258f742635360175564e9470eb060ff4d4b984e7:
>
> modpost: Fix modpost license checking of vmlinux.o (2012-04-09 20:52:56 -0700)
>
> are available in the git repository at:
> git-OGgr7I4mDcYgsBAKwltoeQ@public.gmane.org:linus-tree/linus-tree.git i2c_omap-next
Minor nit:
You might want to indicate a git:// link instead of an ssh URL ?
>
>
> Jon Hunter (1):
> I2C: OMAP: Correct I2C revision for OMAP3
>
> Shubhrajyoti D (16):
> I2C: OMAP: make omap_i2c_unidle/idle functions depend on
> CONFIG_PM_RUNTIME
> I2C: OMAP: Remove reset at init
> I2C: OMAP: I2C register restore only if context is lost
> I2C: OMAP: Fix the interrupt clearing in OMAP4
> I2C: OMAP: Fix the mismatch of pm_runtime enable and disable
> I2C: OMAP: Optimise the remove code
> I2C: OMAP: Fix the error handling
> I2C: OMAP: Don't check if wait_for_completion_timeout() returns less
> than zero
> I2C: OMAP: use devm_* functions
> I2C: OMAP: Fix the crash in i2c remove
> I2C: OMAP: Handle error check for pm runtime
> I2C: OMAP: Use SET_RUNTIME_PM_OPS
> I2C: OMAP: make the read ready processing a separate function
> I2C: OMAP: Do not set the XUDF if the underflow is not reached
> I2C: OMAP: Rename the 1p153 to the erratum id i462
> ARM: OMAP4: hwmod data: I2C: add flag for context restore
>
> Tasslehoff Kjappfot (1):
> I2C: OMAP: fix missing handling of errata I2C_OMAP3_1P153
>
> Vikram Pandita (1):
> I2C: OMAP: Recover from Bus Busy condition
>
> arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 3 +-
> arch/arm/plat-omap/i2c.c | 3 +
> drivers/i2c/busses/i2c-omap.c | 342 +++++++++++++++-------------
> include/linux/i2c-omap.h | 1 +
> 4 files changed, 194 insertions(+), 155 deletions(-)
>
> --
> 1.7.4.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 00/19] I2C updates
@ 2012-04-10 11:31 ` S, Venkatraman
0 siblings, 0 replies; 50+ messages in thread
From: S, Venkatraman @ 2012-04-10 11:31 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Apr 10, 2012 at 4:26 PM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
> The patch series does the following
>
> - Warn fixes if CONFIG_PM_RUNTIME is not selected.
> - I2C register restore only if context if the context is lost
> - Bus busy recovery mechanism.
> - the reset is not done in init.
>
> v2 changes
> -Adds a patch to use devm_* functions
> -Also checks the return type of the get_sync and in case
> ?of errors prevents register access.
> - In case of i2c remove register access was done without any
> ?get_sync fix the same.
> - Adds a pdata function pointer to do context save restore
>
> v3 changes
> - Split the omap_i2c_isr to increase readability
> - Adds the restore flag patch for OMAP4 to the series
> - Make the i2c use SET_RUNTIME_PM_OPS
> v4 changes
> - Folds a patch from Tasslehoff to prevent any merge conflicts.
> - Prevents the XDUF flag to be set if the underflow condition is not met.
>
> v5 changes
> - Add consistency in the subject naming.
>
> v6 changes
> - As per discussion in [1] .Adds a patch to rename the 1p153 errata and
> ?use the unique id instead as the section number in the recent errata
> ?docs has changed.
>
>
> [1] http://www.spinics.net/lists/linux-i2c/msg07607.html
>
> Tested on omap4sdp and omap3sdp.
>
>
> The following changes since commit 258f742635360175564e9470eb060ff4d4b984e7:
>
> ?modpost: Fix modpost license checking of vmlinux.o (2012-04-09 20:52:56 -0700)
>
> are available in the git repository at:
> ?git at gitorious.org:linus-tree/linus-tree.git i2c_omap-next
Minor nit:
You might want to indicate a git:// link instead of an ssh URL ?
>
>
> Jon Hunter (1):
> ?I2C: OMAP: Correct I2C revision for OMAP3
>
> Shubhrajyoti D (16):
> ?I2C: OMAP: make omap_i2c_unidle/idle functions depend on
> ? ?CONFIG_PM_RUNTIME
> ?I2C: OMAP: Remove reset at init
> ?I2C: OMAP: I2C register restore only if context is lost
> ?I2C: OMAP: Fix the interrupt clearing in OMAP4
> ?I2C: OMAP: Fix the mismatch of pm_runtime enable and disable
> ?I2C: OMAP: Optimise the remove code
> ?I2C: OMAP: Fix the error handling
> ?I2C: OMAP: Don't check if wait_for_completion_timeout() returns less
> ? ?than zero
> ?I2C: OMAP: use devm_* functions
> ?I2C: OMAP: Fix the crash in i2c remove
> ?I2C: OMAP: Handle error check for pm runtime
> ?I2C: OMAP: Use SET_RUNTIME_PM_OPS
> ?I2C: OMAP: make the read ready processing a separate function
> ?I2C: OMAP: Do not set the XUDF if the underflow is not reached
> ?I2C: OMAP: Rename the 1p153 to the erratum id i462
> ?ARM: OMAP4: hwmod data: I2C: add flag for context restore
>
> Tasslehoff Kjappfot (1):
> ?I2C: OMAP: fix missing handling of errata I2C_OMAP3_1P153
>
> Vikram Pandita (1):
> ?I2C: OMAP: Recover from Bus Busy condition
>
> ?arch/arm/mach-omap2/omap_hwmod_44xx_data.c | ? ?3 +-
> ?arch/arm/plat-omap/i2c.c ? ? ? ? ? ? ? ? ? | ? ?3 +
> ?drivers/i2c/busses/i2c-omap.c ? ? ? ? ? ? ?| ?342 +++++++++++++++-------------
> ?include/linux/i2c-omap.h ? ? ? ? ? ? ? ? ? | ? ?1 +
> ?4 files changed, 194 insertions(+), 155 deletions(-)
>
> --
> 1.7.4.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 00/19] I2C updates
2012-04-10 11:31 ` S, Venkatraman
@ 2012-04-10 11:41 ` Felipe Balbi
-1 siblings, 0 replies; 50+ messages in thread
From: Felipe Balbi @ 2012-04-10 11:41 UTC (permalink / raw)
To: S, Venkatraman
Cc: Shubhrajyoti D, linux-omap, tony, w.sang, linux-i2c, ben-linux,
linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 2004 bytes --]
On Tue, Apr 10, 2012 at 05:01:37PM +0530, S, Venkatraman wrote:
> On Tue, Apr 10, 2012 at 4:26 PM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
> > The patch series does the following
> >
> > - Warn fixes if CONFIG_PM_RUNTIME is not selected.
> > - I2C register restore only if context if the context is lost
> > - Bus busy recovery mechanism.
> > - the reset is not done in init.
> >
> > v2 changes
> > -Adds a patch to use devm_* functions
> > -Also checks the return type of the get_sync and in case
> > of errors prevents register access.
> > - In case of i2c remove register access was done without any
> > get_sync fix the same.
> > - Adds a pdata function pointer to do context save restore
> >
> > v3 changes
> > - Split the omap_i2c_isr to increase readability
> > - Adds the restore flag patch for OMAP4 to the series
> > - Make the i2c use SET_RUNTIME_PM_OPS
> > v4 changes
> > - Folds a patch from Tasslehoff to prevent any merge conflicts.
> > - Prevents the XDUF flag to be set if the underflow condition is not met.
> >
> > v5 changes
> > - Add consistency in the subject naming.
> >
> > v6 changes
> > - As per discussion in [1] .Adds a patch to rename the 1p153 errata and
> > use the unique id instead as the section number in the recent errata
> > docs has changed.
> >
> >
> > [1] http://www.spinics.net/lists/linux-i2c/msg07607.html
> >
> > Tested on omap4sdp and omap3sdp.
> >
> >
> > The following changes since commit 258f742635360175564e9470eb060ff4d4b984e7:
> >
> > modpost: Fix modpost license checking of vmlinux.o (2012-04-09 20:52:56 -0700)
> >
> > are available in the git repository at:
> > git@gitorious.org:linus-tree/linus-tree.git i2c_omap-next
>
> Minor nit:
> You might want to indicate a git:// link instead of an ssh URL ?
indeed, for those who haven't noticed git now has separate url and
pushurl for every remote. Meaning you can pull and push with different
urls. This solves this issue.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 00/19] I2C updates
@ 2012-04-10 11:41 ` Felipe Balbi
0 siblings, 0 replies; 50+ messages in thread
From: Felipe Balbi @ 2012-04-10 11:41 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Apr 10, 2012 at 05:01:37PM +0530, S, Venkatraman wrote:
> On Tue, Apr 10, 2012 at 4:26 PM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
> > The patch series does the following
> >
> > - Warn fixes if CONFIG_PM_RUNTIME is not selected.
> > - I2C register restore only if context if the context is lost
> > - Bus busy recovery mechanism.
> > - the reset is not done in init.
> >
> > v2 changes
> > -Adds a patch to use devm_* functions
> > -Also checks the return type of the get_sync and in case
> > ?of errors prevents register access.
> > - In case of i2c remove register access was done without any
> > ?get_sync fix the same.
> > - Adds a pdata function pointer to do context save restore
> >
> > v3 changes
> > - Split the omap_i2c_isr to increase readability
> > - Adds the restore flag patch for OMAP4 to the series
> > - Make the i2c use SET_RUNTIME_PM_OPS
> > v4 changes
> > - Folds a patch from Tasslehoff to prevent any merge conflicts.
> > - Prevents the XDUF flag to be set if the underflow condition is not met.
> >
> > v5 changes
> > - Add consistency in the subject naming.
> >
> > v6 changes
> > - As per discussion in [1] .Adds a patch to rename the 1p153 errata and
> > ?use the unique id instead as the section number in the recent errata
> > ?docs has changed.
> >
> >
> > [1] http://www.spinics.net/lists/linux-i2c/msg07607.html
> >
> > Tested on omap4sdp and omap3sdp.
> >
> >
> > The following changes since commit 258f742635360175564e9470eb060ff4d4b984e7:
> >
> > ?modpost: Fix modpost license checking of vmlinux.o (2012-04-09 20:52:56 -0700)
> >
> > are available in the git repository at:
> > ?git at gitorious.org:linus-tree/linus-tree.git i2c_omap-next
>
> Minor nit:
> You might want to indicate a git:// link instead of an ssh URL ?
indeed, for those who haven't noticed git now has separate url and
pushurl for every remote. Meaning you can pull and push with different
urls. This solves this issue.
--
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120410/992e23c3/attachment.sig>
^ permalink raw reply [flat|nested] 50+ messages in thread
[parent not found: <20120410114153.GR20616-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org>]
* Re: [PATCH 00/19] I2C updates
2012-04-10 11:41 ` Felipe Balbi
@ 2012-04-10 14:56 ` Shubhrajyoti
-1 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti @ 2012-04-10 14:56 UTC (permalink / raw)
To: balbi-l0cyMroinI0
Cc: S, Venkatraman, linux-omap-u79uwXL29TY76Z2rM5mHXA,
tony-4v6yS6AI5VpBDgjK7y7TUQ, w.sang-bIcnvbaLZ9MEGnE8C9+IrQ,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
ben-linux-elnMNo+KYs3YtjvyW6yDsg,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
On Tuesday 10 April 2012 05:11 PM, Felipe Balbi wrote:
> On Tue, Apr 10, 2012 at 05:01:37PM +0530, S, Venkatraman wrote:
>> On Tue, Apr 10, 2012 at 4:26 PM, Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org> wrote:
[...]
>>> modpost: Fix modpost license checking of vmlinux.o (2012-04-09 20:52:56 -0700)
>>>
>>> are available in the git repository at:
>>> git-OGgr7I4mDcYgsBAKwltoeQ@public.gmane.org:linus-tree/linus-tree.git i2c_omap-next
>> Minor nit:
>> You might want to indicate a git:// link instead of an ssh URL ?
> indeed, for those who haven't noticed git now has separate url and
> pushurl for every remote. Meaning you can pull and push with different
> urls. This solves this issue.
Thanks,
Venkat , Felipe
Here is the corrected pull request
The following changes since commit 258f742635360175564e9470eb060ff4d4b984e7:
modpost: Fix modpost license checking of vmlinux.o (2012-04-09
20:52:56 -0700)
are available in the git repository at:
git://gitorious.org/linus-tree/linus-tree.git i2c_omap-next
Jon Hunter (1):
I2C: OMAP: Correct I2C revision for OMAP3
Shubhrajyoti D (16):
I2C: OMAP: make omap_i2c_unidle/idle functions depend on
CONFIG_PM_RUNTIME
I2C: OMAP: Remove reset at init
I2C: OMAP: I2C register restore only if context is lost
I2C: OMAP: Fix the interrupt clearing in OMAP4
I2C: OMAP: Fix the mismatch of pm_runtime enable and disable
I2C: OMAP: Optimise the remove code
I2C: OMAP: Fix the error handling
I2C: OMAP: Don't check if wait_for_completion_timeout() returns
less than zero
I2C: OMAP: use devm_* functions
I2C: OMAP: Fix the crash in i2c remove
I2C: OMAP: Handle error check for pm runtime
I2C: OMAP: Use SET_RUNTIME_PM_OPS
I2C: OMAP: make the read ready processing a separate function
I2C: OMAP: Do not set the XUDF if the underflow is not reached
I2C: OMAP: Rename the 1p153 to the erratum id i462
ARM: OMAP4: hwmod data: I2C: add flag for context restore
Tasslehoff Kjappfot (1):
I2C: OMAP: fix missing handling of errata I2C_OMAP3_1P153
Vikram Pandita (1):
I2C: OMAP: Recover from Bus Busy condition
arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 3 +-
arch/arm/plat-omap/i2c.c | 3 +
drivers/i2c/busses/i2c-omap.c | 342
+++++++++++++++-------------
include/linux/i2c-omap.h | 1 +
4 files changed, 194 insertions(+), 155 deletions(-)
^ permalink raw reply [flat|nested] 50+ messages in thread* [PATCH 00/19] I2C updates
@ 2012-04-10 14:56 ` Shubhrajyoti
0 siblings, 0 replies; 50+ messages in thread
From: Shubhrajyoti @ 2012-04-10 14:56 UTC (permalink / raw)
To: linux-arm-kernel
On Tuesday 10 April 2012 05:11 PM, Felipe Balbi wrote:
> On Tue, Apr 10, 2012 at 05:01:37PM +0530, S, Venkatraman wrote:
>> On Tue, Apr 10, 2012 at 4:26 PM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
[...]
>>> modpost: Fix modpost license checking of vmlinux.o (2012-04-09 20:52:56 -0700)
>>>
>>> are available in the git repository at:
>>> git at gitorious.org:linus-tree/linus-tree.git i2c_omap-next
>> Minor nit:
>> You might want to indicate a git:// link instead of an ssh URL ?
> indeed, for those who haven't noticed git now has separate url and
> pushurl for every remote. Meaning you can pull and push with different
> urls. This solves this issue.
Thanks,
Venkat , Felipe
Here is the corrected pull request
The following changes since commit 258f742635360175564e9470eb060ff4d4b984e7:
modpost: Fix modpost license checking of vmlinux.o (2012-04-09
20:52:56 -0700)
are available in the git repository at:
git://gitorious.org/linus-tree/linus-tree.git i2c_omap-next
Jon Hunter (1):
I2C: OMAP: Correct I2C revision for OMAP3
Shubhrajyoti D (16):
I2C: OMAP: make omap_i2c_unidle/idle functions depend on
CONFIG_PM_RUNTIME
I2C: OMAP: Remove reset at init
I2C: OMAP: I2C register restore only if context is lost
I2C: OMAP: Fix the interrupt clearing in OMAP4
I2C: OMAP: Fix the mismatch of pm_runtime enable and disable
I2C: OMAP: Optimise the remove code
I2C: OMAP: Fix the error handling
I2C: OMAP: Don't check if wait_for_completion_timeout() returns
less than zero
I2C: OMAP: use devm_* functions
I2C: OMAP: Fix the crash in i2c remove
I2C: OMAP: Handle error check for pm runtime
I2C: OMAP: Use SET_RUNTIME_PM_OPS
I2C: OMAP: make the read ready processing a separate function
I2C: OMAP: Do not set the XUDF if the underflow is not reached
I2C: OMAP: Rename the 1p153 to the erratum id i462
ARM: OMAP4: hwmod data: I2C: add flag for context restore
Tasslehoff Kjappfot (1):
I2C: OMAP: fix missing handling of errata I2C_OMAP3_1P153
Vikram Pandita (1):
I2C: OMAP: Recover from Bus Busy condition
arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 3 +-
arch/arm/plat-omap/i2c.c | 3 +
drivers/i2c/busses/i2c-omap.c | 342
+++++++++++++++-------------
include/linux/i2c-omap.h | 1 +
4 files changed, 194 insertions(+), 155 deletions(-)
^ permalink raw reply [flat|nested] 50+ messages in thread