[PATCH v2 2/3] oprofile: Provide stubs for oprofile_perf_{init,exit}

2011-01-20 Thread Ari Kauppi
If CONFIG_HW_PERF_EVENTS is not defined, provide stubs for
oprofile_perf_init and oprofile_perf_exit. Allows cleaning of
architecture specific implementations.

Signed-off-by: Ari Kauppi 
---
 include/linux/oprofile.h |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index 54c8382..1ca6411 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -16,6 +16,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
  
 /* Each escaped entry is prefixed by ESCAPE_CODE
@@ -190,6 +192,13 @@ int oprofile_write_commit(struct op_entry *entry);
 int __init oprofile_perf_init(struct oprofile_operations *ops);
 void oprofile_perf_exit(void);
 char *op_name_from_perf_id(void);
+#else
+static inline int __init oprofile_perf_init(struct oprofile_operations *ops)
+{
+   pr_info("oprofile: hardware counters not available\n");
+   return -ENODEV;
+}
+static inline void oprofile_perf_exit(void) { }
 #endif /* CONFIG_HW_PERF_EVENTS */
 
 #endif /* OPROFILE_H */
-- 
1.7.4.rc2.3.g60a2e

--
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


[PATCH v2 3/3] ARM: oprofile: Always allow backtraces

2011-01-20 Thread Ari Kauppi
Always allow backtrace when using oprofile on ARM, even if a PMU
isn't present. Implemented by removing code and using stubs
provided by .

Restores functionality originally introduced in commit
1b7b56982fdcd9d85effd76f3928cf5d6eb26155 ("oprofile: Always allow
backtraces on ARM") by Richard Purdie.

Signed-off-by: Ari Kauppi 
---
 arch/arm/oprofile/common.c |   12 ++--
 1 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c
index 8aa9744..2b66391 100644
--- a/arch/arm/oprofile/common.c
+++ b/arch/arm/oprofile/common.c
@@ -10,8 +10,6 @@
  */
 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
@@ -46,6 +44,7 @@ char *op_name_from_perf_id(void)
return NULL;
}
 }
+#endif
 
 static int report_trace(struct stackframe *frame, void *d)
 {
@@ -111,6 +110,7 @@ static void arm_backtrace(struct pt_regs * const regs, 
unsigned int depth)
 
 int __init oprofile_arch_init(struct oprofile_operations *ops)
 {
+   /* provide backtrace support also in timer mode: */
ops->backtrace  = arm_backtrace;
 
return oprofile_perf_init(ops);
@@ -120,11 +120,3 @@ void __exit oprofile_arch_exit(void)
 {
oprofile_perf_exit();
 }
-#else
-int __init oprofile_arch_init(struct oprofile_operations *ops)
-{
-   pr_info("oprofile: hardware counters not available\n");
-   return -ENODEV;
-}
-void __exit oprofile_arch_exit(void) {}
-#endif /* CONFIG_HW_PERF_EVENTS */
-- 
1.7.4.rc2.3.g60a2e

--
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


[PATCH v2 0/3] oprofile: ARM backtraces and few minors

2011-01-20 Thread Ari Kauppi
This patchset re-enables ARM backtraces with non-PMU capable CPUs.

In V2 I have tried to address the comments received for the V1
patches. arch/sh/oprofile/common.c is untouched but should work
as earlier.

Compile tested with arm/omap2plus_defconfig (with and without
CONFIG_HW_PERF_EVENTS).

Ari Kauppi (3):
  oprofile: Use CONFIG_HW_PERF_EVENTS for oprofile_perf_init and
friends
  oprofile: Provide stubs for oprofile_perf_{init,exit}
  ARM: oprofile: Always allow backtraces

 arch/arm/oprofile/common.c |   12 ++--
 include/linux/oprofile.h   |   13 +++--
 2 files changed, 13 insertions(+), 12 deletions(-)

-- 
1.7.4.rc2.3.g60a2e

--
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


[PATCH v2 1/3] oprofile: Use CONFIG_HW_PERF_EVENTS for oprofile_perf_init and friends

2011-01-20 Thread Ari Kauppi
The implementations are flagged in Makefile with CONFIG_HW_PERF_EVENTS
instead of CONFIG_PERF_EVENTS.

Signed-off-by: Ari Kauppi 
---
 include/linux/oprofile.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index 32fb812..54c8382 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -186,10 +186,10 @@ int oprofile_add_data(struct op_entry *entry, unsigned 
long val);
 int oprofile_add_data64(struct op_entry *entry, u64 val);
 int oprofile_write_commit(struct op_entry *entry);
 
-#ifdef CONFIG_PERF_EVENTS
+#ifdef CONFIG_HW_PERF_EVENTS
 int __init oprofile_perf_init(struct oprofile_operations *ops);
 void oprofile_perf_exit(void);
 char *op_name_from_perf_id(void);
-#endif /* CONFIG_PERF_EVENTS */
+#endif /* CONFIG_HW_PERF_EVENTS */
 
 #endif /* OPROFILE_H */
-- 
1.7.4.rc2.3.g60a2e

--
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: [PATCH] ARM: oprofile: Always allow backtraces

2011-01-20 Thread Ari Kauppi

On Thu, 20 Jan 2011, Robert Richter wrote:

Hi,


On 20.01.11 04:42:24, Will Deacon wrote:

Hi Ari,


Always allow backtrace when using oprofile on ARM, even if a PMU
isn't present.

Restores functionality originally introduced in
1b7b56982fdcd9d85effd76f3928cf5d6eb26155 by Richard Purdie.


Well spotted, I'd forgotten we still want this for timer mode.
Comments inline.


diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c
index 8aa9744..a23e5ae 100644
--- a/arch/arm/oprofile/common.c
+++ b/arch/arm/oprofile/common.c
@@ -46,6 +46,7 @@ char *op_name_from_perf_id(void)
return NULL;
}
 }
+#endif

 static int report_trace(struct stackframe *frame, void *d)
 {
@@ -109,6 +110,7 @@ static void arm_backtrace(struct pt_regs * const regs, 
unsigned int depth)
tail = user_backtrace(tail);
 }

+#ifdef CONFIG_HW_PERF_EVENTS


Can you reorder the backtrace stuff so that we don't need the extra
#endif/#ifdef please?


I would like to go even further, see the diff below.


Thanks for comments, I can prepare a new patch. I think your patch below 
has two typos but the idea was clear, please see comments below.



-Robert

---
arch/arm/oprofile/common.c |   45 ---
1 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c
index 8aa9744..916aa2e 100644
--- a/arch/arm/oprofile/common.c
+++ b/arch/arm/oprofile/common.c
@@ -47,18 +47,6 @@ char *op_name_from_perf_id(void)
}
}

-static int report_trace(struct stackframe *frame, void *d)
-{
-   unsigned int *depth = d;
-
-   if (*depth) {
-   oprofile_add_trace(frame->pc);
-   (*depth)--;
-   }
-
-   return *depth == 0;
-}
-
/*
 * The registers we're interested in are at the end of the variable
 * length saved register structure. The fp points at the end of this
@@ -91,6 +79,30 @@ static struct frame_tail* user_backtrace(struct frame_tail 
*tail)
return buftail[0].fp-1;
}

+#else
+
+static int oprofile_arch_init(struct oprofile_operations *ops)
+{
+   pr_info("oprofile: hardware counters not available\n");
+   return -ENODEV;
+}
+
+static void oprofile_arch_exit(void) { }


I guess you mean oprofile_perf_init and oprofile_perf_exit?

Also the user_backtrace and frame_tail need to be moved out from the 
#ifdef.



+
+#endif /* CONFIG_HW_PERF_EVENTS */
+
+static int report_trace(struct stackframe *frame, void *d)
+{
+   unsigned int *depth = d;
+
+   if (*depth) {
+   oprofile_add_trace(frame->pc);
+   (*depth)--;
+   }
+
+   return *depth == 0;
+}
+
static void arm_backtrace(struct pt_regs * const regs, unsigned int depth)
{
struct frame_tail *tail = ((struct frame_tail *) regs->ARM_fp) - 1;
@@ -111,6 +123,7 @@ static void arm_backtrace(struct pt_regs * const regs, 
unsigned int depth)

int __init oprofile_arch_init(struct oprofile_operations *ops)
{
+   /* provide backtrace support also in timer mode: */
ops->backtrace   = arm_backtrace;

return oprofile_perf_init(ops);
@@ -120,11 +133,3 @@ void __exit oprofile_arch_exit(void)
{
oprofile_perf_exit();
}
-#else
-int __init oprofile_arch_init(struct oprofile_operations *ops)
-{
-   pr_info("oprofile: hardware counters not available\n");
-   return -ENODEV;
-}
-void __exit oprofile_arch_exit(void) {}
-#endif /* CONFIG_HW_PERF_EVENTS */



--
Ari

--
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


[PATCH] ARM: oprofile: Always allow backtraces

2011-01-19 Thread Ari Kauppi
Always allow backtrace when using oprofile on ARM, even if a PMU
isn't present.

Restores functionality originally introduced in
1b7b56982fdcd9d85effd76f3928cf5d6eb26155 by Richard Purdie.

Signed-off-by: Ari Kauppi 
Cc: Richard Purdie 
Cc: Will Deacon 
Cc: Matt Fleming 
---
 arch/arm/oprofile/common.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c
index 8aa9744..a23e5ae 100644
--- a/arch/arm/oprofile/common.c
+++ b/arch/arm/oprofile/common.c
@@ -46,6 +46,7 @@ char *op_name_from_perf_id(void)
return NULL;
}
 }
+#endif
 
 static int report_trace(struct stackframe *frame, void *d)
 {
@@ -109,6 +110,7 @@ static void arm_backtrace(struct pt_regs * const regs, 
unsigned int depth)
tail = user_backtrace(tail);
 }
 
+#ifdef CONFIG_HW_PERF_EVENTS
 int __init oprofile_arch_init(struct oprofile_operations *ops)
 {
ops->backtrace  = arm_backtrace;
@@ -124,6 +126,8 @@ void __exit oprofile_arch_exit(void)
 int __init oprofile_arch_init(struct oprofile_operations *ops)
 {
pr_info("oprofile: hardware counters not available\n");
+   ops->backtrace  = arm_backtrace;
+
return -ENODEV;
 }
 void __exit oprofile_arch_exit(void) {}
-- 
1.7.4.rc2.3.g60a2e

--
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


[PATCH v2] OMAP3: PM: Add milliseconds interface to suspend wakeup timer

2010-03-23 Thread Ari Kauppi
Millisecond resolution is possible and there are use cases for it
(automatic testing).

Seconds-based interface is preserved for compatibility.

Signed-off-by: Ari Kauppi 

---
v2: Keep seconds and milliseconds interfaces strictly separate:
 - Consistent interface, setting/getting seconds and milliseconds
   is always accurate
 - Fixes potential overflow issues in omap2_pm_wakeup_on_timer
 - Cleaner patch
---
 arch/arm/mach-omap2/pm-debug.c |7 +++
 arch/arm/mach-omap2/pm.h   |1 +
 arch/arm/mach-omap2/pm34xx.c   |   17 ++---
 3 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 8aafd71..83acaa2 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -548,6 +548,9 @@ static int option_set(void *data, u64 val)
 {
u32 *option = data;
 
+   if (option == &wakeup_timer_milliseconds && val >= 1000)
+   return -EINVAL;
+
*option = val;
 
if (option == &enable_off_mode)
@@ -605,6 +608,10 @@ static int __init pm_dbg_init(void)
   &sleep_while_idle, &pm_dbg_option_fops);
(void) debugfs_create_file("wakeup_timer_seconds", S_IRUGO | S_IWUGO, d,
   &wakeup_timer_seconds, &pm_dbg_option_fops);
+   (void) debugfs_create_file("wakeup_timer_milliseconds",
+  S_IRUGO | S_IWUGO, d,
+  &wakeup_timer_milliseconds,
+  &pm_dbg_option_fops);
 
/* Only enable for >= ES2.1 . Going to 0V on anything under
 * ES2.1 will eventually cause a crash */
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index b761be5..b3594a9 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -69,6 +69,7 @@ extern int omap3_pm_get_suspend_state(struct powerdomain 
*pwrdm);
 extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state);
 
 extern u32 wakeup_timer_seconds;
+extern u32 wakeup_timer_milliseconds;
 extern struct omap_dm_timer *gptimer_wakeup;
 
 #ifdef CONFIG_PM_DEBUG
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 3868c76..d7922a5 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -74,6 +74,7 @@ static inline bool is_suspending(void)
 u32 enable_off_mode;
 u32 sleep_while_idle;
 u32 wakeup_timer_seconds;
+u32 wakeup_timer_milliseconds;
 u32 voltage_off_while_idle;
 
 struct power_state {
@@ -640,20 +641,21 @@ out:
 }
 
 #ifdef CONFIG_SUSPEND
-static void omap2_pm_wakeup_on_timer(u32 seconds)
+static void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds)
 {
u32 tick_rate, cycles;
 
-   if (!seconds)
+   if (!seconds && !milliseconds)
return;
 
tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer_wakeup));
-   cycles = tick_rate * seconds;
+   cycles = tick_rate * seconds + tick_rate * milliseconds / 1000;
omap_dm_timer_stop(gptimer_wakeup);
omap_dm_timer_set_load_start(gptimer_wakeup, 0, 0x - cycles);
 
-   pr_info("PM: Resume timer in %d secs (%d ticks at %d ticks/sec.)\n",
-   seconds, cycles, tick_rate);
+   pr_info("PM: Resume timer in %u.%03u secs"
+   " (%d ticks at %d ticks/sec.)\n",
+   seconds, milliseconds, cycles, tick_rate);
 }
 
 static int omap3_pm_prepare(void)
@@ -667,8 +669,9 @@ static int omap3_pm_suspend(void)
struct power_state *pwrst;
int state, ret = 0;
 
-   if (wakeup_timer_seconds)
-   omap2_pm_wakeup_on_timer(wakeup_timer_seconds);
+   if (wakeup_timer_seconds || wakeup_timer_milliseconds)
+   omap2_pm_wakeup_on_timer(wakeup_timer_seconds,
+wakeup_timer_milliseconds);
 
/* Read current next_pwrsts */
list_for_each_entry(pwrst, &pwrst_list, node)
-- 
1.6.4.2

--
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


[PATCH] OMAP3: PM: Modify suspend wakeup timer to use milliseconds instead of seconds

2010-03-22 Thread Ari Kauppi
Millisecond resolution is possible and there are use cases for it
(automatic testing).

Seconds-based interface is preserved for compatibility.

Signed-off-by: Ari Kauppi 
---
 arch/arm/mach-omap2/pm-debug.c |   11 +++
 arch/arm/mach-omap2/pm.h   |2 +-
 arch/arm/mach-omap2/pm34xx.c   |   16 
 3 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 8aafd71..0cf2a03 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -37,6 +37,7 @@
 #include "prm-regbits-34xx.h"
 
 int omap2_pm_debug;
+static u32 wakeup_timer_seconds;
 
 #define DUMP_PRM_MOD_REG(mod, reg)\
regs[reg_count].name = #mod "." #reg; \
@@ -552,6 +553,12 @@ static int option_set(void *data, u64 val)
 
if (option == &enable_off_mode)
omap3_pm_off_mode_enable(val);
+
+   if (option == &wakeup_timer_seconds)
+   wakeup_timer_milliseconds = val * 1000;
+   if (option == &wakeup_timer_milliseconds)
+   wakeup_timer_seconds = roundup((u32)val, 1000) / 1000;
+
return 0;
 }
 
@@ -605,6 +612,10 @@ static int __init pm_dbg_init(void)
   &sleep_while_idle, &pm_dbg_option_fops);
(void) debugfs_create_file("wakeup_timer_seconds", S_IRUGO | S_IWUGO, d,
   &wakeup_timer_seconds, &pm_dbg_option_fops);
+   (void) debugfs_create_file("wakeup_timer_milliseconds",
+  S_IRUGO | S_IWUGO, d,
+  &wakeup_timer_milliseconds,
+  &pm_dbg_option_fops);
 
/* Only enable for >= ES2.1 . Going to 0V on anything under
 * ES2.1 will eventually cause a crash */
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index b761be5..423395a 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -68,7 +68,7 @@ static inline void omap3_pm_init_vc(struct prm_setup_vc 
*setup_vc)
 extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm);
 extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state);
 
-extern u32 wakeup_timer_seconds;
+extern u32 wakeup_timer_milliseconds;
 extern struct omap_dm_timer *gptimer_wakeup;
 
 #ifdef CONFIG_PM_DEBUG
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 3868c76..cd55968 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -73,7 +73,7 @@ static inline bool is_suspending(void)
 
 u32 enable_off_mode;
 u32 sleep_while_idle;
-u32 wakeup_timer_seconds;
+u32 wakeup_timer_milliseconds;
 u32 voltage_off_while_idle;
 
 struct power_state {
@@ -640,20 +640,20 @@ out:
 }
 
 #ifdef CONFIG_SUSPEND
-static void omap2_pm_wakeup_on_timer(u32 seconds)
+static void omap2_pm_wakeup_on_timer(u32 milliseconds)
 {
u32 tick_rate, cycles;
 
-   if (!seconds)
+   if (!milliseconds)
return;
 
tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer_wakeup));
-   cycles = tick_rate * seconds;
+   cycles = tick_rate * milliseconds / 1000;
omap_dm_timer_stop(gptimer_wakeup);
omap_dm_timer_set_load_start(gptimer_wakeup, 0, 0x - cycles);
 
-   pr_info("PM: Resume timer in %d secs (%d ticks at %d ticks/sec.)\n",
-   seconds, cycles, tick_rate);
+   pr_info("PM: Resume timer in %u ms (%u ticks at %u ticks/sec.)\n",
+   milliseconds, cycles, tick_rate);
 }
 
 static int omap3_pm_prepare(void)
@@ -667,8 +667,8 @@ static int omap3_pm_suspend(void)
struct power_state *pwrst;
int state, ret = 0;
 
-   if (wakeup_timer_seconds)
-   omap2_pm_wakeup_on_timer(wakeup_timer_seconds);
+   if (wakeup_timer_milliseconds)
+   omap2_pm_wakeup_on_timer(wakeup_timer_milliseconds);
 
/* Read current next_pwrsts */
list_for_each_entry(pwrst, &pwrst_list, node)
-- 
1.6.4.2

--
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


[PATCH 2/2] i2c: i2c-omap: Call request_irq with IRQF_DISABLED

2009-03-06 Thread Ari Kauppi
I have observed some Spurious IRQ's for I2C1 when all kernel hacking options
(and thus LOCKDEP) are disabled.

Applying Richard Woodruff's 'I2C bug fixes for L-O and L-Z' seems to help
but IRQF_DISABLED is needed for proper behaviour.

Signed-off-by: Ari Kauppi 
Acked-by: Felipe Balbi 
---
 drivers/i2c/busses/i2c-omap.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 0c3ed41..18af43f 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -847,7 +847,7 @@ omap_i2c_probe(struct platform_device *pdev)
omap_i2c_init(dev);
 
isr = (dev->rev < OMAP_I2C_REV_2) ? omap_i2c_rev1_isr : omap_i2c_isr;
-   r = request_irq(dev->irq, isr, 0, pdev->name, dev);
+   r = request_irq(dev->irq, isr, IRQF_DISABLED, pdev->name, dev);
 
if (r) {
dev_err(dev->dev, "failure requesting irq %i\n", dev->irq);
-- 
1.5.6.5

--
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


[PATCH 1/2] i2c: i2c-omap: Fix BUFSTAT_REG reading

2009-03-06 Thread Ari Kauppi
From: Eero Nurkkala 

The number of bytes to be received is read from wrong
place with all OMAPs with highspeed I2C support,
which involves a FIFO and BUFSTAT_REG. It is the 6
bits starting from the bit 8 in the BUFSTAT_REG
that indicate this amount of bytes to be read.
Moreover, only the 6 LSB:s are relevant for the
TXSTAT field.

Signed-off-by: Eero Nurkkala 
Signed-off-by: Tony Lindgren 
Signed-off-by: Ari Kauppi 
Acked-by: Felipe Balbi 
---
 drivers/i2c/busses/i2c-omap.c |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index be8ee2c..0c3ed41 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -675,8 +675,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
if (stat & OMAP_I2C_STAT_RRDY)
num_bytes = dev->fifo_size;
else
-   num_bytes = omap_i2c_read_reg(dev,
-   OMAP_I2C_BUFSTAT_REG);
+   num_bytes = (omap_i2c_read_reg(dev,
+   OMAP_I2C_BUFSTAT_REG)
+   >> 8) & 0x3F;
}
while (num_bytes) {
num_bytes--;
@@ -714,8 +715,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
if (stat & OMAP_I2C_STAT_XRDY)
num_bytes = dev->fifo_size;
else
-   num_bytes = omap_i2c_read_reg(dev,
-   OMAP_I2C_BUFSTAT_REG);
+   num_bytes = (omap_i2c_read_reg(dev,
+   OMAP_I2C_BUFSTAT_REG))
+   & 0x3F;
}
while (num_bytes) {
num_bytes--;
-- 
1.5.6.5

--
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


[PATCH 0/2] i2c: i2c-omap: Reliablity and register fixes

2009-03-06 Thread Ari Kauppi
Two patches for i2c-omap driver.

Ari Kauppi (1):
  i2c: i2c-omap: Call request_irq with IRQF_DISABLED

Eero Nurkkala (1):
  i2c: i2c-omap: Fix BUFSTAT_REG reading

 drivers/i2c/busses/i2c-omap.c |   12 +++-
 1 files changed, 7 insertions(+), 5 deletions(-)

--
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


[PATCH] I2C: Call request_irq with IRQF_DISABLED

2009-03-05 Thread Ari Kauppi
I have observed some Spurious IRQ's for I2C1 when all kernel hacking options
(and thus LOCKDEP) are disabled.

Applying Richard Woodruff's 'I2C bug fixes for L-O and L-Z' seems to help
but IRQF_DISABLED is needed for proper behaviour.

Signed-off-by: Ari Kauppi 
---
 drivers/i2c/busses/i2c-omap.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 0c3ed41..18af43f 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -847,7 +847,7 @@ omap_i2c_probe(struct platform_device *pdev)
omap_i2c_init(dev);
 
isr = (dev->rev < OMAP_I2C_REV_2) ? omap_i2c_rev1_isr : omap_i2c_isr;
-   r = request_irq(dev->irq, isr, 0, pdev->name, dev);
+   r = request_irq(dev->irq, isr, IRQF_DISABLED, pdev->name, dev);
 
if (r) {
dev_err(dev->dev, "failure requesting irq %i\n", dev->irq);
-- 
1.5.6.5

--
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