Re: timing in driver function

2011-08-01 Thread C.A, Subramaniam
On Mon, Aug 1, 2011 at 10:34 AM, Gadiyar, Anand gadi...@ti.com wrote:
 Michael Jones wrote:
 I have a function in a driver which takes ~50ms to execute, which I've
 measured by reading jiffies at the beginning and end. But jiffies only
 counts at 128Hz on my system, so this was a very coarse measurement. Now
 I would like to find out more exactly where the time is going inside
 this function. So my basic question is, what is the best way to measure
 lapsed time with reasonable resolution on an OMAP?

 As I had done with the jiffies measurement, what I imagined was
 inserting lines into my function, sampling the value of some counter at
 various points within it. This approach is crude but simple and would
 suffice for my case.

 Since it must be a very common task, I thought I'd ask here what the
 recommended approach is. I see a few directions...

 1. Using the OMAP's 32kHz timer, which is provided as a struct
 clocksource. It seems like what I would want is to call
 clocksource_32k.read(), but I don't know how to retrieve clocksource_32k.


 If you're looking for a one-off profiling, then as a hack, you could
 export a function that unconditionally returns the value of the 32kHz
 timer's count register (32KSYNCNT_CR) and use that for profiling.

How about using GPT using dm-timer APIs?
 - Anand
 --
 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




-- 

Thank you and Regards
Subbu
--
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]omap: i2c: Avoid compilation error in case the header is included multiple times

2010-08-24 Thread C.A, Subramaniam
From e3c3ee9317850b2b26e02680a0c976d3c75febab Mon Sep 17 00:00:00 2001
From: Subramaniam C.A subramaniam...@ti.com
Date: Tue, 24 Aug 2010 12:02:28 -0500
Subject: [PATCH] omap: i2c: Avoid compilation error in case the header is 
included multiple times.

Added defines to avoid compilation error.

Signed-off-by: Subramaniam C.A subramaniam...@ti.com
---
 arch/arm/plat-omap/include/plat/i2c.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/i2c.h 
b/arch/arm/plat-omap/include/plat/i2c.h
index 9e085f1..5d67273 100644
--- a/arch/arm/plat-omap/include/plat/i2c.h
+++ b/arch/arm/plat-omap/include/plat/i2c.h
@@ -18,6 +18,8 @@
  * 02110-1301 USA
  *
  */
+#ifndef __ASM__ARCH_OMAP_I2C_H
+#define __ASM__ARCH_OMAP_I2C_H

 #include linux/i2c.h

@@ -57,3 +59,5 @@ struct omap_i2c_dev_attr {

 void __init omap1_i2c_mux_pins(int bus_id);
 void __init omap2_i2c_mux_pins(int bus_id);
+
+#endif /* __ASM__ARCH_OMAP_I2C_H */
--
1.7.0.4

BR
Subbu
--
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: i2c: Avoid compilation error in case the header is included multiple times

2010-08-24 Thread C.A, Subramaniam
Hi Felipe,

 -Original Message-
 From: Felipe Balbi [mailto:felipe.ba...@nokia.com] 
 Sent: Tuesday, August 24, 2010 1:49 PM
 To: C.A, Subramaniam
 Cc: linux-omap@vger.kernel.org; Gadiyar, Anand; t...@atomide.com
 Subject: Re: [PATCH]omap: i2c: Avoid compilation error in 
 case the header is included multiple times
 
 On Tue, Aug 24, 2010 at 07:14:30PM +0200, ext C.A, Subramaniam wrote:
 From e3c3ee9317850b2b26e02680a0c976d3c75febab Mon Sep 17 
 00:00:00 2001
 From: Subramaniam C.A subramaniam...@ti.com
 Date: Tue, 24 Aug 2010 12:02:28 -0500
 Subject: [PATCH] omap: i2c: Avoid compilation error in case 
 the header is included multiple times.
 
 Added defines to avoid compilation error.
 
 
 could you list one such case ?
This caused a compilation error for the OMAP4 tree, where the ipu_pm.c file was 
including plat/i2c.h and plat/omap-pm.h.
Ref: 
http://dev.omapzoom.org/?p=integration/kernel-omap4.git;a=blob;f=drivers/dsp/syslink/ipu_pm/ipu_pm.c;h=b1791d4e7f2113eed046d3785106360dbe1cfc86;hb=d67c37aaadb80a6209f07618302bb84e1c952e97

omap-pm.h indirectly includes plat/i2c.h and hence the compilation error.

Yes we could have removed the,

#include plat/i2c.h

from the ipu_pm.c file and avoided the compilation error, but it still made 
sense to have this patch.

 
 Signed-off-by: Subramaniam C.A subramaniam...@ti.com
 
 Acked-by: Felipe Balbi felipe.ba...@nokia.com
 
 --
 balbi
 
 DefectiveByDesign.org
 

BR
Subbu--
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/4] omap mailbox: remove mbox_configured scheme

2010-06-24 Thread C.A, Subramaniam

 -Original Message-
 From: linux-omap-ow...@vger.kernel.org 
 [mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of Ohad Ben-Cohen
 Sent: Thursday, June 24, 2010 3:23 PM
 To: Kanigeri, Hari
 Cc: linux-omap@vger.kernel.org; Hiroshi Doyu; Ramirez Luna, Omar
 Subject: Re: [PATCH 3/4] omap mailbox: remove mbox_configured scheme
 
 On Thu, Jun 24, 2010 at 6:10 PM, Kanigeri, Hari 
 h-kanige...@ti.com wrote:
  Ohad,
 
  mbox_configured is global and therefore does not support 
 concurrent 
  usage of multiple mailbox instances.
 
  -- Why do you say that it doesn't support concurrent usage 
 of multiple mailbox instances ? If you take example of OMAP4, 
 we have 2 mailbox instances, one talking to DSP and other to 
 Ducati and they should be supported concurrently.
 
 
 Interesting. was this actually tested and found working ?
 
I think by supporting multiple instances, what Hari meant was that, for DSP and 
Ducati 2 different struct omap_mbox * are returned. They still can maintain 
their own callback function 
(http://dev.omapzoom.org/?p=tisyslink/kernel-syslink.git;a=blob;f=arch/arm/mach-omap2/mailbox.c;h=a23c7edf1e84ab4fa51e56d0c2daf2922084751a;hb=438f7a6a3cced478eb121426201206f6205fbbdc#l327
 for Ducati
and

http://dev.omapzoom.org/?p=tisyslink/kernel-syslink.git;a=blob;f=arch/arm/mach-omap2/mailbox.c;h=a23c7edf1e84ab4fa51e56d0c2daf2922084751a;hb=438f7a6a3cced478eb121426201206f6205fbbdc#l334
 
for DSP).

The mbox_configured was a means to reference count for one instance of the 
struct omap_mbox * .
  
 AFAICT (I don't have OMAP4, this is just by looking at the 
 code) this doesn't work:
 mbox_configured will prevent omap2_mbox_startup from being 
 invoked more than once. This means that 
 omap2_mbox_enable_irq(mbox, IRQ_RX) will only be called once 
 too, which seems like a problem if you want to start 
 receiving RX interrupts from both mbox instances at the same time.
 
 To fix that I guess we should decouple the RX interrupt 
 enabling from the mbox startup function. I can write 
 something, but I'd need your help to test it on OMAP4 :)
 
 
  If you remove the mbox_configured variable, then the mailbox module 
  would shut down once the first instance calls the 
 omap_mbox_put function.
 
 Also interesting point.
 
 So you use mbox_configures as a reference counter to allow 
 concurrent multiple senders to the same mbox instance.
 
 I will update the previous patch (that introduced the 
 atomic_t reference counter) to reflect this use case, thanks!
 
 
  Thank you,
  Best regards,
  Hari
 
 --
 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
 


Thank you and Regards
Subbu--
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/4] omap mailbox: remove mbox_configured scheme

2010-06-24 Thread C.A, Subramaniam

 -Original Message-
 From: linux-omap-ow...@vger.kernel.org 
 [mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of C.A, 
 Subramaniam
 Sent: Thursday, June 24, 2010 4:36 PM
 To: Ohad Ben-Cohen; Kanigeri, Hari
 Cc: linux-omap@vger.kernel.org; Hiroshi Doyu; Ramirez Luna, Omar
 Subject: RE: [PATCH 3/4] omap mailbox: remove mbox_configured scheme
 
 
  -Original Message-
  From: linux-omap-ow...@vger.kernel.org 
  [mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of Ohad 
 Ben-Cohen
  Sent: Thursday, June 24, 2010 3:23 PM
  To: Kanigeri, Hari
  Cc: linux-omap@vger.kernel.org; Hiroshi Doyu; Ramirez Luna, Omar
  Subject: Re: [PATCH 3/4] omap mailbox: remove mbox_configured scheme
  
  On Thu, Jun 24, 2010 at 6:10 PM, Kanigeri, Hari 
 h-kanige...@ti.com 
  wrote:
   Ohad,
  
   mbox_configured is global and therefore does not support
  concurrent
   usage of multiple mailbox instances.
  
   -- Why do you say that it doesn't support concurrent usage
  of multiple mailbox instances ? If you take example of 
 OMAP4, we have 
  2 mailbox instances, one talking to DSP and other to Ducati 
 and they 
  should be supported concurrently.
  
  
  Interesting. was this actually tested and found working ?
  
 I think by supporting multiple instances, what Hari meant was 
 that, for DSP and Ducati 2 different struct omap_mbox * are 
 returned. They still can maintain their own callback function
 (http://dev.omapzoom.org/?p=tisyslink/kernel-syslink.git;a=blo
 b;f=arch/arm/mach-omap2/mailbox.c;h=a23c7edf1e84ab4fa51e56d0c2
 daf2922084751a;hb=438f7a6a3cced478eb121426201206f6205fbbdc#l32
 7 for Ducati and
 
 http://dev.omapzoom.org/?p=tisyslink/kernel-syslink.git;a=blob
 ;f=arch/arm/mach-omap2/mailbox.c;h=a23c7edf1e84ab4fa51e56d0c2d
 af2922084751a;hb=438f7a6a3cced478eb121426201206f6205fbbdc#l334
 for DSP).
 
 The mbox_configured was a means to reference count for one 
 instance of the struct omap_mbox * .
Sorry I that that back. Even though we maintain 2 strucutres, only the one that 
calls the request_irq() is honoured. Hence yes only one callback will be 
serviced (Thank to Ramesh for pointing that out). Chaining of callbacks is a 
good way to allow multiple clients to be notified.

   
  AFAICT (I don't have OMAP4, this is just by looking at the
  code) this doesn't work:
  mbox_configured will prevent omap2_mbox_startup from being invoked 
  more than once. This means that omap2_mbox_enable_irq(mbox, IRQ_RX) 
  will only be called once too, which seems like a problem if 
 you want 
  to start receiving RX interrupts from both mbox instances 
 at the same 
  time.
  
  To fix that I guess we should decouple the RX interrupt 
 enabling from 
  the mbox startup function. I can write something, but I'd need your 
  help to test it on OMAP4 :)
  
  
   If you remove the mbox_configured variable, then the 
 mailbox module 
   would shut down once the first instance calls the
  omap_mbox_put function.
  
  Also interesting point.
  
  So you use mbox_configures as a reference counter to allow 
 concurrent 
  multiple senders to the same mbox instance.
  
  I will update the previous patch (that introduced the atomic_t 
  reference counter) to reflect this use case, thanks!
  
  
   Thank you,
   Best regards,
   Hari
  
  --
  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
  
 
 
 Thank you and Regards
 Subbu--
 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
 

Thank you and Regards
Subbu--
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 v3 4/4] omap: mailbox: convert block api to kfifo

2010-06-14 Thread C.A, Subramaniam
Hi Ohad/Hiroshi,

Good to see the new mailbox requirements. While we are at it can we add some 
more :)?

* Make the mailbox as a generic driver. 
Meaning, users can request for a pair of mailbox rather than using a 
set of pre-defined ones. For eg: Instead of doing an omap_mbox_get(mailbox-1) 
we can have the user specify the mailbox pair that he needs ( omap_mbox_get(int 
tx_mbox, int rx_mbox) or similar API ). This also means that we remove the bulk 
of the data structures like omap2_mbox_1_priv and mbox_1_info and so on. 
Additional checks needs to be done so that consequtive requests to the driver 
does not re-configure the rx-tx pairs.

Rationale: 
The pre-configured structures does make sense in case of DSP Bridge, since it 
is the only user of mailbox. However, for Syslink for example, (or for any 
other IPC or user of mailbox) it would be good for the user of the mailbox to 
request the pair (or just tx/rx) from user/kernel side.

* Provide debug support for the mailboxes (relevant for OMAP4)
Since OMAP4 has support to read the RAW registers we might as well add 
an API for the user to read the status from RAW registers.

Please provide your feedback!


Thank you and Regards
Subbu
 

 -Original Message-
 From: linux-omap-ow...@vger.kernel.org 
 [mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of Hiroshi DOYU
 Sent: Monday, June 14, 2010 3:58 AM
 To: Guzman Lugo, Fernando; o...@wizery.com
 Cc: Chitriki Rudramuni, Deepak; Ramirez Luna, Omar; Kanigeri, 
 Hari; linux-omap@vger.kernel.org
 Subject: Re: [PATCH v3 4/4] omap: mailbox: convert block api to kfifo
 
 Hi Ohad,
 
 From: ext Ohad Ben-Cohen o...@wizery.com
 Subject: Re: [PATCH v3 4/4] omap: mailbox: convert block api to kfifo
 Date: Mon, 14 Jun 2010 01:52:16 +0200
 
  On Wed, Jun 9, 2010 at 12:07 AM, Hiroshi DOYU 
 hiroshi.d...@nokia.com wrote:
  diff --git a/arch/arm/plat-omap/mailbox.c 
 b/arch/arm/plat-omap/mailbox.c
  index 87e0cde..1b79b32 100644
  --- a/arch/arm/plat-omap/mailbox.c
  +++ b/arch/arm/plat-omap/mailbox.c
  @@ -188,7 +188,7 @@ static void __mbox_rx_interrupt(struct 
 omap_mbox *mbox)
         /* no more messages in the fifo. clear IRQ source. */
         ack_mbox_irq(mbox, IRQ_RX);
   nomem:
  -       queue_work(mboxd, mbox-rxq-work);
  +       mbox-callback(mbox);
   }
  
  I like this !
 
  It will allow us to easily plug in new IPC mechanisms in the future.
 
 Agree.
 
  (btw, if we do this, and also introduce 
 omap_mbox_msg_send_sync, do we
  still need a mailbox queuing mechanism at all ? :)
 
 I think that queuing(can be called as S/W fifo/buffer?) is basically
 necessary it can compensate the shortage of H/W fifo slots under high
 load or emergency case. It has only 4 slots. I guess that, DSP usually
 responds quickly and 4 H/W slots may be enough, but it might be
 safer/more robust to avoid the assumption which depends on other
 entity/DSP. From latecy perspective, s/w fifo + tasklet would be
 enough short.
 
 omap_mbox_msg_send_sync() can handle the case for a special message,
 like PM, which has to respond at the higher priority than the normal
 ones.
 
  Having said that, this is not going to solve the lockdep warning
  reported by Deepak - that was caused because of dspbridge's sending
  context (and not because of the receiving context). To 
 eliminate that
 
 Does dspbridge really need its own defered work for sending mailbox
 messages?
 
 For me, the problem here is the unneccesary duplication of tasklet, or
 can be said, the unnecessary use of tasklet for _sending_ mailbox
 messages in dspbridge.
 
 http://marc.info/?l=linux-omapm=127601655325416w=2
 
 I thought that bridge_msg_put()/bridge_msg_get() can use omap mbox
 APIs directly, with getting rid of its use of its own defered
 work/tasklet as pointed out in the above link. Fernando?
 
 For recieving, its defered work(tasklet) can be trigered directly in
 the above proposed callback, that callback can triger its own
 workqueue if necessary, then. I think that, for recieving, some PM
 command may has to be sent back immedieately inside of
 tasklet. omap_mbox_msg_send_sync() may handle this case.
 
 What do you think?
 
  issue, I prefer fixing dspbridge to use work queues rather 
 than using
  spin_lock_bh in omap_mbox_msg_send. Disabling system bottom halves
  just to send a mbox msg sounds unjustified (unless bridge 
 really needs
  to use tasklets instead of work queues, which I slightly 
 doubt). What
  do you think ?
 
 I think that workqueue is only necessary when it has to sleep,
 otherwise tasklet is prefered. For _sending_ a message inside of
 dspbridge, I haven't found any reasonable reason to use any defered
 work(softirq, tasklet, workqueue) so far.
 
  Speaking of mailbox I'd like to address some issues that 
 are code related:
  
  * Let's add mailbox API to set the callback pointer (it 
 feels wrong to
  let users directly manipulate the mbox structure).
  
  * We can also safely move the callback field to the main 

RE: [PATCH 8/10 v2] omap mailbox: OMAP4-Mailbox - Adds code changes to support OMAP4 mailbox.

2009-11-18 Thread C.A, Subramaniam
 

 -Original Message-
 From: Hiroshi DOYU [mailto:hiroshi.d...@nokia.com] 
 Sent: Wednesday, November 18, 2009 1:36 PM
 To: C.A, Subramaniam
 Cc: t...@atomide.com; linux-omap@vger.kernel.org; Kanigeri, 
 Hari; Gupta, Ramesh
 Subject: Re: [PATCH 8/10 v2] omap mailbox: OMAP4-Mailbox - 
 Adds code changes to support OMAP4 mailbox.
 
 From: ext C.A, Subramaniam subramaniam...@ti.com
 Subject: [PATCH 8/10 v2] omap mailbox: OMAP4-Mailbox - Adds 
 code changes to support OMAP4 mailbox.
 Date: Tue, 17 Nov 2009 15:51:14 +0100
 
  Hi Tony,
  Following is the version 2 of Patch 8/10 (removing all #fidefs)
  
  Regards
  Subbu
   
  From 775dde65217785f519efe2a202489a791460f861 Mon Sep 17 
 00:00:00 2001
  From: C A Subramaniam subramaniam...@ti.com
  Date: Fri, 13 Nov 2009 16:42:40 +0530
  Subject: [PATCH 8/10 v2] omap mailbox: OMAP4-Mailbox - Adds 
 code changes to support OMAP4 mailbox.
  
  This patch adds code changes in the mailbox driver module to add 
  support for OMAP4 mailbox.
  Removed #ifdef CONFIG_ARCH_OMAP4
  
  Signed-off-by: Hari Kanigeri h-kanige...@ti.com
  Signed-off-by: C A Subramaniam subramaniam...@ti.com
  Signed-off-by: Ramesh Gupta G grgu...@ti.com
  ---
   arch/arm/mach-omap2/mailbox.c |  140 
 ++---
   arch/arm/plat-omap/mailbox.c  |   25 ++--
   2 files changed, 136 insertions(+), 29 deletions(-)
  
  diff --git a/arch/arm/mach-omap2/mailbox.c 
  b/arch/arm/mach-omap2/mailbox.c index 5ba3aa6..d20550f 100644
  --- a/arch/arm/mach-omap2/mailbox.c
  +++ b/arch/arm/mach-omap2/mailbox.c
  @@ -18,6 +18,8 @@
   #include plat/mailbox.h
   #include mach/irqs.h
   
  +#define DRV_NAME omap2-mailbox
  +
   #define MAILBOX_REVISION   0x000
   #define MAILBOX_SYSCONFIG  0x010
   #define MAILBOX_SYSSTATUS  0x014
  @@ -27,8 +29,12 @@
   #define MAILBOX_IRQSTATUS(u)   (0x100 + 8 * (u))
   #define MAILBOX_IRQENABLE(u)   (0x104 + 8 * (u))
   
  -#define MAILBOX_IRQ_NEWMSG(u)  (1  (2 * (u)))
  -#define MAILBOX_IRQ_NOTFULL(u) (1  (2 * (u) + 1))
  +#define OMAP4_MAILBOX_IRQSTATUS(u) (0x104 + 10 * (u))
  +#define OMAP4_MAILBOX_IRQENABLE(u) (0x108 + 10 * (u))
  +#define OMAP4_MAILBOX_IRQENABLE_CLR(u) (0x10c + 10 * (u))
  +
  +#define MAILBOX_IRQ_NEWMSG(m)  (1  (2 * (m)))
  +#define MAILBOX_IRQ_NOTFULL(m) (1  (2 * (m) + 1))
   
   /* SYSCONFIG: register bit definition */
   #define AUTOIDLE   (1  0)
  @@ -39,7 +45,11 @@
   #define RESETDONE  (1  0)
   
   #define MBOX_REG_SIZE  0x120
  +
  +#define OMAP4_MBOX_REG_SIZE0x130
  +
   #define MBOX_NR_REGS   (MBOX_REG_SIZE 
 / sizeof(u32))
  +#define OMAP4_MBOX_NR_REGS (OMAP4_MBOX_REG_SIZE / 
 sizeof(u32))
 
 Doesn't this modification break other OMAP arch support?
 
 We need to support OMAP2/3/4 mailbox with this file.
 
   
   static void __iomem *mbox_base;
   
  @@ -56,7 +66,8 @@ struct omap_mbox2_priv {
  unsigned long irqstatus;
  u32 newmsg_bit;
  u32 notfull_bit;
  -   u32 ctx[MBOX_NR_REGS];
  +   u32 ctx[OMAP4_MBOX_REG_SIZE];

This reserves the array size to be max of both the values . However, while 
saving and restoring the context we decide on the size based on the arch

snip--

static void omap2_mbox_save_ctx(struct omap_mbox *mbox)
{
int i;
struct omap_mbox2_priv *p = mbox-priv;
int nr_regs;
if (cpu_is_omap44xx())
nr_regs = OMAP4_MBOX_NR_REGS;
else
nr_regs = MBOX_NR_REGS;
for (i = 0; i  nr_regs; i++) {
p-ctx[i] = mbox_read_reg(i * sizeof(u32));

dev_dbg(mbox-dev, %s: [%02x] %08x\n, __func__,
i, p-ctx[i]);
}
}

static void omap2_mbox_restore_ctx(struct omap_mbox *mbox)
{
int i;
struct omap_mbox2_priv *p = mbox-priv;
int nr_regs;
if (cpu_is_omap44xx())
nr_regs = OMAP4_MBOX_NR_REGS;
else
nr_regs = MBOX_NR_REGS;
for (i = 0; i  nr_regs; i++) {
mbox_write_reg(p-ctx[i], i * sizeof(u32));

dev_dbg(mbox-dev, %s: [%02x] %08x\n, __func__,
i, p-ctx[i]);
}
}
---snip--

Please provide your commnets on the same.

 
 Is this only valid for OMAP4?
 
 --
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 8/10 v2] omap mailbox: OMAP4-Mailbox - Adds code changes to support OMAP4 mailbox.

2009-11-18 Thread C.A, Subramaniam

 -Original Message-
 From: Hiroshi DOYU [mailto:hiroshi.d...@nokia.com] 
 Sent: Wednesday, November 18, 2009 2:01 PM
 To: C.A, Subramaniam
 Cc: t...@atomide.com; linux-omap@vger.kernel.org; Kanigeri, 
 Hari; Gupta, Ramesh
 Subject: Re: [PATCH 8/10 v2] omap mailbox: OMAP4-Mailbox - 
 Adds code changes to support OMAP4 mailbox.
 
 Hi Subb,
 
 From: ext C.A, Subramaniam subramaniam...@ti.com
 Subject: RE: [PATCH 8/10 v2] omap mailbox: OMAP4-Mailbox - 
 Adds code changes to support OMAP4 mailbox.
 Date: Wed, 18 Nov 2009 09:15:42 +0100
 
 [...]
 
 /* SYSCONFIG: register bit definition */
 #define AUTOIDLE   (1  0)
@@ -39,7 +45,11 @@
 #define RESETDONE  (1  0)
 
 #define MBOX_REG_SIZE  0x120
+
+#define OMAP4_MBOX_REG_SIZE0x130
+
 #define MBOX_NR_REGS   (MBOX_REG_SIZE 
   / sizeof(u32))
+#define OMAP4_MBOX_NR_REGS (OMAP4_MBOX_REG_SIZE / 
   sizeof(u32))
   
   Doesn't this modification break other OMAP arch support?
   
   We need to support OMAP2/3/4 mailbox with this file.
   
 
 static void __iomem *mbox_base;
 
@@ -56,7 +66,8 @@ struct omap_mbox2_priv {
unsigned long irqstatus;
u32 newmsg_bit;
u32 notfull_bit;
-   u32 ctx[MBOX_NR_REGS];
+   u32 ctx[OMAP4_MBOX_REG_SIZE];
  
  This reserves the array size to be max of both the values . 
 However,  
  while saving and restoring the context we decide on the 
 size based  on 
  the arch
 
 The max array reservation may work with other omap arch as 
 well, but at least, shoulnd't the above 
 ctx[OMAP4_MBOX_REG_SIZE] be ctx[OMAP4_MBOX_NR_REG]?
Hi Hiroshi,
Yes my bad. Thank you pointing that out.  
I will change and send the patch afresh.

 
 --
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 8/10 v3] omap mailbox: OMAP4-Mailbox - Adds code changes to support OMAP4 mailbox.

2009-11-18 Thread C.A, Subramaniam
Hi Tony,
Following is the version 3 of patch 8/10. It removes one typo in the v2 patch 
that I sent out earlier.
Request you to take this version of the patch.

Hiroshi,
Thank you for pointing out the error. Request you to please review the patch.

Regards
Subbu

From 989d89b561ca176ddba19b0fcb5df1c2bec90d6d Mon Sep 17 00:00:00 2001
From: C A Subramaniam subramaniam...@ti.com
Date: Fri, 13 Nov 2009 16:42:40 +0530
Subject: [PATCH 8/10 v3] omap mailbox: OMAP4-Mailbox - Adds code changes to 
support OMAP4 mailbox.

This patch adds code changes in the mailbox driver module to
add support for OMAP4 mailbox.
Removed #ifdefs for OMAP4

Signed-off-by: Hari Kanigeri h-kanige...@ti.com
Signed-off-by: C A Subramaniam subramaniam...@ti.com
Signed-off-by: Ramesh Gupta G grgu...@ti.com
Signed-off-by: Hiroshi DOYU hiroshi.d...@nokia.com
---
 arch/arm/mach-omap2/mailbox.c |  140 ++---
 arch/arm/plat-omap/mailbox.c  |   25 ++--
 2 files changed, 136 insertions(+), 29 deletions(-)

diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 5ba3aa6..281ab63 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -18,6 +18,8 @@
 #include plat/mailbox.h
 #include mach/irqs.h
 
+#define DRV_NAME omap2-mailbox
+
 #define MAILBOX_REVISION   0x000
 #define MAILBOX_SYSCONFIG  0x010
 #define MAILBOX_SYSSTATUS  0x014
@@ -27,8 +29,12 @@
 #define MAILBOX_IRQSTATUS(u)   (0x100 + 8 * (u))
 #define MAILBOX_IRQENABLE(u)   (0x104 + 8 * (u))
 
-#define MAILBOX_IRQ_NEWMSG(u)  (1  (2 * (u)))
-#define MAILBOX_IRQ_NOTFULL(u) (1  (2 * (u) + 1))
+#define OMAP4_MAILBOX_IRQSTATUS(u) (0x104 + 10 * (u))
+#define OMAP4_MAILBOX_IRQENABLE(u) (0x108 + 10 * (u))
+#define OMAP4_MAILBOX_IRQENABLE_CLR(u) (0x10c + 10 * (u))
+
+#define MAILBOX_IRQ_NEWMSG(m)  (1  (2 * (m)))
+#define MAILBOX_IRQ_NOTFULL(m) (1  (2 * (m) + 1))
 
 /* SYSCONFIG: register bit definition */
 #define AUTOIDLE   (1  0)
@@ -39,7 +45,11 @@
 #define RESETDONE  (1  0)
 
 #define MBOX_REG_SIZE  0x120
+
+#define OMAP4_MBOX_REG_SIZE0x130
+
 #define MBOX_NR_REGS   (MBOX_REG_SIZE / sizeof(u32))
+#define OMAP4_MBOX_NR_REGS (OMAP4_MBOX_REG_SIZE / sizeof(u32))
 
 static void __iomem *mbox_base;
 
@@ -56,7 +66,8 @@ struct omap_mbox2_priv {
unsigned long irqstatus;
u32 newmsg_bit;
u32 notfull_bit;
-   u32 ctx[MBOX_NR_REGS];
+   u32 ctx[OMAP4_MBOX_NR_REGS];
+   unsigned long irqdisable;
 };
 
 static struct clk *mbox_ick_handle;
@@ -82,8 +93,9 @@ static int omap2_mbox_startup(struct omap_mbox *mbox)
 
mbox_ick_handle = clk_get(NULL, mailboxes_ick);
if (IS_ERR(mbox_ick_handle)) {
-   pr_err(Can't get mailboxes_ick\n);
-   return -ENODEV;
+   printk(KERN_ERR Could not get mailboxes_ick: %d\n,
+   PTR_ERR(mbox_ick_handle));
+   return PTR_ERR(mbox_ick_handle);
}
clk_enable(mbox_ick_handle);
 
@@ -115,6 +127,7 @@ static void omap2_mbox_shutdown(struct omap_mbox *mbox)
 {
clk_disable(mbox_ick_handle);
clk_put(mbox_ick_handle);
+   mbox_ick_handle = NULL;
 }
 
 /* Mailbox FIFO handle functions */
@@ -143,7 +156,7 @@ static int omap2_mbox_fifo_full(struct omap_mbox *mbox)
 {
struct omap_mbox2_fifo *fifo =
((struct omap_mbox2_priv *)mbox-priv)-tx_fifo;
-   return (mbox_read_reg(fifo-fifo_stat));
+   return mbox_read_reg(fifo-fifo_stat);
 }
 
 /* Mailbox IRQ handle functions */
@@ -163,10 +176,9 @@ static void omap2_mbox_disable_irq(struct omap_mbox *mbox,
 {
struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox-priv;
u32 l, bit = (irq == IRQ_TX) ? p-notfull_bit : p-newmsg_bit;
-
-   l = mbox_read_reg(p-irqenable);
+   l = mbox_read_reg(p-irqdisable);
l = ~bit;
-   mbox_write_reg(l, p-irqenable);
+   mbox_write_reg(l, p-irqdisable);
 }
 
 static void omap2_mbox_ack_irq(struct omap_mbox *mbox,
@@ -189,15 +201,19 @@ static int omap2_mbox_is_irq(struct omap_mbox *mbox,
u32 enable = mbox_read_reg(p-irqenable);
u32 status = mbox_read_reg(p-irqstatus);
 
-   return (enable  status  bit);
+   return (int)(enable  status  bit);
 }
 
 static void omap2_mbox_save_ctx(struct omap_mbox *mbox)
 {
int i;
struct omap_mbox2_priv *p = mbox-priv;
-
-   for (i = 0; i  MBOX_NR_REGS; i++) {
+   int nr_regs;
+   if (cpu_is_omap44xx())
+   nr_regs = OMAP4_MBOX_NR_REGS;
+   else
+   nr_regs = MBOX_NR_REGS;
+   for (i = 0; i  nr_regs; i++) {
p-ctx[i] = mbox_read_reg(i * sizeof(u32));
 
dev_dbg(mbox-dev, %s: [%02x] %08x\n, __func__,
@@ -209,8 +225,12 @@ static void omap2_mbox_restore_ctx(struct omap_mbox *mbox)
 {
int i;
struct 

RE: [PATCH 7/10] omap mailbox: expose omap_mbox_enable()/disable_irq()

2009-11-17 Thread C.A, Subramaniam
 -Original Message-
 From: Tony Lindgren [mailto:t...@atomide.com] 
 Sent: Saturday, November 14, 2009 6:10 AM
 To: C.A, Subramaniam
 Cc: linux-omap@vger.kernel.org; Gupta, Ramesh; Kanigeri, 
 Hari; Hiroshi DOYU
 Subject: Re: [PATCH 7/10] omap mailbox: expose 
 omap_mbox_enable()/disable_irq()
 
 * C.A, Subramaniam subramaniam...@ti.com [091113 04:32]:
  From 177e2efb7384c03ac445b55e2e4ccf44e2160051 Mon Sep 17 
 00:00:00 2001
  From: C A Subramaniam subramaniam...@ti.com
  Date: Fri, 13 Nov 2009 15:04:57 +0530
  Subject: [PATCH 7/10] omap mailbox: expose 
  omap_mbox_enable()/disable_irq()
  
  Signed-off-by: Hiroshi DOYU hiroshi.d...@nokia.com
 
 Is this missing a Signed-off-by: C A Subramaniam 
 subramaniam...@ti.com, or should this be From: Hiroshi DOYU 
 hiroshi.d...@nokia.com?
 
Hi Tony,
The patch is given by Hiroshi. Since it was sent as part of the OMAP4
Mailbox patch series the From has C A Subramaniam subramaniam...@ti.com


 Regards,
 
 Tony
 
  ---
   arch/arm/plat-omap/include/plat/mailbox.h |   12 
   arch/arm/plat-omap/mailbox.c  |   12 ++--
   2 files changed, 14 insertions(+), 10 deletions(-)
  
  diff --git a/arch/arm/plat-omap/include/plat/mailbox.h 
  b/arch/arm/plat-omap/include/plat/mailbox.h
  index 8260a3f..bf06953 100644
  --- a/arch/arm/plat-omap/include/plat/mailbox.h
  +++ b/arch/arm/plat-omap/include/plat/mailbox.h
  @@ -92,4 +92,16 @@ static inline void 
 omap_mbox_restore_ctx(struct omap_mbox *mbox)
  mbox-ops-restore_ctx(mbox);
   }
   
  +static inline void omap_mbox_enable_irq(struct omap_mbox *mbox,
  +   omap_mbox_irq_t irq)
  +{
  +   mbox-ops-enable_irq(mbox, irq);
  +}
  +
  +static inline void omap_mbox_disable_irq(struct omap_mbox *mbox,
  +omap_mbox_irq_t irq)
  +{
  +   mbox-ops-disable_irq(mbox, irq);
  +}
  +
   #endif /* MAILBOX_H */
  diff --git a/arch/arm/plat-omap/mailbox.c 
  b/arch/arm/plat-omap/mailbox.c index eb76df2..d5377a3 100644
  --- a/arch/arm/plat-omap/mailbox.c
  +++ b/arch/arm/plat-omap/mailbox.c
  @@ -50,14 +50,6 @@ static inline int mbox_fifo_full(struct 
 omap_mbox 
  *mbox)  }
   
   /* Mailbox IRQ handle functions */
  -static inline void enable_mbox_irq(struct omap_mbox *mbox, 
  omap_mbox_irq_t irq) -{
  -   mbox-ops-enable_irq(mbox, irq);
  -}
  -static inline void disable_mbox_irq(struct omap_mbox *mbox, 
  omap_mbox_irq_t irq) -{
  -   mbox-ops-disable_irq(mbox, irq);
  -}
   static inline void ack_mbox_irq(struct omap_mbox *mbox, 
  omap_mbox_irq_t irq)  {
  if (mbox-ops-ack_irq)
  @@ -144,7 +136,7 @@ static void mbox_tx_work(struct 
 work_struct *work)
   
  ret = __mbox_msg_send(mbox, tx_data-msg);
  if (ret) {
  -   enable_mbox_irq(mbox, IRQ_TX);
  +   omap_mbox_enable_irq(mbox, IRQ_TX);
  spin_lock(q-queue_lock);
  blk_requeue_request(q, rq);
  spin_unlock(q-queue_lock);
  @@ -196,7 +188,7 @@ static void mbox_rxq_fn(struct request_queue *q)
   
   static void __mbox_tx_interrupt(struct omap_mbox *mbox)  {
  -   disable_mbox_irq(mbox, IRQ_TX);
  +   omap_mbox_disable_irq(mbox, IRQ_TX);
  ack_mbox_irq(mbox, IRQ_TX);
  schedule_work(mbox-txq-work);
   }
  --
  1.5.3.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 8/10] omap mailbox: OMAP4-Mailbox - Adds code changes to support OMAP4 mailbox

2009-11-17 Thread C.A, Subramaniam
 

 -Original Message-
 From: Tony Lindgren [mailto:t...@atomide.com] 
 Sent: Saturday, November 14, 2009 6:16 AM
 To: C.A, Subramaniam
 Cc: linux-omap@vger.kernel.org; Gupta, Ramesh; Kanigeri, 
 Hari; Hiroshi DOYU
 Subject: Re: [PATCH 8/10] omap mailbox: OMAP4-Mailbox - Adds 
 code changes to support OMAP4 mailbox
 
 Hi,
 
 Just noticed all the iffdef else stuff here, that should be 
 easy to remove.
 
Hi Tony,
I will send a revised patch for this as 8/10 v2.

 * C.A, Subramaniam subramaniam...@ti.com [091113 04:33]:
  From 1a5865e67ce5fae94ae283882411cd01f48e07a7 Mon Sep 17 
 00:00:00 2001
  From: C A Subramaniam subramaniam...@ti.com
  Date: Fri, 13 Nov 2009 16:42:40 +0530
  Subject: [PATCH 8/10] omap mailbox: OMAP4-Mailbox - Adds 
 code changes to support OMAP4 mailbox.
  
  This patch adds code changes in the mailbox driver module to add 
  support for OMAP4 mailbox.
  
  Signed-off-by: Hari Kanigeri h-kanige...@ti.com
  Signed-off-by: C A Subramaniam subramaniam...@ti.com
  Signed-off-by: Ramesh Gupta G grgu...@ti.com
  ---
   arch/arm/mach-omap2/mailbox.c |  118 
 +++--
   arch/arm/plat-omap/mailbox.c  |   25 +++--
   2 files changed, 122 insertions(+), 21 deletions(-)
  
  diff --git a/arch/arm/mach-omap2/mailbox.c 
  b/arch/arm/mach-omap2/mailbox.c index 5ba3aa6..3b21a5d 100644
  --- a/arch/arm/mach-omap2/mailbox.c
  +++ b/arch/arm/mach-omap2/mailbox.c
  @@ -18,17 +18,26 @@
   #include plat/mailbox.h
   #include mach/irqs.h
   
  +#define DRV_NAME omap2-mailbox
  +
   #define MAILBOX_REVISION   0x000
   #define MAILBOX_SYSCONFIG  0x010
   #define MAILBOX_SYSSTATUS  0x014
   #define MAILBOX_MESSAGE(m) (0x040 + 4 * (m))
   #define MAILBOX_FIFOSTATUS(m)  (0x080 + 4 * (m))
   #define MAILBOX_MSGSTATUS(m)   (0x0c0 + 4 * (m))
  +
  +#ifdef CONFIG_ARCH_OMAP4
  +#define MAILBOX_IRQSTATUS(u)   (0x104 + 10 * (u))
  +#define MAILBOX_IRQENABLE(u)   (0x108 + 10 * (u))
  +#define MAILBOX_IRQENABLE_CLR(u)   (0x10c + 10 * (u))
  +#else
   #define MAILBOX_IRQSTATUS(u)   (0x100 + 8 * (u))
   #define MAILBOX_IRQENABLE(u)   (0x104 + 8 * (u))
  +#endif
 
 How about just have separate defines for OMAP4:
 
 #define OMAP4_MAILBOX_IRQSTATUS(u) (0x104 + 10 * (u))
 #define OMAP4_MAILBOX_IRQENABLE(u) (0x108 + 10 * (u))
 #define OMAP4_MAILBOX_IRQENABLE_CLR(u) (0x10c + 10 * (u))
 
 
  -#define MAILBOX_IRQ_NEWMSG(u)  (1  (2 * (u)))
  -#define MAILBOX_IRQ_NOTFULL(u) (1  (2 * (u) + 1))
  +#define MAILBOX_IRQ_NEWMSG(m)  (1  (2 * (m)))
  +#define MAILBOX_IRQ_NOTFULL(m) (1  (2 * (m) + 1))
   
   /* SYSCONFIG: register bit definition */
   #define AUTOIDLE   (1  0)
  @@ -38,7 +47,12 @@
   /* SYSSTATUS: register bit definition */
   #define RESETDONE  (1  0)
   
  +#ifdef CONFIG_ARCH_OMAP4
  +#define MBOX_REG_SIZE  0x130
  +#else
   #define MBOX_REG_SIZE  0x120
  +#endif
  +
 
 #define OMAP4_MBOX_REG_SIZE   0x130
 
 
   #define MBOX_NR_REGS   (MBOX_REG_SIZE 
 / sizeof(u32))
   
   static void __iomem *mbox_base;
  @@ -57,6 +71,9 @@ struct omap_mbox2_priv {
  u32 newmsg_bit;
  u32 notfull_bit;
  u32 ctx[MBOX_NR_REGS];
  +#ifdef CONFIG_ARCH_OMAP4
  +   unsigned long irqdisable;
  +#endif
   };
   
   static struct clk *mbox_ick_handle;
  @@ -82,8 +99,9 @@ static int omap2_mbox_startup(struct omap_mbox 
  *mbox)
   
  mbox_ick_handle = clk_get(NULL, mailboxes_ick);
  if (IS_ERR(mbox_ick_handle)) {
  -   pr_err(Can't get mailboxes_ick\n);
  -   return -ENODEV;
  +   printk(KERN_ERR Could not get mailboxes_ick: %d\n,
  +   PTR_ERR(mbox_ick_handle));
  +   return PTR_ERR(mbox_ick_handle);
  }
  clk_enable(mbox_ick_handle);
   
  @@ -115,6 +133,7 @@ static void omap2_mbox_shutdown(struct 
 omap_mbox 
  *mbox)  {
  clk_disable(mbox_ick_handle);
  clk_put(mbox_ick_handle);
  +   mbox_ick_handle = NULL;
   }
   
   /* Mailbox FIFO handle functions */
  @@ -143,7 +162,7 @@ static int omap2_mbox_fifo_full(struct 
 omap_mbox 
  *mbox)  {
  struct omap_mbox2_fifo *fifo =
  ((struct omap_mbox2_priv *)mbox-priv)-tx_fifo;
  -   return (mbox_read_reg(fifo-fifo_stat));
  +   return mbox_read_reg(fifo-fifo_stat);
   }
   
   /* Mailbox IRQ handle functions */
  @@ -163,10 +182,9 @@ static void omap2_mbox_disable_irq(struct 
  omap_mbox *mbox,  {
  struct omap_mbox2_priv *p = (struct omap_mbox2_priv 
 *)mbox-priv;
  u32 l, bit = (irq == IRQ_TX) ? p-notfull_bit : p-newmsg_bit;
  -
  -   l = mbox_read_reg(p-irqenable);
  +   l = mbox_read_reg(p-irqdisable);
  l = ~bit;
  -   mbox_write_reg(l, p-irqenable);
  +   mbox_write_reg(l, p-irqdisable);
   }
   
   static void omap2_mbox_ack_irq(struct omap_mbox *mbox, @@ -189,7 
  +207,7 @@ static int

[PATCH 8/10 v2] omap mailbox: OMAP4-Mailbox - Adds code changes to support OMAP4 mailbox.

2009-11-17 Thread C.A, Subramaniam
Hi Tony,
Following is the version 2 of Patch 8/10 (removing all #fidefs)

Regards
Subbu
 
From 775dde65217785f519efe2a202489a791460f861 Mon Sep 17 00:00:00 2001
From: C A Subramaniam subramaniam...@ti.com
Date: Fri, 13 Nov 2009 16:42:40 +0530
Subject: [PATCH 8/10 v2] omap mailbox: OMAP4-Mailbox - Adds code changes to 
support OMAP4 mailbox.

This patch adds code changes in the mailbox driver module to
add support for OMAP4 mailbox.
Removed #ifdef CONFIG_ARCH_OMAP4

Signed-off-by: Hari Kanigeri h-kanige...@ti.com
Signed-off-by: C A Subramaniam subramaniam...@ti.com
Signed-off-by: Ramesh Gupta G grgu...@ti.com
---
 arch/arm/mach-omap2/mailbox.c |  140 ++---
 arch/arm/plat-omap/mailbox.c  |   25 ++--
 2 files changed, 136 insertions(+), 29 deletions(-)

diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 5ba3aa6..d20550f 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -18,6 +18,8 @@
 #include plat/mailbox.h
 #include mach/irqs.h
 
+#define DRV_NAME omap2-mailbox
+
 #define MAILBOX_REVISION   0x000
 #define MAILBOX_SYSCONFIG  0x010
 #define MAILBOX_SYSSTATUS  0x014
@@ -27,8 +29,12 @@
 #define MAILBOX_IRQSTATUS(u)   (0x100 + 8 * (u))
 #define MAILBOX_IRQENABLE(u)   (0x104 + 8 * (u))
 
-#define MAILBOX_IRQ_NEWMSG(u)  (1  (2 * (u)))
-#define MAILBOX_IRQ_NOTFULL(u) (1  (2 * (u) + 1))
+#define OMAP4_MAILBOX_IRQSTATUS(u) (0x104 + 10 * (u))
+#define OMAP4_MAILBOX_IRQENABLE(u) (0x108 + 10 * (u))
+#define OMAP4_MAILBOX_IRQENABLE_CLR(u) (0x10c + 10 * (u))
+
+#define MAILBOX_IRQ_NEWMSG(m)  (1  (2 * (m)))
+#define MAILBOX_IRQ_NOTFULL(m) (1  (2 * (m) + 1))
 
 /* SYSCONFIG: register bit definition */
 #define AUTOIDLE   (1  0)
@@ -39,7 +45,11 @@
 #define RESETDONE  (1  0)
 
 #define MBOX_REG_SIZE  0x120
+
+#define OMAP4_MBOX_REG_SIZE0x130
+
 #define MBOX_NR_REGS   (MBOX_REG_SIZE / sizeof(u32))
+#define OMAP4_MBOX_NR_REGS (OMAP4_MBOX_REG_SIZE / sizeof(u32))
 
 static void __iomem *mbox_base;
 
@@ -56,7 +66,8 @@ struct omap_mbox2_priv {
unsigned long irqstatus;
u32 newmsg_bit;
u32 notfull_bit;
-   u32 ctx[MBOX_NR_REGS];
+   u32 ctx[OMAP4_MBOX_REG_SIZE];
+   unsigned long irqdisable;
 };
 
 static struct clk *mbox_ick_handle;
@@ -82,8 +93,9 @@ static int omap2_mbox_startup(struct omap_mbox *mbox)
 
mbox_ick_handle = clk_get(NULL, mailboxes_ick);
if (IS_ERR(mbox_ick_handle)) {
-   pr_err(Can't get mailboxes_ick\n);
-   return -ENODEV;
+   printk(KERN_ERR Could not get mailboxes_ick: %d\n,
+   PTR_ERR(mbox_ick_handle));
+   return PTR_ERR(mbox_ick_handle);
}
clk_enable(mbox_ick_handle);
 
@@ -115,6 +127,7 @@ static void omap2_mbox_shutdown(struct omap_mbox *mbox)
 {
clk_disable(mbox_ick_handle);
clk_put(mbox_ick_handle);
+   mbox_ick_handle = NULL;
 }
 
 /* Mailbox FIFO handle functions */
@@ -143,7 +156,7 @@ static int omap2_mbox_fifo_full(struct omap_mbox *mbox)
 {
struct omap_mbox2_fifo *fifo =
((struct omap_mbox2_priv *)mbox-priv)-tx_fifo;
-   return (mbox_read_reg(fifo-fifo_stat));
+   return mbox_read_reg(fifo-fifo_stat);
 }
 
 /* Mailbox IRQ handle functions */
@@ -163,10 +176,9 @@ static void omap2_mbox_disable_irq(struct omap_mbox *mbox,
 {
struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox-priv;
u32 l, bit = (irq == IRQ_TX) ? p-notfull_bit : p-newmsg_bit;
-
-   l = mbox_read_reg(p-irqenable);
+   l = mbox_read_reg(p-irqdisable);
l = ~bit;
-   mbox_write_reg(l, p-irqenable);
+   mbox_write_reg(l, p-irqdisable);
 }
 
 static void omap2_mbox_ack_irq(struct omap_mbox *mbox,
@@ -189,15 +201,19 @@ static int omap2_mbox_is_irq(struct omap_mbox *mbox,
u32 enable = mbox_read_reg(p-irqenable);
u32 status = mbox_read_reg(p-irqstatus);
 
-   return (enable  status  bit);
+   return (int)(enable  status  bit);
 }
 
 static void omap2_mbox_save_ctx(struct omap_mbox *mbox)
 {
int i;
struct omap_mbox2_priv *p = mbox-priv;
-
-   for (i = 0; i  MBOX_NR_REGS; i++) {
+   int nr_regs;
+   if (cpu_is_omap44xx())
+   nr_regs = OMAP4_MBOX_NR_REGS;
+   else
+   nr_regs = MBOX_NR_REGS;
+   for (i = 0; i  nr_regs; i++) {
p-ctx[i] = mbox_read_reg(i * sizeof(u32));
 
dev_dbg(mbox-dev, %s: [%02x] %08x\n, __func__,
@@ -209,8 +225,12 @@ static void omap2_mbox_restore_ctx(struct omap_mbox *mbox)
 {
int i;
struct omap_mbox2_priv *p = mbox-priv;
-
-   for (i = 0; i  MBOX_NR_REGS; i++) {
+   int nr_regs;
+   if (cpu_is_omap44xx())
+   nr_regs = OMAP4_MBOX_NR_REGS;
+   else
+   nr_regs = 

[PATCH 6/10] omap: mailbox: remove unnecessary arg for

2009-11-13 Thread C.A, Subramaniam
From 27c97972080ba1fea6296ee59105aebd5ea4442a Mon Sep 17 00:00:00 2001
From: C A Subramaniam subramaniam...@ti.com
Date: Thu, 12 Nov 2009 16:18:05 -0800
Subject: [PATCH 6/10] omap: mailbox: remove unnecessary arg for 
omap_mbox_msg_send

Also removed from tx_data

Signed-off-by: C A Subramaniam subramaniam...@ti.com
Acked-by: Hiroshi DOYU hiroshi.d...@nokia.com
Signed-off-by: Tony Lindgren t...@atomide.com
---
 arch/arm/plat-omap/include/plat/mailbox.h |2 +-
 arch/arm/plat-omap/mailbox.c  |4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/mailbox.h 
b/arch/arm/plat-omap/include/plat/mailbox.h
index 319306a..8260a3f 100644
--- a/arch/arm/plat-omap/include/plat/mailbox.h
+++ b/arch/arm/plat-omap/include/plat/mailbox.h
@@ -63,7 +63,7 @@ struct omap_mbox {
void(*err_notify)(void);
 };
 
-int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg, void *);
+int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg);
 void omap_mbox_init_seq(struct omap_mbox *);
 
 struct omap_mbox *omap_mbox_get(const char *);
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index b49bb29..99ecf80 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -88,7 +88,6 @@ static int __mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t 
msg)
 
 struct omap_msg_tx_data {
mbox_msg_t  msg;
-   void*arg;
 };
 
 static void omap_msg_tx_end_io(struct request *rq, int error)
@@ -97,7 +96,7 @@ static void omap_msg_tx_end_io(struct request *rq, int error)
__blk_put_request(rq-q, rq);
 }
 
-int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg, void* arg)
+int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg)
 {
struct omap_msg_tx_data *tx_data;
struct request *rq;
@@ -114,7 +113,6 @@ int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t 
msg, void* arg)
}
 
tx_data-msg = msg;
-   tx_data-arg = arg;
rq-end_io = omap_msg_tx_end_io;
blk_insert_request(q, rq, 0, tx_data);
 
-- 
1.5.3.2
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/10] omap mailbox: expose omap_mbox_enable()/disable_irq()

2009-11-13 Thread C.A, Subramaniam
From 177e2efb7384c03ac445b55e2e4ccf44e2160051 Mon Sep 17 00:00:00 2001
From: C A Subramaniam subramaniam...@ti.com
Date: Fri, 13 Nov 2009 15:04:57 +0530
Subject: [PATCH 7/10] omap mailbox: expose omap_mbox_enable()/disable_irq()

Signed-off-by: Hiroshi DOYU hiroshi.d...@nokia.com
---
 arch/arm/plat-omap/include/plat/mailbox.h |   12 
 arch/arm/plat-omap/mailbox.c  |   12 ++--
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/mailbox.h 
b/arch/arm/plat-omap/include/plat/mailbox.h
index 8260a3f..bf06953 100644
--- a/arch/arm/plat-omap/include/plat/mailbox.h
+++ b/arch/arm/plat-omap/include/plat/mailbox.h
@@ -92,4 +92,16 @@ static inline void omap_mbox_restore_ctx(struct omap_mbox 
*mbox)
mbox-ops-restore_ctx(mbox);
 }
 
+static inline void omap_mbox_enable_irq(struct omap_mbox *mbox,
+   omap_mbox_irq_t irq)
+{
+   mbox-ops-enable_irq(mbox, irq);
+}
+
+static inline void omap_mbox_disable_irq(struct omap_mbox *mbox,
+omap_mbox_irq_t irq)
+{
+   mbox-ops-disable_irq(mbox, irq);
+}
+
 #endif /* MAILBOX_H */
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index eb76df2..d5377a3 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -50,14 +50,6 @@ static inline int mbox_fifo_full(struct omap_mbox *mbox)
 }
 
 /* Mailbox IRQ handle functions */
-static inline void enable_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
-{
-   mbox-ops-enable_irq(mbox, irq);
-}
-static inline void disable_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t 
irq)
-{
-   mbox-ops-disable_irq(mbox, irq);
-}
 static inline void ack_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
 {
if (mbox-ops-ack_irq)
@@ -144,7 +136,7 @@ static void mbox_tx_work(struct work_struct *work)
 
ret = __mbox_msg_send(mbox, tx_data-msg);
if (ret) {
-   enable_mbox_irq(mbox, IRQ_TX);
+   omap_mbox_enable_irq(mbox, IRQ_TX);
spin_lock(q-queue_lock);
blk_requeue_request(q, rq);
spin_unlock(q-queue_lock);
@@ -196,7 +188,7 @@ static void mbox_rxq_fn(struct request_queue *q)
 
 static void __mbox_tx_interrupt(struct omap_mbox *mbox)
 {
-   disable_mbox_irq(mbox, IRQ_TX);
+   omap_mbox_disable_irq(mbox, IRQ_TX);
ack_mbox_irq(mbox, IRQ_TX);
schedule_work(mbox-txq-work);
 }
-- 
1.5.3.2
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/10] omap mailbox: OMAP4-Mailbox - Adds code changes to support OMAP4 mailbox

2009-11-13 Thread C.A, Subramaniam
From 1a5865e67ce5fae94ae283882411cd01f48e07a7 Mon Sep 17 00:00:00 2001
From: C A Subramaniam subramaniam...@ti.com
Date: Fri, 13 Nov 2009 16:42:40 +0530
Subject: [PATCH 8/10] omap mailbox: OMAP4-Mailbox - Adds code changes to 
support OMAP4 mailbox.

This patch adds code changes in the mailbox driver module to
add support for OMAP4 mailbox.

Signed-off-by: Hari Kanigeri h-kanige...@ti.com
Signed-off-by: C A Subramaniam subramaniam...@ti.com
Signed-off-by: Ramesh Gupta G grgu...@ti.com
---
 arch/arm/mach-omap2/mailbox.c |  118 +++--
 arch/arm/plat-omap/mailbox.c  |   25 +++--
 2 files changed, 122 insertions(+), 21 deletions(-)

diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 5ba3aa6..3b21a5d 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -18,17 +18,26 @@
 #include plat/mailbox.h
 #include mach/irqs.h
 
+#define DRV_NAME omap2-mailbox
+
 #define MAILBOX_REVISION   0x000
 #define MAILBOX_SYSCONFIG  0x010
 #define MAILBOX_SYSSTATUS  0x014
 #define MAILBOX_MESSAGE(m) (0x040 + 4 * (m))
 #define MAILBOX_FIFOSTATUS(m)  (0x080 + 4 * (m))
 #define MAILBOX_MSGSTATUS(m)   (0x0c0 + 4 * (m))
+
+#ifdef CONFIG_ARCH_OMAP4
+#define MAILBOX_IRQSTATUS(u)   (0x104 + 10 * (u))
+#define MAILBOX_IRQENABLE(u)   (0x108 + 10 * (u))
+#define MAILBOX_IRQENABLE_CLR(u)   (0x10c + 10 * (u))
+#else
 #define MAILBOX_IRQSTATUS(u)   (0x100 + 8 * (u))
 #define MAILBOX_IRQENABLE(u)   (0x104 + 8 * (u))
+#endif
 
-#define MAILBOX_IRQ_NEWMSG(u)  (1  (2 * (u)))
-#define MAILBOX_IRQ_NOTFULL(u) (1  (2 * (u) + 1))
+#define MAILBOX_IRQ_NEWMSG(m)  (1  (2 * (m)))
+#define MAILBOX_IRQ_NOTFULL(m) (1  (2 * (m) + 1))
 
 /* SYSCONFIG: register bit definition */
 #define AUTOIDLE   (1  0)
@@ -38,7 +47,12 @@
 /* SYSSTATUS: register bit definition */
 #define RESETDONE  (1  0)
 
+#ifdef CONFIG_ARCH_OMAP4
+#define MBOX_REG_SIZE  0x130
+#else
 #define MBOX_REG_SIZE  0x120
+#endif
+
 #define MBOX_NR_REGS   (MBOX_REG_SIZE / sizeof(u32))
 
 static void __iomem *mbox_base;
@@ -57,6 +71,9 @@ struct omap_mbox2_priv {
u32 newmsg_bit;
u32 notfull_bit;
u32 ctx[MBOX_NR_REGS];
+#ifdef CONFIG_ARCH_OMAP4
+   unsigned long irqdisable;
+#endif
 };
 
 static struct clk *mbox_ick_handle;
@@ -82,8 +99,9 @@ static int omap2_mbox_startup(struct omap_mbox *mbox)
 
mbox_ick_handle = clk_get(NULL, mailboxes_ick);
if (IS_ERR(mbox_ick_handle)) {
-   pr_err(Can't get mailboxes_ick\n);
-   return -ENODEV;
+   printk(KERN_ERR Could not get mailboxes_ick: %d\n,
+   PTR_ERR(mbox_ick_handle));
+   return PTR_ERR(mbox_ick_handle);
}
clk_enable(mbox_ick_handle);
 
@@ -115,6 +133,7 @@ static void omap2_mbox_shutdown(struct omap_mbox *mbox)
 {
clk_disable(mbox_ick_handle);
clk_put(mbox_ick_handle);
+   mbox_ick_handle = NULL;
 }
 
 /* Mailbox FIFO handle functions */
@@ -143,7 +162,7 @@ static int omap2_mbox_fifo_full(struct omap_mbox *mbox)
 {
struct omap_mbox2_fifo *fifo =
((struct omap_mbox2_priv *)mbox-priv)-tx_fifo;
-   return (mbox_read_reg(fifo-fifo_stat));
+   return mbox_read_reg(fifo-fifo_stat);
 }
 
 /* Mailbox IRQ handle functions */
@@ -163,10 +182,9 @@ static void omap2_mbox_disable_irq(struct omap_mbox *mbox,
 {
struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox-priv;
u32 l, bit = (irq == IRQ_TX) ? p-notfull_bit : p-newmsg_bit;
-
-   l = mbox_read_reg(p-irqenable);
+   l = mbox_read_reg(p-irqdisable);
l = ~bit;
-   mbox_write_reg(l, p-irqenable);
+   mbox_write_reg(l, p-irqdisable);
 }
 
 static void omap2_mbox_ack_irq(struct omap_mbox *mbox,
@@ -189,7 +207,7 @@ static int omap2_mbox_is_irq(struct omap_mbox *mbox,
u32 enable = mbox_read_reg(p-irqenable);
u32 status = mbox_read_reg(p-irqstatus);
 
-   return (enable  status  bit);
+   return (int)(enable  status  bit);
 }
 
 static void omap2_mbox_save_ctx(struct omap_mbox *mbox)
@@ -242,9 +260,12 @@ static struct omap_mbox_ops omap2_mbox_ops = {
  */
 
 /* FIXME: the following structs should be filled automatically by the user id 
*/
-
+#ifdef CONFIG_ARCH_OMAP4
+static struct omap_mbox2_priv omap2_mbox_1_priv = {
+#else
 /* DSP */
 static struct omap_mbox2_priv omap2_mbox_dsp_priv = {
+#endif
.tx_fifo = {
.msg= MAILBOX_MESSAGE(0),
.fifo_stat  = MAILBOX_FIFOSTATUS(0),
@@ -257,7 +278,19 @@ static struct omap_mbox2_priv omap2_mbox_dsp_priv = {
.irqstatus  = MAILBOX_IRQSTATUS(0),
.notfull_bit= MAILBOX_IRQ_NOTFULL(0),
.newmsg_bit = MAILBOX_IRQ_NEWMSG(1),
+#ifdef CONFIG_ARCH_OMAP4
+   .irqdisable = 

[PATCH 9/10] omap: mailbox: OMAP4 Mailbox Patch to change the IRQ

2009-11-13 Thread C.A, Subramaniam
From 8a1b63918459dfbb5152dd31988714f91f4fd51b Mon Sep 17 00:00:00 2001
From: C A Subramaniam subramaniam...@ti.com
Date: Thu, 12 Nov 2009 16:18:06 -0800
Subject: [PATCH 9/10] omap: mailbox: OMAP4 Mailbox Patch to change the IRQ flag 
from IRQF_DISABLED to IRQF_SHARED

Currently, this facilitates both the tesla and ducati
sides to request for the same irq through an
omap_mbox_get() call.

Signed-off-by: C A Subramaniam subramaniam...@ti.com
Signed-off-by: Ramesh Gupta G grgu...@ti.com
Acked-by: Hiroshi DOYU hiroshi.d...@nokia.com
Signed-off-by: Tony Lindgren t...@atomide.com
---
 arch/arm/plat-omap/mailbox.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 99ecf80..eb76df2 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -283,7 +283,7 @@ static int omap_mbox_startup(struct omap_mbox *mbox)
return ret;
}
 
-   ret = request_irq(mbox-irq, mbox_interrupt, IRQF_DISABLED,
+   ret = request_irq(mbox-irq, mbox_interrupt, IRQF_SHARED,
mbox-name, mbox);
if (unlikely(ret)) {
printk(KERN_ERR
-- 
1.5.3.2
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/10] omap mailbox: OMAP4 Mailbox-driver Patch to support tasklet implementation

2009-11-13 Thread C.A, Subramaniam
From 5fd7c2bfae11879edfcae7db073deb11bea1f584 Mon Sep 17 00:00:00 2001
From: C A Subramaniam subramaniam...@ti.com
Date: Fri, 13 Nov 2009 15:59:58 +0530
Subject: [PATCH 10/10] omap mailbox: OMAP4 Mailbox-driver Patch to support 
tasklet implementation

This patch uses a tasklet implementation for
sending mailbox messages.

Signed-off-by: C A Subramaniam subramaniam...@ti.com
Signed-off-by: Ramesh Gupta G grgu...@ti.com
Signed-off-by: Hiroshi DOYU hiroshi.d...@nokia.com
---
 arch/arm/plat-omap/include/plat/mailbox.h |8 +++-
 arch/arm/plat-omap/mailbox.c  |   59 
 2 files changed, 23 insertions(+), 44 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/mailbox.h 
b/arch/arm/plat-omap/include/plat/mailbox.h
index bf06953..729166b 100644
--- a/arch/arm/plat-omap/include/plat/mailbox.h
+++ b/arch/arm/plat-omap/include/plat/mailbox.h
@@ -6,6 +6,7 @@
 #include linux/wait.h
 #include linux/workqueue.h
 #include linux/blkdev.h
+#include linux/interrupt.h
 
 typedef u32 mbox_msg_t;
 struct omap_mbox;
@@ -28,8 +29,10 @@ struct omap_mbox_ops {
int (*fifo_empty)(struct omap_mbox *mbox);
int (*fifo_full)(struct omap_mbox *mbox);
/* irq */
-   void(*enable_irq)(struct omap_mbox *mbox, omap_mbox_irq_t 
irq);
-   void(*disable_irq)(struct omap_mbox *mbox, omap_mbox_irq_t 
irq);
+   void(*enable_irq)(struct omap_mbox *mbox,
+   omap_mbox_irq_t irq);
+   void(*disable_irq)(struct omap_mbox *mbox,
+   omap_mbox_irq_t irq);
void(*ack_irq)(struct omap_mbox *mbox, omap_mbox_irq_t irq);
int (*is_irq)(struct omap_mbox *mbox, omap_mbox_irq_t irq);
/* ctx */
@@ -41,6 +44,7 @@ struct omap_mbox_queue {
spinlock_t  lock;
struct request_queue*queue;
struct work_struct  work;
+   struct tasklet_struct   tasklet;
int (*callback)(void *);
struct omap_mbox*mbox;
 };
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 4d7947e..8e90633 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -80,74 +80,45 @@ static int __mbox_msg_send(struct omap_mbox *mbox, 
mbox_msg_t msg)
return ret;
 }
 
-struct omap_msg_tx_data {
-   mbox_msg_t  msg;
-};
-
-static void omap_msg_tx_end_io(struct request *rq, int error)
-{
-   kfree(rq-special);
-   __blk_put_request(rq-q, rq);
-}
 
 int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg)
 {
-   struct omap_msg_tx_data *tx_data;
+
struct request *rq;
struct request_queue *q = mbox-txq-queue;
 
-   tx_data = kmalloc(sizeof(*tx_data), GFP_ATOMIC);
-   if (unlikely(!tx_data))
-   return -ENOMEM;
-
rq = blk_get_request(q, WRITE, GFP_ATOMIC);
-   if (unlikely(!rq)) {
-   kfree(tx_data);
+   if (unlikely(!rq))
return -ENOMEM;
-   }
 
-   tx_data-msg = msg;
-   rq-end_io = omap_msg_tx_end_io;
-   blk_insert_request(q, rq, 0, tx_data);
+   blk_insert_request(q, rq, 0, (void *) msg);
+   tasklet_schedule(mbox-txq-tasklet);
 
-   schedule_work(mbox-txq-work);
return 0;
 }
 EXPORT_SYMBOL(omap_mbox_msg_send);
 
-static void mbox_tx_work(struct work_struct *work)
+static void mbox_tx_tasklet(unsigned long tx_data)
 {
int ret;
struct request *rq;
-   struct omap_mbox_queue *mq = container_of(work,
-   struct omap_mbox_queue, work);
-   struct omap_mbox *mbox = mq-queue-queuedata;
+   struct omap_mbox *mbox = (struct omap_mbox *)tx_data;
struct request_queue *q = mbox-txq-queue;
 
while (1) {
-   struct omap_msg_tx_data *tx_data;
 
-   spin_lock(q-queue_lock);
rq = blk_fetch_request(q);
-   spin_unlock(q-queue_lock);
 
if (!rq)
break;
 
-   tx_data = rq-special;
-
-   ret = __mbox_msg_send(mbox, tx_data-msg);
+   ret = __mbox_msg_send(mbox, (mbox_msg_t)rq-special);
if (ret) {
omap_mbox_enable_irq(mbox, IRQ_TX);
-   spin_lock(q-queue_lock);
blk_requeue_request(q, rq);
-   spin_unlock(q-queue_lock);
return;
}
-
-   spin_lock(q-queue_lock);
-   __blk_end_request_all(rq, 0);
-   spin_unlock(q-queue_lock);
+   blk_end_request_all(rq, 0);
}
 }
 
@@ -192,7 +163,7 @@ static void __mbox_tx_interrupt(struct omap_mbox *mbox)
 {
omap_mbox_disable_irq(mbox, IRQ_TX);
ack_mbox_irq(mbox, IRQ_TX);
-   schedule_work(mbox-txq-work);
+   

[PATCH 5/10] omap: mailbox: remove disable_/enable_mbox_irq in isr

2009-11-13 Thread C.A, Subramaniam
From 977b46afb3d52422d486458c6c7889c9ce906b3d Mon Sep 17 00:00:00 2001
From: Hiroshi DOYU hiroshi.d...@nokia.com
Date: Thu, 12 Nov 2009 16:18:05 -0800
Subject: [PATCH 5/10] omap: mailbox: remove disable_/enable_mbox_irq in isr

No need to handle it in isr, since irq won't happen during isr.

Signed-off-by: Hiroshi DOYU hiroshi.d...@nokia.com
Signed-off-by: Tony Lindgren t...@atomide.com
---
 arch/arm/plat-omap/mailbox.c |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 13ca236..b49bb29 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -209,8 +209,6 @@ static void __mbox_rx_interrupt(struct omap_mbox *mbox)
mbox_msg_t msg;
struct request_queue *q = mbox-rxq-queue;
 
-   disable_mbox_irq(mbox, IRQ_RX);
-
while (!mbox_fifo_empty(mbox)) {
rq = blk_get_request(q, WRITE, GFP_ATOMIC);
if (unlikely(!rq))
@@ -226,7 +224,6 @@ static void __mbox_rx_interrupt(struct omap_mbox *mbox)
 
/* no more messages in the fifo. clear IRQ source. */
ack_mbox_irq(mbox, IRQ_RX);
-   enable_mbox_irq(mbox, IRQ_RX);
 nomem:
schedule_work(mbox-rxq-work);
 }
-- 
1.5.3.2
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/10] omap: mailbox: remove class interface

2009-11-13 Thread C.A, Subramaniam
From fcd239d499ab89a13e186d5ec5e2d0dde7d21e9e Mon Sep 17 00:00:00 2001
From: Hiroshi DOYU hiroshi.d...@nokia.com
Date: Thu, 12 Nov 2009 16:18:05 -0800
Subject: [PATCH 4/10] omap: mailbox: remove class interface

It's not used at present.

Signed-off-by: Hiroshi DOYU hiroshi.d...@nokia.com
Signed-off-by: Tony Lindgren t...@atomide.com
---
 arch/arm/plat-omap/include/plat/mailbox.h |1 -
 arch/arm/plat-omap/mailbox.c  |  115 ++--
 2 files changed, 9 insertions(+), 107 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/mailbox.h 
b/arch/arm/plat-omap/include/plat/mailbox.h
index b7a6991..319306a 100644
--- a/arch/arm/plat-omap/include/plat/mailbox.h
+++ b/arch/arm/plat-omap/include/plat/mailbox.h
@@ -8,7 +8,6 @@
 #include linux/blkdev.h
 
 typedef u32 mbox_msg_t;
-typedef void (mbox_receiver_t)(mbox_msg_t msg);
 struct omap_mbox;
 
 typedef int __bitwise omap_mbox_irq_t;
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index f82810e..13ca236 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -71,7 +71,7 @@ static inline int is_mbox_irq(struct omap_mbox *mbox, 
omap_mbox_irq_t irq)
 /*
  * message sender
  */
-static int __mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg, void *arg)
+static int __mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg)
 {
int ret = 0, i = 1000;
 
@@ -82,15 +82,7 @@ static int __mbox_msg_send(struct omap_mbox *mbox, 
mbox_msg_t msg, void *arg)
return -1;
udelay(1);
}
-
-   if (arg  mbox-txq-callback) {
-   ret = mbox-txq-callback(arg);
-   if (ret)
-   goto out;
-   }
-
mbox_fifo_write(mbox, msg);
- out:
return ret;
 }
 
@@ -152,7 +144,7 @@ static void mbox_tx_work(struct work_struct *work)
 
tx_data = rq-special;
 
-   ret = __mbox_msg_send(mbox, tx_data-msg, tx_data-arg);
+   ret = __mbox_msg_send(mbox, tx_data-msg);
if (ret) {
enable_mbox_irq(mbox, IRQ_TX);
spin_lock(q-queue_lock);
@@ -180,11 +172,6 @@ static void mbox_rx_work(struct work_struct *work)
mbox_msg_t msg;
unsigned long flags;
 
-   if (mbox-rxq-callback == NULL) {
-   sysfs_notify(mbox-dev-kobj, NULL, mbox);
-   return;
-   }
-
while (1) {
spin_lock_irqsave(q-queue_lock, flags);
rq = blk_fetch_request(q);
@@ -257,69 +244,6 @@ static irqreturn_t mbox_interrupt(int irq, void *p)
return IRQ_HANDLED;
 }
 
-/*
- * sysfs files
- */
-static ssize_t
-omap_mbox_write(struct device *dev, struct device_attribute *attr,
-   const char *buf, size_t count)
-{
-   int ret;
-   mbox_msg_t *p = (mbox_msg_t *)buf;
-   struct omap_mbox *mbox = dev_get_drvdata(dev);
-
-   for (; count = sizeof(mbox_msg_t); count -= sizeof(mbox_msg_t)) {
-   ret = omap_mbox_msg_send(mbox, be32_to_cpu(*p), NULL);
-   if (ret)
-   return -EAGAIN;
-   p++;
-   }
-
-   return (size_t)((char *)p - buf);
-}
-
-static ssize_t
-omap_mbox_read(struct device *dev, struct device_attribute *attr, char *buf)
-{
-   unsigned long flags;
-   struct request *rq;
-   mbox_msg_t *p = (mbox_msg_t *) buf;
-   struct omap_mbox *mbox = dev_get_drvdata(dev);
-   struct request_queue *q = mbox-rxq-queue;
-
-   while (1) {
-   spin_lock_irqsave(q-queue_lock, flags);
-   rq = blk_fetch_request(q);
-   spin_unlock_irqrestore(q-queue_lock, flags);
-
-   if (!rq)
-   break;
-
-   *p = (mbox_msg_t)rq-special;
-
-   blk_end_request_all(rq, 0);
-
-   p++;
-   }
-
-   pr_debug(%02x %02x %02x %02x\n, buf[0], buf[1], buf[2], buf[3]);
-
-   return (size_t) ((char *)p - buf);
-}
-
-static DEVICE_ATTR(mbox, S_IRUGO | S_IWUSR, omap_mbox_read, omap_mbox_write);
-
-static ssize_t mbox_show(struct class *class, char *buf)
-{
-   return sprintf(buf, mbox);
-}
-
-static CLASS_ATTR(mbox, S_IRUGO, mbox_show, NULL);
-
-static struct class omap_mbox_class = {
-   .name = omap-mailbox,
-};
-
 static struct omap_mbox_queue *mbox_queue_alloc(struct omap_mbox *mbox,
request_fn_proc *proc,
void (*work) (struct work_struct *))
@@ -353,7 +277,7 @@ static void mbox_queue_free(struct omap_mbox_queue *q)
kfree(q);
 }
 
-static int omap_mbox_init(struct omap_mbox *mbox)
+static int omap_mbox_startup(struct omap_mbox *mbox)
 {
int ret;
struct omap_mbox_queue *mq;
@@ -436,7 +360,7 @@ struct omap_mbox *omap_mbox_get(const char *name)
 
read_unlock(mboxes_lock);
 
-   ret = omap_mbox_init(mbox);
+   ret = omap_mbox_startup(mbox);
if 

[PATCH 0/10] omap mailbox: Refreshed patch series for-next branch

2009-11-13 Thread C.A, Subramaniam
Hi All,
Following is the refreshed version of patches for mailbox driver.

Hi Tony,
I have gone through the patch set in the for-next branch and have made the 
following changes:

Patch 7 was missing. I have re-worked it to the for-next branch.

As you had mentioned in the previous mail, Patches 8 and 10 have been re-worked.

Request you to please apply the patches 7, 8 and 10 on the for-next branch.

Patches already APPLIED on the for-next branch:
--
0001-omap-mailbox-Add-build-specific-changes-to-support.patch
0002-omap-mailbox-OMAP4-Add-resources-and-mailbox-reg.patch
0003-omap-mailbox-remove-sequence-bit-checking.patch
0004-omap-mailbox-remove-class-interface.patch
0005-omap-mailbox-remove-disable_-enable_mbox_irq-in-is.patch
0006-omap-mailbox-remove-unnecessary-arg-for-omap_mbox_.patch

0009-omap-mailbox-OMAP4-Mailbox-Patch-to-change-the-IRQ.patch

Patches refreshed for the for-next branch (need to be APPLIED):
--

0007-omap-mailbox-expose-omap_mbox_enable-disable_irq.patch
0008-omap-mailbox-OMAP4-Mailbox-Adds-code-changes-to-s.patch

0010-omap-mailbox-OMAP4-Mailbox-driver-Patch-to-support.patch

Please do let me know if you have any concerns.

Thank you and Regards
Subbu--
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/10] omap: mailbox: OMAP4 - Add resources

2009-11-13 Thread C.A, Subramaniam
From 80f2bf9ba7e2d87490a36346d25517c41033677f Mon Sep 17 00:00:00 2001
From: C A Subramaniam subramaniam...@ti.com
Date: Thu, 12 Nov 2009 16:18:04 -0800
Subject: [PATCH 2/10] omap: mailbox: OMAP4 - Add resources and mailbox register 
base address for OMAP4 mailbox

This patch adds resource information of mailbox driver for
OMAP4 mailbox module. Register base address also added

Signed-off-by: C A Subramaniam subramaniam...@ti.com
Signed-off-by: Ramesh Gupta G grgu...@ti.com
Acked-by: Hiroshi DOYU hiroshi.d...@nokia.com
Signed-off-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/devices.c  |   36 +---
 arch/arm/plat-omap/include/plat/omap44xx.h |2 +
 2 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 8b6cd8c..733d3dc 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -136,9 +136,10 @@ static inline void omap_init_camera(void)
 
 #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
 
-#define MBOX_REG_SIZE  0x120
+#define MBOX_REG_SIZE   0x120
 
-static struct resource omap2_mbox_resources[] = {
+#ifdef CONFIG_ARCH_OMAP2
+static struct resource omap_mbox_resources[] = {
{
.start  = OMAP24XX_MAILBOX_BASE,
.end= OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
@@ -153,8 +154,10 @@ static struct resource omap2_mbox_resources[] = {
.flags  = IORESOURCE_IRQ,
},
 };
+#endif
 
-static struct resource omap3_mbox_resources[] = {
+#ifdef CONFIG_ARCH_OMAP3
+static struct resource omap_mbox_resources[] = {
{
.start  = OMAP34XX_MAILBOX_BASE,
.end= OMAP34XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
@@ -165,6 +168,24 @@ static struct resource omap3_mbox_resources[] = {
.flags  = IORESOURCE_IRQ,
},
 };
+#endif
+
+#ifdef CONFIG_ARCH_OMAP4
+
+#define OMAP4_MBOX_REG_SIZE0x130
+static struct resource omap_mbox_resources[] = {
+   {
+   .start  = OMAP44XX_MAILBOX_BASE,
+   .end= OMAP44XX_MAILBOX_BASE +
+   OMAP4_MBOX_REG_SIZE - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = INT_44XX_MAIL_U0_MPU,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+#endif
 
 static struct platform_device mbox_device = {
.name   = omap2-mailbox,
@@ -173,12 +194,9 @@ static struct platform_device mbox_device = {
 
 static inline void omap_init_mbox(void)
 {
-   if (cpu_is_omap2420()) {
-   mbox_device.num_resources = ARRAY_SIZE(omap2_mbox_resources);
-   mbox_device.resource = omap2_mbox_resources;
-   } else if (cpu_is_omap3430()) {
-   mbox_device.num_resources = ARRAY_SIZE(omap3_mbox_resources);
-   mbox_device.resource = omap3_mbox_resources;
+   if (cpu_is_omap2420() || cpu_is_omap3430() || cpu_is_omap44xx()) {
+   mbox_device.num_resources = ARRAY_SIZE(omap_mbox_resources);
+   mbox_device.resource = omap_mbox_resources;
} else {
pr_err(%s: platform not supported\n, __func__);
return;
diff --git a/arch/arm/plat-omap/include/plat/omap44xx.h 
b/arch/arm/plat-omap/include/plat/omap44xx.h
index 3361897..e52902a 100644
--- a/arch/arm/plat-omap/include/plat/omap44xx.h
+++ b/arch/arm/plat-omap/include/plat/omap44xx.h
@@ -40,5 +40,7 @@
 #define OMAP44XX_LOCAL_TWD_BASE0x48240600
 #define OMAP44XX_WKUPGEN_BASE  0x48281000
 
+#define OMAP44XX_MAILBOX_BASE  (L4_44XX_BASE + 0xF4000)
+
 #endif /* __ASM_ARCH_OMAP44XX_H */
 
-- 
1.5.3.2
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/10] omap: mailbox: remove sequence bit checking

2009-11-13 Thread C.A, Subramaniam
From 39b709da59a8f146169577702c4d77048050c3d0 Mon Sep 17 00:00:00 2001
From: Hiroshi DOYU hiroshi.d...@nokia.com
Date: Thu, 12 Nov 2009 16:18:04 -0800
Subject: [PATCH 3/10] omap: mailbox: remove sequence bit checking

Any protocol should be handled in the upper layer and mailbox driver
shouldn't care about the contents of messages.

Signed-off-by: Hiroshi DOYU hiroshi.d...@nokia.com
Signed-off-by: Tony Lindgren t...@atomide.com
---
 arch/arm/plat-omap/mailbox.c |   70 ++---
 1 files changed, 4 insertions(+), 66 deletions(-)

diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 734bff3..f82810e 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -28,54 +28,9 @@
 
 #include plat/mailbox.h
 
-static int enable_seq_bit;
-module_param(enable_seq_bit, bool, 0);
-MODULE_PARM_DESC(enable_seq_bit, Enable sequence bit checking.);
-
 static struct omap_mbox *mboxes;
 static DEFINE_RWLOCK(mboxes_lock);
 
-/*
- * Mailbox sequence bit API
- */
-
-/* seq_rcv should be initialized with any value other than
- * 0 and 1  31, to allow either value for the first
- * message.  */
-static inline void mbox_seq_init(struct omap_mbox *mbox)
-{
-   if (!enable_seq_bit)
-   return;
-
-   /* any value other than 0 and 1  31 */
-   mbox-seq_rcv = 0x;
-}
-
-static inline void mbox_seq_toggle(struct omap_mbox *mbox, mbox_msg_t * msg)
-{
-   if (!enable_seq_bit)
-   return;
-
-   /* add seq_snd to msg */
-   *msg = (*msg  0x7fff) | mbox-seq_snd;
-   /* flip seq_snd */
-   mbox-seq_snd ^= 1  31;
-}
-
-static inline int mbox_seq_test(struct omap_mbox *mbox, mbox_msg_t msg)
-{
-   mbox_msg_t seq;
-
-   if (!enable_seq_bit)
-   return 0;
-
-   seq = msg  (1  31);
-   if (seq == mbox-seq_rcv)
-   return -1;
-   mbox-seq_rcv = seq;
-   return 0;
-}
-
 /* Mailbox FIFO handle functions */
 static inline mbox_msg_t mbox_fifo_read(struct omap_mbox *mbox)
 {
@@ -113,13 +68,6 @@ static inline int is_mbox_irq(struct omap_mbox *mbox, 
omap_mbox_irq_t irq)
return mbox-ops-is_irq(mbox, irq);
 }
 
-/* Mailbox Sequence Bit function */
-void omap_mbox_init_seq(struct omap_mbox *mbox)
-{
-   mbox_seq_init(mbox);
-}
-EXPORT_SYMBOL(omap_mbox_init_seq);
-
 /*
  * message sender
  */
@@ -141,7 +89,6 @@ static int __mbox_msg_send(struct omap_mbox *mbox, 
mbox_msg_t msg, void *arg)
goto out;
}
 
-   mbox_seq_toggle(mbox, msg);
mbox_fifo_write(mbox, msg);
  out:
return ret;
@@ -254,11 +201,11 @@ static void mbox_rx_work(struct work_struct *work)
 /*
  * Mailbox interrupt handler
  */
-static void mbox_txq_fn(struct request_queue * q)
+static void mbox_txq_fn(struct request_queue *q)
 {
 }
 
-static void mbox_rxq_fn(struct request_queue * q)
+static void mbox_rxq_fn(struct request_queue *q)
 {
 }
 
@@ -284,11 +231,6 @@ static void __mbox_rx_interrupt(struct omap_mbox *mbox)
 
msg = mbox_fifo_read(mbox);
 
-   if (unlikely(mbox_seq_test(mbox, msg))) {
-   pr_info(mbox: Illegal seq bit!(%08x)\n, msg);
-   if (mbox-err_notify)
-   mbox-err_notify();
-   }
 
blk_insert_request(q, rq, 0, (void *)msg);
if (mbox-ops-type == OMAP_MBOX_TYPE1)
@@ -320,7 +262,7 @@ static irqreturn_t mbox_interrupt(int irq, void *p)
  */
 static ssize_t
 omap_mbox_write(struct device *dev, struct device_attribute *attr,
-   const char * buf, size_t count)
+   const char *buf, size_t count)
 {
int ret;
mbox_msg_t *p = (mbox_msg_t *)buf;
@@ -357,10 +299,6 @@ omap_mbox_read(struct device *dev, struct device_attribute 
*attr, char *buf)
 
blk_end_request_all(rq, 0);
 
-   if (unlikely(mbox_seq_test(mbox, *p))) {
-   pr_info(mbox: Illegal seq bit!(%08x) ignored\n, *p);
-   continue;
-   }
p++;
}
 
@@ -383,7 +321,7 @@ static struct class omap_mbox_class = {
 };
 
 static struct omap_mbox_queue *mbox_queue_alloc(struct omap_mbox *mbox,
-   request_fn_proc * proc,
+   request_fn_proc *proc,
void (*work) (struct work_struct *))
 {
struct request_queue *q;
-- 
1.5.3.2
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/10] omap: mailbox: Add build specific changes to support omap mailbox

2009-11-13 Thread C.A, Subramaniam
From bf41b0fd7324149a647b43d434ae3821bea49541 Mon Sep 17 00:00:00 2001
From: C A Subramaniam subramaniam...@ti.com
Date: Thu, 12 Nov 2009 16:18:03 -0800
Subject: [PATCH 1/10] omap: mailbox: Add build specific changes to support omap 
mailbox

This patch adds changes to the build related files of mailbox
driver

Signed-off-by: C A Subramaniam subramaniam...@ti.com
Signed-off-by: Ramesh Gupta G grgu...@ti.com
Acked-by: Hiroshi DOYU hiroshi.d...@nokia.com
Signed-off-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/Makefile |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 5c32b65..b77fe24 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -44,6 +44,9 @@ obj-$(CONFIG_ARCH_OMAP4)  += cm4xxx.o
 obj-$(CONFIG_ARCH_OMAP2)   += clock24xx.o
 obj-$(CONFIG_ARCH_OMAP3)   += clock34xx.o
 
+obj-$(CONFIG_OMAP_MBOX_FWK)+= mailbox_mach.o
+mailbox_mach-objs  := mailbox.o
+
 iommu-y+= iommu2.o
 iommu-$(CONFIG_ARCH_OMAP3) += omap3-iommu.o
 
-- 
1.5.3.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 8/10 v3] omap mailbox: OMAP4-Mailbox - Adds code changes to support OMAP4 mailbox.

2009-11-12 Thread C.A, Subramaniam
 
 -Original Message-
 From: Tony Lindgren [mailto:t...@atomide.com] 
 Sent: Thursday, November 12, 2009 4:35 AM
 To: C.A, Subramaniam
 Cc: li...@arm.linux.org.uk; linux-omap@vger.kernel.org; 
 Hiroshi DOYU; Gupta, Ramesh; Kanigeri, Hari
 Subject: Re: [PATCH 8/10 v3] omap mailbox: OMAP4-Mailbox - 
 Adds code changes to support OMAP4 mailbox.
 
 * C.A, Subramaniam subramaniam...@ti.com [090924 08:06]:
  Hi all,
  This is the revised version of the patch incorporating 
 Russell's comments.
  
  Regards
  Subbu
   
  From 0c7c506f0a47acc8444bed83fa56ad2aa76c3b7c Mon Sep 17 
 00:00:00 2001
  From: C A Subramaniam subramaniam...@ti.com
  Date: Thu, 24 Sep 2009 19:16:39 +0530
  Subject: [PATCH 8/10 v3] omap mailbox: OMAP4-Mailbox - Adds 
 code changes to support OMAP4 mailbox.
  
  This patch adds code changes in the mailbox driver module to add 
  support for OMAP4 mailbox.
 
 Subbu, can you please repost patch 8/10 and 10/10 against 
 what I currently have in the omap for-next branch?
 
 I got the other ones applied, but those two need to be refreshed.
 
Tony,
I am working on the 2 patches (8 and 10). I will send them out tomorrow.

 Also, please make sure I got the other 8 patches merged right.

I will check the patches and ensure that they are in place. 

 
 Regards,
 
 Tony
 
 

Thank you and Regards
Subbu--
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 8/10] omap mailbox: OMAP4-Mailbox - Adds code changes to support OMAP4 mailbox.

2009-09-24 Thread C.A, Subramaniam
Hi Russell,

 -Original Message-
 From: Russell King [mailto:r...@arm.linux.org.uk] 
 Sent: Wednesday, September 23, 2009 3:26 PM
 To: C.A, Subramaniam
 Cc: linux-omap@vger.kernel.org; Hiroshi DOYU; 
 t...@atomide.com; Kanigeri, Hari; Gupta, Ramesh
 Subject: Re: [PATCH 8/10] omap mailbox: OMAP4-Mailbox - Adds 
 code changes to support OMAP4 mailbox.
 
 On Tue, Sep 22, 2009 at 08:03:32PM +0530, C.A, Subramaniam wrote:
  @@ -70,10 +88,9 @@ static inline void mbox_write_reg(u32 
 val, size_t ofs)
   static int omap2_mbox_startup(struct omap_mbox *mbox)
   {
  unsigned int l;
  -
  mbox_ick_handle = clk_get(NULL, mailboxes_ick);
  if (IS_ERR(mbox_ick_handle)) {
  -   printk(Could not get mailboxes_ick\n);
  +   printk(KERN_ERR Could not get mailboxes_ick\n);
  return -ENODEV;
 
 Good idea: Print the error code so people can diagnose why 
 things fail.
 
   printk(KERN_ERR Could not get mailboxes_ick: %d\n,
   PTR_ERR(mbox_ick_handle));
 
 And wonder why this hasn't been spotted before.
 
 Rule: always propagate error codes when you have one to propagate.
 
   return PTR_ERR(mbox_ick_handle);

Thank you for your comments. I will send a revised patch.

Regards
Subbu--
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 8/10 v3] omap mailbox: OMAP4-Mailbox - Adds code changes to support OMAP4 mailbox.

2009-09-24 Thread C.A, Subramaniam
Hi all,
This is the revised version of the patch incorporating Russell's comments.

Regards
Subbu
 
From 0c7c506f0a47acc8444bed83fa56ad2aa76c3b7c Mon Sep 17 00:00:00 2001
From: C A Subramaniam subramaniam...@ti.com
Date: Thu, 24 Sep 2009 19:16:39 +0530
Subject: [PATCH 8/10 v3] omap mailbox: OMAP4-Mailbox - Adds code changes to 
support OMAP4 mailbox.

This patch adds code changes in the mailbox driver module to
add support for OMAP4 mailbox.

Signed-off-by: Hari Kanigeri h-kanige...@ti.com
Signed-off-by: C A Subramaniam subramaniam...@ti.com
Signed-off-by: Ramesh Gupta G grgu...@ti.com
---
 arch/arm/mach-omap2/mailbox.c |  123 +++--
 arch/arm/plat-omap/mailbox.c  |   25 +++--
 2 files changed, 125 insertions(+), 23 deletions(-)

diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 6f71f37..fee4ee7 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -18,21 +18,36 @@
 #include mach/mailbox.h
 #include mach/irqs.h
 
+#define DRV_NAME omap2-mailbox
+
 #define MAILBOX_REVISION   0x000
 #define MAILBOX_SYSCONFIG  0x010
 #define MAILBOX_SYSSTATUS  0x014
 #define MAILBOX_MESSAGE(m) (0x040 + 4 * (m))
 #define MAILBOX_FIFOSTATUS(m)  (0x080 + 4 * (m))
 #define MAILBOX_MSGSTATUS(m)   (0x0c0 + 4 * (m))
+
+#ifdef CONFIG_ARCH_OMAP4
+#define MAILBOX_IRQSTATUS(u)   (0x104 + 10 * (u))
+#define MAILBOX_IRQENABLE(u)   (0x108 + 10 * (u))
+#define MAILBOX_IRQENABLE_CLR(u)   (0x10c + 10 * (u))
+#else
 #define MAILBOX_IRQSTATUS(u)   (0x100 + 8 * (u))
 #define MAILBOX_IRQENABLE(u)   (0x104 + 8 * (u))
+#endif
 
-#define MAILBOX_IRQ_NEWMSG(u)  (1  (2 * (u)))
-#define MAILBOX_IRQ_NOTFULL(u) (1  (2 * (u) + 1))
+#define MAILBOX_IRQ_NEWMSG(m)  (1  (2 * (m)))
+#define MAILBOX_IRQ_NOTFULL(m) (1  (2 * (m) + 1))
 
+#ifdef CONFIG_ARCH_OMAP4
+#define MBOX_REG_SIZE  0x130
+#else
 #define MBOX_REG_SIZE  0x120
+#endif
+
 #define MBOX_NR_REGS   (MBOX_REG_SIZE / sizeof(u32))
 
+
 static void __iomem *mbox_base;
 
 struct omap_mbox2_fifo {
@@ -49,6 +64,9 @@ struct omap_mbox2_priv {
u32 newmsg_bit;
u32 notfull_bit;
u32 ctx[MBOX_NR_REGS];
+#ifdef CONFIG_ARCH_OMAP4
+   unsigned long irqdisable;
+#endif
 };
 
 static struct clk *mbox_ick_handle;
@@ -70,11 +88,11 @@ static inline void mbox_write_reg(u32 val, size_t ofs)
 static int omap2_mbox_startup(struct omap_mbox *mbox)
 {
unsigned int l;
-
mbox_ick_handle = clk_get(NULL, mailboxes_ick);
if (IS_ERR(mbox_ick_handle)) {
-   printk(Could not get mailboxes_ick\n);
-   return -ENODEV;
+   printk(KERN_ERR Could not get mailboxes_ick: %d\n,
+   PTR_ERR(mbox_ick_handle));
+   return PTR_ERR(mbox_ick_handle);
}
clk_enable(mbox_ick_handle);
 
@@ -85,7 +103,6 @@ static int omap2_mbox_startup(struct omap_mbox *mbox)
l = mbox_read_reg(MAILBOX_SYSCONFIG);
l |= 0x0011;
mbox_write_reg(l, MAILBOX_SYSCONFIG);
-
omap2_mbox_enable_irq(mbox, IRQ_RX);
 
return 0;
@@ -95,6 +112,7 @@ static void omap2_mbox_shutdown(struct omap_mbox *mbox)
 {
clk_disable(mbox_ick_handle);
clk_put(mbox_ick_handle);
+   mbox_ick_handle = NULL;
 }
 
 /* Mailbox FIFO handle functions */
@@ -123,7 +141,7 @@ static int omap2_mbox_fifo_full(struct omap_mbox *mbox)
 {
struct omap_mbox2_fifo *fifo =
((struct omap_mbox2_priv *)mbox-priv)-tx_fifo;
-   return (mbox_read_reg(fifo-fifo_stat));
+   return mbox_read_reg(fifo-fifo_stat);
 }
 
 /* Mailbox IRQ handle functions */
@@ -143,10 +161,9 @@ static void omap2_mbox_disable_irq(struct omap_mbox *mbox,
 {
struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox-priv;
u32 l, bit = (irq == IRQ_TX) ? p-notfull_bit : p-newmsg_bit;
-
-   l = mbox_read_reg(p-irqenable);
+   l = mbox_read_reg(p-irqdisable);
l = ~bit;
-   mbox_write_reg(l, p-irqenable);
+   mbox_write_reg(l, p-irqdisable);
 }
 
 static void omap2_mbox_ack_irq(struct omap_mbox *mbox,
@@ -156,6 +173,8 @@ static void omap2_mbox_ack_irq(struct omap_mbox *mbox,
u32 bit = (irq == IRQ_TX) ? p-notfull_bit : p-newmsg_bit;
 
mbox_write_reg(bit, p-irqstatus);
+   /* Flush post writing */
+mbox_read_reg(p-irqstatus);
 }
 
 static int omap2_mbox_is_irq(struct omap_mbox *mbox,
@@ -166,7 +185,7 @@ static int omap2_mbox_is_irq(struct omap_mbox *mbox,
u32 enable = mbox_read_reg(p-irqenable);
u32 status = mbox_read_reg(p-irqstatus);
 
-   return (enable  status  bit);
+   return (int)(enable  status  bit);
 }
 
 static void omap2_mbox_save_ctx(struct omap_mbox *mbox)
@@ -219,9 +238,12 @@ static struct omap_mbox_ops omap2_mbox_ops = {
  */
 
 /* FIXME: the following 

[PATCH 0/10] omap mailbox: Adding OMAP4 support v2

2009-09-22 Thread C.A, Subramaniam
Hi All,
Following is the second version of patches for mailbox driver. 
The comments provided by Hiroshi and Russell King have been in-corporated.
Resending the entire series of patches, below is the summary of changes.

0001-omap-mailbox-Add-build-specific-changes-to-support.patch   (Removed 
reference to OMAP4, Make file comment removed)
0002-omap-mailbox-OMAP4-Add-resources-and-mailbox-regi.patch(Re-organized 
recources undef platform specific #ifdef)
0003-omap-mailbox-remove-sequence-bit-checking.patch(No 
Changes)
0004-omap-mailbox-remove-class-interface.patch  (No 
changes)
0005-omap-mailbox-remove-disable_-enable_mbox_irq-in-isr.patch  (No changes)
0006-omap-mailbox-remove-unnecessary-arg-for-omap_mbox_m.patch  (Removed args, 
in tx_data)
0007-omap-mailbox-expose-omap_mbox_enable-disable_irq.patch (No 
Changes, generated since previous patches changed)
0008-omap-mailbox-OMAP4-Mailbox-Adds-code-changes-to-s.patch(Move hardware 
independent logic to the plat-omap file, add check race conditions)
0009-omap-mailbox-OMAP4-Mailbox-Patch-to-change-the-IRQ.patch   (No Changes, 
generated since previous patches changed)
0010-omap-mailbox-OMAP4-Mailbox-driver-Patch-to-support.patch   (Add tasklet 
implementation logic into the plat-omap file instead of mach-omap file)

File modified:

arch/arm/mach-omap2/Makefile
arch/arm/mach-omap2/devices.c
arch/arm/plat-omap/include/mach/omap44xx.h
arch/arm/plat-omap/mailbox.c
arch/arm/plat-omap/include/mach/mailbox.h
arch/arm/mach-omap2/mailbox.c

Thank you and Regards
Subramaniam C A,
Ramesh Gupta. G
Kanigeri Hari
--
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/10] omap mailbox: Add build specific changes to support omap mailbox

2009-09-22 Thread C.A, Subramaniam
From c25cd3fc0a18010a579ab6fc265009ff19e81ac7 Mon Sep 17 00:00:00 2001
From: C A Subramaniam subramaniam...@ti.com
Date: Mon, 7 Sep 2009 14:54:20 +0530
Subject: [PATCH 1/10] omap mailbox: Add build specific changes to support omap 
mailbox.

This patch adds changes to the build related files of mailbox
driver

Signed-off-by: C A Subramaniam subramaniam...@ti.com
Signed-off-by: Ramesh Gupta G grgu...@ti.com
---
 arch/arm/mach-omap2/Makefile |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 735bae5..b7be8b3 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -39,6 +39,9 @@ endif
 obj-$(CONFIG_ARCH_OMAP2)   += clock24xx.o
 obj-$(CONFIG_ARCH_OMAP3)   += clock34xx.o
 
+obj-$(CONFIG_OMAP_MBOX_FWK)+= mailbox_mach.o
+mailbox_mach-objs  := mailbox.o
+
 iommu-y+= iommu2.o
 iommu-$(CONFIG_ARCH_OMAP3) += omap3-iommu.o
 
-- 
1.5.3.2
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/10] omap mailbox: OMAP4 - Add resources and mailbox register base address for OMAP4 mailbox

2009-09-22 Thread C.A, Subramaniam
From c8057dc97d7b3479e2fb73f57f13ff27f6af8b9e Mon Sep 17 00:00:00 2001
From: C A Subramaniam subramaniam...@ti.com
Date: Tue, 8 Sep 2009 15:26:34 +0530
Subject: [PATCH 2/10] omap mailbox: OMAP4 - Add resources and mailbox register 
base address for OMAP4 mailbox

This patch adds resource information of mailbox driver for
OMAP4 mailbox module. Register base address also added

Signed-off-by: C A Subramaniam subramaniam...@ti.com
Signed-off-by: Ramesh Gupta G grgu...@ti.com
---
 arch/arm/mach-omap2/devices.c  |   36 +---
 arch/arm/plat-omap/include/mach/omap44xx.h |2 +
 2 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 894cc35..359c715 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -136,9 +136,10 @@ static inline void omap_init_camera(void)
 
 #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
 
-#define MBOX_REG_SIZE  0x120
+#define MBOX_REG_SIZE   0x120
 
-static struct resource omap2_mbox_resources[] = {
+#ifdef CONFIG_ARCH_OMAP2
+static struct resource omap_mbox_resources[] = {
{
.start  = OMAP24XX_MAILBOX_BASE,
.end= OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
@@ -153,8 +154,10 @@ static struct resource omap2_mbox_resources[] = {
.flags  = IORESOURCE_IRQ,
},
 };
+#endif
 
-static struct resource omap3_mbox_resources[] = {
+#ifdef CONFIG_ARCH_OMAP3
+static struct resource omap_mbox_resources[] = {
{
.start  = OMAP34XX_MAILBOX_BASE,
.end= OMAP34XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
@@ -165,6 +168,24 @@ static struct resource omap3_mbox_resources[] = {
.flags  = IORESOURCE_IRQ,
},
 };
+#endif
+
+#ifdef CONFIG_ARCH_OMAP4
+
+#define OMAP4_MBOX_REG_SIZE0x130
+static struct resource omap_mbox_resources[] = {
+   {
+   .start  = OMAP44XX_MAILBOX_BASE,
+   .end= OMAP44XX_MAILBOX_BASE +
+   OMAP4_MBOX_REG_SIZE - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = INT_44XX_MAIL_U0_MPU,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+#endif
 
 static struct platform_device mbox_device = {
.name   = omap2-mailbox,
@@ -173,12 +194,9 @@ static struct platform_device mbox_device = {
 
 static inline void omap_init_mbox(void)
 {
-   if (cpu_is_omap2420()) {
-   mbox_device.num_resources = ARRAY_SIZE(omap2_mbox_resources);
-   mbox_device.resource = omap2_mbox_resources;
-   } else if (cpu_is_omap3430()) {
-   mbox_device.num_resources = ARRAY_SIZE(omap3_mbox_resources);
-   mbox_device.resource = omap3_mbox_resources;
+   if (cpu_is_omap2420() || cpu_is_omap3430() || cpu_is_omap44xx()) {
+   mbox_device.num_resources = ARRAY_SIZE(omap_mbox_resources);
+   mbox_device.resource = omap_mbox_resources;
} else {
pr_err(%s: platform not supported\n, __func__);
return;
diff --git a/arch/arm/plat-omap/include/mach/omap44xx.h 
b/arch/arm/plat-omap/include/mach/omap44xx.h
index 52f2f85..ef0efaa 100644
--- a/arch/arm/plat-omap/include/mach/omap44xx.h
+++ b/arch/arm/plat-omap/include/mach/omap44xx.h
@@ -44,5 +44,7 @@
 #define OMAP44XX_WKUPGEN_BASE  0x48281000
 #define OMAP44XX_VA_WKUPGEN_BASE   IO_ADDRESS(OMAP44XX_WKUPGEN_BASE)
 
+#define OMAP44XX_MAILBOX_BASE  (L4_44XX_BASE + 0xF4000)
+
 #endif /* __ASM_ARCH_OMAP44XX_H */
 
-- 
1.5.3.2
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/10] omap mailbox: remove class interface

2009-09-22 Thread C.A, Subramaniam
From 3ab5427742e66e7b9e0eb882e71bd6f688163200 Mon Sep 17 00:00:00 2001
From: Hiroshi DOYU hiroshi.d...@nokia.com
Date: Wed, 2 Sep 2009 20:03:19 +0530
Subject: [PATCH 4/10] omap mailbox: remove class interface

It's not used at present.

Signed-off-by: Hiroshi DOYU hiroshi.d...@nokia.com
---
 arch/arm/plat-omap/include/mach/mailbox.h |1 -
 arch/arm/plat-omap/mailbox.c  |  115 ++--
 2 files changed, 9 insertions(+), 107 deletions(-)

diff --git a/arch/arm/plat-omap/include/mach/mailbox.h 
b/arch/arm/plat-omap/include/mach/mailbox.h
index b7a6991..319306a 100644
--- a/arch/arm/plat-omap/include/mach/mailbox.h
+++ b/arch/arm/plat-omap/include/mach/mailbox.h
@@ -8,7 +8,6 @@
 #include linux/blkdev.h
 
 typedef u32 mbox_msg_t;
-typedef void (mbox_receiver_t)(mbox_msg_t msg);
 struct omap_mbox;
 
 typedef int __bitwise omap_mbox_irq_t;
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index e2bcc9d..6e713a7 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -71,7 +71,7 @@ static inline int is_mbox_irq(struct omap_mbox *mbox, 
omap_mbox_irq_t irq)
 /*
  * message sender
  */
-static int __mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg, void *arg)
+static int __mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg)
 {
int ret = 0, i = 1000;
 
@@ -82,15 +82,7 @@ static int __mbox_msg_send(struct omap_mbox *mbox, 
mbox_msg_t msg, void *arg)
return -1;
udelay(1);
}
-
-   if (arg  mbox-txq-callback) {
-   ret = mbox-txq-callback(arg);
-   if (ret)
-   goto out;
-   }
-
mbox_fifo_write(mbox, msg);
- out:
return ret;
 }
 
@@ -152,7 +144,7 @@ static void mbox_tx_work(struct work_struct *work)
 
tx_data = rq-special;
 
-   ret = __mbox_msg_send(mbox, tx_data-msg, tx_data-arg);
+   ret = __mbox_msg_send(mbox, tx_data-msg);
if (ret) {
enable_mbox_irq(mbox, IRQ_TX);
spin_lock(q-queue_lock);
@@ -180,11 +172,6 @@ static void mbox_rx_work(struct work_struct *work)
mbox_msg_t msg;
unsigned long flags;
 
-   if (mbox-rxq-callback == NULL) {
-   sysfs_notify(mbox-dev-kobj, NULL, mbox);
-   return;
-   }
-
while (1) {
spin_lock_irqsave(q-queue_lock, flags);
rq = blk_fetch_request(q);
@@ -257,69 +244,6 @@ static irqreturn_t mbox_interrupt(int irq, void *p)
return IRQ_HANDLED;
 }
 
-/*
- * sysfs files
- */
-static ssize_t
-omap_mbox_write(struct device *dev, struct device_attribute *attr,
-   const char *buf, size_t count)
-{
-   int ret;
-   mbox_msg_t *p = (mbox_msg_t *)buf;
-   struct omap_mbox *mbox = dev_get_drvdata(dev);
-
-   for (; count = sizeof(mbox_msg_t); count -= sizeof(mbox_msg_t)) {
-   ret = omap_mbox_msg_send(mbox, be32_to_cpu(*p), NULL);
-   if (ret)
-   return -EAGAIN;
-   p++;
-   }
-
-   return (size_t)((char *)p - buf);
-}
-
-static ssize_t
-omap_mbox_read(struct device *dev, struct device_attribute *attr, char *buf)
-{
-   unsigned long flags;
-   struct request *rq;
-   mbox_msg_t *p = (mbox_msg_t *) buf;
-   struct omap_mbox *mbox = dev_get_drvdata(dev);
-   struct request_queue *q = mbox-rxq-queue;
-
-   while (1) {
-   spin_lock_irqsave(q-queue_lock, flags);
-   rq = blk_fetch_request(q);
-   spin_unlock_irqrestore(q-queue_lock, flags);
-
-   if (!rq)
-   break;
-
-   *p = (mbox_msg_t)rq-special;
-
-   blk_end_request_all(rq, 0);
-
-   p++;
-   }
-
-   pr_debug(%02x %02x %02x %02x\n, buf[0], buf[1], buf[2], buf[3]);
-
-   return (size_t) ((char *)p - buf);
-}
-
-static DEVICE_ATTR(mbox, S_IRUGO | S_IWUSR, omap_mbox_read, omap_mbox_write);
-
-static ssize_t mbox_show(struct class *class, char *buf)
-{
-   return sprintf(buf, mbox);
-}
-
-static CLASS_ATTR(mbox, S_IRUGO, mbox_show, NULL);
-
-static struct class omap_mbox_class = {
-   .name = omap-mailbox,
-};
-
 static struct omap_mbox_queue *mbox_queue_alloc(struct omap_mbox *mbox,
request_fn_proc *proc,
void (*work) (struct work_struct *))
@@ -353,7 +277,7 @@ static void mbox_queue_free(struct omap_mbox_queue *q)
kfree(q);
 }
 
-static int omap_mbox_init(struct omap_mbox *mbox)
+static int omap_mbox_startup(struct omap_mbox *mbox)
 {
int ret;
struct omap_mbox_queue *mq;
@@ -436,7 +360,7 @@ struct omap_mbox *omap_mbox_get(const char *name)
 
read_unlock(mboxes_lock);
 
-   ret = omap_mbox_init(mbox);
+   ret = omap_mbox_startup(mbox);
if (ret)
return ERR_PTR(-ENODEV);
 

[PATCH 6/10] omap mailbox: remove unnecessary arg for omap_mbox_msg_send

2009-09-22 Thread C.A, Subramaniam
From 021907db683b2d7c7bf5f60bea3874fc6c2fa5a0 Mon Sep 17 00:00:00 2001
From: C A Subramaniam subramaniam...@ti.com
Date: Tue, 8 Sep 2009 21:35:58 +0530
Subject: [PATCH 6/10] omap mailbox: remove unnecessary arg for 
omap_mbox_msg_send

Also removed from tx_data

Signed-off-by: Hiroshi DOYU hiroshi.d...@nokia.com
---
 arch/arm/plat-omap/include/mach/mailbox.h |2 +-
 arch/arm/plat-omap/mailbox.c  |4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm/plat-omap/include/mach/mailbox.h 
b/arch/arm/plat-omap/include/mach/mailbox.h
index 319306a..8260a3f 100644
--- a/arch/arm/plat-omap/include/mach/mailbox.h
+++ b/arch/arm/plat-omap/include/mach/mailbox.h
@@ -63,7 +63,7 @@ struct omap_mbox {
void(*err_notify)(void);
 };
 
-int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg, void *);
+int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg);
 void omap_mbox_init_seq(struct omap_mbox *);
 
 struct omap_mbox *omap_mbox_get(const char *);
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 8a6d087..2899255 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -88,7 +88,6 @@ static int __mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t 
msg)
 
 struct omap_msg_tx_data {
mbox_msg_t  msg;
-   void*arg;
 };
 
 static void omap_msg_tx_end_io(struct request *rq, int error)
@@ -97,7 +96,7 @@ static void omap_msg_tx_end_io(struct request *rq, int error)
__blk_put_request(rq-q, rq);
 }
 
-int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg, void* arg)
+int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg)
 {
struct omap_msg_tx_data *tx_data;
struct request *rq;
@@ -114,7 +113,6 @@ int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t 
msg, void* arg)
}
 
tx_data-msg = msg;
-   tx_data-arg = arg;
rq-end_io = omap_msg_tx_end_io;
blk_insert_request(q, rq, 0, tx_data);
 
-- 
1.5.3.2
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/10] omap mailbox: remove disable_/enable_mbox_irq in isr

2009-09-22 Thread C.A, Subramaniam
From d9bcb084bfdfdd72a4b449ca4c5990c27e8f6957 Mon Sep 17 00:00:00 2001
From: Hiroshi DOYU hiroshi.d...@nokia.com
Date: Wed, 2 Sep 2009 20:06:38 +0530
Subject: [PATCH 5/10] omap mailbox: remove disable_/enable_mbox_irq in isr

No need to handle it in isr, since irq won't happen during isr.

Signed-off-by: Hiroshi DOYU hiroshi.d...@nokia.com
---
 arch/arm/plat-omap/mailbox.c |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 6e713a7..8a6d087 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -209,8 +209,6 @@ static void __mbox_rx_interrupt(struct omap_mbox *mbox)
mbox_msg_t msg;
struct request_queue *q = mbox-rxq-queue;
 
-   disable_mbox_irq(mbox, IRQ_RX);
-
while (!mbox_fifo_empty(mbox)) {
rq = blk_get_request(q, WRITE, GFP_ATOMIC);
if (unlikely(!rq))
@@ -226,7 +224,6 @@ static void __mbox_rx_interrupt(struct omap_mbox *mbox)
 
/* no more messages in the fifo. clear IRQ source. */
ack_mbox_irq(mbox, IRQ_RX);
-   enable_mbox_irq(mbox, IRQ_RX);
 nomem:
schedule_work(mbox-rxq-work);
 }
-- 
1.5.3.2
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/10] omap mailbox: expose omap_mbox_enable()/disable_irq()

2009-09-22 Thread C.A, Subramaniam
From 1ba55e567917b48afc64a14202fd860b3332056d Mon Sep 17 00:00:00 2001
From: Hiroshi DOYU hiroshi.d...@nokia.com
Date: Wed, 2 Sep 2009 20:18:53 +0530
Subject: [PATCH 7/10] omap mailbox: expose omap_mbox_enable()/disable_irq()

Signed-off-by: Hiroshi DOYU hiroshi.d...@nokia.com
---
 arch/arm/plat-omap/include/mach/mailbox.h |   12 
 arch/arm/plat-omap/mailbox.c  |   12 ++--
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/arch/arm/plat-omap/include/mach/mailbox.h 
b/arch/arm/plat-omap/include/mach/mailbox.h
index 8260a3f..bf06953 100644
--- a/arch/arm/plat-omap/include/mach/mailbox.h
+++ b/arch/arm/plat-omap/include/mach/mailbox.h
@@ -92,4 +92,16 @@ static inline void omap_mbox_restore_ctx(struct omap_mbox 
*mbox)
mbox-ops-restore_ctx(mbox);
 }
 
+static inline void omap_mbox_enable_irq(struct omap_mbox *mbox,
+   omap_mbox_irq_t irq)
+{
+   mbox-ops-enable_irq(mbox, irq);
+}
+
+static inline void omap_mbox_disable_irq(struct omap_mbox *mbox,
+omap_mbox_irq_t irq)
+{
+   mbox-ops-disable_irq(mbox, irq);
+}
+
 #endif /* MAILBOX_H */
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 2899255..032f1fe 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -50,14 +50,6 @@ static inline int mbox_fifo_full(struct omap_mbox *mbox)
 }
 
 /* Mailbox IRQ handle functions */
-static inline void enable_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
-{
-   mbox-ops-enable_irq(mbox, irq);
-}
-static inline void disable_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t 
irq)
-{
-   mbox-ops-disable_irq(mbox, irq);
-}
 static inline void ack_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
 {
if (mbox-ops-ack_irq)
@@ -144,7 +136,7 @@ static void mbox_tx_work(struct work_struct *work)
 
ret = __mbox_msg_send(mbox, tx_data-msg);
if (ret) {
-   enable_mbox_irq(mbox, IRQ_TX);
+   omap_mbox_enable_irq(mbox, IRQ_TX);
spin_lock(q-queue_lock);
blk_requeue_request(q, rq);
spin_unlock(q-queue_lock);
@@ -196,7 +188,7 @@ static void mbox_rxq_fn(struct request_queue *q)
 
 static void __mbox_tx_interrupt(struct omap_mbox *mbox)
 {
-   disable_mbox_irq(mbox, IRQ_TX);
+   omap_mbox_disable_irq(mbox, IRQ_TX);
ack_mbox_irq(mbox, IRQ_TX);
schedule_work(mbox-txq-work);
 }
-- 
1.5.3.2
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/10] omap mailbox: OMAP4-Mailbox - Adds code changes to support OMAP4 mailbox.

2009-09-22 Thread C.A, Subramaniam
From 6e3100d338c37928724821cab460ced1437bfa59 Mon Sep 17 00:00:00 2001
From: C A Subramaniam subramaniam...@ti.com
Date: Tue, 8 Sep 2009 22:36:20 +0530
Subject: [PATCH 8/10] omap mailbox: OMAP4-Mailbox - Adds code changes to 
support OMAP4 mailbox.

This patch adds code changes in the mailbox driver module to
add support for OMAP4 mailbox.

Signed-off-by: Hari Kanigeri h-kanige...@ti.com
Signed-off-by: C A Subramaniam subramaniam...@ti.com
Signed-off-by: Ramesh Gupta G grgu...@ti.com
---
 arch/arm/mach-omap2/mailbox.c |  120 +++--
 arch/arm/plat-omap/mailbox.c  |   25 +++--
 2 files changed, 123 insertions(+), 22 deletions(-)

diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 6f71f37..3d85807 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -18,21 +18,36 @@
 #include mach/mailbox.h
 #include mach/irqs.h
 
+#define DRV_NAME omap2-mailbox
+
 #define MAILBOX_REVISION   0x000
 #define MAILBOX_SYSCONFIG  0x010
 #define MAILBOX_SYSSTATUS  0x014
 #define MAILBOX_MESSAGE(m) (0x040 + 4 * (m))
 #define MAILBOX_FIFOSTATUS(m)  (0x080 + 4 * (m))
 #define MAILBOX_MSGSTATUS(m)   (0x0c0 + 4 * (m))
+
+#ifdef CONFIG_ARCH_OMAP4
+#define MAILBOX_IRQSTATUS(u)   (0x104 + 10 * (u))
+#define MAILBOX_IRQENABLE(u)   (0x108 + 10 * (u))
+#define MAILBOX_IRQENABLE_CLR(u)   (0x10c + 10 * (u))
+#else
 #define MAILBOX_IRQSTATUS(u)   (0x100 + 8 * (u))
 #define MAILBOX_IRQENABLE(u)   (0x104 + 8 * (u))
+#endif
 
-#define MAILBOX_IRQ_NEWMSG(u)  (1  (2 * (u)))
-#define MAILBOX_IRQ_NOTFULL(u) (1  (2 * (u) + 1))
+#define MAILBOX_IRQ_NEWMSG(m)  (1  (2 * (m)))
+#define MAILBOX_IRQ_NOTFULL(m) (1  (2 * (m) + 1))
 
+#ifdef CONFIG_ARCH_OMAP4
+#define MBOX_REG_SIZE  0x130
+#else
 #define MBOX_REG_SIZE  0x120
+#endif
+
 #define MBOX_NR_REGS   (MBOX_REG_SIZE / sizeof(u32))
 
+
 static void __iomem *mbox_base;
 
 struct omap_mbox2_fifo {
@@ -49,6 +64,9 @@ struct omap_mbox2_priv {
u32 newmsg_bit;
u32 notfull_bit;
u32 ctx[MBOX_NR_REGS];
+#ifdef CONFIG_ARCH_OMAP4
+   unsigned long irqdisable;
+#endif
 };
 
 static struct clk *mbox_ick_handle;
@@ -70,10 +88,9 @@ static inline void mbox_write_reg(u32 val, size_t ofs)
 static int omap2_mbox_startup(struct omap_mbox *mbox)
 {
unsigned int l;
-
mbox_ick_handle = clk_get(NULL, mailboxes_ick);
if (IS_ERR(mbox_ick_handle)) {
-   printk(Could not get mailboxes_ick\n);
+   printk(KERN_ERR Could not get mailboxes_ick\n);
return -ENODEV;
}
clk_enable(mbox_ick_handle);
@@ -85,7 +102,6 @@ static int omap2_mbox_startup(struct omap_mbox *mbox)
l = mbox_read_reg(MAILBOX_SYSCONFIG);
l |= 0x0011;
mbox_write_reg(l, MAILBOX_SYSCONFIG);
-
omap2_mbox_enable_irq(mbox, IRQ_RX);
 
return 0;
@@ -95,6 +111,7 @@ static void omap2_mbox_shutdown(struct omap_mbox *mbox)
 {
clk_disable(mbox_ick_handle);
clk_put(mbox_ick_handle);
+   mbox_ick_handle = NULL;
 }
 
 /* Mailbox FIFO handle functions */
@@ -123,7 +140,7 @@ static int omap2_mbox_fifo_full(struct omap_mbox *mbox)
 {
struct omap_mbox2_fifo *fifo =
((struct omap_mbox2_priv *)mbox-priv)-tx_fifo;
-   return (mbox_read_reg(fifo-fifo_stat));
+   return mbox_read_reg(fifo-fifo_stat);
 }
 
 /* Mailbox IRQ handle functions */
@@ -143,10 +160,9 @@ static void omap2_mbox_disable_irq(struct omap_mbox *mbox,
 {
struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox-priv;
u32 l, bit = (irq == IRQ_TX) ? p-notfull_bit : p-newmsg_bit;
-
-   l = mbox_read_reg(p-irqenable);
+   l = mbox_read_reg(p-irqdisable);
l = ~bit;
-   mbox_write_reg(l, p-irqenable);
+   mbox_write_reg(l, p-irqdisable);
 }
 
 static void omap2_mbox_ack_irq(struct omap_mbox *mbox,
@@ -156,6 +172,8 @@ static void omap2_mbox_ack_irq(struct omap_mbox *mbox,
u32 bit = (irq == IRQ_TX) ? p-notfull_bit : p-newmsg_bit;
 
mbox_write_reg(bit, p-irqstatus);
+   /* Flush post writing */
+mbox_read_reg(p-irqstatus);
 }
 
 static int omap2_mbox_is_irq(struct omap_mbox *mbox,
@@ -166,7 +184,7 @@ static int omap2_mbox_is_irq(struct omap_mbox *mbox,
u32 enable = mbox_read_reg(p-irqenable);
u32 status = mbox_read_reg(p-irqstatus);
 
-   return (enable  status  bit);
+   return (int)(enable  status  bit);
 }
 
 static void omap2_mbox_save_ctx(struct omap_mbox *mbox)
@@ -219,9 +237,12 @@ static struct omap_mbox_ops omap2_mbox_ops = {
  */
 
 /* FIXME: the following structs should be filled automatically by the user id 
*/
-
+#ifdef CONFIG_ARCH_OMAP4
+static struct omap_mbox2_priv omap2_mbox_1_priv = {
+#else
 /* DSP */
 static struct omap_mbox2_priv omap2_mbox_dsp_priv = {

[PATCH 9/10] omap mailbox: OMAP4 Mailbox Patch to change the IRQ flag from IRQF_DISABLED to IRQF_SHARED

2009-09-22 Thread C.A, Subramaniam
From 96827a1faf75893646b459bd3c0b7e9453376bb2 Mon Sep 17 00:00:00 2001
From: C A Subramaniam subramaniam...@ti.com
Date: Tue, 8 Sep 2009 22:40:16 +0530
Subject: [PATCH 9/10] omap mailbox: OMAP4 Mailbox Patch to change the IRQ flag 
from IRQF_DISABLED to IRQF_SHARED

Currently, this facilitates both the tesla and ducati
sides to request for the same irq through an
omap_mbox_get() call.

Signed-off-by: C A Subramaniam subramaniam...@ti.com
Signed-off-by: Ramesh Gupta G grgu...@ti.com
---
 arch/arm/plat-omap/mailbox.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 72ea119..3ab3f0d 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -284,7 +284,7 @@ static int omap_mbox_startup(struct omap_mbox *mbox)
write_unlock(mboxes_lock);
}
 
-   ret = request_irq(mbox-irq, mbox_interrupt, IRQF_DISABLED,
+   ret = request_irq(mbox-irq, mbox_interrupt, IRQF_SHARED,
mbox-name, mbox);
if (unlikely(ret)) {
printk(KERN_ERR
-- 
1.5.3.2
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/10] omap mailbox: OMAP4 Mailbox-driver Patch to support tasklet

2009-09-22 Thread C.A, Subramaniam
From f2ba2415d17a9bf2adc9f1240ff21e17e639b2bf Mon Sep 17 00:00:00 2001
From: C A Subramaniam subramaniam...@ti.com
Date: Thu, 17 Sep 2009 22:01:33 +0530
Subject: [PATCH 10/10] omap mailbox: OMAP4 Mailbox-driver Patch to support 
tasklet
 implementation

This patch uses a tasklet implementation for
sending mailbox messages.

Signed-off-by: C A Subramaniam subramaniam...@ti.com
Signed-off-by: Ramesh Gupta G grgu...@ti.com
Signed-off-by: Hiroshi DOYU hiroshi.d...@nokia.com
---
 arch/arm/plat-omap/include/mach/mailbox.h |8 +++-
 arch/arm/plat-omap/mailbox.c  |   59 
 2 files changed, 23 insertions(+), 44 deletions(-)

diff --git a/arch/arm/plat-omap/include/mach/mailbox.h 
b/arch/arm/plat-omap/include/mach/mailbox.h
index bf06953..729166b 100644
--- a/arch/arm/plat-omap/include/mach/mailbox.h
+++ b/arch/arm/plat-omap/include/mach/mailbox.h
@@ -6,6 +6,7 @@
 #include linux/wait.h
 #include linux/workqueue.h
 #include linux/blkdev.h
+#include linux/interrupt.h
 
 typedef u32 mbox_msg_t;
 struct omap_mbox;
@@ -28,8 +29,10 @@ struct omap_mbox_ops {
int (*fifo_empty)(struct omap_mbox *mbox);
int (*fifo_full)(struct omap_mbox *mbox);
/* irq */
-   void(*enable_irq)(struct omap_mbox *mbox, omap_mbox_irq_t 
irq);
-   void(*disable_irq)(struct omap_mbox *mbox, omap_mbox_irq_t 
irq);
+   void(*enable_irq)(struct omap_mbox *mbox,
+   omap_mbox_irq_t irq);
+   void(*disable_irq)(struct omap_mbox *mbox,
+   omap_mbox_irq_t irq);
void(*ack_irq)(struct omap_mbox *mbox, omap_mbox_irq_t irq);
int (*is_irq)(struct omap_mbox *mbox, omap_mbox_irq_t irq);
/* ctx */
@@ -41,6 +44,7 @@ struct omap_mbox_queue {
spinlock_t  lock;
struct request_queue*queue;
struct work_struct  work;
+   struct tasklet_struct   tasklet;
int (*callback)(void *);
struct omap_mbox*mbox;
 };
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 3ab3f0d..55facda 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -80,74 +80,45 @@ static int __mbox_msg_send(struct omap_mbox *mbox, 
mbox_msg_t msg)
return ret;
 }
 
-struct omap_msg_tx_data {
-   mbox_msg_t  msg;
-};
-
-static void omap_msg_tx_end_io(struct request *rq, int error)
-{
-   kfree(rq-special);
-   __blk_put_request(rq-q, rq);
-}
 
 int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg)
 {
-   struct omap_msg_tx_data *tx_data;
+
struct request *rq;
struct request_queue *q = mbox-txq-queue;
 
-   tx_data = kmalloc(sizeof(*tx_data), GFP_ATOMIC);
-   if (unlikely(!tx_data))
-   return -ENOMEM;
-
rq = blk_get_request(q, WRITE, GFP_ATOMIC);
-   if (unlikely(!rq)) {
-   kfree(tx_data);
+   if (unlikely(!rq))
return -ENOMEM;
-   }
 
-   tx_data-msg = msg;
-   rq-end_io = omap_msg_tx_end_io;
-   blk_insert_request(q, rq, 0, tx_data);
+   blk_insert_request(q, rq, 0, (void *) msg);
+   tasklet_schedule(mbox-txq-tasklet);
 
-   schedule_work(mbox-txq-work);
return 0;
 }
 EXPORT_SYMBOL(omap_mbox_msg_send);
 
-static void mbox_tx_work(struct work_struct *work)
+static void mbox_tx_tasklet(unsigned long tx_data)
 {
int ret;
struct request *rq;
-   struct omap_mbox_queue *mq = container_of(work,
-   struct omap_mbox_queue, work);
-   struct omap_mbox *mbox = mq-queue-queuedata;
+   struct omap_mbox *mbox = (struct omap_mbox *)tx_data;
struct request_queue *q = mbox-txq-queue;
 
while (1) {
-   struct omap_msg_tx_data *tx_data;
 
-   spin_lock(q-queue_lock);
rq = blk_fetch_request(q);
-   spin_unlock(q-queue_lock);
 
if (!rq)
break;
 
-   tx_data = rq-special;
-
-   ret = __mbox_msg_send(mbox, tx_data-msg);
+   ret = __mbox_msg_send(mbox, (mbox_msg_t)rq-special);
if (ret) {
omap_mbox_enable_irq(mbox, IRQ_TX);
-   spin_lock(q-queue_lock);
blk_requeue_request(q, rq);
-   spin_unlock(q-queue_lock);
return;
}
-
-   spin_lock(q-queue_lock);
-   __blk_end_request_all(rq, 0);
-   spin_unlock(q-queue_lock);
+   blk_end_request_all(rq, 0);
}
 }
 
@@ -192,7 +163,7 @@ static void __mbox_tx_interrupt(struct omap_mbox *mbox)
 {
omap_mbox_disable_irq(mbox, IRQ_TX);
ack_mbox_irq(mbox, IRQ_TX);
-   schedule_work(mbox-txq-work);
+   

RE: [PATCH 10/10] omap mailbox: OMAP4 Mailbox-driver Patch to support tasklet implementation

2009-09-14 Thread C.A, Subramaniam
Hi Hiroshi,
Sorry for the delayed response. 

 -Original Message-
 From: Hiroshi DOYU [mailto:hiroshi.d...@nokia.com] 
 Sent: Thursday, September 10, 2009 5:59 PM
 To: C.A, Subramaniam
 Cc: linux-omap@vger.kernel.org; t...@atomide.com; 
 r...@arm.linux.org.uk; Kanigeri, Hari; Gupta, Ramesh
 Subject: Re: [PATCH 10/10] omap mailbox: OMAP4 Mailbox-driver 
 Patch to support tasklet implementation
 
 From: ext C.A, Subramaniam subramaniam...@ti.com
 Subject: RE: [PATCH 10/10] omap mailbox: OMAP4 Mailbox-driver 
 Patch to support tasklet implementation
 Date: Thu, 10 Sep 2009 13:46:53 +0200
 
  
   
  Hi Hiroshi,
  
   -Original Message-
   From: Hiroshi DOYU [mailto:hiroshi.d...@nokia.com]
   Sent: Wednesday, September 09, 2009 2:32 PM
   To: C.A, Subramaniam
   Cc: linux-omap@vger.kernel.org; t...@atomide.com; 
   r...@arm.linux.org.uk; Kanigeri, Hari; Gupta, Ramesh
   Subject: Re: [PATCH 10/10] omap mailbox: OMAP4 
 Mailbox-driver Patch 
   to support tasklet implementation
   
   Hi Subbu,
   
   From: ext C.A, Subramaniam subramaniam...@ti.com
   Subject: RE: [PATCH 10/10] omap mailbox: OMAP4 
 Mailbox-driver Patch 
   to support tasklet implementation
   Date: Tue, 8 Sep 2009 19:43:48 +0200
   
   [...]
   
 As I described in the comment on [PATCH 8/10], I think
   that it would
 be better to keep mach-omap2/mailbox.c simple and 
 to add some 
 additional logic on plat-omap/mailbox.c.
 
 Would it be possbile to move this tasklet implementation to 
 plat-omap/mailbox.c?

The implementation of the tasklet itself is maintained in 
plat-omap/mailbox.c Since, I wanted to maintain a separate
   tasklet for
each mailbox instance used to send messages from MPU, I had to 
associate the the tasklet to the mailbox. Hence, the
   changes were done
in mach-omap2/mailbox.c

Please give your comments on this approach.
   
   Wouldn't just converting work_queue to tasklet work like below?
   
   (I havne't tested this at all, though...)
   
   diff --git a/arch/arm/plat-omap/include/mach/mailbox.h
   b/arch/arm/plat-omap/include/mach/mailbox.h
   index b7a6991..1f4e53e 100644
   --- a/arch/arm/plat-omap/include/mach/mailbox.h
   +++ b/arch/arm/plat-omap/include/mach/mailbox.h
   @@ -52,6 +52,8 @@ struct omap_mbox {

 struct omap_mbox_queue  *txq, *rxq;

   + struct tasklet_struct   tx_tasklet;
   +
 struct omap_mbox_ops*ops;

 mbox_msg_t  seq_snd, seq_rcv;
  
  Moved the tasklet structure to the omap_mbox_queue as follows:
 
 This is better.
 
  
  @@ -40,7 +43,8 @@ struct omap_mbox_ops {  struct omap_mbox_queue {
  spinlock_t  lock;
  struct request_queue*queue;
  -   struct work_struct  work;
  +   struct work_struct  rx_work;
  +   struct tasklet_struct   tx_tasklet;
  int (*callback)(void *);
  struct omap_mbox*mbox;
   };
 
 
 I think that rx_/tx_ prefix may not be necessary if you add 
 tasklet feature in omap_mbox_queue as followed since 
 omap_mbox_queue can be considered as s/w queue which can 
 evoke workqueue/tasklet accordingly.
 
 
 + struct work_struct  work;
 + struct tasklet_struct   tasklet;
   int (*callback)(void *);
   struct omap_mbox*mbox;
  };

This is fine. Will remove rx_ and tx_ prefix.
 
 
  
  Also chagned the omap_mbox_msg_send(). Removed the struct 
 omap_msg_tx_data.
  
   
   int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg)  {
  -   struct omap_msg_tx_data *tx_data;
  +
  struct request *rq;
  struct request_queue *q = mbox-txq-queue;
   
  -   tx_data = kmalloc(sizeof(*tx_data), GFP_ATOMIC);
  -   if (unlikely(!tx_data))
  -   return -ENOMEM;
  -
  rq = blk_get_request(q, WRITE, GFP_ATOMIC);
  -   if (unlikely(!rq)) {
  -   kfree(tx_data);
  +   if (unlikely(!rq))
  return -ENOMEM;
  -   }
   
  -   tx_data-msg = msg;
  -   rq-end_io = omap_msg_tx_end_io;
  -   blk_insert_request(q, rq, 0, tx_data);
  +   blk_insert_request(q, rq, 0, (void *) msg);
  +   tasklet_schedule(mbox-txq-tx_tasklet);
   
  -   schedule_work(mbox-txq-work);
  return 0;
   }
   EXPORT_SYMBOL(omap_mbox_msg_send);
  
   diff --git a/arch/arm/plat-omap/mailbox.c 
   b/arch/arm/plat-omap/mailbox.c index 40424ed..37267ca 100644
   --- a/arch/arm/plat-omap/mailbox.c
   +++ b/arch/arm/plat-omap/mailbox.c
   @@ -184,22 +184,17 @@ int omap_mbox_msg_send(struct 
 omap_mbox *mbox, 
   mbox_msg_t msg, void* arg)  } EXPORT_SYMBOL(omap_mbox_msg_send);

   -static void mbox_tx_work(struct work_struct *work)
   +static void mbox_tx_tasklet(unsigned long data)
{
 int ret;
 struct request *rq;
   - struct omap_mbox_queue *mq = container_of(work,
   - struct omap_mbox_queue, work);
   - struct omap_mbox *mbox = mq-queue-queuedata;
   + struct omap_mbox *mbox = (struct omap_mbox *)data;
 struct request_queue *q = mbox-txq-queue

RE: [PATCH 10/10] omap mailbox: OMAP4 Mailbox-driver Patch to support tasklet implementation

2009-09-10 Thread C.A, Subramaniam
 
Hi Hiroshi,

 -Original Message-
 From: Hiroshi DOYU [mailto:hiroshi.d...@nokia.com] 
 Sent: Wednesday, September 09, 2009 2:32 PM
 To: C.A, Subramaniam
 Cc: linux-omap@vger.kernel.org; t...@atomide.com; 
 r...@arm.linux.org.uk; Kanigeri, Hari; Gupta, Ramesh
 Subject: Re: [PATCH 10/10] omap mailbox: OMAP4 Mailbox-driver 
 Patch to support tasklet implementation
 
 Hi Subbu,
 
 From: ext C.A, Subramaniam subramaniam...@ti.com
 Subject: RE: [PATCH 10/10] omap mailbox: OMAP4 Mailbox-driver 
 Patch to support tasklet implementation
 Date: Tue, 8 Sep 2009 19:43:48 +0200
 
 [...]
 
   As I described in the comment on [PATCH 8/10], I think 
 that it would 
   be better to keep mach-omap2/mailbox.c simple and to add some 
   additional logic on plat-omap/mailbox.c.
   
   Would it be possbile to move this tasklet implementation to 
   plat-omap/mailbox.c?
  
  The implementation of the tasklet itself is maintained in 
  plat-omap/mailbox.c Since, I wanted to maintain a separate 
 tasklet for 
  each mailbox instance used to send messages from MPU, I had to 
  associate the the tasklet to the mailbox. Hence, the 
 changes were done 
  in mach-omap2/mailbox.c
  
  Please give your comments on this approach.
 
 Wouldn't just converting work_queue to tasklet work like below?
 
 (I havne't tested this at all, though...)
 
 diff --git a/arch/arm/plat-omap/include/mach/mailbox.h 
 b/arch/arm/plat-omap/include/mach/mailbox.h
 index b7a6991..1f4e53e 100644
 --- a/arch/arm/plat-omap/include/mach/mailbox.h
 +++ b/arch/arm/plat-omap/include/mach/mailbox.h
 @@ -52,6 +52,8 @@ struct omap_mbox {
  
   struct omap_mbox_queue  *txq, *rxq;
  
 + struct tasklet_struct   tx_tasklet;
 +
   struct omap_mbox_ops*ops;
  
   mbox_msg_t  seq_snd, seq_rcv;

Moved the tasklet structure to the omap_mbox_queue as follows:

@@ -40,7 +43,8 @@ struct omap_mbox_ops {
 struct omap_mbox_queue {
spinlock_t  lock;
struct request_queue*queue;
-   struct work_struct  work;
+   struct work_struct  rx_work;
+   struct tasklet_struct   tx_tasklet;
int (*callback)(void *);
struct omap_mbox*mbox;
 };

Also chagned the omap_mbox_msg_send(). Removed the struct omap_msg_tx_data.

 
 int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg)
 {
-   struct omap_msg_tx_data *tx_data;
+
struct request *rq;
struct request_queue *q = mbox-txq-queue;
 
-   tx_data = kmalloc(sizeof(*tx_data), GFP_ATOMIC);
-   if (unlikely(!tx_data))
-   return -ENOMEM;
-
rq = blk_get_request(q, WRITE, GFP_ATOMIC);
-   if (unlikely(!rq)) {
-   kfree(tx_data);
+   if (unlikely(!rq))
return -ENOMEM;
-   }
 
-   tx_data-msg = msg;
-   rq-end_io = omap_msg_tx_end_io;
-   blk_insert_request(q, rq, 0, tx_data);
+   blk_insert_request(q, rq, 0, (void *) msg);
+   tasklet_schedule(mbox-txq-tx_tasklet);
 
-   schedule_work(mbox-txq-work);
return 0;
 }
 EXPORT_SYMBOL(omap_mbox_msg_send);

 diff --git a/arch/arm/plat-omap/mailbox.c 
 b/arch/arm/plat-omap/mailbox.c index 40424ed..37267ca 100644
 --- a/arch/arm/plat-omap/mailbox.c
 +++ b/arch/arm/plat-omap/mailbox.c
 @@ -184,22 +184,17 @@ int omap_mbox_msg_send(struct omap_mbox 
 *mbox, mbox_msg_t msg, void* arg)  }  
 EXPORT_SYMBOL(omap_mbox_msg_send);
  
 -static void mbox_tx_work(struct work_struct *work)
 +static void mbox_tx_tasklet(unsigned long data)
  {
   int ret;
   struct request *rq;
 - struct omap_mbox_queue *mq = container_of(work,
 - struct omap_mbox_queue, work);
 - struct omap_mbox *mbox = mq-queue-queuedata;
 + struct omap_mbox *mbox = (struct omap_mbox *)data;
   struct request_queue *q = mbox-txq-queue;
  
   while (1) {
   struct omap_msg_tx_data *tx_data;
  
 - spin_lock(q-queue_lock);
   rq = blk_fetch_request(q);
 - spin_unlock(q-queue_lock);
 -
   if (!rq)
   break;
  
 @@ -208,15 +203,10 @@ static void mbox_tx_work(struct 
 work_struct *work)
   ret = __mbox_msg_send(mbox, tx_data-msg, tx_data-arg);
   if (ret) {
   enable_mbox_irq(mbox, IRQ_TX);
 - spin_lock(q-queue_lock);
   blk_requeue_request(q, rq);
 - spin_unlock(q-queue_lock);
   return;
   }
 -
 - spin_lock(q-queue_lock);
   __blk_end_request_all(rq, 0);
 - spin_unlock(q-queue_lock);
   }
  }
  

Changed the mbox_tx_tasklet as follows:

-static void mbox_tx_work(struct work_struct *work)
+static void mbox_tx_tasklet(unsigned long tx_data)
 {
int ret;
struct request *rq;
-   struct omap_mbox_queue *mq = container_of(work,
-   struct omap_mbox_queue, work);
-   struct

RE: [PATCH 10/10] omap mailbox: OMAP4 Mailbox-driver Patch to support tasklet implementation

2009-09-09 Thread C.A, Subramaniam
 Hi Hiroshi,

 -Original Message-
 From: Hiroshi DOYU [mailto:hiroshi.d...@nokia.com] 
 Sent: Wednesday, September 09, 2009 2:32 PM
 To: C.A, Subramaniam
 Cc: linux-omap@vger.kernel.org; t...@atomide.com; 
 r...@arm.linux.org.uk; Kanigeri, Hari; Gupta, Ramesh
 Subject: Re: [PATCH 10/10] omap mailbox: OMAP4 Mailbox-driver 
 Patch to support tasklet implementation
 
 Hi Subbu,
 
 From: ext C.A, Subramaniam subramaniam...@ti.com
 Subject: RE: [PATCH 10/10] omap mailbox: OMAP4 Mailbox-driver 
 Patch to support tasklet implementation
 Date: Tue, 8 Sep 2009 19:43:48 +0200
 
 [...]
 
   As I described in the comment on [PATCH 8/10], I think 
 that it would 
   be better to keep mach-omap2/mailbox.c simple and to add some 
   additional logic on plat-omap/mailbox.c.
   
   Would it be possbile to move this tasklet implementation to 
   plat-omap/mailbox.c?
  
  The implementation of the tasklet itself is maintained in 
  plat-omap/mailbox.c Since, I wanted to maintain a separate 
 tasklet for 
  each mailbox instance used to send messages from MPU, I had to 
  associate the the tasklet to the mailbox. Hence, the 
 changes were done 
  in mach-omap2/mailbox.c
  
  Please give your comments on this approach.
 
 Wouldn't just converting work_queue to tasklet work like below?
 
 (I havne't tested this at all, though...)
I will try that out and let you know. Also your approach seems better
as you are replacing the work queue implementaion as well.  
 
 diff --git a/arch/arm/plat-omap/include/mach/mailbox.h 
 b/arch/arm/plat-omap/include/mach/mailbox.h
 index b7a6991..1f4e53e 100644
 --- a/arch/arm/plat-omap/include/mach/mailbox.h
 +++ b/arch/arm/plat-omap/include/mach/mailbox.h
 @@ -52,6 +52,8 @@ struct omap_mbox {
  
   struct omap_mbox_queue  *txq, *rxq;
  
 + struct tasklet_struct   tx_tasklet;
 +
   struct omap_mbox_ops*ops;
  
   mbox_msg_t  seq_snd, seq_rcv;
 diff --git a/arch/arm/plat-omap/mailbox.c 
 b/arch/arm/plat-omap/mailbox.c index 40424ed..37267ca 100644
 --- a/arch/arm/plat-omap/mailbox.c
 +++ b/arch/arm/plat-omap/mailbox.c
 @@ -184,22 +184,17 @@ int omap_mbox_msg_send(struct omap_mbox 
 *mbox, mbox_msg_t msg, void* arg)  }  
 EXPORT_SYMBOL(omap_mbox_msg_send);
  
 -static void mbox_tx_work(struct work_struct *work)
 +static void mbox_tx_tasklet(unsigned long data)
  {
   int ret;
   struct request *rq;
 - struct omap_mbox_queue *mq = container_of(work,
 - struct omap_mbox_queue, work);
 - struct omap_mbox *mbox = mq-queue-queuedata;
 + struct omap_mbox *mbox = (struct omap_mbox *)data;
   struct request_queue *q = mbox-txq-queue;
  
   while (1) {
   struct omap_msg_tx_data *tx_data;
  
 - spin_lock(q-queue_lock);
   rq = blk_fetch_request(q);
 - spin_unlock(q-queue_lock);
 -
   if (!rq)
   break;
  
 @@ -208,15 +203,10 @@ static void mbox_tx_work(struct 
 work_struct *work)
   ret = __mbox_msg_send(mbox, tx_data-msg, tx_data-arg);
   if (ret) {
   enable_mbox_irq(mbox, IRQ_TX);
 - spin_lock(q-queue_lock);
   blk_requeue_request(q, rq);
 - spin_unlock(q-queue_lock);
   return;
   }
 -
 - spin_lock(q-queue_lock);
   __blk_end_request_all(rq, 0);
 - spin_unlock(q-queue_lock);
   }
  }
  
 @@ -266,7 +256,7 @@ static void __mbox_tx_interrupt(struct 
 omap_mbox *mbox)  {
   disable_mbox_irq(mbox, IRQ_TX);
   ack_mbox_irq(mbox, IRQ_TX);
 - schedule_work(mbox-txq-work);
 + tasklet_schedule(mbox-tx_tasklet);
  }
  
  static void __mbox_rx_interrupt(struct omap_mbox *mbox) @@ 
 -434,7 +424,9 @@ static int omap_mbox_init(struct omap_mbox *mbox)
   goto fail_request_irq;
   }
  
 - mq = mbox_queue_alloc(mbox, mbox_txq_fn, mbox_tx_work);
 + tasklet_init(mbox-tx_tasklet, mbox_tx_tasklet, 
 (unsigned long)mbox);
 +
 + mq = mbox_queue_alloc(mbox, mbox_txq_fn, NULL);
   if (!mq) {
   ret = -ENOMEM;
   goto fail_alloc_txq;
 
 --
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 10/10] omap mailbox: OMAP4 Mailbox-driver Patch to support tasklet implementation

2009-09-08 Thread C.A, Subramaniam
Hi Hiroshi, 

 -Original Message-
 From: Hiroshi DOYU [mailto:hiroshi.d...@nokia.com] 
 Sent: Monday, September 07, 2009 2:20 PM
 To: C.A, Subramaniam
 Cc: linux-omap@vger.kernel.org; t...@atomide.com; 
 r...@arm.linux.org.uk; Kanigeri, Hari; Gupta, Ramesh
 Subject: Re: [PATCH 10/10] omap mailbox: OMAP4 Mailbox-driver 
 Patch to support tasklet implementation
 
 From: ext C.A, Subramaniam subramaniam...@ti.com
 Subject: [PATCH 10/10] omap mailbox: OMAP4 Mailbox-driver 
 Patch to support tasklet implementation
 Date: Fri, 4 Sep 2009 13:48:45 +0200
 
  From e759173e77f73fabce5177b4f685df20b16c6922 Mon Sep 17 
 00:00:00 2001
  From: C A Subramaniam subramaniam...@ti.com
  Date: Thu, 3 Sep 2009 17:42:35 +0530
  Subject: [PATCH 10/10] omap mailbox: OMAP4 Mailbox-driver 
 Patch to support tasklet
 implementation
  
  This patch uses a tasklet implementation for sending 
 mailbox messages.
  
  Signed-off-by: C A Subramaniam subramaniam...@ti.com
  Signed-off-by: Ramesh Gupta G grgu...@ti.com
  ---
   arch/arm/mach-omap2/mailbox.c |   43 ++-
   arch/arm/plat-omap/include/mach/mailbox.h |   16 +-
   arch/arm/plat-omap/mailbox.c  |   80 
 ++---
   3 files changed, 81 insertions(+), 58 deletions(-)
  
  diff --git a/arch/arm/mach-omap2/mailbox.c 
  b/arch/arm/mach-omap2/mailbox.c index 52a1670..45aea98 100644
  --- a/arch/arm/mach-omap2/mailbox.c
  +++ b/arch/arm/mach-omap2/mailbox.c
  @@ -236,6 +237,17 @@ static struct omap_mbox_ops omap2_mbox_ops = {
  .restore_ctx= omap2_mbox_restore_ctx,
   };
   
  +
  +static struct omap_mbox_task omap_mbox_1_tasklet = {
  +   .arg= NULL,
  +};
  +
  +static struct omap_mbox_task omap_mbox_2_tasklet = {
  +   .arg= NULL,
  +};
 
 As I described in the comment on [PATCH 8/10], I think that 
 it would be better to keep mach-omap2/mailbox.c simple and 
 to add some additional logic on plat-omap/mailbox.c.
 
 Would it be possbile to move this tasklet implementation to 
 plat-omap/mailbox.c?

The implementation of the tasklet itself is maintained in plat-omap/mailbox.c
Since, I wanted to maintain a separate tasklet for each mailbox
instance used to send messages from MPU, I had to associate the the tasklet
to the mailbox. Hence, the changes were done in mach-omap2/mailbox.c

Please give your comments on this approach.

 
  +
  +
  +
   /*
* MAILBOX 0: ARM - DSP,
* MAILBOX 1: ARM - DSP.
  @@ -272,6 +284,7 @@ struct omap_mbox mbox_1_info = {
  .name   = mailbox-1,
  .ops= omap2_mbox_ops,
  .priv   = omap2_mbox_1_priv,
  +   .tx_tasklet = omap_mbox_1_tasklet,
   };
   EXPORT_SYMBOL(mbox_1_info);
   #else
  @@ -305,8 +318,10 @@ struct omap_mbox mbox_2_info = {
  .name   = mailbox-2,
  .ops= omap2_mbox_ops,
  .priv   = omap2_mbox_2_priv,
  +   .tx_tasklet = omap_mbox_2_tasklet,
   };
   EXPORT_SYMBOL(mbox_2_info);
  +
   #endif
   
   
  diff --git a/arch/arm/plat-omap/include/mach/mailbox.h 
  b/arch/arm/plat-omap/include/mach/mailbox.h
  index bf06953..5271345 100644
  --- a/arch/arm/plat-omap/include/mach/mailbox.h
  +++ b/arch/arm/plat-omap/include/mach/mailbox.h
  @@ -28,8 +28,10 @@ struct omap_mbox_ops {
  int (*fifo_empty)(struct omap_mbox *mbox);
  int (*fifo_full)(struct omap_mbox *mbox);
  /* irq */
  -   void(*enable_irq)(struct omap_mbox *mbox, 
 omap_mbox_irq_t irq);
  -   void(*disable_irq)(struct omap_mbox *mbox, 
 omap_mbox_irq_t irq);
  +   void(*enable_irq)(struct omap_mbox *mbox,
  +   omap_mbox_irq_t irq);
  +   void(*disable_irq)(struct omap_mbox *mbox,
  +   omap_mbox_irq_t irq);
  void(*ack_irq)(struct omap_mbox *mbox, 
 omap_mbox_irq_t irq);
  int (*is_irq)(struct omap_mbox *mbox, 
 omap_mbox_irq_t irq);
  /* ctx */
  @@ -45,12 +47,22 @@ struct omap_mbox_queue {
  struct omap_mbox*mbox;
   };
   
  +struct omap_mbox_task{
  +   spinlock_t  lock;
  +   struct tasklet_struct   *t;
  +   mbox_msg_t  msg;
  +   void*arg;
  +};
  +
  +
   struct omap_mbox {
  char*name;
  unsigned intirq;
   
  struct omap_mbox_queue  *txq, *rxq;
   
  +   struct omap_mbox_task   *tx_tasklet;
  +
  struct omap_mbox_ops*ops;
   
  mbox_msg_t  seq_snd, seq_rcv;
  diff --git a/arch/arm/plat-omap/mailbox.c 
  b/arch/arm/plat-omap/mailbox.c index 84cf6af..b5e53d4 100644
  --- a/arch/arm/plat-omap/mailbox.c
  +++ b/arch/arm/plat-omap/mailbox.c
  @@ -63,60 +63,49 @@ static inline int is_mbox_irq(struct omap_mbox 
  *mbox, omap_mbox_irq_t irq)
   /*
* message sender
*/
  -static int __mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg)
  +static void __mbox_msg_send(unsigned long tx)
   {
  +   struct omap_mbox_task *tx_data

RE: [PATCH 1/10] omap mailbox: OMAP4-Mailbox - Add build specific changes to support OMAP4 mailbox.

2009-09-07 Thread C.A, Subramaniam
Hi Hiroshi, 

 -Original Message-
 From: Hiroshi DOYU [mailto:hiroshi.d...@nokia.com] 
 Sent: Monday, September 07, 2009 2:03 PM
 To: C.A, Subramaniam
 Cc: linux-omap@vger.kernel.org; t...@atomide.com; 
 r...@arm.linux.org.uk; Kanigeri, Hari; Gupta, Ramesh
 Subject: Re: [PATCH 1/10] omap mailbox: OMAP4-Mailbox - Add 
 build specific changes to support OMAP4 mailbox.
 
 From: ext C.A, Subramaniam subramaniam...@ti.com
 Subject: RE: [PATCH 1/10] omap mailbox: OMAP4-Mailbox - Add 
 build specific changes to support OMAP4 mailbox.
 Date: Mon, 7 Sep 2009 10:27:22 +0200
 

Signed-off-by: C A Subramaniam subramaniam...@ti.com
Signed-off-by: Ramesh Gupta G grgu...@ti.com
---
 arch/arm/mach-omap2/Makefile |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/Makefile 
b/arch/arm/mach-omap2/Makefile index 735bae5..4bb426d 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -39,6 +39,10 @@ endif
 obj-$(CONFIG_ARCH_OMAP2)   += clock24xx.o
 obj-$(CONFIG_ARCH_OMAP3)   += clock34xx.o
 
+# MAILBOX
   
   I think that the above line is not necessary since the 
 module names 
   are enough self-explanatory, a little bit nitpicky, though
  
  I have followed the existing convention present in the 
 Makefile (Power management, clock framework,etc.) as follows:
  
  # Power Management
  ifeq ($(CONFIG_PM),y)
  obj-$(CONFIG_ARCH_OMAP2)+= pm24xx.o
  obj-$(CONFIG_ARCH_OMAP24XX) += sleep24xx.o
  obj-$(CONFIG_ARCH_OMAP3)+= pm34xx.o sleep34xx.o
  obj-$(CONFIG_PM_DEBUG)  += pm-debug.o
  endif
  
  # Clock framework
  obj-$(CONFIG_ARCH_OMAP2)+= clock24xx.o
  obj-$(CONFIG_ARCH_OMAP3)+= clock34xx.o
  
  Please let me know if you still believe that the line needs 
 to be removed.
 
 I understand that you followed kind of convention, but I 
 still think that these comments don't make so much sense 
 since these module names are apparently enough self-explanatory.
 
 

Sure! I can remove that. I will send a patch with the changes you had 
mentioned.--
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/10] omap mailbox: OMAP4 - Add resources and mailbox register base address for OMAP4 mailbox

2009-09-07 Thread C.A, Subramaniam
Hi Hiroshi, 

 -Original Message-
 From: Hiroshi DOYU [mailto:hiroshi.d...@nokia.com] 
 Sent: Saturday, September 05, 2009 3:06 PM
 To: C.A, Subramaniam
 Cc: linux-omap@vger.kernel.org; t...@atomide.com; 
 r...@arm.linux.org.uk; Kanigeri, Hari; Gupta, Ramesh
 Subject: Re: [PATCH 2/10] omap mailbox: OMAP4 - Add resources 
 and mailbox register base address for OMAP4 mailbox
 
 Hi Subramaniam,
 
 From: ext C.A, Subramaniam subramaniam...@ti.com
 Subject: [PATCH 2/10] omap mailbox: OMAP4 - Add resources and 
 mailbox register base address for OMAP4 mailbox
 Date: Fri, 4 Sep 2009 13:47:43 +0200
 
  From 80e74ada510bace7208d59c0f912f9b1077efb45 Mon Sep 17 
 00:00:00 2001
  From: C A Subramaniam subramaniam...@ti.com
  Date: Wed, 2 Sep 2009 17:58:57 +0530
  Subject: [PATCH 2/10] omap mailbox: OMAP4 - Add resources 
 and mailbox 
  register base address  for OMAP4 mailbox
  
  This patch adds resource information of mailbox driver for
  OMAP4 mailbox module. Register base address also added
  
  Signed-off-by: C A Subramaniam subramaniam...@ti.com
  Signed-off-by: Ramesh Gupta G grgu...@ti.com
  ---
   arch/arm/mach-omap2/devices.c  |   20 
 +++-
   arch/arm/plat-omap/include/mach/omap44xx.h |2 ++
   2 files changed, 21 insertions(+), 1 deletions(-)
  
  diff --git a/arch/arm/mach-omap2/devices.c 
  b/arch/arm/mach-omap2/devices.c index 894cc35..711ed6a 100644
  --- a/arch/arm/mach-omap2/devices.c
  +++ b/arch/arm/mach-omap2/devices.c
  @@ -136,8 +136,11 @@ static inline void omap_init_camera(void)
   
   #if defined(CONFIG_OMAP_MBOX_FWK) || 
  defined(CONFIG_OMAP_MBOX_FWK_MODULE)
   
  +#ifdef CONFIG_ARCH_OMAP4
  +#define MBOX_REG_SIZE   0x130
  +#else
   #define MBOX_REG_SIZE  0x120
  -
  +#endif
 
 I'm not sure if it is still valid or not to support multiple OMAP
 architecture(OMAP1/2/3/4?) with a single vmlinux binary, but 
 the above modification will break this feature.
 
 If it is still valid, I think that the above should be 
 modified, for example, with using embedded constant values, 
 like other device resources and the rousources should be 
 ifded'ed with architecture #:

I think it is better to #ifdef for each architecture like you have suggested.
 
 #ifdef CONFIG_ARCH_OMAP2
   static struct resource omap2_mbox_resources[] = {
   {
   .start  = OMAP24XX_MAILBOX_BASE,
   .end= OMAP24XX_MAILBOX_BASE + 
 OMAP2_MBOX_REG_SIZE - 1,
 #endif
 
 #ifdef CONFIG_ARCH_OMAP3
  @@ -166,6 +169,18 @@ static struct resource 
 omap3_mbox_resources[] = {
   },
   };
 #endif
 
 #ifdef CONFIG_ARCH_OMAP4
 
 #define OMAP4_MBOX_REG_SIZE   0x130
 
 static struct resource omap4_mbox_resources[] = {
   {
   .start  = OMAP44XX_MAILBOX_BASE,
   .end= OMAP44XX_MAILBOX_BASE + 
 OMAP4_MBOX_REG_SIZE - 1,
   .flags  = IORESOURCE_MEM,
   },
   {
   .start  = INT_44XX_MAIL_U0_MPU,
   .flags  = IORESOURCE_IRQ,
   },
 };
 #endif
 
  +
   static struct platform_device mbox_device = {
  .name   = omap2-mailbox,
  .id = -1,
  @@ -179,6 +194,9 @@ static inline void omap_init_mbox(void)
  } else if (cpu_is_omap3430()) {
  mbox_device.num_resources = 
 ARRAY_SIZE(omap3_mbox_resources);
  mbox_device.resource = omap3_mbox_resources;
  +   } else if (cpu_is_omap44xx()) {
  +   mbox_device.num_resources = 
 ARRAY_SIZE(omap4_mbox_resources);
  +   mbox_device.resource = omap4_mbox_resources;
  } else {
  pr_err(%s: platform not supported\n, __func__);
  return;
  diff --git a/arch/arm/plat-omap/include/mach/omap44xx.h 
  b/arch/arm/plat-omap/include/mach/omap44xx.h
  index 52f2f85..6a545d3 100644
  --- a/arch/arm/plat-omap/include/mach/omap44xx.h
  +++ b/arch/arm/plat-omap/include/mach/omap44xx.h
  @@ -44,5 +44,7 @@
   #define OMAP44XX_WKUPGEN_BASE  0x48281000
   #define OMAP44XX_VA_WKUPGEN_BASE   
 IO_ADDRESS(OMAP44XX_WKUPGEN_BASE)
   
  +#define OMAP44xx_MAILBOX_BASE  (L4_44XX_BASE + 0xF4000)
 
 From naming consistency, can the above be, OMAP44XX_MAILBOX_BASE ?
 

I agree. I will incoprporate this change and send a patch.

  +
   #endif /* __ASM_ARCH_OMAP44XX_H */
   
  --
  1.5.3.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 8/10] omap mailbox: OMAP4-Mailbox - Adds code changes to support OMAP4 mailbox.

2009-09-07 Thread C.A, Subramaniam
Hi Russell,
Yes, that needs to be taken care of. Hiroshi has suggested that we move this 
logic into the omap_mbox_get() function.
Will add code to protect from races conditions while making the change.

Thank you and Regards
Subbu


 -Original Message-
 From: Russell King [mailto:r...@arm.linux.org.uk] 
 Sent: Monday, September 07, 2009 8:35 PM
 To: C.A, Subramaniam
 Cc: linux-omap@vger.kernel.org; t...@atomide.com; 
 hiroshi.d...@nokia.com; Kanigeri, Hari; Gupta, Ramesh
 Subject: Re: [PATCH 8/10] omap mailbox: OMAP4-Mailbox - Adds 
 code changes to support OMAP4 mailbox.
 
 On Fri, Sep 04, 2009 at 05:18:11PM +0530, C.A, Subramaniam wrote:
  @@ -70,31 +89,37 @@ static inline void mbox_write_reg(u32 
 val, size_t 
  ofs)  static int omap2_mbox_startup(struct omap_mbox *mbox)  {
  unsigned int l;
  +   if (!mbox_configured) {
  +   mbox_ick_handle = clk_get(NULL, mailboxes_ick);
  +   if (IS_ERR(mbox_ick_handle)) {
  +   printk(KERN_ERR Could not get 
 mailboxes_ick\n);
  +   return -ENODEV;
  +   }
  +   clk_enable(mbox_ick_handle);
   
  -   mbox_ick_handle = clk_get(NULL, mailboxes_ick);
  -   if (IS_ERR(mbox_ick_handle)) {
  -   printk(Could not get mailboxes_ick\n);
  -   return -ENODEV;
  -   }
  -   clk_enable(mbox_ick_handle);
  -
  -   l = mbox_read_reg(MAILBOX_REVISION);
  -   pr_info(omap mailbox rev %d.%d\n, (l  0xf0)  4, (l 
  0x0f));
  -
  -   /* set smart-idle  autoidle */
  -   l = mbox_read_reg(MAILBOX_SYSCONFIG);
  -   l |= 0x0011;
  -   mbox_write_reg(l, MAILBOX_SYSCONFIG);
  +   l = mbox_read_reg(MAILBOX_REVISION);
  +   pr_info(omap mailbox rev %d.%d\n, (l  0xf0)  4,
  +   (l  0x0f));
   
  +   /* set smart-idle  autoidle */
  +   l = mbox_read_reg(MAILBOX_SYSCONFIG);
  +   l |= 0x0011;
  +   mbox_write_reg(l, MAILBOX_SYSCONFIG);
  +   }
  +   mbox_configured++;
 
 I assume you're doing this because this function can be 
 called multiple times.  What protects this against races?
 
  omap2_mbox_enable_irq(mbox, IRQ_RX);
   
  return 0;
   }
   
   static void omap2_mbox_shutdown(struct omap_mbox *mbox) -{
  -   clk_disable(mbox_ick_handle);
  -   clk_put(mbox_ick_handle);
  +{  if (mbox_configured  0)
  +   mbox_configured--;
  +   if (!mbox_configured) {
  +   clk_disable(mbox_ick_handle);
  +   clk_put(mbox_ick_handle);
  +   mbox_ick_handle = NULL;
  +   }
 
 Same concern - what protects mbox_configured and the 
 associated code against races?
 
 --
 Russell King
  Linux kernel2.6 ARM Linux   - http://www.arm.linux.org.uk/
  maintainer of:
 
 --
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 6/10] omap mailbox: remove unnecessary arg for omap_mbox_msg_send

2009-09-07 Thread C.A, Subramaniam
Hi Russell,
'arg' is used later in Patch 10, as part of the tasklet implementation, for 
writing messages to the mailbox. Should I be removing it in patch 6 and 
introduce it only for the tasklet implementation?

Thank you and regards
Subbu 

 -Original Message-
 From: Russell King [mailto:r...@arm.linux.org.uk] 
 Sent: Monday, September 07, 2009 8:33 PM
 To: C.A, Subramaniam
 Cc: linux-omap@vger.kernel.org; t...@atomide.com; 
 hiroshi.d...@nokia.com; Kanigeri, Hari; Gupta, Ramesh
 Subject: Re: [PATCH 6/10] omap mailbox: remove unnecessary 
 arg for omap_mbox_msg_send
 
 On Fri, Sep 04, 2009 at 05:18:04PM +0530, C.A, Subramaniam wrote:
  @@ -114,7 +114,6 @@ int omap_mbox_msg_send(struct omap_mbox 
 *mbox, mbox_msg_t msg, void* arg)
  }
   
  tx_data-msg = msg;
  -   tx_data-arg = arg;
 
 What about also removing 'arg' from struct omap_msg_tx_data ?
 
 --
 Russell King
  Linux kernel2.6 ARM Linux   - http://www.arm.linux.org.uk/
  maintainer of:
 
 --
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 6/10] omap mailbox: remove unnecessary arg for omap_mbox_msg_send

2009-09-07 Thread C.A, Subramaniam
 Santhosh,

 -Original Message-
 From: Shilimkar, Santosh 
 Sent: Monday, September 07, 2009 9:08 PM
 To: C.A, Subramaniam; Russell King
 Cc: linux-omap@vger.kernel.org; t...@atomide.com; 
 hiroshi.d...@nokia.com; Kanigeri, Hari; Gupta, Ramesh
 Subject: RE: [PATCH 6/10] omap mailbox: remove unnecessary 
 arg for omap_mbox_msg_send
 
 Subbu,
  -Original Message-
  From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap- 
  ow...@vger.kernel.org] On Behalf Of C.A, Subramaniam
  Sent: Monday, September 07, 2009 9:03 PM
  To: Russell King
  Cc: linux-omap@vger.kernel.org; t...@atomide.com; 
  hiroshi.d...@nokia.com; Kanigeri, Hari; Gupta, Ramesh
  Subject: RE: [PATCH 6/10] omap mailbox: remove unnecessary arg for 
  omap_mbox_msg_send
  
  Hi Russell,
  'arg' is used later in Patch 10, as part of the tasklet 
  implementation, for writing messages to the mailbox. Should I be 
  removing it in patch 6 and introduce it only for the 
 tasklet implementation?
  
 
  Avoid top posting !!
 
Thank you for pointing that out. Sorry for the confusion!

Thank you and Regards
Subbu--
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/10] omap mailbox: Adding OMAP4 support

2009-09-04 Thread C.A, Subramaniam
Hi All,
This is the series of patches adding OMAP4 support for omap mailbox driver. The 
patches are generated against tag (2.6.31-rc5). Functionality has been tested 
in OMAP4430. These patches also include various cleanup done in the omap 
mailbox.

File modified:

arch/arm/mach-omap2/Makefile
arch/arm/mach-omap2/devices.c
arch/arm/plat-omap/include/mach/omap44xx.h
arch/arm/plat-omap/mailbox.c
arch/arm/plat-omap/include/mach/mailbox.h
arch/arm/mach-omap2/mailbox.c


Regards
Subramaniam C A,
Ramesh Gupta . G
Kanigeri Hari--
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/10] omap mailbox: OMAP4-Mailbox - Add build specific changes to support OMAP4 mailbox.

2009-09-04 Thread C.A, Subramaniam
From aa759db084be9a2893de5e61b11f6de6d05508d9 Mon Sep 17 00:00:00 2001
From: C A Subramaniam subramaniam...@ti.com
Date: Wed, 2 Sep 2009 17:52:22 +0530
Subject: [PATCH 1/10] omap mailbox: OMAP4-Mailbox - Add build specific changes 
to support OMAP4 mailbox.

This patch adds changes to the build related files of mailbox
driver to support OMAP4 mailbox

Signed-off-by: C A Subramaniam subramaniam...@ti.com
Signed-off-by: Ramesh Gupta G grgu...@ti.com
---
 arch/arm/mach-omap2/Makefile |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 735bae5..4bb426d 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -39,6 +39,10 @@ endif
 obj-$(CONFIG_ARCH_OMAP2)   += clock24xx.o
 obj-$(CONFIG_ARCH_OMAP3)   += clock34xx.o
 
+# MAILBOX
+obj-$(CONFIG_OMAP_MBOX_FWK)+= mailbox_mach.o
+mailbox_mach-objs  := mailbox.o
+
 iommu-y+= iommu2.o
 iommu-$(CONFIG_ARCH_OMAP3) += omap3-iommu.o
 
-- 
1.5.3.2
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/10] omap mailbox: OMAP4 - Add resources and mailbox register base address for OMAP4 mailbox

2009-09-04 Thread C.A, Subramaniam
From 80e74ada510bace7208d59c0f912f9b1077efb45 Mon Sep 17 00:00:00 2001
From: C A Subramaniam subramaniam...@ti.com
Date: Wed, 2 Sep 2009 17:58:57 +0530
Subject: [PATCH 2/10] omap mailbox: OMAP4 - Add resources and mailbox register 
base address
 for OMAP4 mailbox

This patch adds resource information of mailbox driver for
OMAP4 mailbox module. Register base address also added

Signed-off-by: C A Subramaniam subramaniam...@ti.com
Signed-off-by: Ramesh Gupta G grgu...@ti.com
---
 arch/arm/mach-omap2/devices.c  |   20 +++-
 arch/arm/plat-omap/include/mach/omap44xx.h |2 ++
 2 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 894cc35..711ed6a 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -136,8 +136,11 @@ static inline void omap_init_camera(void)
 
 #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
 
+#ifdef CONFIG_ARCH_OMAP4
+#define MBOX_REG_SIZE   0x130
+#else
 #define MBOX_REG_SIZE  0x120
-
+#endif
 static struct resource omap2_mbox_resources[] = {
{
.start  = OMAP24XX_MAILBOX_BASE,
@@ -166,6 +169,18 @@ static struct resource omap3_mbox_resources[] = {
},
 };
 
+static struct resource omap4_mbox_resources[] = {
+   {
+   .start  = OMAP44xx_MAILBOX_BASE,
+   .end= OMAP44xx_MAILBOX_BASE + MBOX_REG_SIZE  - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = INT_44XX_MAIL_U0_MPU,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
 static struct platform_device mbox_device = {
.name   = omap2-mailbox,
.id = -1,
@@ -179,6 +194,9 @@ static inline void omap_init_mbox(void)
} else if (cpu_is_omap3430()) {
mbox_device.num_resources = ARRAY_SIZE(omap3_mbox_resources);
mbox_device.resource = omap3_mbox_resources;
+   } else if (cpu_is_omap44xx()) {
+   mbox_device.num_resources = ARRAY_SIZE(omap4_mbox_resources);
+   mbox_device.resource = omap4_mbox_resources;
} else {
pr_err(%s: platform not supported\n, __func__);
return;
diff --git a/arch/arm/plat-omap/include/mach/omap44xx.h 
b/arch/arm/plat-omap/include/mach/omap44xx.h
index 52f2f85..6a545d3 100644
--- a/arch/arm/plat-omap/include/mach/omap44xx.h
+++ b/arch/arm/plat-omap/include/mach/omap44xx.h
@@ -44,5 +44,7 @@
 #define OMAP44XX_WKUPGEN_BASE  0x48281000
 #define OMAP44XX_VA_WKUPGEN_BASE   IO_ADDRESS(OMAP44XX_WKUPGEN_BASE)
 
+#define OMAP44xx_MAILBOX_BASE  (L4_44XX_BASE + 0xF4000)
+
 #endif /* __ASM_ARCH_OMAP44XX_H */
 
-- 
1.5.3.2
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/10] omap mailbox: remove sequence bit checking

2009-09-04 Thread C.A, Subramaniam
From d7a03f1d174036edbad312dff1f1789736098bf0 Mon Sep 17 00:00:00 2001
From: Hiroshi DOYU hiroshi.d...@nokia.com
Date: Wed, 2 Sep 2009 19:32:42 +0530
Subject: [PATCH 3/10] omap mailbox: remove sequence bit checking

Any protocol should be handled in the upper layer and mailbox driver
shouldn't care about the contents of messages.

Signed-off-by: Hiroshi DOYU hiroshi.d...@nokia.com
---
 arch/arm/plat-omap/mailbox.c |   70 ++---
 1 files changed, 4 insertions(+), 66 deletions(-)

diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 40424ed..e2bcc9d 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -28,54 +28,9 @@
 
 #include mach/mailbox.h
 
-static int enable_seq_bit;
-module_param(enable_seq_bit, bool, 0);
-MODULE_PARM_DESC(enable_seq_bit, Enable sequence bit checking.);
-
 static struct omap_mbox *mboxes;
 static DEFINE_RWLOCK(mboxes_lock);
 
-/*
- * Mailbox sequence bit API
- */
-
-/* seq_rcv should be initialized with any value other than
- * 0 and 1  31, to allow either value for the first
- * message.  */
-static inline void mbox_seq_init(struct omap_mbox *mbox)
-{
-   if (!enable_seq_bit)
-   return;
-
-   /* any value other than 0 and 1  31 */
-   mbox-seq_rcv = 0x;
-}
-
-static inline void mbox_seq_toggle(struct omap_mbox *mbox, mbox_msg_t * msg)
-{
-   if (!enable_seq_bit)
-   return;
-
-   /* add seq_snd to msg */
-   *msg = (*msg  0x7fff) | mbox-seq_snd;
-   /* flip seq_snd */
-   mbox-seq_snd ^= 1  31;
-}
-
-static inline int mbox_seq_test(struct omap_mbox *mbox, mbox_msg_t msg)
-{
-   mbox_msg_t seq;
-
-   if (!enable_seq_bit)
-   return 0;
-
-   seq = msg  (1  31);
-   if (seq == mbox-seq_rcv)
-   return -1;
-   mbox-seq_rcv = seq;
-   return 0;
-}
-
 /* Mailbox FIFO handle functions */
 static inline mbox_msg_t mbox_fifo_read(struct omap_mbox *mbox)
 {
@@ -113,13 +68,6 @@ static inline int is_mbox_irq(struct omap_mbox *mbox, 
omap_mbox_irq_t irq)
return mbox-ops-is_irq(mbox, irq);
 }
 
-/* Mailbox Sequence Bit function */
-void omap_mbox_init_seq(struct omap_mbox *mbox)
-{
-   mbox_seq_init(mbox);
-}
-EXPORT_SYMBOL(omap_mbox_init_seq);
-
 /*
  * message sender
  */
@@ -141,7 +89,6 @@ static int __mbox_msg_send(struct omap_mbox *mbox, 
mbox_msg_t msg, void *arg)
goto out;
}
 
-   mbox_seq_toggle(mbox, msg);
mbox_fifo_write(mbox, msg);
  out:
return ret;
@@ -254,11 +201,11 @@ static void mbox_rx_work(struct work_struct *work)
 /*
  * Mailbox interrupt handler
  */
-static void mbox_txq_fn(struct request_queue * q)
+static void mbox_txq_fn(struct request_queue *q)
 {
 }
 
-static void mbox_rxq_fn(struct request_queue * q)
+static void mbox_rxq_fn(struct request_queue *q)
 {
 }
 
@@ -284,11 +231,6 @@ static void __mbox_rx_interrupt(struct omap_mbox *mbox)
 
msg = mbox_fifo_read(mbox);
 
-   if (unlikely(mbox_seq_test(mbox, msg))) {
-   pr_info(mbox: Illegal seq bit!(%08x)\n, msg);
-   if (mbox-err_notify)
-   mbox-err_notify();
-   }
 
blk_insert_request(q, rq, 0, (void *)msg);
if (mbox-ops-type == OMAP_MBOX_TYPE1)
@@ -320,7 +262,7 @@ static irqreturn_t mbox_interrupt(int irq, void *p)
  */
 static ssize_t
 omap_mbox_write(struct device *dev, struct device_attribute *attr,
-   const char * buf, size_t count)
+   const char *buf, size_t count)
 {
int ret;
mbox_msg_t *p = (mbox_msg_t *)buf;
@@ -357,10 +299,6 @@ omap_mbox_read(struct device *dev, struct device_attribute 
*attr, char *buf)
 
blk_end_request_all(rq, 0);
 
-   if (unlikely(mbox_seq_test(mbox, *p))) {
-   pr_info(mbox: Illegal seq bit!(%08x) ignored\n, *p);
-   continue;
-   }
p++;
}
 
@@ -383,7 +321,7 @@ static struct class omap_mbox_class = {
 };
 
 static struct omap_mbox_queue *mbox_queue_alloc(struct omap_mbox *mbox,
-   request_fn_proc * proc,
+   request_fn_proc *proc,
void (*work) (struct work_struct *))
 {
struct request_queue *q;
-- 
1.5.3.2
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/10] omap mailbox: remove class interface

2009-09-04 Thread C.A, Subramaniam
From ddba6182ca716f9f5f5072088475a613f3141eb8 Mon Sep 17 00:00:00 2001
From: Hiroshi DOYU hiroshi.d...@nokia.com
Date: Wed, 2 Sep 2009 20:03:19 +0530
Subject: [PATCH 4/10] omap mailbox: remove class interface

It's not used at present.

Signed-off-by: Hiroshi DOYU hiroshi.d...@nokia.com
---
 arch/arm/plat-omap/include/mach/mailbox.h |1 -
 arch/arm/plat-omap/mailbox.c  |  115 ++--
 2 files changed, 9 insertions(+), 107 deletions(-)

diff --git a/arch/arm/plat-omap/include/mach/mailbox.h 
b/arch/arm/plat-omap/include/mach/mailbox.h
index b7a6991..319306a 100644
--- a/arch/arm/plat-omap/include/mach/mailbox.h
+++ b/arch/arm/plat-omap/include/mach/mailbox.h
@@ -8,7 +8,6 @@
 #include linux/blkdev.h
 
 typedef u32 mbox_msg_t;
-typedef void (mbox_receiver_t)(mbox_msg_t msg);
 struct omap_mbox;
 
 typedef int __bitwise omap_mbox_irq_t;
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index e2bcc9d..6e713a7 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -71,7 +71,7 @@ static inline int is_mbox_irq(struct omap_mbox *mbox, 
omap_mbox_irq_t irq)
 /*
  * message sender
  */
-static int __mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg, void *arg)
+static int __mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg)
 {
int ret = 0, i = 1000;
 
@@ -82,15 +82,7 @@ static int __mbox_msg_send(struct omap_mbox *mbox, 
mbox_msg_t msg, void *arg)
return -1;
udelay(1);
}
-
-   if (arg  mbox-txq-callback) {
-   ret = mbox-txq-callback(arg);
-   if (ret)
-   goto out;
-   }
-
mbox_fifo_write(mbox, msg);
- out:
return ret;
 }
 
@@ -152,7 +144,7 @@ static void mbox_tx_work(struct work_struct *work)
 
tx_data = rq-special;
 
-   ret = __mbox_msg_send(mbox, tx_data-msg, tx_data-arg);
+   ret = __mbox_msg_send(mbox, tx_data-msg);
if (ret) {
enable_mbox_irq(mbox, IRQ_TX);
spin_lock(q-queue_lock);
@@ -180,11 +172,6 @@ static void mbox_rx_work(struct work_struct *work)
mbox_msg_t msg;
unsigned long flags;
 
-   if (mbox-rxq-callback == NULL) {
-   sysfs_notify(mbox-dev-kobj, NULL, mbox);
-   return;
-   }
-
while (1) {
spin_lock_irqsave(q-queue_lock, flags);
rq = blk_fetch_request(q);
@@ -257,69 +244,6 @@ static irqreturn_t mbox_interrupt(int irq, void *p)
return IRQ_HANDLED;
 }
 
-/*
- * sysfs files
- */
-static ssize_t
-omap_mbox_write(struct device *dev, struct device_attribute *attr,
-   const char *buf, size_t count)
-{
-   int ret;
-   mbox_msg_t *p = (mbox_msg_t *)buf;
-   struct omap_mbox *mbox = dev_get_drvdata(dev);
-
-   for (; count = sizeof(mbox_msg_t); count -= sizeof(mbox_msg_t)) {
-   ret = omap_mbox_msg_send(mbox, be32_to_cpu(*p), NULL);
-   if (ret)
-   return -EAGAIN;
-   p++;
-   }
-
-   return (size_t)((char *)p - buf);
-}
-
-static ssize_t
-omap_mbox_read(struct device *dev, struct device_attribute *attr, char *buf)
-{
-   unsigned long flags;
-   struct request *rq;
-   mbox_msg_t *p = (mbox_msg_t *) buf;
-   struct omap_mbox *mbox = dev_get_drvdata(dev);
-   struct request_queue *q = mbox-rxq-queue;
-
-   while (1) {
-   spin_lock_irqsave(q-queue_lock, flags);
-   rq = blk_fetch_request(q);
-   spin_unlock_irqrestore(q-queue_lock, flags);
-
-   if (!rq)
-   break;
-
-   *p = (mbox_msg_t)rq-special;
-
-   blk_end_request_all(rq, 0);
-
-   p++;
-   }
-
-   pr_debug(%02x %02x %02x %02x\n, buf[0], buf[1], buf[2], buf[3]);
-
-   return (size_t) ((char *)p - buf);
-}
-
-static DEVICE_ATTR(mbox, S_IRUGO | S_IWUSR, omap_mbox_read, omap_mbox_write);
-
-static ssize_t mbox_show(struct class *class, char *buf)
-{
-   return sprintf(buf, mbox);
-}
-
-static CLASS_ATTR(mbox, S_IRUGO, mbox_show, NULL);
-
-static struct class omap_mbox_class = {
-   .name = omap-mailbox,
-};
-
 static struct omap_mbox_queue *mbox_queue_alloc(struct omap_mbox *mbox,
request_fn_proc *proc,
void (*work) (struct work_struct *))
@@ -353,7 +277,7 @@ static void mbox_queue_free(struct omap_mbox_queue *q)
kfree(q);
 }
 
-static int omap_mbox_init(struct omap_mbox *mbox)
+static int omap_mbox_startup(struct omap_mbox *mbox)
 {
int ret;
struct omap_mbox_queue *mq;
@@ -436,7 +360,7 @@ struct omap_mbox *omap_mbox_get(const char *name)
 
read_unlock(mboxes_lock);
 
-   ret = omap_mbox_init(mbox);
+   ret = omap_mbox_startup(mbox);
if (ret)
return ERR_PTR(-ENODEV);
 

[PATCH 5/10] omap mailbox: remove disalbe_/enable_mbox_irq in isr

2009-09-04 Thread C.A, Subramaniam
From 20a90cfa9b06b70c495f1699825dd9fded381949 Mon Sep 17 00:00:00 2001
From: Hiroshi DOYU hiroshi.d...@nokia.com
Date: Wed, 2 Sep 2009 20:06:38 +0530
Subject: [PATCH 5/10] omap mailbox: remove disalbe_/enable_mbox_irq in isr

No need to handle it in isr, since irq won't happen during isr.

Signed-off-by: Hiroshi DOYU hiroshi.d...@nokia.com
---
 arch/arm/plat-omap/mailbox.c |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 6e713a7..8a6d087 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -209,8 +209,6 @@ static void __mbox_rx_interrupt(struct omap_mbox *mbox)
mbox_msg_t msg;
struct request_queue *q = mbox-rxq-queue;
 
-   disable_mbox_irq(mbox, IRQ_RX);
-
while (!mbox_fifo_empty(mbox)) {
rq = blk_get_request(q, WRITE, GFP_ATOMIC);
if (unlikely(!rq))
@@ -226,7 +224,6 @@ static void __mbox_rx_interrupt(struct omap_mbox *mbox)
 
/* no more messages in the fifo. clear IRQ source. */
ack_mbox_irq(mbox, IRQ_RX);
-   enable_mbox_irq(mbox, IRQ_RX);
 nomem:
schedule_work(mbox-rxq-work);
 }
-- 
1.5.3.2
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/10] omap mailbox: remove unnecessary arg for omap_mbox_msg_send

2009-09-04 Thread C.A, Subramaniam
From 4e4fbfa64b2b77ec6f1140178770a70ff6f8caed Mon Sep 17 00:00:00 2001
From: Hiroshi DOYU hiroshi.d...@nokia.com
Date: Wed, 2 Sep 2009 20:14:24 +0530
Subject: [PATCH 6/10] omap mailbox: remove unnecessary arg for 
omap_mbox_msg_send

Signed-off-by: Hiroshi DOYU hiroshi.d...@nokia.com
---
 arch/arm/plat-omap/include/mach/mailbox.h |2 +-
 arch/arm/plat-omap/mailbox.c  |3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/arm/plat-omap/include/mach/mailbox.h 
b/arch/arm/plat-omap/include/mach/mailbox.h
index 319306a..8260a3f 100644
--- a/arch/arm/plat-omap/include/mach/mailbox.h
+++ b/arch/arm/plat-omap/include/mach/mailbox.h
@@ -63,7 +63,7 @@ struct omap_mbox {
void(*err_notify)(void);
 };
 
-int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg, void *);
+int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg);
 void omap_mbox_init_seq(struct omap_mbox *);
 
 struct omap_mbox *omap_mbox_get(const char *);
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 8a6d087..b7c0d5f 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -97,7 +97,7 @@ static void omap_msg_tx_end_io(struct request *rq, int error)
__blk_put_request(rq-q, rq);
 }
 
-int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg, void* arg)
+int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg)
 {
struct omap_msg_tx_data *tx_data;
struct request *rq;
@@ -114,7 +114,6 @@ int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t 
msg, void* arg)
}
 
tx_data-msg = msg;
-   tx_data-arg = arg;
rq-end_io = omap_msg_tx_end_io;
blk_insert_request(q, rq, 0, tx_data);
 
-- 
1.5.3.2
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/10] omap mailbox: expose omap_mbox_enable()/disable_irq()

2009-09-04 Thread C.A, Subramaniam
From 76e10e3b49c987894164375b2f5171418b9778e5 Mon Sep 17 00:00:00 2001
From: Hiroshi DOYU hiroshi.d...@nokia.com
Date: Wed, 2 Sep 2009 20:18:53 +0530
Subject: [PATCH 7/10] omap mailbox: expose omap_mbox_enable()/disable_irq()

Signed-off-by: Hiroshi DOYU hiroshi.d...@nokia.com
---
 arch/arm/plat-omap/include/mach/mailbox.h |   12 
 arch/arm/plat-omap/mailbox.c  |   12 ++--
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/arch/arm/plat-omap/include/mach/mailbox.h 
b/arch/arm/plat-omap/include/mach/mailbox.h
index 8260a3f..bf06953 100644
--- a/arch/arm/plat-omap/include/mach/mailbox.h
+++ b/arch/arm/plat-omap/include/mach/mailbox.h
@@ -92,4 +92,16 @@ static inline void omap_mbox_restore_ctx(struct omap_mbox 
*mbox)
mbox-ops-restore_ctx(mbox);
 }
 
+static inline void omap_mbox_enable_irq(struct omap_mbox *mbox,
+   omap_mbox_irq_t irq)
+{
+   mbox-ops-enable_irq(mbox, irq);
+}
+
+static inline void omap_mbox_disable_irq(struct omap_mbox *mbox,
+omap_mbox_irq_t irq)
+{
+   mbox-ops-disable_irq(mbox, irq);
+}
+
 #endif /* MAILBOX_H */
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index b7c0d5f..f6d6b67 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -50,14 +50,6 @@ static inline int mbox_fifo_full(struct omap_mbox *mbox)
 }
 
 /* Mailbox IRQ handle functions */
-static inline void enable_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
-{
-   mbox-ops-enable_irq(mbox, irq);
-}
-static inline void disable_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t 
irq)
-{
-   mbox-ops-disable_irq(mbox, irq);
-}
 static inline void ack_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
 {
if (mbox-ops-ack_irq)
@@ -145,7 +137,7 @@ static void mbox_tx_work(struct work_struct *work)
 
ret = __mbox_msg_send(mbox, tx_data-msg);
if (ret) {
-   enable_mbox_irq(mbox, IRQ_TX);
+   omap_mbox_enable_irq(mbox, IRQ_TX);
spin_lock(q-queue_lock);
blk_requeue_request(q, rq);
spin_unlock(q-queue_lock);
@@ -197,7 +189,7 @@ static void mbox_rxq_fn(struct request_queue *q)
 
 static void __mbox_tx_interrupt(struct omap_mbox *mbox)
 {
-   disable_mbox_irq(mbox, IRQ_TX);
+   omap_mbox_disable_irq(mbox, IRQ_TX);
ack_mbox_irq(mbox, IRQ_TX);
schedule_work(mbox-txq-work);
 }
-- 
1.5.3.2
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/10] omap mailbox: OMAP4-Mailbox - Adds code changes to support OMAP4 mailbox.

2009-09-04 Thread C.A, Subramaniam
From eeaa22aff9df8027f91884ee78328028bd5a6782 Mon Sep 17 00:00:00 2001
From: C A Subramaniam subramaniam...@ti.com
Date: Thu, 3 Sep 2009 17:53:27 +0530
Subject: [PATCH 8/10] omap mailbox: OMAP4-Mailbox - Adds code changes to 
support OMAP4 mailbox.

This patch adds code changes in the mailbox driver module to
add support for OMAP4 mailbox.

Signed-off-by: Hari Kanigeri h-kanige...@ti.com
Signed-off-by: C A Subramaniam subramaniam...@ti.com
Signed-off-by: Ramesh Gupta G grgu...@ti.com
---
 arch/arm/mach-omap2/mailbox.c |  156 +
 1 files changed, 125 insertions(+), 31 deletions(-)

diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 6f71f37..4ab3e1d 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -18,21 +18,36 @@
 #include mach/mailbox.h
 #include mach/irqs.h
 
+#define DRV_NAME omap2-mailbox
+
 #define MAILBOX_REVISION   0x000
 #define MAILBOX_SYSCONFIG  0x010
 #define MAILBOX_SYSSTATUS  0x014
 #define MAILBOX_MESSAGE(m) (0x040 + 4 * (m))
 #define MAILBOX_FIFOSTATUS(m)  (0x080 + 4 * (m))
 #define MAILBOX_MSGSTATUS(m)   (0x0c0 + 4 * (m))
+
+#ifdef CONFIG_ARCH_OMAP4
+#define MAILBOX_IRQSTATUS(u)   (0x104 + 10 * (u))
+#define MAILBOX_IRQENABLE(u)   (0x108 + 10 * (u))
+#define MAILBOX_IRQENABLE_CLR(u)   (0x10c + 10 * (u))
+#else
 #define MAILBOX_IRQSTATUS(u)   (0x100 + 8 * (u))
 #define MAILBOX_IRQENABLE(u)   (0x104 + 8 * (u))
+#endif
 
-#define MAILBOX_IRQ_NEWMSG(u)  (1  (2 * (u)))
-#define MAILBOX_IRQ_NOTFULL(u) (1  (2 * (u) + 1))
+#define MAILBOX_IRQ_NEWMSG(m)  (1  (2 * (m)))
+#define MAILBOX_IRQ_NOTFULL(m) (1  (2 * (m) + 1))
 
+#ifdef CONFIG_ARCH_OMAP4
+#define MBOX_REG_SIZE  0x130
+#else
 #define MBOX_REG_SIZE  0x120
+#endif
+
 #define MBOX_NR_REGS   (MBOX_REG_SIZE / sizeof(u32))
 
+
 static void __iomem *mbox_base;
 
 struct omap_mbox2_fifo {
@@ -49,9 +64,13 @@ struct omap_mbox2_priv {
u32 newmsg_bit;
u32 notfull_bit;
u32 ctx[MBOX_NR_REGS];
+#ifdef CONFIG_ARCH_OMAP4
+   unsigned long irqdisable;
+#endif
 };
 
 static struct clk *mbox_ick_handle;
+static int mbox_configured;
 
 static void omap2_mbox_enable_irq(struct omap_mbox *mbox,
  omap_mbox_type_t irq);
@@ -70,31 +89,37 @@ static inline void mbox_write_reg(u32 val, size_t ofs)
 static int omap2_mbox_startup(struct omap_mbox *mbox)
 {
unsigned int l;
+   if (!mbox_configured) {
+   mbox_ick_handle = clk_get(NULL, mailboxes_ick);
+   if (IS_ERR(mbox_ick_handle)) {
+   printk(KERN_ERR Could not get mailboxes_ick\n);
+   return -ENODEV;
+   }
+   clk_enable(mbox_ick_handle);
 
-   mbox_ick_handle = clk_get(NULL, mailboxes_ick);
-   if (IS_ERR(mbox_ick_handle)) {
-   printk(Could not get mailboxes_ick\n);
-   return -ENODEV;
-   }
-   clk_enable(mbox_ick_handle);
-
-   l = mbox_read_reg(MAILBOX_REVISION);
-   pr_info(omap mailbox rev %d.%d\n, (l  0xf0)  4, (l  0x0f));
-
-   /* set smart-idle  autoidle */
-   l = mbox_read_reg(MAILBOX_SYSCONFIG);
-   l |= 0x0011;
-   mbox_write_reg(l, MAILBOX_SYSCONFIG);
+   l = mbox_read_reg(MAILBOX_REVISION);
+   pr_info(omap mailbox rev %d.%d\n, (l  0xf0)  4,
+   (l  0x0f));
 
+   /* set smart-idle  autoidle */
+   l = mbox_read_reg(MAILBOX_SYSCONFIG);
+   l |= 0x0011;
+   mbox_write_reg(l, MAILBOX_SYSCONFIG);
+   }
+   mbox_configured++;
omap2_mbox_enable_irq(mbox, IRQ_RX);
 
return 0;
 }
 
 static void omap2_mbox_shutdown(struct omap_mbox *mbox)
-{
-   clk_disable(mbox_ick_handle);
-   clk_put(mbox_ick_handle);
+{  if (mbox_configured  0)
+   mbox_configured--;
+   if (!mbox_configured) {
+   clk_disable(mbox_ick_handle);
+   clk_put(mbox_ick_handle);
+   mbox_ick_handle = NULL;
+   }
 }
 
 /* Mailbox FIFO handle functions */
@@ -123,7 +148,7 @@ static int omap2_mbox_fifo_full(struct omap_mbox *mbox)
 {
struct omap_mbox2_fifo *fifo =
((struct omap_mbox2_priv *)mbox-priv)-tx_fifo;
-   return (mbox_read_reg(fifo-fifo_stat));
+   return mbox_read_reg(fifo-fifo_stat);
 }
 
 /* Mailbox IRQ handle functions */
@@ -143,10 +168,9 @@ static void omap2_mbox_disable_irq(struct omap_mbox *mbox,
 {
struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox-priv;
u32 l, bit = (irq == IRQ_TX) ? p-notfull_bit : p-newmsg_bit;
-
-   l = mbox_read_reg(p-irqenable);
+   l = mbox_read_reg(p-irqdisable);
l = ~bit;
- 

[PATCH 10/10] omap mailbox: OMAP4 Mailbox-driver Patch to support tasklet implementation

2009-09-04 Thread C.A, Subramaniam
From e759173e77f73fabce5177b4f685df20b16c6922 Mon Sep 17 00:00:00 2001
From: C A Subramaniam subramaniam...@ti.com
Date: Thu, 3 Sep 2009 17:42:35 +0530
Subject: [PATCH 10/10] omap mailbox: OMAP4 Mailbox-driver Patch to support 
tasklet
   implementation

This patch uses a tasklet implementation for
sending mailbox messages.

Signed-off-by: C A Subramaniam subramaniam...@ti.com
Signed-off-by: Ramesh Gupta G grgu...@ti.com
---
 arch/arm/mach-omap2/mailbox.c |   43 ++-
 arch/arm/plat-omap/include/mach/mailbox.h |   16 +-
 arch/arm/plat-omap/mailbox.c  |   80 ++---
 3 files changed, 81 insertions(+), 58 deletions(-)

diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 52a1670..45aea98 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -236,6 +237,17 @@ static struct omap_mbox_ops omap2_mbox_ops = {
.restore_ctx= omap2_mbox_restore_ctx,
 };
 
+
+static struct omap_mbox_task omap_mbox_1_tasklet = {
+   .arg= NULL,
+};
+
+static struct omap_mbox_task omap_mbox_2_tasklet = {
+   .arg= NULL,
+};
+
+
+
 /*
  * MAILBOX 0: ARM - DSP,
  * MAILBOX 1: ARM - DSP.
@@ -272,6 +284,7 @@ struct omap_mbox mbox_1_info = {
.name   = mailbox-1,
.ops= omap2_mbox_ops,
.priv   = omap2_mbox_1_priv,
+   .tx_tasklet = omap_mbox_1_tasklet,
 };
 EXPORT_SYMBOL(mbox_1_info);
 #else
@@ -305,8 +318,10 @@ struct omap_mbox mbox_2_info = {
.name   = mailbox-2,
.ops= omap2_mbox_ops,
.priv   = omap2_mbox_2_priv,
+   .tx_tasklet = omap_mbox_2_tasklet,
 };
 EXPORT_SYMBOL(mbox_2_info);
+
 #endif
 
 
diff --git a/arch/arm/plat-omap/include/mach/mailbox.h 
b/arch/arm/plat-omap/include/mach/mailbox.h
index bf06953..5271345 100644
--- a/arch/arm/plat-omap/include/mach/mailbox.h
+++ b/arch/arm/plat-omap/include/mach/mailbox.h
@@ -28,8 +28,10 @@ struct omap_mbox_ops {
int (*fifo_empty)(struct omap_mbox *mbox);
int (*fifo_full)(struct omap_mbox *mbox);
/* irq */
-   void(*enable_irq)(struct omap_mbox *mbox, omap_mbox_irq_t 
irq);
-   void(*disable_irq)(struct omap_mbox *mbox, omap_mbox_irq_t 
irq);
+   void(*enable_irq)(struct omap_mbox *mbox,
+   omap_mbox_irq_t irq);
+   void(*disable_irq)(struct omap_mbox *mbox,
+   omap_mbox_irq_t irq);
void(*ack_irq)(struct omap_mbox *mbox, omap_mbox_irq_t irq);
int (*is_irq)(struct omap_mbox *mbox, omap_mbox_irq_t irq);
/* ctx */
@@ -45,12 +47,22 @@ struct omap_mbox_queue {
struct omap_mbox*mbox;
 };
 
+struct omap_mbox_task{
+   spinlock_t  lock;
+   struct tasklet_struct   *t;
+   mbox_msg_t  msg;
+   void*arg;
+};
+
+
 struct omap_mbox {
char*name;
unsigned intirq;
 
struct omap_mbox_queue  *txq, *rxq;
 
+   struct omap_mbox_task   *tx_tasklet;
+
struct omap_mbox_ops*ops;
 
mbox_msg_t  seq_snd, seq_rcv;
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 84cf6af..b5e53d4 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -63,60 +63,49 @@ static inline int is_mbox_irq(struct omap_mbox *mbox, 
omap_mbox_irq_t irq)
 /*
  * message sender
  */
-static int __mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg)
+static void __mbox_msg_send(unsigned long tx)
 {
+   struct omap_mbox_task *tx_data  =  (struct omap_mbox_task *)tx;
+   struct omap_mbox *mbox = (struct omap_mbox *)tx_data-arg;
+   mbox_msg_t msg = tx_data-msg;
int ret = 0, i = 1000;
 
while (mbox_fifo_full(mbox)) {
-   if (mbox-ops-type == OMAP_MBOX_TYPE2)
-   return -1;
-   if (--i == 0)
-   return -1;
+   if (mbox-ops-type == OMAP_MBOX_TYPE2) {
+   printk(KERN_ERR Invalid mailbox type\n);
+   return ;
+   }
+   if (--i == 0) {
+   printk(KERN_ERR Time out writing to mailbox\n);
+   return ;
+   }
udelay(1);
}
mbox_fifo_write(mbox, msg);
-   return ret;
-}
-
-struct omap_msg_tx_data {
-   mbox_msg_t  msg;
-   void*arg;
-};
+   tx_data-arg = NULL;
+   spin_unlock((mbox-tx_tasklet-lock));
 
-static void omap_msg_tx_end_io(struct request *rq, int error)
-{
-   kfree(rq-special);
-   __blk_put_request(rq-q, rq);
+   return;
 }
 
+
 int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg)
 {
-   struct omap_msg_tx_data *tx_data;
-   struct request *rq;
-   struct