Re: [PATCH v2 00/13] drivers: mailbox: framework creation

2013-02-13 Thread Loic PALLARDY
Hi Suman,

I'll send new version of patch 11 taking into account Mark Rutland's 
comments.

Regards,
Loic

On 02/13/2013 05:41 PM, Anna, Suman wrote:
 On Wed, Feb 13, 2013 at 02:36:32PM +0100, Linus Walleij wrote:
 On Tue, Feb 12, 2013 at 5:56 AM, Suman Annas-a...@ti.com  wrote:

 I have hosted the series at [3].
 [3]
 https://github.com/sumananna/mailbox/commits/dbx500-prcmu-mailbox

 Suman, I suggest you ask Stepgen Rothwell to include this branch into
 the linux-next tree, so we can get some rotation of this stuff in
 preparation for the v3.10 merge window. (It's not going in now
 anyway.)

 Best wait until after v3.9-rc1 - remember that linux-next is supposed to be a
 staging tree for the _next_ merge window only.

 Yes, will do. Anyway, we need a new revision of one patch (so far) to address 
 Mark Rutland's comments.

 Thanks
 Suman--
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 v3 10/13] mailbox: create dbx500 mailbox driver

2013-02-13 Thread Loic Pallardy
From: Loic Pallardy loic.palla...@st.com

Add STEriccson DBX500 PRCM mailbox support.

Change-Id: I36cbef646e26469a9490d46a5e143667aa93d762
Signed-off-by: Loic Pallardy loic.palla...@st.com
Signed-off-by: Linus Walleij linus.wall...@linaro.org
---
 .../devicetree/bindings/mailbox/dbx500-mailbox.txt |  27 +
 drivers/mailbox/Kconfig|   7 +
 drivers/mailbox/Makefile   |   1 +
 drivers/mailbox/mailbox-dbx500.c   | 648 +
 include/linux/platform_data/mailbox-dbx500.h   |  12 +
 5 files changed, 695 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/dbx500-mailbox.txt
 create mode 100644 drivers/mailbox/mailbox-dbx500.c
 create mode 100644 include/linux/platform_data/mailbox-dbx500.h

diff --git a/Documentation/devicetree/bindings/mailbox/dbx500-mailbox.txt 
b/Documentation/devicetree/bindings/mailbox/dbx500-mailbox.txt
new file mode 100644
index 000..7a10e72
--- /dev/null
+++ b/Documentation/devicetree/bindings/mailbox/dbx500-mailbox.txt
@@ -0,0 +1,27 @@
+ST-Ericsson DBx500 PRCM Mailbox Driver
+
+Required properties:
+- compatible   : Should be
+ stericsson,db8500-mailbox for db8500 and db9500
+ stericsson,db9540-mailbox for db9540
+- reg  : Physical base address and length of mailbox's
+ registers and shared memory
+- reg-names: Should contain the reg names prcm-reg and
+ prcmu-tcdm
+- interrupts   : contains the IRQ line for the PRCM mailbox
+- interrupt-names  : Should contain the interrupt name irq
+- legacy-offset: Memory offset in shared mem for legacy 
mailboxes
+
+Optional properties:
+- upap-offset  : Memory offset in shared mem for upap mailboxes
+
+Examples:
+
+mailbox {
+   compatible = stericsson,db8500-mailbox;
+   reg = 0x80157000 0x1000, 0x801B8000 0x2000;
+   reg-names = prcm-reg, prcmu-tcdm;
+   interrupts = 0 47 0x4;
+   interrupt-names = irq;
+   legacy-offset = 0xdd4;
+};
diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig
index c28897d..d352028 100644
--- a/drivers/mailbox/Kconfig
+++ b/drivers/mailbox/Kconfig
@@ -24,6 +24,12 @@ config OMAP2PLUS_MBOX
  OMAP2/3; or IPU, IVA HD and DSP in OMAP4. Say Y here if you want
  to use OMAP2+ Mailbox framework support.
 
+config DBX500_MBOX
+   tristate DBx500 Mailbox driver support
+   depends on ARCH_U8500
+   help
+ Say Y here if you want to use DBx500 Mailbox driver support for
+ power coprocessor access on Ux500 and Ux540 families
 
 config MBOX_KFIFO_SIZE
int Mailbox kfifo default buffer size (bytes)
@@ -35,6 +41,7 @@ config MBOX_KFIFO_SIZE
 
 config MBOX_DATA_SIZE
int Mailbox associated data max size (bytes)
+   default 64 if DBX500_MBOX
default 4
help
  Specify the default size of mailbox's associated data buffer
diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile
index 4085b71..c04ce79 100644
--- a/drivers/mailbox/Makefile
+++ b/drivers/mailbox/Makefile
@@ -2,3 +2,4 @@ obj-$(CONFIG_MAILBOX) += mailbox.o
 
 obj-$(CONFIG_OMAP1_MBOX)   += mailbox-omap1.o
 obj-$(CONFIG_OMAP2PLUS_MBOX)   += mailbox-omap2.o
+obj-$(CONFIG_DBX500_MBOX)  += mailbox-dbx500.o
diff --git a/drivers/mailbox/mailbox-dbx500.c b/drivers/mailbox/mailbox-dbx500.c
new file mode 100644
index 000..e9d2b0a
--- /dev/null
+++ b/drivers/mailbox/mailbox-dbx500.c
@@ -0,0 +1,648 @@
+/*
+ * Copyright (C) ST-Ericsson SA 2012
+ *
+ * License Terms: GNU General Public License v2
+ * Author: Loic Pallardy loic.palla...@st.com for ST-Ericsson
+ * DBX500 PRCM Mailbox driver
+ *
+ */
+
+#include linux/module.h
+#include linux/err.h
+#include linux/platform_device.h
+#include linux/irq.h
+#include linux/io.h
+#include linux/platform_data/mailbox-dbx500.h
+#include linux/of.h
+#include linux/of_device.h
+#include linux/irqdomain.h
+
+#include mailbox_internal.h
+
+#define MAILBOX_LEGACY 0
+#define MAILBOX_UPAP   1
+
+enum {
+   MAILBOX_BLOCKING,
+   MAILBOX_ATOMIC,
+};
+
+/* CPU mailbox registers */
+#define PRCM_MBOX_CPU_VAL  0x0fc
+#define PRCM_MBOX_CPU_SET  0x100
+#define PRCM_MBOX_CPU_CLR  0x104
+
+#define PRCM_ARM_IT1_CLR   0x48C
+#define PRCM_ARM_IT1_VAL   0x494
+
+#define NUM_MB 8
+#define MBOX_BIT BIT
+#define ALL_MBOX_BITS (MBOX_BIT(NUM_MB) - 1)
+
+/* CPU mailbox shared memory */
+#define PRCM_MBOX_LEGACY_SIZE  0x220
+#define _PRCM_MBOX_HEADER  0x214 /* 16 bytes */
+#define PRCM_MBOX_HEADER_REQ_MB0   (_PRCM_MBOX_HEADER + 0x0)
+#define PRCM_MBOX_HEADER_REQ_MB1   (_PRCM_MBOX_HEADER + 0x1)
+#define PRCM_MBOX_HEADER_REQ_MB2   (_PRCM_MBOX_HEADER + 0x2)
+#define PRCM_MBOX_HEADER_REQ_MB3   (_PRCM_MBOX_HEADER + 0x3)
+#define PRCM_MBOX_HEADER_REQ_MB4   (_PRCM_MBOX_HEADER + 0x4

Re: [PATCH v3 10/13] mailbox: create dbx500 mailbox driver

2013-02-13 Thread Loic PALLARDY
Sorry my mistake, I forgot to clean this before sending.

Regards,
Loic

On 02/13/2013 09:55 PM, Greg Kroah-Hartman wrote:
 On Wed, Feb 13, 2013 at 09:42:07PM +0100, Loic Pallardy wrote:
 From: Loic Pallardyloic.palla...@st.com

 Add STEriccson DBX500 PRCM mailbox support.

 Change-Id: I36cbef646e26469a9490d46a5e143667aa93d762

 These mean nothing when submitting kernel patches, please never include
 them.

 thanks,

 greg k-h--
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 v4 10/13] mailbox: create dbx500 mailbox driver

2013-02-13 Thread Loic Pallardy
From: Loic Pallardy loic.palla...@st.com

Add STEriccson DBX500 PRCM mailbox support.

Signed-off-by: Loic Pallardy loic.palla...@st.com
Signed-off-by: Linus Walleij linus.wall...@linaro.org
---
 .../devicetree/bindings/mailbox/dbx500-mailbox.txt |  27 +
 drivers/mailbox/Kconfig|   7 +
 drivers/mailbox/Makefile   |   1 +
 drivers/mailbox/mailbox-dbx500.c   | 648 +
 include/linux/platform_data/mailbox-dbx500.h   |  12 +
 5 files changed, 695 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/dbx500-mailbox.txt
 create mode 100644 drivers/mailbox/mailbox-dbx500.c
 create mode 100644 include/linux/platform_data/mailbox-dbx500.h

diff --git a/Documentation/devicetree/bindings/mailbox/dbx500-mailbox.txt 
b/Documentation/devicetree/bindings/mailbox/dbx500-mailbox.txt
new file mode 100644
index 000..7a10e72
--- /dev/null
+++ b/Documentation/devicetree/bindings/mailbox/dbx500-mailbox.txt
@@ -0,0 +1,27 @@
+ST-Ericsson DBx500 PRCM Mailbox Driver
+
+Required properties:
+- compatible   : Should be
+ stericsson,db8500-mailbox for db8500 and db9500
+ stericsson,db9540-mailbox for db9540
+- reg  : Physical base address and length of mailbox's
+ registers and shared memory
+- reg-names: Should contain the reg names prcm-reg and
+ prcmu-tcdm
+- interrupts   : contains the IRQ line for the PRCM mailbox
+- interrupt-names  : Should contain the interrupt name irq
+- legacy-offset: Memory offset in shared mem for legacy 
mailboxes
+
+Optional properties:
+- upap-offset  : Memory offset in shared mem for upap mailboxes
+
+Examples:
+
+mailbox {
+   compatible = stericsson,db8500-mailbox;
+   reg = 0x80157000 0x1000, 0x801B8000 0x2000;
+   reg-names = prcm-reg, prcmu-tcdm;
+   interrupts = 0 47 0x4;
+   interrupt-names = irq;
+   legacy-offset = 0xdd4;
+};
diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig
index c28897d..d352028 100644
--- a/drivers/mailbox/Kconfig
+++ b/drivers/mailbox/Kconfig
@@ -24,6 +24,12 @@ config OMAP2PLUS_MBOX
  OMAP2/3; or IPU, IVA HD and DSP in OMAP4. Say Y here if you want
  to use OMAP2+ Mailbox framework support.
 
+config DBX500_MBOX
+   tristate DBx500 Mailbox driver support
+   depends on ARCH_U8500
+   help
+ Say Y here if you want to use DBx500 Mailbox driver support for
+ power coprocessor access on Ux500 and Ux540 families
 
 config MBOX_KFIFO_SIZE
int Mailbox kfifo default buffer size (bytes)
@@ -35,6 +41,7 @@ config MBOX_KFIFO_SIZE
 
 config MBOX_DATA_SIZE
int Mailbox associated data max size (bytes)
+   default 64 if DBX500_MBOX
default 4
help
  Specify the default size of mailbox's associated data buffer
diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile
index 4085b71..c04ce79 100644
--- a/drivers/mailbox/Makefile
+++ b/drivers/mailbox/Makefile
@@ -2,3 +2,4 @@ obj-$(CONFIG_MAILBOX) += mailbox.o
 
 obj-$(CONFIG_OMAP1_MBOX)   += mailbox-omap1.o
 obj-$(CONFIG_OMAP2PLUS_MBOX)   += mailbox-omap2.o
+obj-$(CONFIG_DBX500_MBOX)  += mailbox-dbx500.o
diff --git a/drivers/mailbox/mailbox-dbx500.c b/drivers/mailbox/mailbox-dbx500.c
new file mode 100644
index 000..e9d2b0a
--- /dev/null
+++ b/drivers/mailbox/mailbox-dbx500.c
@@ -0,0 +1,648 @@
+/*
+ * Copyright (C) ST-Ericsson SA 2012
+ *
+ * License Terms: GNU General Public License v2
+ * Author: Loic Pallardy loic.palla...@st.com for ST-Ericsson
+ * DBX500 PRCM Mailbox driver
+ *
+ */
+
+#include linux/module.h
+#include linux/err.h
+#include linux/platform_device.h
+#include linux/irq.h
+#include linux/io.h
+#include linux/platform_data/mailbox-dbx500.h
+#include linux/of.h
+#include linux/of_device.h
+#include linux/irqdomain.h
+
+#include mailbox_internal.h
+
+#define MAILBOX_LEGACY 0
+#define MAILBOX_UPAP   1
+
+enum {
+   MAILBOX_BLOCKING,
+   MAILBOX_ATOMIC,
+};
+
+/* CPU mailbox registers */
+#define PRCM_MBOX_CPU_VAL  0x0fc
+#define PRCM_MBOX_CPU_SET  0x100
+#define PRCM_MBOX_CPU_CLR  0x104
+
+#define PRCM_ARM_IT1_CLR   0x48C
+#define PRCM_ARM_IT1_VAL   0x494
+
+#define NUM_MB 8
+#define MBOX_BIT BIT
+#define ALL_MBOX_BITS (MBOX_BIT(NUM_MB) - 1)
+
+/* CPU mailbox shared memory */
+#define PRCM_MBOX_LEGACY_SIZE  0x220
+#define _PRCM_MBOX_HEADER  0x214 /* 16 bytes */
+#define PRCM_MBOX_HEADER_REQ_MB0   (_PRCM_MBOX_HEADER + 0x0)
+#define PRCM_MBOX_HEADER_REQ_MB1   (_PRCM_MBOX_HEADER + 0x1)
+#define PRCM_MBOX_HEADER_REQ_MB2   (_PRCM_MBOX_HEADER + 0x2)
+#define PRCM_MBOX_HEADER_REQ_MB3   (_PRCM_MBOX_HEADER + 0x3)
+#define PRCM_MBOX_HEADER_REQ_MB4   (_PRCM_MBOX_HEADER + 0x4)
+#define PRCM_MBOX_HEADER_REQ_MB5   (_PRCM_MBOX_HEADER

Re: [PATCH v2 10/13] mailbox: create dbx500 mailbox driver

2013-02-12 Thread Loic PALLARDY
Hi Mark,

Thanks for your comments.

On 02/12/2013 11:39 AM, Mark Rutland wrote:
 Hello,

 I have a few comments on the devicetree binding and the way it's parsed.

 +static const struct of_device_id dbx500_mailbox_match[] = {
 +   { .compatible = stericsson,db8500-mailbox,
 +   .data = (void *)db8500_mboxes,
 +   },
 +   { .compatible = stericsson,db9540-mailbox,
 +   .data = (void *)dbx540_mboxes,
 +   },
 +   { /* sentinel */}
 +};
 +

 The binding for the compatible strings above and property parsing below should
 be documented.

Yes you're right. I will add a description in 
Documentation/devicetree/bindings/mailbox/...

 +static int dbx500_mbox_probe(struct platform_device *pdev)
 +{
 +   const struct platform_device_id *platid = 
 platform_get_device_id(pdev);
 +   struct resource *mem;
 +   int ret, i, legacy_offset = 0, upap_offset;
 +   struct mailbox **list;
 +   int irq;
 +   struct dbx500_plat_data *pdata = dev_get_platdata(pdev-dev);
 +   struct device_node *np = pdev-dev.of_node;
 +
 +   if (!pdata) {
 +   if (np) {
 +   of_property_read_u32(np, legacy-offset,
 +legacy_offset);

 I see that legacy_offset is initialised to 0, and there's no check on the
 return value of of_property_read_u32. Does that mean this is an optional
 property? This needs to be documented.

Correct, I'll add a check. This offset must be compared to shared memory 
size.

 +   of_property_read_u32(np, upap-offset,upap_offset);

 However, upap_offset isn't initialised, but there's no check on the return
 value. If upap-offset isn't defined in the dt, upap_offset won't have been
 initialised.
Should be documented too. upap_offset is optional since not supported by 
all STE platforms.
Anyway, value must be checked when used.

 Is there no basic sanity checking that could be done here? I assume there's a
 maximum offset we expect that's less than 4GB?

 Additionally, of_property_read_u32 takes a *u32, not *int. It would be nice to
 be consistent with the interface.
OK

 I'm not familiar with the hardware. What's the difference between the legacy
 and upap cases?
Same HW, but different way to access and manage shared memory.
Link to coprocessor firmware version.

 +   list = (struct mailbox **)of_match_device(
 +   
 dbx500_mailbox_match,pdev-dev)-data;
 +   if (!list) {
 +   /* No mailbox configuration */
 +   dev_err(pdev-dev, No configuration 
 found\n);
 +   return -ENODEV;
 +   }
 +   } else {
 +   /* No mailbox configuration */
 +   dev_err(pdev-dev, No configuration found\n);
 +   return -ENODEV;
 +   }
 +   } else {
 +   list = (struct mailbox **)platid-driver_data;
 +   legacy_offset = pdata-legacy_offset;
 +   upap_offset = pdata-upap_offset;
 +   }
 +
 +   mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, prcm_reg);

 Does this work for dt? I wasn't aware we got anything more than anonymous
 memory and interrupts.

Yes this is working with and without dt.
dt declaration will be the following
mailbox {
compatible = stericsson,db8500-mailbox;
reg = 0x80157000 0x1000, 0x801B8000 0x2000;
reg-names = prcm-reg, prcmu-tcdm;
interrupts = 0 47 0x4;
interrupt-names = irq;
legacy-offset = 0xdd4;
};

 +   mbox_base = devm_ioremap(pdev-dev, mem-start, resource_size(mem));
 +   if (!mbox_base) {
 +   ret = -ENOMEM;
 +   goto out;
 +   }
 +
 +   mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, 
 prcmu_tcdm);

 Same here.

 Thanks,
 Mark.

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


Re: [PATCH 1/9] mailbox: OMAP: introduce mailbox framework

2013-01-09 Thread Loic PALLARDY
Hi Vaibhav,

On 01/09/2013 01:11 PM, Bedia, Vaibhav wrote:
 Hi Loic,

 On Fri, Dec 21, 2012 at 16:23:24, Loic PALLARDY wrote:


 On 12/21/2012 11:49 AM, Bedia, Vaibhav wrote:
 On Fri, Dec 21, 2012 at 14:24:26, Loic PALLARDY wrote:

 I have a few patches which are dependent on this patch series.
 Could you please keep me in cc for the future versions.

 Sure, I'll.


 When do you plan to post an updated version of these patches?
I'm synchronizing with Omar to include TI RPMsg and tidspbridge patches 
in next update.
So I plan update for end of the week, beginning of next week.

Regards,
Loic

 Regards,
 Vaibhav--
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 0/9] drivers: mailbox: framework creation

2012-12-21 Thread Loic PALLARDY


On 12/21/2012 08:31 AM, Ohad Ben-Cohen wrote:
 On Thu, Dec 20, 2012 at 9:19 PM, Olof Johanssono...@lixom.net  wrote:
 While we can make the branch stable, would it make sense to make
 remoteproc for omap depend on !multiplatform during the transition, to
 reduce dependencies a little? Either way works, but it'd be nice to
 keep them independent if we can.

 I'm not sure multiplatform is the culprit; OMAP's remoteproc driver
 heavily depends on this mailbox code, and obviously breaks with this
 patch-set if only for the the naming changes. We'll need this patch
 set to update omap's remoteproc as well so at least we don't break
 bisectibility, though running a sanity test before merging would be
 even nicer (Loic I can help if you don't have a panda board).

Hi Ohad,
Yes tidspbridge and remoteproc must be adapted.
This new mailbox fw has been tested on TI environment by Omar, who did 
adaptation at least for tidspbridge.

Omar, do you have patch series ready for TI adaptations to new mailbox 
framework?
Else I can do it, but I won't be able to test it (no panda board)

Regards,
Loic

 BTW - grep shows that tidspbridge is using the mailbox code too, but
 it's in staging and I'm not sure it gets much love. Nevertheless, as
 long as it's there we should at least update it with the new API as
 well.

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


Re: [PATCH 1/9] mailbox: OMAP: introduce mailbox framework

2012-12-21 Thread Loic PALLARDY


On 12/18/2012 05:59 PM, Tony Lindgren wrote:
 * Loic Pallardyloic.pallardy-...@stericsson.com  [121218 05:15]:

 Signed-off-by: Omar Ramirez Lunaomar.l...@linaro.org

 AFAIK the first two patches should have:
 From: Omar Ramirez Lunaomar.l...@linaro.org
Yes right, my mistake.
I'll fix that on next version.
/Loic

 Once that's fixed, for arch/arm/*omap*/* parts:

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


Re: [PATCH 4/9] mailbox: create opened message type

2012-12-21 Thread Loic PALLARDY


On 12/21/2012 11:28 AM, Bedia, Vaibhav wrote:
 On Tue, Dec 18, 2012 at 18:40:07, Loic Pallardy wrote:

 -msg = mbox_read_reg(fifo-data);
 -msg |= ((mbox_msg_t) mbox_read_reg(fifo-cmd))  16;
 +msg-header = mbox_read_reg(fifo-data);
 +msg-header |= ((mbox_msg_t) mbox_read_reg(fifo-cmd))  16;

 Now that struct mailbox_msg encapsulates the data, you can
 get rid of the mbox_msg_t typedef completely. Having the data
 as part of the mailbox_msg along with the functions with mbox_msg_t
 as the return type just creates confusion IMHO.

OK I'll clean up mbox_msg_t typedef.

 -return msg;
 +return 0;
   }

 Convert all return 0 functions to void?

 [...]

Yes, agree I'll change the prototype.

 +
 +#define MAILBOX_FILL_HEADER_MSG(_msg, _header) \
 +MAILBOX_FILL_MSG(_msg, _header, NULL, 0);
 +

 I used these patches as part of the suspend-resume support for AM335x
 which has the same mailbox IP as OMAP4. I used the MAILBOX_FILL_HEADER_MSG
 helper and things work as expected.

Nice.

 However, I found the 'header' part to be very confusing. Why not treat the
 OMAP case as a special case of the new MAILBOX_FILL_MSG where the data size
 is set to 1?

Yes it is another possibility. Changes are not big.
Omar, what's your view on this point?

Regards,
Loic

 Regards,
 Vaibhav--
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 5/9] mailbox: change protection mechanisms

2012-12-21 Thread Loic PALLARDY


On 12/21/2012 11:28 AM, Bedia, Vaibhav wrote:
 On Tue, Dec 18, 2012 at 18:40:08, Loic Pallardy wrote:
 TX: replace spin by mutex
 RX: replace spin_lock_irq by spin_lock_irqsave


 Can you please add a short note on why this is being done?

Ok I'll add more information in commit message in next version.

Regards,
Loic

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


Re: [PATCH 1/9] mailbox: OMAP: introduce mailbox framework

2012-12-21 Thread Loic PALLARDY


On 12/21/2012 11:49 AM, Bedia, Vaibhav wrote:
 On Fri, Dec 21, 2012 at 14:24:26, Loic PALLARDY wrote:

 I have a few patches which are dependent on this patch series.
 Could you please keep me in cc for the future versions.

Sure, I'll.

/Loic
 Thanks,
 Vaibhav--
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/9] drivers: mailbox: framework creation

2012-12-18 Thread Loic Pallardy
OMAP and ST-Ericsson platforms are both using mailbox to communicate
with some coprocessors.
Based on OMAP existing mailbox framework, this series proposes a
generic framework, living under drivers/mailbox.

This series:
- moves omap-mailbox framework to a newly drivers/mailbox folder
  (part of plat-omap code cleaning)
- creates API header file
- replaces omap prefix by mailbox
- opens interface and make framework independent from omap HW
- adapts existing omap1 and omap2 drivers to new changes
- creates dbx500 mailbox driver for ST-Ericsson platforms

Signed-off-by: Omar Ramirez Luna omar.l...@linaro.org
Signed-off-by: Loic Pallardy loic.palla...@st.com

Based on 3.7-rc7.

Loic Pallardy (9):
  mailbox: OMAP: introduce mailbox framework
  mailbox: split internal header from API header
  mailbox: rename omap_mbox in mailbox
  mailbox: create opened message type
  mailbox: change protection mechanisms
  mailbox: add shared memory mailbox type
  mailbox: add IRQF_NO_SUSPEND flag
  mailbox: add no_irq send message
  mailbox: create dbx500 mailbox driver

 arch/arm/configs/omap1_defconfig   |   3 +-
 arch/arm/mach-omap1/Makefile   |   4 -
 arch/arm/mach-omap1/mailbox.c  | 199 ---
 arch/arm/mach-omap2/Makefile   |   3 -
 arch/arm/mach-omap2/devices.c  |   4 +-
 arch/arm/plat-omap/Kconfig |  16 -
 arch/arm/plat-omap/Makefile|   3 -
 arch/arm/plat-omap/include/plat/mailbox.h  | 105 
 arch/arm/plat-omap/mailbox.c   | 435 ---
 drivers/Kconfig|   2 +
 drivers/Makefile   |   1 +
 drivers/mailbox/Kconfig|  51 ++
 drivers/mailbox/Makefile   |   5 +
 drivers/mailbox/mailbox-dbx500.c   | 601 +
 drivers/mailbox/mailbox-omap1.c| 222 
 .../mailbox.c = drivers/mailbox/mailbox-omap2.c   | 230 
 drivers/mailbox/mailbox.c  | 551 +++
 drivers/mailbox/mailbox.h  |  66 +++
 include/linux/mailbox.h|  36 ++
 include/linux/platform_data/mailbox-dbx500.h   |  13 +
 20 files changed, 1672 insertions(+), 878 deletions(-)
 delete mode 100644 arch/arm/mach-omap1/mailbox.c
 delete mode 100644 arch/arm/plat-omap/include/plat/mailbox.h
 delete mode 100644 arch/arm/plat-omap/mailbox.c
 create mode 100644 drivers/mailbox/Kconfig
 create mode 100644 drivers/mailbox/Makefile
 create mode 100644 drivers/mailbox/mailbox-dbx500.c
 create mode 100644 drivers/mailbox/mailbox-omap1.c
 rename arch/arm/mach-omap2/mailbox.c = drivers/mailbox/mailbox-omap2.c (56%)
 create mode 100644 drivers/mailbox/mailbox.c
 create mode 100644 drivers/mailbox/mailbox.h
 create mode 100644 include/linux/mailbox.h
 create mode 100644 include/linux/platform_data/mailbox-dbx500.h

-- 
1.7.11.1

--
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/9] mailbox: create opened message type

2012-12-18 Thread Loic Pallardy
Current message type is a u32 to fit HW fifo format.
This should be extended to support any message exchanges
and type of mailbox.
Propose structure owns the original u32 and an optional
pointer on additional data.

Signed-off-by: Loic Pallardy loic.palla...@st.com
---
 drivers/mailbox/Kconfig |  9 ++
 drivers/mailbox/mailbox-omap1.c | 18 ++--
 drivers/mailbox/mailbox-omap2.c | 10 ---
 drivers/mailbox/mailbox.c   | 64 +
 drivers/mailbox/mailbox.h   |  6 ++--
 include/linux/mailbox.h | 17 ++-
 6 files changed, 89 insertions(+), 35 deletions(-)

diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig
index d1e7d74..efb766f 100644
--- a/drivers/mailbox/Kconfig
+++ b/drivers/mailbox/Kconfig
@@ -33,4 +33,13 @@ config MBOX_KFIFO_SIZE
  This can also be changed at runtime (via the mbox_kfifo_size
  module parameter).
 
+config MBOX_DATA_SIZE
+   int Mailbox associated data max size (bytes)
+   default 64
+   help
+ Specify the default size of mailbox's associated data buffer
+ (bytes)
+  This can also be changed at runtime (via the mbox_kfifo_size
+  module parameter).
+
 endif
diff --git a/drivers/mailbox/mailbox-omap1.c b/drivers/mailbox/mailbox-omap1.c
index 31cb70a..94e90af 100644
--- a/drivers/mailbox/mailbox-omap1.c
+++ b/drivers/mailbox/mailbox-omap1.c
@@ -50,26 +50,26 @@ static inline void mbox_write_reg(u32 val, size_t ofs)
 }
 
 /* msg */
-static mbox_msg_t omap1_mbox_fifo_read(struct mailbox *mbox)
+static int omap1_mbox_fifo_read(struct mailbox *mbox, struct mailbox_msg *msg)
 {
struct omap_mbox1_fifo *fifo =
((struct omap_mbox1_priv *)mbox-priv)-rx_fifo;
-   mbox_msg_t msg;
 
-   msg = mbox_read_reg(fifo-data);
-   msg |= ((mbox_msg_t) mbox_read_reg(fifo-cmd))  16;
+   msg-header = mbox_read_reg(fifo-data);
+   msg-header |= ((mbox_msg_t) mbox_read_reg(fifo-cmd))  16;
 
-   return msg;
+   return 0;
 }
 
-static void
-omap1_mbox_fifo_write(struct mailbox *mbox, mbox_msg_t msg)
+static int
+omap1_mbox_fifo_write(struct mailbox *mbox, struct mailbox_msg *msg)
 {
struct omap_mbox1_fifo *fifo =
((struct omap_mbox1_priv *)mbox-priv)-tx_fifo;
 
-   mbox_write_reg(msg  0x, fifo-data);
-   mbox_write_reg(msg  16, fifo-cmd);
+   mbox_write_reg(msg-header  0x, fifo-data);
+   mbox_write_reg(msg-header  16, fifo-cmd);
+   return 0
 }
 
 static int omap1_mbox_fifo_empty(struct mailbox *mbox)
diff --git a/drivers/mailbox/mailbox-omap2.c b/drivers/mailbox/mailbox-omap2.c
index 230d9d3..2299674 100644
--- a/drivers/mailbox/mailbox-omap2.c
+++ b/drivers/mailbox/mailbox-omap2.c
@@ -95,18 +95,20 @@ static void omap2_mbox_shutdown(struct mailbox *mbox)
 }
 
 /* Mailbox FIFO handle functions */
-static mbox_msg_t omap2_mbox_fifo_read(struct mailbox *mbox)
+static int omap2_mbox_fifo_read(struct mailbox *mbox, struct mailbox_msg *msg)
 {
struct omap_mbox2_fifo *fifo =
((struct omap_mbox2_priv *)mbox-priv)-rx_fifo;
-   return (mbox_msg_t) mbox_read_reg(fifo-msg);
+   msg-header = mbox_read_reg(fifo-msg);
+   return 0;
 }
 
-static void omap2_mbox_fifo_write(struct mailbox *mbox, mbox_msg_t msg)
+static int omap2_mbox_fifo_write(struct mailbox *mbox, struct mailbox_msg *msg)
 {
struct omap_mbox2_fifo *fifo =
((struct omap_mbox2_priv *)mbox-priv)-tx_fifo;
-   mbox_write_reg(msg, fifo-msg);
+   mbox_write_reg(msg-header, fifo-msg);
+   return 0;
 }
 
 static int omap2_mbox_fifo_empty(struct mailbox *mbox)
diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index b9389c6..727e67e 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -43,12 +43,13 @@ static unsigned int mbox_kfifo_size = 
CONFIG_MBOX_KFIFO_SIZE;
 module_param(mbox_kfifo_size, uint, S_IRUGO);
 MODULE_PARM_DESC(mbox_kfifo_size, Size of mailbox kfifo (bytes));
 
+
 /* Mailbox FIFO handle functions */
-static inline mbox_msg_t mbox_fifo_read(struct mailbox *mbox)
+static inline mbox_msg_t mbox_fifo_read(struct mailbox *mbox, struct 
mailbox_msg *msg)
 {
-   return mbox-ops-fifo_read(mbox);
+   return mbox-ops-fifo_read(mbox, msg);
 }
-static inline void mbox_fifo_write(struct mailbox *mbox, mbox_msg_t msg)
+static inline void mbox_fifo_write(struct mailbox *mbox, struct mailbox_msg 
*msg)
 {
mbox-ops-fifo_write(mbox, msg);
 }
@@ -89,14 +90,14 @@ static int __mbox_poll_for_space(struct mailbox *mbox)
return ret;
 }
 
-int mailbox_msg_send(struct mailbox *mbox, mbox_msg_t msg)
+int mailbox_msg_send(struct mailbox *mbox, struct mailbox_msg *msg)
 {
struct mailbox_queue *mq = mbox-txq;
int ret = 0, len;
 
spin_lock_bh(mq-lock);
 
-   if (kfifo_avail(mq-fifo)  sizeof(msg)) {
+   if (kfifo_avail(mq-fifo)  (sizeof(msg) + msg-size)) {
ret

[PATCH 1/9] mailbox: OMAP: introduce mailbox framework

2012-12-18 Thread Loic Pallardy
Actually moving it from plat-omap, as this framework/driver code is
supposed to be under drivers/ folder. The framework should work with
the current supported OMAP processors (OMAP1+) that have mailbox and
can be used as a method of interprocessor communication.

The mailbox hardware (in OMAP) uses a queued mailbox-interrupt mechanism
that provides a communication channel between processors through a set of
registers and their associated interrupt signals by sending and receiving
messages.

As part of the migration from plat and mach code:
- Kconfig symbols have been renamed to build OMAP1 or OMAP2+ drivers.
- mailbox.h has been changed from plat to a dedicated drivers/ folder.
- soc.h has been changed for plat/cpu.h, since there are dependencies in
  the cpu_is_() macro.

Module names have changed too, instead of mailbox_mach:
- OMAP1: mailbox-omap1.ko
- OMAP2+: mailbox-omap2.ko

Signed-off-by: Omar Ramirez Luna omar.l...@linaro.org
---
 arch/arm/configs/omap1_defconfig   |   3 +-
 arch/arm/mach-omap1/Makefile   |   4 -
 arch/arm/mach-omap2/Makefile   |   3 -
 arch/arm/mach-omap2/devices.c  |   4 +-
 arch/arm/plat-omap/Kconfig |  16 ---
 arch/arm/plat-omap/Makefile|   3 -
 drivers/Kconfig|   2 +
 drivers/Makefile   |   1 +
 drivers/mailbox/Kconfig|  37 +
 drivers/mailbox/Makefile   |   4 +
 .../mailbox.c = drivers/mailbox/mailbox-omap1.c   |  65 -
 .../mailbox.c = drivers/mailbox/mailbox-omap2.c   | 160 ++---
 {arch/arm/plat-omap = drivers/mailbox}/mailbox.c  |  18 +--
 .../include/plat = drivers/mailbox}/mailbox.h |  58 
 14 files changed, 199 insertions(+), 179 deletions(-)
 create mode 100644 drivers/mailbox/Kconfig
 create mode 100644 drivers/mailbox/Makefile
 rename arch/arm/mach-omap1/mailbox.c = drivers/mailbox/mailbox-omap1.c (75%)
 rename arch/arm/mach-omap2/mailbox.c = drivers/mailbox/mailbox-omap2.c (69%)
 rename {arch/arm/plat-omap = drivers/mailbox}/mailbox.c (97%)
 rename {arch/arm/plat-omap/include/plat = drivers/mailbox}/mailbox.h (57%)

diff --git a/arch/arm/configs/omap1_defconfig b/arch/arm/configs/omap1_defconfig
index dde2a1a..37894db 100644
--- a/arch/arm/configs/omap1_defconfig
+++ b/arch/arm/configs/omap1_defconfig
@@ -26,7 +26,8 @@ CONFIG_ARCH_OMAP=y
 CONFIG_ARCH_OMAP1=y
 CONFIG_OMAP_RESET_CLOCKS=y
 # CONFIG_OMAP_MUX is not set
-CONFIG_OMAP_MBOX_FWK=y
+CONFIG_MAILBOX=y
+CONFIG_OMAP1_MBOX=y
 CONFIG_OMAP_32K_TIMER=y
 CONFIG_OMAP_DM_TIMER=y
 CONFIG_ARCH_OMAP730=y
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index cd169c3..48275f8 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -18,10 +18,6 @@ obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o
 # Power Management
 obj-$(CONFIG_PM) += pm.o sleep.o
 
-# DSP
-obj-$(CONFIG_OMAP_MBOX_FWK)+= mailbox_mach.o
-mailbox_mach-objs  := mailbox.o
-
 i2c-omap-$(CONFIG_I2C_OMAP):= i2c.o
 obj-y  += $(i2c-omap-m) $(i2c-omap-y)
 
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index fe40d9e..3907fc5 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -181,9 +181,6 @@ obj-$(CONFIG_ARCH_OMAP4)+= 
omap_hwmod_44xx_data.o
 obj-$(CONFIG_OMAP3_EMU)+= emu.o
 obj-$(CONFIG_HW_PERF_EVENTS)   += pmu.o
 
-obj-$(CONFIG_OMAP_MBOX_FWK)+= mailbox_mach.o
-mailbox_mach-objs  := mailbox.o
-
 obj-$(CONFIG_OMAP_IOMMU)   += iommu2.o
 
 iommu-$(CONFIG_OMAP_IOMMU) := omap-iommu.o
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index c72b5a7..5ef4004 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -273,7 +273,7 @@ int __init omap4_keyboard_init(struct 
omap4_keypad_platform_data
return 0;
 }
 
-#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
+#if defined(CONFIG_OMAP2PLUS_MBOX) || defined(CONFIG_OMAP2PLUS_MBOX_MODULE)
 static inline void __init omap_init_mbox(void)
 {
struct omap_hwmod *oh;
@@ -291,7 +291,7 @@ static inline void __init omap_init_mbox(void)
 }
 #else
 static inline void omap_init_mbox(void) { }
-#endif /* CONFIG_OMAP_MBOX_FWK */
+#endif /* CONFIG_OMAP2PLUS_MBOX */
 
 static inline void omap_init_sti(void) {}
 
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index 82fcb20..419648f 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -116,22 +116,6 @@ config OMAP_MUX_WARNINGS
  to change the pin multiplexing setup.  When there are no warnings
  printed, it's safe to deselect OMAP_MUX for your product.
 
-config OMAP_MBOX_FWK
-   tristate Mailbox framework support

[PATCH 6/9] mailbox: add shared memory mailbox type

2012-12-18 Thread Loic Pallardy
Some mailboxes are made up of cross interrupts
and associated shared memory.
Shared memory mapping is fixed and cross interrupt/shared
memory relation make impossible the use of virtio.
Mailbox framework must be enough opened to support
any kind of mailbox.

Signed-off-by: Loic Pallardy loic.palla...@st.com
---
 drivers/mailbox/mailbox-omap1.c | 40 +++-
 drivers/mailbox/mailbox-omap2.c | 16 
 drivers/mailbox/mailbox.c   | 38 +++---
 drivers/mailbox/mailbox.h   | 14 --
 4 files changed, 62 insertions(+), 46 deletions(-)

diff --git a/drivers/mailbox/mailbox-omap1.c b/drivers/mailbox/mailbox-omap1.c
index 94e90af..0097342 100644
--- a/drivers/mailbox/mailbox-omap1.c
+++ b/drivers/mailbox/mailbox-omap1.c
@@ -37,6 +37,7 @@ struct omap_mbox1_fifo {
 struct omap_mbox1_priv {
struct omap_mbox1_fifo tx_fifo;
struct omap_mbox1_fifo rx_fifo;
+   bool empty_flag;
 };
 
 static inline int mbox_read_reg(size_t ofs)
@@ -52,12 +53,12 @@ static inline void mbox_write_reg(u32 val, size_t ofs)
 /* msg */
 static int omap1_mbox_fifo_read(struct mailbox *mbox, struct mailbox_msg *msg)
 {
-   struct omap_mbox1_fifo *fifo =
-   ((struct omap_mbox1_priv *)mbox-priv)-rx_fifo;
+   struct omap_mbox1_priv *priv = (struct omap_mbox1_priv *)mbox-priv;
+   struct omap_mbox1_fifo *fifo = priv-rx_fifo;
 
msg-header = mbox_read_reg(fifo-data);
msg-header |= ((mbox_msg_t) mbox_read_reg(fifo-cmd))  16;
-
+   priv-empty_flag = false;
return 0;
 }
 
@@ -69,12 +70,16 @@ omap1_mbox_fifo_write(struct mailbox *mbox, struct 
mailbox_msg *msg)
 
mbox_write_reg(msg-header  0x, fifo-data);
mbox_write_reg(msg-header  16, fifo-cmd);
-   return 0
+   return 0;
 }
 
 static int omap1_mbox_fifo_empty(struct mailbox *mbox)
 {
-   return 0;
+   struct omap_mbox1_priv *priv = (struct omap_mbox1_priv *)mbox-priv;
+   if (priv-empty_flag)
+   return 0;
+   else
+   return 1;
 }
 
 static int omap1_mbox_fifo_full(struct mailbox *mbox)
@@ -85,6 +90,18 @@ static int omap1_mbox_fifo_full(struct mailbox *mbox)
return mbox_read_reg(fifo-flag);
 }
 
+static int ompa1_mbox_poll_for_space(struct mailbox *mbox)
+{
+   int ret = 0, i = 1000;
+
+   while (omap1_mbox_fifo_full(mbox)) {
+   if (--i == 0)
+   return -1;
+   udelay(1);
+   }
+   return ret;
+}
+
 /* irq */
 static void
 omap1_mbox_enable_irq(struct mailbox *mbox, mailbox_type_t irq)
@@ -103,17 +120,22 @@ omap1_mbox_disable_irq(struct mailbox *mbox, 
mailbox_type_t irq)
 static int
 omap1_mbox_is_irq(struct mailbox *mbox, mailbox_type_t irq)
 {
+   struct omap_mbox1_priv *priv = (struct omap_mbox1_priv *)mbox-priv;
+
if (irq == IRQ_TX)
return 0;
+   if (irq == IRQ_RX)
+   priv-empty_flag = true;
+
return 1;
 }
 
 static struct mailbox_ops omap1_mbox_ops = {
.type   = MBOX_HW_FIFO1_TYPE,
-   .fifo_read  = omap1_mbox_fifo_read,
-   .fifo_write = omap1_mbox_fifo_write,
-   .fifo_empty = omap1_mbox_fifo_empty,
-   .fifo_full  = omap1_mbox_fifo_full,
+   .read   = omap1_mbox_fifo_read,
+   .write  = omap1_mbox_fifo_write,
+   .empty = omap1_mbox_fifo_empty,
+   .poll_for_space = ompa1_mbox_poll_for_space,
.enable_irq = omap1_mbox_enable_irq,
.disable_irq= omap1_mbox_disable_irq,
.is_irq = omap1_mbox_is_irq,
diff --git a/drivers/mailbox/mailbox-omap2.c b/drivers/mailbox/mailbox-omap2.c
index 2299674..7c26bed 100644
--- a/drivers/mailbox/mailbox-omap2.c
+++ b/drivers/mailbox/mailbox-omap2.c
@@ -125,6 +125,14 @@ static int omap2_mbox_fifo_full(struct mailbox *mbox)
return mbox_read_reg(fifo-fifo_stat);
 }
 
+static int ompa2_mbox_poll_for_space(struct mailbox *mbox)
+{
+   if (omap2_mbox_fifo_full(mbox))
+   return -1;
+
+   return 0;
+}
+
 /* Mailbox IRQ handle functions */
 static void omap2_mbox_enable_irq(struct mailbox *mbox,
mailbox_type_t irq)
@@ -210,10 +218,10 @@ static struct mailbox_ops omap2_mbox_ops = {
.type   = MBOX_HW_FIFO2_TYPE,
.startup= omap2_mbox_startup,
.shutdown   = omap2_mbox_shutdown,
-   .fifo_read  = omap2_mbox_fifo_read,
-   .fifo_write = omap2_mbox_fifo_write,
-   .fifo_empty = omap2_mbox_fifo_empty,
-   .fifo_full  = omap2_mbox_fifo_full,
+   .read   = omap2_mbox_fifo_read,
+   .write  = omap2_mbox_fifo_write,
+   .empty  = omap2_mbox_fifo_empty,
+   .poll_for_space = ompa2_mbox_poll_for_space,
.enable_irq = omap2_mbox_enable_irq,
.disable_irq= omap2_mbox_disable_irq,
.ack_irq= omap2_mbox_ack_irq,
diff --git

[PATCH 3/9] mailbox: rename omap_mbox in mailbox

2012-12-18 Thread Loic Pallardy
In order to create a generic mailbox framework, functions
and structures should be renamed in mailbox.

Signed-off-by: Loic Pallardy loic.palla...@st.com
---
 drivers/mailbox/Kconfig |   3 +-
 drivers/mailbox/mailbox-omap1.c |  28 -
 drivers/mailbox/mailbox-omap2.c |  60 +-
 drivers/mailbox/mailbox.c   | 133 
 drivers/mailbox/mailbox.h   |  56 -
 include/linux/mailbox.h |  22 +++
 6 files changed, 151 insertions(+), 151 deletions(-)

diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig
index e98ca6c..d1e7d74 100644
--- a/drivers/mailbox/Kconfig
+++ b/drivers/mailbox/Kconfig
@@ -25,9 +25,8 @@ config OMAP2PLUS_MBOX
  to use OMAP2+ Mailbox framework support.
 
 
-config OMAP_MBOX_KFIFO_SIZE
+config MBOX_KFIFO_SIZE
int Mailbox kfifo default buffer size (bytes)
-   depends on OMAP1_MBOX || OMAP2PLUS_MBOX
default 256
help
  Specify the default size of mailbox's kfifo buffers (bytes).
diff --git a/drivers/mailbox/mailbox-omap1.c b/drivers/mailbox/mailbox-omap1.c
index d681d4e..31cb70a 100644
--- a/drivers/mailbox/mailbox-omap1.c
+++ b/drivers/mailbox/mailbox-omap1.c
@@ -50,7 +50,7 @@ static inline void mbox_write_reg(u32 val, size_t ofs)
 }
 
 /* msg */
-static mbox_msg_t omap1_mbox_fifo_read(struct omap_mbox *mbox)
+static mbox_msg_t omap1_mbox_fifo_read(struct mailbox *mbox)
 {
struct omap_mbox1_fifo *fifo =
((struct omap_mbox1_priv *)mbox-priv)-rx_fifo;
@@ -63,7 +63,7 @@ static mbox_msg_t omap1_mbox_fifo_read(struct omap_mbox *mbox)
 }
 
 static void
-omap1_mbox_fifo_write(struct omap_mbox *mbox, mbox_msg_t msg)
+omap1_mbox_fifo_write(struct mailbox *mbox, mbox_msg_t msg)
 {
struct omap_mbox1_fifo *fifo =
((struct omap_mbox1_priv *)mbox-priv)-tx_fifo;
@@ -72,12 +72,12 @@ omap1_mbox_fifo_write(struct omap_mbox *mbox, mbox_msg_t 
msg)
mbox_write_reg(msg  16, fifo-cmd);
 }
 
-static int omap1_mbox_fifo_empty(struct omap_mbox *mbox)
+static int omap1_mbox_fifo_empty(struct mailbox *mbox)
 {
return 0;
 }
 
-static int omap1_mbox_fifo_full(struct omap_mbox *mbox)
+static int omap1_mbox_fifo_full(struct mailbox *mbox)
 {
struct omap_mbox1_fifo *fifo =
((struct omap_mbox1_priv *)mbox-priv)-rx_fifo;
@@ -87,29 +87,29 @@ static int omap1_mbox_fifo_full(struct omap_mbox *mbox)
 
 /* irq */
 static void
-omap1_mbox_enable_irq(struct omap_mbox *mbox, omap_mbox_type_t irq)
+omap1_mbox_enable_irq(struct mailbox *mbox, mailbox_type_t irq)
 {
if (irq == IRQ_RX)
enable_irq(mbox-irq);
 }
 
 static void
-omap1_mbox_disable_irq(struct omap_mbox *mbox, omap_mbox_type_t irq)
+omap1_mbox_disable_irq(struct mailbox *mbox, mailbox_type_t irq)
 {
if (irq == IRQ_RX)
disable_irq(mbox-irq);
 }
 
 static int
-omap1_mbox_is_irq(struct omap_mbox *mbox, omap_mbox_type_t irq)
+omap1_mbox_is_irq(struct mailbox *mbox, mailbox_type_t irq)
 {
if (irq == IRQ_TX)
return 0;
return 1;
 }
 
-static struct omap_mbox_ops omap1_mbox_ops = {
-   .type   = OMAP_MBOX_TYPE1,
+static struct mailbox_ops omap1_mbox_ops = {
+   .type   = MBOX_HW_FIFO1_TYPE,
.fifo_read  = omap1_mbox_fifo_read,
.fifo_write = omap1_mbox_fifo_write,
.fifo_empty = omap1_mbox_fifo_empty,
@@ -135,19 +135,19 @@ static struct omap_mbox1_priv omap1_mbox_dsp_priv = {
},
 };
 
-static struct omap_mbox mbox_dsp_info = {
+static struct mailbox mbox_dsp_info = {
.name   = dsp,
.ops= omap1_mbox_ops,
.priv   = omap1_mbox_dsp_priv,
 };
 
-static struct omap_mbox *omap1_mboxes[] = { mbox_dsp_info, NULL };
+static struct mailbox *omap1_mboxes[] = { mbox_dsp_info, NULL };
 
 static int __devinit omap1_mbox_probe(struct platform_device *pdev)
 {
struct resource *mem;
int ret;
-   struct omap_mbox **list;
+   struct mailbox **list;
 
list = omap1_mboxes;
list[0]-irq = platform_get_irq_byname(pdev, dsp);
@@ -157,7 +157,7 @@ static int __devinit omap1_mbox_probe(struct 
platform_device *pdev)
if (!mbox_base)
return -ENOMEM;
 
-   ret = omap_mbox_register(pdev-dev, list);
+   ret = mailbox_register(pdev-dev, list);
if (ret) {
iounmap(mbox_base);
return ret;
@@ -168,7 +168,7 @@ static int __devinit omap1_mbox_probe(struct 
platform_device *pdev)
 
 static int __devexit omap1_mbox_remove(struct platform_device *pdev)
 {
-   omap_mbox_unregister();
+   mailbox_unregister();
iounmap(mbox_base);
return 0;
 }
diff --git a/drivers/mailbox/mailbox-omap2.c b/drivers/mailbox/mailbox-omap2.c
index 7dcffa8..230d9d3 100644
--- a/drivers/mailbox/mailbox-omap2.c
+++ b/drivers/mailbox/mailbox-omap2.c
@@ -61,8 +61,8 @@ struct omap_mbox2_priv {
unsigned long

[PATCH 5/9] mailbox: change protection mechanisms

2012-12-18 Thread Loic Pallardy
TX: replace spin by mutex
RX: replace spin_lock_irq by spin_lock_irqsave

Signed-off-by: Loic Pallardy loic.palla...@st.com
---
 drivers/mailbox/mailbox.c | 10 ++
 drivers/mailbox/mailbox.h |  1 +
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index 727e67e..8b7d7bd 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -95,7 +95,7 @@ int mailbox_msg_send(struct mailbox *mbox, struct mailbox_msg 
*msg)
struct mailbox_queue *mq = mbox-txq;
int ret = 0, len;
 
-   spin_lock_bh(mq-lock);
+   mutex_lock(mq-mlock);
 
if (kfifo_avail(mq-fifo)  (sizeof(msg) + msg-size)) {
ret = -ENOMEM;
@@ -118,7 +118,7 @@ int mailbox_msg_send(struct mailbox *mbox, struct 
mailbox_msg *msg)
tasklet_schedule(mbox-txq-tasklet);
 
 out:
-   spin_unlock_bh(mq-lock);
+   mutex_unlock(mq-mlock);
return ret;
 }
 EXPORT_SYMBOL(mailbox_msg_send);
@@ -198,6 +198,7 @@ static void mbox_rx_work(struct work_struct *work)
int len;
struct mailbox *mbox = mq-mbox;
struct mailbox_msg msg;
+   unsigned long flags;
 
while (kfifo_len(mq-fifo) = sizeof(msg)) {
len = kfifo_out(mq-fifo, (unsigned char *)msg, sizeof(msg));
@@ -210,12 +211,12 @@ static void mbox_rx_work(struct work_struct *work)
}
 
blocking_notifier_call_chain(mbox-notifier, len, (void 
*)msg);
-   spin_lock_irq(mq-lock);
+   spin_lock_irqsave(mq-lock, flags);
if (mq-full) {
mq-full = false;
mailbox_enable_irq(mbox, IRQ_RX);
}
-   spin_unlock_irq(mq-lock);
+   spin_unlock_irqrestore(mq-lock, flags);
}
 }
 
@@ -288,6 +289,7 @@ static struct mailbox_queue *mbox_queue_alloc(struct 
mailbox *mbox,
return NULL;
 
spin_lock_init(mq-lock);
+   mutex_init(mq-mlock);
 
if (kfifo_alloc(mq-fifo, mbox_kfifo_size, GFP_KERNEL))
goto error;
diff --git a/drivers/mailbox/mailbox.h b/drivers/mailbox/mailbox.h
index 23ac551..0a31c99 100644
--- a/drivers/mailbox/mailbox.h
+++ b/drivers/mailbox/mailbox.h
@@ -37,6 +37,7 @@ struct mailbox_ops {
 
 struct mailbox_queue {
spinlock_t  lock;
+   struct mutexmlock;
struct kfifofifo;
struct work_struct  work;
struct tasklet_struct   tasklet;
-- 
1.7.11.1

--
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/9] mailbox: add no_irq send message

2012-12-18 Thread Loic Pallardy
For debug purpose, mailbox must be available when
interrupts are disabled to collect dump information.

Signed-off-by: Loic Pallardy loic.palla...@st.com
---
 drivers/mailbox/mailbox.c | 66 +++
 include/linux/mailbox.h   |  3 +++
 2 files changed, 69 insertions(+)

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index 57cb566..2f50226 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -110,6 +110,72 @@ out:
 }
 EXPORT_SYMBOL(mailbox_msg_send);
 
+#define TRANSFER_TIMEOUT 3 /* Becomes ~3s timeout */
+
+static struct mailbox_msg no_irq_msg_res;
+
+struct mailbox_msg *mailbox_msg_send_receive_no_irq(struct mailbox *mbox,
+   struct mailbox_msg *msg)
+{
+   int ret = 0;
+   int count = 0;
+
+   BUG_ON(!irqs_disabled());
+
+   if (likely(mbox-ops-write  mbox-ops-read)) {
+   if (__mbox_poll_for_space(mbox)) {
+   ret = -EBUSY;
+   goto out;
+   }
+   mbox-ops-write(mbox, msg);
+   while (!is_mbox_irq(mbox, IRQ_RX)) {
+   udelay(100);
+   cpu_relax();
+   count++;
+   if (count  TRANSFER_TIMEOUT) {
+   pr_err(%s: Error: transfer timed out\n,
+   __func__);
+   ret = -EINVAL;
+   goto out;
+   }
+   }
+   mbox-ops-read(mbox, no_irq_msg_res);
+   ack_mbox_irq(mbox, IRQ_RX);
+   } else {
+   ret = -EINVAL;
+   }
+
+out:
+   BUG_ON(ret  0);
+
+   return no_irq_msg_res;
+}
+EXPORT_SYMBOL(mailbox_msg_send_receive_no_irq);
+
+int mailbox_msg_send_no_irq(struct mailbox *mbox,
+   struct mailbox_msg *msg)
+{
+   int ret = 0;
+
+   BUG_ON(!irqs_disabled());
+
+   if (likely(mbox-ops-write)) {
+   if (__mbox_poll_for_space(mbox)) {
+   ret = -EBUSY;
+   goto out;
+   }
+   mbox-ops-write(mbox, msg);
+   } else {
+   ret = -EINVAL;
+   }
+
+out:
+   WARN_ON(ret  0);
+
+   return ret;
+}
+EXPORT_SYMBOL(mailbox_msg_send_no_irq);
+
 void mailbox_save_ctx(struct mailbox *mbox)
 {
if (!mbox-ops-save_ctx) {
diff --git a/include/linux/mailbox.h b/include/linux/mailbox.h
index d256e1a..3f9ec1e 100644
--- a/include/linux/mailbox.h
+++ b/include/linux/mailbox.h
@@ -23,6 +23,9 @@ struct mailbox_msg {
MAILBOX_FILL_MSG(_msg, _header, NULL, 0);
 
 int mailbox_msg_send(struct mailbox *, struct mailbox_msg *msg);
+struct mailbox_msg *mailbox_msg_send_receive_no_irq(struct mailbox *,
+   struct mailbox_msg *msg);
+int mailbox_msg_send_no_irq(struct mailbox *, struct mailbox_msg *msg);
 
 struct mailbox *mailbox_get(const char *, struct notifier_block *nb);
 void mailbox_put(struct mailbox *mbox, struct notifier_block *nb);
-- 
1.7.11.1

--
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 9/9] mailbox: create dbx500 mailbox driver

2012-12-18 Thread Loic Pallardy
Add STEriccson DBX500 PRCM mailbox support.

Signed-off-by: Loic Pallardy loic.palla...@st.com
---
 drivers/mailbox/Kconfig  |  18 +-
 drivers/mailbox/Makefile |   1 +
 drivers/mailbox/mailbox-dbx500.c | 601 +++
 include/linux/platform_data/mailbox-dbx500.h |  13 +
 4 files changed, 627 insertions(+), 6 deletions(-)
 create mode 100644 drivers/mailbox/mailbox-dbx500.c
 create mode 100644 include/linux/platform_data/mailbox-dbx500.h

diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig
index efb766f..9246e67 100644
--- a/drivers/mailbox/Kconfig
+++ b/drivers/mailbox/Kconfig
@@ -24,14 +24,20 @@ config OMAP2PLUS_MBOX
  OMAP2/3; or IPU, IVA HD and DSP in OMAP4. Say Y here if you want
  to use OMAP2+ Mailbox framework support.
 
+config DBX500_MBOX
+   tristate DBx500 Mailbox driver support
+   depends on ARCH_U8500
+   help
+ Say Y here if you want to use DBx500 Mailbox driver support for
+ power coprocessor access on Ux500 and Ux540 families
 
 config MBOX_KFIFO_SIZE
-   int Mailbox kfifo default buffer size (bytes)
-   default 256
-   help
- Specify the default size of mailbox's kfifo buffers (bytes).
- This can also be changed at runtime (via the mbox_kfifo_size
- module parameter).
+int Mailbox kfifo default buffer size (bytes)
+default 256
+help
+  Specify the default size of mailbox's kfifo buffers (bytes).
+  This can also be changed at runtime (via the mbox_kfifo_size
+  module parameter).
 
 config MBOX_DATA_SIZE
int Mailbox associated data max size (bytes)
diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile
index 4085b71..c04ce79 100644
--- a/drivers/mailbox/Makefile
+++ b/drivers/mailbox/Makefile
@@ -2,3 +2,4 @@ obj-$(CONFIG_MAILBOX) += mailbox.o
 
 obj-$(CONFIG_OMAP1_MBOX)   += mailbox-omap1.o
 obj-$(CONFIG_OMAP2PLUS_MBOX)   += mailbox-omap2.o
+obj-$(CONFIG_DBX500_MBOX)  += mailbox-dbx500.o
diff --git a/drivers/mailbox/mailbox-dbx500.c b/drivers/mailbox/mailbox-dbx500.c
new file mode 100644
index 000..030e1eb
--- /dev/null
+++ b/drivers/mailbox/mailbox-dbx500.c
@@ -0,0 +1,601 @@
+/*
+ * Copyright (C) ST-Ericsson SA 2012
+ *
+ * License Terms: GNU General Public License v2
+ * Author: Loic Pallardy loic.palla...@st.com for ST-Ericsson
+ * DBX500 PRCM Mailbox driver
+ *
+ */
+
+#include linux/module.h
+#include linux/err.h
+#include linux/platform_device.h
+#include linux/irq.h
+#include linux/io.h
+#include linux/platform_data/mailbox-dbx500.h
+#include linux/of.h
+#include linux/of_device.h
+
+#include mailbox.h
+
+#define MAILBOX_LEGACY 0
+#define MAILBOX_UPAP   1
+
+enum {
+   MAILBOX_BLOCKING,
+   MAILBOX_ATOMIC,
+};
+
+/* CPU mailbox registers */
+#define PRCM_MBOX_CPU_VAL  0x0fc
+#define PRCM_MBOX_CPU_SET  0x100
+#define PRCM_MBOX_CPU_CLR  0x104
+
+#define PRCM_ARM_IT1_CLR   0x48C
+#define PRCM_ARM_IT1_VAL   0x494
+
+#define NUM_MB 8
+#define MBOX_BIT BIT
+#define ALL_MBOX_BITS (MBOX_BIT(NUM_MB) - 1)
+
+/* CPU mailbox share memory */
+#define _PRCM_MBOX_HEADER  0x214 /* 16 bytes */
+#define PRCM_MBOX_HEADER_REQ_MB0   (_PRCM_MBOX_HEADER + 0x0)
+#define PRCM_MBOX_HEADER_REQ_MB1   (_PRCM_MBOX_HEADER + 0x1)
+#define PRCM_MBOX_HEADER_REQ_MB2   (_PRCM_MBOX_HEADER + 0x2)
+#define PRCM_MBOX_HEADER_REQ_MB3   (_PRCM_MBOX_HEADER + 0x3)
+#define PRCM_MBOX_HEADER_REQ_MB4   (_PRCM_MBOX_HEADER + 0x4)
+#define PRCM_MBOX_HEADER_REQ_MB5   (_PRCM_MBOX_HEADER + 0x5)
+#define PRCM_MBOX_HEADER_ACK_MB0   (_PRCM_MBOX_HEADER + 0x8)
+
+/* Req Mailboxes */
+#define PRCM_REQ_MB0   0x208 /* 12 bytes  */
+#define PRCM_REQ_MB1   0x1FC /* 12 bytes  */
+#define PRCM_REQ_MB2   0x1EC /* 16 bytes  */
+#define PRCM_REQ_MB3   0x78  /* 372 bytes  */
+#define PRCM_REQ_MB4   0x74  /* 4 bytes  */
+#define PRCM_REQ_MB5   0x70  /* 4 bytes  */
+#define PRCM_REQ_PASR  0x30 /* 4 bytes */
+
+/* Ack Mailboxes */
+#define PRCM_ACK_MB0   0x34 /* 52 bytes  */
+#define PRCM_ACK_MB1   0x30 /* 4 bytes */
+#define PRCM_ACK_MB2   0x2C /* 4 bytes */
+#define PRCM_ACK_MB3   0x28 /* 4 bytes */
+#define PRCM_ACK_MB4   0x24 /* 4 bytes */
+#define PRCM_ACK_MB5   0x20 /* 4 bytes */
+
+/* Ack Mailboxe sizes */
+#define PRCM_ACK_MB0_SIZE  0x24 /* 52 bytes  */
+#define PRCM_ACK_MB1_SIZE  0x4 /* 4 bytes */
+#define PRCM_ACK_MB2_SIZE  0x1 /* 1 bytes */
+#define PRCM_ACK_MB3_SIZE  0x2 /* 2 bytes */
+#define PRCM_ACK_MB4_SIZE  0x0 /* 0 bytes */
+#define PRCM_ACK_MB5_SIZE  0x4 /* 4 bytes */
+
+static void __iomem *mbox_base;
+static void __iomem *tdcm_mem_base

[PATCH 2/9] mailbox: split internal header from API header

2012-12-18 Thread Loic Pallardy
Now internal structures can remain hidden to the user and just API
related functions and defines are made available.

Signed-off-by: Omar Ramirez Luna omar.l...@linaro.org
---
 drivers/mailbox/mailbox.c | 34 ++
 drivers/mailbox/mailbox.h | 44 +---
 include/linux/mailbox.h   | 18 ++
 3 files changed, 53 insertions(+), 43 deletions(-)
 create mode 100644 include/linux/mailbox.h

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index aec291d0..8cb3b15 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -116,6 +116,40 @@ out:
 }
 EXPORT_SYMBOL(omap_mbox_msg_send);
 
+void omap_mbox_save_ctx(struct omap_mbox *mbox)
+{
+   if (!mbox-ops-save_ctx) {
+   dev_err(mbox-dev, %s:\tno save\n, __func__);
+   return;
+   }
+
+   mbox-ops-save_ctx(mbox);
+}
+EXPORT_SYMBOL(omap_mbox_save_ctx);
+
+void omap_mbox_restore_ctx(struct omap_mbox *mbox)
+{
+   if (!mbox-ops-restore_ctx) {
+   dev_err(mbox-dev, %s:\tno restore\n, __func__);
+   return;
+   }
+
+   mbox-ops-restore_ctx(mbox);
+}
+EXPORT_SYMBOL(omap_mbox_restore_ctx);
+
+void omap_mbox_enable_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
+{
+   mbox-ops-enable_irq(mbox, irq);
+}
+EXPORT_SYMBOL(omap_mbox_enable_irq);
+
+void omap_mbox_disable_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
+{
+   mbox-ops-disable_irq(mbox, irq);
+}
+EXPORT_SYMBOL(omap_mbox_disable_irq);
+
 static void mbox_tx_tasklet(unsigned long tx_data)
 {
struct omap_mbox *mbox = (struct omap_mbox *)tx_data;
diff --git a/drivers/mailbox/mailbox.h b/drivers/mailbox/mailbox.h
index 88a9f6a..bf3c1b4 100644
--- a/drivers/mailbox/mailbox.h
+++ b/drivers/mailbox/mailbox.h
@@ -8,13 +8,7 @@
 #include linux/interrupt.h
 #include linux/device.h
 #include linux/kfifo.h
-
-typedef u32 mbox_msg_t;
-struct omap_mbox;
-
-typedef int __bitwise omap_mbox_irq_t;
-#define IRQ_TX ((__force omap_mbox_irq_t) 1)
-#define IRQ_RX ((__force omap_mbox_irq_t) 2)
+#include linux/mailbox.h
 
 typedef int __bitwise omap_mbox_type_t;
 #define OMAP_MBOX_TYPE1 ((__force omap_mbox_type_t) 1)
@@ -61,45 +55,9 @@ struct omap_mbox {
struct blocking_notifier_head   notifier;
 };
 
-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 *, struct notifier_block *nb);
-void omap_mbox_put(struct omap_mbox *mbox, struct notifier_block *nb);
-
 int omap_mbox_register(struct device *parent, struct omap_mbox **);
 int omap_mbox_unregister(void);
 
-static inline void omap_mbox_save_ctx(struct omap_mbox *mbox)
-{
-   if (!mbox-ops-save_ctx) {
-   dev_err(mbox-dev, %s:\tno save\n, __func__);
-   return;
-   }
-
-   mbox-ops-save_ctx(mbox);
-}
-
-static inline void omap_mbox_restore_ctx(struct omap_mbox *mbox)
-{
-   if (!mbox-ops-restore_ctx) {
-   dev_err(mbox-dev, %s:\tno restore\n, __func__);
-   return;
-   }
-
-   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/include/linux/mailbox.h b/include/linux/mailbox.h
new file mode 100644
index 000..78ef848
--- /dev/null
+++ b/include/linux/mailbox.h
@@ -0,0 +1,18 @@
+/* mailbox.h */
+
+typedef u32 mbox_msg_t;
+struct omap_mbox;
+
+typedef int __bitwise omap_mbox_irq_t;
+#define IRQ_TX ((__force omap_mbox_irq_t) 1)
+#define IRQ_RX ((__force omap_mbox_irq_t) 2)
+
+int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg);
+
+struct omap_mbox *omap_mbox_get(const char *, struct notifier_block *nb);
+void omap_mbox_put(struct omap_mbox *mbox, struct notifier_block *nb);
+
+void omap_mbox_save_ctx(struct omap_mbox *mbox);
+void omap_mbox_restore_ctx(struct omap_mbox *mbox);
+void omap_mbox_enable_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq);
+void omap_mbox_disable_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq);
-- 
1.7.11.1

--
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/9] mailbox: add IRQF_NO_SUSPEND flag

2012-12-18 Thread Loic Pallardy
Coprocessor must be accessible during suspend transitions.

Signed-off-by: Loic Pallardy loic.palla...@st.com
---
 drivers/mailbox/mailbox.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index c0a8e49..57cb566 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -311,7 +311,8 @@ static int mailbox_startup(struct mailbox *mbox)
}
 
if (!mbox-use_count++) {
-   ret = request_irq(mbox-irq, mbox_interrupt, IRQF_SHARED,
+   ret = request_irq(mbox-irq, mbox_interrupt,
+   IRQF_SHARED | IRQF_NO_SUSPEND,
mbox-name, mbox);
if (unlikely(ret)) {
pr_err(failed to register mailbox interrupt:%d\n,
-- 
1.7.11.1

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


Re: [PATCH v2 2/2] mailbox: split internal header from API header

2012-11-06 Thread Loic PALLARDY


On 11/06/2012 03:55 AM, Omar Ramirez Luna wrote:
 Now internal structures can remain hidden to the user and just API
 related functions and defines are made available.

 Signed-off-by: Omar Ramirez Lunaomar.l...@linaro.org
 ---
   drivers/mailbox/mailbox.c |   34 
   drivers/mailbox/mailbox.h |   48 
 +
   include/linux/mailbox.h   |   22 +++
I agree with the file split but I think mailbox framework API should be 
more generic.
omap_ prefix should not be used. mailbox_ prefix will be better.
Message type must be more opened like for example:
struct mailbox_msg {
int size;
unsigned char   header;
unsigned char   *pdata;
};

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


Re: [PATCH 1/2] ARM: OMAP2+: move mailbox.h out of plat-omap headers

2012-10-31 Thread Loic PALLARDY

Hi Omar,

On 10/31/2012 08:22 AM, Omar Ramirez Luna wrote:

 As part of plat-omap code cleanup, I was planning to move omap-mailbox
 framework to a newly drivers/mailbox folder, right now this code is
 specific to OMAP platforms, but with some clean up it could be the
 base for a generic framework. And living under drivers/mailbox could
 give it some exposure for interested developers to give feedback and
 propose changes.

 In the past there was a mailbox-like driver in mach-ux500, I was
 hoping both could live under the same folder, however the platform
 using it, was dropped a couple of kernel releases back and with it the
 other similar mailbox implementation.

On STE side, we are working on a mailbox driver which will rely on 
mailbox framework.
However some modifications in current Omap mailbox framework are needed 
to fit STE HW specificities.
- API naming should be generic (replace omap prefix by mailbox)
- message type should be enhanced
- fifo mechanism is linked to Omap maibox, not needed in STE case since 
it relies on cross interrupt + shared memory
I already have modifications I'll send you to see how we can create a 
common and generic mailbox framework.

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