Re: [PATCH v7 0/5] OMAP: McBSP: Use register cache

2009-12-16 Thread Peter Ujfalusi
Hello Janusz,

I'll try to go through the series.

On Wednesday 09 December 2009 22:24:13 ext Janusz Krzysztofik wrote:

 This could help for developing the McBSP context save/restore features, as
 well as solve the problem of possible register corruption, experienced on
 OMAP1510 based Amstrad Delta board at least.

For the context save/restore feature:
On OMAP3 this is not that straight forward IMHO.
OMAP3 has FIFO on the McBSP ports (1024+256, or 128 word long).
This buffer will be invalidated in case of OFF mode (or when context 
save/restore is needed).
So if we ever face with this situation, we need to make sure that the McBSP 
FIFO 
is empty prior to context save, so when we are restoring we are not going to 
loose any data.
Note also, that the McBSP FIFO can not be bypassed on OMAP3, which means that 
the FIFO is most of the time is kind of full.
Well, full in element mode, and mostly full in threshold mode.

In other words: on OMAP3 the context save/restore is not that simple as it is 
on 
OMAP1/2. We need to make sure that the FIFO is empty at the right moment, which 
can not be done with the current code, and to be honest, I can not see how it 
can be done, unless we branch out the OMAP3 related McBSP/DMA code, and leave 
the current implementation to support only OMAP1/2 class devices.

-- 
Péter
--
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 3/5 v8] OMAP: McBSP: Introduce caching in register write operations

2009-12-16 Thread Jarkko Nikula
On Tue, 15 Dec 2009 01:36:47 +0100
Janusz Krzysztofik jkrzy...@tis.icnet.pl wrote:

 3. In omap_mcbsp_free(), marking the port as free before deallocating the 
cache, could result in memory leak as well.
 
 I hope all are addressed correctly. Since releasing the port with
 
   mcbsp-free = 1;
 
 after kzalloc() failure should be atomic, I have assumed this doesn't require 
 locking.
 
Good catch. One comment below.

 @@ -471,6 +491,9 @@ void omap_mcbsp_free(unsigned int id)
   free_irq(mcbsp-tx_irq, (void *)mcbsp);
   }
  
 + kfree(mcbsp-reg_cache);
 + mcbsp-reg_cache = NULL;
 +
   spin_lock(mcbsp-lock);
   if (mcbsp-free) {
   dev_err(mcbsp-dev, McBSP%d was not reserved\n,

This is fine in current form but to play safe, lets do the kfree
inside the spin_lock section where the mcbsp-free is set. Then there
is no risk if some future code would use the mcbsp-free as a guard for
cache etc. access.


-- 
Jarkko
--
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: Low level debugging using CONFIG_EARLY_PRINTK=y, omap-debug branch removed

2009-12-16 Thread Shilimkar, Santosh
Tony,
 -Original Message-
 From: linux-omap-ow...@vger.kernel.org 
 [mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of Tony
 Lindgren
 Sent: Wednesday, December 16, 2009 6:24 AM
 To: linux-omap@vger.kernel.org
 Subject: Low level debugging using CONFIG_EARLY_PRINTK=y, omap-debug branch 
 removed
 
 Hi all,
 
 Recent commit 93fd03a8c6728b58879f8af20ffd55d9c32a778b added
 support for CONFIG_EARLY_PRINTK on ARM. Recent earlier kernels
 should work too by applying the patch in the commit above.
 
 This means we can now get rid of the old printk.c hack in the
 omap-debug branch, so I've deleted that branch.
 
 To use the earlyprintk, just do the following:
 
 1. Make sure you have the necessary .config options set
 
 CONFIG_DEBUG_LL=y
 CONFIG_EARLY_PRINTK=y
 CONFIG_OMAP_LL_DEBUG_UART1=y
 # CONFIG_OMAP_LL_DEBUG_UART2 is not set
 # CONFIG_OMAP_LL_DEBUG_UART3 is not set
 
 The LL_DEBUG_UART above is typically 1, but it's 3 on Nokia
 boards.
 
 2. Edit the kernel CMDLINE in your .config to have debug earlyprintk
 
 Optionally if you have a JTAG console, you can use CONFIG_DEBUG_ICEDCC
 instead LL_DEBUG_UART.
 
 I've also added these instructions to:
 
 http://www.elinux.org/Debugging_OMAP_kernel
I tried this on couple of boards and at least it doesn't work with the options 
and mentioned bootargs. The low level debug prints are still not coming on 
console.

I haven't debugged it though.

Regards,
Santosh



--
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: linux-next: origin tree build failure

2009-12-16 Thread Samuel Ortiz
Hi Stephen,

On Wed, Dec 16, 2009 at 09:45:41AM +1100, Stephen Rothwell wrote:
 Hi Tony,
 
 On Tue, 15 Dec 2009 09:27:17 -0800 Tony Lindgren t...@atomide.com wrote:
 
  * Mark Brown broo...@opensource.wolfsonmicro.com [091215 06:52]:
   On Tue, Dec 15, 2009 at 04:41:08PM +1100, Stephen Rothwell wrote:
   
I have applied this patch for today (please check):
   
   Looks good to me too, fwiw:
   
   Acked-by: Mark Brown broo...@opensource.wolfsonmicro.com
  
  Good thing we have for-next to catch things like this.
 
 Except if the renaming patch had gone through linux-next (even for one
 day) we would have found the problem *before* it was in Linus' tree ...
Mea maxima culpa. I could come up with several reason why I rushed this patch
in, but none of them would be good. I apologize here.


 (/me is a little grumpy :-))
I understand, sorry again.

Cheers,
Samuel.


 -- 
 Cheers,
 Stephen Rothwells...@canb.auug.org.au
 http://www.canb.auug.org.au/~sfr/



-- 
Intel Open Source Technology Centre
http://oss.intel.com/
--
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: dadd2bb931a08a4b6b17f9e82d9bbe7bedebbc98 breaks omapfb (old non-dss2)

2009-12-16 Thread Tomi Valkeinen
Hi,

On Tue, 2009-12-15 at 17:01 +0100, ext Sergey Lapin wrote:
 On Tue, Dec 15, 2009 at 6:22 PM, Tomi Valkeinen
 tomi.valkei...@nokia.com wrote:
  Hi,
 
  On Tue, 2009-12-15 at 10:58 +0100, ext Sergey Lapin wrote:
  dadd2bb931a08a4b6b17f9e82d9bbe7bedebbc98
  OMAP: OMAPFB: add omapdss device
 
  The upcoming new display subsystem driver is divided to two devices,
  omapdss and omapfb, of which omapdss handles the actual hardware.
 
  This patch adds a dummy omapdss platform device for the current omapfb
  driver, which is then used to get the clocks. This will make it 
  possible
  for the current and the new display drivers to co-exist.
 
  Signed-off-by: Tomi Valkeinen tomi.valkei...@nokia.com
  Acked-by: Tony Lindgren t...@atomide.com
 
  breaks old omapfb.
 
  I didn't look at this further, but I quickly tested with OMAP3 SDP
  board, reverting the patch that makes SDP use DSS2, and it seems to work
  fine with the old omapfb.

rfbi.c was still using omapfb device to get the clocks. Can you try this
patch?


From 33b78006fb0387e21d5f780338d821621ecad929 Mon Sep 17 00:00:00 2001
From: Tomi Valkeinen tomi.valkei...@nokia.com
Date: Wed, 16 Dec 2009 13:18:07 +0200
Subject: [PATCH] OMAP: OMAPFB: fix clk_get for RFBI

omapfb platform device was still used to get clocks inside rfbi.c

Signed-off-by: Tomi Valkeinen tomi.valkei...@nokia.com
---
 drivers/video/omap/dispc.c  |2 +-
 drivers/video/omap/omapfb.h |2 ++
 drivers/video/omap/rfbi.c   |4 ++--
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/video/omap/dispc.c b/drivers/video/omap/dispc.c
index c7c6455..e40146a 100644
--- a/drivers/video/omap/dispc.c
+++ b/drivers/video/omap/dispc.c
@@ -189,7 +189,7 @@ static struct {
struct omapfb_color_key color_key;
 } dispc;
 
-static struct platform_device omapdss_device = {
+struct platform_device omapdss_device = {
.name   = omapdss,
.id = -1,
 };
diff --git a/drivers/video/omap/omapfb.h b/drivers/video/omap/omapfb.h
index 46e4714..0a4988e 100644
--- a/drivers/video/omap/omapfb.h
+++ b/drivers/video/omap/omapfb.h
@@ -224,4 +224,6 @@ extern int  omapfb_update_window_async(struct fb_info *fbi,
   void (*callback)(void *),
   void *callback_data);
 
+extern struct platform_device omapdss_device;
+
 #endif /* __OMAPFB_H */
diff --git a/drivers/video/omap/rfbi.c b/drivers/video/omap/rfbi.c
index fed7b1b..36af8ba 100644
--- a/drivers/video/omap/rfbi.c
+++ b/drivers/video/omap/rfbi.c
@@ -83,13 +83,13 @@ static inline u32 rfbi_read_reg(int idx)
 
 static int rfbi_get_clocks(void)
 {
-   rfbi.dss_ick = clk_get(rfbi.fbdev-dev, ick);
+   rfbi.dss_ick = clk_get(omapdss_device.dev, ick);
if (IS_ERR(rfbi.dss_ick)) {
dev_err(rfbi.fbdev-dev, can't get ick\n);
return PTR_ERR(rfbi.dss_ick);
}
 
-   rfbi.dss1_fck = clk_get(rfbi.fbdev-dev, dss1_fck);
+   rfbi.dss1_fck = clk_get(omapdss_device.dev, dss1_fck);
if (IS_ERR(rfbi.dss1_fck)) {
dev_err(rfbi.fbdev-dev, can't get dss1_fck\n);
clk_put(rfbi.dss_ick);
-- 
1.6.3.3






--
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] ehci: fix missing kfree in remove path also

2009-12-16 Thread Ajay Kumar Gupta
Added missing kfree() in ehci_hcd_omap_remove().

Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
---
 drivers/usb/host/ehci-omap.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 74d07f4..2460f0d 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -681,6 +681,7 @@ static int ehci_hcd_omap_remove(struct platform_device 
*pdev)
iounmap(omap-tll_base);
iounmap(omap-uhh_base);
usb_put_hcd(hcd);
+   kfree(omap);
 
return 0;
 }
-- 
1.6.2.4

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


[PATCH 0/2] omap i2c interrupt handler fixes

2009-12-16 Thread Alexander Shishkin
Hi,

This is the second version of the patch that I've sent to linux-omap to
address this issue. This time I've moved the whole errata workaround bit
to a separate function to get rid of too long lines and a couple of extra
levels of indentation.

The actual fix is the same as the first time, it adds a timeout to a busy
loop which happens to take place in an interrupt handler and is capable
of hanging the kernel.

Regards,
--
Alex
--
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] omap i2c: make errata 1.153 workaround a separate function

2009-12-16 Thread Alexander Shishkin
This is to avoid insanely long lines and levels of indentation.

Signed-off-by: Alexander Shishkin virtu...@slind.org
CC: linux-...@vger.kernel.org
CC: linux-omap@vger.kernel.org
---
 drivers/i2c/busses/i2c-omap.c |   43 ++--
 1 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 75bf3ad..ad8242a 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -671,6 +671,27 @@ omap_i2c_rev1_isr(int this_irq, void *dev_id)
 #define omap_i2c_rev1_isr  NULL
 #endif
 
+/*
+ * OMAP3430 Errata 1.153: When an XRDY/XDR is hit, wait for XUDF before writing
+ * data to DATA_REG. Otherwise some data bytes can be lost while transferring
+ * them from the memory to the I2C interface.
+ */
+static int omap3430_workaround(struct omap_i2c_dev *dev, u16 *stat, int *err)
+{
+   while (!(*stat  OMAP_I2C_STAT_XUDF)) {
+   if (*stat  (OMAP_I2C_STAT_NACK | OMAP_I2C_STAT_AL)) {
+   omap_i2c_ack_stat(dev, *stat  (OMAP_I2C_STAT_XRDY |
+   OMAP_I2C_STAT_XDR));
+   *err |= OMAP_I2C_STAT_XUDF;
+   return -1;
+   }
+   cpu_relax();
+   *stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
+   }
+
+   return 0;
+}
+
 static irqreturn_t
 omap_i2c_isr(int this_irq, void *dev_id)
 {
@@ -794,25 +815,9 @@ complete:
break;
}
 
-   /*
-* OMAP3430 Errata 1.153: When an XRDY/XDR
-* is hit, wait for XUDF before writing data
-* to DATA_REG. Otherwise some data bytes can
-* be lost while transferring them from the
-* memory to the I2C interface.
-*/
-
-   if (dev-rev = OMAP_I2C_REV_ON_3430) {
-   while (!(stat  
OMAP_I2C_STAT_XUDF)) {
-   if (stat  
(OMAP_I2C_STAT_NACK | OMAP_I2C_STAT_AL)) {
-   
omap_i2c_ack_stat(dev, stat  (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR));
-   err |= 
OMAP_I2C_STAT_XUDF;
-   goto complete;
-   }
-   cpu_relax();
-   stat = 
omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
-   }
-   }
+   if (dev-rev = OMAP_I2C_REV_ON_3430 
+   omap3430_workaround(dev, stat, err))
+   goto complete;
 
omap_i2c_write_reg(dev, OMAP_I2C_DATA_REG, w);
}
-- 
1.6.3.3

--
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 1/2] omap i2c: make errata 1.153 workaround a separate function

2009-12-16 Thread Alexander Shishkin
On Wed, Dec 16, 2009 at 03:43:04 +0200, Alexander Shishkin wrote:
 From: Alexander Shishkin ext-alexander.shish...@nokia.com

Please disregard this, I've got the emails wrong here. I'll resend
shortly.

Regards,
--
Alex
--
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] omap i2c: make errata 1.153 workaround a separate function

2009-12-16 Thread Alexander Shishkin
This is to avoid insanely long lines and levels of indentation.

Signed-off-by: Alexander Shishkin virtu...@slind.org
CC: linux-...@vger.kernel.org
CC: linux-omap@vger.kernel.org
---
 drivers/i2c/busses/i2c-omap.c |   43 ++--
 1 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 75bf3ad..ad8242a 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -671,6 +671,27 @@ omap_i2c_rev1_isr(int this_irq, void *dev_id)
 #define omap_i2c_rev1_isr  NULL
 #endif
 
+/*
+ * OMAP3430 Errata 1.153: When an XRDY/XDR is hit, wait for XUDF before writing
+ * data to DATA_REG. Otherwise some data bytes can be lost while transferring
+ * them from the memory to the I2C interface.
+ */
+static int omap3430_workaround(struct omap_i2c_dev *dev, u16 *stat, int *err)
+{
+   while (!(*stat  OMAP_I2C_STAT_XUDF)) {
+   if (*stat  (OMAP_I2C_STAT_NACK | OMAP_I2C_STAT_AL)) {
+   omap_i2c_ack_stat(dev, *stat  (OMAP_I2C_STAT_XRDY |
+   OMAP_I2C_STAT_XDR));
+   *err |= OMAP_I2C_STAT_XUDF;
+   return -1;
+   }
+   cpu_relax();
+   *stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
+   }
+
+   return 0;
+}
+
 static irqreturn_t
 omap_i2c_isr(int this_irq, void *dev_id)
 {
@@ -794,25 +815,9 @@ complete:
break;
}
 
-   /*
-* OMAP3430 Errata 1.153: When an XRDY/XDR
-* is hit, wait for XUDF before writing data
-* to DATA_REG. Otherwise some data bytes can
-* be lost while transferring them from the
-* memory to the I2C interface.
-*/
-
-   if (dev-rev = OMAP_I2C_REV_ON_3430) {
-   while (!(stat  
OMAP_I2C_STAT_XUDF)) {
-   if (stat  
(OMAP_I2C_STAT_NACK | OMAP_I2C_STAT_AL)) {
-   
omap_i2c_ack_stat(dev, stat  (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR));
-   err |= 
OMAP_I2C_STAT_XUDF;
-   goto complete;
-   }
-   cpu_relax();
-   stat = 
omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
-   }
-   }
+   if (dev-rev = OMAP_I2C_REV_ON_3430 
+   omap3430_workaround(dev, stat, err))
+   goto complete;
 
omap_i2c_write_reg(dev, OMAP_I2C_DATA_REG, w);
}
-- 
1.6.3.3

--
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] omap i2c: add a timeout to the busy waiting

2009-12-16 Thread Alexander Shishkin
The errata 1.153 workaround is busy waiting on XUDF bit in interrupt
context, which may lead to kernel hangs. The problem can be reproduced
by running the bus with wrong (too high) speed.

Signed-off-by: Alexander Shishkin virtu...@slind.org
CC: linux-...@vger.kernel.org
CC: linux-omap@vger.kernel.org
---
 drivers/i2c/busses/i2c-omap.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index ad8242a..b474c20 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -678,7 +678,9 @@ omap_i2c_rev1_isr(int this_irq, void *dev_id)
  */
 static int omap3430_workaround(struct omap_i2c_dev *dev, u16 *stat, int *err)
 {
-   while (!(*stat  OMAP_I2C_STAT_XUDF)) {
+   unsigned long timeout = 1;
+
+   while (!(*stat  OMAP_I2C_STAT_XUDF  --timeout)) {
if (*stat  (OMAP_I2C_STAT_NACK | OMAP_I2C_STAT_AL)) {
omap_i2c_ack_stat(dev, *stat  (OMAP_I2C_STAT_XRDY |
OMAP_I2C_STAT_XDR));
@@ -689,6 +691,9 @@ static int omap3430_workaround(struct omap_i2c_dev *dev, 
u16 *stat, int *err)
*stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
}
 
+   if (!timeout)
+   dev_err(dev-dev, timeout waiting on XUDF bit\n);
+
return 0;
 }
 
-- 
1.6.3.3

--
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][RESEND] omap i2c interrupt handler fixes

2009-12-16 Thread Alexander Shishkin
Hi,

This is the second version of the patch that I've sent to linux-omap to
address this issue. This time I've moved the whole errata workaround bit
to a separate function to get rid of too long lines and a couple of extra
levels of indentation.

The actual fix is the same as the first time, it adds a timeout to a busy
loop which happens to take place in an interrupt handler and is capable
of hanging the kernel.

Regards,
--
Alex
--
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] PM: Prevent direct cpufreq scaling during initialization

2009-12-16 Thread Kevin Hilman
Romit Dasgupta ro...@ti.com writes:

 It is seen that the OMAP specific cpufreq initialization code tries to
 scale the MPU frequency to the highest possible without taking care of
 the voltage level. On power on reset the power IC does not provide the
 necessary voltage for the highest available MPU frequency (that would
 satisfy all Si families). This potentially is an window of opportunity
 for things to go wrong.

 Signed-off-by: Romit Dasgupta ro...@ti.com

Looks good.  Pulling into PM branch, and queing in pm-fixes for .33-rc
series.

Kevin

 ---
 diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c
 index 449b6b6..f94df20 100644
 --- a/arch/arm/plat-omap/cpu-omap.c
 +++ b/arch/arm/plat-omap/cpu-omap.c
 @@ -149,8 +149,6 @@ static int __init omap_cpu_init(struct cpufreq_policy 
 *policy)
   VERY_HI_RATE) / 1000;
   }
  
 - clk_set_rate(mpu_clk, policy-cpuinfo.max_freq * 1000);
 -
   policy-min = policy-cpuinfo.min_freq;
   policy-max = policy-cpuinfo.max_freq;
   policy-cur = omap_getspeed(0);
--
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


OMAP3 I2C driver timing problem with multiple messages transfer

2009-12-16 Thread Weng, Wending
Hi All,

Some I2C related protocols as SMBus, each command is composed of 
multiple I2C messages with timing constraint, the delay between two messages 
must be less than 10 ms, otherwise, the SMBus device will be timeout, and the 
command fails. As the function wait_for_completion_timeout is used to wait the 
end of a message, it doesn't guarante the next message will be sent out in 10 
ms after the previous message is completed, so the SMBus command fails very 
often. I developped a patch for fixing this timing problem(2.6.32.RC5), is 
there anybody willing to review and to incorporate the patch into the furture 
release?

Wending
Software Engineer
at Rheinmetall Canada
--
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 v2] OMAP3 : Fix I2C lockup during timeout/error cases

2009-12-16 Thread G, Manjunath Kondaiah

If there are no comments for this patch, can you please consider this patch
for upstream?

-Manjunath
 

 -Original Message-
 From: G, Manjunath Kondaiah 
 Sent: Friday, December 11, 2009 11:09 AM
 To: linux-omap@vger.kernel.org; linux-...@vger.kernel.org; 
 ben-li...@fluff.org
 Cc: G, Manjunath Kondaiah; Menon, Nishanth; Sonasath, Moiz; 
 Krishnamoorthy, Balaji T; Varadarajan, Charu Latha; George, Harith
 Subject: [PATCH v2] OMAP3 : Fix I2C lockup during timeout/error cases
 
 Current OMAP3 I2C driver code does not follow the correct 
 sequence for soft
 reset. Due to this, lock up issues are reported during 
 timeout/error cases.
 
 This patch fixes above issue by disabling I2C controller as 
 per OMAP3430 TRM
 for soft reset. As per TRM, I2C controller needs to be 
 disabled as a first
 step during soft reset.
 
 Here is correct soft reset sequence:
 a. Ensure that the module is disabled
 (clear the I2Ci.I2C_CON[15] I2C_EN bit to 0).
 b. Set the I2Ci.I2C_SYSC[1] SRST bit to 1.
 c. Enable the module by setting I2Ci.I2C_CON[15] I2C_EN bit to 1.
 d. Check the I2Ci.I2C_SYSS[0] RDONE bit until it is set to 1 to
 indicate the software reset is complete.
 
 
 Tested on Zoom2, Zoom3, 3430SDP and 3630SDP
 
 Signed-off-by: Manjunatha GK manj...@ti.com
 Signed-off-by: George, Harithhar...@ti.com
 Acked-by: Varadarajan, Charu Lathach...@ti.com
 ---
 v1 : Initital version
 v2 : Removed delay since time taken for disabling I2C 
 controller is zero
  jiffies
 
  drivers/i2c/busses/i2c-omap.c |5 +
  1 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/i2c/busses/i2c-omap.c 
 b/drivers/i2c/busses/i2c-omap.c
 index 827da08..74620c0 100644
 --- a/drivers/i2c/busses/i2c-omap.c
 +++ b/drivers/i2c/busses/i2c-omap.c
 @@ -265,6 +265,11 @@ static int omap_i2c_init(struct 
 omap_i2c_dev *dev)
   unsigned long internal_clk = 0;
  
   if (dev-rev = OMAP_I2C_REV_2) {
 + /* Disable I2C controller before soft reset */
 + omap_i2c_write_reg(dev, OMAP_I2C_CON_REG,
 + omap_i2c_read_reg(dev, OMAP_I2C_CON_REG) 
 + ~(OMAP_I2C_CON_EN));
 +
   omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG, 
 SYSC_SOFTRESET_MASK);
   /* For some reason we need to set the EN bit before the
* reset done bit gets set. */
 -- 
 1.6.0.4
 
 --
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] mfd: twl: fix twl4030 rename for remaining driver, board files

2009-12-16 Thread Krishnamoorthy, Balaji T
 From: Peter Ujfalusi [mailto:peter.ujfal...@nokia.com]
 I have not followed the thread too closely, but have you made the changes also
 to the sound/soc/codec/twl4030.c driver as well, since that also includes the
 linux/i2c/twl4030.h ?
Yes, that has been taken care
I should have taken little more care, My Apologies.

 
 If that has been taken care by other patch, than:
 
 Acked-By: Peter Ujfalusi peter.ujfal...@nokia.com
Thanks

--
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 v2] mfd: twl: fix twl4030 rename for remaining driver, board files

2009-12-16 Thread Krishnamoorthy, Balaji T
 -Original Message-
 From: Tony Lindgren [mailto:t...@atomide.com]
 
 * Tony Lindgren t...@atomide.com [091215 10:19]:
  * Tony Lindgren t...@atomide.com [091215 09:43]:
   * Krishnamoorthy, Balaji T balaj...@ti.com [091215 08:09]:
Hi Samuel,
Could you please take this patch through the mfd tree.
  
   NAK. Please redo the whole twl rename series so _every_ patch
   in the series builds for _every_ omap and x86. Then let's have
   it sit in for-next before merging it. Otherwise git bisect
   breaks on x86 also.
 
  Argh. Too late. This twl rename series already hit the mainline
  just now.
 
  Has this patch been compile tested on all omaps and x86?
 
 Looks like commit 8bea8672edfca7ec5f661cafb218f1205863b343 already
 took care of the x86 compile issue.
 
 I'll merge the refreshed version below via omap-fixes queue.
Thanks

 
 Regards,
 
 Tony

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


Re: [PATCH] OMAP: omap3_pm_get_suspend_state() error ignored in pwrdm_suspend_get()

2009-12-16 Thread Kevin Hilman
Roel Kluin roel.kl...@gmail.com writes:

 val is an u64 pointer, we need an int to check the error.

 Signed-off-by: Roel Kluin roel.kl...@gmail.com

Thanks, will queue this in my PM fixes queue for .33-rc series.

Kevin

 ---
 Found using coccinelle: http://coccinelle.lip6.fr/

 diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
 index 860b755..081ca85 100644
 --- a/arch/arm/mach-omap2/pm-debug.c
 +++ b/arch/arm/mach-omap2/pm-debug.c
 @@ -488,9 +488,11 @@ int pm_dbg_regset_init(int reg_set)
  
  static int pwrdm_suspend_get(void *data, u64 *val)
  {
 - *val = omap3_pm_get_suspend_state((struct powerdomain *)data);
 + int ret;
 + ret = omap3_pm_get_suspend_state((struct powerdomain *)data);
 + *val = ret;
  
 - if (*val = 0)
 + if (ret = 0)
   return 0;
   return *val;
  }
 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
--
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: OMAP3 I2C driver timing problem with multiple messages transfer

2009-12-16 Thread Weng, Wending
Hi All,

The atached file is the patch for the problem.

Wending

-Original Message-
From: Sonasath, Moiz [mailto:m-sonas...@ti.com]
Sent: December 16, 2009 10:58 AM
To: Weng, Wending; linux-omap@vger.kernel.org; linux-...@vger.kernel.org
Subject: RE: OMAP3 I2C driver timing problem with multiple messages
transfer


Wending,

 -Original Message-
 From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap-
 ow...@vger.kernel.org] On Behalf Of Weng, Wending
 Sent: Wednesday, December 16, 2009 8:54 AM
 To: linux-omap@vger.kernel.org; linux-...@vger.kernel.org
 Subject: OMAP3 I2C driver timing problem with multiple messages transfer

 Hi All,

 Some I2C related protocols as SMBus, each command is composed of
 multiple I2C messages with timing constraint, the delay between two
 messages must be less than 10 ms, otherwise, the SMBus device will be
 timeout, and the command fails. As the function
 wait_for_completion_timeout is used to wait the end of a message, it
 doesn't guarante the next message will be sent out in 10 ms after the
 previous message is completed, so the SMBus command fails very often. I
 developped a patch for fixing this timing problem(2.6.32.RC5), is there
 anybody willing to review and to incorporate the patch into the furture
 release?


Yes, do send out the patch as I am sure people would be interested to review 
your patch as well as incorporate it if it's
needed. Please send out the patch to these mailing lists.

 Wending
 Software Engineer
 at Rheinmetall Canada
 --
 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


i2c.patch
Description: i2c.patch


[PATCH] mfd: twl4030-irq: irq_desc-lock converted to raw_spinlock_t

2009-12-16 Thread Felipe Balbi
commit 239007b8440abff689632f50cdf0f2b9e895b534 converted
the spinlock_t to raw_spinlock_t. Unfortunately twl4030-irq
was left aside on the conversion.

Cc: Thomas Gleixner t...@linutronix.de
Cc: Tony Lindgre t...@atomide.com
Cc: linux-omap@vger.kernel.org
Signed-off-by: Felipe Balbi felipe.ba...@nokia.com
---

I'm not sure this is the expected fix since twl4030-irq handler
should be running in thread context. Currently mask/unmask/set_type
are deferred to a workqueue. Thomas, should this be done ? How
do you expect irq chips on slow busses to implement mask/unmask/set_type ?

 drivers/mfd/twl4030-irq.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c
index 20d29ba..9df9a5a 100644
--- a/drivers/mfd/twl4030-irq.c
+++ b/drivers/mfd/twl4030-irq.c
@@ -568,12 +568,12 @@ static void twl4030_sih_do_edge(struct work_struct *work)
 
bytes[byte] = ~(0x03  off);
 
-   spin_lock_irq(d-lock);
+   raw_spin_lock_irq(d-lock);
if (d-status  IRQ_TYPE_EDGE_RISING)
bytes[byte] |= BIT(off + 1);
if (d-status  IRQ_TYPE_EDGE_FALLING)
bytes[byte] |= BIT(off + 0);
-   spin_unlock_irq(d-lock);
+   raw_spin_unlock_irq(d-lock);
 
edge_change = ~BIT(i);
}
-- 
1.6.6.rc0

--
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] mfd: twl4030-irq: irq_desc-lock converted to raw_spinlock_t

2009-12-16 Thread Felipe Balbi

On Wed, Dec 16, 2009 at 07:18:50PM +0100, Balbi Felipe (Nokia-D/Helsinki) wrote:

commit 239007b8440abff689632f50cdf0f2b9e895b534 converted
the spinlock_t to raw_spinlock_t. Unfortunately twl4030-irq
was left aside on the conversion.

Cc: Thomas Gleixner t...@linutronix.de
Cc: Tony Lindgre t...@atomide.com


oops, my n is failing.

Tony Lindgren, below is better version:

== cut here =

From 17edd64d8e813713da6fb9fa018ab5f79d94d159 Mon Sep 17 00:00:00 2001
From: Felipe Balbi felipe.ba...@nokia.com
Date: Wed, 16 Dec 2009 20:11:22 +0200
Subject: [PATCH] mfd: twl4030-irq: irq_desc-lock converted to raw_spinlock_t

commit 239007b8440abff689632f50cdf0f2b9e895b534 converted
the spinlock_t to raw_spinlock_t. Unfortunately twl4030-irq
was left aside on the conversion.

Cc: Thomas Gleixner t...@linutronix.de
Cc: Tony Lindgren t...@atomide.com
Cc: linux-omap@vger.kernel.org
Signed-off-by: Felipe Balbi felipe.ba...@nokia.com
---

I'm not sure this is the expected fix since twl4030-irq handler
should be running in thread context. Currently mask/unmask/set_type
are deferred to a workqueue. Thomas, should this be done ? How
do you expect irq chips on slow busses to implement mask/unmask/set_type ?

 drivers/mfd/twl4030-irq.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c
index 20d29ba..9df9a5a 100644
--- a/drivers/mfd/twl4030-irq.c
+++ b/drivers/mfd/twl4030-irq.c
@@ -568,12 +568,12 @@ static void twl4030_sih_do_edge(struct work_struct *work)
 
 		bytes[byte] = ~(0x03  off);
 
-		spin_lock_irq(d-lock);

+   raw_spin_lock_irq(d-lock);
if (d-status  IRQ_TYPE_EDGE_RISING)
bytes[byte] |= BIT(off + 1);
if (d-status  IRQ_TYPE_EDGE_FALLING)
bytes[byte] |= BIT(off + 0);
-   spin_unlock_irq(d-lock);
+   raw_spin_unlock_irq(d-lock);
 
 		edge_change = ~BIT(i);

}
--
1.6.6.rc0


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


[APPLIED] [PATCH] OMAP3: serial - fix bug introduced in

2009-12-16 Thread Tony Lindgren
This patch has been applied to the linux-omap
by youw fwiendly patch wobot.

Branch in linux-omap: omap-fixes

Initial commit ID (Likely to change): 01ae00d38cb195d8bbf1653400c3e27d9e4f2a70

PatchWorks
http://patchwork.kernel.org/patch/67293/

Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=01ae00d38cb195d8bbf1653400c3e27d9e4f2a70


--
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/4] Build fixes for omap

2009-12-16 Thread Tony Lindgren
Hi all,

Here are build fixes for omaps and a suspend fix for omap3.
There's one more build fix coming from the linux-usb list for
H2 transceiver.

Planning to send these today before starting to look into
the other pending fixes.

Regards,

Tony

---

Balaji T K (1):
  mfd: twl: fix twl4030 rename for remaining driver, board files

Mika Westerberg (1):
  OMAP3: serial - fix bug introduced in

Olof Johansson (1):
  omap3: Allow EHCI to be built on OMAP3

Thomas Weber (1):
  USB ehci: replace mach header with plat


 arch/arm/mach-omap2/Kconfig  |1 +
 arch/arm/mach-omap2/board-cm-t35.c   |2 +-
 arch/arm/mach-omap2/board-igep0020.c |2 +-
 arch/arm/mach-omap2/board-omap3evm.c |2 +-
 arch/arm/mach-omap2/board-omap3touchbook.c   |2 +-
 arch/arm/mach-omap2/board-rx51-peripherals.c |2 +-
 arch/arm/mach-omap2/board-zoom-peripherals.c |2 +-
 arch/arm/mach-omap2/serial.c |7 ---
 drivers/usb/host/ehci-omap.c |2 +-
 drivers/video/omap/lcd_ldp.c |4 ++--
 drivers/video/omap/lcd_omap2evm.c|   10 +-
 drivers/video/omap/lcd_omap3beagle.c |2 +-
 drivers/video/omap/lcd_omap3evm.c|   10 +-
 drivers/video/omap/lcd_overo.c   |2 +-
 sound/soc/omap/sdp3430.c |6 +++---
 15 files changed, 29 insertions(+), 27 deletions(-)

-- 
Signature
--
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 4/4] OMAP3: serial - fix bug introduced in

2009-12-16 Thread Tony Lindgren
From: Mika Westerberg ext-mika.1.westerb...@nokia.com

Commit f62349ee9788b1d94c55eb6c291d74a1f69bdd9e had side effect that
causes kernel to oops when we are suspending to ram:

# echo mem  /sys/power/state

WARNING: at kernel/irq/manage.c:858 __free_irq+0x90/0x174()
Trying to free already-free IRQ 72
Modules linked in:
Backtrace:
[c00328d0] (dump_backtrace+0x0/0x110) from [c0347298] 
(dump_stack+0x18/0x1c)
 r7:dfd4be08 r6:c009505c r5:c03fbfd1 r4:035a
[c0347280] (dump_stack+0x0/0x1c) from [c005a408] 
(warn_slowpath_common+0x50/0x68)
[c005a3b8] (warn_slowpath_common+0x0/0x68) from [c005a46c] 
(warn_slowpath_fmt+0x30)
 r7:c0474afc r6:0048 r5: r4:c0474ac0
[c005a43c] (warn_slowpath_fmt+0x0/0x38) from [c009505c] 
(__free_irq+0x90/0x174)
 r3:0048 r2:c03fc0ef
[c0094fcc] (__free_irq+0x0/0x174) from [c0095184] 
(free_irq+0x44/0x64)
[c0095140] (free_irq+0x0/0x64) from [c0038100] 
(omap_uart_enable_irqs+0x4c/0x90)
 r7:c034d58c r6:0003 r5: r4:c0463028
[c00380b4] (omap_uart_enable_irqs+0x0/0x90) from [c003d8f8] 
(omap3_pm_begin+0x1c/0)
 r5:0003 r4:
[c003d8dc] (omap3_pm_begin+0x0/0x28) from [c008d008] 
(suspend_devices_and_enter+0x)
[c008cfd8] (suspend_devices_and_enter+0x0/0x1dc) from [c008d29c] 
(enter_state+0xe8)
 r5:c03f7f46 r4:
[c008d1b4] (enter_state+0x0/0x140) from [c008c8e0] 
(state_store+0x9c/0xc4)
 r7:c034d58c r6:0003 r5:0003 r4:c03f7f46
[c008c844] (state_store+0x0/0xc4) from [c01cb2dc] 
(kobj_attr_store+0x20/0x24)
[c01cb2bc] (kobj_attr_store+0x0/0x24) from [c0119420] 
(sysfs_write_file+0x114/0x14)
[c011930c] (sysfs_write_file+0x0/0x148) from [c00cb298] 
(vfs_write+0xb8/0x164)
[c00cb1e0] (vfs_write+0x0/0x164) from [c00cb408] 
(sys_write+0x44/0x70)
 r8:4001f000 r7:0004 r6:df81bd00 r5: r4:
[c00cb3c4] (sys_write+0x0/0x70) from [c002f040] 
(ret_fast_syscall+0x0/0x38)
 r8:c002f204 r7:0004 r6:401fa5e8 r5:4001f000 r4:0004

This is due the fact that uart_list list was populated in
omap_serial_early_init() and omap_uart_enable_irqs() went through this
list even when serial idle wasn't enabled for all uarts.

This patch moves the code that populates the uart_list and enables uart
clocks into omap_serial_init_port().

Signed-off-by: Mika Westerberg ext-mika.1.westerb...@nokia.com
Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/serial.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 39b797b..19805a7 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -640,12 +640,9 @@ void __init omap_serial_early_init(void)
uart-num = i;
p-private_data = uart;
uart-p = p;
-   list_add_tail(uart-node, uart_list);
 
if (cpu_is_omap44xx())
p-irq += 32;
-
-   omap_uart_enable_clocks(uart);
}
 }
 
@@ -673,9 +670,13 @@ void __init omap_serial_init_port(int port)
pdev = uart-pdev;
dev = pdev-dev;
 
+   omap_uart_enable_clocks(uart);
+
omap_uart_reset(uart);
omap_uart_idle_init(uart);
 
+   list_add_tail(uart-node, uart_list);
+
if (WARN_ON(platform_device_register(pdev)))
return;
 

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


[ANNOUNCE] new PM branch, rebased to current master

2009-12-16 Thread Kevin Hilman
Hello,

I've just pushed the latest PM branch.  As usual, all the gory details
can be found on the wiki[1], but I'll highlight the important changes
here:

- PM branch getting smaller: The off-mode support and CPUidle support
  is now in mainline, so it's no longer in PM branch.

- omap3_pm_defconfig: now works an all supported boards.  I moved to
  the new DEBUG_LL_NONE so all boards should work out of the box without
  having to switch DEBUG_LL_UART* setup.

- voltage_off_while_idle: only modifies the VOLTCTRL reg during OFF
  transitions instead of when debugfs file is changed

Otherwise, this is primarily a rebase and inclusion of several
patches/fixes from the mailing list.

The biggest change is on how the PM branch will be managed.  As of
this release, the PM branch will no longer be continually rebased.
Instead, it will remain mergable.  I will be rebuilding the PM
branch in a similar way that Tony is now doing the master branch.

Kevin

[1] http://elinux.org/OMAP_Power_Management
--
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 00/10 V5] omap3: pm: introduce support for 3630 OPPs

2009-12-16 Thread Kevin Hilman
Nishanth Menon n...@ti.com writes:

 Hi,
 Thanks for all the comments. Here are the *changed* patches since V5

 What changed in V5:
 * review comment incorporated
 * vsel is deprecated now
 * I seem to have hit a checkpatch.pl bug as in 
   http://lkml.org/lkml/2009/12/11/573, made me check the usage
   of __deprecated for struct params, and used it in a
   consistent manner to functions..
 * More warnings added to build :( (deprecated ones ofcourse)
 * removed OMAP_OPP_DEF_TERMINATOR
 * 3430 and 3630 patches changed as a result

 History:
 V4: http://marc.info/?t=12603396261r=1w=2
 V3: http://marc.info/?t=12591223421r=1w=2
 V2: http://marc.info/?l=linux-omapm=125809232732700w=2
 V1: http://marc.info/?l=linux-omapm=125800488923479w=2

 Ref: http://elinux.org/OMAP_Power_Management#Future_directions

 TODO: The list is still the same as in:
 http://marc.info/?l=linux-omapm=126033945313269w=2

FYI...

To facilitate the ongoing discussions on OPP rework, and to have a
common base, this series is available as a branch in my linux-omap-pm
repo[1].

The branch is called 'pm-wip-opp' and I have rebased onto the PM
branch I pushed today.

Kevin

[1] http://git.kernel.org/?p=linux/kernel/git/khilman/linux-omap-pm.git
--
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 1/4] omap3: Allow EHCI to be built on OMAP3

2009-12-16 Thread Felipe Balbi
On Wed, 2009-12-16 at 11:09 -0800, Tony Lindgren wrote:
 From: Olof Johansson o...@lixom.net
 
 OMAP34XX has EHCI, so select USB_ARCH_HAS_EHCI.
 
 Signed-off-by: Olof Johansson o...@lixom.net
 Acked-by: Anand Gadiyar gadi...@ti.com
 Signed-off-by: Tony Lindgren t...@atomide.com

fwiw:

Acked-by: Felipe Balbi felipe.ba...@nokia.com


-- 
balbi

--
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] DSPBRIDGE: return right error codes wmd directory

2009-12-16 Thread Guzman Lugo, Fernando
From 1eff8623eafbff7dd187a3e226442d5650adf7c3 Mon Sep 17 00:00:00 2001
From: Fernando Guzman Lugo x0095...@ti.com
Date: Wed, 16 Dec 2009 14:53:53 -0600
Subject: [PATCH] DSPBRIDGE: return right error codes wmd directory

This patch fixes the bad error codes returned by some functions,
also it is taking cafe about some status returned by
functions which were not checked before and removing unused check
or status variables.

Signed-off-by: Fernando Guzman Lugo x0095...@ti.com
---
 drivers/dsp/bridge/wmd/chnl_sm.c|  226 ++
 drivers/dsp/bridge/wmd/io_sm.c  |  319 ++
 drivers/dsp/bridge/wmd/mmu_fault.c  |   18 +--
 drivers/dsp/bridge/wmd/msg_sm.c |   45 +++--
 drivers/dsp/bridge/wmd/tiomap3430.c |   28 +--
 drivers/dsp/bridge/wmd/tiomap3430_pwr.c |   12 +-
 drivers/dsp/bridge/wmd/tiomap_io.c  |   10 +-
 drivers/dsp/bridge/wmd/tiomap_sm.c  |2 -
 drivers/dsp/bridge/wmd/ue_deh.c |   38 +---
 9 files changed, 311 insertions(+), 387 deletions(-)

diff --git a/drivers/dsp/bridge/wmd/chnl_sm.c b/drivers/dsp/bridge/wmd/chnl_sm.c
index 462fc58..fb1c8ba 100644
--- a/drivers/dsp/bridge/wmd/chnl_sm.c
+++ b/drivers/dsp/bridge/wmd/chnl_sm.c
@@ -109,7 +109,32 @@ DSP_STATUS WMD_CHNL_AddIOReq(struct CHNL_OBJECT *hChnl, 
void *pHostBuf,
  %x Id %d\n, pChnl, CHNL_IsOutput(pChnl-uMode),
  pChnl-uChnlType, pChnl-uId);

-   fIsEOS = (cBytes == 0) ? true : false;
+   /* Validate args:  */
+   if (pHostBuf == NULL) {
+   status = DSP_EPOINTER;
+   } else if (!MEM_IsValidHandle(pChnl, CHNL_SIGNATURE)) {
+   status = DSP_EHANDLE;
+   } else if (fIsEOS  CHNL_IsInput(pChnl-uMode)) {
+   status = CHNL_E_NOEOS;
+   } else {
+   /* Check the channel state: only queue chirp if channel state
+* allows */
+   dwState = pChnl-dwState;
+   if (dwState != CHNL_STATEREADY) {
+   if (dwState  CHNL_STATECANCEL)
+   status = CHNL_E_CANCELLED;
+   else if ((dwState  CHNL_STATEEOS)
+   CHNL_IsOutput(pChnl-uMode))
+   status = CHNL_E_EOS;
+   else
+   /* No other possible states left: */
+   DBC_Assert(0);
+   }
+   }
+   if (DSP_FAILED(status))
+   goto func_end;
+
+   fIsEOS = (cBytes == 0);

if (pChnl-uChnlType == CHNL_PCPY  pChnl-uId  1  pHostBuf) {
if (!(pHostBuf  (void *)USERMODE_ADDR)) {
@@ -122,7 +147,7 @@ DSP_STATUS WMD_CHNL_AddIOReq(struct CHNL_OBJECT *hChnl, 
void *pHostBuf,
status = DSP_EMEMORY;
DBG_Trace(DBG_LEVEL7,
 No memory to allocate kernel buffer\n);
-   goto func_cont;
+   goto func_end;
}
if (CHNL_IsOutput(pChnl-uMode)) {
status = copy_from_user(pHostSysBuf, pHostBuf,
@@ -135,33 +160,11 @@ DSP_STATUS WMD_CHNL_AddIOReq(struct CHNL_OBJECT *hChnl, 
void *pHostBuf,
MEM_Free(pHostSysBuf);
pHostSysBuf = NULL;
status = DSP_EPOINTER;
+   goto func_end;
}
}
}
 func_cont:
-   /* Validate args:  */
-   if (pHostBuf == NULL) {
-   status = DSP_EPOINTER;
-   } else if (!MEM_IsValidHandle(pChnl, CHNL_SIGNATURE)) {
-   status = DSP_EHANDLE;
-   } else if (fIsEOS  CHNL_IsInput(pChnl-uMode)) {
-   status = CHNL_E_NOEOS;
-   } else {
-   /* Check the channel state: only queue chirp if channel state
-* allows */
-   dwState = pChnl-dwState;
-   if (dwState != CHNL_STATEREADY) {
-   if (dwState  CHNL_STATECANCEL) {
-   status = CHNL_E_CANCELLED;
-   } else if ((dwState  CHNL_STATEEOS)
-   CHNL_IsOutput(pChnl-uMode)) {
-   status = CHNL_E_EOS;
-   } else {
-   /* No other possible states left: */
-   DBC_Assert(0);
-   }
-   }
-   }
/* Mailbox IRQ is disabled to avoid race condition with DMA/ZCPY
 * channels. DPCCS is held to avoid race conditions with PCPY channels.
 * If DPC is scheduled in process context (IO_Schedule) and any
@@ -191,47 +194,47 @@ func_cont:
if (pChnl-uChnlType == CHNL_PCPY  pChnl-uId  1)
pChirp-pHostSysBuf = pHostSysBuf;

-   if (DSP_SUCCEEDED(status)) {
-   

[rfc/rft/patch-v2.6.32-omap1+ 1/2] arm: omap: clock: add omap_udc to clkdev

2009-12-16 Thread Felipe Balbi
then we can later remove all of those cpu conditionals
on drivers/usb/gadget/omap_udc.c

Cc: Paul Walmsley p...@pwsan.com
Signed-off-by: Felipe Balbi felipe.ba...@nokia.com
---

Paul, do you think the following is correct ? Judging
by omap_udc.c those are the clocks used by that driver
but I don't have boards to try out.

Anyways, after this patch hits mainline, I can send
patches to omap_udc.c removing the cpu conditional
clk_get().

 arch/arm/mach-omap1/clock_data.c |   10 +-
 arch/arm/mach-omap2/clock2xxx_data.c |4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c
index ab995a9..72169e7 100644
--- a/arch/arm/mach-omap1/clock_data.c
+++ b/arch/arm/mach-omap1/clock_data.c
@@ -622,7 +622,7 @@ static struct omap_clk omap_clks[] = {
/* CK_GEN3 clocks */
CLK(NULL,   tc_ck,tc_ck.clk, CK_16XX | CK_1510 | 
CK_310 | CK_7XX),
CLK(NULL,   tipb_ck,  tipb_ck,   CK_1510 | CK_310),
-   CLK(NULL,   l3_ocpi_ck,   l3_ocpi_ck,CK_16XX | CK_7XX),
+   CLK(omap_udc, l3_ocpi_ck,   l3_ocpi_ck,CK_16XX | CK_7XX),
CLK(NULL,   tc1_ck,   tc1_ck,CK_16XX),
CLK(NULL,   tc2_ck,   tc2_ck,CK_16XX),
CLK(NULL,   dma_ck,   dma_ck,CK_16XX | CK_1510 | 
CK_310),
@@ -640,10 +640,10 @@ static struct omap_clk omap_clks[] = {
CLK(NULL,   uart3_ck, uart3_1510,CK_1510 | CK_310),
CLK(NULL,   uart3_ck, uart3_16xx.clk, CK_16XX),
CLK(NULL,   usb_clko, usb_clko,  CK_16XX | CK_1510 | 
CK_310),
-   CLK(NULL,   usb_hhc_ck,   usb_hhc_ck1510, CK_1510 | CK_310),
-   CLK(NULL,   usb_hhc_ck,   usb_hhc_ck16xx, CK_16XX),
-   CLK(NULL,   usb_dc_ck,usb_dc_ck, CK_16XX),
-   CLK(NULL,   usb_dc_ck,usb_dc_ck7xx,  CK_7XX),
+   CLK(omap_udc, usb_hhc_ck,   usb_hhc_ck1510, CK_1510 | CK_310),
+   CLK(omap_hdc, usb_hhc_ck,   usb_hhc_ck16xx, CK_16XX),
+   CLK(omap_udc, usb_dc_ck,usb_dc_ck, CK_16XX),
+   CLK(omap_udc, usb_dc_ck,usb_dc_ck7xx,  CK_7XX),
CLK(NULL,   mclk, mclk_1510, CK_1510 | CK_310),
CLK(NULL,   mclk, mclk_16xx, CK_16XX),
CLK(NULL,   bclk, bclk_1510, CK_1510 | CK_310),
diff --git a/arch/arm/mach-omap2/clock2xxx_data.c 
b/arch/arm/mach-omap2/clock2xxx_data.c
index 97dc7cf..c21bf7c 100644
--- a/arch/arm/mach-omap2/clock2xxx_data.c
+++ b/arch/arm/mach-omap2/clock2xxx_data.c
@@ -2126,7 +2126,7 @@ static struct omap_clk omap24xx_clks[] = {
/* L3 domain clocks */
CLK(NULL,   core_l3_ck,   core_l3_ck,CK_243X | CK_242X),
CLK(NULL,   ssi_fck,  ssi_ssr_sst_fck, CK_243X | CK_242X),
-   CLK(NULL,   usb_l4_ick,   usb_l4_ick,CK_243X | CK_242X),
+   CLK(omap_udc, usb_l4_ick,   usb_l4_ick,CK_243X | CK_242X),
/* L4 domain clocks */
CLK(NULL,   l4_ck,l4_ck, CK_243X | CK_242X),
CLK(NULL,   ssi_l4_ick,   ssi_l4_ick,CK_243X | CK_242X),
@@ -2221,7 +2221,7 @@ static struct omap_clk omap24xx_clks[] = {
CLK(omap_rng, ick,  rng_ick,   CK_243X | CK_242X),
CLK(NULL,   aes_ick,  aes_ick,   CK_243X | CK_242X),
CLK(NULL,   pka_ick,  pka_ick,   CK_243X | CK_242X),
-   CLK(NULL,   usb_fck,  usb_fck,   CK_243X | CK_242X),
+   CLK(omap_udc, usb_fck,  usb_fck,   CK_243X | CK_242X),
CLK(musb_hdrc,ick,  usbhs_ick, CK_243X),
CLK(mmci-omap-hs.0, ick,mmchs1_ick,CK_243X),
CLK(mmci-omap-hs.0, fck,mmchs1_fck,CK_243X),
-- 
1.6.6.rc0

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


[GIT PULL] omap build fixes

2009-12-16 Thread Tony Lindgren
Hi Linus,

Please pull omap build fixes from:

git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git 
omap-fixes-for-linus

In addition to the three build fixes, there's also a suspend fix
for omap serial init.

Regards,

Tony


The following changes since commit 8bea8672edfca7ec5f661cafb218f1205863b343:
  Stephen Rothwell (1):
mfd: compile fix for twl4030 renaming

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git 
omap-fixes-for-linus

Balaji T K (1):
  mfd: twl: fix twl4030 rename for remaining driver, board files

Mika Westerberg (1):
  OMAP3: serial - fix bug introduced in

Olof Johansson (1):
  omap3: Allow EHCI to be built on OMAP3

Thomas Weber (1):
  USB ehci: replace mach header with plat

 arch/arm/mach-omap2/Kconfig  |1 +
 arch/arm/mach-omap2/board-cm-t35.c   |2 +-
 arch/arm/mach-omap2/board-igep0020.c |2 +-
 arch/arm/mach-omap2/board-omap3evm.c |2 +-
 arch/arm/mach-omap2/board-omap3touchbook.c   |2 +-
 arch/arm/mach-omap2/board-rx51-peripherals.c |2 +-
 arch/arm/mach-omap2/board-zoom-peripherals.c |2 +-
 arch/arm/mach-omap2/serial.c |7 ---
 drivers/usb/host/ehci-omap.c |2 +-
 drivers/video/omap/lcd_ldp.c |4 ++--
 drivers/video/omap/lcd_omap2evm.c|   10 +-
 drivers/video/omap/lcd_omap3beagle.c |2 +-
 drivers/video/omap/lcd_omap3evm.c|   10 +-
 drivers/video/omap/lcd_overo.c   |2 +-
 sound/soc/omap/sdp3430.c |6 +++---
 15 files changed, 29 insertions(+), 27 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


Re: [PATCH 00/10 V5] omap3: pm: introduce support for 3630 OPPs

2009-12-16 Thread Kevin Hilman
Kevin Hilman khil...@deeprootsystems.com writes:

 Nishanth Menon n...@ti.com writes:

 Hi,
 Thanks for all the comments. Here are the *changed* patches since V5

 What changed in V5:
 * review comment incorporated
 * vsel is deprecated now
 * I seem to have hit a checkpatch.pl bug as in 
   http://lkml.org/lkml/2009/12/11/573, made me check the usage
   of __deprecated for struct params, and used it in a
   consistent manner to functions..
 * More warnings added to build :( (deprecated ones ofcourse)
 * removed OMAP_OPP_DEF_TERMINATOR
 * 3430 and 3630 patches changed as a result
[...]

 To facilitate the ongoing discussions on OPP rework, and to have a
 common base, this series is available as a branch in my linux-omap-pm
 repo[1].

 The branch is called 'pm-wip-opp' and I have rebased onto the PM
 branch I pushed today.

I forgot to mention that I've also pushed the patch for removing OPP
interface from the OMAP PM layer[1] to the work-in-progress OPP
branch.

Kevin

[1] http://marc.info/?l=linux-omapm=125917007423545w=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


Re: [PATCH] mfd: twl4030-irq: irq_desc-lock converted to raw_spinlock_t

2009-12-16 Thread Thomas Gleixner
On Wed, 16 Dec 2009, Felipe Balbi wrote:
 commit 239007b8440abff689632f50cdf0f2b9e895b534 converted
 the spinlock_t to raw_spinlock_t. Unfortunately twl4030-irq
 was left aside on the conversion.
 
 Cc: Thomas Gleixner t...@linutronix.de
 Cc: Tony Lindgren t...@atomide.com
 Cc: linux-omap@vger.kernel.org
 Signed-off-by: Felipe Balbi felipe.ba...@nokia.com
 ---
 
 I'm not sure this is the expected fix since twl4030-irq handler
 should be running in thread context. Currently mask/unmask/set_type
 are deferred to a workqueue. Thomas, should this be done ? How
 do you expect irq chips on slow busses to implement mask/unmask/set_type ?

That does not matter whether this runs in thread context or not. We
changed the type of the lock from spinlock to raw_spinlock. So we need
to use the corresponding raw_spin_* functions for it independent of
the context. Your patch is completely correct.

Acked-by: Thomas Gleixner t...@linutronix.de
 
  drivers/mfd/twl4030-irq.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c
 index 20d29ba..9df9a5a 100644
 --- a/drivers/mfd/twl4030-irq.c
 +++ b/drivers/mfd/twl4030-irq.c
 @@ -568,12 +568,12 @@ static void twl4030_sih_do_edge(struct work_struct
 *work)
   bytes[byte] = ~(0x03  off);
  -spin_lock_irq(d-lock);
 + raw_spin_lock_irq(d-lock);
   if (d-status  IRQ_TYPE_EDGE_RISING)
   bytes[byte] |= BIT(off + 1);
   if (d-status  IRQ_TYPE_EDGE_FALLING)
   bytes[byte] |= BIT(off + 0);
 - spin_unlock_irq(d-lock);
 + raw_spin_unlock_irq(d-lock);
   edge_change = ~BIT(i);
   }
 -- 
 1.6.6.rc0
 
 
 -- 
 balbi
 
--
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


[PATCHv3 1/3] DSPBRIDGE: Interface tightening to check for invalid input

2009-12-16 Thread Ramos Falcon, Ernesto
From b55f8999690d6502d82b61fe2854d9f0e32cf8be Mon Sep 17 00:00:00 2001
From: Ernesto Ramos erne...@ti.com
Date: Wed, 16 Dec 2009 16:20:11 -0600
Subject: [PATCHv3 1/3] DSPBRIDGE: Interface tightening to check for invalid 
input parameters.

Add more error checking and range to address usecases
accessing kernel API directly.

Signed-off-by: Ernesto Ramos erne...@ti.com
---
 arch/arm/plat-omap/include/dspbridge/dbdefs.h |4 +-
 drivers/dsp/bridge/pmgr/wcd.c |   90 +++-
 drivers/dsp/bridge/services/mem.c |4 -
 3 files changed, 74 insertions(+), 24 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/dbdefs.h 
b/arch/arm/plat-omap/include/dspbridge/dbdefs.h
index 3570171..6c78c8f 100644
--- a/arch/arm/plat-omap/include/dspbridge/dbdefs.h
+++ b/arch/arm/plat-omap/include/dspbridge/dbdefs.h
@@ -217,7 +217,9 @@
DSP_DCDLIBRARYTYPE,
DSP_DCDCREATELIBTYPE,
DSP_DCDEXECUTELIBTYPE,
-   DSP_DCDDELETELIBTYPE
+   DSP_DCDDELETELIBTYPE,
+   DSP_DCDMAXOBJTYPE   /* Don't add enum values after this */
+   /* it should the last DCD object type */
} ;
 
 /* Processor states */
diff --git a/drivers/dsp/bridge/pmgr/wcd.c b/drivers/dsp/bridge/pmgr/wcd.c
index dc65f07..ab18740 100644
--- a/drivers/dsp/bridge/pmgr/wcd.c
+++ b/drivers/dsp/bridge/pmgr/wcd.c
@@ -479,6 +479,10 @@ u32 MGRWRAP_EnumNode_Info(union Trapped_Args *args, void 
*pr_ctxt)
 args-ARGS_MGR_ENUMNODE_INFO.pNDBProps,
 args-ARGS_MGR_ENUMNODE_INFO.uNDBPropsSize,
 args-ARGS_MGR_ENUMNODE_INFO.puNumNodes);
+
+   if (size  sizeof(struct DSP_NDBPROPS))
+   return DSP_ESIZE;
+
pNDBProps = MEM_Alloc(size, MEM_NONPAGED);
if (pNDBProps == NULL)
status = DSP_EMEMORY;
@@ -516,6 +520,10 @@ u32 MGRWRAP_EnumProc_Info(union Trapped_Args *args, void 
*pr_ctxt)
 args-ARGS_MGR_ENUMPROC_INFO.pProcessorInfo,
 args-ARGS_MGR_ENUMPROC_INFO.uProcessorInfoSize,
 args-ARGS_MGR_ENUMPROC_INFO.puNumProcs);
+
+   if (size  sizeof(struct DSP_PROCESSORINFO))
+   return DSP_ESIZE;
+
pProcessorInfo = MEM_Alloc(size, MEM_NONPAGED);
if (pProcessorInfo == NULL)
status = DSP_EMEMORY;
@@ -548,6 +556,11 @@ u32 MGRWRAP_RegisterObject(union Trapped_Args *args, void 
*pr_ctxt)
char *pszPathName = NULL;
DSP_STATUS status = DSP_SOK;
 
+
+   GT_1trace(WCD_debugMask, GT_ENTER,
+MGRWRAP_RegisterObject: entered 
+0x%x\n, args-ARGS_MGR_REGISTEROBJECT.pUuid);
+
cp_fm_usr(pUuid, args-ARGS_MGR_REGISTEROBJECT.pUuid, status, 1);
if (DSP_FAILED(status))
goto func_end;
@@ -565,9 +578,9 @@ u32 MGRWRAP_RegisterObject(union Trapped_Args *args, void 
*pr_ctxt)
goto func_end;
}
 
-   GT_1trace(WCD_debugMask, GT_ENTER,
-MGRWRAP_RegisterObject: entered pg2hMsg 
-0x%x\n, args-ARGS_MGR_REGISTEROBJECT.pUuid);
+   if (args-ARGS_MGR_REGISTEROBJECT.objType = DSP_DCDMAXOBJTYPE)
+   return DSP_EINVALIDARG;
+
status = DCD_RegisterObject(pUuid,
args-ARGS_MGR_REGISTEROBJECT.objType,
(char *)pszPathName);
@@ -756,7 +769,10 @@ u32 PROCWRAP_EnumNode_Info(union Trapped_Args *args, void 
*pr_ctxt)
 args-ARGS_PROC_ENUMNODE_INFO.uNodeTabSize,
 args-ARGS_PROC_ENUMNODE_INFO.puNumNodes,
 args-ARGS_PROC_ENUMNODE_INFO.puAllocated);
-   DBC_Require(args-ARGS_PROC_ENUMNODE_INFO.uNodeTabSize = MAX_NODES);
+
+   if (!args-ARGS_PROC_ENUMNODE_INFO.uNodeTabSize)
+   return DSP_ESIZE;
+
status = PROC_EnumNodes(args-ARGS_PROC_ENUMNODE_INFO.hProcessor,
aNodeTab,
args-ARGS_PROC_ENUMNODE_INFO.uNodeTabSize,
@@ -779,6 +795,9 @@ u32 PROCWRAP_FlushMemory(union Trapped_Args *args, void 
*pr_ctxt)
 
GT_0trace(WCD_debugMask, GT_ENTER, PROCWRAP_FlushMemory: entered\n);
 
+   if (args-ARGS_PROC_FLUSHMEMORY.ulFlags  PROC_WRBK_INV_ALL)
+   return DSP_EINVALIDARG;
+
status = PROC_FlushMemory(args-ARGS_PROC_FLUSHMEMORY.hProcessor,
 args-ARGS_PROC_FLUSHMEMORY.pMpuAddr,
 args-ARGS_PROC_FLUSHMEMORY.ulSize,
@@ -813,9 +832,6 @@ u32 PROCWRAP_EnumResources(union Trapped_Args *args, void 
*pr_ctxt)
DSP_STATUS status = DSP_SOK;
struct DSP_RESOURCEINFO pResourceInfo;
 
-   if (DSP_FAILED(status))
-   goto func_end;
-
GT_4trace(WCD_debugMask, GT_ENTER,
 PROCWRAP_EnumResources: entered args:\n
 0x%x hProcessor: 0x%x\tuResourceMask: 0x%x\tpResourceInfo
@@ -824,15 +840,19 @@ u32 

[PATCHv2 2/3] DSPBRIDGE: Undo allocation of resources in case of cp_to_usr fails.

2009-12-16 Thread Ramos Falcon, Ernesto
From 1a6375220b22a97526797835844c9be15e165cd6 Mon Sep 17 00:00:00 2001
From: Ernesto Ramos erne...@ti.com
Date: Wed, 16 Dec 2009 14:55:43 -0600
Subject: [PATCH] DSPBRIDGE: Undo allocation of resources in case of cp_to_usr 
fails.

Release resources allocated during MAP, Node Allocation,
STRM Buf Allocation in the case of cp_to_usr fails.

Signed-off-by: Ernesto Ramos erne...@ti.com
---
 drivers/dsp/bridge/pmgr/wcd.c |   35 ---
 1 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/drivers/dsp/bridge/pmgr/wcd.c b/drivers/dsp/bridge/pmgr/wcd.c
index ab18740..917e549 100644
--- a/drivers/dsp/bridge/pmgr/wcd.c
+++ b/drivers/dsp/bridge/pmgr/wcd.c
@@ -1045,8 +1045,11 @@ u32 PROCWRAP_Map(union Trapped_Args *args, void *pr_ctxt)
 args-ARGS_PROC_MAPMEM.pReqAddr, pMapAddr,
 args-ARGS_PROC_MAPMEM.ulMapAttr, pr_ctxt);
if (DSP_SUCCEEDED(status)) {
-   if (put_user(pMapAddr, args-ARGS_PROC_MAPMEM.ppMapAddr))
+   if (put_user(pMapAddr, args-ARGS_PROC_MAPMEM.ppMapAddr)) {
status = DSP_EINVALIDARG;
+   PROC_UnMap(args-ARGS_PROC_MAPMEM.hProcessor,
+   pMapAddr, pr_ctxt);
+   }
 
}
return status;
@@ -1091,9 +1094,13 @@ u32 PROCWRAP_ReserveMemory(union Trapped_Args *args, 
void *pr_ctxt)
GT_0trace(WCD_debugMask, GT_ENTER, PROCWRAP_ReserveMemory: entered\n);
status = PROC_ReserveMemory(args-ARGS_PROC_RSVMEM.hProcessor,
   args-ARGS_PROC_RSVMEM.ulSize, pRsvAddr);
-   if (put_user(pRsvAddr, args-ARGS_PROC_RSVMEM.ppRsvAddr))
-   status = DSP_EINVALIDARG;
-
+   if (DSP_SUCCEEDED(status)) {
+   if (put_user(pRsvAddr, args-ARGS_PROC_RSVMEM.ppRsvAddr)) {
+   status = DSP_EINVALIDARG;
+   PROC_UnReserveMemory(args-ARGS_PROC_RSVMEM.hProcessor,
+   pRsvAddr);
+   }
+   }
return status;
 }
 
@@ -1196,7 +1203,13 @@ u32 NODEWRAP_Allocate(union Trapped_Args *args, void 
*pr_ctxt)
  nodeId, (struct DSP_CBDATA *)pArgs,
  pAttrIn, hNode, pr_ctxt);
}
-   cp_to_usr(args-ARGS_NODE_ALLOCATE.phNode, hNode, status, 1);
+   if (DSP_SUCCEEDED(status)) {
+   cp_to_usr(args-ARGS_NODE_ALLOCATE.phNode, hNode, status, 1);
+   if (DSP_FAILED(status)) {
+   status = DSP_EPOINTER;
+   NODE_Delete(hNode, pr_ctxt);
+   }
+   }
 func_cont:
if (pArgs)
MEM_Free(pArgs);
@@ -1530,8 +1543,16 @@ u32 STRMWRAP_AllocateBuffer(union Trapped_Args *args, 
void *pr_ctxt)
status = STRM_AllocateBuffer(args-ARGS_STRM_ALLOCATEBUFFER.hStream,
 args-ARGS_STRM_ALLOCATEBUFFER.uSize,
 apBuffer, uNumBufs, pr_ctxt);
-   cp_to_usr(args-ARGS_STRM_ALLOCATEBUFFER.apBuffer, apBuffer, status,
-uNumBufs);
+   if (DSP_SUCCEEDED(status)) {
+   cp_to_usr(args-ARGS_STRM_ALLOCATEBUFFER.apBuffer, apBuffer,
+   status, uNumBufs);
+   if (DSP_FAILED(status)) {
+   status = DSP_EPOINTER;
+   STRM_FreeBuffer(
+   args-ARGS_STRM_ALLOCATEBUFFER.hStream,
+   apBuffer, uNumBufs, pr_ctxt);
+   }
+   }
if (apBuffer)
MEM_Free(apBuffer);
 
-- 
1.5.4.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 3/3] DSPBRIDGE: Validate Processor Handle from user.

2009-12-16 Thread Ramos Falcon, Ernesto
From 84b37fc98b56b91ab364c40114d9cf072bbef345 Mon Sep 17 00:00:00 2001
From: Ernesto Ramos erne...@ti.com
Date: Wed, 16 Dec 2009 18:09:14 -0600
Subject: [PATCH] DSPBRIDGE: Validate Processor Handle from user.

Add check to validate the Processor handle received
from user.

Signed-off-by: Ernesto Ramos erne...@ti.com
---
 drivers/dsp/bridge/pmgr/wcd.c  |   81 +++-
 drivers/dsp/bridge/rmgr/proc.c |  300 ++--
 2 files changed, 184 insertions(+), 197 deletions(-)

diff --git a/drivers/dsp/bridge/pmgr/wcd.c b/drivers/dsp/bridge/pmgr/wcd.c
index 917e549..55b436a 100644
--- a/drivers/dsp/bridge/pmgr/wcd.c
+++ b/drivers/dsp/bridge/pmgr/wcd.c
@@ -701,6 +701,7 @@ u32 PROCWRAP_Ctrl(union Trapped_Args *args, void *pr_ctxt)
args-ARGS_PROC_CTRL.pArgs;
u8 *pArgs = NULL;
DSP_STATUS status = DSP_SOK;
+   struct PROCESS_CONTEXT *pCtxt = pr_ctxt;

GT_3trace(WCD_debugMask, GT_ENTER,
 PROCWRAP_Ctrl: entered args:\n 0x%x
@@ -708,6 +709,10 @@ u32 PROCWRAP_Ctrl(union Trapped_Args *args, void *pr_ctxt)
 args-ARGS_PROC_CTRL.hProcessor,
 args-ARGS_PROC_CTRL.dwCmd,
 args-ARGS_PROC_CTRL.pArgs);
+   if (args-ARGS_PROC_CTRL.hProcessor != pCtxt-hProcessor) {
+   status = DSP_EHANDLE;
+   goto func_end;
+   }
if (pSize) {
if (get_user(cbDataSize, pSize)) {
status = DSP_EFAIL;
@@ -759,6 +764,7 @@ u32 PROCWRAP_EnumNode_Info(union Trapped_Args *args, void 
*pr_ctxt)
DSP_HNODE aNodeTab[MAX_NODES];
u32 uNumNodes;
u32 uAllocated;
+   struct PROCESS_CONTEXT *pCtxt = pr_ctxt;

GT_5trace(WCD_debugMask, GT_ENTER,
 PROCWRAP_EnumNode_Info:entered args:\n0x
@@ -770,6 +776,9 @@ u32 PROCWRAP_EnumNode_Info(union Trapped_Args *args, void 
*pr_ctxt)
 args-ARGS_PROC_ENUMNODE_INFO.puNumNodes,
 args-ARGS_PROC_ENUMNODE_INFO.puAllocated);

+   if (args-ARGS_PROC_CTRL.hProcessor != pCtxt-hProcessor)
+   return DSP_EHANDLE;
+
if (!args-ARGS_PROC_ENUMNODE_INFO.uNodeTabSize)
return DSP_ESIZE;

@@ -792,9 +801,13 @@ u32 PROCWRAP_EnumNode_Info(union Trapped_Args *args, void 
*pr_ctxt)
 u32 PROCWRAP_FlushMemory(union Trapped_Args *args, void *pr_ctxt)
 {
DSP_STATUS status;
+   struct PROCESS_CONTEXT *pCtxt = pr_ctxt;

GT_0trace(WCD_debugMask, GT_ENTER, PROCWRAP_FlushMemory: entered\n);

+   if (args-ARGS_PROC_CTRL.hProcessor != pCtxt-hProcessor)
+   return DSP_EHANDLE;
+
if (args-ARGS_PROC_FLUSHMEMORY.ulFlags  PROC_WRBK_INV_ALL)
return DSP_EINVALIDARG;

@@ -812,10 +825,14 @@ u32 PROCWRAP_FlushMemory(union Trapped_Args *args, void 
*pr_ctxt)
 u32 PROCWRAP_InvalidateMemory(union Trapped_Args *args, void *pr_ctxt)
 {
DSP_STATUS status;
+   struct PROCESS_CONTEXT *pCtxt = pr_ctxt;

GT_0trace(WCD_debugMask, GT_ENTER,
 PROCWRAP_InvalidateMemory:entered\n);

+   if (args-ARGS_PROC_CTRL.hProcessor != pCtxt-hProcessor)
+   return DSP_EHANDLE;
+
status = PROC_InvalidateMemory(
  args-ARGS_PROC_INVALIDATEMEMORY.hProcessor,
  args-ARGS_PROC_INVALIDATEMEMORY.pMpuAddr,
@@ -831,6 +848,7 @@ u32 PROCWRAP_EnumResources(union Trapped_Args *args, void 
*pr_ctxt)
 {
DSP_STATUS status = DSP_SOK;
struct DSP_RESOURCEINFO pResourceInfo;
+   struct PROCESS_CONTEXT *pCtxt = pr_ctxt;

GT_4trace(WCD_debugMask, GT_ENTER,
 PROCWRAP_EnumResources: entered args:\n
@@ -841,6 +859,9 @@ u32 PROCWRAP_EnumResources(union Trapped_Args *args, void 
*pr_ctxt)
 args-ARGS_PROC_ENUMRESOURCES.pResourceInfo,
 args-ARGS_PROC_ENUMRESOURCES.uResourceInfoSize);

+   if (args-ARGS_PROC_CTRL.hProcessor != pCtxt-hProcessor)
+   return DSP_EHANDLE;
+
if (args-ARGS_PROC_ENUMRESOURCES.uResourceInfoSize 
sizeof(struct DSP_RESOURCEINFO))
return DSP_ESIZE;
@@ -864,8 +885,13 @@ u32 PROCWRAP_GetState(union Trapped_Args *args, void 
*pr_ctxt)
 {
DSP_STATUS status;
struct DSP_PROCESSORSTATE procStatus;
+   struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
+
GT_0trace(WCD_debugMask, GT_ENTER, PROCWRAP_GetState: entered\n);

+   if (args-ARGS_PROC_CTRL.hProcessor != pCtxt-hProcessor)
+   return DSP_EHANDLE;
+
if (args-ARGS_PROC_GETSTATE.uStateInfoSize 
sizeof(struct DSP_PROCESSORSTATE))
return DSP_ESIZE;
@@ -884,9 +910,13 @@ u32 PROCWRAP_GetTrace(union Trapped_Args *args, void 
*pr_ctxt)
 {
DSP_STATUS status;
u8 *pBuf;
+   struct PROCESS_CONTEXT *pCtxt = pr_ctxt;

GT_0trace(WCD_debugMask, GT_ENTER, PROCWRAP_GetTrace: entered\n);

+   if 

[PATCHv2 01/18] DSPBRIDGE: Fix compile break for WCD debug mask

2009-12-16 Thread Omar Ramirez Luna
If debug mode is enabled compilation will break because WCD
debug mask is used before behing defined.

Signed-off-by: Omar Ramirez Luna omar.rami...@ti.com
---
 drivers/dsp/bridge/pmgr/wcd.c |   80 
 1 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/drivers/dsp/bridge/pmgr/wcd.c b/drivers/dsp/bridge/pmgr/wcd.c
index bb28cd2..3fb5208 100644
--- a/drivers/dsp/bridge/pmgr/wcd.c
+++ b/drivers/dsp/bridge/pmgr/wcd.c
@@ -144,46 +144,6 @@
 #define MAX_STREAMS 16
 #define MAX_BUFS   64
 
-static inline void __cp_fm_usr(void *to, const void __user *from,
-  DSP_STATUS *err, unsigned long bytes)
-{
-   if (DSP_FAILED(*err))
-   return;
-
-   if (unlikely(!from)) {
-   *err = DSP_EPOINTER;
-   return;
-   }
-
-   if (unlikely(copy_from_user(to, from, bytes))) {
-   GT_2trace(WCD_debugMask, GT_7CLASS,
- %s failed, from=0x%08x\n, __func__, from);
-   *err = DSP_EPOINTER;
-   }
-}
-#define cp_fm_usr(to, from, err, n)\
-   __cp_fm_usr(to, from, (err), (n) * sizeof(*(to)))
-
-static inline void __cp_to_usr(void __user *to, const void *from,
-  DSP_STATUS *err, unsigned long bytes)
-{
-   if (DSP_FAILED(*err))
-   return;
-
-   if (unlikely(!to)) {
-   *err = DSP_EPOINTER;
-   return;
-   }
-
-   if (unlikely(copy_to_user(to, from, bytes))) {
-   GT_2trace(WCD_debugMask, GT_7CLASS,
- %s failed, to=0x%08x\n, __func__, to);
-   *err = DSP_EPOINTER;
-   }
-}
-#define cp_to_usr(to, from, err, n)\
-   __cp_to_usr(to, from, (err), (n) * sizeof(*(from)))
-
 /* Device IOCtl function pointer */
 struct WCD_Cmd {
u32(*fxn)(union Trapped_Args *args);
@@ -265,6 +225,46 @@ static struct WCD_Cmd WCD_cmdTable[] = {
{CMMWRAP_GetInfo, CMD_CMM_GETINFO_OFFSET}
 };
 
+static inline void __cp_fm_usr(void *to, const void __user *from,
+  DSP_STATUS *err, unsigned long bytes)
+{
+   if (DSP_FAILED(*err))
+   return;
+
+   if (unlikely(!from)) {
+   *err = DSP_EPOINTER;
+   return;
+   }
+
+   if (unlikely(copy_from_user(to, from, bytes))) {
+   GT_2trace(WCD_debugMask, GT_7CLASS,
+ %s failed, from=0x%08x\n, __func__, from);
+   *err = DSP_EPOINTER;
+   }
+}
+#define cp_fm_usr(to, from, err, n)\
+   __cp_fm_usr(to, from, (err), (n) * sizeof(*(to)))
+
+static inline void __cp_to_usr(void __user *to, const void *from,
+  DSP_STATUS *err, unsigned long bytes)
+{
+   if (DSP_FAILED(*err))
+   return;
+
+   if (unlikely(!to)) {
+   *err = DSP_EPOINTER;
+   return;
+   }
+
+   if (unlikely(copy_to_user(to, from, bytes))) {
+   GT_2trace(WCD_debugMask, GT_7CLASS,
+ %s failed, to=0x%08x\n, __func__, to);
+   *err = DSP_EPOINTER;
+   }
+}
+#define cp_to_usr(to, from, err, n)\
+   __cp_to_usr(to, from, (err), (n) * sizeof(*(from)))
+
 /*
  *   WCD_CallDevIOCtl 
  *  Purpose:
-- 
1.6.2.4

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


[PATCHv2 00/18] First set of unreviewed patches

2009-12-16 Thread Omar Ramirez Luna
These patches need to be reviewed to be included into dspbridge-baseline.

v2:
- Added to series, because of priority fix:
DSPBRIDGE: Fix compile break for WCD debug mask
DSPBRIDGE: enable smart/autoidle for mailbox sysconfig
- Fixed a bracket missing for else (code style):
DSPBRIDGE: Enable peripheral clocks on wake up
- Updated commit message for:
DSPBRIDGE: Implemented Trampoline support for dynamic loader
DSPBRIDGE: Enable/Disable MCBSP_CLOCKS for MCBSP2
- Dropped for rework:
DSPBRIDGE: Avoid REGistry if pDevContext is available

Ernest Ramos Falcon (1):
  DSPBRIDGE: check pointer before calling Proc_Detach

Ernesto Ramos Falcon (1):
  DSPBRIDGE: Memory leak in Node Register Notify

Fernando Guzman Lugo (3):
  DSPBRIDGE: Implemented Trampoline support for dynamic loader
  DSPBRIDGE: Enable/Disable MCBSP_CLOCKS for MCBSP2
  DSPBRIDGE: support loading 4 dependent DLL

Hiroshi DOYU (1):
  DSPBRIDGE: enable smart/autoidle for mailbox sysconfig

Omar Ramirez Luna (11):
  DSPBRIDGE: Fix compile break for WCD debug mask
  DSPBRIDGE: set PWRERROR notifications as an option
  DSPBRIDGE: Enable peripheral clocks on wake up
  DSPBRIDGE: Remove long busy-wait loops on PWRST transitions
  DSPBRIDGE: Rename usCount to timeout
  DSPBRIDGE: Trivial cleanup on DBDCD
  DSPBRIDGE: Do not panic on bad page count
  DSPBRIDGE: check the status of DMM_GetHandle
  DSPBRIDGE: KFILE_Seek  KFILE_Tell, u32 replaced with loff_t
  DSPBRIDGE: Delete unused files
  DSPBRIDGE: Compilation fixes 2.6.31

Rebecca Schultz Zavin (1):
  DSPBRIDGE: Remove preproessor condition that could never work

 arch/arm/mach-omap2/dspbridge.c|2 +
 arch/arm/plat-omap/include/dspbridge/dbl.h |  354 --
 arch/arm/plat-omap/include/dspbridge/dbof.h|  117 --
 drivers/dsp/bridge/Kconfig |   11 +
 drivers/dsp/bridge/Makefile|3 +-
 drivers/dsp/bridge/dynload/cload.c |  148 ++-
 drivers/dsp/bridge/dynload/dlclasses_hdr.h |   41 -
 drivers/dsp/bridge/dynload/dload_internal.h|  125 +++-
 drivers/dsp/bridge/dynload/reloc.c |   81 ++-
 drivers/dsp/bridge/dynload/tramp.c | 1110 +++
 drivers/dsp/bridge/dynload/tramp_table_c6000.c |  164 +++
 drivers/dsp/bridge/hw/hw_mbox.c|   14 +-
 drivers/dsp/bridge/hw/hw_mbox.h|   22 +
 drivers/dsp/bridge/pmgr/cod.c  |4 +-
 drivers/dsp/bridge/pmgr/dbl.c  | 1385 
 drivers/dsp/bridge/pmgr/wcd.c  |   85 +-
 drivers/dsp/bridge/rmgr/dbdcd.c|  345 +++---
 drivers/dsp/bridge/rmgr/drv_interface.c|   11 +-
 drivers/dsp/bridge/rmgr/proc.c |   20 +-
 drivers/dsp/bridge/wmd/_tiomap_util.h  |6 +
 drivers/dsp/bridge/wmd/io_sm.c |1 +
 drivers/dsp/bridge/wmd/tiomap3430.c|   18 +-
 drivers/dsp/bridge/wmd/tiomap3430_pwr.c|  110 ++-
 drivers/dsp/bridge/wmd/tiomap_sm.c |3 +
 drivers/dsp/bridge/wmd/ue_deh.c|2 +
 25 files changed, 1982 insertions(+), 2200 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/dspbridge/dbl.h
 delete mode 100644 arch/arm/plat-omap/include/dspbridge/dbof.h
 delete mode 100644 drivers/dsp/bridge/dynload/dlclasses_hdr.h
 create mode 100644 drivers/dsp/bridge/dynload/tramp.c
 create mode 100644 drivers/dsp/bridge/dynload/tramp_table_c6000.c
 delete mode 100644 drivers/dsp/bridge/pmgr/dbl.c

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


[PATCHv2 14/18] DSPBRIDGE: check pointer before calling Proc_Detach

2009-12-16 Thread Omar Ramirez Luna
From: Ernest Ramos Falcon erne...@ti.com

This patch adds a check before calling Proc_Detach, otherwise
we will see an error.

Signed-off-by: Ernest Ramos Falcon erne...@ti.com
Signed-off-by: Fernando Guzman Lugo x0095...@ti.com
---
 drivers/dsp/bridge/rmgr/drv_interface.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c 
b/drivers/dsp/bridge/rmgr/drv_interface.c
index a2df832..6415955 100644
--- a/drivers/dsp/bridge/rmgr/drv_interface.c
+++ b/drivers/dsp/bridge/rmgr/drv_interface.c
@@ -592,7 +592,8 @@ static int bridge_release(struct inode *ip, struct file 
*filp)
if (DSP_SUCCEEDED(dsp_status)) {
flush_signals(current);
DRV_RemoveAllResources(pr_ctxt);
-   PROC_Detach(pr_ctxt-hProcessor);
+   if (pr_ctxt-hProcessor)
+   PROC_Detach(pr_ctxt-hProcessor);
DRV_RemoveProcContext((struct DRV_OBJECT *)hDrvObject,
pr_ctxt, (void *)pr_ctxt-pid);
} else {
-- 
1.6.2.4

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


[PATCHv2 12/18] DSPBRIDGE: support loading 4 dependent DLL

2009-12-16 Thread Omar Ramirez Luna
From: Fernando Guzman Lugo x0095...@ti.com

This patch fixes loading a SN that has 4 dependent DLLs, previously
it was failing due to a non-null terminated string.

Signed-off-by: Fernando Guzman Lugo x0095...@ti.com
---
 drivers/dsp/bridge/rmgr/dbdcd.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/dbdcd.c b/drivers/dsp/bridge/rmgr/dbdcd.c
index b1391e2..fb06ff2 100644
--- a/drivers/dsp/bridge/rmgr/dbdcd.c
+++ b/drivers/dsp/bridge/rmgr/dbdcd.c
@@ -1529,7 +1529,7 @@ static DSP_STATUS GetDepLibInfo(IN struct DCD_MANAGER 
*hDcdMgr,
goto func_cont;
 
/* Allocate zeroed buffer. */
-   pszCoffBuf = MEM_Calloc(ulLen, MEM_PAGED);
+   pszCoffBuf = MEM_Calloc(ulLen + 4, MEM_PAGED);
if (pszCoffBuf == NULL)
status = DSP_EMEMORY;
 
-- 
1.6.2.4

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


[PATCHv2 11/18] DSPBRIDGE: Do not panic on bad page count

2009-12-16 Thread Omar Ramirez Luna
If a page doesn't have a sane count, do not panic or release it.
Loudly complain with dump_stack but do not halt with BUG.

Signed-off-by: Fernando Guzman Lugo x0095...@ti.com
Signed-off-by: Omar Ramirez Luna omar.rami...@ti.com
---
 drivers/dsp/bridge/wmd/tiomap3430.c |   12 +++-
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/dsp/bridge/wmd/tiomap3430.c 
b/drivers/dsp/bridge/wmd/tiomap3430.c
index 65a21b2..f41763c 100644
--- a/drivers/dsp/bridge/wmd/tiomap3430.c
+++ b/drivers/dsp/bridge/wmd/tiomap3430.c
@@ -301,7 +301,7 @@ static void bad_page_dump(u32 pa, struct page *pg)
current-comm, pg, (int)(2*sizeof(unsigned long)),
(unsigned long)pg-flags, pg-mapping,
page_mapcount(pg), page_count(pg));
-   BUG();
+   dump_stack();
 }
 
 /*
@@ -1707,9 +1707,10 @@ static DSP_STATUS WMD_BRD_MemUnMap(struct 
WMD_DEV_CONTEXT *hDevContext,
COUNT 0 FOR PA 0x%x, size = 
0x%x\n, pAddr, ulNumBytes);
bad_page_dump(pAddr, pg);
+   } else {
+   SetPageDirty(pg);
+   page_cache_release(pg);
}
-   SetPageDirty(pg);
-   page_cache_release(pg);
pAddr += HW_PAGE_SIZE_4KB;
}
if (HW_MMU_PteClear(pteAddrL2, vaCurr, pteSize)
@@ -1772,9 +1773,10 @@ skip_coarse_page:
COUNT 0 FOR PA 0x%x, size = 
0x%x\n, pAddr, ulNumBytes);
bad_page_dump(pAddr, pg);
+   } else {
+   SetPageDirty(pg);
+   page_cache_release(pg);
}
-   SetPageDirty(pg);
-   page_cache_release(pg);
}
pAddr += HW_PAGE_SIZE_4KB;
}
-- 
1.6.2.4

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


[PATCHv2 13/18] DSPBRIDGE: Memory leak in Node Register Notify

2009-12-16 Thread Omar Ramirez Luna
From: Ernesto Ramos Falcon erne...@ti.com

Fix for memory leak in DSPNode_RegisterNotify when
unregistering an object.

Signed-off-by: Ernesto Ramos Falcon erne...@ti.com
---
 drivers/dsp/bridge/pmgr/wcd.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/dsp/bridge/pmgr/wcd.c b/drivers/dsp/bridge/pmgr/wcd.c
index 3fb5208..93460d1 100644
--- a/drivers/dsp/bridge/pmgr/wcd.c
+++ b/drivers/dsp/bridge/pmgr/wcd.c
@@ -1403,6 +1403,11 @@ u32 NODEWRAP_RegisterNotify(union Trapped_Args *args)
notification.psName = NULL;
notification.handle = NULL;
 
+   if (!args-ARGS_PROC_REGISTER_NOTIFY.uEventMask)
+   cp_fm_usr(notification,
+   args-ARGS_PROC_REGISTER_NOTIFY.hNotification,
+   status, 1);
+
status = NODE_RegisterNotify(args-ARGS_NODE_REGISTERNOTIFY.hNode,
args-ARGS_NODE_REGISTERNOTIFY.uEventMask,
args-ARGS_NODE_REGISTERNOTIFY.uNotifyType,
-- 
1.6.2.4

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


[PATCHv2 16/18] DSPBRIDGE: KFILE_Seek KFILE_Tell, u32 replaced with loff_t

2009-12-16 Thread Omar Ramirez Luna
KFILE_Seek  KFILE_Tell, u32 replaced with loff_t

Discovered-by: Ameya Palande ameya.pala...@nokia.com
Signed-off-by: Omar Ramirez Luna omar.rami...@ti.com
---
 drivers/dsp/bridge/pmgr/cod.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dsp/bridge/pmgr/cod.c b/drivers/dsp/bridge/pmgr/cod.c
index a85f2a7..1ebbe8d 100644
--- a/drivers/dsp/bridge/pmgr/cod.c
+++ b/drivers/dsp/bridge/pmgr/cod.c
@@ -199,7 +199,7 @@ static s32 COD_fRead(void __user *pBuffer, s32 cSize, s32 
cCount,
 
 static s32 COD_fSeek(struct file *hFile, s32 lOffset, s32 cOrigin)
 {
-   u32 dwCurPos;
+   loff_t dwCurPos;
 
/* check for valid file handle */
if (!hFile)
@@ -217,7 +217,7 @@ static s32 COD_fSeek(struct file *hFile, s32 lOffset, s32 
cOrigin)
 
 static s32 COD_fTell(struct file *hFile)
 {
-   u32 dwCurPos;
+   loff_t dwCurPos;
 
if (!hFile)
return DSP_EHANDLE;
-- 
1.6.2.4

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


[PATCHv2 08/18] DSPBRIDGE: Remove long busy-wait loops on PWRST transitions

2009-12-16 Thread Omar Ramirez Luna
Remove busy waiting on suspend and self hibernation paths by
removing udelays.

Decrease the total timer waiting on power transitions to be less
than 3 seconds, defined to wait for power transition approx. 200 msecs

Change required for:
http://android.git.kernel.org/?p=kernel/omap.git;a=commit;h=c8853459b739e5f43da0badc1605a0a0c0c8195d

Reported-by: Nishanth Menon n...@ti.com
Signed-off-by: Fernando Guzman Lugo x0095...@ti.com
Signed-off-by: Omar Ramirez Luna omar.rami...@ti.com
---
 drivers/dsp/bridge/wmd/_tiomap_util.h   |6 ++
 drivers/dsp/bridge/wmd/tiomap3430_pwr.c |   24 +---
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/drivers/dsp/bridge/wmd/_tiomap_util.h 
b/drivers/dsp/bridge/wmd/_tiomap_util.h
index 47e1e5d..bd1b571 100644
--- a/drivers/dsp/bridge/wmd/_tiomap_util.h
+++ b/drivers/dsp/bridge/wmd/_tiomap_util.h
@@ -31,6 +31,12 @@
 /* Time out Values in uSeconds*/
 #define TIHELEN_ACKTIMEOUT  1
 
+/*
+ * Time out for power state transition (in msecs), due to system
+ * latencies and HZ resolution this timer can vary.
+ */
+#define PWRSTST_TIMEOUT200
+
 /*  Time delay for HOM-SAM transition. */
 #define  WAIT_SAM   100/* in usec (1000 millisec) */
 
diff --git a/drivers/dsp/bridge/wmd/tiomap3430_pwr.c 
b/drivers/dsp/bridge/wmd/tiomap3430_pwr.c
index 2d7be1c..da59e4b 100644
--- a/drivers/dsp/bridge/wmd/tiomap3430_pwr.c
+++ b/drivers/dsp/bridge/wmd/tiomap3430_pwr.c
@@ -110,7 +110,7 @@ DSP_STATUS handle_hibernation_fromDSP(struct 
WMD_DEV_CONTEXT *pDevContext)
 {
DSP_STATUS status = DSP_SOK;
 #ifdef CONFIG_PM
-   u16 usCount = TIHELEN_ACKTIMEOUT;
+   u16 usCount = PWRSTST_TIMEOUT / 10;
struct CFG_HOSTRES resources;
enum HW_PwrState_t pwrState;
 #ifdef CONFIG_BRIDGE_DVFS
@@ -127,10 +127,12 @@ DSP_STATUS handle_hibernation_fromDSP(struct 
WMD_DEV_CONTEXT *pDevContext)
 
HW_PWR_IVA2StateGet(resources.dwPrmBase, HW_PWR_DOMAIN_DSP,
pwrState);
-   /* Wait for DSP to move into Off state,  how much time should
-* we wait? */
+   /* Wait for DSP to move into OFF state */
while ((pwrState != HW_PWR_STATE_OFF)  --usCount) {
-   udelay(500);
+   if (msleep_interruptible(10)) {
+   pr_err(Waiting for DSP OFF mode interrupted\n);
+   return DSP_EFAIL;
+   }
HW_PWR_IVA2StateGet(resources.dwPrmBase, HW_PWR_DOMAIN_DSP,
pwrState);
}
@@ -195,7 +197,7 @@ DSP_STATUS SleepDSP(struct WMD_DEV_CONTEXT *pDevContext, IN 
u32 dwCmd,
 #ifdef CONFIG_BRIDGE_NTFY_PWRERR
struct DEH_MGR *hDehMgr;
 #endif /* CONFIG_BRIDGE_NTFY_PWRERR */
-   u16 usCount = TIHELEN_ACKTIMEOUT;
+   u16 usCount = PWRSTST_TIMEOUT / 10;
enum HW_PwrState_t pwrState, targetPwrState;
 
DBG_Trace(DBG_LEVEL7, SleepDSP- Enter function \n);
@@ -256,12 +258,12 @@ DSP_STATUS SleepDSP(struct WMD_DEV_CONTEXT *pDevContext, 
IN u32 dwCmd,
HW_PWR_IVA2StateGet(resources.dwPrmBase, HW_PWR_DOMAIN_DSP,
pwrState);
 
-   /*
-* Wait for DSP to move into Standby state,  how much time
-* should we wait?
-*/
-   while ((pwrState != targetPwrState)  --usCount) {
-   udelay(500);
+   /* Wait for DSP to move into target power state */
+   while ((pwrState != targetPwrState)  usCount--) {
+   if (msleep_interruptible(10)) {
+   pr_err(Waiting for DSP to Suspend interrupted\n);
+   return DSP_EFAIL;
+   }
HW_PWR_IVA2StateGet(resources.dwPrmBase, HW_PWR_DOMAIN_DSP,
pwrState);
}
-- 
1.6.2.4

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


[PATCHv2 05/18] DSPBRIDGE: Enable/Disable MCBSP_CLOCKS for MCBSP2

2009-12-16 Thread Omar Ramirez Luna
From: Fernando Guzman Lugo x0095...@ti.com

Bridge should enable McBSP_CLKS (using T2 clock) so that DPLL4
can be gated. Once McBSP2 clock is released, it should disable
McBSP_CLKS as it prevents PER and CORE domain transitions when
OFF is set to target power state.

Signed-off-by: Fernando Guzman Lugo x0095...@ti.com
Signed-off-by: Omar Ramirez Luna omar.rami...@ti.com
---
 drivers/dsp/bridge/wmd/tiomap3430_pwr.c |   73 ++-
 1 files changed, 72 insertions(+), 1 deletions(-)

diff --git a/drivers/dsp/bridge/wmd/tiomap3430_pwr.c 
b/drivers/dsp/bridge/wmd/tiomap3430_pwr.c
index 619ed1a..f30da74 100644
--- a/drivers/dsp/bridge/wmd/tiomap3430_pwr.c
+++ b/drivers/dsp/bridge/wmd/tiomap3430_pwr.c
@@ -361,6 +361,8 @@ DSP_STATUS DSPPeripheralClkCtrl(struct WMD_DEV_CONTEXT 
*pDevContext,
u32 dspPerClksBefore;
DSP_STATUS status = DSP_SOK;
DSP_STATUS status1 = DSP_SOK;
+   struct CFG_HOSTRES resources;
+   u32 value;
 
DBG_Trace(DBG_ENTER, Entering DSPPeripheralClkCtrl \n);
dspPerClksBefore = pDevContext-uDspPerClks;
@@ -369,6 +371,13 @@ DSP_STATUS DSPPeripheralClkCtrl(struct WMD_DEV_CONTEXT 
*pDevContext,
 
extClk = (u32)*((u32 *)pArgs);
 
+   status = CFG_GetHostResources(
+   (struct CFG_DEVNODE *)DRV_GetFirstDevExtension(),
+   resources);
+
+   if (DSP_FAILED(status))
+   return DSP_EFAIL;
+
DBG_Trace(DBG_LEVEL3, DSPPeripheralClkCtrl : extClk+Cmd = 0x%x \n,
 extClk);
 
@@ -399,6 +408,17 @@ DSP_STATUS DSPPeripheralClkCtrl(struct WMD_DEV_CONTEXT 
*pDevContext,
 DSPPeripheralClkCtrl : Disable CLK for \n);
status1 = CLK_Disable(BPWR_Clks[clkIdIndex].intClk);
status = CLK_Disable(BPWR_Clks[clkIdIndex].funClk);
+   if (BPWR_CLKID[clkIdIndex] == BPWR_MCBSP1) {
+   /* clear MCBSP1_CLKS, on McBSP1 OFF */
+   value = __raw_readl(resources.dwSysCtrlBase + 0x274);
+   value = ~(1  2);
+   __raw_writel(value, resources.dwSysCtrlBase + 0x274);
+   } else if (BPWR_CLKID[clkIdIndex] == BPWR_MCBSP2) {
+   /* clear MCBSP2_CLKS, on McBSP2 OFF */
+   value = __raw_readl(resources.dwSysCtrlBase + 0x274);
+   value = ~(1  6);
+   __raw_writel(value, resources.dwSysCtrlBase + 0x274);
+   }
DSPClkWakeupEventCtrl(BPWR_Clks[clkIdIndex].clkId, false);
if ((DSP_SUCCEEDED(status))  (DSP_SUCCEEDED(status1))) {
(pDevContext-uDspPerClks) =
@@ -413,6 +433,17 @@ DSP_STATUS DSPPeripheralClkCtrl(struct WMD_DEV_CONTEXT 
*pDevContext,
 DSPPeripheralClkCtrl : Enable CLK for \n);
status1 = CLK_Enable(BPWR_Clks[clkIdIndex].intClk);
status = CLK_Enable(BPWR_Clks[clkIdIndex].funClk);
+   if (BPWR_CLKID[clkIdIndex] == BPWR_MCBSP1) {
+   /* set MCBSP1_CLKS, on McBSP1 ON */
+   value = __raw_readl(resources.dwSysCtrlBase + 0x274);
+   value |= 1  2;
+   __raw_writel(value, resources.dwSysCtrlBase + 0x274);
+   } else if (BPWR_CLKID[clkIdIndex] == BPWR_MCBSP2) {
+   /* set MCBSP2_CLKS, on McBSP2 ON */
+   value = __raw_readl(resources.dwSysCtrlBase + 0x274);
+   value |= 1  6;
+   __raw_writel(value, resources.dwSysCtrlBase + 0x274);
+   }
DSPClkWakeupEventCtrl(BPWR_Clks[clkIdIndex].clkId, true);
if ((DSP_SUCCEEDED(status))  (DSP_SUCCEEDED(status1))) {
(pDevContext-uDspPerClks) |= (1  clkIdIndex);
@@ -522,14 +553,34 @@ DSP_STATUS PostScale_DSP(struct WMD_DEV_CONTEXT 
*pDevContext, IN void *pArgs)
 DSP_STATUS DSP_PeripheralClocks_Disable(struct WMD_DEV_CONTEXT *pDevContext,
IN void *pArgs)
 {
-
u32 clkIdx;
DSP_STATUS status = DSP_SOK;
+   struct CFG_HOSTRES resources;
+   u32 value;
+
+   status = CFG_GetHostResources(
+   (struct CFG_DEVNODE *)DRV_GetFirstDevExtension(),
+   resources);
 
for (clkIdx = 0; clkIdx  MBX_PM_MAX_RESOURCES; clkIdx++) {
if (((pDevContext-uDspPerClks)  clkIdx)  0x01) {
/* Disables the interface clock of the peripheral */
status = CLK_Disable(BPWR_Clks[clkIdx].intClk);
+   if (BPWR_CLKID[clkIdx] == BPWR_MCBSP1) {
+   /* clear MCBSP1_CLKS, on McBSP1 OFF */
+   value = __raw_readl(resources.dwSysCtrlBase
+   + 0x274);
+   value = 

[PATCHv2 17/18] DSPBRIDGE: Delete unused files

2009-12-16 Thread Omar Ramirez Luna
These files seem to be unused, deleting them.

Signed-off-by: Omar Ramirez Luna omar.rami...@ti.com
---
 arch/arm/plat-omap/include/dspbridge/dbl.h  |  354 ---
 arch/arm/plat-omap/include/dspbridge/dbof.h |  117 ---
 drivers/dsp/bridge/dynload/dlclasses_hdr.h  |   41 -
 drivers/dsp/bridge/pmgr/dbl.c   | 1385 ---
 4 files changed, 0 insertions(+), 1897 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/dspbridge/dbl.h
 delete mode 100644 arch/arm/plat-omap/include/dspbridge/dbof.h
 delete mode 100644 drivers/dsp/bridge/dynload/dlclasses_hdr.h
 delete mode 100644 drivers/dsp/bridge/pmgr/dbl.c

diff --git a/arch/arm/plat-omap/include/dspbridge/dbl.h 
b/arch/arm/plat-omap/include/dspbridge/dbl.h
deleted file mode 100644
index 19847f9..000
--- a/arch/arm/plat-omap/include/dspbridge/dbl.h
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * dbl.h
- *
- * DSP-BIOS Bridge driver support functions for TI OMAP processors.
- *
- * Copyright (C) 2005-2006 Texas Instruments, Inc.
- *
- * This package is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-
-/*
- *   dbl.h 
- *
- *! Revision History
- *! 
- *! 19-Mar-2002 jeh Pass DBL_Symbol pointer to DBL_getAddr, DBL_getCAddr
- *! to accomodate dynamic loader library.
- *! 20-Nov-2001 jeh Removed DBL_loadArgs().
- *! 24-Sep-2001 jeh Code review changes.
- *! 07-Sep-2001 jeh Added DBL_LoadSect(), DBL_UnloadSect().
- *! 05-Jun-2001 jeh Created based on zl.h.
- */
-
-#ifndef DBL_
-#define DBL_
-
-#include dspbridge/dbdefs.h
-#include dspbridge/dbldefs.h
-
-/*
- *   DBL_close 
- *  Close library opened with DBL_open.
- *  Parameters:
- *  lib - Handle returned from DBL_open().
- *  Returns:
- *  Requires:
- *  DBL initialized.
- *  Valid lib.
- *  Ensures:
- */
-   extern void DBL_close(struct DBL_LibraryObj *lib);
-
-/*
- *   DBL_create 
- *  Create a target object by specifying the alloc, free, and write
- *  functions for the target.
- *  Parameters:
- *  pTarget - Location to store target handle on output.
- *  pAttrs  - Attributes.
- *  Returns:
- *  DSP_SOK:Success.
- *  DSP_EMEMORY:Memory allocation failed.
- *  Requires:
- *  DBL initialized.
- *  pAttrs != NULL.
- *  pTarget != NULL;
- *  Ensures:
- *  Success:*pTarget != NULL.
- *  Failure:*pTarget == NULL.
- */
-   extern DSP_STATUS DBL_create(struct DBL_TargetObj **pTarget,
-struct DBL_Attrs *pAttrs);
-
-/*
- *   DBL_delete 
- *  Delete target object and free resources for any loaded libraries.
- *  Parameters:
- *  target  - Handle returned from DBL_Create().
- *  Returns:
- *  Requires:
- *  DBL initialized.
- *  Valid target.
- *  Ensures:
- */
-   extern void DBL_delete(struct DBL_TargetObj *target);
-
-/*
- *   DBL_exit 
- *  Discontinue use of DBL module.
- *  Parameters:
- *  Returns:
- *  Requires:
- *  cRefs  0.
- *  Ensures:
- *  cRefs = 0.
- */
-   extern void DBL_exit(void);
-
-/*
- *   DBL_getAddr 
- *  Get address of name in the specified library.
- *  Parameters:
- *  lib - Handle returned from DBL_open().
- *  name- Name of symbol
- *  ppSym   - Location to store symbol address on output.
- *  Returns:
- *  TRUE:   Success.
- *  FALSE:  Symbol not found.
- *  Requires:
- *  DBL initialized.
- *  Valid lib.
- *  name != NULL.
- *  pAddr != NULL.
- *  Ensures:
- */
-   extern bool DBL_getAddr(struct DBL_LibraryObj *lib, char *name,
-   struct DBL_Symbol **ppSym);
-
-/*
- *   DBL_getAttrs 
- *  Retrieve the attributes of the target.
- *  Parameters:
- *  target  - Handle returned from DBL_Create().
- *  pAttrs  - Location to store attributes on output.
- *  Returns:
- *  Requires:
- *  DBL initialized.
- *  Valid target.
- *  pAttrs != NULL.
- *  Ensures:
- */
-   extern void DBL_getAttrs(struct DBL_TargetObj *target,
-struct DBL_Attrs *pAttrs);
-
-/*
- *   DBL_getCAddr 
- *  Get address of C name in the specified library.
- *  Parameters:
- *  lib - Handle returned from DBL_open().
- *  name- Name of symbol
- *  ppSym   - Location to store symbol address on output.
- *  Returns:
- *  TRUE:   Success.
- *  FALSE:  

[PATCHv2 10/18] DSPBRIDGE: Trivial cleanup on DBDCD

2009-12-16 Thread Omar Ramirez Luna
Trivial spacing cleanup on DSP/BIOS Bridge Configuration
Database module.

Signed-off-by: Omar Ramirez Luna omar.rami...@ti.com
---
 drivers/dsp/bridge/rmgr/dbdcd.c |  343 ---
 1 files changed, 179 insertions(+), 164 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/dbdcd.c b/drivers/dsp/bridge/rmgr/dbdcd.c
index fb4a9a6..b1391e2 100644
--- a/drivers/dsp/bridge/rmgr/dbdcd.c
+++ b/drivers/dsp/bridge/rmgr/dbdcd.c
@@ -31,32 +31,32 @@
  *! 
  *! 03-Dec-2003 map Changed DCD_OBJTYPE to DSP_DCDOBJTYPE
  *! 17-Dec-2002 map Modified DCD_GetDepLibs, DCD_GetNumDepLibs, GetDepLibInfo
- *! to include phase information
+ *! to include phase information
  *! 02-Dec-2002 map Modified DCD_GetLibraryName for phases in different
- *! libraries
+ *! libraries
  *! 26-Feb-2003 kc  Updated DCD_AutoUnregister and DCD_GetObjects to simplify
- *! DCD implementation.
+ *! DCD implementation.
  *! 17-Jul-2002 jeh Call COD_Open() instead of COD_OpenBase(), call COD_Close()
  *! 11-Jul-2002 jeh Added DCD_GetDepLibs(), DCD_GetNumDepLibs().
  *! 18-Feb-2003 vp  Code review updates
  *! 18-Oct-2002 vp  Ported to Linux platform
  *! 15-Mar-2002 jeh Read dynamic loading memory requirements into node object
- *! data. Added DCD_GetLibraryName().
+ *! data. Added DCD_GetLibraryName().
  *! 13-Feb-2002 jeh Get system stack size in GetAttrsFromBuf().
  *! 01-Aug-2001 ag: Added check for PROC extended attributes used for
- *!DSP-MMU setup. These are private attributes.
+ *!DSP-MMU setup. These are private attributes.
  *! 18-Apr-2001 jeh Use COD_OpenBase instead of COD_LoadBase.
  *! 03-Apr-2001 sg: Changed error names to DSP_EDCD* format.
  *! 11-Jan-2001 jeh Changes to DCD_GetObjectDef to match node.cdb, proc.cdb.
  *! 12-Dec-2000 kc: Added DCD_AutoUnregister. MSGNODE, DAISNODE added in
- *! GetAttrsFromBuf
+ *! GetAttrsFromBuf
  *! 22-Nov-2000 kc: Replaced sprintf() calls with strncat.
  *! 09-Nov-2000 kc: Optimized DCD module.
  *! 30-Oct-2000 kc: Added DCD_AutoRegister function; changed local var. names.
  *! 29-Sep-2000 kc: Added code review changes (src/reviews/dcd_reviews.txt).
  *! 06-Sep-2000 jeh Get message segid, message notification type. Added Atoi()
- *! to replace atoi(), until cdb generation can output in
- *! decimal format.
+ *! to replace atoi(), until cdb generation can output in
+ *! decimal format.
  *! 26-Jul-2000 kc: Created.
  *!
  */
@@ -88,12 +88,12 @@
 /*  --- Global defines. */
 #define SIGNATURE   0x5f444344 /* DCD_ (in reverse). */
 
-#define IsValidHandle(h)(((h) != NULL)  (h-dwSignature == SIGNATURE))
+#define IsValidHandle(h)   (((h) != NULL)  (h-dwSignature == SIGNATURE))
 
 #define MAX_INT2CHAR_LENGTH 16   /* Maximum int2char len of 32 bit int. */
 
 /* Name of section containing dependent libraries */
-#define DEPLIBSECT  .dspbridge_deplibs
+#define DEPLIBSECT .dspbridge_deplibs
 
 /* DCD specific structures. */
 struct DCD_MANAGER {
@@ -107,17 +107,13 @@ static u32 cEnumRefs;
 
 extern struct GT_Mask curTrace;
 
-/* helper function prototypes. */
+/* Helper function prototypes. */
 static s32 Atoi(char *pszBuf);
-
 static DSP_STATUS GetAttrsFromBuf(char *pszBuf, u32 ulBufSize,
  enum DSP_DCDOBJTYPE objType,
  struct DCD_GENERICOBJ *pGenObj);
-
 static void CompressBuf(char *pszBuf, u32 ulBufSize, s32 cCharSize);
-
 static char DspChar2GppChar(char *pWord, s32 cDspCharSize);
-
 static DSP_STATUS GetDepLibInfo(IN struct DCD_MANAGER *hDcdMgr,
IN struct DSP_UUID *pUuid,
IN OUT u16 *pNumLibs,
@@ -131,9 +127,8 @@ static DSP_STATUS GetDepLibInfo(IN struct DCD_MANAGER 
*hDcdMgr,
  *  Purpose:
  *  Parses the supplied image and resigsters with DCD.
  */
-
 DSP_STATUS DCD_AutoRegister(IN struct DCD_MANAGER *hDcdMgr,
-   IN char *pszCoffPath)
+   IN char *pszCoffPath)
 {
DSP_STATUS status = DSP_SOK;
 
@@ -161,7 +156,7 @@ DSP_STATUS DCD_AutoRegister(IN struct DCD_MANAGER *hDcdMgr,
  *  Parses the supplied DSP image and unresiters from DCD.
  */
 DSP_STATUS DCD_AutoUnregister(IN struct DCD_MANAGER *hDcdMgr,
-IN char *pszCoffPath)
+   IN char *pszCoffPath)
 {
DSP_STATUS status = DSP_SOK;
 
@@ -172,8 +167,7 @@ DSP_STATUS DCD_AutoUnregister(IN struct DCD_MANAGER 
*hDcdMgr,
 
if (IsValidHandle(hDcdMgr)) {
status = DCD_GetObjects(hDcdMgr, pszCoffPath,
-  (DCD_REGISTERFXN)DCD_RegisterObject,
-  NULL);
+   

Re: [PATCH 1/2] omap i2c: make errata 1.153 workaround a separate function

2009-12-16 Thread Menon, Nishanth

Alexander Shishkin said the following on 12/16/2009 07:32 PM:

This is to avoid insanely long lines and levels of indentation.

Signed-off-by: Alexander Shishkin virtu...@slind.org
CC: linux-...@vger.kernel.org
CC: linux-omap@vger.kernel.org
---
 drivers/i2c/busses/i2c-omap.c |   43 ++--
 1 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 75bf3ad..ad8242a 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -671,6 +671,27 @@ omap_i2c_rev1_isr(int this_irq, void *dev_id)
 #define omap_i2c_rev1_isr  NULL
 #endif
 
+/*

+ * OMAP3430 Errata 1.153: When an XRDY/XDR is hit, wait for XUDF before writing
+ * data to DATA_REG. Otherwise some data bytes can be lost while transferring
+ * them from the memory to the I2C interface.
+ */
+static int omap3430_workaround(struct omap_i2c_dev *dev, u16 *stat, int *err)
  


note, though this is identified as being part of 3430, it is not really 
restricted to 3430 alone

we might want to rename this as errata_omap3_1p153() perhaps?


+{
+   while (!(*stat  OMAP_I2C_STAT_XUDF)) {
+   if (*stat  (OMAP_I2C_STAT_NACK | OMAP_I2C_STAT_AL)) {
+   omap_i2c_ack_stat(dev, *stat  (OMAP_I2C_STAT_XRDY |
+   OMAP_I2C_STAT_XDR));
+   *err |= OMAP_I2C_STAT_XUDF;
+   return -1;
+   }
+   cpu_relax();
+   *stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
+   }
+
+   return 0;
+}
  
wonder if using an inline might help throw away the function call 
overhead (considering it is used only once)?

+
 static irqreturn_t
 omap_i2c_isr(int this_irq, void *dev_id)
 {
@@ -794,25 +815,9 @@ complete:
break;
}
 
-/*

-* OMAP3430 Errata 1.153: When an XRDY/XDR
-* is hit, wait for XUDF before writing data
-* to DATA_REG. Otherwise some data bytes can
-* be lost while transferring them from the
-* memory to the I2C interface.
-*/
-
-   if (dev-rev = OMAP_I2C_REV_ON_3430) {
-   while (!(stat  
OMAP_I2C_STAT_XUDF)) {
-   if (stat  
(OMAP_I2C_STAT_NACK | OMAP_I2C_STAT_AL)) {
-   
omap_i2c_ack_stat(dev, stat  (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR));
-   err |= 
OMAP_I2C_STAT_XUDF;
-   goto complete;
-   }
-   cpu_relax();
-   stat = 
omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
-   }
-   }
+   if (dev-rev = OMAP_I2C_REV_ON_3430 
+   omap3430_workaround(dev, stat, err))
+   goto complete;
 
 omap_i2c_write_reg(dev, OMAP_I2C_DATA_REG, w);

}
  


Regards,
Nishanth Menon
--
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 2/2] omap i2c: add a timeout to the busy waiting

2009-12-16 Thread Menon, Nishanth

Alexander Shishkin said the following on 12/16/2009 07:32 PM:

The errata 1.153 workaround is busy waiting on XUDF bit in interrupt
context, which may lead to kernel hangs. The problem can be reproduced
by running the bus with wrong (too high) speed.

Signed-off-by: Alexander Shishkin virtu...@slind.org
CC: linux-...@vger.kernel.org
CC: linux-omap@vger.kernel.org
---
 drivers/i2c/busses/i2c-omap.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index ad8242a..b474c20 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -678,7 +678,9 @@ omap_i2c_rev1_isr(int this_irq, void *dev_id)
  */
 static int omap3430_workaround(struct omap_i2c_dev *dev, u16 *stat, int *err)
 {
-   while (!(*stat  OMAP_I2C_STAT_XUDF)) {
+   unsigned long timeout = 1;
+
+   while (!(*stat  OMAP_I2C_STAT_XUDF  --timeout)) {
  
a) timeout without using an actual delay is not a good idea - consider 
each OPP - we can go upto 1ghz on 3630,

the actual time for 1 iterations will depend on the MPU speed.
b) how did you arrive at the 10k iteration limit?


if (*stat  (OMAP_I2C_STAT_NACK | OMAP_I2C_STAT_AL)) {
omap_i2c_ack_stat(dev, *stat  (OMAP_I2C_STAT_XRDY |
OMAP_I2C_STAT_XDR));
@@ -689,6 +691,9 @@ static int omap3430_workaround(struct omap_i2c_dev *dev, 
u16 *stat, int *err)
*stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
}
 
+	if (!timeout)

+   dev_err(dev-dev, timeout waiting on XUDF bit\n);
+
return 0;
 }
 
  

Regards,
Nishanth Menon
--
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 00/10 V5] omap3: pm: introduce support for 3630 OPPs

2009-12-16 Thread Menon, Nishanth

Kevin Hilman said the following on 12/17/2009 04:07 AM:

Kevin Hilman khil...@deeprootsystems.com writes:

  

Nishanth Menon n...@ti.com writes:



Hi,
Thanks for all the comments. Here are the *changed* patches since V5

What changed in V5:
* review comment incorporated
* vsel is deprecated now
* I seem to have hit a checkpatch.pl bug as in 
  http://lkml.org/lkml/2009/12/11/573, made me check the usage

  of __deprecated for struct params, and used it in a
  consistent manner to functions..
* More warnings added to build :( (deprecated ones ofcourse)
* removed OMAP_OPP_DEF_TERMINATOR
* 3430 and 3630 patches changed as a result
  

[...]

  

To facilitate the ongoing discussions on OPP rework, and to have a
common base, this series is available as a branch in my linux-omap-pm
repo[1].

The branch is called 'pm-wip-opp' and I have rebased onto the PM
branch I pushed today.



  

Thanks Kevin.


I forgot to mention that I've also pushed the patch for removing OPP
interface from the OMAP PM layer[1] to the work-in-progress OPP
branch.

Kevin

[1] http://marc.info/?l=linux-omapm=125917007423545w=2
  

Reg [1]
What is the point of having
void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
http://git.kernel.org/?p=linux/kernel/git/khilman/linux-omap-pm.git;a=blob;f=arch/arm/mach-omap2/io.c;h=a45ff981b8d65ed3004cec7b4e3431862d4447de;hb=925b2120f036c3374df3f58aeb2a0f39d1ba8d84#l305 
struct omap_sdrc_params *sdrc_cs1,
http://git.kernel.org/?p=linux/kernel/git/khilman/linux-omap-pm.git;a=blob;f=arch/arm/mach-omap2/io.c;h=a45ff981b8d65ed3004cec7b4e3431862d4447de;hb=925b2120f036c3374df3f58aeb2a0f39d1ba8d84#l306 
struct omap_opp *mpu_opps,
http://git.kernel.org/?p=linux/kernel/git/khilman/linux-omap-pm.git;a=blob;f=arch/arm/mach-omap2/io.c;h=a45ff981b8d65ed3004cec7b4e3431862d4447de;hb=925b2120f036c3374df3f58aeb2a0f39d1ba8d84#l307 
struct omap_opp *dsp_opps,
http://git.kernel.org/?p=linux/kernel/git/khilman/linux-omap-pm.git;a=blob;f=arch/arm/mach-omap2/io.c;h=a45ff981b8d65ed3004cec7b4e3431862d4447de;hb=925b2120f036c3374df3f58aeb2a0f39d1ba8d84#l308 
struct omap_opp *l3_opps)



Why have mpu_opps, dsp_opps and l3_opps anymore? those parameters are 
unused anymore. the patch should have changed omap2_init_common_hw and 
related board calls - am I right?


regards,
Nishanth Menon
Ref:
[1]: 
http://git.kernel.org/?p=linux/kernel/git/khilman/linux-omap-pm.git;a=commitdiff;h=925b2120f036c3374df3f58aeb2a0f39d1ba8d84

--
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 7/7] DSPBRIDGE: Move PROC object abstraction to proc.c

2009-12-16 Thread Omar Ramirez Luna
Move object structure to PROC module.

Signed-off-by: Omar Ramirez Luna omar.rami...@ti.com
---
 arch/arm/plat-omap/include/dspbridge/proc.h |   24 
 drivers/dsp/bridge/rmgr/proc.c  |   23 +++
 2 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/proc.h 
b/arch/arm/plat-omap/include/dspbridge/proc.h
index 935afd0..d63c5cf 100644
--- a/arch/arm/plat-omap/include/dspbridge/proc.h
+++ b/arch/arm/plat-omap/include/dspbridge/proc.h
@@ -66,30 +66,6 @@
 #include dspbridge/devdefs.h
 #include dspbridge/drv.h
 
-/* The PROC_OBJECT structure.   */
-struct PROC_OBJECT {
-   struct LST_ELEM link;   /* Link to next PROC_OBJECT */
-   u32 dwSignature;/* Used for object validation */
-   struct DEV_OBJECT *hDevObject;  /* Device this PROC represents */
-   u32 hProcess;   /* Process owning this Processor */
-   struct MGR_OBJECT *hMgrObject;  /* Manager Object Handle */
-   u32 uAttachCount;   /* Processor attach count */
-   u32 uProcessor; /* Processor number */
-   u32 uTimeout;   /* Time out count */
-   enum DSP_PROCSTATE sState;  /* Processor state */
-   u32 ulUnit; /* DDSP unit number */
-   bool bIsAlreadyAttached;/*
-* True if the Device below has
-* GPP Client attached
-*/
-   struct NTFY_OBJECT *hNtfy;  /* Manages  notifications */
-   struct WMD_DEV_CONTEXT *hWmdContext;/* WMD Context Handle */
-   struct WMD_DRV_INTERFACE *pIntfFxns;/* Function interface to WMD */
-   char *g_pszLastCoff;
-   struct list_head proc_object;
-};
-
-
 /*
  *   PROC_Attach 
  *  Purpose:
diff --git a/drivers/dsp/bridge/rmgr/proc.c b/drivers/dsp/bridge/rmgr/proc.c
index 8501b06..3055078 100644
--- a/drivers/dsp/bridge/rmgr/proc.c
+++ b/drivers/dsp/bridge/rmgr/proc.c
@@ -166,6 +166,29 @@ extern char *iva_img;
 static struct GT_Mask PROC_DebugMask = { NULL, NULL }; /* WCD MGR Mask */
 #endif
 
+/* The PROC_OBJECT structure.   */
+struct PROC_OBJECT {
+   struct LST_ELEM link;   /* Link to next PROC_OBJECT */
+   u32 dwSignature;/* Used for object validation */
+   struct DEV_OBJECT *hDevObject;  /* Device this PROC represents */
+   u32 hProcess;   /* Process owning this Processor */
+   struct MGR_OBJECT *hMgrObject;  /* Manager Object Handle */
+   u32 uAttachCount;   /* Processor attach count */
+   u32 uProcessor; /* Processor number */
+   u32 uTimeout;   /* Time out count */
+   enum DSP_PROCSTATE sState;  /* Processor state */
+   u32 ulUnit; /* DDSP unit number */
+   bool bIsAlreadyAttached;/*
+* True if the Device below has
+* GPP Client attached
+*/
+   struct NTFY_OBJECT *hNtfy;  /* Manages  notifications */
+   struct WMD_DEV_CONTEXT *hWmdContext;/* WMD Context Handle */
+   struct WMD_DRV_INTERFACE *pIntfFxns;/* Function interface to WMD */
+   char *g_pszLastCoff;
+   struct list_head proc_object;
+};
+
 static u32 cRefs;
 
 struct SYNC_CSOBJECT *hProcLock;   /* For critical sections */
-- 
1.6.2.4

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


[PATCH 6/7] DSPBRIDGE: Delete list implementation for resource cleanup

2009-12-16 Thread Omar Ramirez Luna
From: Ernesto Ramos Falcon erne...@ti.com

This patch moves processor detach implementation to bridge_release,
when a process is exiting it will be doing the detach from there
instead of relying on the user to explicitly call detach function.

This will allow a fine control on the resources that will be cleaned
once the application exits.

Signed-off-by: Ernesto Ramos Falcon erne...@ti.com
---
 arch/arm/plat-omap/include/dspbridge/drv.h  |   12 +
 arch/arm/plat-omap/include/dspbridge/proc.h |5 +--
 drivers/dsp/bridge/pmgr/wcd.c   |7 ++---
 drivers/dsp/bridge/rmgr/drv.c   |   12 --
 drivers/dsp/bridge/rmgr/drv_interface.c |   16 +++--
 drivers/dsp/bridge/rmgr/proc.c  |   31 +++---
 6 files changed, 24 insertions(+), 59 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/drv.h 
b/arch/arm/plat-omap/include/dspbridge/drv.h
index efc3a92..d14613f 100644
--- a/arch/arm/plat-omap/include/dspbridge/drv.h
+++ b/arch/arm/plat-omap/include/dspbridge/drv.h
@@ -173,16 +173,8 @@ struct PROCESS_CONTEXT{
/* Process State */
enum GPP_PROC_RES_STATE resState;
 
-   /* Process ID (Same as UNIX process ID) */
-   u32 pid;
-
-   /* Pointer to next process context
-   * (To maintain a linked list of process contexts) */
-   struct PROCESS_CONTEXT *next;
-
-   /* List of Processors */
-   struct list_head processor_list;
-   spinlock_t proc_list_lock;
+   /* Handle to Processor */
+   DSP_HPROCESSOR hProcessor;
 
/* DSP Node resources */
struct NODE_RES_OBJECT *pNodeList;
diff --git a/arch/arm/plat-omap/include/dspbridge/proc.h 
b/arch/arm/plat-omap/include/dspbridge/proc.h
index d4896d5..935afd0 100644
--- a/arch/arm/plat-omap/include/dspbridge/proc.h
+++ b/arch/arm/plat-omap/include/dspbridge/proc.h
@@ -177,7 +177,7 @@ struct PROC_OBJECT {
  *  Close a DSP processor and de-allocate all (GPP) resources reserved
  *  for it. The Processor Object is deleted.
  *  Parameters:
- *  hProcessor  :   The processor handle.
+ *  pr_ctxt :   The processor handle.
  *  Returns:
  *  DSP_SOK :   Success.
  *  DSP_EHANDLE :   InValid Handle.
@@ -187,8 +187,7 @@ struct PROC_OBJECT {
  *  Ensures:
  *  PROC Object is destroyed.
  */
-   extern DSP_STATUS PROC_Detach(DSP_HPROCESSOR hProcessor,
-   struct PROCESS_CONTEXT *pr_ctxt);
+   extern DSP_STATUS PROC_Detach(struct PROCESS_CONTEXT *pr_ctxt);
 
 /*
  *   PROC_EnumNodes 
diff --git a/drivers/dsp/bridge/pmgr/wcd.c b/drivers/dsp/bridge/pmgr/wcd.c
index 70a56ed..7226b5a 100644
--- a/drivers/dsp/bridge/pmgr/wcd.c
+++ b/drivers/dsp/bridge/pmgr/wcd.c
@@ -734,14 +734,13 @@ func_end:
  */
 u32 PROCWRAP_Detach(union Trapped_Args *args, void *pr_ctxt)
 {
-   u32 retVal;
-
GT_1trace(WCD_debugMask, GT_ENTER,
 PROCWRAP_Detach: entered args\n0x%x 
 hProceesor \n, args-ARGS_PROC_DETACH.hProcessor);
-   retVal = PROC_Detach(args-ARGS_PROC_DETACH.hProcessor, pr_ctxt);
 
-   return retVal;
+   /* PROC_Detach called at bridge_release only */
+
+   return DSP_SOK;
 }
 
 /*
diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c
index 7201c95..ad49c7f 100644
--- a/drivers/dsp/bridge/rmgr/drv.c
+++ b/drivers/dsp/bridge/rmgr/drv.c
@@ -157,18 +157,6 @@ static DSP_STATUS DRV_ProcFreeNodeRes(HANDLE hPCtxt);
 static DSP_STATUS  DRV_ProcFreeSTRMRes(HANDLE hPCtxt);
 extern enum NODE_STATE NODE_GetState(HANDLE hNode);
 
-/* Set the Process ID */
-DSP_STATUS DRV_ProcSetPID(HANDLE hPCtxt, s32 hProcess)
-{
-   struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt;
-   DSP_STATUS status = DSP_SOK;
-
-   DBC_Assert(hPCtxt != NULL);
-
-   pCtxt-pid = hProcess;
-   return status;
-}
-
 /* Update the state of process context */
 DSP_STATUS DRV_ProcUpdatestate(HANDLE hPCtxt, enum GPP_PROC_RES_STATE status)
 {
diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c 
b/drivers/dsp/bridge/rmgr/drv_interface.c
index f0c5e35..42fb7cb 100644
--- a/drivers/dsp/bridge/rmgr/drv_interface.c
+++ b/drivers/dsp/bridge/rmgr/drv_interface.c
@@ -545,14 +545,11 @@ static int bridge_open(struct inode *ip, struct file 
*filp)
 * process context list.
 */
pr_ctxt = MEM_Calloc(sizeof(struct PROCESS_CONTEXT), MEM_PAGED);
-   if (pr_ctxt) {
-   spin_lock_init((pr_ctxt-proc_list_lock));
-   INIT_LIST_HEAD((pr_ctxt-processor_list));
+   if (pr_ctxt)
DRV_ProcUpdatestate(pr_ctxt, PROC_RES_ALLOCATED);
-   DRV_ProcSetPID(pr_ctxt, current-tgid);
-   } else {
+   else
status = -ENOMEM;
-   }
+
filp-private_data = pr_ctxt;
 
 err:
@@ -570,7 +567,6 @@ static int bridge_release(struct inode *ip, struct file 
*filp)
DSP_STATUS dsp_status;
HANDLE hDrvObject;

[PATCH 0/7] Resource cleanup changes

2009-12-16 Thread Omar Ramirez Luna
This patch series contains the changes to migrate to the
new resource implementation proposed by Ameya.

It is meant to apply after v2 of first set of unreviewed patches

Ameya Palande (3):
  DSPBRIDGE: Pass filp-private to all the ioctl wrappers
  DSPBRIDGE: Define pr_ctxt as a parameter in low level functions
  DSPBRIDGE: Remove old resource cleanup implementation

Ernesto Ramos Falcon (1):
  DSPBRIDGE: Delete list implementation for resource cleanup

Fernando Guzman Lugo (1):
  DSPBRIDGE: Remove process context list

Omar Ramirez Luna (2):
  DSPBRIDGE: less indentation for bridge_open and bridge_release
  DSPBRIDGE: Move PROC object abstraction to proc.c

 arch/arm/plat-omap/include/dspbridge/_dcd.h|  135 ---
 arch/arm/plat-omap/include/dspbridge/drv.h |9 +-
 arch/arm/plat-omap/include/dspbridge/node.h|7 +-
 arch/arm/plat-omap/include/dspbridge/proc.h|   14 +-
 .../plat-omap/include/dspbridge/resourcecleanup.h  |9 +-
 arch/arm/plat-omap/include/dspbridge/strm.h|   13 +-
 drivers/dsp/bridge/pmgr/wcd.c  |  143 +++---
 drivers/dsp/bridge/rmgr/drv.c  |  467 +---
 drivers/dsp/bridge/rmgr/drv_interface.c|   71 ++--
 drivers/dsp/bridge/rmgr/node.c |   88 +---
 drivers/dsp/bridge/rmgr/proc.c |  201 ++---
 drivers/dsp/bridge/rmgr/strm.c |  118 ++
 12 files changed, 306 insertions(+), 969 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 3/7] DSPBRIDGE: Remove old resource cleanup implementation

2009-12-16 Thread Omar Ramirez Luna
From: Ameya Palande ameya.pala...@nokia.com

Remove old resource cleanup implementation, and use the process
context pointer stored in filp-private.

Signed-off-by: Ameya Palande ameya.pala...@nokia.com
[ orl: split into logical patch set, patch description ]
Signed-off-by: Omar Ramirez Luna omar.rami...@ti.com
Acked-by: Fernando Guzman Lugo x0095...@ti.com
---
 arch/arm/plat-omap/include/dspbridge/drv.h |5 +-
 arch/arm/plat-omap/include/dspbridge/proc.h|   24 +++
 .../plat-omap/include/dspbridge/resourcecleanup.h  |7 +-
 drivers/dsp/bridge/rmgr/drv.c  |  126 
 drivers/dsp/bridge/rmgr/drv_interface.c|   18 ++-
 drivers/dsp/bridge/rmgr/node.c |   65 +---
 drivers/dsp/bridge/rmgr/proc.c |  158 ---
 drivers/dsp/bridge/rmgr/strm.c |  104 +++---
 8 files changed, 134 insertions(+), 373 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/drv.h 
b/arch/arm/plat-omap/include/dspbridge/drv.h
index c468461..efc3a92 100644
--- a/arch/arm/plat-omap/include/dspbridge/drv.h
+++ b/arch/arm/plat-omap/include/dspbridge/drv.h
@@ -180,8 +180,9 @@ struct PROCESS_CONTEXT{
* (To maintain a linked list of process contexts) */
struct PROCESS_CONTEXT *next;
 
-   /* Processor info to which the process is related */
-   DSP_HPROCESSOR hProcessor;
+   /* List of Processors */
+   struct list_head processor_list;
+   spinlock_t proc_list_lock;
 
/* DSP Node resources */
struct NODE_RES_OBJECT *pNodeList;
diff --git a/arch/arm/plat-omap/include/dspbridge/proc.h 
b/arch/arm/plat-omap/include/dspbridge/proc.h
index f5b0c50..d4896d5 100644
--- a/arch/arm/plat-omap/include/dspbridge/proc.h
+++ b/arch/arm/plat-omap/include/dspbridge/proc.h
@@ -66,6 +66,30 @@
 #include dspbridge/devdefs.h
 #include dspbridge/drv.h
 
+/* The PROC_OBJECT structure.   */
+struct PROC_OBJECT {
+   struct LST_ELEM link;   /* Link to next PROC_OBJECT */
+   u32 dwSignature;/* Used for object validation */
+   struct DEV_OBJECT *hDevObject;  /* Device this PROC represents */
+   u32 hProcess;   /* Process owning this Processor */
+   struct MGR_OBJECT *hMgrObject;  /* Manager Object Handle */
+   u32 uAttachCount;   /* Processor attach count */
+   u32 uProcessor; /* Processor number */
+   u32 uTimeout;   /* Time out count */
+   enum DSP_PROCSTATE sState;  /* Processor state */
+   u32 ulUnit; /* DDSP unit number */
+   bool bIsAlreadyAttached;/*
+* True if the Device below has
+* GPP Client attached
+*/
+   struct NTFY_OBJECT *hNtfy;  /* Manages  notifications */
+   struct WMD_DEV_CONTEXT *hWmdContext;/* WMD Context Handle */
+   struct WMD_DRV_INTERFACE *pIntfFxns;/* Function interface to WMD */
+   char *g_pszLastCoff;
+   struct list_head proc_object;
+};
+
+
 /*
  *   PROC_Attach 
  *  Purpose:
diff --git a/arch/arm/plat-omap/include/dspbridge/resourcecleanup.h 
b/arch/arm/plat-omap/include/dspbridge/resourcecleanup.h
index b43fa16..f32da22 100644
--- a/arch/arm/plat-omap/include/dspbridge/resourcecleanup.h
+++ b/arch/arm/plat-omap/include/dspbridge/resourcecleanup.h
@@ -35,15 +35,10 @@ extern DSP_STATUS DRV_ProcUpdatestate(HANDLE pCtxt,
 
 extern DSP_STATUS DRV_ProcSetPID(HANDLE pCtxt, s32 hProcess);
 
-extern DSP_STATUS DRV_GetProcContext(u32 phProcess,
-   struct DRV_OBJECT *hDrvObject,
-   HANDLE hPCtxt, DSP_HNODE hNode,
-   u32 pMapAddr);
-
 extern DSP_STATUS DRV_RemoveAllResources(HANDLE pPctxt);
 
 extern DSP_STATUS DRV_RemoveProcContext(struct DRV_OBJECT *hDRVObject,
-HANDLE hPCtxt, HANDLE hProcess);
+HANDLE pr_ctxt);
 
 extern DSP_STATUS DRV_GetNodeResElement(HANDLE hNode, HANDLE nodeRes,
HANDLE pCtxt);
diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c
index a00598b..92e2a62 100644
--- a/drivers/dsp/bridge/rmgr/drv.c
+++ b/drivers/dsp/bridge/rmgr/drv.c
@@ -194,77 +194,6 @@ DSP_STATUS DRV_GetProcCtxtList(struct PROCESS_CONTEXT 
**pPctxt,
return status;
 }
 
-
-
-/* Get a particular process context based on process handle (phProcess) */
-DSP_STATUS DRV_GetProcContext(u32 phProcess,
-   struct DRV_OBJECT *hDrvObject,
-   HANDLE hPCtxt, DSP_HNODE hNode,
-   u32 pMapAddr)
-{
-   struct PROCESS_CONTEXT **pCtxt = (struct PROCESS_CONTEXT **)hPCtxt;
-   DSP_STATUS status = DSP_SOK;
-   struct 

[PATCH 1/7] DSPBRIDGE: Pass filp-private to all the ioctl wrappers

2009-12-16 Thread Omar Ramirez Luna
From: Ameya Palande ameya.pala...@nokia.com

This patch enables passing of filp-private_data to all the ioctl wrappers
functions. This change will facilitate retrival of PROCESS_CONTEXT pointer in
ioctl, and will remove the call to DRV_GetProcContext().

Signed-off-by: Ameya Palande ameya.pala...@nokia.com
Acked-by: Fernando Guzman Lugo x0095...@ti.com
---
 arch/arm/plat-omap/include/dspbridge/_dcd.h |  135 ---
 drivers/dsp/bridge/pmgr/wcd.c   |  112 +++---
 drivers/dsp/bridge/rmgr/drv_interface.c |3 +-
 3 files changed, 138 insertions(+), 112 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/_dcd.h 
b/arch/arm/plat-omap/include/dspbridge/_dcd.h
index b6a8d9e..6e6aec5 100644
--- a/arch/arm/plat-omap/include/dspbridge/_dcd.h
+++ b/arch/arm/plat-omap/include/dspbridge/_dcd.h
@@ -72,7 +72,7 @@
  */
extern DSP_STATUS WCD_CallDevIOCtl(unsigned int cmd,
   union Trapped_Args *args,
-  u32 *pResult);
+  u32 *pResult, void *pr_ctxt);
 
 /*
  *   WCD_Init 
@@ -119,69 +119,94 @@
extern void WCD_Exit(void);
 
 /* MGR wrapper functions */
-   extern u32 MGRWRAP_EnumNode_Info(union Trapped_Args *args);
-   extern u32 MGRWRAP_EnumProc_Info(union Trapped_Args *args);
-   extern u32 MGRWRAP_RegisterObject(union Trapped_Args *args);
-   extern u32 MGRWRAP_UnregisterObject(union Trapped_Args *args);
-   extern u32 MGRWRAP_WaitForBridgeEvents(union Trapped_Args *args);
+   extern u32 MGRWRAP_EnumNode_Info(union Trapped_Args *args,
+   void *pr_ctxt);
+   extern u32 MGRWRAP_EnumProc_Info(union Trapped_Args *args,
+   void *pr_ctxt);
+   extern u32 MGRWRAP_RegisterObject(union Trapped_Args *args,
+   void *pr_ctxt);
+   extern u32 MGRWRAP_UnregisterObject(union Trapped_Args *args,
+   void *pr_ctxt);
+   extern u32 MGRWRAP_WaitForBridgeEvents(union Trapped_Args *args,
+   void *pr_ctxt);
 
 #ifndef RES_CLEANUP_DISABLE
-   extern u32 MGRWRAP_GetProcessResourcesInfo(union Trapped_Args *args);
+   extern u32 MGRWRAP_GetProcessResourcesInfo(union Trapped_Args *args,
+   void *pr_ctxt);
 #endif
 
 
 /* CPRC (Processor) wrapper Functions */
-   extern u32 PROCWRAP_Attach(union Trapped_Args *args);
-   extern u32 PROCWRAP_Ctrl(union Trapped_Args *args);
-   extern u32 PROCWRAP_Detach(union Trapped_Args *args);
-   extern u32 PROCWRAP_EnumNode_Info(union Trapped_Args *args);
-   extern u32 PROCWRAP_EnumResources(union Trapped_Args *args);
-   extern u32 PROCWRAP_GetState(union Trapped_Args *args);
-   extern u32 PROCWRAP_GetTrace(union Trapped_Args *args);
-   extern u32 PROCWRAP_Load(union Trapped_Args *args);
-   extern u32 PROCWRAP_RegisterNotify(union Trapped_Args *args);
-   extern u32 PROCWRAP_Start(union Trapped_Args *args);
-   extern u32 PROCWRAP_ReserveMemory(union Trapped_Args *args);
-   extern u32 PROCWRAP_UnReserveMemory(union Trapped_Args *args);
-   extern u32 PROCWRAP_Map(union Trapped_Args *args);
-   extern u32 PROCWRAP_UnMap(union Trapped_Args *args);
-   extern u32 PROCWRAP_FlushMemory(union Trapped_Args *args);
-   extern u32 PROCWRAP_Stop(union Trapped_Args *args);
-   extern u32 PROCWRAP_InvalidateMemory(union Trapped_Args *args);
+   extern u32 PROCWRAP_Attach(union Trapped_Args *args, void *pr_ctxt);
+   extern u32 PROCWRAP_Ctrl(union Trapped_Args *args, void *pr_ctxt);
+   extern u32 PROCWRAP_Detach(union Trapped_Args *args, void *pr_ctxt);
+   extern u32 PROCWRAP_EnumNode_Info(union Trapped_Args *args,
+   void *pr_ctxt);
+   extern u32 PROCWRAP_EnumResources(union Trapped_Args *args,
+   void *pr_ctxt);
+   extern u32 PROCWRAP_GetState(union Trapped_Args *args, void *pr_ctxt);
+   extern u32 PROCWRAP_GetTrace(union Trapped_Args *args, void *pr_ctxt);
+   extern u32 PROCWRAP_Load(union Trapped_Args *args, void *pr_ctxt);
+   extern u32 PROCWRAP_RegisterNotify(union Trapped_Args *args,
+   void *pr_ctxt);
+   extern u32 PROCWRAP_Start(union Trapped_Args *args, void *pr_ctxt);
+   extern u32 PROCWRAP_ReserveMemory(union Trapped_Args *args,
+   void *pr_ctxt);
+   extern u32 PROCWRAP_UnReserveMemory(union Trapped_Args *args,
+   void *pr_ctxt);
+   extern u32 PROCWRAP_Map(union Trapped_Args *args, void *pr_ctxt);
+   extern u32 PROCWRAP_UnMap(union Trapped_Args *args, void *pr_ctxt);
+   extern u32 PROCWRAP_FlushMemory(union Trapped_Args *args,
+   void *pr_ctxt);
+   extern u32 PROCWRAP_Stop(union Trapped_Args *args, void *pr_ctxt);
+   extern u32 

[PATCH 5/7] DSPBRIDGE: Remove process context list

2009-12-16 Thread Omar Ramirez Luna
From: Fernando Guzman Lugo x0095...@ti.com

This patch removes the list implementation to store and manage
process contexts as it is not needed anymore.

Signed-off-by: Fernando Guzman Lugo x0095...@ti.com
---
 .../plat-omap/include/dspbridge/resourcecleanup.h  |2 -
 drivers/dsp/bridge/pmgr/wcd.c  |1 -
 drivers/dsp/bridge/rmgr/drv.c  |  382 
 drivers/dsp/bridge/rmgr/drv_interface.c|   27 +--
 drivers/dsp/bridge/rmgr/proc.c |   43 +---
 5 files changed, 6 insertions(+), 449 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/resourcecleanup.h 
b/arch/arm/plat-omap/include/dspbridge/resourcecleanup.h
index f32da22..a6f4397 100644
--- a/arch/arm/plat-omap/include/dspbridge/resourcecleanup.h
+++ b/arch/arm/plat-omap/include/dspbridge/resourcecleanup.h
@@ -76,8 +76,6 @@ extern DSP_STATUS DRV_ProcRemoveSTRMResElement(HANDLE 
STRMRes, HANDLE pCtxt);
 
 extern DSP_STATUS DRV_RemoveAllSTRMResElements(HANDLE pCtxt);
 
-extern DSP_STATUS DRV_ProcDisplayResInfo(u8 *pBuf, u32 *pSize);
-
 extern enum NODE_STATE NODE_GetState(HANDLE hNode);
 
 #endif
diff --git a/drivers/dsp/bridge/pmgr/wcd.c b/drivers/dsp/bridge/pmgr/wcd.c
index 0d027ec..70a56ed 100644
--- a/drivers/dsp/bridge/pmgr/wcd.c
+++ b/drivers/dsp/bridge/pmgr/wcd.c
@@ -639,7 +639,6 @@ u32 MGRWRAP_GetProcessResourcesInfo(union Trapped_Args 
*args, void *pr_ctxt)
 DSP_STATUS status = DSP_SOK;
 u32 uSize = 0;
 u8 *pBuf = MEM_Alloc(8092, MEM_NONPAGED);
-status = DRV_ProcDisplayResInfo(pBuf, uSize);
 GT_1trace(WCD_debugMask, GT_ENTER,
 MGRWRAP_GetProcessResourcesInfo:uSize=%d :\n, uSize);
 cp_to_usr(args-ARGS_PROC_GETTRACE.pBuf, pBuf, status, uSize);
diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c
index 92e2a62..7201c95 100644
--- a/drivers/dsp/bridge/rmgr/drv.c
+++ b/drivers/dsp/bridge/rmgr/drv.c
@@ -128,9 +128,6 @@ struct DRV_OBJECT {
u32 dwSignature;
struct LST_LIST *devList;
struct LST_LIST *devNodeString;
-#ifndef RES_CLEANUP_DISABLE
-   struct PROCESS_CONTEXT  *procCtxtList;
-#endif
 };
 
 /*
@@ -156,13 +153,10 @@ static DSP_STATUS RequestBridgeResourcesDSP(u32 
dwContext, s32 fRequest);
 #ifndef RES_CLEANUP_DISABLE
 /* GPP PROCESS CLEANUP CODE */
 
-static DSP_STATUS PrintProcessInformation(void);
 static DSP_STATUS DRV_ProcFreeNodeRes(HANDLE hPCtxt);
 static DSP_STATUS  DRV_ProcFreeSTRMRes(HANDLE hPCtxt);
 extern enum NODE_STATE NODE_GetState(HANDLE hNode);
 
-/* Get the process context list from driver object */
-
 /* Set the Process ID */
 DSP_STATUS DRV_ProcSetPID(HANDLE hPCtxt, s32 hProcess)
 {
@@ -175,108 +169,6 @@ DSP_STATUS DRV_ProcSetPID(HANDLE hPCtxt, s32 hProcess)
return status;
 }
 
-
-/* Getting the head of the process context list */
-DSP_STATUS DRV_GetProcCtxtList(struct PROCESS_CONTEXT **pPctxt,
-   struct DRV_OBJECT *hDrvObject)
-{
-   DSP_STATUS status = DSP_SOK;
-   struct DRV_OBJECT *pDrvObject = (struct DRV_OBJECT *)hDrvObject;
-
-   DBC_Assert(hDrvObject != NULL);
-   GT_2trace(curTrace, GT_ENTER,
-   DRV_GetProcCtxtList: 2 *pPctxt:%x, pDrvObject
-   :%x, *pPctxt, pDrvObject);
-   *pPctxt = pDrvObject-procCtxtList;
-   GT_2trace(curTrace, GT_ENTER,
-   DRV_GetProcCtxtList: 3 *pPctxt:%x, pDrvObject
-   :%x, *pPctxt, pDrvObject);
-   return status;
-}
-
-/* Add a new process context to process context list */
-DSP_STATUS DRV_InsertProcContext(struct DRV_OBJECT *hDrVObject, HANDLE hPCtxt)
-{
-   struct PROCESS_CONTEXT **pCtxt = (struct PROCESS_CONTEXT **)hPCtxt;
-   DSP_STATUS status = DSP_SOK;
-   struct PROCESS_CONTEXT *pCtxtList = NULL;
-   struct DRV_OBJECT*hDRVObject;
-
-   GT_0trace(curTrace, GT_ENTER, \n In DRV_InsertProcContext\n);
-
-   status = CFG_GetObject((u32 *)hDRVObject, REG_DRV_OBJECT);
-   DBC_Assert(hDRVObject != NULL);
-
-   *pCtxt = MEM_Calloc(1 * sizeof(struct PROCESS_CONTEXT), MEM_PAGED);
-   if (!*pCtxt) {
-   pr_err(DSP: MEM_Calloc failed in DRV_InsertProcContext\n);
-   return DSP_EMEMORY;
-   }
-
-   spin_lock_init((*pCtxt)-proc_list_lock);
-   INIT_LIST_HEAD((*pCtxt)-processor_list);
-
-   GT_0trace(curTrace, GT_ENTER,
-\n In DRV_InsertProcContext Calling 
-DRV_GetProcCtxtList\n);
-   DRV_GetProcCtxtList(pCtxtList, hDRVObject);
-   GT_0trace(curTrace, GT_ENTER,
-\n In DRV_InsertProcContext After Calling 
-DRV_GetProcCtxtList\n);
-   if (pCtxtList != NULL) {
-   GT_0trace(curTrace, GT_ENTER,
-\n In DRV_InsertProcContext and pCtxt is 
-not Null\n);
-   while (pCtxtList-next != NULL)
-   pCtxtList = pCtxtList-next;
-
-   pCtxtList-next = 

[PATCH 2/7] DSPBRIDGE: Define pr_ctxt as a parameter in low level functions

2009-12-16 Thread Omar Ramirez Luna
From: Ameya Palande ameya.pala...@nokia.com

As part of resource cleanup changes, this patch continues with the
next level of modifications required to use filp-private to store
PROCESS_CONTEXT structure.

Signed-off-by: Ameya Palande ameya.pala...@nokia.com
[ orl: split into logical patch set, patch description ]
Signed-off-by: Omar Ramirez Luna omar.rami...@ti.com
Acked-by: Fernando Guzman Lugo x0095...@ti.com
---
 arch/arm/plat-omap/include/dspbridge/node.h |7 +--
 arch/arm/plat-omap/include/dspbridge/proc.h |   13 +
 arch/arm/plat-omap/include/dspbridge/strm.h |   13 +
 drivers/dsp/bridge/pmgr/wcd.c   |   25 +++--
 drivers/dsp/bridge/rmgr/drv.c   |   15 +--
 drivers/dsp/bridge/rmgr/drv_interface.c |4 ++--
 drivers/dsp/bridge/rmgr/node.c  |   23 ++-
 drivers/dsp/bridge/rmgr/proc.c  |   14 +-
 drivers/dsp/bridge/rmgr/strm.c  |   14 +-
 9 files changed, 77 insertions(+), 51 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/node.h 
b/arch/arm/plat-omap/include/dspbridge/node.h
index d253962..e8952f5 100644
--- a/arch/arm/plat-omap/include/dspbridge/node.h
+++ b/arch/arm/plat-omap/include/dspbridge/node.h
@@ -68,6 +68,7 @@
 #include dspbridge/nodedefs.h
 #include dspbridge/dispdefs.h
 #include dspbridge/nldrdefs.h
+#include dspbridge/drv.h
 
 /*
  *   NODE_Allocate 
@@ -104,7 +105,8 @@
*pArgs,
OPTIONAL IN CONST struct DSP_NODEATTRIN
*pAttrIn,
-   OUT struct NODE_OBJECT **phNode);
+   OUT struct NODE_OBJECT **phNode,
+   struct PROCESS_CONTEXT *pr_ctxt);
 
 /*
  *   NODE_AllocMsgBuf 
@@ -307,7 +309,8 @@
  *  Ensures:
  *  DSP_SOK:hNode is invalid.
  */
-   extern DSP_STATUS NODE_Delete(struct NODE_OBJECT *hNode);
+   extern DSP_STATUS NODE_Delete(struct NODE_OBJECT *hNode,
+   struct PROCESS_CONTEXT *pr_ctxt);
 
 /*
  *   NODE_DeleteMgr 
diff --git a/arch/arm/plat-omap/include/dspbridge/proc.h 
b/arch/arm/plat-omap/include/dspbridge/proc.h
index 486652e..f5b0c50 100644
--- a/arch/arm/plat-omap/include/dspbridge/proc.h
+++ b/arch/arm/plat-omap/include/dspbridge/proc.h
@@ -64,6 +64,7 @@
 
 #include dspbridge/cfgdefs.h
 #include dspbridge/devdefs.h
+#include dspbridge/drv.h
 
 /*
  *   PROC_Attach 
@@ -94,7 +95,8 @@
extern DSP_STATUS PROC_Attach(u32 uProcessor,
  OPTIONAL CONST struct DSP_PROCESSORATTRIN
  *pAttrIn,
- OUT DSP_HPROCESSOR *phProcessor);
+ OUT DSP_HPROCESSOR *phProcessor,
+ struct PROCESS_CONTEXT *pr_ctxt);
 
 /*
  *   PROC_AutoStart =
@@ -161,7 +163,8 @@
  *  Ensures:
  *  PROC Object is destroyed.
  */
-   extern DSP_STATUS PROC_Detach(DSP_HPROCESSOR hProcessor);
+   extern DSP_STATUS PROC_Detach(DSP_HPROCESSOR hProcessor,
+   struct PROCESS_CONTEXT *pr_ctxt);
 
 /*
  *   PROC_EnumNodes 
@@ -578,7 +581,8 @@
   void *pMpuAddr,
   u32 ulSize,
   void *pReqAddr,
-  void **ppMapAddr, u32 ulMapAttr);
+  void **ppMapAddr, u32 ulMapAttr,
+  struct PROCESS_CONTEXT *pr_ctxt);
 
 /*
  *   PROC_ReserveMemory 
@@ -621,7 +625,8 @@
  *  Ensures:
  *  Details:
  */
-   extern DSP_STATUS PROC_UnMap(DSP_HPROCESSOR hProcessor, void *pMapAddr);
+   extern DSP_STATUS PROC_UnMap(DSP_HPROCESSOR hProcessor, void *pMapAddr,
+   struct PROCESS_CONTEXT *pr_ctxt);
 
 /*
  *   PROC_UnReserveMemory 
diff --git a/arch/arm/plat-omap/include/dspbridge/strm.h 
b/arch/arm/plat-omap/include/dspbridge/strm.h
index 5825615..bedc715 100644
--- a/arch/arm/plat-omap/include/dspbridge/strm.h
+++ b/arch/arm/plat-omap/include/dspbridge/strm.h
@@ -59,6 +59,7 @@
 #include dspbridge/dev.h
 
 #include dspbridge/strmdefs.h
+#include dspbridge/proc.h
 
 /*
  *   STRM_AllocateBuffer 
@@ -83,7 +84,8 @@
extern DSP_STATUS STRM_AllocateBuffer(struct STRM_OBJECT *hStrm,
  u32 uSize,
  OUT u8 **apBuffer,
- u32 uNumBufs);
+ u32 uNumBufs,
+ struct PROCESS_CONTEXT *pr_ctxt);
 
 /*
  *   

[PATCH 4/7] DSPBRIDGE: less indentation for bridge_open and bridge_release

2009-12-16 Thread Omar Ramirez Luna
Use goto statement to remove one indent level from
bridge_open and bridge_release.

Signed-off-by: Omar Ramirez Luna omar.rami...@ti.com
---
 drivers/dsp/bridge/rmgr/drv_interface.c |   61 ---
 1 files changed, 32 insertions(+), 29 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c 
b/drivers/dsp/bridge/rmgr/drv_interface.c
index 22e81bd..0452029 100644
--- a/drivers/dsp/bridge/rmgr/drv_interface.c
+++ b/drivers/dsp/bridge/rmgr/drv_interface.c
@@ -553,24 +553,25 @@ static int bridge_open(struct inode *ip, struct file 
*filp)
GT_0trace(driverTrace, GT_ENTER, - bridge_open\n);
 
dsp_status = CFG_GetObject((u32 *)hDrvObject, REG_DRV_OBJECT);
-   if (DSP_SUCCEEDED(dsp_status)) {
-   /*
-* Allocate a new process context and insert it into global
-* process context list.
-*/
-   DRV_InsertProcContext(hDrvObject, pr_ctxt);
-   if (pr_ctxt) {
-   DRV_ProcUpdatestate(pr_ctxt, PROC_RES_ALLOCATED);
-   DRV_ProcSetPID(pr_ctxt, current-tgid);
-   } else {
-   status = -ENOMEM;
-   }
-   } else {
+   if (DSP_FAILED(dsp_status)) {
status = -EIO;
+   goto err;
}
 
+   /*
+* Allocate a new process context and insert it into global
+* process context list.
+*/
+   DRV_InsertProcContext(hDrvObject, pr_ctxt);
+   if (pr_ctxt) {
+   DRV_ProcUpdatestate(pr_ctxt, PROC_RES_ALLOCATED);
+   DRV_ProcSetPID(pr_ctxt, current-tgid);
+   } else {
+   status = -ENOMEM;
+   }
filp-private_data = pr_ctxt;
 
+err:
GT_0trace(driverTrace, GT_ENTER, - bridge_open\n);
return status;
 }
@@ -591,25 +592,27 @@ static int bridge_release(struct inode *ip, struct file 
*filp)
 
if (!filp-private_data) {
status = -EIO;
-   } else {
-   pr_ctxt = filp-private_data;
-   dsp_status = CFG_GetObject((u32 *)hDrvObject, REG_DRV_OBJECT);
-   if (DSP_SUCCEEDED(dsp_status)) {
-   flush_signals(current);
-   DRV_RemoveAllResources(pr_ctxt);
-   list_for_each_entry_safe(proc_obj_ptr, temp,
-   pr_ctxt-processor_list,
-   proc_object) {
-   PROC_Detach(proc_obj_ptr, pr_ctxt);
-   }
-   DRV_RemoveProcContext((struct DRV_OBJECT *)hDrvObject,
-   pr_ctxt);
-   } else {
-   status = -EIO;
+   goto err;
+   }
+
+   pr_ctxt = filp-private_data;
+   dsp_status = CFG_GetObject((u32 *)hDrvObject, REG_DRV_OBJECT);
+   if (DSP_SUCCEEDED(dsp_status)) {
+   flush_signals(current);
+   DRV_RemoveAllResources(pr_ctxt);
+   list_for_each_entry_safe(proc_obj_ptr, temp,
+   pr_ctxt-processor_list,
+   proc_object) {
+   PROC_Detach(proc_obj_ptr, pr_ctxt);
}
-   filp-private_data = NULL;
+   DRV_RemoveProcContext((struct DRV_OBJECT *)hDrvObject,
+   pr_ctxt);
+   } else {
+   status = -EIO;
}
+   filp-private_data = NULL;
 
+err:
GT_0trace(driverTrace, GT_ENTER, - bridge_release\n);
return status;
 }
-- 
1.6.2.4

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


[PATCH] DSPBRIDGE: Reset IVA2 Video sequencer

2009-12-16 Thread Omar Ramirez Luna
This patch will reset IVA2 video sequencer as part of
initialization or uninstall process.

Signed-off-by: Omar Ramirez Luna omar.rami...@ti.com
---
 drivers/dsp/bridge/wmd/tiomap3430.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/dsp/bridge/wmd/tiomap3430.c 
b/drivers/dsp/bridge/wmd/tiomap3430.c
index f41763c..b7447e1 100644
--- a/drivers/dsp/bridge/wmd/tiomap3430.c
+++ b/drivers/dsp/bridge/wmd/tiomap3430.c
@@ -879,6 +879,7 @@ static DSP_STATUS WMD_BRD_Stop(struct WMD_DEV_CONTEXT 
*hDevContext)
DBG_Trace(DBG_LEVEL6, WMD_BRD_Stop - End ** \n);
HW_RST_Reset(resources.dwPrmBase, HW_RST1_IVA2);
HW_RST_Reset(resources.dwPrmBase, HW_RST2_IVA2);
+   HW_RST_Reset(resources.dwPrmBase, HW_RST3_IVA2);
 
return status;
 }
@@ -945,6 +946,7 @@ static DSP_STATUS WMD_BRD_Delete(struct WMD_DEV_CONTEXT 
*hDevContext)
DBG_Trace(DBG_LEVEL6, WMD_BRD_Delete - End ** \n);
HW_RST_Reset(resources.dwPrmBase, HW_RST1_IVA2);
HW_RST_Reset(resources.dwPrmBase, HW_RST2_IVA2);
+   HW_RST_Reset(resources.dwPrmBase, HW_RST3_IVA2);
 
return status;
 }
-- 
1.6.2.4

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


[PATCH] DSPBRIDGE: Improve flush_all() performance

2009-12-16 Thread Omar Ramirez Luna
From: Ameya Palande ameya.pala...@nokia.com

This patch improves performance of flush_all operation by:

1. Instead of checking IVA state by reading a register, use
   pDevContext-dwBrdState variable.

2. Only call WakeDSP() when IVA is in OFF state.

Ported from:
http://gitorious.org/tidspbridge/mainline/commit/f0cc4ab4e4c40043a423f178a970ad9c8ab8fa06

Signed-off-by: Ameya Palande ameya.pala...@nokia.com
[ orl: ported ]
Signed-off-by: Omar Ramirez Luna omar.rami...@ti.com
---
 drivers/dsp/bridge/wmd/tiomap3430.c |   18 --
 1 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/dsp/bridge/wmd/tiomap3430.c 
b/drivers/dsp/bridge/wmd/tiomap3430.c
index b7447e1..7138396 100644
--- a/drivers/dsp/bridge/wmd/tiomap3430.c
+++ b/drivers/dsp/bridge/wmd/tiomap3430.c
@@ -275,21 +275,11 @@ static inline void tlb_flush_all(const void __iomem *base)
 
 static inline void flush_all(struct WMD_DEV_CONTEXT *pDevContext)
 {
-   struct CFG_HOSTRES resources;
-   u32 temp = 0;
-
-   CFG_GetHostResources((struct CFG_DEVNODE *)DRV_GetFirstDevExtension(),
-   resources);
-   HW_PWRST_IVA2RegGet(resources.dwPrmBase, temp);
-
-   if ((temp  HW_PWR_STATE_ON) == HW_PWR_STATE_OFF ||
-   (temp  HW_PWR_STATE_ON) == HW_PWR_STATE_RET) {
-   CLK_Enable(SERVICESCLK_iva2_ck);
+   if (pDevContext-dwBrdState == BRD_DSP_HIBERNATION ||
+   pDevContext-dwBrdState == BRD_HIBERNATION)
WakeDSP(pDevContext, NULL);
-   tlb_flush_all(pDevContext-dwDSPMmuBase);
-   CLK_Disable(SERVICESCLK_iva2_ck);
-   } else
-   tlb_flush_all(pDevContext-dwDSPMmuBase);
+
+   tlb_flush_all(pDevContext-dwDSPMmuBase);
 }
 
 static void bad_page_dump(u32 pa, struct page *pg)
-- 
1.6.2.4

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


CPU consumption is going as high as 95% on ARM Cortex A8

2009-12-16 Thread Hiremath, Vaibhav
Hi,

I am seeing some strange behavior while accessing buffers through User Space 
(mapped using mmap call)

Background :- 

Platform - TI AM3517
CPU - ARM Cortex A8

r...@am3517-evm:~#
r...@am3517-evm:~# cat /proc/cpuinfo
Processor   : ARMv7 Processor rev 7 (v7l)
BogoMIPS: 499.92
Features: swp half thumb fastmult vfp edsp neon vfpv3
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x1
CPU part: 0xc08
CPU revision: 7
Hardware: OMAP3517/AM3517 EVM
Revision: 0020
Serial  : 
r...@omap3517-evm:~#


Issue/Usage :- 
-
The V4l2-Capture driver captures the data from video decoder into buffer and 
the application does some processing on this buffer. The mmap implementation 
can be found at drivers/media/video/videobuf-dma-contig.c, 
function__videobuf_mmap_mapper().

Observation - 
The CPU consumption goes as high as 95% on read buffer operation, please note 
that write operation on these buffers also gives 60-70% CPU consumption. (Using 
memcpy/memset API's for read and write operation).

Some more inputs :- 
--
- If I specify PAGE_READONLY or PAGE_SHARED (actual flag is L_PTE_USER) while 
mapping the buffer to UserSpace in mmap system call, the CPU consumption goes 
down to expected value (20-27%). 
Then I reached till the function cpu_v7_set_pte_ext, where we are configuring 
level 2 translation table entries, which makes use of these flags.

- Below is the value of r0, r1 and r2 register (ptep, pteval, ext) in both the 
cases -


Without PAGE_READONLY/PAGE_SHARED

ptep - cfb5de10, pte - 8d200383, ext - 800
ptep - cfb5de14, pte - 8d201383, ext - 800

Important bits are [0-9] - 0x383

With PAGE_READONLY/PAGE_SHARED set

ptep - cfb30e10, pte - 8d10038f, ext - 800
ptep - cfb30e14, pte - 8d10138f, ext - 800

Important bits are [0-9] - 0x38F

The lines inside function cpu_v7_set_pte_ext, is using the flag as shown 
below -

   tst r1, #L_PTE_USER
   orrne   r3, r3, #PTE_EXT_AP1
   tstne   r3, #PTE_EXT_APX
   bicne   r3, r3, #PTE_EXT_APX | PTE_EXT_AP0

Without PAGE_READONLY/PAGE_SHARED   With flags set

Access perm = reserved  Access Perm = Read Only

- I tried the same thing with another platform (ARM9) and it works fine there.

Can somebody help me to understand the flag PAGE_SHARED/PAGE_READONLY and 
access permissions? Am I debugging this into right path? Does anybody have 
seen/observed similar issue before?


Thanks in advance.

Thanks,
Vaibhav Hiremath

--
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: CPU consumption is going as high as 95% on ARM Cortex A8

2009-12-16 Thread Shilimkar, Santosh

 -Original Message-
 From: linux-arm-kernel-boun...@lists.infradead.org [mailto:linux-arm-kernel-
 boun...@lists.infradead.org] On Behalf Of Hiremath, Vaibhav
 Sent: Thursday, December 17, 2009 11:09 AM
 To: li...@arm.linux.org.uk
 Cc: linux...@kvack.org; linux-omap@vger.kernel.org; 
 linux-arm-ker...@lists.infradead.org
 Subject: CPU consumption is going as high as 95% on ARM Cortex A8
 
 Hi,
 
 I am seeing some strange behavior while accessing buffers through User Space 
 (mapped using mmap call)
 
 Background :-
 
 Platform - TI AM3517
 CPU - ARM Cortex A8
 
 r...@am3517-evm:~#
 r...@am3517-evm:~# cat /proc/cpuinfo
 Processor   : ARMv7 Processor rev 7 (v7l)
 BogoMIPS: 499.92
 Features: swp half thumb fastmult vfp edsp neon vfpv3
 CPU implementer : 0x41
 CPU architecture: 7
 CPU variant : 0x1
 CPU part: 0xc08
 CPU revision: 7
 Hardware: OMAP3517/AM3517 EVM
 Revision: 0020
 Serial  : 
 r...@omap3517-evm:~#
 
 
 Issue/Usage :-
 -
 The V4l2-Capture driver captures the data from video decoder into buffer and 
 the application does
 some processing on this buffer. The mmap implementation can be found at 
 drivers/media/video/videobuf-
 dma-contig.c, function__videobuf_mmap_mapper().
 
 Observation -
 The CPU consumption goes as high as 95% on read buffer operation, please note 
 that write operation on
 these buffers also gives 60-70% CPU consumption. (Using memcpy/memset API's 
 for read and write
 operation).
 
 Some more inputs :-
 --
 - If I specify PAGE_READONLY or PAGE_SHARED (actual flag is L_PTE_USER) while 
 mapping the buffer to
 UserSpace in mmap system call, the CPU consumption goes down to expected 
 value (20-27%).
 Then I reached till the function cpu_v7_set_pte_ext, where we are configuring 
 level 2 translation
 table entries, which makes use of these flags.
 
 - Below is the value of r0, r1 and r2 register (ptep, pteval, ext) in both 
 the cases -
 
 
 Without PAGE_READONLY/PAGE_SHARED
 
 ptep - cfb5de10, pte - 8d200383, ext - 800
 ptep - cfb5de14, pte - 8d201383, ext - 800

Which kernel version is this? Can you please also give values of PRRR, NMRR and 
SCTLR 
--
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] OMAP: McBSP: Fix possible port lockout

2009-12-16 Thread Jarkko Nikula
On Wed, 16 Dec 2009 17:16:28 +0100
Janusz Krzysztofik jkrzy...@tis.icnet.pl wrote:

 More and more looking at this, I think that omap_mcbsp_request() should be 
 cleaned up frist in respect of freeing resources on error before we put any 
 new functionality there.
 
Good idea.

 I'm not sure if it is really required to revert any  
 mcbsp-pdata-ops-request() or omap34xx_mcbsp_request() applied changes by 
 calling mcbsp-pdata-ops-free() or omap34xx_mcbsp_free() from here.
 
It is allways worth/must to keep request and free calls in balance as
your patch does. In this case some clocks may left running
(omap1_mcbsp_request/_free) or wakeup behavior (34xx) otherwise.

Acked-by: Jarkko Nikula jhnik...@gmail.com
--
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