aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/remoteproc
diff options
context:
space:
mode:
authorZiyan <jaraidaniel@gmail.com>2015-05-01 18:23:56 +0200
committerZiyan <jaraidaniel@gmail.com>2015-05-01 18:23:56 +0200
commit5eee0b4d3f7b5bf9abb66b2191d8190e2aae2333 (patch)
treedcc929c505edb0d9f2d9647dc28eeab639476d39 /drivers/remoteproc
parent7b3037e9b35620164f48ae08e187b62c2ecba463 (diff)
downloadkernel_samsung_tuna-5eee0b4d3f7b5bf9abb66b2191d8190e2aae2333.tar.gz
kernel_samsung_tuna-5eee0b4d3f7b5bf9abb66b2191d8190e2aae2333.tar.bz2
kernel_samsung_tuna-5eee0b4d3f7b5bf9abb66b2191d8190e2aae2333.zip
[TEST] revert rpc/rpmsg changes
Diffstat (limited to 'drivers/remoteproc')
-rw-r--r--drivers/remoteproc/Kconfig22
-rw-r--r--drivers/remoteproc/omap_remoteproc.c101
-rwxr-xr-xdrivers/remoteproc/remoteproc.c192
-rw-r--r--drivers/remoteproc/rpres.c22
4 files changed, 134 insertions, 203 deletions
diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
index 348bf432ae0..af0894f2a09 100644
--- a/drivers/remoteproc/Kconfig
+++ b/drivers/remoteproc/Kconfig
@@ -34,28 +34,6 @@ config OMAP_REMOTE_PROC
It's safe to say n here if you're not interested in multimedia
offloading or just want a bare minium kernel.
-config OMAP_REMOTE_PROC_IPU
- bool "OMAP remoteproc support for IPU"
- depends on OMAP_REMOTE_PROC
- default y
- help
- Say Y here if you want to enable OMAP's IPU remote processor.
-
- This option controls only the dual M3 processor sub-system. You
- would want to say y here usually, as this is the sub-system where
- typically video & imaging codec control s/w is offloaded.
-
-config OMAP_REMOTE_PROC_DSP
- bool "OMAP remoteproc support for DSP"
- depends on OMAP_REMOTE_PROC
- default y
- help
- Say Y here if you want to enable OMAP's DSP remote processor.
-
- This option controls only the DSP processor sub-system. DSP would
- typically be used to offload audio codecs or other advanced
- processing algorithms.
-
config OMAP_RPRES
bool "Remote Processor Resources"
depends on OMAP_REMOTE_PROC
diff --git a/drivers/remoteproc/omap_remoteproc.c b/drivers/remoteproc/omap_remoteproc.c
index 5a5d1206d37..5548917c6b1 100644
--- a/drivers/remoteproc/omap_remoteproc.c
+++ b/drivers/remoteproc/omap_remoteproc.c
@@ -35,14 +35,12 @@
#include "../../arch/arm/mach-omap2/clockdomain.h"
#define PM_SUSPEND_MBOX 0xffffff07
-#define PM_SUSPEND_MBOX_FORCE 0xffffff09
#define PM_SUSPEND_TIMEOUT 300
struct omap_rproc_priv {
struct iommu *iommu;
int (*iommu_cb)(struct rproc *, u64, u32);
int (*wdt_cb)(struct rproc *);
- u64 bootaddr;
#ifdef CONFIG_REMOTE_PROC_AUTOSUSPEND
struct omap_mbox *mbox;
void __iomem *idle;
@@ -58,14 +56,11 @@ static bool _may_suspend(struct omap_rproc_priv *rpp)
return readl(rpp->idle) & rpp->idle_mask;
}
-static int _suspend(struct omap_rproc_priv *rpp, bool force)
+static int _suspend(struct omap_rproc_priv *rpp)
{
unsigned long timeout = msecs_to_jiffies(PM_SUSPEND_TIMEOUT) + jiffies;
- if (force)
- omap_mbox_msg_send(rpp->mbox, PM_SUSPEND_MBOX_FORCE);
- else
- omap_mbox_msg_send(rpp->mbox, PM_SUSPEND_MBOX);
+ omap_mbox_msg_send(rpp->mbox, PM_SUSPEND_MBOX);
while (time_after(timeout, jiffies)) {
if ((readl(rpp->suspend) & rpp->suspend_mask) &&
@@ -74,7 +69,7 @@ static int _suspend(struct omap_rproc_priv *rpp, bool force)
schedule();
}
- return -EAGAIN;
+ return -EIO;
}
static int omap_suspend(struct rproc *rproc, bool force)
@@ -82,7 +77,7 @@ static int omap_suspend(struct rproc *rproc, bool force)
struct omap_rproc_priv *rpp = rproc->priv;
if (rpp->idle && (force || _may_suspend(rpp)))
- return _suspend(rpp, force);
+ return _suspend(rpp);
return -EBUSY;
}
@@ -90,10 +85,43 @@ static int omap_suspend(struct rproc *rproc, bool force)
static void omap_rproc_dump_registers(struct rproc *rproc)
{
- struct device *dev = rproc->dev;
- struct omap_rproc_pdata *pdata = dev->platform_data;
-
- pdata->ops->dump_registers(rproc);
+ unsigned long flags;
+ char buf[64];
+ struct pt_regs regs;
+
+ if (!rproc->cdump_buf1)
+ return;
+
+ remoteproc_fill_pt_regs(&regs,
+ (struct exc_regs *)rproc->cdump_buf1);
+
+ pr_info("REGISTER DUMP FOR REMOTEPROC %s\n", rproc->name);
+ pr_info("PC is at %08lx\n", instruction_pointer(&regs));
+ pr_info("LR is at %08lx\n", regs.ARM_lr);
+ pr_info("pc : [<%08lx>] lr : [<%08lx>] psr: %08lx\n"
+ "sp : %08lx ip : %08lx fp : %08lx\n",
+ regs.ARM_pc, regs.ARM_lr, regs.ARM_cpsr,
+ regs.ARM_sp, regs.ARM_ip, regs.ARM_fp);
+ pr_info("r10: %08lx r9 : %08lx r8 : %08lx\n",
+ regs.ARM_r10, regs.ARM_r9,
+ regs.ARM_r8);
+ pr_info("r7 : %08lx r6 : %08lx r5 : %08lx r4 : %08lx\n",
+ regs.ARM_r7, regs.ARM_r6,
+ regs.ARM_r5, regs.ARM_r4);
+ pr_info("r3 : %08lx r2 : %08lx r1 : %08lx r0 : %08lx\n",
+ regs.ARM_r3, regs.ARM_r2,
+ regs.ARM_r1, regs.ARM_r0);
+
+ flags = regs.ARM_cpsr;
+ buf[0] = flags & PSR_N_BIT ? 'N' : 'n';
+ buf[1] = flags & PSR_Z_BIT ? 'Z' : 'z';
+ buf[2] = flags & PSR_C_BIT ? 'C' : 'c';
+ buf[3] = flags & PSR_V_BIT ? 'V' : 'v';
+ buf[4] = '\0';
+
+ pr_info("Flags: %s IRQs o%s FIQs o%s\n",
+ buf, interrupts_enabled(&regs) ? "n" : "ff",
+ fast_interrupts_enabled(&regs) ? "n" : "ff");
}
static int
@@ -155,15 +183,6 @@ static int omap_rproc_iommu_isr(struct iommu *iommu, u32 da, u32 errs, void *p)
return ret;
}
-static inline void _load_boot_addr(struct rproc *rproc, u64 bootaddr)
-{
- struct omap_rproc_pdata *pdata = rproc->dev->platform_data;
-
- if (pdata->boot_reg)
- omap_writel(bootaddr, pdata->boot_reg);
- return;
-}
-
int omap_rproc_activate(struct omap_device *od)
{
int i, ret = 0;
@@ -171,8 +190,8 @@ int omap_rproc_activate(struct omap_device *od)
struct device *dev = rproc->dev;
struct omap_rproc_pdata *pdata = dev->platform_data;
struct omap_rproc_timers_info *timers = pdata->timers;
- struct omap_rproc_priv *rpp = rproc->priv;
#ifdef CONFIG_REMOTE_PROC_AUTOSUSPEND
+ struct omap_rproc_priv *rpp = rproc->priv;
struct iommu *iommu;
if (!rpp->iommu) {
@@ -188,11 +207,6 @@ int omap_rproc_activate(struct omap_device *od)
if (!rpp->mbox)
rpp->mbox = omap_mbox_get(pdata->sus_mbox_name, NULL);
#endif
- /**
- * explicitly configure a boot address from which remoteproc
- * starts executing code when taken out of reset.
- */
- _load_boot_addr(rproc, rpp->bootaddr);
/**
* Domain is in HW SUP thus in hw_auto but
@@ -423,14 +437,12 @@ static irqreturn_t omap_rproc_watchdog_isr(int irq, void *p)
return IRQ_HANDLED;
}
#endif
-
static inline int omap_rproc_start(struct rproc *rproc, u64 bootaddr)
{
struct device *dev = rproc->dev;
struct platform_device *pdev = to_platform_device(dev);
struct omap_rproc_pdata *pdata = dev->platform_data;
struct omap_rproc_timers_info *timers = pdata->timers;
- struct omap_rproc_priv *rpp = rproc->priv;
int i;
int ret = 0;
@@ -445,11 +457,8 @@ static inline int omap_rproc_start(struct rproc *rproc, u64 bootaddr)
}
#ifdef CONFIG_REMOTE_PROC_AUTOSUSPEND
- ret = _init_pm_flags(rproc);
- if (ret)
- return ret;
+ _init_pm_flags(rproc);
#endif
-
for (i = 0; i < pdata->timers_cnt; i++) {
timers[i].odt = omap_dm_timer_request_specific(timers[i].id);
if (!timers[i].odt) {
@@ -458,10 +467,8 @@ static inline int omap_rproc_start(struct rproc *rproc, u64 bootaddr)
}
omap_dm_timer_set_source(timers[i].odt, OMAP_TIMER_SRC_SYS_CLK);
#ifdef CONFIG_REMOTEPROC_WATCHDOG
- /* GPT 9 & 11 (ipu); GPT 6 (dsp) are used as watchdog timers */
- if ((!strcmp(rproc->name, "dsp") && timers[i].id == 6) ||
- (!strcmp(rproc->name, "ipu") &&
- (timers[i].id == 9 || timers[i].id == 11))) {
+ /* GPT 9 and 11 are using as WDT */
+ if (timers[i].id == 9 || timers[i].id == 11) {
ret = request_irq(omap_dm_timer_get_irq(timers[i].odt),
omap_rproc_watchdog_isr, IRQF_DISABLED,
"rproc-wdt", rproc);
@@ -471,7 +478,6 @@ static inline int omap_rproc_start(struct rproc *rproc, u64 bootaddr)
#endif
}
- rpp->bootaddr = bootaddr;
ret = omap_device_enable(pdev);
out:
if (ret) {
@@ -526,10 +532,8 @@ static inline int omap_rproc_stop(struct rproc *rproc)
for (i = 0; i < pdata->timers_cnt; i++) {
#ifdef CONFIG_REMOTEPROC_WATCHDOG
- /* GPT 9 & 11 (ipu); GPT 6 (dsp) are used as watchdog timers */
- if ((!strcmp(rproc->name, "dsp") && timers[i].id == 6) ||
- (!strcmp(rproc->name, "ipu") &&
- (timers[i].id == 9 || timers[i].id == 11)))
+ /* GPT 9 and 11 are used as WDT */
+ if (timers[i].id == 9 || timers[i].id == 11)
free_irq(omap_dm_timer_get_irq(timers[i].odt), rproc);
#endif
omap_dm_timer_free(timers[i].odt);
@@ -541,15 +545,8 @@ err:
static int omap_rproc_set_lat(struct rproc *rproc, long val)
{
- int ret = 0;
-
- if (!strcmp(rproc->name, "ipu"))
- pm_qos_update_request(rproc->qos_request, val);
- else
- ret = omap_pm_set_max_dev_wakeup_lat(rproc->dev,
- rproc->dev, val);
-
- return ret;
+ pm_qos_update_request(rproc->qos_request, val);
+ return 0;
}
static int omap_rproc_set_l3_bw(struct rproc *rproc, long val)
diff --git a/drivers/remoteproc/remoteproc.c b/drivers/remoteproc/remoteproc.c
index 1801f2b9b74..12dd4ddc4e0 100755
--- a/drivers/remoteproc/remoteproc.c
+++ b/drivers/remoteproc/remoteproc.c
@@ -48,22 +48,30 @@ static DEFINE_SPINLOCK(rprocs_lock);
/* debugfs parent dir */
static struct dentry *rproc_dbg;
-static ssize_t rproc_format_trace_buf(char __user *userbuf, size_t count,
- loff_t *ppos, const void *src, int size)
+static ssize_t rproc_format_trace_buf(struct rproc *rproc, char __user *userbuf,
+ size_t count, loff_t *ppos,
+ const void *src, int size)
{
const char *buf = (const char *) src;
ssize_t num_copied = 0;
static int from_beg;
loff_t pos = *ppos;
int *w_idx;
- int i, w_pos;
+ int i, w_pos, ret = 0;
+
+ if (mutex_lock_interruptible(&rproc->tlock))
+ return -EINTR;
/* When src is NULL, the remoteproc is offline. */
- if (!src)
- return -EIO;
+ if (!src) {
+ ret = -EIO;
+ goto unlock;
+ }
- if (size < 2 * sizeof(u32))
- return -EINVAL;
+ if (size < 2 * sizeof(u32)) {
+ ret = -EINVAL;
+ goto unlock;
+ }
/* Assume write_idx is the penultimate byte in the buffer trace*/
size = size - (sizeof(u32) * 2);
@@ -80,25 +88,29 @@ static ssize_t rproc_format_trace_buf(char __user *userbuf, size_t count,
;
if (i > w_pos)
- num_copied = simple_read_from_buffer(userbuf, count,
- ppos, src, i);
+ num_copied =
+ simple_read_from_buffer(userbuf, count, ppos, src, i);
if (!num_copied) {
from_beg = 1;
*ppos = 0;
- } else
- return num_copied;
+ } else {
+ ret = num_copied;
+ goto unlock;
+ }
print_beg:
for (i = 0; i < w_pos && buf[i]; i++)
;
if (i) {
- num_copied = simple_read_from_buffer(userbuf, count,
- ppos, src, i);
+ num_copied =
+ simple_read_from_buffer(userbuf, count, ppos, src, i);
if (!num_copied)
from_beg = 0;
- return num_copied;
+ ret = num_copied;
}
- return 0;
+unlock:
+ mutex_unlock(&rproc->tlock);
+ return ret;
}
static ssize_t rproc_name_read(struct file *filp, char __user *userbuf,
@@ -135,12 +147,12 @@ static int rproc_open_generic(struct inode *inode, struct file *file)
return 0;
}
-#define DEBUGFS_READONLY_FILE(name, value, len) \
+#define DEBUGFS_READONLY_FILE(name, v, l) \
static ssize_t name## _rproc_read(struct file *filp, \
- char __user *userbuf, size_t count, loff_t *ppos) \
+ char __user *ubuf, size_t count, loff_t *ppos) \
{ \
struct rproc *rproc = filp->private_data; \
- return rproc_format_trace_buf(userbuf, count, ppos, value, len);\
+ return rproc_format_trace_buf(rproc, ubuf, count, ppos, v, l); \
} \
\
static const struct file_operations name ##_rproc_ops = { \
@@ -260,8 +272,9 @@ static int setup_rproc_elf_core_dump(struct core_rproc *d)
{
short __phnum;
struct elf_phdr *nphdr;
- struct exc_regs *xregs;
- struct pt_regs *regs;
+ struct exc_regs *xregs = d->rproc->cdump_buf1;
+ struct pt_regs *regs =
+ (struct pt_regs *)&d->core.core_note.prstatus.pr_reg;
memset(&d->core.elf, 0, sizeof(d->core.elf));
@@ -296,12 +309,8 @@ static int setup_rproc_elf_core_dump(struct core_rproc *d)
d->core.core_note.note_prstatus.n_type = NT_PRSTATUS;
memcpy(d->core.core_note.name, CORE_STR, sizeof(CORE_STR));
- /* fill in registers for ipu only, dsp yet to be supported */
- if (!strcmp(d->rproc->name, "ipu")) {
- xregs = d->rproc->cdump_buf1;
- regs = (struct pt_regs *)&d->core.core_note.prstatus.pr_reg;
- remoteproc_fill_pt_regs(regs, xregs);
- }
+ remoteproc_fill_pt_regs(regs, xregs);
+
/* We ignore the NVIC registers for now */
d->offset = sizeof(struct core);
@@ -547,8 +556,8 @@ static struct rproc *__find_rproc_by_name(const char *name)
}
/**
- * rproc_da_to_pa - convert a device (virtual) address to its physical address
- * @rproc: the remote processor handle
+ * __rproc_da_to_pa - convert a device (virtual) address to its physical address
+ * @maps: the remote processor's memory mappings array
* @da: a device address (as seen by the remote processor)
* @pa: pointer to the physical address result
*
@@ -559,32 +568,26 @@ static struct rproc *__find_rproc_by_name(const char *name)
* On success 0 is returned, and the @pa is updated with the result.
* Otherwise, -EINVAL is returned.
*/
-int rproc_da_to_pa(struct rproc *rproc, u64 da, phys_addr_t *pa)
+static int
+rproc_da_to_pa(const struct rproc_mem_entry *maps, u64 da, phys_addr_t *pa)
{
- int i, ret = -EINVAL;
- struct rproc_mem_entry *maps = NULL;
-
- if (!rproc || !pa)
- return -EINVAL;
+ int i;
+ u64 offset;
- if (mutex_lock_interruptible(&rproc->lock))
- return -EINTR;
+ for (i = 0; maps[i].size; i++) {
+ const struct rproc_mem_entry *me = &maps[i];
- maps = rproc->memory_maps;
- for (i = 0; maps->size; maps++) {
- if (da >= maps->da && da < (maps->da + maps->size)) {
+ if (da >= me->da && da < (me->da + me->size)) {
+ offset = da - me->da;
pr_debug("%s: matched mem entry no. %d\n",
__func__, i);
- *pa = maps->pa + (da - maps->da);
- ret = 0;
- break;
+ *pa = me->pa + offset;
+ return 0;
}
}
- mutex_unlock(&rproc->lock);
- return ret;
+ return -EINVAL;
}
-EXPORT_SYMBOL(rproc_da_to_pa);
static int rproc_mmu_fault_isr(struct rproc *rproc, u64 da, u32 flags)
{
@@ -766,9 +769,7 @@ static int rproc_add_mem_entry(struct rproc *rproc, struct fw_resource *rsc)
* carveouts we don't care about in a core dump.
* Perhaps the ION carveout should be reported as RSC_DEVMEM.
*/
- me->core = (rsc->type == RSC_CARVEOUT &&
- strcmp(rsc->name, "IPU_MEM_IOBUFS") &&
- strcmp(rsc->name, "DSP_MEM_IOBUFS"));
+ me->core = (rsc->type == RSC_CARVEOUT && rsc->pa != 0xba300000);
#endif
}
@@ -891,13 +892,7 @@ static int rproc_handle_resources(struct rproc *rproc, struct fw_resource *rsc,
rsc->pa = pa;
} else {
ret = rproc_check_poolmem(rproc, rsc->len, pa);
- /*
- * ignore the error for DSP buffers as they can
- * not be assigned together with rest of dsp
- * pool memory
- */
- if (ret &&
- strcmp(rsc->name, "DSP_MEM_IOBUFS")) {
+ if (ret) {
dev_err(dev, "static memory for %s "
"doesn't belong to poolmem\n",
rsc->name);
@@ -932,10 +927,14 @@ static int rproc_handle_resources(struct rproc *rproc, struct fw_resource *rsc,
* trace buffer memory _is_ normal memory, so we cast away the
* __iomem to make sparse happy
*/
+
+ if (mutex_lock_interruptible(&rproc->tlock))
+ goto error;
+
if (trace_da0) {
- ret = rproc_da_to_pa(rproc, trace_da0, &pa);
+ ret = rproc_da_to_pa(rproc->memory_maps, trace_da0, &pa);
if (ret)
- goto error;
+ goto unlock;
rproc->trace_buf0 = (__force void *)
ioremap_nocache(pa, rproc->trace_len0);
if (rproc->trace_buf0) {
@@ -946,20 +945,20 @@ static int rproc_handle_resources(struct rproc *rproc, struct fw_resource *rsc,
GFP_KERNEL);
if (!rproc->last_trace_buf0) {
ret = -ENOMEM;
- goto error;
+ goto unlock;
}
DEBUGFS_ADD(trace0_last);
}
} else {
dev_err(dev, "can't ioremap trace buffer0\n");
ret = -EIO;
- goto error;
+ goto unlock;
}
}
if (trace_da1) {
- ret = rproc_da_to_pa(rproc, trace_da1, &pa);
+ ret = rproc_da_to_pa(rproc->memory_maps, trace_da1, &pa);
if (ret)
- goto error;
+ goto unlock;
rproc->trace_buf1 = (__force void *)
ioremap_nocache(pa, rproc->trace_len1);
if (rproc->trace_buf1) {
@@ -970,13 +969,14 @@ static int rproc_handle_resources(struct rproc *rproc, struct fw_resource *rsc,
GFP_KERNEL);
if (!rproc->last_trace_buf1) {
ret = -ENOMEM;
- goto error;
+ goto unlock;
}
DEBUGFS_ADD(trace1_last);
}
} else {
dev_err(dev, "can't ioremap trace buffer1\n");
ret = -EIO;
+ goto unlock;
}
}
@@ -988,9 +988,9 @@ static int rproc_handle_resources(struct rproc *rproc, struct fw_resource *rsc,
* make sparse happy
*/
if (cdump_da0) {
- ret = rproc_da_to_pa(rproc, cdump_da0, &pa);
+ ret = rproc_da_to_pa(rproc->memory_maps, cdump_da0, &pa);
if (ret)
- goto error;
+ goto unlock;
rproc->cdump_buf0 = (__force void *)
ioremap_nocache(pa, rproc->cdump_len0);
if (rproc->cdump_buf0)
@@ -998,13 +998,13 @@ static int rproc_handle_resources(struct rproc *rproc, struct fw_resource *rsc,
else {
dev_err(dev, "can't ioremap cdump buffer0\n");
ret = -EIO;
- goto error;
+ goto unlock;
}
}
if (cdump_da1) {
- ret = rproc_da_to_pa(rproc, cdump_da1, &pa);
+ ret = rproc_da_to_pa(rproc->memory_maps, cdump_da1, &pa);
if (ret)
- goto error;
+ goto unlock;
rproc->cdump_buf1 = (__force void *)
ioremap_nocache(pa, rproc->cdump_len1);
if (rproc->cdump_buf1)
@@ -1012,10 +1012,12 @@ static int rproc_handle_resources(struct rproc *rproc, struct fw_resource *rsc,
else {
dev_err(dev, "can't ioremap cdump buffer1\n");
ret = -EIO;
- goto error;
}
}
+unlock:
+ mutex_unlock(&rproc->tlock);
+
error:
if (ret && rproc->dbg_dir) {
debugfs_remove_recursive(rproc->dbg_dir);
@@ -1064,12 +1066,13 @@ static int rproc_process_fw(struct rproc *rproc, struct fw_section *section,
ret = rproc_handle_resources(rproc,
(struct fw_resource *) section->content,
len, bootaddr);
- if (ret)
+ if (ret) {
break;
+ }
}
if (section->type <= FW_DATA) {
- ret = rproc_da_to_pa(rproc, da, &pa);
+ ret = rproc_da_to_pa(rproc->memory_maps, da, &pa);
if (ret) {
dev_err(dev, "rproc_da_to_pa failed:%d\n", ret);
break;
@@ -1114,7 +1117,7 @@ static void rproc_loader_cont(const struct firmware *fw, void *context)
u64 bootaddr = 0;
struct fw_header *image;
struct fw_section *section;
- int left, ret = -EINVAL;
+ int left, ret;
if (!fw) {
dev_err(dev, "%s: failed to load %s\n", __func__, fwfile);
@@ -1136,7 +1139,7 @@ static void rproc_loader_cont(const struct firmware *fw, void *context)
goto out;
}
- dev_dbg(dev, "BIOS image version is %d\n", image->version);
+ dev_info(dev, "BIOS image version is %d\n", image->version);
rproc->header = kzalloc(image->header_len, GFP_KERNEL);
if (!rproc->header) {
@@ -1146,9 +1149,6 @@ static void rproc_loader_cont(const struct firmware *fw, void *context)
memcpy(rproc->header, image->header, image->header_len);
rproc->header_len = image->header_len;
- debugfs_create_file("version", 0444, rproc->dbg_dir, rproc,
- &rproc_version_ops);
-
/* Ensure we recognize this BIOS version: */
if (image->version != RPROC_BIOS_VERSION) {
dev_err(dev, "Expected BIOS version: %d!\n",
@@ -1161,10 +1161,6 @@ static void rproc_loader_cont(const struct firmware *fw, void *context)
left = fw->size - sizeof(struct fw_header) - image->header_len;
- /* event currently used to bump the remoteproc to max freq
- * while booting. */
- _event_notify(rproc, RPROC_PRELOAD, NULL);
-
ret = rproc_process_fw(rproc, section, left, &bootaddr);
if (ret) {
dev_err(dev, "Failed to process the image: %d\n", ret);
@@ -1178,8 +1174,6 @@ out:
complete_fw:
/* allow all contexts calling rproc_put() to proceed */
complete_all(&rproc->firmware_loading_complete);
- if (ret)
- _event_notify(rproc, RPROC_LOAD_ERROR, NULL);
}
static int rproc_loader(struct rproc *rproc)
@@ -1207,34 +1201,6 @@ static int rproc_loader(struct rproc *rproc)
return 0;
}
-int rproc_pa_to_da(struct rproc *rproc, phys_addr_t pa, u64 *da)
-{
- int i, ret = -EINVAL;
- struct rproc_mem_entry *maps = NULL;
-
- if (!rproc || !da)
- return -EINVAL;
-
- if (mutex_lock_interruptible(&rproc->lock))
- return -EINTR;
-
- if (rproc->state == RPROC_RUNNING || rproc->state == RPROC_SUSPENDED) {
- maps = rproc->memory_maps;
- for (i = 0; maps->size; maps++) {
- if (pa >= maps->pa && pa < (maps->pa + maps->size)) {
- *da = maps->da + (pa - maps->pa);
- ret = 0;
- break;
- }
- }
- }
-
- mutex_unlock(&rproc->lock);
- return ret;
-
-}
-EXPORT_SYMBOL(rproc_pa_to_da);
-
int rproc_set_secure(const char *name, bool enable)
{
struct rproc *rproc;
@@ -1372,6 +1338,9 @@ void rproc_put(struct rproc *rproc)
if (--rproc->count)
goto out;
+ if (mutex_lock_interruptible(&rproc->tlock))
+ goto out;
+
if (rproc->trace_buf0)
/* iounmap normal memory, so make sparse happy */
iounmap((__force void __iomem *) rproc->trace_buf0);
@@ -1388,6 +1357,8 @@ void rproc_put(struct rproc *rproc)
iounmap((__force void __iomem *) rproc->cdump_buf1);
rproc->cdump_buf0 = rproc->cdump_buf1 = NULL;
+ mutex_unlock(&rproc->tlock);
+
rproc_reset_poolmem(rproc);
memset(rproc->memory_maps, 0, sizeof(rproc->memory_maps));
kfree(rproc->header);
@@ -1737,6 +1708,7 @@ int rproc_register(struct device *dev, const char *name,
#endif
mutex_init(&rproc->lock);
mutex_init(&rproc->secure_lock);
+ mutex_init(&rproc->tlock);
INIT_WORK(&rproc->error_work, rproc_error_work);
BLOCKING_INIT_NOTIFIER_HEAD(&rproc->nbh);
@@ -1776,6 +1748,8 @@ int rproc_register(struct device *dev, const char *name,
debugfs_create_file("name", 0444, rproc->dbg_dir, rproc,
&rproc_name_ops);
+ debugfs_create_file("version", 0444, rproc->dbg_dir, rproc,
+ &rproc_version_ops);
out:
return 0;
}
diff --git a/drivers/remoteproc/rpres.c b/drivers/remoteproc/rpres.c
index 7a200a4c5dc..e839f70f629 100644
--- a/drivers/remoteproc/rpres.c
+++ b/drivers/remoteproc/rpres.c
@@ -15,7 +15,6 @@
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/err.h>
-#include <linux/opp.h>
#include <plat/omap_device.h>
#include <plat/rpres.h>
@@ -76,13 +75,12 @@ void rpres_put(struct rpres *obj)
}
EXPORT_SYMBOL(rpres_put);
-int rpres_set_constraints(struct rpres *obj, enum rpres_constraint type,
- long val)
+int rpres_set_constraints(struct rpres *obj, enum rpres_constraint type, long val)
{
int ret;
struct rpres_platform_data *pdata = obj->pdev->dev.platform_data;
struct platform_device *pdev = obj->pdev;
- static char * const cname[] = {"scale", "latency", "bandwidth"};
+ static const char *cname[] = {"scale", "latency", "bandwidth"};
int (*func)(struct platform_device *, long);
switch (type) {
@@ -125,22 +123,6 @@ int rpres_set_constraints(struct rpres *obj, enum rpres_constraint type,
}
EXPORT_SYMBOL(rpres_set_constraints);
-unsigned long rpres_get_max_freq(struct rpres *obj)
-{
- struct platform_device *pdev = obj->pdev;
- struct opp *opp;
- unsigned long maxfreq = ULONG_MAX;
-
- rcu_read_lock();
- opp = opp_find_freq_floor(&pdev->dev, &maxfreq);
- if (IS_ERR(opp))
- maxfreq = 0;
- rcu_read_unlock();
-
- return maxfreq;
-}
-EXPORT_SYMBOL(rpres_get_max_freq);
-
static int rpres_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;