linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ohad Ben-Cohen <ohad@wizery.com>
To: linux-omap@vger.kernel.org
Cc: Kanigeri Hari <h-kanigeri2@ti.com>, Ohad Ben-Cohen <ohadb@ti.com>
Subject: [RFC 5/6] omap: add remoteproc device(s)
Date: Fri,  2 Jul 2010 01:23:13 +0300	[thread overview]
Message-ID: <1278022994-28476-6-git-send-email-ohad@wizery.com> (raw)
In-Reply-To: <1278022994-28476-1-git-send-email-ohad@wizery.com>

From: Ohad Ben-Cohen <ohadb@ti.com>

Add an omap_device for each remote processor on the system

Signed-off-by: Ohad Ben-Cohen <ohadb@ti.com>
Signed-off-by: Hari Kanigeri <h-kanigeri2@ti.com>
---
 arch/arm/mach-omap2/devices.c |   86 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 86 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 18ad931..d365db6 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -15,6 +15,7 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/clk.h>
+#include <linux/err.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -26,9 +27,13 @@
 #include <plat/mux.h>
 #include <mach/gpio.h>
 #include <plat/mmc.h>
+#include <plat/remoteproc.h>
 
 #include "mux.h"
 
+#include <plat/omap_device.h>
+#include <plat/omap_hwmod.h>
+
 #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
 
 static struct resource cam_resources[] = {
@@ -136,6 +141,86 @@ static inline void omap_init_camera(void)
 }
 #endif
 
+#if defined(CONFIG_OMAP_REMOTE_PROC) || defined(CONFIG_OMAP_REMOTE_PROC_MODULE)
+static struct omap_device_pm_latency omap_rproc_latency[] = {
+	{
+		.deactivate_func = omap_device_idle_hwmods,
+		.activate_func = omap_device_enable_hwmods,
+		.deactivate_lat = 1,
+		.activate_lat = 1,
+	},
+};
+
+static struct omap_rproc_platform_data *omap_get_remoteproc_data(void)
+{
+	struct omap_rproc_platform_data *rproc_data = NULL;
+
+	if (cpu_is_omap3430() || cpu_is_omap3630())
+		rproc_data = omap3_get_rproc_data();
+	else if (cpu_is_omap44xx())
+		rproc_data = omap4_get_rproc_data();
+	else
+		pr_err("%s: platform not supported\n", __func__);
+
+	return rproc_data;
+}
+
+int omap_get_num_of_remoteproc(void)
+{
+	int num = -1;
+
+	if (cpu_is_omap3430() || cpu_is_omap3630())
+		num = omap3_get_rproc_data_size();
+	else if (cpu_is_omap44xx())
+		num = omap4_get_rproc_data_size();
+	else
+		pr_err("%s: platform not supported\n", __func__);
+
+	return num;
+}
+EXPORT_SYMBOL(omap_get_num_of_remoteproc);
+
+static inline void omap_init_rproc(void)
+{
+	struct omap_hwmod *oh;
+	struct omap_device *od;
+	struct omap_device_pm_latency *ohl;
+	char *oh_name, *pdev_name;
+	int ohl_cnt = 0, i;
+	int rproc_data_size;
+	struct omap_rproc_platform_data *rproc_data;
+
+	pdev_name = "omap-rproc";
+	ohl = omap_rproc_latency;
+	ohl_cnt = ARRAY_SIZE(omap_rproc_latency);
+
+	rproc_data = omap_get_remoteproc_data();
+	rproc_data_size = omap_get_num_of_remoteproc();
+	if (rproc_data == NULL || rproc_data_size <= 0) {
+		pr_err("%s: platform not supported\n", __func__);
+		return;
+	}
+
+	for (i = 0; i < rproc_data_size; i++) {
+		oh_name = rproc_data[i].oh_name;
+		oh = omap_hwmod_lookup(oh_name);
+		if (!oh) {
+			pr_err("%s: could not look up %s\n", __func__, oh_name);
+			continue;
+		}
+
+		od = omap_device_build(pdev_name, i, oh,
+					&rproc_data[i],
+					sizeof(struct omap_rproc_platform_data),
+					ohl, ohl_cnt);
+		WARN(IS_ERR(od), "Could not build omap_device for %s %s\n",
+			pdev_name, oh_name);
+	}
+}
+#else
+static inline void omap_init_rproc(void) { }
+#endif /* CONFIG_OMAP_REMOTE_PROC */
+
 #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
 
 #define MBOX_REG_SIZE   0x120
@@ -773,6 +858,7 @@ static int __init omap2_init_devices(void)
 	omap_hsmmc_reset();
 	omap_init_camera();
 	omap_init_mbox();
+	omap_init_rproc();
 	omap_init_mcspi();
 	omap_hdq_init();
 	omap_init_sti();
-- 
1.7.0.4


  parent reply	other threads:[~2010-07-01 22:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-01 22:23 [RFC 0/6] Introducing OMAP Remote Processor module Ohad Ben-Cohen
2010-07-01 22:23 ` [RFC 1/6] omap: add iva2 hwmod support to omap3 Ohad Ben-Cohen
2010-07-02  5:43   ` Cousson, Benoit
2010-07-04 21:57     ` Ohad Ben-Cohen
2010-07-01 22:23 ` [RFC 2/6] omap: introduce OMAP3 remoteproc module Ohad Ben-Cohen
2010-07-27 15:23   ` Premi, Sanjeev
2010-07-01 22:23 ` [RFC 3/6] omap: introduce OMAP4 " Ohad Ben-Cohen
2010-07-01 22:23 ` [RFC 4/6] omap: introduce common " Ohad Ben-Cohen
2010-07-27 14:49   ` Premi, Sanjeev
2010-07-01 22:23 ` Ohad Ben-Cohen [this message]
2010-07-27 15:44   ` [RFC 5/6] omap: add remoteproc device(s) Premi, Sanjeev
2010-07-01 22:23 ` [RFC 6/6] omap: enable remoteproc building Ohad Ben-Cohen
2010-07-27 15:49   ` Premi, Sanjeev
2010-07-27 12:27 ` [RFC 0/6] Introducing OMAP Remote Processor module Premi, Sanjeev
2010-07-27 17:09   ` Ohad Ben-Cohen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1278022994-28476-6-git-send-email-ohad@wizery.com \
    --to=ohad@wizery.com \
    --cc=h-kanigeri2@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=ohadb@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).