2 * Remote processor machine-specific module for OMAP4
4 * Copyright (C) 2011 Texas Instruments, Inc.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #define pr_fmt(fmt) "%s: " fmt, __func__
18 #include <linux/kernel.h>
19 #include <linux/err.h>
20 #include <linux/slab.h>
21 #include <linux/remoteproc.h>
22 #include <linux/memblock.h>
23 #include <plat/omap_device.h>
24 #include <plat/omap_hwmod.h>
25 #include <plat/remoteproc.h>
29 #include "cm-regbits-44xx.h"
31 #define OMAP4430_CM_M3_M3_CLKCTRL (OMAP4430_CM2_BASE + OMAP4430_CM2_CORE_INST \
32 + OMAP4_CM_DUCATI_DUCATI_CLKCTRL_OFFSET)
34 static struct omap_rproc_timers_info ipu_timers
[] = {
37 #ifdef CONFIG_REMOTEPROC_WATCHDOG
43 static struct omap_rproc_pdata omap4_rproc_data
[] = {
46 .iommu_name
= "tesla",
47 .firmware
= "tesla-dsp.bin",
49 .clkdm_name
= "dsp_clkdm",
53 .iommu_name
= "ducati",
54 .firmware
= "ducati-m3.bin",
56 .oh_name_opt
= "ipu_c1",
57 .clkdm_name
= "ducati_clkdm",
59 .timers_cnt
= ARRAY_SIZE(ipu_timers
),
60 .idle_addr
= OMAP4430_CM_M3_M3_CLKCTRL
,
61 .idle_mask
= OMAP4430_STBYST_MASK
,
62 .suspend_addr
= 0xb3bf02d8,
65 .sus_mbox_name
= "mailbox-1",
69 static struct omap_device_pm_latency omap_rproc_latency
[] = {
71 OMAP_RPROC_DEFAULT_PM_LATENCY
,
75 static struct rproc_mem_pool
*omap_rproc_get_pool(const char *name
)
77 struct rproc_mem_pool
*pool
= NULL
;
79 /* check for ipu currently. dsp will be handled later */
80 if (!strcmp("ipu", name
)) {
81 phys_addr_t paddr1
= omap_ipu_get_mempool_base(
82 OMAP_RPROC_MEMPOOL_STATIC
);
83 phys_addr_t paddr2
= omap_ipu_get_mempool_base(
84 OMAP_RPROC_MEMPOOL_DYNAMIC
);
85 u32 len1
= omap_ipu_get_mempool_size(OMAP_RPROC_MEMPOOL_STATIC
);
86 u32 len2
= omap_ipu_get_mempool_size(OMAP_RPROC_MEMPOOL_DYNAMIC
);
88 if (!paddr1
&& !paddr2
) {
89 pr_err("no carveout memory available at all for "
94 pr_warn("static memory is unavailable: 0x%x, 0x%x\n",
97 pr_warn("carveout memory is unavailable: 0x%x, 0x%x\n",
100 pool
= kzalloc(sizeof(*pool
), GFP_KERNEL
);
102 pool
->st_base
= paddr1
;
103 pool
->st_size
= len1
;
104 pool
->mem_base
= paddr2
;
105 pool
->mem_size
= len2
;
106 pool
->cur_base
= paddr2
;
107 pool
->cur_size
= len2
;
114 static int __init
omap_rproc_init(void)
116 const char *pdev_name
= "omap-rproc";
117 struct omap_hwmod
*oh
[2];
118 struct omap_device
*od
;
119 int i
, ret
= 0, oh_count
;
121 /* names like ipu_cx/dsp_cx might show up on other OMAPs, too */
122 if (!cpu_is_omap44xx())
125 for (i
= 0; i
< ARRAY_SIZE(omap4_rproc_data
); i
++) {
126 const char *oh_name
= omap4_rproc_data
[i
].oh_name
;
127 const char *oh_name_opt
= omap4_rproc_data
[i
].oh_name_opt
;
130 oh
[0] = omap_hwmod_lookup(oh_name
);
132 pr_err("could not look up %s\n", oh_name
);
138 oh
[1] = omap_hwmod_lookup(oh_name_opt
);
140 pr_err("could not look up %s\n", oh_name_opt
);
146 omap4_rproc_data
[i
].memory_pool
=
147 omap_rproc_get_pool(omap4_rproc_data
[i
].name
);
148 od
= omap_device_build_ss(pdev_name
, i
, oh
, oh_count
,
149 &omap4_rproc_data
[i
],
150 sizeof(struct omap_rproc_pdata
),
152 ARRAY_SIZE(omap_rproc_latency
),
155 pr_err("Could not build omap_device for %s:%s\n",
163 /* must be ready in time for device_initcall users */
164 subsys_initcall(omap_rproc_init
);