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