Commit 82873734 authored by Hiroshi DOYU's avatar Hiroshi DOYU Committed by Tony Lindgren

OMAP: DSP: N800: remaining updates for dsp parts

Signed-off-by: default avatarHiroshi DOYU <Hiroshi.DOYU@nokia.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 19890e58
......@@ -50,7 +50,7 @@ static struct dsp_kfunc_device n800_audio_device = {
/*
* dsp peripheral device: TIMER
*/
static int dsp_timer_probe(struct dsp_kfunc_device *kdev)
static int dsp_timer_probe(struct dsp_kfunc_device *kdev, int stage)
{
char clockname[20];
......@@ -80,7 +80,7 @@ static int dsp_timer_probe(struct dsp_kfunc_device *kdev)
return PTR_ERR(kdev->ick);
}
static int dsp_timer_remove(struct dsp_kfunc_device *kdev)
static int dsp_timer_remove(struct dsp_kfunc_device *kdev, int stage)
{
clk_put(kdev->ick);
clk_put(kdev->fck);
......@@ -92,7 +92,7 @@ static int dsp_timer_enable(struct dsp_kfunc_device *kdev, int stage)
{
pr_debug("%s enabled(%d)\n", kdev->name, stage);
mutex_lock(&kdev->lock);
spin_lock(&kdev->lock);
if (kdev->enabled)
goto out;
......@@ -101,7 +101,7 @@ static int dsp_timer_enable(struct dsp_kfunc_device *kdev, int stage)
clk_enable(kdev->fck);
clk_enable(kdev->ick);
out:
mutex_unlock(&kdev->lock);
spin_unlock(&kdev->lock);
return 0;
}
......@@ -110,7 +110,7 @@ static int dsp_timer_disable(struct dsp_kfunc_device *kdev, int stage)
{
pr_debug("%s disabled(%d)\n", kdev->name, stage);
mutex_lock(&kdev->lock);
spin_lock(&kdev->lock);
if (kdev->enabled == 0)
goto out;
......@@ -119,7 +119,7 @@ static int dsp_timer_disable(struct dsp_kfunc_device *kdev, int stage)
clk_disable(kdev->ick);
clk_disable(kdev->fck);
out:
mutex_unlock(&kdev->lock);
spin_unlock(&kdev->lock);
return 0;
}
......
......@@ -74,7 +74,7 @@ int dsp_kfunc_device_register(struct dsp_kfunc_device *kdev)
{
static DEFINE_MUTEX(dsp_pdata_lock);
mutex_init(&kdev->lock);
spin_lock_init(&kdev->lock);
mutex_lock(&dsp_pdata_lock);
list_add_tail(&kdev->entry, &dsp_pdata.kdev_list);
......
......@@ -23,7 +23,7 @@ config OMAP_DSP_TASK_MULTIOPEN
config OMAP_DSP_FBEXPORT
bool "Framebuffer export to DSP"
depends on OMAP_DSP
depends on OMAP_DSP && FB
help
This enables to map the frame buffer to DSP.
By doing this, DSP can access the frame buffer directly without
......
......@@ -21,6 +21,9 @@
*
*/
#ifndef __PLAT_OMAP_DSP_DSP_H
#define __PLAT_OMAP_DSP_DSP_H
#include "hardware_dsp.h"
#include "dsp_common.h"
#include <asm/arch/mmu.h>
......@@ -129,7 +132,7 @@ extern int dsp_mbcmd_send_and_wait_exarg(struct mbcmd *mb, struct mb_exarg *arg,
#define dsp_mbcmd_send_and_wait(mb, q) \
dsp_mbcmd_send_and_wait_exarg((mb), NULL, (q))
static __inline__ int __mbcompose_send_exarg(u8 cmd_h, u8 cmd_l, u16 data,
static inline int __mbcompose_send_exarg(u8 cmd_h, u8 cmd_l, u16 data,
struct mb_exarg *arg,
int recovery_flag)
{
......@@ -143,7 +146,7 @@ static __inline__ int __mbcompose_send_exarg(u8 cmd_h, u8 cmd_l, u16 data,
#define mbcompose_send_recovery(cmd_h, cmd_l, data) \
__mbcompose_send_exarg(MBOX_CMD_DSP_##cmd_h, (cmd_l), (data), NULL, 1)
static __inline__ int __mbcompose_send_and_wait_exarg(u8 cmd_h, u8 cmd_l,
static inline int __mbcompose_send_and_wait_exarg(u8 cmd_h, u8 cmd_l,
u16 data,
struct mb_exarg *arg,
wait_queue_head_t *q)
......@@ -242,3 +245,5 @@ extern struct omap_mmu dsp_mmu;
#define dsp_mem_enable(addr) omap_mmu_mem_enable(&dsp_mmu, (addr))
#define dsp_mem_disable(addr) omap_mmu_mem_disable(&dsp_mmu, (addr))
#endif /* __PLAT_OMAP_DSP_DSP_H */
......@@ -56,7 +56,7 @@ dsp_long_t dspmem_base, dspmem_size,
daram_base, daram_size,
saram_base, saram_size;
struct cpustat {
static struct cpustat {
struct mutex lock;
enum cpustat_e stat;
enum cpustat_e req;
......@@ -317,6 +317,8 @@ static int __init omap_dsp_init(void)
api_ck_handle = clk_get(NULL, "api_ck");
if (IS_ERR(api_ck_handle)) {
printk(KERN_ERR "omapdsp: could not acquire api_ck handle.\n");
if (dsp_ck_handle != NULL)
clk_put(dsp_ck_handle);
return PTR_ERR(api_ck_handle);
}
......@@ -337,12 +339,14 @@ static int __init omap_dsp_init(void)
dsp_ick_handle = clk_get(NULL, "dsp_ick");
if (IS_ERR(dsp_ick_handle)) {
printk(KERN_ERR "omapdsp: could not acquire dsp_ick handle.\n");
if (dsp_fck_handle != NULL)
clk_put(dsp_fck_handle);
return PTR_ERR(dsp_ick_handle);
}
#endif
init_done = 1;
printk(KERN_INFO "omap_dsp_init() done\n");
pr_info("omap_dsp_init() done\n");
return 0;
}
......
......@@ -145,18 +145,6 @@ void dsp_cpustat_set_icrmask(u16 mask);
void dsp_register_mem_cb(int (*req_cb)(void), void (*rel_cb)(void));
void dsp_unregister_mem_cb(void);
#if defined(CONFIG_ARCH_OMAP1)
static inline void dsp_clk_autoidle(void) {}
#elif defined(CONFIG_ARCH_OMAP2)
static inline void dsp_clk_autoidle(void)
{
/*XXX should be handled in mach-omap[1,2] XXX*/
PM_PWSTCTRL_DSP = (1 << 18) | (1 << 0);
CM_AUTOIDLE_DSP |= (1 << 1);
CM_CLKSTCTRL_DSP |= (1 << 0);
}
#endif
#if defined(CONFIG_ARCH_OMAP1)
static inline void dsp_clk_enable(void) {}
static inline void dsp_clk_disable(void) {}
......@@ -186,7 +174,7 @@ struct dsp_kfunc_device {
char *name;
struct clk *fck;
struct clk *ick;;
struct mutex lock;
spinlock_t lock;
int enabled;
int type;
#define DSP_KFUNC_DEV_TYPE_COMMON 1
......@@ -194,8 +182,8 @@ struct dsp_kfunc_device {
struct list_head entry;
int (*probe)(struct dsp_kfunc_device *);
int (*remove)(struct dsp_kfunc_device *);
int (*probe)(struct dsp_kfunc_device *, int);
int (*remove)(struct dsp_kfunc_device *, int);
int (*enable)(struct dsp_kfunc_device *, int);
int (*disable)(struct dsp_kfunc_device *, int);
};
......@@ -212,7 +200,7 @@ struct omap_dsp {
int mmu_irq;
struct omap_mbox *mbox;
struct device *dev;
struct list_head *kdev_list;
struct list_head *kdev_list;
int initialized;
};
......
......@@ -132,97 +132,44 @@ const struct cmdinfo *cmdinfo[MBOX_CMD_MAX] = {
[MBOX_CMD_DSP_DBG] = &cif_dbg,
};
static int dsp_kfunc_probe_devices(struct omap_dsp *dsp)
{
struct dsp_kfunc_device *p;
int ret, fail = 0;
mutex_lock(&dsp->lock);
list_for_each_entry(p, dsp->kdev_list, entry) {
if (p->probe == NULL)
continue;
ret = p->probe(p);
if (ret) {
printk(KERN_ERR
"probing %s failed\n", p->name);
fail++;
}
}
mutex_unlock(&dsp->lock);
pr_debug("%s() fail:%d\n", __FUNCTION__, fail);
return fail;
#define list_for_each_entry_safe_natural(p,n,h,m) \
list_for_each_entry_safe(p,n,h,m)
#define __BUILD_KFUNC(fn, dir) \
static int __dsp_kfunc_##fn##_devices(struct omap_dsp *dsp, int type, int stage)\
{ \
struct dsp_kfunc_device *p, *tmp; \
int ret, fail = 0; \
\
list_for_each_entry_safe_##dir(p, tmp, dsp->kdev_list, entry) { \
if (type && (p->type != type)) \
continue; \
if (p->fn == NULL) \
continue; \
ret = p->fn(p, stage); \
if (ret) { \
printk(KERN_ERR "%s %s failed\n", #fn, p->name); \
fail++; \
} \
} \
return fail; \
}
static int dsp_kfunc_remove_devices(struct omap_dsp *dsp)
{
struct dsp_kfunc_device *p;
int ret, fail = 0;
mutex_lock(&dsp->lock);
list_for_each_entry_reverse(p, dsp->kdev_list, entry) {
if (p->remove == NULL)
continue;
ret = p->remove(p);
if (ret) {
printk(KERN_ERR
"removing %s failed\n", p->name);
fail++;
}
}
mutex_unlock(&dsp->lock);
pr_debug("%s() fail:%d\n", __FUNCTION__, fail);
return fail;
#define BUILD_KFUNC(fn, dir) \
__BUILD_KFUNC(fn, dir) \
static inline int dsp_kfunc_##fn##_devices(struct omap_dsp *dsp) \
{ \
return __dsp_kfunc_##fn##_devices(dsp, 0, 0); \
}
static int dsp_kfunc_enable_devices(struct omap_dsp *dsp, int type, int stage)
{
struct dsp_kfunc_device *p;
int ret, fail = 0;
mutex_lock(&dsp->lock);
list_for_each_entry(p, dsp->kdev_list, entry) {
if ((p->type != type) || (p->enable == NULL))
continue;
ret = p->enable(p, stage);
if (ret) {
printk(KERN_ERR
"enabling %s failed\n", p->name);
fail++;
}
}
mutex_unlock(&dsp->lock);
pr_debug("%s(%d) fail:%d\n", __FUNCTION__, type, fail);
return fail;
#define BUILD_KFUNC_CTL(fn, dir) \
__BUILD_KFUNC(fn, dir) \
static inline int dsp_kfunc_##fn##_devices(struct omap_dsp *dsp, int type, int stage) \
{ \
return __dsp_kfunc_##fn##_devices(dsp, type, stage); \
}
static int dsp_kfunc_disable_devices(struct omap_dsp *dsp, int type, int stage)
{
struct dsp_kfunc_device *p;
int ret, fail = 0;
mutex_lock(&dsp->lock);
list_for_each_entry_reverse(p, omap_dsp->kdev_list, entry) {
if ((p->type != type) || (p->disable == NULL))
continue;
ret = p->disable(p, stage);
if (ret) {
printk(KERN_ERR
"disabling %s failed\n", p->name);
fail++;
}
}
mutex_unlock(&dsp->lock);
pr_debug("%s(%d) fail:%d\n", __FUNCTION__, type, fail);
return fail;
}
BUILD_KFUNC(probe, natural)
BUILD_KFUNC(remove, reverse)
BUILD_KFUNC_CTL(enable, natural)
BUILD_KFUNC_CTL(disable, reverse)
int sync_with_dsp(u16 *adr, u16 val, int try_cnt)
{
......@@ -256,6 +203,7 @@ static int mbcmd_sender_prepare(void *data)
*
* Therefore, we can call this function here safely.
*/
dsp_mem_enable(ipbuf_sys_ad);
if (sync_with_dsp(&ipbuf_sys_ad->s, TID_FREE, 10) < 0) {
printk(KERN_ERR "omapdsp: ipbuf_sys_ad is busy.\n");
ret = -EBUSY;
......@@ -267,6 +215,7 @@ static int mbcmd_sender_prepare(void *data)
}
ipbuf_sys_ad->s = arg->tid;
out:
dsp_mem_disable(ipbuf_sys_ad);
return ret;
}
......@@ -296,9 +245,6 @@ int __dsp_mbcmd_send_exarg(struct mbcmd *mb, struct mb_exarg *arg,
goto out;
}
if (arg)
dsp_mem_enable(ipbuf_sys_ad);
ret = omap_mbox_msg_send(omap_dsp->mbox,
*(mbox_msg_t *)mb, (void*)arg);
if (ret)
......@@ -309,44 +255,37 @@ int __dsp_mbcmd_send_exarg(struct mbcmd *mb, struct mb_exarg *arg,
mblog_add(mb, DIR_A2D);
out:
if (arg)
dsp_mem_disable(ipbuf_sys_ad);
return ret;
}
int dsp_mbcmd_send_and_wait_exarg(struct mbcmd *mb, struct mb_exarg *arg,
wait_queue_head_t *q)
{
long current_state;
DECLARE_WAITQUEUE(wait, current);
add_wait_queue(q, &wait);
current_state = current->state;
set_current_state(TASK_INTERRUPTIBLE);
if (dsp_mbcmd_send_exarg(mb, arg) < 0) {
set_current_state(current_state);
remove_wait_queue(q, &wait);
return -1;
}
schedule_timeout(DSP_TIMEOUT);
set_current_state(current_state);
remove_wait_queue(q, &wait);
int ret;
return 0;
DEFINE_WAIT(wait);
prepare_to_wait(q, &wait, TASK_INTERRUPTIBLE);
ret = dsp_mbcmd_send_exarg(mb, arg);
if (ret < 0)
goto out;
schedule_timeout(DSP_TIMEOUT);
out:
finish_wait(q, &wait);
return ret;
}
/*
* mbcmd receiver
*/
static int mbcmd_receiver(void *data)
static int mbcmd_receiver(void* msg)
{
struct mbcmd *mb = data;
struct mbcmd *mb = (struct mbcmd *)&msg;
if (cmdinfo[mb->cmd_h] == NULL) {
printk(KERN_ERR
"invalid message for mbcmd_receiver().\n");
return -EINVAL;
"invalid message (%08x) for mbcmd_receiver().\n",
(mbox_msg_t)msg);
return -1;
}
(*mbseq_expect)++;
......@@ -407,7 +346,7 @@ int dsp_mbox_config(void *p)
static int __init dsp_mbox_init(void)
{
omap_dsp->mbox = omap_mbox_get("dsp");
if (omap_dsp->mbox == NULL) {
if (IS_ERR(omap_dsp->mbox)) {
printk(KERN_ERR "failed to get mailbox handler for DSP.\n");
return -ENODEV;
}
......@@ -420,8 +359,10 @@ static int __init dsp_mbox_init(void)
static void dsp_mbox_exit(void)
{
omap_dsp->mbox->rxq->callback = NULL;
omap_dsp->mbox->txq->callback = NULL;
omap_dsp->mbox->rxq->callback = NULL;
omap_mbox_put(omap_dsp->mbox);
if (mbsync_hold_mem_active) {
dsp_mem_disable((void *)daram_base);
......@@ -517,36 +458,33 @@ int dsp_late_init(void)
{
int ret;
/*dsp_clk_autoidle();*/
dsp_clk_enable();
dsp_mem_late_init();
ret = dsp_mbox_init();
if (ret)
goto fail_mbox;
#ifdef CONFIG_ARCH_OMAP1
dsp_set_idle_boot_base(IDLEPG_BASE, IDLEPG_SIZE);
#endif
ret = dsp_kfunc_enable_devices(omap_dsp,
DSP_KFUNC_DEV_TYPE_COMMON, 0);
if (ret == 0)
if (ret)
goto fail_kfunc;
omap_dsp->enabled = 1;
return 0;
fail_kfunc:
fail_kfunc:
dsp_mbox_exit();
fail_mbox:
fail_mbox:
dsp_clk_disable();
return ret;
}
extern int dsp_ctl_core_init(void);
extern void dsp_ctl_core_exit(void);
extern void dsp_ctl_init(void);
extern int dsp_ctl_init(void);
extern void dsp_ctl_exit(void);
extern int dsp_mem_init(void);
extern void dsp_mem_exit(void);
......@@ -581,36 +519,42 @@ static int __init dsp_drv_probe(struct platform_device *pdev)
ret = dsp_kfunc_probe_devices(info);
if (ret) {
ret = -ENXIO;
goto fail0;
goto fail_kfunc;
}
info->mmu_irq = platform_get_irq_byname(pdev, "dsp_mmu");
if (unlikely(info->mmu_irq) < 0) {
ret = -ENXIO;
goto fail1;
goto fail_irq;
}
if ((ret = dsp_ctl_core_init()) < 0)
goto fail2;
if ((ret = dsp_mem_init()) < 0)
goto fail3;
dsp_ctl_init();
ret = dsp_ctl_core_init();
if (ret)
goto fail_ctl_core;
ret = dsp_mem_init();
if (ret)
goto fail_mem;
ret = dsp_ctl_init();
if (unlikely(ret))
goto fail_ctl_init;
mblog_init();
if ((ret = dsp_taskmod_init()) < 0)
goto fail4;
ret = dsp_taskmod_init();
if (ret)
goto fail_taskmod;
return 0;
fail4:
fail_taskmod:
mblog_exit();
dsp_ctl_exit();
fail_ctl_init:
dsp_mem_exit();
fail3:
fail_mem:
dsp_ctl_core_exit();
fail2:
fail1:
fail_ctl_core:
fail_irq:
dsp_kfunc_remove_devices(info);
fail0:
fail_kfunc:
kfree(info);
return ret;
......@@ -642,7 +586,7 @@ static int dsp_drv_remove(struct platform_device *pdev)
return 0;
}
#ifdef CONFIG_PM
#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP1)
static int dsp_drv_suspend(struct platform_device *pdev, pm_message_t state)
{
dsp_cfgstat_request(CFGSTAT_SUSPEND);
......
......@@ -269,15 +269,15 @@ static int dsp_cfg(void)
#endif
/* send parameter */
if ((ret = dsp_setvar(VARID_ICRMASK, dsp_cpustat_get_icrmask())) < 0)
ret = dsp_setvar(VARID_ICRMASK, dsp_cpustat_get_icrmask());
if (ret < 0)
goto out;
/* create runtime sysfs entries */
ret = device_create_file(omap_dsp->dev, &dev_attr_loadinfo);
if (ret)
printk(KERN_ERR "device_create_file failed: %d\n", ret);
out:
out:
dsp_mem_disable((void *)dspmem_base);
return ret;
}
......@@ -749,9 +749,8 @@ void mbox_dspcfg(struct mbcmd *mb)
* revision check has been passed.
*/
if (!mbox_revision < 0) {
printk(KERN_INFO
"mbox: DSPCFG command received, "
"but revision check has not been passed.\n");
pr_info("mbox: DSPCFG command received, "
"but revision check has not been passed.\n");
return;
}
......@@ -1038,15 +1037,28 @@ out:
return len;
}
void __init dsp_ctl_init(void)
int __init dsp_ctl_init(void)
{
int ret;
ret = device_create_file(omap_dsp->dev, &dev_attr_ifver);
ret |= device_create_file(omap_dsp->dev, &dev_attr_cpustat);
ret |= device_create_file(omap_dsp->dev, &dev_attr_icrmask);
if (ret)
printk(KERN_ERR "device_create_file failed: %d\n", ret);
if (unlikely(ret))
return ret;
ret = device_create_file(omap_dsp->dev, &dev_attr_cpustat);
if (unlikely(ret))
goto fail_create_cpustat;
ret = device_create_file(omap_dsp->dev, &dev_attr_icrmask);
if (unlikely(ret))
goto fail_create_icrmask;
return 0;
fail_create_icrmask:
device_remove_file(omap_dsp->dev, &dev_attr_cpustat);
fail_create_cpustat:
device_remove_file(omap_dsp->dev, &dev_attr_ifver);
return ret;
}
void dsp_ctl_exit(void)
......
......@@ -21,6 +21,8 @@
*
*/
#ifndef __PLAT_OMAP_DSP_MBCMD_H
#define __PLAT_OMAP_DSP_MBCMD_H
/*
* mailbox command: 0x00 - 0x7f
* when a driver wants to use mailbox, it must reserve mailbox commands here.
......@@ -141,3 +143,5 @@
#define BID_NULL 0xffff
#define BID_PVT 0xfffe
#endif /* __PLAT_OMAP_DSP_MBCMD_H */
......@@ -352,6 +352,7 @@ static int dsp_mem_ioctl(struct inode *inode, struct file *file,
case MEM_IOCTL_MMUINIT:
if (dsp_mmu.exmap_tbl)
omap_mmu_unregister(&dsp_mmu);
dsp_mem_ipi_init();
return omap_mmu_register(&dsp_mmu);
case MEM_IOCTL_EXMAP:
......@@ -432,17 +433,9 @@ void dsp_mem_stop(void)
void dsp_mem_late_init(void)
{
int ret = 0;
#ifdef CONFIG_ARCH_OMAP2
int i, dspmem_pg_count;
dspmem_pg_count = dspmem_size >> 12;
for (i = 0; i < dspmem_pg_count; i++) {
writel(i, DSP_IPI_INDEX);
writel(DSP_IPI_ENTRY_ELMSIZEVALUE_16, DSP_IPI_ENTRY);
}
writel(1, DSP_IPI_ENABLE);
writel(IOMAP_VAL, DSP_IPI_IOMAP);
dsp_mem_ipi_init();
#ifdef CONFIG_ARCH_OMAP2
dsp_mmu.clk = dsp_fck_handle;
dsp_mmu.memclk = dsp_ick_handle;
#elif defined(CONFIG_ARCH_OMAP1)
......
......@@ -26,6 +26,7 @@
#include <linux/poll.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <asm/arch/mailbox.h>
#include <asm/uaccess.h>
#include "dsp_mbcmd.h"
#include "dsp.h"
......@@ -50,24 +51,17 @@ static ssize_t dsp_err_read(struct file *file, char __user *buf, size_t count,
{
unsigned long flags;
int status;
DEFINE_WAIT(wait);
if (count < 4)
return 0;
if (errcnt == 0) {
long current_state;
DECLARE_WAITQUEUE(wait, current);
add_wait_queue(&err_wait_q, &wait);
current_state = current->state;
set_current_state(TASK_INTERRUPTIBLE);
if (errcnt == 0) /* last check */
schedule();
set_current_state(current_state);
remove_wait_queue(&err_wait_q, &wait);
if (signal_pending(current))
return -EINTR;
}
prepare_to_wait(&err_wait_q, &wait, TASK_INTERRUPTIBLE);
if (errcnt == 0)
schedule();
finish_wait(&err_wait_q, &wait);
if (signal_pending(current))
return -EINTR;
local_irq_save(flags);
status = copy_to_user(buf, &errval, 4);
......@@ -155,6 +149,12 @@ int dsp_err_isset(enum errcode_e code)
return (errval & dsp_err_desc[code].val) ? 1 : 0;
}
void dsp_err_notify(void)
{
/* new error code should be assigned */
dsp_err_set(DSP_ERR_WDT, 0);
}
/*
* functions called from mailbox interrupt routine
*/
......@@ -216,11 +216,12 @@ void dsp_err_start(void)
if (dsp_err_isset(i))
dsp_err_clear(i);
}
omap_dsp->mbox->err_notify = dsp_err_notify;
errcnt = 0;
}
void dsp_err_stop(void)
{
wake_up_interruptible(&err_wait_q);
omap_dsp->mbox->err_notify = NULL;
}
......@@ -21,6 +21,9 @@
*
*/
#ifndef __PLAT_OMAP_DSP_FIFO_H
#define __PLAT_OMAP_DSP_FIFO_H
struct fifo_struct {
spinlock_t lock;
char *buf;
......@@ -168,3 +171,5 @@ out:
spin_unlock(&fifo->lock);
return ret;
}
#endif /* __PLAT_OMAP_DSP_FIFO_H */
......@@ -112,10 +112,9 @@ int ipbuf_config(u16 ln, u16 lsz, void *base)
ipbcfg.bsycnt = ln; /* DSP holds all ipbufs initially. */
ipbcfg.cnt_full = 0;
printk(KERN_INFO
"omapdsp: IPBUF configuration\n"
" %d words * %d lines at 0x%p.\n",
ipbcfg.lsz, ipbcfg.ln, ipbcfg.base);
pr_info("omapdsp: IPBUF configuration\n"
" %d words * %d lines at 0x%p.\n",
ipbcfg.lsz, ipbcfg.ln, ipbcfg.base);
ret = device_create_file(omap_dsp->dev, &dev_attr_ipbuf);
if (ret)
......@@ -123,7 +122,7 @@ int ipbuf_config(u16 ln, u16 lsz, void *base)
return ret;
free_out:
free_out:
kfree(g_ipbuf);
g_ipbuf = NULL;
return ret;
......
......@@ -21,6 +21,9 @@
*
*/
#ifndef __PLAT_OMAP_DSP_IPBUF_H
#define __PLAT_OMAP_DSP_IPBUF_H
struct ipbuf {
u16 c; /* count */
u16 next; /* link */
......@@ -61,19 +64,8 @@ struct ipbuf_head {
extern struct ipbcfg ipbcfg;
extern struct ipbuf_sys *ipbuf_sys_da, *ipbuf_sys_ad;
#define ipb_bsycnt_inc(ipbcfg) \
do { \
disable_irq(omap_dsp->mbox->irq); \
(ipbcfg)->bsycnt++; \
enable_irq(omap_dsp->mbox->irq); \
} while(0)
#define ipb_bsycnt_dec(ipbcfg) \
do { \
disable_irq(omap_dsp->mbox->irq); \
(ipbcfg)->bsycnt--; \
enable_irq(omap_dsp->mbox->irq); \
} while(0)
#define ipb_bsycnt_inc(ipbcfg) atomic_inc((atomic_t *)&((ipbcfg)->bsycnt))
#define ipb_bsycnt_dec(ipbcfg) atomic_dec((atomic_t *)&((ipbcfg)->bsycnt))
#define dsp_mem_enable_ipbuf() dsp_mem_enable(ipbcfg.base)
#define dsp_mem_disable_ipbuf() dsp_mem_disable(ipbcfg.base)
......@@ -105,7 +97,7 @@ struct ipblink {
#define ipblink_empty(link) ((link)->top == BID_NULL)
static __inline__ void __ipblink_del_top(struct ipblink *link)
static inline void __ipblink_del_top(struct ipblink *link)
{
struct ipbuf_head *ipb_h = bid_to_ipbuf(link->top);
......@@ -115,14 +107,14 @@ static __inline__ void __ipblink_del_top(struct ipblink *link)
ipb_h->p->next = BID_NULL;
}
static __inline__ void ipblink_del_top(struct ipblink *link)
static inline void ipblink_del_top(struct ipblink *link)
{
spin_lock(&link->lock);
__ipblink_del_top(link);
spin_unlock(&link->lock);
}
static __inline__ void __ipblink_add_tail(struct ipblink *link, u16 bid)
static inline void __ipblink_add_tail(struct ipblink *link, u16 bid)
{
if (ipblink_empty(link))
link->top = bid;
......@@ -131,14 +123,14 @@ static __inline__ void __ipblink_add_tail(struct ipblink *link, u16 bid)
link->tail = bid;
}
static __inline__ void ipblink_add_tail(struct ipblink *link, u16 bid)
static inline void ipblink_add_tail(struct ipblink *link, u16 bid)
{
spin_lock(&link->lock);
__ipblink_add_tail(link, bid);
spin_unlock(&link->lock);
}
static __inline__ void __ipblink_flush(struct ipblink *link)
static inline void __ipblink_flush(struct ipblink *link)
{
u16 bid;
......@@ -149,46 +141,46 @@ static __inline__ void __ipblink_flush(struct ipblink *link)
}
}
static __inline__ void ipblink_flush(struct ipblink *link)
static inline void ipblink_flush(struct ipblink *link)
{
spin_lock(&link->lock);
__ipblink_flush(link);
spin_unlock(&link->lock);
}
static __inline__ void __ipblink_add_pvt(struct ipblink *link)
static inline void __ipblink_add_pvt(struct ipblink *link)
{
link->top = BID_PVT;
link->tail = BID_PVT;
}
static __inline__ void ipblink_add_pvt(struct ipblink *link)
static inline void ipblink_add_pvt(struct ipblink *link)
{
spin_lock(&link->lock);
__ipblink_add_pvt(link);
spin_unlock(&link->lock);
}
static __inline__ void __ipblink_del_pvt(struct ipblink *link)
static inline void __ipblink_del_pvt(struct ipblink *link)
{
link->top = BID_NULL;
link->tail = BID_NULL;
}
static __inline__ void ipblink_del_pvt(struct ipblink *link)
static inline void ipblink_del_pvt(struct ipblink *link)
{
spin_lock(&link->lock);
__ipblink_del_pvt(link);
spin_unlock(&link->lock);
}
static __inline__ void __ipblink_flush_pvt(struct ipblink *link)
static inline void __ipblink_flush_pvt(struct ipblink *link)
{
if (!ipblink_empty(link))
ipblink_del_pvt(link);
}
static __inline__ void ipblink_flush_pvt(struct ipblink *link)
static inline void ipblink_flush_pvt(struct ipblink *link)
{
spin_lock(&link->lock);
__ipblink_flush_pvt(link);
......@@ -197,3 +189,5 @@ static __inline__ void ipblink_flush_pvt(struct ipblink *link)
#define ipblink_for_each(bid, link) \
for (bid = (link)->top; bid != BID_NULL; bid = bid_to_ipbuf(bid)->p->next)
#endif /* __PLAT_OMAP_DSP_IPBUF_H */
......@@ -48,7 +48,16 @@ char *subcmd_name(struct mbcmd *mb)
break;
case MBOX_CMD_DSP_KFUNC:
s = (cmd_l == KFUNC_FBCTL) ? "FBCTL":
(cmd_l == KFUNC_POWER) ? "POWER":
(cmd_l == KFUNC_POWER) ?
((mb->data == AUDIO_PWR_UP) ? "PWR AUD /UP":
(mb->data == AUDIO_PWR_DOWN) ? "PWR AUD /DOWN":
(mb->data == AUDIO_PWR_DOWN2) ? "PWR AUD /DOWN(2)":
(mb->data == DSP_PWR_UP) ? "PWR DSP /UP":
(mb->data == DSP_PWR_DOWN) ? "PWR DSP /DOWN":
(mb->data == DVFS_START) ? "PWR DVFS/START":
(mb->data == DVFS_STOP) ? "PWR DVFS/STOP":
NULL):
NULL;
break;
case MBOX_CMD_DSP_DSPCFG:
......@@ -138,22 +147,19 @@ static inline void mblog_print_cmd(struct mbcmd *mb, arm_dsp_dir_t dir)
subname = subcmd_name(mb);
if (unlikely(!subname))
subname = "Unknown";
printk(KERN_DEBUG
"mbox: %s seq=%d, cmd=%02x:%02x(%s:%s), data=%04x\n",
dir_str, mb->seq, mb->cmd_h, mb->cmd_l,
ci->name, subname, mb->data);
pr_debug("mbox: %s seq=%d, cmd=%02x:%02x(%s:%s), data=%04x\n",
dir_str, mb->seq, mb->cmd_h, mb->cmd_l,
ci->name, subname, mb->data);
break;
case CMD_L_TYPE_TID:
printk(KERN_DEBUG
"mbox: %s seq=%d, cmd=%02x:%02x(%s:task %d), data=%04x\n",
dir_str, mb->seq, mb->cmd_h, mb->cmd_l,
ci->name, mb->cmd_l, mb->data);
pr_debug("mbox: %s seq=%d, cmd=%02x:%02x(%s:task %d), data=%04x\n",
dir_str, mb->seq, mb->cmd_h, mb->cmd_l,
ci->name, mb->cmd_l, mb->data);
break;
case CMD_L_TYPE_NULL:
printk(KERN_DEBUG
"mbox: %s seq=%d, cmd=%02x:%02x(%s), data=%04x\n",
dir_str, mb->seq, mb->cmd_h, mb->cmd_l,
ci->name, mb->data);
pr_debug("mbox: %s seq=%d, cmd=%02x:%02x(%s), data=%04x\n",
dir_str, mb->seq, mb->cmd_h, mb->cmd_l,
ci->name, mb->data);
break;
}
}
......
......@@ -274,4 +274,20 @@ static void intmem_disable(void) { }
static int dsp_mmu_itack(void) { return 0; }
#endif
#ifdef CONFIG_ARCH_OMAP2
static inline void dsp_mem_ipi_init(void)
{
int i, dspmem_pg_count;
dspmem_pg_count = dspmem_size >> 12;
for (i = 0; i < dspmem_pg_count; i++) {
writel(i, DSP_IPI_INDEX);
writel(DSP_IPI_ENTRY_ELMSIZEVALUE_16, DSP_IPI_ENTRY);
}
writel(1, DSP_IPI_ENABLE);
writel(IOMAP_VAL, DSP_IPI_IOMAP);
}
#else
static inline void dsp_mem_ipi_init(void) { }
#endif
#endif /* __PLAT_OMAP_DSP_MMU_H */
......@@ -21,26 +21,33 @@
*
*/
#ifndef __PLAT_OMAP_DSP_PROCLIST_H
#define __PLAT_OMAP_DSP_PROCLIST_H
struct proc_list {
struct list_head list_head;
pid_t pid;
struct file *file;
};
static __inline__ void proc_list_add(spinlock_t *lock, struct list_head *list,
static inline int proc_list_add(spinlock_t *lock, struct list_head *list,
struct task_struct *tsk, struct file *file)
{
struct proc_list *new;
new = kmalloc(sizeof(struct proc_list), GFP_KERNEL);
if (new == NULL)
return -ENOMEM;
new->pid = tsk->pid;
new->file = file;
spin_lock(lock);
list_add_tail(&new->list_head, list);
spin_unlock(lock);
return 0;
}
static __inline__ void proc_list_del(spinlock_t *lock, struct list_head *list,
static inline void proc_list_del(spinlock_t *lock, struct list_head *list,
struct task_struct *tsk, struct file *file)
{
struct proc_list *pl;
......@@ -64,7 +71,7 @@ static __inline__ void proc_list_del(spinlock_t *lock, struct list_head *list,
spin_unlock(lock);
}
static __inline__ void proc_list_flush(spinlock_t *lock, struct list_head *list)
static inline void proc_list_flush(spinlock_t *lock, struct list_head *list)
{
struct proc_list *pl;
......@@ -76,3 +83,5 @@ static __inline__ void proc_list_flush(spinlock_t *lock, struct list_head *list)
}
spin_unlock(lock);
}
#endif /* __PLAT_OMAP_DSP_PROCLIST_H */
This diff is collapsed.
......@@ -48,28 +48,21 @@ static ssize_t dsp_twch_read(struct file *file, char __user *buf, size_t count,
long taskstat[TASKDEV_MAX];
int devcount = count / sizeof(long);
int i;
DEFINE_WAIT(wait);
if (dsp_cfgstat_get_stat() != CFGSTAT_READY) {
printk(KERN_ERR "omapdsp: dsp has not been configured.\n");
return -EINVAL;
}
if (change_cnt == 0) {
long current_state;
DECLARE_WAITQUEUE(wait, current);
add_wait_queue(&read_wait_q, &wait);
current_state = current->state;
set_current_state(TASK_INTERRUPTIBLE);
if (change_cnt == 0) /* last check */
schedule();
set_current_state(current_state);
remove_wait_queue(&read_wait_q, &wait);
/* unconfigured while waiting ;-( */
if (dsp_cfgstat_get_stat() != CFGSTAT_READY)
return -EINVAL;
}
prepare_to_wait(&read_wait_q, &wait, TASK_INTERRUPTIBLE);
if (change_cnt == 0) /* last check */
schedule();
finish_wait(&read_wait_q, &wait);
/* unconfigured while waiting ;-( */
if ((change_cnt == 0) && (dsp_cfgstat_get_stat() != CFGSTAT_READY))
return -EINVAL;
if (devcount > TASKDEV_MAX)
devcount = TASKDEV_MAX;
......
......@@ -37,7 +37,7 @@ extern unsigned long __copy_to_user_dsp_2b(void __user *to,
#endif
#ifndef HAVE_ASM_COPY_FROM_USER_DSP_2B
static __inline__ unsigned long copy_from_user_dsp_2b(void *to,
static inline unsigned long copy_from_user_dsp_2b(void *to,
const void *from)
{
unsigned short tmp;
......@@ -53,7 +53,7 @@ static __inline__ unsigned long copy_from_user_dsp_2b(void *to,
/*
* @n must be multiple of 2
*/
static __inline__ unsigned long copy_from_user_dsp(void *to, const void *from,
static inline unsigned long copy_from_user_dsp(void *to, const void *from,
unsigned long n)
{
if (access_ok(VERIFY_READ, from, n)) {
......@@ -108,7 +108,7 @@ static __inline__ unsigned long copy_from_user_dsp(void *to, const void *from,
}
#ifndef HAVE_ASM_COPY_FROM_USER_DSP_2B
static __inline__ unsigned long copy_to_user_dsp_2b(void *to, const void *from)
static inline unsigned long copy_to_user_dsp_2b(void *to, const void *from)
{
/* expecting compiler to generate "strh" instruction */
unsigned short tmp = *(unsigned short *)from;
......@@ -120,7 +120,7 @@ static __inline__ unsigned long copy_to_user_dsp_2b(void *to, const void *from)
/*
* @n must be multiple of 2
*/
static __inline__ unsigned long copy_to_user_dsp(void *to, const void *from,
static inline unsigned long copy_to_user_dsp(void *to, const void *from,
unsigned long n)
{
if (access_ok(VERIFY_WRITE, to, n)) {
......
......@@ -1239,13 +1239,13 @@ static ssize_t mempool_show(struct class *class, char *buf)
static CLASS_ATTR(mempool, S_IRUGO, mempool_show, NULL);
static void omap_mmu_class_dev_release(struct class_device *cd)
static void omap_mmu_class_dev_release(struct device *dev)
{
}
static struct class omap_mmu_class = {
.name = "mmu",
.release = omap_mmu_class_dev_release,
.dev_release = omap_mmu_class_dev_release,
};
int omap_mmu_register(struct omap_mmu *mmu)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment