From: Ohad Ben-Cohen <ohad@wizery.com>
To: linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Cc: akpm@linux-foundation.org, Brian Swetland <swetland@google.com>,
Arnd Bergmann <arnd@arndb.de>,
Grant Likely <grant.likely@secretlab.ca>,
davinci-linux-open-source
<davinci-linux-open-source@linux.davincidsp.com>,
Rusty Russell <rusty@rustcorp.com.au>,
"Guzman Lugo, Fernando" <fernando.lugo@ti.com>,
Ohad Ben-Cohen <ohad@wizery.com>
Subject: [RFC 4/8] omap: add remoteproc devices
Date: Tue, 21 Jun 2011 10:18:30 +0300 [thread overview]
Message-ID: <1308640714-17961-5-git-send-email-ohad@wizery.com> (raw)
In-Reply-To: <1308640714-17961-1-git-send-email-ohad@wizery.com>
From: Guzman Lugo, Fernando <fernando.lugo@ti.com>
Add omap remoteproc devices for the ipu and dsp remote processors.
TODO:
- rework to use CMA instead of reserving memory at boot
[ohad@wizery.com: commit log, refactored and simplified, still wip]
Signed-off-by: Guzman Lugo, Fernando <fernando.lugo@ti.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
---
arch/arm/mach-omap2/Makefile | 2 +
arch/arm/mach-omap2/remoteproc.c | 159 ++++++++++++++++++++++++++++++++++++++
2 files changed, 161 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/mach-omap2/remoteproc.c
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index b148077..2b04fe6 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -270,3 +270,5 @@ disp-$(CONFIG_OMAP2_DSS) := display.o
obj-y += $(disp-m) $(disp-y)
obj-y += common-board-devices.o
+
+obj-$(CONFIG_OMAP_REMOTE_PROC) += remoteproc.o
diff --git a/arch/arm/mach-omap2/remoteproc.c b/arch/arm/mach-omap2/remoteproc.c
new file mode 100644
index 0000000..4f846cb
--- /dev/null
+++ b/arch/arm/mach-omap2/remoteproc.c
@@ -0,0 +1,159 @@
+/*
+ * Remote processor machine-specific module for OMAP4
+ *
+ * Copyright (C) 2011 Texas Instruments, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#define pr_fmt(fmt) "%s: " fmt, __func__
+
+#include <linux/kernel.h>
+#include <linux/err.h>
+#include <linux/remoteproc.h>
+#include <linux/memblock.h>
+
+#include <plat/omap_device.h>
+#include <plat/omap_hwmod.h>
+#include <plat/remoteproc.h>
+#include <plat/dsp.h>
+#include <plat/io.h>
+
+#define L4_PERIPHERAL_L4CFG (L4_44XX_BASE)
+#define IPU_PERIPHERAL_L4CFG 0xAA000000
+
+#define IPU_MEM_TEXT 0x0
+#define IPU_MEM_DATA 0x80000000
+#define IPU_MEM_IPC 0xA0000000
+
+/*
+ * Memory mappings for the remote M3 subsystem
+ *
+ * Don't change the device addresses (first parameter), otherwise you'd have
+ * to update the firmware (BIOS image) accordingly.
+ *
+ * A 0 physical address (second parameter) means this physical region should
+ * be dynamically carved out at boot time.
+ *
+ * Sizes should be in the form of 2 ^ n * PAGE_SIZE (where n = 0, 1, 2, ...)
+ *
+ * Alignment requirement: at least page-based
+ */
+static struct rproc_mem_entry ipu_memory_maps[] = {
+ {IPU_MEM_IPC, 0, SZ_1M}, /* keep this IPC region first */
+ {IPU_MEM_TEXT, 0, SZ_4M},
+ {IPU_MEM_DATA, 0, SZ_32M},
+ {IPU_PERIPHERAL_L4CFG, L4_PERIPHERAL_L4CFG, SZ_16M},
+ { }
+};
+
+static struct omap_rproc_pdata omap4_rproc_data[] = {
+ {
+ .name = "dsp",
+ .iommu_name = "tesla",
+ .firmware = "tesla-dsp.bin",
+ .oh_name = "dsp_c0",
+ },
+ {
+ .name = "ipu",
+ .iommu_name = "ducati",
+ .firmware = "ducati-m3.bin",
+ .oh_name = "ipu_c0",
+ .oh_name_opt = "ipu_c1",
+ .memory_maps = ipu_memory_maps,
+ },
+};
+
+static struct omap_device_pm_latency omap_rproc_latency[] = {
+ {
+ .deactivate_func = omap_device_idle_hwmods,
+ .activate_func = omap_device_enable_hwmods,
+ .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+ },
+};
+
+static int __init omap_rproc_init(void)
+{
+ const char *pdev_name = "omap-rproc";
+ struct omap_hwmod *oh[2];
+ struct omap_device *od;
+ int i, ret = 0, oh_count;
+ phys_addr_t paddr, size;
+
+ /* names like ipu_cx/dsp_cx might show up on other OMAPs, too */
+ if (!cpu_is_omap44xx())
+ return 0;
+
+ paddr = omap_dsp_get_mempool_base();
+ size = omap_dsp_get_mempool_size();
+ if (!paddr || !size) {
+ pr_warn("carveout memory is unavailable: 0x%x, 0x%x\n",
+ paddr, size);
+ return -ENOMEM;
+ }
+
+ /* dynamically allocate carveout memory as required by the ipu */
+ for (i = 0; i < ARRAY_SIZE(ipu_memory_maps); i++) {
+ struct rproc_mem_entry *me = &ipu_memory_maps[i];
+
+ if (!me->pa && me->size) {
+ if (me->size > size) {
+ pr_warn("out of carveout memory\n");
+ return -ENOMEM;
+ }
+
+ me->pa = paddr;
+ paddr += me->size;
+ size -= me->size;
+
+ pr_info("0x%x bytes at 0x%x %d\n", me->size, me->pa, i);
+ }
+ }
+
+ /* build the remote proc devices */
+ for (i = 0; i < ARRAY_SIZE(omap4_rproc_data); i++) {
+ const char *oh_name = omap4_rproc_data[i].oh_name;
+ const char *oh_name_opt = omap4_rproc_data[i].oh_name_opt;
+ oh_count = 0;
+
+ oh[0] = omap_hwmod_lookup(oh_name);
+ if (!oh[0]) {
+ pr_err("could not look up %s\n", oh_name);
+ continue;
+ }
+ oh_count++;
+
+ /* ipu has a secondary hwmod entry */
+ if (oh_name_opt) {
+ oh[1] = omap_hwmod_lookup(oh_name_opt);
+ if (!oh[1]) {
+ pr_err("could not look up %s\n", oh_name_opt);
+ continue;
+ }
+ oh_count++;
+ }
+
+ od = omap_device_build_ss(pdev_name, i, oh, oh_count,
+ &omap4_rproc_data[i],
+ sizeof(struct omap_rproc_pdata),
+ omap_rproc_latency,
+ ARRAY_SIZE(omap_rproc_latency),
+ false);
+ if (IS_ERR(od)) {
+ pr_err("Could not build omap_device for %s:%s\n",
+ pdev_name, oh_name);
+ ret = PTR_ERR(od);
+ }
+ }
+
+ return ret;
+}
+/* must be ready in time for device_initcall users */
+subsys_initcall(omap_rproc_init);
--
1.7.1
next prev parent reply other threads:[~2011-06-21 7:18 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-21 7:18 [RFC 0/8] Introducing a generic AMP/IPC framework Ohad Ben-Cohen
2011-06-21 7:18 ` [RFC 1/8] drivers: add generic remoteproc framework Ohad Ben-Cohen
2011-06-22 17:55 ` Randy Dunlap
2011-06-22 19:11 ` Ohad Ben-Cohen
[not found] ` <1308640714-17961-2-git-send-email-ohad-Ix1uc/W3ht7QT0dZR+AlfA@public.gmane.org>
2011-06-27 20:49 ` Grant Likely
[not found] ` <20110627204958.GB20865-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-06-27 21:52 ` Grosen, Mark
2011-06-27 22:24 ` Grant Likely
[not found] ` <20110627222401.GE20865-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-06-27 23:54 ` Grosen, Mark
2011-06-27 23:29 ` Russell King - ARM Linux
2011-06-27 23:35 ` Grant Likely
2011-06-28 21:55 ` Ohad Ben-Cohen
2011-06-28 21:41 ` Ohad Ben-Cohen
2011-06-21 7:18 ` [RFC 2/8] remoteproc: add omap implementation Ohad Ben-Cohen
2011-06-22 10:05 ` Will Newton
2011-06-22 10:50 ` Ohad Ben-Cohen
2011-06-27 21:00 ` Grant Likely
2011-06-29 15:04 ` Ohad Ben-Cohen
2011-06-29 15:31 ` Grant Likely
2011-06-21 7:18 ` [RFC 3/8] omap: add carveout memory support for remoteproc Ohad Ben-Cohen
2011-06-21 7:18 ` Ohad Ben-Cohen [this message]
2011-06-21 7:18 ` [RFC 5/8] remoteproc: add davinci implementation Ohad Ben-Cohen
2011-06-23 15:27 ` Sergei Shtylyov
[not found] ` <4E035B78.3080200-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
2011-06-24 4:25 ` Grosen, Mark
2011-06-24 15:13 ` Sergei Shtylyov
2011-06-24 15:43 ` Nori, Sekhar
[not found] ` <B85A65D85D7EB246BE421B3FB0FBB593024D6C2F29-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2011-06-27 18:31 ` Grosen, Mark
[not found] ` <FFF198FBBF957F4393BA834040FEFFA202EC99-Jq/I0xf/SMGIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2011-07-05 5:29 ` Nori, Sekhar
[not found] ` <B85A65D85D7EB246BE421B3FB0FBB593024D91A2BE-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2011-07-05 16:54 ` Grosen, Mark
2011-07-05 5:34 ` Nori, Sekhar
[not found] ` <B85A65D85D7EB246BE421B3FB0FBB593024D91A2CC-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2011-07-05 16:54 ` Grosen, Mark
[not found] ` <FFF198FBBF957F4393BA834040FEFFA2032F6F-Jq/I0xf/SMGIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2011-07-06 4:36 ` Nori, Sekhar
[not found] ` <4E04A9AE.3030801-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
2011-06-27 18:20 ` Grosen, Mark
[not found] ` <FFF198FBBF957F4393BA834040FEFFA202EC68-Jq/I0xf/SMGIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2011-06-28 9:36 ` Nori, Sekhar
2011-06-21 7:18 ` [RFC 6/8] davinci: da850: add remoteproc dsp device Ohad Ben-Cohen
[not found] ` <1308640714-17961-7-git-send-email-ohad-Ix1uc/W3ht7QT0dZR+AlfA@public.gmane.org>
2011-06-28 10:18 ` Sergei Shtylyov
2011-06-21 7:18 ` [RFC 7/8] drivers: introduce rpmsg, a remote-processor messaging bus Ohad Ben-Cohen
2011-06-09 17:12 ` Pavel Machek
2011-07-19 5:38 ` Ohad Ben-Cohen
2011-06-22 2:42 ` Rusty Russell
2011-06-22 3:11 ` Sasha Levin
2011-06-22 10:46 ` Ohad Ben-Cohen
2011-09-14 18:38 ` Ohad Ben-Cohen
2011-09-15 0:12 ` Rusty Russell
2011-09-15 14:56 ` Ohad Ben-Cohen
2011-06-27 22:21 ` Grant Likely
2011-06-28 22:46 ` Ohad Ben-Cohen
2011-06-28 22:51 ` Grant Likely
2011-06-28 23:00 ` Ohad Ben-Cohen
2011-06-29 15:43 ` Grant Likely
2011-07-01 15:13 ` Ohad Ben-Cohen
2011-06-28 23:44 ` Randy Dunlap
2011-06-29 6:30 ` Ohad Ben-Cohen
2011-06-29 11:59 ` Arnd Bergmann
2011-06-29 12:29 ` Ohad Ben-Cohen
2011-06-21 7:18 ` [RFC 8/8] rpmsg: add omap host backend Ohad Ben-Cohen
2011-06-21 7:50 ` [RFC 0/8] Introducing a generic AMP/IPC framework Ohad Ben-Cohen
2011-06-21 9:30 ` Ohad Ben-Cohen
2011-06-21 14:20 ` Arnd Bergmann
2011-06-21 15:54 ` Grant Likely
2011-06-22 11:41 ` Ohad Ben-Cohen
2011-06-22 13:05 ` Arnd Bergmann
2011-06-22 13:09 ` Ohad Ben-Cohen
2011-06-23 12:23 ` Michael Williamson
[not found] ` <4E033041.9090606-wZX4cNJlHJ2sVWG7oymsAA@public.gmane.org>
2011-06-23 16:27 ` Grosen, Mark
2011-06-23 18:46 ` Arnd Bergmann
2011-06-24 4:32 ` Grosen, Mark
2011-06-24 20:16 ` Stephen Boyd
2011-06-26 1:11 ` Ohad Ben-Cohen
2011-06-26 1:17 ` Brian Swetland
[not found] ` <BANLkTi=sFtwam29i4TZdi=RO7BoytTTdrw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-27 21:22 ` Grosen, Mark
2011-06-28 11:26 ` Ohad Ben-Cohen
2011-06-28 11:36 ` Brian Swetland
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=1308640714-17961-5-git-send-email-ohad@wizery.com \
--to=ohad@wizery.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=davinci-linux-open-source@linux.davincidsp.com \
--cc=fernando.lugo@ti.com \
--cc=grant.likely@secretlab.ca \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=swetland@google.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).