All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2 0/5] OMAP Mailbox framework adoption & DT support
@ 2014-07-11 22:04 ` Suman Anna
  0 siblings, 0 replies; 37+ messages in thread
From: Suman Anna @ 2014-07-11 22:04 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Jassi Brar, Dave Gerlach, Pavel Machek,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Suman Anna

Hi,

This is a refresh of the OMAP Mailbox framework adoption & DT support
series [1], to work with the revised OMAP mailbox DT/hwmod cleanup
series [2].

The series has one less patch than the previous series, with the patch
"mailbox/omap: add a custom of_xlate function" squashed into the OMAP
mailbox framework adaptation patch. The first 3 patches deal with the
OMAP DT bindings and parse support like previous series, and the last
2 patches deal with the mailbox framework adaptation. The testing is
also done with the updated v8 version of mailbox framework [3] from
Jassi Brar, no changes are required for the v7 to v8 update.

The AM335 PM suspend series [4] which relies on this series also does
not require any changes.

Changes in v2:
- Updated the OMAP DT bindings document for the added back DT properties:
  "ti,mbox-num-users" and "ti,mbox-num-fifos". Also added information
  regarding "#mbox-cells" and DT client usage.
- Updated the OMAP DT adaptation patch to parse the added back DT properties
  and clean up the previous match data structure.
- Squashed custom xlate patch into the framework adaptation patch.
- Tested against v8 of mailbox framework.

v1:
- Tested against v7 of mailbox framework
- See [1] for additional details

The series depends on the OMAP mailbox cleanup series [5] and the 
refreshed OMAP mailbox DT/hwmod cleanup series [2].

The following shows the boot/validation logs on various OMAP platforms:
  OMAP3 (BeagleXM)          : http://slexy.org/view/s23mLEA46B
  OMAP4 (PandaBoard)        : http://slexy.org/view/s215xfwEo3
  OMAP5 (OMAP5 uEVM)        : http://slexy.org/view/s2peigexO0
  DRA7  (DRA7 EVM)          : http://slexy.org/view/s21huoN7Q4
  AM33xx (BeagleBone Black) : http://slexy.org/view/s21KQ0gMN8
  AM43xx (AM437x GP EVM)    : http://slexy.org/view/s2KGKGeFre

[1] http://www.spinics.net/lists/linux-omap/msg108595.html
[2] http://marc.info/?l=linux-omap&m=140511512208519&w=2
[3] https://lkml.org/lkml/2014/7/11/174
[4] http://www.spinics.net/lists/linux-omap/msg109331.html
[5] http://www.spinics.net/lists/linux-omap/msg108574.html

Suman Anna (5):
  Documentation: dt: add omap mailbox bindings
  mailbox/omap: add support for parsing dt devices
  ARM: dts: OMAP2+: Add sub mailboxes device node information
  mailbox/omap: adapt to the new mailbox framework
  ARM: dts: OMAP2+: Add #mbox-cells property to all mailbox nodes

 .../devicetree/bindings/mailbox/omap-mailbox.txt   | 135 ++++++
 arch/arm/boot/dts/am33xx.dtsi                      |   5 +
 arch/arm/boot/dts/am4372.dtsi                      |   5 +
 arch/arm/boot/dts/dra7.dtsi                        |  13 +
 arch/arm/boot/dts/omap2420.dtsi                    |   9 +
 arch/arm/boot/dts/omap2430.dtsi                    |   5 +
 arch/arm/boot/dts/omap3.dtsi                       |   5 +
 arch/arm/boot/dts/omap4.dtsi                       |   9 +
 arch/arm/boot/dts/omap5.dtsi                       |   9 +
 drivers/mailbox/omap-mailbox.c                     | 499 ++++++++++++++-------
 drivers/remoteproc/omap_remoteproc.c               |  54 ++-
 drivers/staging/tidspbridge/core/_tiomap.h         |   3 +-
 drivers/staging/tidspbridge/core/io_sm.c           |   7 +-
 drivers/staging/tidspbridge/core/tiomap3430.c      |  22 +-
 drivers/staging/tidspbridge/core/tiomap_io.c       |   7 +-
 .../tidspbridge/include/dspbridge/host_os.h        |   1 +
 .../staging/tidspbridge/include/dspbridge/io_sm.h  |   8 +-
 include/linux/omap-mailbox.h                       |  15 +-
 18 files changed, 584 insertions(+), 227 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mailbox/omap-mailbox.txt

-- 
2.0.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 37+ messages in thread
* [PATCHv2 2/5] mailbox/omap: add support for parsing dt devices
@ 2013-07-22 21:26 ` Suman Anna
  0 siblings, 0 replies; 37+ messages in thread
From: Suman Anna @ 2013-07-22 21:26 UTC (permalink / raw)
  To: Tony Lindgren, Benoit Cousson
  Cc: Paul Walmsley, Ohad Ben-Cohen, Omar Ramirez Luna, Jassi Brar,
	linux-omap, linux-arm-kernel, devicetree-discuss, Suman Anna

Logic has been added to the OMAP2+ mailbox code to
parse the mailbox dt nodes and construct the different
mailboxes associated with the instance. The design is
based on gathering the same information that was being
passed previously through the platform data, except for
the interrupt type configuration information.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 .../devicetree/bindings/mailbox/omap-mailbox.txt   |  43 +++++++
 drivers/mailbox/mailbox-omap2.c                    | 130 ++++++++++++++++++---
 2 files changed, 158 insertions(+), 15 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mailbox/omap-mailbox.txt

diff --git a/Documentation/devicetree/bindings/mailbox/omap-mailbox.txt b/Documentation/devicetree/bindings/mailbox/omap-mailbox.txt
new file mode 100644
index 0000000..8ffb08a
--- /dev/null
+++ b/Documentation/devicetree/bindings/mailbox/omap-mailbox.txt
@@ -0,0 +1,43 @@
+OMAP2+ Mailbox Driver
+
+Required properties:
+- compatible:		Should be one of the following,
+			    "ti,omap2-mailbox" for
+				OMAP2420, OMAP2430, OMAP3430, OMAP3630 SoCs
+			    "ti,omap4-mailbox" for
+				OMAP44xx, OMAP54xx, AM33xx, AM43xx, DRA7xx SoCs
+- reg:			Contains the mailbox register address range (base address
+			and length)
+- interrupts: 		Contains the interrupt information for the mailbox
+			device. The format is dependent on which interrupt
+			controller the OMAP device uses
+- ti,hwmods:		Name of the hwmod associated with the mailbox
+- ti,mbox-num-users:	Number of targets (processor devices) that the mailbox device
+			can interrupt
+- ti,mbox-num-fifos:	Number of h/w fifos within the mailbox device
+- ti,mbox-names:	Array of the names of the mailboxes
+- ti,mbox-data:		Mailbox descriptor data private to each mailbox. The 4
+			cells represent the following data,
+			  Cell #1 (tx_id) - mailbox fifo id used for
+						transmitting messages
+			  Cell #2 (rx_id) - mailbox fifo id on which messages
+						are received
+			  Cell #3 (irq_id) - irq identifier index number to use
+						from the interrupts data
+			  Cell #4 (usr_id) - mailbox user id for identifying the
+						interrupt into the MPU interrupt
+						controller.
+
+Example:
+
+/* OMAP4 */
+mailbox: mailbox@4a0f4000 {
+	compatible = "ti,omap4-mailbox";
+	reg = <0x4a0f4000 0x200>;
+	interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>;
+	ti,hwmods = "mailbox";
+	ti,mbox-num-users = <3>;
+	ti,mbox-num-fifos = <8>;
+	ti,mbox-names = "mbox-ipu", "mbox-dsp";
+	ti,mbox-data = <0 1 0 0>, <3 2 0 0>;
+};
diff --git a/drivers/mailbox/mailbox-omap2.c b/drivers/mailbox/mailbox-omap2.c
index 6c0687c..759f72c 100644
--- a/drivers/mailbox/mailbox-omap2.c
+++ b/drivers/mailbox/mailbox-omap2.c
@@ -14,6 +14,7 @@
 #include <linux/slab.h>
 #include <linux/clk.h>
 #include <linux/err.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/pm_runtime.h>
@@ -222,6 +223,21 @@ static struct omap_mbox_ops omap2_mbox_ops = {
 	.restore_ctx	= omap2_mbox_restore_ctx,
 };
 
+static const struct of_device_id omap_mailbox_of_match[] = {
+	{
+		.compatible	= "ti,omap2-mailbox",
+		.data		= (void *) MBOX_INTR_CFG_TYPE1,
+	},
+	{
+		.compatible	= "ti,omap4-mailbox",
+		.data		= (void *) MBOX_INTR_CFG_TYPE2,
+	},
+	{
+		/* end */
+	},
+};
+MODULE_DEVICE_TABLE(of, omap_mailbox_of_match);
+
 static int omap2_mbox_probe(struct platform_device *pdev)
 {
 	struct resource *mem;
@@ -229,47 +245,127 @@ static int omap2_mbox_probe(struct platform_device *pdev)
 	struct omap_mbox **list, *mbox, *mboxblk;
 	struct omap_mbox2_priv *priv, *privblk;
 	struct omap_mbox_pdata *pdata = pdev->dev.platform_data;
-	struct omap_mbox_dev_info *info;
 	struct omap_mbox_device *mdev;
-	int i;
-
-	if (!pdata || !pdata->info_cnt || !pdata->info) {
+	struct omap_mbox_dev_info *info, *of_info = NULL;
+	struct device_node *node = pdev->dev.of_node;
+	int i, j;
+	u32 info_count = 0, intr_type = 0;
+	u32 num_users = 0, num_fifos = 0;
+	u32 dlen, dsize = 4;
+	u32 *tmp;
+	const __be32 *mbox_data;
+
+	if (!node && (!pdata || !pdata->info_cnt || !pdata->info)) {
 		pr_err("%s: platform not supported\n", __func__);
 		return -ENODEV;
 	}
 
+	if (node) {
+		intr_type = (u32)of_match_device(omap_mailbox_of_match,
+							&pdev->dev)->data;
+		if (intr_type != 0 && intr_type != 1) {
+			dev_err(&pdev->dev, "invalid match data value\n");
+			return -EINVAL;
+		}
+
+		if (of_property_read_u32(node, "ti,mbox-num-users",
+								&num_users)) {
+			dev_err(&pdev->dev,
+				"no ti,mbox-num-users configuration found\n");
+			return -ENODEV;
+		}
+
+		if (of_property_read_u32(node, "ti,mbox-num-fifos",
+								&num_fifos)) {
+			dev_err(&pdev->dev,
+				"no ti,mbox-num-fifos configuration found\n");
+			return -ENODEV;
+		}
+
+		info_count = of_property_count_strings(node, "ti,mbox-names");
+		if (!info_count) {
+			dev_err(&pdev->dev, "no mbox devices found\n");
+			return -ENODEV;
+		}
+
+		mbox_data = of_get_property(node, "ti,mbox-data", &dlen);
+		if (!mbox_data) {
+			dev_err(&pdev->dev, "no mbox device data found\n");
+			return -ENODEV;
+		}
+		dlen /= sizeof(dsize);
+		if (dlen != dsize * info_count) {
+			dev_err(&pdev->dev, "mbox device data is truncated\n");
+			return -ENODEV;
+		}
+
+		of_info = kzalloc(info_count * sizeof(*of_info), GFP_KERNEL);
+		if (!of_info)
+			return -ENOMEM;
+
+		i = 0;
+		while (i < info_count) {
+			info = of_info + i;
+			if (of_property_read_string_index(node,
+					"ti,mbox-names", i,  &info->name)) {
+				dev_err(&pdev->dev,
+					"mbox_name [%d] read failed\n", i);
+				ret = -ENODEV;
+				goto free_of;
+			}
+
+			tmp = &info->tx_id;
+			for (j = 0; j < dsize; j++) {
+				tmp[j] = of_read_number(
+						mbox_data + j + (i * dsize), 1);
+			}
+			i++;
+		}
+	}
+
+	if (!node) { /* non-DT device creation */
+		info_count = pdata->info_cnt;
+		info = pdata->info;
+		intr_type = pdata->intr_type;
+		num_users = pdata->num_users;
+		num_fifos = pdata->num_fifos;
+	} else {
+		info = of_info;
+	}
+
 	mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
-	if (!mdev)
-		return -ENOMEM;
+	if (!mdev) {
+		ret = -ENOMEM;
+		goto free_of;
+	}
 
 	/* allocate one extra for marking end of list */
-	list = kzalloc((pdata->info_cnt + 1) * sizeof(*list), GFP_KERNEL);
+	list = kzalloc((info_count + 1) * sizeof(*list), GFP_KERNEL);
 	if (!list) {
 		ret = -ENOMEM;
 		goto free_mdev;
 	}
 
-	mboxblk = mbox = kzalloc(pdata->info_cnt * sizeof(*mbox), GFP_KERNEL);
+	mboxblk = mbox = kzalloc(info_count * sizeof(*mbox), GFP_KERNEL);
 	if (!mboxblk) {
 		ret = -ENOMEM;
 		goto free_list;
 	}
 
-	privblk = priv = kzalloc(pdata->info_cnt * sizeof(*priv), GFP_KERNEL);
+	privblk = priv = kzalloc(info_count * sizeof(*priv), GFP_KERNEL);
 	if (!privblk) {
 		ret = -ENOMEM;
 		goto free_mboxblk;
 	}
 
-	info = pdata->info;
-	for (i = 0; i < pdata->info_cnt; i++, info++, priv++) {
+	for (i = 0; i < info_count; i++, info++, priv++) {
 		priv->tx_fifo.msg = MAILBOX_MESSAGE(info->tx_id);
 		priv->tx_fifo.fifo_stat = MAILBOX_FIFOSTATUS(info->tx_id);
 		priv->rx_fifo.msg =  MAILBOX_MESSAGE(info->rx_id);
 		priv->rx_fifo.msg_stat =  MAILBOX_MSGSTATUS(info->rx_id);
 		priv->notfull_bit = MAILBOX_IRQ_NOTFULL(info->tx_id);
 		priv->newmsg_bit = MAILBOX_IRQ_NEWMSG(info->rx_id);
-		if (pdata->intr_type) {
+		if (intr_type) {
 			priv->irqenable = OMAP4_MAILBOX_IRQENABLE(info->usr_id);
 			priv->irqstatus = OMAP4_MAILBOX_IRQSTATUS(info->usr_id);
 			priv->irqdisable =
@@ -279,7 +375,7 @@ static int omap2_mbox_probe(struct platform_device *pdev)
 			priv->irqstatus = MAILBOX_IRQSTATUS(info->usr_id);
 			priv->irqdisable = MAILBOX_IRQENABLE(info->usr_id);
 		}
-		priv->intr_type = pdata->intr_type;
+		priv->intr_type = intr_type;
 
 		mbox->priv = priv;
 		mbox->parent = mdev;
@@ -307,8 +403,8 @@ static int omap2_mbox_probe(struct platform_device *pdev)
 
 	mutex_init(&mdev->cfg_lock);
 	mdev->dev = &pdev->dev;
-	mdev->num_users = pdata->num_users;
-	mdev->num_fifos = pdata->num_fifos;
+	mdev->num_users = num_users;
+	mdev->num_fifos = num_fifos;
 	mdev->mboxes = list;
 	ret = omap_mbox_register(&pdev->dev, list);
 	if (ret)
@@ -317,6 +413,7 @@ static int omap2_mbox_probe(struct platform_device *pdev)
 
 	pm_runtime_enable(mdev->dev);
 
+	kfree(of_info);
 	return 0;
 
 unmap_mbox:
@@ -329,6 +426,8 @@ free_list:
 	kfree(list);
 free_mdev:
 	kfree(mdev);
+free_of:
+	kfree(of_info);
 	return ret;
 }
 
@@ -358,6 +457,7 @@ static struct platform_driver omap2_mbox_driver = {
 	.remove	= omap2_mbox_remove,
 	.driver	= {
 		.name = "omap-mailbox",
+		.of_match_table = omap_mailbox_of_match,
 	},
 };
 
-- 
1.8.3.3


^ permalink raw reply related	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2014-07-16 21:12 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-11 22:04 [PATCHv2 0/5] OMAP Mailbox framework adoption & DT support Suman Anna
2014-07-11 22:04 ` Suman Anna
2014-07-11 22:04 ` Suman Anna
2014-07-11 22:04 ` [PATCHv2 1/5] Documentation: dt: add omap mailbox bindings Suman Anna
2014-07-11 22:04   ` Suman Anna
2014-07-11 22:04   ` Suman Anna
2014-07-11 22:04 ` [PATCHv2 2/5] mailbox/omap: add support for parsing dt devices Suman Anna
2014-07-11 22:04   ` Suman Anna
2014-07-11 22:04   ` Suman Anna
2014-07-12 22:16   ` Pavel Machek
2014-07-12 22:16     ` Pavel Machek
2014-07-16 20:50   ` Markus Mayer
2014-07-16 20:50     ` Markus Mayer
2014-07-16 21:11     ` Suman Anna
2014-07-16 21:11       ` Suman Anna
2014-07-16 21:11       ` Suman Anna
2014-07-11 22:04 ` [PATCHv2 3/5] ARM: dts: OMAP2+: Add sub mailboxes device node information Suman Anna
2014-07-11 22:04   ` Suman Anna
2014-07-11 22:04   ` Suman Anna
2014-07-11 22:04 ` [PATCHv2 4/5] mailbox/omap: adapt to the new mailbox framework Suman Anna
2014-07-11 22:04   ` Suman Anna
2014-07-11 22:04   ` Suman Anna
2014-07-11 22:04 ` [PATCHv2 5/5] ARM: dts: OMAP2+: Add #mbox-cells property to all mailbox nodes Suman Anna
2014-07-11 22:04   ` Suman Anna
     [not found] ` <1405116252-53612-1-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
2014-07-11 23:15   ` [PATCHv2 0/5] OMAP Mailbox framework adoption & DT support Markus Mayer
2014-07-11 23:15     ` Markus Mayer
2014-07-11 23:15     ` Markus Mayer
     [not found]     ` <CAPdLdq=ZnPBQiGVbKOk8G5soP=uPYpT7mEjigpR=W1Hc4btV3g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-14 15:58       ` Suman Anna
2014-07-14 15:58         ` Suman Anna
2014-07-14 15:58         ` Suman Anna
2014-07-14 21:18         ` Markus Mayer
2014-07-14 21:18           ` Markus Mayer
2014-07-14 21:53           ` Suman Anna
2014-07-14 21:53             ` Suman Anna
2014-07-14 21:53             ` Suman Anna
  -- strict thread matches above, loose matches on Subject: below --
2013-07-22 21:26 [PATCHv2 2/5] mailbox/omap: add support for parsing dt devices Suman Anna
2013-07-22 21:26 ` Suman Anna

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.