Commit 205e5d8f authored by Hiroshi DOYU's avatar Hiroshi DOYU Committed by Juha Yrjola

ARM: OMAP: DSPGW: rename mbx -> mbox

Signed-off-by: default avatarHiroshi DOYU <Hiroshi.DOYU@nokia.com>
Signed-off-by: default avatarJuha Yrjola <juha.yrjola@solidboot.com>
parent a44ca244
......@@ -116,10 +116,10 @@ struct mb_exarg {
u16 *argv;
};
extern struct mbx *mbx_dsp;
extern void dsp_mbx_start(void);
extern void dsp_mbx_stop(void);
extern int dsp_mbx_config(void *p);
extern struct mbox *mbox_dsp;
extern void dsp_mbox_start(void);
extern void dsp_mbox_stop(void);
extern int dsp_mbox_config(void *p);
extern int sync_with_dsp(u16 *syncwd, u16 tid, int try_cnt);
extern int __dsp_mbcmd_send_exarg(struct mbcmd *mb, struct mb_exarg *arg,
int recovery_flag);
......@@ -138,11 +138,11 @@ static __inline__ int __mbcompose_send_exarg(u8 cmd_h, u8 cmd_l, u16 data,
return __dsp_mbcmd_send_exarg(&mb, arg, recovery_flag);
}
#define mbcompose_send(cmd_h, cmd_l, data) \
__mbcompose_send_exarg(MBX_CMD_DSP_##cmd_h, (cmd_l), (data), NULL, 0)
__mbcompose_send_exarg(MBOX_CMD_DSP_##cmd_h, (cmd_l), (data), NULL, 0)
#define mbcompose_send_exarg(cmd_h, cmd_l, data, arg) \
__mbcompose_send_exarg(MBX_CMD_DSP_##cmd_h, (cmd_l), (data), arg, 0)
__mbcompose_send_exarg(MBOX_CMD_DSP_##cmd_h, (cmd_l), (data), arg, 0)
#define mbcompose_send_recovery(cmd_h, cmd_l, data) \
__mbcompose_send_exarg(MBX_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,
u16 data,
......@@ -153,10 +153,10 @@ static __inline__ int __mbcompose_send_and_wait_exarg(u8 cmd_h, u8 cmd_l,
return dsp_mbcmd_send_and_wait_exarg(&mb, arg, q);
}
#define mbcompose_send_and_wait(cmd_h, cmd_l, data, q) \
__mbcompose_send_and_wait_exarg(MBX_CMD_DSP_##cmd_h, (cmd_l), (data), \
__mbcompose_send_and_wait_exarg(MBOX_CMD_DSP_##cmd_h, (cmd_l), (data), \
NULL, (q))
#define mbcompose_send_and_wait_exarg(cmd_h, cmd_l, data, arg, q) \
__mbcompose_send_and_wait_exarg(MBX_CMD_DSP_##cmd_h, (cmd_l), (data), \
__mbcompose_send_and_wait_exarg(MBOX_CMD_DSP_##cmd_h, (cmd_l), (data), \
(arg), (q))
extern struct ipbuf_head *bid_to_ipbuf(u16 bid);
......@@ -176,7 +176,7 @@ extern void unuse_ipbuf_nowait(struct ipbuf_head *ipb_h);
(ipbuf_pvt)->s = TID_FREE; \
} while(0)
extern int mbx_revision;
extern int mbox_revision;
extern int dsp_cfgstat_request(enum cfgstat_e st);
extern enum cfgstat_e dsp_cfgstat_get_stat(void);
......
......@@ -39,7 +39,7 @@ MODULE_AUTHOR("Toshihiro Kobayashi <toshihiro.kobayashi@nokia.com>");
MODULE_DESCRIPTION("OMAP DSP driver module");
MODULE_LICENSE("GPL");
struct mbx *mbx_dsp;
struct mbox *mbox_dsp;
static struct sync_seq *mbseq;
static u16 mbseq_expect_tmp;
static u16 *mbseq_expect = &mbseq_expect_tmp;
......@@ -47,87 +47,87 @@ static u16 *mbseq_expect = &mbseq_expect_tmp;
/*
* mailbox commands
*/
extern void mbx_wdsnd(struct mbcmd *mb);
extern void mbx_wdreq(struct mbcmd *mb);
extern void mbx_bksnd(struct mbcmd *mb);
extern void mbx_bkreq(struct mbcmd *mb);
extern void mbx_bkyld(struct mbcmd *mb);
extern void mbx_bksndp(struct mbcmd *mb);
extern void mbx_bkreqp(struct mbcmd *mb);
extern void mbx_tctl(struct mbcmd *mb);
extern void mbx_poll(struct mbcmd *mb);
extern void mbox_wdsnd(struct mbcmd *mb);
extern void mbox_wdreq(struct mbcmd *mb);
extern void mbox_bksnd(struct mbcmd *mb);
extern void mbox_bkreq(struct mbcmd *mb);
extern void mbox_bkyld(struct mbcmd *mb);
extern void mbox_bksndp(struct mbcmd *mb);
extern void mbox_bkreqp(struct mbcmd *mb);
extern void mbox_tctl(struct mbcmd *mb);
extern void mbox_poll(struct mbcmd *mb);
#ifdef OLD_BINARY_SUPPORT
/* v3.3 obsolete */
extern void mbx_wdt(struct mbcmd *mb);
extern void mbox_wdt(struct mbcmd *mb);
#endif
extern void mbx_suspend(struct mbcmd *mb);
static void mbx_kfunc(struct mbcmd *mb);
extern void mbx_tcfg(struct mbcmd *mb);
extern void mbx_tadd(struct mbcmd *mb);
extern void mbx_tdel(struct mbcmd *mb);
extern void mbx_dspcfg(struct mbcmd *mb);
extern void mbx_regrw(struct mbcmd *mb);
extern void mbx_getvar(struct mbcmd *mb);
extern void mbx_err(struct mbcmd *mb);
extern void mbx_dbg(struct mbcmd *mb);
extern void mbox_suspend(struct mbcmd *mb);
static void mbox_kfunc(struct mbcmd *mb);
extern void mbox_tcfg(struct mbcmd *mb);
extern void mbox_tadd(struct mbcmd *mb);
extern void mbox_tdel(struct mbcmd *mb);
extern void mbox_dspcfg(struct mbcmd *mb);
extern void mbox_regrw(struct mbcmd *mb);
extern void mbox_getvar(struct mbcmd *mb);
extern void mbox_err(struct mbcmd *mb);
extern void mbox_dbg(struct mbcmd *mb);
static const struct cmdinfo
cif_wdsnd = { "WDSND", CMD_L_TYPE_TID, mbx_wdsnd },
cif_wdreq = { "WDREQ", CMD_L_TYPE_TID, mbx_wdreq },
cif_bksnd = { "BKSND", CMD_L_TYPE_TID, mbx_bksnd },
cif_bkreq = { "BKREQ", CMD_L_TYPE_TID, mbx_bkreq },
cif_bkyld = { "BKYLD", CMD_L_TYPE_NULL, mbx_bkyld },
cif_bksndp = { "BKSNDP", CMD_L_TYPE_TID, mbx_bksndp },
cif_bkreqp = { "BKREQP", CMD_L_TYPE_TID, mbx_bkreqp },
cif_tctl = { "TCTL", CMD_L_TYPE_TID, mbx_tctl },
cif_poll = { "POLL", CMD_L_TYPE_NULL, mbx_poll },
cif_wdsnd = { "WDSND", CMD_L_TYPE_TID, mbox_wdsnd },
cif_wdreq = { "WDREQ", CMD_L_TYPE_TID, mbox_wdreq },
cif_bksnd = { "BKSND", CMD_L_TYPE_TID, mbox_bksnd },
cif_bkreq = { "BKREQ", CMD_L_TYPE_TID, mbox_bkreq },
cif_bkyld = { "BKYLD", CMD_L_TYPE_NULL, mbox_bkyld },
cif_bksndp = { "BKSNDP", CMD_L_TYPE_TID, mbox_bksndp },
cif_bkreqp = { "BKREQP", CMD_L_TYPE_TID, mbox_bkreqp },
cif_tctl = { "TCTL", CMD_L_TYPE_TID, mbox_tctl },
cif_poll = { "POLL", CMD_L_TYPE_NULL, mbox_poll },
#ifdef OLD_BINARY_SUPPORT
/* v3.3 obsolete */
cif_wdt = { "WDT", CMD_L_TYPE_NULL, mbx_wdt },
cif_wdt = { "WDT", CMD_L_TYPE_NULL, mbox_wdt },
#endif
cif_runlevel = { "RUNLEVEL", CMD_L_TYPE_SUBCMD, NULL },
cif_pm = { "PM", CMD_L_TYPE_SUBCMD, NULL },
cif_suspend = { "SUSPEND", CMD_L_TYPE_NULL, mbx_suspend },
cif_kfunc = { "KFUNC", CMD_L_TYPE_SUBCMD, mbx_kfunc },
cif_tcfg = { "TCFG", CMD_L_TYPE_TID, mbx_tcfg },
cif_tadd = { "TADD", CMD_L_TYPE_TID, mbx_tadd },
cif_tdel = { "TDEL", CMD_L_TYPE_TID, mbx_tdel },
cif_suspend = { "SUSPEND", CMD_L_TYPE_NULL, mbox_suspend },
cif_kfunc = { "KFUNC", CMD_L_TYPE_SUBCMD, mbox_kfunc },
cif_tcfg = { "TCFG", CMD_L_TYPE_TID, mbox_tcfg },
cif_tadd = { "TADD", CMD_L_TYPE_TID, mbox_tadd },
cif_tdel = { "TDEL", CMD_L_TYPE_TID, mbox_tdel },
cif_tstop = { "TSTOP", CMD_L_TYPE_TID, NULL },
cif_dspcfg = { "DSPCFG", CMD_L_TYPE_SUBCMD, mbx_dspcfg },
cif_regrw = { "REGRW", CMD_L_TYPE_SUBCMD, mbx_regrw },
cif_getvar = { "GETVAR", CMD_L_TYPE_SUBCMD, mbx_getvar },
cif_dspcfg = { "DSPCFG", CMD_L_TYPE_SUBCMD, mbox_dspcfg },
cif_regrw = { "REGRW", CMD_L_TYPE_SUBCMD, mbox_regrw },
cif_getvar = { "GETVAR", CMD_L_TYPE_SUBCMD, mbox_getvar },
cif_setvar = { "SETVAR", CMD_L_TYPE_SUBCMD, NULL },
cif_err = { "ERR", CMD_L_TYPE_SUBCMD, mbx_err },
cif_dbg = { "DBG", CMD_L_TYPE_NULL, mbx_dbg };
#define MBX_CMD_MAX 0x80
const struct cmdinfo *cmdinfo[MBX_CMD_MAX] = {
[MBX_CMD_DSP_WDSND] = &cif_wdsnd,
[MBX_CMD_DSP_WDREQ] = &cif_wdreq,
[MBX_CMD_DSP_BKSND] = &cif_bksnd,
[MBX_CMD_DSP_BKREQ] = &cif_bkreq,
[MBX_CMD_DSP_BKYLD] = &cif_bkyld,
[MBX_CMD_DSP_BKSNDP] = &cif_bksndp,
[MBX_CMD_DSP_BKREQP] = &cif_bkreqp,
[MBX_CMD_DSP_TCTL] = &cif_tctl,
[MBX_CMD_DSP_POLL] = &cif_poll,
cif_err = { "ERR", CMD_L_TYPE_SUBCMD, mbox_err },
cif_dbg = { "DBG", CMD_L_TYPE_NULL, mbox_dbg };
#define MBOX_CMD_MAX 0x80
const struct cmdinfo *cmdinfo[MBOX_CMD_MAX] = {
[MBOX_CMD_DSP_WDSND] = &cif_wdsnd,
[MBOX_CMD_DSP_WDREQ] = &cif_wdreq,
[MBOX_CMD_DSP_BKSND] = &cif_bksnd,
[MBOX_CMD_DSP_BKREQ] = &cif_bkreq,
[MBOX_CMD_DSP_BKYLD] = &cif_bkyld,
[MBOX_CMD_DSP_BKSNDP] = &cif_bksndp,
[MBOX_CMD_DSP_BKREQP] = &cif_bkreqp,
[MBOX_CMD_DSP_TCTL] = &cif_tctl,
[MBOX_CMD_DSP_POLL] = &cif_poll,
#ifdef OLD_BINARY_SUPPORT
[MBX_CMD_DSP_WDT] = &cif_wdt, /* v3.3 obsolete */
[MBOX_CMD_DSP_WDT] = &cif_wdt, /* v3.3 obsolete */
#endif
[MBX_CMD_DSP_RUNLEVEL] = &cif_runlevel,
[MBX_CMD_DSP_PM] = &cif_pm,
[MBX_CMD_DSP_SUSPEND] = &cif_suspend,
[MBX_CMD_DSP_KFUNC] = &cif_kfunc,
[MBX_CMD_DSP_TCFG] = &cif_tcfg,
[MBX_CMD_DSP_TADD] = &cif_tadd,
[MBX_CMD_DSP_TDEL] = &cif_tdel,
[MBX_CMD_DSP_TSTOP] = &cif_tstop,
[MBX_CMD_DSP_DSPCFG] = &cif_dspcfg,
[MBX_CMD_DSP_REGRW] = &cif_regrw,
[MBX_CMD_DSP_GETVAR] = &cif_getvar,
[MBX_CMD_DSP_SETVAR] = &cif_setvar,
[MBX_CMD_DSP_ERR] = &cif_err,
[MBX_CMD_DSP_DBG] = &cif_dbg,
[MBOX_CMD_DSP_RUNLEVEL] = &cif_runlevel,
[MBOX_CMD_DSP_PM] = &cif_pm,
[MBOX_CMD_DSP_SUSPEND] = &cif_suspend,
[MBOX_CMD_DSP_KFUNC] = &cif_kfunc,
[MBOX_CMD_DSP_TCFG] = &cif_tcfg,
[MBOX_CMD_DSP_TADD] = &cif_tadd,
[MBOX_CMD_DSP_TDEL] = &cif_tdel,
[MBOX_CMD_DSP_TSTOP] = &cif_tstop,
[MBOX_CMD_DSP_DSPCFG] = &cif_dspcfg,
[MBOX_CMD_DSP_REGRW] = &cif_regrw,
[MBOX_CMD_DSP_GETVAR] = &cif_getvar,
[MBOX_CMD_DSP_SETVAR] = &cif_setvar,
[MBOX_CMD_DSP_ERR] = &cif_err,
[MBOX_CMD_DSP_DBG] = &cif_dbg,
};
int sync_with_dsp(u16 *adr, u16 val, int try_cnt)
......@@ -166,7 +166,7 @@ int __dsp_mbcmd_send_exarg(struct mbcmd *mb, struct mb_exarg *arg,
*/
if (dsp_err_isset(ERRCODE_MMU) && !recovery_flag) {
printk(KERN_ERR
"mbx: mmu interrupt is set. %s is aborting.\n",
"mbox: mmu interrupt is set. %s is aborting.\n",
cmd_name(*mb));
return -1;
}
......@@ -205,7 +205,7 @@ int __dsp_mbcmd_send_exarg(struct mbcmd *mb, struct mb_exarg *arg,
mblog_add(mb, DIR_A2D);
mblog_printcmd(mb, DIR_A2D);
ret = mbx_send(mbx_dsp, *(mbx_msg_t *)mb);
ret = mbox_send(mbox_dsp, *(mbox_msg_t *)mb);
out:
mutex_unlock(&mbsend_lock);
......@@ -236,7 +236,7 @@ int dsp_mbcmd_send_and_wait_exarg(struct mbcmd *mb, struct mb_exarg *arg,
/*
* mbcmd receiver
*/
static void mbcmd_receiver(mbx_msg_t msg)
static void mbcmd_receiver(mbox_msg_t msg)
{
struct mbcmd *mb = (struct mbcmd *)&msg;
......@@ -255,25 +255,25 @@ static void mbcmd_receiver(mbx_msg_t msg)
if (cmdinfo[mb->cmd_h]->handler)
cmdinfo[mb->cmd_h]->handler(mb);
else
printk(KERN_ERR "mbx: %s is not allowed from DSP.\n",
printk(KERN_ERR "mbox: %s is not allowed from DSP.\n",
cmd_name(*mb));
}
static int mbsync_hold_mem_active;
void dsp_mbx_start(void)
void dsp_mbox_start(void)
{
mbx_init_seq(mbx_dsp);
mbox_init_seq(mbox_dsp);
mbseq_expect_tmp = 0;
}
void dsp_mbx_stop(void)
void dsp_mbox_stop(void)
{
mbseq = NULL;
mbseq_expect = &mbseq_expect_tmp;
}
int dsp_mbx_config(void *p)
int dsp_mbox_config(void *p)
{
unsigned long flags;
......@@ -301,14 +301,14 @@ int dsp_mbx_config(void *p)
return 0;
}
static int __init dsp_mbx_init(void)
static int __init dsp_mbox_init(void)
{
int i;
int ret;
for (i = 0; i < MBX_CMD_MAX; i++) {
for (i = 0; i < MBOX_CMD_MAX; i++) {
if (cmdinfo[i] != NULL) {
ret = register_mbx_receiver(mbx_dsp, i, mbcmd_receiver);
ret = register_mbox_receiver(mbox_dsp, i, mbcmd_receiver);
if (ret)
goto fail;
}
......@@ -318,18 +318,18 @@ static int __init dsp_mbx_init(void)
fail:
for (i--; i; i--)
unregister_mbx_receiver(mbx_dsp, i, mbcmd_receiver);
unregister_mbox_receiver(mbox_dsp, i, mbcmd_receiver);
return ret;
}
static void dsp_mbx_exit(void)
static void dsp_mbox_exit(void)
{
int i;
for (i = 0; i < MBX_CMD_MAX; i++) {
for (i = 0; i < MBOX_CMD_MAX; i++) {
if (cmdinfo[i] != NULL)
unregister_mbx_receiver(mbx_dsp, i, mbcmd_receiver);
unregister_mbox_receiver(mbox_dsp, i, mbcmd_receiver);
}
if (mbsync_hold_mem_active) {
......@@ -341,25 +341,25 @@ static void dsp_mbx_exit(void)
/*
* kernel function dispatcher
*/
extern void mbx_fbctl_upd(void);
extern void mbx_fbctl_disable(struct mbcmd *mb);
extern void mbox_fbctl_upd(void);
extern void mbox_fbctl_disable(struct mbcmd *mb);
static void mbx_kfunc_fbctl(struct mbcmd *mb)
static void mbox_kfunc_fbctl(struct mbcmd *mb)
{
switch (mb->data) {
case FBCTL_UPD:
mbx_fbctl_upd();
mbox_fbctl_upd();
break;
case FBCTL_DISABLE:
mbx_fbctl_disable(mb);
mbox_fbctl_disable(mb);
break;
default:
printk(KERN_ERR
"mbx: Unknown FBCTL from DSP: 0x%04x\n", mb->data);
"mbox: Unknown FBCTL from DSP: 0x%04x\n", mb->data);
}
}
static void mbx_kfunc_audio_pwr(unsigned short data)
static void mbox_kfunc_audio_pwr(unsigned short data)
{
switch (data) {
case AUDIO_PWR_UP:
......@@ -379,18 +379,18 @@ static void mbx_kfunc_audio_pwr(unsigned short data)
}
}
static void mbx_kfunc(struct mbcmd *mb)
static void mbox_kfunc(struct mbcmd *mb)
{
switch (mb->cmd_l) {
case KFUNC_FBCTL:
mbx_kfunc_fbctl(mb);
mbox_kfunc_fbctl(mb);
break;
case KFUNC_AUDIO_PWR:
mbx_kfunc_audio_pwr(mb->data);
mbox_kfunc_audio_pwr(mb->data);
break;
default:
printk(KERN_ERR
"mbx: Unknown KFUNC from DSP: 0x%02x\n", mb->cmd_l);
"mbox: Unknown KFUNC from DSP: 0x%02x\n", mb->cmd_l);
}
}
......@@ -434,7 +434,7 @@ static int __init dsp_drv_probe(struct platform_device *pdev)
mblog_init();
if ((ret = dsp_taskmod_init()) < 0)
goto fail3;
if ((ret = dsp_mbx_init()) < 0)
if ((ret = dsp_mbox_init()) < 0)
goto fail4;
return 0;
......@@ -461,7 +461,7 @@ static int dsp_drv_remove(struct platform_device *pdev)
dsp_cpustat_request(CPUSTAT_RESET);
dsp_cfgstat_request(CFGSTAT_CLEAN);
dsp_mbx_exit();
dsp_mbox_exit();
dsp_taskmod_exit();
mblog_exit();
dsp_ctl_exit();
......@@ -527,8 +527,8 @@ static int __init omap_dsp_mod_init(void)
{
int ret;
mbx_dsp = mbx_get("DSP");
if (IS_ERR(mbx_dsp)) {
mbox_dsp = mbox_get("DSP");
if (IS_ERR(mbox_dsp)) {
printk(KERN_ERR "failed to get mailbox handler for DSP.\n");
goto fail1;
}
......
......@@ -54,7 +54,7 @@ static enum fbstat_e {
#endif
static enum cfgstat_e cfgstat;
int mbx_revision;
int mbox_revision;
static u8 n_stask;
static ssize_t ifver_show(struct device *dev, struct device_attribute *attr,
......@@ -115,7 +115,7 @@ static int __misc_mbcompose_send_and_wait(u8 cmd_h, u8 cmd_l, u16 data,
}
#define misc_mbcompose_send_and_wait(cmd_h, cmd_l, data, retvp) \
__misc_mbcompose_send_and_wait(MBX_CMD_DSP_##cmd_h, (cmd_l), \
__misc_mbcompose_send_and_wait(MBOX_CMD_DSP_##cmd_h, (cmd_l), \
(data), (retvp));
static int misc_mbcmd_response(struct mbcmd *mb, int argc, int match_cmd_l_flag)
......@@ -135,24 +135,24 @@ static int misc_mbcmd_response(struct mbcmd *mb, int argc, int match_cmd_l_flag)
else
strcpy(cmdstr, ci->name);
printk(KERN_WARNING
"mbx: unexpected command %s received!\n", cmdstr);
"mbox: unexpected command %s received!\n", cmdstr);
return -1;
}
/*
* if argc == 1, receive data through mbx:data register.
* if argc == 1, receive data through mbox:data register.
* if argc > 1, receive through ipbuf_sys.
*/
if (argc == 1)
misc_mb_wait.retvp[0] = mb->data;
else if (argc > 1) {
if (dsp_mem_enable(ipbuf_sys_da) < 0) {
printk(KERN_ERR "mbx: %s - ipbuf_sys_da read failed!\n",
printk(KERN_ERR "mbox: %s - ipbuf_sys_da read failed!\n",
cmdinfo[mb->cmd_h]->name);
return -1;
}
if (sync_with_dsp(&ipbuf_sys_da->s, TID_ANON, 10) < 0) {
printk(KERN_ERR "mbx: %s - IPBUF sync failed!\n",
printk(KERN_ERR "mbox: %s - IPBUF sync failed!\n",
cmdinfo[mb->cmd_h]->name);
dsp_mem_disable(ipbuf_sys_da);
return -1;
......@@ -233,12 +233,12 @@ static int dsp_cfg(void)
*/
dsp_mem_enable((void *)dspmem_base);
dsp_mbx_start();
dsp_mbox_start();
dsp_twch_start();
dsp_mem_start();
dsp_err_start();
mbx_revision = -1;
mbox_revision = -1;
ret = misc_mbcompose_send_and_wait(DSPCFG, DSPCFG_REQ, 0, NULL);
if (ret < 0) {
......@@ -253,8 +253,8 @@ static int dsp_cfg(void)
* MBREV 3.2 or earlier doesn't assume DMA domain is on
* when DSPCFG command is sent
*/
if ((mbx_revision == MBREV_3_0) ||
(mbx_revision == MBREV_3_2)) {
if ((mbox_revision == MBREV_3_0) ||
(mbox_revision == MBREV_3_2)) {
if ((ret = mbcompose_send(PM, PM_ENABLE, DSPREG_ICR_DMA)) < 0)
goto out;
}
......@@ -292,7 +292,7 @@ static int dsp_uncfg(void)
/* remove runtime sysfs entries */
device_remove_file(&dsp_device.dev, &dev_attr_loadinfo);
dsp_mbx_stop();
dsp_mbox_stop();
dsp_twch_stop();
dsp_mem_stop();
dsp_err_stop();
......@@ -555,7 +555,7 @@ static int dsp_ctl_ioctl(struct inode *inode, struct file *file,
case DSPCTL_IOCTL_MBSEND:
{
struct omap_dsp_mailbox_cmd u_cmd;
mbx_msg_t msg;
mbox_msg_t msg;
if (copy_from_user(&u_cmd, (void *)arg, sizeof(u_cmd)))
return -EFAULT;
msg = (u_cmd.cmd << 16) | u_cmd.data;
......@@ -699,45 +699,45 @@ static int dsp_ctl_ioctl(struct inode *inode, struct file *file,
/*
* functions called from mailbox interrupt routine
*/
void mbx_suspend(struct mbcmd *mb)
void mbox_suspend(struct mbcmd *mb)
{
misc_mbcmd_response(mb, 0, 0);
}
void mbx_dspcfg(struct mbcmd *mb)
void mbox_dspcfg(struct mbcmd *mb)
{
u8 last = mb->cmd_l & 0x80;
u8 cfgcmd = mb->cmd_l & 0x7f;
static dsp_long_t tmp_ipb_adr;
if (!waitqueue_active(&misc_mb_wait.wait_q) ||
(misc_mb_wait.cmd_h != MBX_CMD_DSP_DSPCFG)) {
(misc_mb_wait.cmd_h != MBOX_CMD_DSP_DSPCFG)) {
printk(KERN_WARNING
"mbx: DSPCFG command received, "
"mbox: DSPCFG command received, "
"but nobody is waiting for it...\n");
return;
}
/* mailbox protocol check */
if (cfgcmd == DSPCFG_PROTREV) {
mbx_revision = mb->data;
if (mbx_revision == MBPROT_REVISION)
mbox_revision = mb->data;
if (mbox_revision == MBPROT_REVISION)
return;
#ifdef OLD_BINARY_SUPPORT
else if ((mbx_revision == MBREV_3_0) ||
(mbx_revision == MBREV_3_2)) {
else if ((mbox_revision == MBREV_3_0) ||
(mbox_revision == MBREV_3_2)) {
printk(KERN_WARNING
"mbx: ***** old DSP binary *****\n"
"mbox: ***** old DSP binary *****\n"
" Please update your DSP application.\n");
return;
}
#endif
else {
printk(KERN_ERR
"mbx: protocol revision check error!\n"
"mbox: protocol revision check error!\n"
" expected=0x%04x, received=0x%04x\n",
MBPROT_REVISION, mb->data);
mbx_revision = -1;
mbox_revision = -1;
goto abort1;
}
}
......@@ -746,9 +746,9 @@ void mbx_dspcfg(struct mbcmd *mb)
* following commands are accepted only after
* revision check has been passed.
*/
if (!mbx_revision < 0) {
if (!mbox_revision < 0) {
printk(KERN_INFO
"mbx: DSPCFG command received, "
"mbox: DSPCFG command received, "
"but revision check has not been passed.\n");
return;
}
......@@ -767,7 +767,7 @@ void mbx_dspcfg(struct mbcmd *mb)
default:
printk(KERN_ERR
"mbx: Unknown CFG command: cmd_l=0x%02x, data=0x%04x\n",
"mbox: Unknown CFG command: cmd_l=0x%02x, data=0x%04x\n",
mb->cmd_l, mb->data);
return;
}
......@@ -788,11 +788,11 @@ void mbx_dspcfg(struct mbcmd *mb)
goto abort1;
if (dsp_mem_enable(ipbuf_sys_da) < 0) {
printk(KERN_ERR "mbx: DSPCFG - ipbuf_sys_da read failed!\n");
printk(KERN_ERR "mbox: DSPCFG - ipbuf_sys_da read failed!\n");
goto abort1;
}
if (sync_with_dsp(&ipbuf_sys_da->s, TID_ANON, 10) < 0) {
printk(KERN_ERR "mbx: DSPCFG - IPBUF sync failed!\n");
printk(KERN_ERR "mbox: DSPCFG - IPBUF sync failed!\n");
dsp_mem_disable(ipbuf_sys_da);
goto abort1;
}
......@@ -801,7 +801,7 @@ void mbx_dspcfg(struct mbcmd *mb)
* we must read with 16bit-access
*/
#ifdef OLD_BINARY_SUPPORT
if (mbx_revision == MBPROT_REVISION) {
if (mbox_revision == MBPROT_REVISION) {
#endif
buf = ipbuf_sys_da->d;
n_stask = buf[0];
......@@ -819,7 +819,7 @@ void mbx_dspcfg(struct mbcmd *mb)
mem_sync.SDRAM = MKVIRT(buf[19], buf[20]);
mem_syncp = &mem_sync;
#ifdef OLD_BINARY_SUPPORT
} else if (mbx_revision == MBREV_3_2) {
} else if (mbox_revision == MBREV_3_2) {
buf = ipbuf_sys_da->d;
n_stask = buf[0];
bln = buf[1];
......@@ -832,7 +832,7 @@ void mbx_dspcfg(struct mbcmd *mb)
dbg_buf_sz = 0;
dbg_line_sz = 0;
mem_syncp = NULL;
} else if (mbx_revision == MBREV_3_0) {
} else if (mbox_revision == MBREV_3_0) {
buf = ipbuf_sys_da->d;
n_stask = buf[0];
bln = buf[1];
......@@ -863,7 +863,7 @@ void mbx_dspcfg(struct mbcmd *mb)
goto abort1;
if (ipbuf_config(bln, bsz, badr) < 0)
goto abort1;
if (dsp_mbx_config(mbseq) < 0)
if (dsp_mbox_config(mbseq) < 0)
goto abort2;
if (dsp_dbg_config(dbg_buf, dbg_buf_sz, dbg_line_sz) < 0)
goto abort2;
......@@ -882,12 +882,12 @@ abort1:
return;
}
void mbx_poll(struct mbcmd *mb)
void mbox_poll(struct mbcmd *mb)
{
misc_mbcmd_response(mb, 0, 0);
}
void mbx_regrw(struct mbcmd *mb)
void mbox_regrw(struct mbcmd *mb)
{
switch (mb->cmd_l) {
case REGRW_DATA:
......@@ -895,13 +895,13 @@ void mbx_regrw(struct mbcmd *mb)
break;
default:
printk(KERN_ERR
"mbx: Illegal REGRW command: "
"mbox: Illegal REGRW command: "
"cmd_l=0x%02x, data=0x%04x\n", mb->cmd_l, mb->data);
return;
}
}
void mbx_getvar(struct mbcmd *mb)
void mbox_getvar(struct mbcmd *mb)
{
switch (mb->cmd_l) {
case VARID_ICRMASK:
......@@ -912,13 +912,13 @@ void mbx_getvar(struct mbcmd *mb)
break;
default:
printk(KERN_ERR
"mbx: Illegal GETVAR command: "
"mbox: Illegal GETVAR command: "
"cmd_l=0x%02x, data=0x%04x\n", mb->cmd_l, mb->data);
return;
}
}
void mbx_fbctl_disable(struct mbcmd *mb)
void mbox_fbctl_disable(struct mbcmd *mb)
{
misc_mbcmd_response(mb, 0, 0);
}
......
......@@ -361,7 +361,7 @@ int dsp_mem_sync_inc(void)
}
/*
* dsp_mem_sync_config() is called from mbx1 workqueue
* dsp_mem_sync_config() is called from mbox1 workqueue
*/
int dsp_mem_sync_config(struct mem_sync_struct *sync)
{
......@@ -2002,7 +2002,7 @@ static int dsp_mem_open(struct inode *inode, struct file *file)
* fb update functions:
* fbupd_response() is executed by the workqueue.
* fbupd_cb() is called when fb update is done, in interrupt context.
* mbx_fbupd() is called when KFUNC:FBCTL:UPD is received from DSP.
* mbox_fbupd() is called when KFUNC:FBCTL:UPD is received from DSP.
*/
static void fbupd_response(void *arg)
{
......@@ -2025,7 +2025,7 @@ static void fbupd_cb(void *arg)
schedule_work(&fbupd_response_work);
}
void mbx_fbctl_upd(void)
void mbox_fbctl_upd(void)
{
struct omapfb_update_window win;
volatile unsigned short *buf = ipbuf_sys_da->d;
......@@ -2053,7 +2053,7 @@ void mbx_fbctl_upd(void)
#else /* CONFIG_FB_OMAP_LCDC_EXTERNAL */
void mbx_fbctl_upd(void)
void mbox_fbctl_upd(void)
{
}
#endif /* CONFIG_FB_OMAP_LCDC_EXTERNAL */
......
......@@ -158,23 +158,23 @@ int dsp_err_isset(enum errcode_e code)
/*
* functions called from mailbox interrupt routine
*/
static void mbx_err_wdt(u16 data)
static void mbox_err_wdt(u16 data)
{
dsp_err_set(DSP_ERR_WDT, (unsigned long)data);
}
#ifdef OLD_BINARY_SUPPORT
/* v3.3 obsolete */
void mbx_wdt(struct mbcmd *mb)
void mbox_wdt(struct mbcmd *mb)
{
mbx_err_wdt(mb->data);
mbox_err_wdt(mb->data);
}
#endif
extern void mbx_err_ipbfull(void);
extern void mbx_err_fatal(u8 tid);
extern void mbox_err_ipbfull(void);
extern void mbox_err_fatal(u8 tid);
void mbx_err(struct mbcmd *mb)
void mbox_err(struct mbcmd *mb)
{
u8 eid = mb->cmd_l;
char *eidnm = subcmd_name(mb);
......@@ -182,25 +182,25 @@ void mbx_err(struct mbcmd *mb)
if (eidnm) {
printk(KERN_WARNING
"mbx: ERR from DSP (%s): 0x%04x\n", eidnm, mb->data);
"mbox: ERR from DSP (%s): 0x%04x\n", eidnm, mb->data);
} else {
printk(KERN_WARNING
"mbx: ERR from DSP (unknown EID=%02x): %04x\n",
"mbox: ERR from DSP (unknown EID=%02x): %04x\n",
eid, mb->data);
}
switch (eid) {
case EID_IPBFULL:
mbx_err_ipbfull();
mbox_err_ipbfull();
break;
case EID_FATAL:
tid = mb->data & 0x00ff;
mbx_err_fatal(tid);
mbox_err_fatal(tid);
break;
case EID_WDT:
mbx_err_wdt(mb->data);
mbox_err_wdt(mb->data);
break;
}
}
......
......@@ -287,7 +287,7 @@ void unuse_ipbuf_nowait(struct ipbuf_head *ipb_h)
* functions called from mailbox interrupt routine
*/
void mbx_err_ipbfull(void)
void mbox_err_ipbfull(void)
{
ipbcfg.cnt_full++;
}
......
......@@ -63,16 +63,16 @@ extern struct ipbuf_sys *ipbuf_sys_da, *ipbuf_sys_ad;
#define ipb_bsycnt_inc(ipbcfg) \
do { \
disable_mbx_irq(mbx_dsp); \
disable_mbox_irq(mbox_dsp); \
(ipbcfg)->bsycnt++; \
enable_mbx_irq(mbx_dsp); \
enable_mbox_irq(mbox_dsp); \
} while(0)
#define ipb_bsycnt_dec(ipbcfg) \
do { \
disable_mbx_irq(mbx_dsp); \
disable_mbox_irq(mbox_dsp); \
(ipbcfg)->bsycnt--; \
enable_mbx_irq(mbx_dsp); \
enable_mbox_irq(mbox_dsp); \
} while(0)
#define dsp_mem_enable_ipbuf() dsp_mem_enable(ipbcfg.base)
......
......@@ -34,22 +34,22 @@ char *subcmd_name(struct mbcmd *mb)
char *s;
switch (cmd_h) {
case MBX_CMD_DSP_RUNLEVEL:
case MBOX_CMD_DSP_RUNLEVEL:
s = (cmd_l == RUNLEVEL_USER) ? "USER":
(cmd_l == RUNLEVEL_SUPER) ? "SUPER":
(cmd_l == RUNLEVEL_RECOVERY) ? "RECOVERY":
NULL;
break;
case MBX_CMD_DSP_PM:
case MBOX_CMD_DSP_PM:
s = (cmd_l == PM_DISABLE) ? "DISABLE":
(cmd_l == PM_ENABLE) ? "ENABLE":
NULL;
break;
case MBX_CMD_DSP_KFUNC:
case MBOX_CMD_DSP_KFUNC:
s = (cmd_l == KFUNC_FBCTL) ? "FBCTL":
NULL;
break;
case MBX_CMD_DSP_DSPCFG:
case MBOX_CMD_DSP_DSPCFG:
{
u8 cfgc = cmd_l & 0x7f;
s = (cfgc == DSPCFG_REQ) ? "REQ":
......@@ -60,7 +60,7 @@ char *subcmd_name(struct mbcmd *mb)
NULL;
break;
}
case MBX_CMD_DSP_REGRW:
case MBOX_CMD_DSP_REGRW:
s = (cmd_l == REGRW_MEMR) ? "MEMR":
(cmd_l == REGRW_MEMW) ? "MEMW":
(cmd_l == REGRW_IOR) ? "IOR":
......@@ -68,13 +68,13 @@ char *subcmd_name(struct mbcmd *mb)
(cmd_l == REGRW_DATA) ? "DATA":
NULL;
break;
case MBX_CMD_DSP_GETVAR:
case MBX_CMD_DSP_SETVAR:
case MBOX_CMD_DSP_GETVAR:
case MBOX_CMD_DSP_SETVAR:
s = (cmd_l == VARID_ICRMASK) ? "ICRMASK":
(cmd_l == VARID_LOADINFO) ? "LOADINFO":
NULL;
break;
case MBX_CMD_DSP_ERR:
case MBOX_CMD_DSP_ERR:
s = (cmd_l == EID_BADTID) ? "BADTID":
(cmd_l == EID_BADTCN) ? "BADTCN":
(cmd_l == EID_BADBID) ? "BADBID":
......@@ -110,7 +110,7 @@ char *subcmd_name(struct mbcmd *mb)
struct mblogent {
unsigned long jiffies;
mbx_msg_t msg;
mbox_msg_t msg;
enum arm_dsp_dir_e dir;
};
......@@ -130,7 +130,7 @@ void mblog_add(struct mbcmd *mb, enum arm_dsp_dir_e dir)
spin_lock(&mblog.lock);
ent = &mblog.ent[mblog.wp];
ent->jiffies = jiffies;
ent->msg = *(mbx_msg_t *)mb;
ent->msg = *(mbox_msg_t *)mb;
ent->dir = dir;
if (mblog.cnt < 0xffffffff)
mblog.cnt++;
......@@ -240,19 +240,19 @@ void mblog_printcmd(struct mbcmd *mb, enum arm_dsp_dir_e dir)
if ((subname = subcmd_name(mb)) == NULL)
subname = "Unknown";
printk(KERN_DEBUG
"mbx: %s cmd=%02x:%02x(%s:%s), data=%04x\n",
"mbox: %s cmd=%02x:%02x(%s:%s), data=%04x\n",
dir_str, mb->cmd_h, mb->cmd_l,
ci->name, subname, mb->data);
break;
case CMD_L_TYPE_TID:
printk(KERN_DEBUG
"mbx: %s cmd=%02x:%02x(%s:task %d), data=%04x\n",
"mbox: %s cmd=%02x:%02x(%s:task %d), data=%04x\n",
dir_str, mb->cmd_h, mb->cmd_l,
ci->name, mb->cmd_l, mb->data);
break;
case CMD_L_TYPE_NULL:
printk(KERN_DEBUG
"mbx: %s cmd=%02x:%02x(%s), data=%04x\n",
"mbox: %s cmd=%02x:%02x(%s), data=%04x\n",
dir_str, mb->cmd_h, mb->cmd_l, ci->name, mb->data);
break;
}
......
......@@ -489,7 +489,7 @@ static int dsp_task_config(struct dsptask *task, u8 tid)
ret = -EINTR;
goto fail_out;
}
cfg_cmd = MBX_CMD_DSP_TCFG;
cfg_cmd = MBOX_CMD_DSP_TCFG;
mbcompose_send_and_wait(TCFG, tid, 0, &cfg_wait_q);
cfg_cmd = 0;
mutex_unlock(&cfg_lock);
......@@ -1968,7 +1968,7 @@ static int dsp_tadd(struct taskdev *dev, dsp_long_t adr)
goto fail_out;
}
cfg_tid = TID_ANON;
cfg_cmd = MBX_CMD_DSP_TADD;
cfg_cmd = MBOX_CMD_DSP_TADD;
arg.tid = TID_ANON;
arg.argc = 2;
arg.argv = argv;
......@@ -2034,7 +2034,7 @@ del_out:
goto fail_out;
}
cfg_tid = TID_ANON;
cfg_cmd = MBX_CMD_DSP_TDEL;
cfg_cmd = MBOX_CMD_DSP_TDEL;
mbcompose_send_and_wait(TDEL, tid, TDEL_KILL, &cfg_wait_q);
tid_response = cfg_tid;
cfg_tid = TID_ANON;
......@@ -2197,7 +2197,7 @@ static int dsp_tdel_bh(struct taskdev *dev, u16 type)
}
}
cfg_tid = TID_ANON;
cfg_cmd = MBX_CMD_DSP_TDEL;
cfg_cmd = MBOX_CMD_DSP_TDEL;
mbcompose_send_and_wait(TDEL, tid, type, &cfg_wait_q);
tid_response = cfg_tid;
cfg_tid = TID_ANON;
......@@ -2239,24 +2239,24 @@ long taskdev_state_stale(unsigned char minor)
/*
* functions called from mailbox interrupt routine
*/
void mbx_wdsnd(struct mbcmd *mb)
void mbox_wdsnd(struct mbcmd *mb)
{
u8 tid = mb->cmd_l;
struct dsptask *task = dsptask[tid];
if ((tid >= TASKDEV_MAX) || (task == NULL)) {
printk(KERN_ERR "mbx: WDSND with illegal tid! %d\n", tid);
printk(KERN_ERR "mbox: WDSND with illegal tid! %d\n", tid);
return;
}
if (sndtyp_bk(task->ttyp)) {
printk(KERN_ERR
"mbx: WDSND from block sending task! (task%d)\n", tid);
"mbox: WDSND from block sending task! (task%d)\n", tid);
return;
}
if (sndtyp_psv(task->ttyp) &&
!waitqueue_active(&task->dev->read_wait_q)) {
printk(KERN_WARNING
"mbx: WDSND from passive sending task (task%d) "
"mbox: WDSND from passive sending task (task%d) "
"without request!\n", tid);
return;
}
......@@ -2265,19 +2265,19 @@ void mbx_wdsnd(struct mbcmd *mb)
wake_up_interruptible(&task->dev->read_wait_q);
}
void mbx_wdreq(struct mbcmd *mb)
void mbox_wdreq(struct mbcmd *mb)
{
u8 tid = mb->cmd_l;
struct dsptask *task = dsptask[tid];
struct taskdev *dev;
if ((tid >= TASKDEV_MAX) || (task == NULL)) {
printk(KERN_ERR "mbx: WDREQ with illegal tid! %d\n", tid);
printk(KERN_ERR "mbox: WDREQ with illegal tid! %d\n", tid);
return;
}
if (rcvtyp_psv(task->ttyp)) {
printk(KERN_ERR
"mbx: WDREQ from passive receiving task! (task%d)\n",
"mbox: WDREQ from passive receiving task! (task%d)\n",
tid);
return;
}
......@@ -2289,7 +2289,7 @@ void mbx_wdreq(struct mbcmd *mb)
wake_up_interruptible(&dev->write_wait_q);
}
void mbx_bksnd(struct mbcmd *mb)
void mbox_bksnd(struct mbcmd *mb)
{
u8 tid = mb->cmd_l;
u16 bid = mb->data;
......@@ -2298,27 +2298,27 @@ void mbx_bksnd(struct mbcmd *mb)
u16 cnt;
if (bid >= ipbcfg.ln) {
printk(KERN_ERR "mbx: BKSND with illegal bid! %d\n", bid);
printk(KERN_ERR "mbox: BKSND with illegal bid! %d\n", bid);
return;
}
ipb_h = bid_to_ipbuf(bid);
ipb_bsycnt_dec(&ipbcfg);
if ((tid >= TASKDEV_MAX) || (task == NULL)) {
printk(KERN_ERR "mbx: BKSND with illegal tid! %d\n", tid);
printk(KERN_ERR "mbox: BKSND with illegal tid! %d\n", tid);
goto unuse_ipbuf_out;
}
if (sndtyp_wd(task->ttyp)) {
printk(KERN_ERR
"mbx: BKSND from word sending task! (task%d)\n", tid);
"mbox: BKSND from word sending task! (task%d)\n", tid);
goto unuse_ipbuf_out;
}
if (sndtyp_pvt(task->ttyp)) {
printk(KERN_ERR
"mbx: BKSND from private sending task! (task%d)\n", tid);
"mbox: BKSND from private sending task! (task%d)\n", tid);
goto unuse_ipbuf_out;
}
if (sync_with_dsp(&ipb_h->p->sd, tid, 10) < 0) {
printk(KERN_ERR "mbx: BKSND - IPBUF sync failed!\n");
printk(KERN_ERR "mbox: BKSND - IPBUF sync failed!\n");
return;
}
......@@ -2327,7 +2327,7 @@ void mbx_bksnd(struct mbcmd *mb)
cnt = ipb_h->p->c;
if (cnt > ipbcfg.lsz) {
printk(KERN_ERR "mbx: BKSND cnt(%d) > ipbuf line size(%d)!\n",
printk(KERN_ERR "mbox: BKSND cnt(%d) > ipbuf line size(%d)!\n",
cnt, ipbcfg.lsz);
goto unuse_ipbuf_out;
}
......@@ -2350,7 +2350,7 @@ unuse_ipbuf_out:
return;
}
void mbx_bkreq(struct mbcmd *mb)
void mbox_bkreq(struct mbcmd *mb)
{
u8 tid = mb->cmd_l;
u16 cnt = mb->data;
......@@ -2358,23 +2358,23 @@ void mbx_bkreq(struct mbcmd *mb)
struct taskdev *dev;
if ((tid >= TASKDEV_MAX) || (task == NULL)) {
printk(KERN_ERR "mbx: BKREQ with illegal tid! %d\n", tid);
printk(KERN_ERR "mbox: BKREQ with illegal tid! %d\n", tid);
return;
}
if (rcvtyp_wd(task->ttyp)) {
printk(KERN_ERR
"mbx: BKREQ from word receiving task! (task%d)\n", tid);
"mbox: BKREQ from word receiving task! (task%d)\n", tid);
return;
}
if (rcvtyp_pvt(task->ttyp)) {
printk(KERN_ERR
"mbx: BKREQ from private receiving task! (task%d)\n",
"mbox: BKREQ from private receiving task! (task%d)\n",
tid);
return;
}
if (rcvtyp_psv(task->ttyp)) {
printk(KERN_ERR
"mbx: BKREQ from passive receiving task! (task%d)\n",
"mbox: BKREQ from passive receiving task! (task%d)\n",
tid);
return;
}
......@@ -2386,13 +2386,13 @@ void mbx_bkreq(struct mbcmd *mb)
wake_up_interruptible(&dev->write_wait_q);
}
void mbx_bkyld(struct mbcmd *mb)
void mbox_bkyld(struct mbcmd *mb)
{
u16 bid = mb->data;
struct ipbuf_head *ipb_h;
if (bid >= ipbcfg.ln) {
printk(KERN_ERR "mbx: BKYLD with illegal bid! %d\n", bid);
printk(KERN_ERR "mbox: BKYLD with illegal bid! %d\n", bid);
return;
}
ipb_h = bid_to_ipbuf(bid);
......@@ -2405,24 +2405,24 @@ void mbx_bkyld(struct mbcmd *mb)
release_ipbuf(ipb_h);
}
void mbx_bksndp(struct mbcmd *mb)
void mbox_bksndp(struct mbcmd *mb)
{
u8 tid = mb->cmd_l;
struct dsptask *task = dsptask[tid];
struct ipbuf_p *ipbp;
if ((tid >= TASKDEV_MAX) || (task == NULL)) {
printk(KERN_ERR "mbx: BKSNDP with illegal tid! %d\n", tid);
printk(KERN_ERR "mbox: BKSNDP with illegal tid! %d\n", tid);
return;
}
if (sndtyp_wd(task->ttyp)) {
printk(KERN_ERR
"mbx: BKSNDP from word sending task! (task%d)\n", tid);
"mbox: BKSNDP from word sending task! (task%d)\n", tid);
return;
}
if (sndtyp_gbl(task->ttyp)) {
printk(KERN_ERR
"mbx: BKSNDP from non-private sending task! (task%d)\n",
"mbox: BKSNDP from non-private sending task! (task%d)\n",
tid);
return;
}
......@@ -2435,16 +2435,16 @@ void mbx_bksndp(struct mbcmd *mb)
ipbp = task->ipbuf_pvt_r;
if (sync_with_dsp(&ipbp->s, tid, 10) < 0) {
printk(KERN_ERR "mbx: BKSNDP - IPBUF sync failed!\n");
printk(KERN_ERR "mbox: BKSNDP - IPBUF sync failed!\n");
return;
}
printk(KERN_DEBUG "mbx: ipbuf_pvt_r->a = 0x%08lx\n",
printk(KERN_DEBUG "mbox: ipbuf_pvt_r->a = 0x%08lx\n",
MKLONG(ipbp->ah, ipbp->al));
ipblink_add_pvt(&task->dev->rcvdt.bk.link);
wake_up_interruptible(&task->dev->read_wait_q);
}
void mbx_bkreqp(struct mbcmd *mb)
void mbox_bkreqp(struct mbcmd *mb)
{
u8 tid = mb->cmd_l;
struct dsptask *task = dsptask[tid];
......@@ -2452,31 +2452,31 @@ void mbx_bkreqp(struct mbcmd *mb)
struct ipbuf_p *ipbp;
if ((tid >= TASKDEV_MAX) || (task == NULL)) {
printk(KERN_ERR "mbx: BKREQP with illegal tid! %d\n", tid);
printk(KERN_ERR "mbox: BKREQP with illegal tid! %d\n", tid);
return;
}
if (rcvtyp_wd(task->ttyp)) {
printk(KERN_ERR
"mbx: BKREQP from word receiving task! (task%d)\n", tid);
"mbox: BKREQP from word receiving task! (task%d)\n", tid);
return;
}
if (rcvtyp_gbl(task->ttyp)) {
printk(KERN_ERR
"mbx: BKREQP from non-private receiving task! (task%d)\n", tid);
"mbox: BKREQP from non-private receiving task! (task%d)\n", tid);
return;
}
if (rcvtyp_psv(task->ttyp)) {
printk(KERN_ERR
"mbx: BKREQP from passive receiving task! (task%d)\n", tid);
"mbox: BKREQP from passive receiving task! (task%d)\n", tid);
return;
}
ipbp = task->ipbuf_pvt_w;
if (sync_with_dsp(&ipbp->s, TID_FREE, 10) < 0) {
printk(KERN_ERR "mbx: BKREQP - IPBUF sync failed!\n");
printk(KERN_ERR "mbox: BKREQP - IPBUF sync failed!\n");
return;
}
printk(KERN_DEBUG "mbx: ipbuf_pvt_w->a = 0x%08lx\n",
printk(KERN_DEBUG "mbox: ipbuf_pvt_w->a = 0x%08lx\n",
MKLONG(ipbp->ah, ipbp->al));
dev = task->dev;
spin_lock(&dev->wsz_lock);
......@@ -2485,18 +2485,18 @@ void mbx_bkreqp(struct mbcmd *mb)
wake_up_interruptible(&dev->write_wait_q);
}
void mbx_tctl(struct mbcmd *mb)
void mbox_tctl(struct mbcmd *mb)
{
u8 tid = mb->cmd_l;
struct dsptask *task = dsptask[tid];
if ((tid >= TASKDEV_MAX) || (task == NULL)) {
printk(KERN_ERR "mbx: TCTL with illegal tid! %d\n", tid);
printk(KERN_ERR "mbox: TCTL with illegal tid! %d\n", tid);
return;
}
if (!waitqueue_active(&task->dev->tctl_wait_q)) {
printk(KERN_WARNING "mbx: unexpected TCTL from DSP!\n");
printk(KERN_WARNING "mbox: unexpected TCTL from DSP!\n");
return;
}
......@@ -2504,7 +2504,7 @@ void mbx_tctl(struct mbcmd *mb)
wake_up_interruptible(&task->dev->tctl_wait_q);
}
void mbx_tcfg(struct mbcmd *mb)
void mbox_tcfg(struct mbcmd *mb)
{
u8 tid = mb->cmd_l;
struct dsptask *task = dsptask[tid];
......@@ -2513,21 +2513,21 @@ void mbx_tcfg(struct mbcmd *mb)
int i;
if ((tid >= TASKDEV_MAX) || (task == NULL)) {
printk(KERN_ERR "mbx: TCFG with illegal tid! %d\n", tid);
printk(KERN_ERR "mbox: TCFG with illegal tid! %d\n", tid);
return;
}
if ((task->state != TASK_ST_CFGREQ) || (cfg_cmd != MBX_CMD_DSP_TCFG)) {
printk(KERN_WARNING "mbx: unexpected TCFG from DSP!\n");
if ((task->state != TASK_ST_CFGREQ) || (cfg_cmd != MBOX_CMD_DSP_TCFG)) {
printk(KERN_WARNING "mbox: unexpected TCFG from DSP!\n");
return;
}
if (dsp_mem_enable(ipbuf_sys_da) < 0) {
printk(KERN_ERR "mbx: TCFG - ipbuf_sys_da read failed!\n");
printk(KERN_ERR "mbox: TCFG - ipbuf_sys_da read failed!\n");
dsp_mem_disable(ipbuf_sys_da);
goto out;
}
if (sync_with_dsp(&ipbuf_sys_da->s, tid, 10) < 0) {
printk(KERN_ERR "mbx: TCFG - IPBUF sync failed!\n");
printk(KERN_ERR "mbox: TCFG - IPBUF sync failed!\n");
dsp_mem_disable(ipbuf_sys_da);
goto out;
}
......@@ -2567,37 +2567,37 @@ out:
wake_up_interruptible(&cfg_wait_q);
}
void mbx_tadd(struct mbcmd *mb)
void mbox_tadd(struct mbcmd *mb)
{
u8 tid = mb->cmd_l;
if ((!waitqueue_active(&cfg_wait_q)) || (cfg_cmd != MBX_CMD_DSP_TADD)) {
printk(KERN_WARNING "mbx: unexpected TADD from DSP!\n");
if ((!waitqueue_active(&cfg_wait_q)) || (cfg_cmd != MBOX_CMD_DSP_TADD)) {
printk(KERN_WARNING "mbox: unexpected TADD from DSP!\n");
return;
}
cfg_tid = tid;
wake_up_interruptible(&cfg_wait_q);
}
void mbx_tdel(struct mbcmd *mb)
void mbox_tdel(struct mbcmd *mb)
{
u8 tid = mb->cmd_l;
if ((!waitqueue_active(&cfg_wait_q)) || (cfg_cmd != MBX_CMD_DSP_TDEL)) {
printk(KERN_WARNING "mbx: unexpected TDEL from DSP!\n");
if ((!waitqueue_active(&cfg_wait_q)) || (cfg_cmd != MBOX_CMD_DSP_TDEL)) {
printk(KERN_WARNING "mbox: unexpected TDEL from DSP!\n");
return;
}
cfg_tid = tid;
wake_up_interruptible(&cfg_wait_q);
}
void mbx_err_fatal(u8 tid)
void mbox_err_fatal(u8 tid)
{
struct dsptask *task = dsptask[tid];
struct taskdev *dev;
if ((tid >= TASKDEV_MAX) || (task == NULL)) {
printk(KERN_ERR "mbx: FATAL ERR with illegal tid! %d\n", tid);
printk(KERN_ERR "mbox: FATAL ERR with illegal tid! %d\n", tid);
return;
}
......@@ -2615,7 +2615,7 @@ static int dbg_rp;
int dsp_dbg_config(u16 *buf, u16 sz, u16 lsz)
{
#ifdef OLD_BINARY_SUPPORT
if ((mbx_revision == MBREV_3_0) || (mbx_revision == MBREV_3_2)) {
if ((mbox_revision == MBREV_3_0) || (mbox_revision == MBREV_3_2)) {
dbg_buf = NULL;
dbg_buf_sz = 0;
dbg_line_sz = 0;
......@@ -2648,10 +2648,10 @@ void dsp_dbg_stop(void)
}
#ifdef OLD_BINARY_SUPPORT
static void mbx_dbg_old(struct mbcmd *mb);
static void mbox_dbg_old(struct mbcmd *mb);
#endif
void mbx_dbg(struct mbcmd *mb)
void mbox_dbg(struct mbcmd *mb)
{
u8 tid = mb->cmd_l;
int cnt = mb->data;
......@@ -2660,19 +2660,19 @@ void mbx_dbg(struct mbcmd *mb)
int i;
#ifdef OLD_BINARY_SUPPORT
if ((mbx_revision == MBREV_3_0) || (mbx_revision == MBREV_3_2)) {
mbx_dbg_old(mb);
if ((mbox_revision == MBREV_3_0) || (mbox_revision == MBREV_3_2)) {
mbox_dbg_old(mb);
return;
}
#endif
if (((tid >= TASKDEV_MAX) || (dsptask[tid] == NULL)) &&
(tid != TID_ANON)) {
printk(KERN_ERR "mbx: DBG with illegal tid! %d\n", tid);
printk(KERN_ERR "mbox: DBG with illegal tid! %d\n", tid);
return;
}
if (dbg_buf == NULL) {
printk(KERN_ERR "mbx: DBG command received, but "
printk(KERN_ERR "mbox: DBG command received, but "
"dbg_buf has not been configured yet.\n");
return;
}
......@@ -2718,7 +2718,7 @@ void mbx_dbg(struct mbcmd *mb)
}
#ifdef OLD_BINARY_SUPPORT
static void mbx_dbg_old(struct mbcmd *mb)
static void mbox_dbg_old(struct mbcmd *mb)
{
u8 tid = mb->cmd_l;
char s[80], *s_end = &s[79], *p;
......@@ -2729,15 +2729,15 @@ static void mbx_dbg_old(struct mbcmd *mb)
if (((tid >= TASKDEV_MAX) || (dsptask[tid] == NULL)) &&
(tid != TID_ANON)) {
printk(KERN_ERR "mbx: DBG with illegal tid! %d\n", tid);
printk(KERN_ERR "mbox: DBG with illegal tid! %d\n", tid);
return;
}
if (dsp_mem_enable(ipbuf_sys_da) < 0) {
printk(KERN_ERR "mbx: DBG - ipbuf_sys_da read failed!\n");
printk(KERN_ERR "mbox: DBG - ipbuf_sys_da read failed!\n");
return;
}
if (sync_with_dsp(&ipbuf_sys_da->s, tid, 10) < 0) {
printk(KERN_ERR "mbx: DBG - IPBUF sync failed!\n");
printk(KERN_ERR "mbox: DBG - IPBUF sync failed!\n");
goto out1;
}
buf = ipbuf_sys_da->d;
......
......@@ -38,19 +38,19 @@
#if defined(CONFIG_ARCH_OMAP1)
#define read_mbx(m, msgp) \
#define read_mbox(m, msgp) \
do { \
*(msgp) = omap_readw((m)->data_r); \
*(msgp) |= ((mbx_msg_t)omap_readw((m)->cmd_r)) << 16; \
*(msgp) |= ((mbox_msg_t)omap_readw((m)->cmd_r)) << 16; \
} while (0)
#define write_mbx(m, msg) \
#define write_mbox(m, msg) \
do { \
omap_writew((msg) & 0xffff, (m)->data_w); \
omap_writew((msg) >> 16, (m)->cmd_w); \
} while (0)
#define enable_newmsg_irq(m) enable_irq((m)->irq)
#define disable_newmsg_irq(m) disable_irq((m)->irq)
#define mbx_is_notfull(m) (omap_readw((m)->flag_w) == 0)
#define mbox_is_notfull(m) (omap_readw((m)->flag_w) == 0)
#elif defined(CONFIG_ARCH_OMAP2)
......@@ -59,9 +59,9 @@
#define omap_bit_clrl(b,r) \
do { omap_writel(omap_readl(r) & ~(b), (r)); } while(0)
#define read_mbx(m, msgp) \
#define read_mbox(m, msgp) \
do { *(msgp) = omap_readl((m)->message_r); } while (0)
#define write_mbx(m, msg) omap_writel(msg, (m)->message_w)
#define write_mbox(m, msg) omap_writel(msg, (m)->message_w)
#define enable_newmsg_irq(m) omap_bit_setl((m)->newmsg_bit, (m)->irqenable)
#define disable_newmsg_irq(m) omap_bit_clrl((m)->newmsg_bit, (m)->irqenable)
#define enable_notfull_irq(m) omap_bit_setl((m)->notfull_bit, (m)->irqenable)
......@@ -71,42 +71,42 @@
#define notfull_irq_enabled(m) (omap_readl((m)->irqenable) & (m)->notfull_bit)
#define has_newmsg_irq(m) (omap_readl((m)->irqstatus) & (m)->newmsg_bit)
#define has_notfull_irq(m) (omap_readl((m)->irqstatus) & (m)->notfull_bit)
#define mbx_nomsg(m) (omap_readl((m)->msgstatus_r) == 0)
#define mbx_is_notfull(m) (omap_readl((m)->fifostatus_w) == 0)
#define mbox_nomsg(m) (omap_readl((m)->msgstatus_r) == 0)
#define mbox_is_notfull(m) (omap_readl((m)->fifostatus_w) == 0)
#endif /* CONFIG_ARCH_OMAP2 */
static void do_mbx(void *p);
static void do_mbox(void *p);
#define MBQ_DEPTH 16
struct mbq {
mbx_msg_t msg[MBQ_DEPTH];
mbox_msg_t msg[MBQ_DEPTH];
int rp, wp, full;
};
#define mbq_inc(p) do { if (++(p) == MBQ_DEPTH) (p) = 0; } while(0)
#if defined(CONFIG_ARCH_OMAP1)
# define MBX_USE_SEQ_BIT /* XXX */
# define MBOX_USE_SEQ_BIT /* XXX */
#elif defined(CONFIG_ARCH_OMAP2)
# undef MBX_USE_SEQ_BIT
# undef MBOX_USE_SEQ_BIT
#endif
struct mbx {
struct mbox {
char *name;
unsigned int irq;
char irq_devid_newmsg;
#ifdef CONFIG_ARCH_OMAP2
char irq_devid_notfull;
#endif
#ifdef MBX_USE_SEQ_BIT
mbx_msg_t seq_snd;
mbx_msg_t seq_rcv;
#ifdef MBOX_USE_SEQ_BIT
mbox_msg_t seq_snd;
mbox_msg_t seq_rcv;
/* seq_rcv should be initialized with any value other than
* 0 and 1 << 31, to allow either value for the first
* message. */
#endif
mbx_receiver_t *receiver_map[MBX_CMD_MAX];
mbox_receiver_t *receiver_map[MBOX_CMD_MAX];
struct work_struct work;
struct mbq mbq;
#ifdef CONFIG_ARCH_OMAP2
......@@ -139,10 +139,10 @@ struct mbx {
#define INT_DSP_MAILBOX1 INT_1610_DSP_MAILBOX1
#endif
static struct mbx mbx_dsp = {
static struct mbox mbox_dsp = {
.name = "DSP",
.irq = INT_DSP_MAILBOX1,
.work = __WORK_INITIALIZER(mbx_dsp.work, do_mbx, &mbx_dsp),
.work = __WORK_INITIALIZER(mbox_dsp.work, do_mbox, &mbox_dsp),
.cmd_w = (void *)MAILBOX_ARM2DSP1b,
.data_w = (void *)MAILBOX_ARM2DSP1,
......@@ -159,11 +159,11 @@ static struct mbx mbx_dsp = {
* MAILBOX 2: ARM -> IVA,
* MAILBOX 3: ARM <- IVA.
*/
static struct mbx mbx_dsp = {
static struct mbox mbox_dsp = {
.name = "DSP",
.irq = INT_24XX_MAIL_U0_MPU,
.work = __WORK_INITIALIZER(mbx_dsp.work, do_mbx, &mbx_dsp),
.full_wait_q = __WAIT_QUEUE_HEAD_INITIALIZER(mbx_dsp.full_wait_q),
.work = __WORK_INITIALIZER(mbox_dsp.work, do_mbox, &mbox_dsp),
.full_wait_q = __WAIT_QUEUE_HEAD_INITIALIZER(mbox_dsp.full_wait_q),
.irqenable = (void *)MAILBOX_IRQENABLE_0,
.irqstatus = (void *)MAILBOX_IRQSTATUS_0,
......@@ -174,11 +174,11 @@ static struct mbx mbx_dsp = {
.notfull_bit = MAILBOX_IRQ_NOTFULL(0),
.newmsg_bit = MAILBOX_IRQ_NEWMSG(1),
};
static struct mbx mbx_iva = {
static struct mbox mbox_iva = {
.name = "IVA",
.irq = INT_24XX_MAIL_U3_MPU,
.work = __WORK_INITIALIZER(mbx_iva.work, do_mbx, &mbx_iva),
.full_wait_q = __WAIT_QUEUE_HEAD_INITIALIZER(mbx_iva.full_wait_q),
.work = __WORK_INITIALIZER(mbox_iva.work, do_mbox, &mbox_iva),
.full_wait_q = __WAIT_QUEUE_HEAD_INITIALIZER(mbox_iva.full_wait_q),
.irqenable = (void *)MAILBOX_IRQENABLE_3,
.irqstatus = (void *)MAILBOX_IRQSTATUS_3,
......@@ -192,33 +192,33 @@ static struct mbx mbx_iva = {
#endif /* CONFIG_ARCH_OMAP2 */
static struct mbx *mbxes[] = {
&mbx_dsp,
static struct mbox *mboxes[] = {
&mbox_dsp,
#ifdef CONFIG_ARCH_OMAP2
&mbx_iva,
&mbox_iva,
#endif
};
struct mbx *mbx_get(const char *id)
struct mbox *mbox_get(const char *id)
{
int i;
for (i = 0; i < ARRAY_SIZE(mbxes); i++) {
if (!strcmp(id, mbxes[i]->name))
return mbxes[i];
for (i = 0; i < ARRAY_SIZE(mboxes); i++) {
if (!strcmp(id, mboxes[i]->name))
return mboxes[i];
}
return ERR_PTR(-ENOENT);
}
#if defined(CONFIG_ARCH_OMAP1)
static __inline__ int mbsync_irq_save(struct mbx *mbx, unsigned long *flags,
static __inline__ int mbsync_irq_save(struct mbox *mbox, unsigned long *flags,
int try_cnt)
{
int cnt;
local_irq_save(*flags);
if (mbx_is_notfull(mbx))
if (mbox_is_notfull(mbox))
return 0;
/*
* mailbox is busy. wait for some usecs...
......@@ -227,7 +227,7 @@ static __inline__ int mbsync_irq_save(struct mbx *mbx, unsigned long *flags,
for (cnt = 0; cnt < try_cnt; cnt++) {
udelay(1);
local_irq_save(*flags);
if (mbx_is_notfull(mbx)) /* success! */
if (mbox_is_notfull(mbox)) /* success! */
return 0;
local_irq_restore(*flags);
}
......@@ -236,30 +236,30 @@ static __inline__ int mbsync_irq_save(struct mbx *mbx, unsigned long *flags,
return -1;
}
#elif defined(CONFIG_ARCH_OMAP2)
static __inline__ int mbsync_irq_save(struct mbx *mbx, unsigned long *flags)
static __inline__ int mbsync_irq_save(struct mbox *mbox, unsigned long *flags)
{
long current_state;
DECLARE_WAITQUEUE(wait, current);
do {
local_irq_save(*flags);
if (mbx_is_notfull(mbx))
if (mbox_is_notfull(mbox))
return 0;
/*
* mailbox is busy.
*/
local_irq_restore(*flags);
enable_notfull_irq(mbx);
enable_notfull_irq(mbox);
/* wait until the FIFO becomes not-full */
add_wait_queue(&mbx->full_wait_q, &wait);
add_wait_queue(&mbox->full_wait_q, &wait);
current_state = current->state;
set_current_state(TASK_INTERRUPTIBLE);
if (!mbx_is_notfull(mbx)) /* last check */
if (!mbox_is_notfull(mbox)) /* last check */
schedule();
set_current_state(current_state);
remove_wait_queue(&mbx->full_wait_q, &wait);
remove_wait_queue(&mbox->full_wait_q, &wait);
if (signal_pending(current))
return -1;
......@@ -270,7 +270,7 @@ static __inline__ int mbsync_irq_save(struct mbx *mbx, unsigned long *flags)
/*
* message dispatcher API
*/
int mbx_send(struct mbx *mbx, mbx_msg_t msg)
int mbox_send(struct mbox *mbox, mbox_msg_t msg)
{
unsigned long flags;
......@@ -278,25 +278,25 @@ int mbx_send(struct mbx *mbx, mbx_msg_t msg)
/*
* DSP mailbox interrupt latency must be less than 1ms.
*/
if (mbsync_irq_save(mbx, &flags, 1000) < 0) {
if (mbsync_irq_save(mbox, &flags, 1000) < 0) {
printk(KERN_ERR
"mailbox(%s) is busy. message 0x%08x is aborting.\n",
mbx->name, msg);
mbox->name, msg);
return -1;
}
#elif defined(CONFIG_ARCH_OMAP2)
if (mbsync_irq_save(mbx, &flags) < 0)
if (mbsync_irq_save(mbox, &flags) < 0)
return -1;
#endif
#ifdef MBX_USE_SEQ_BIT
#ifdef MBOX_USE_SEQ_BIT
/* add seq_snd to msg */
msg = (msg & 0x7fffffff) | mbx->seq_snd;
msg = (msg & 0x7fffffff) | mbox->seq_snd;
/* flip seq_snd */
mbx->seq_snd ^= 1 << 31;
mbox->seq_snd ^= 1 << 31;
#endif
write_mbx(mbx, msg);
write_mbox(mbox, msg);
local_irq_restore(flags);
return 0;
......@@ -305,160 +305,160 @@ int mbx_send(struct mbx *mbx, mbx_msg_t msg)
/*
* register / unregister API
*/
int register_mbx_receiver(struct mbx *mbx, unsigned char cmd,
mbx_receiver_t *rcv)
int register_mbox_receiver(struct mbox *mbox, unsigned char cmd,
mbox_receiver_t *rcv)
{
if (cmd >= MBX_CMD_MAX) {
printk(KERN_ERR "register_mbx_receiver(): "
if (cmd >= MBOX_CMD_MAX) {
printk(KERN_ERR "register_mbox_receiver(): "
"bad cmd (0x%x)\n", cmd);
return -EINVAL;
}
if (mbx->receiver_map[cmd] != NULL) {
printk(KERN_ERR "register_mbx_receiver(): cmd 0x%x is "
if (mbox->receiver_map[cmd] != NULL) {
printk(KERN_ERR "register_mbox_receiver(): cmd 0x%x is "
"already reserved.\n", cmd);
return -EINVAL;
}
mbx->receiver_map[cmd] = rcv;
mbox->receiver_map[cmd] = rcv;
return 0;
}
int unregister_mbx_receiver(struct mbx *mbx, unsigned char cmd,
mbx_receiver_t *rcv)
int unregister_mbox_receiver(struct mbox *mbox, unsigned char cmd,
mbox_receiver_t *rcv)
{
if (cmd >= MBX_CMD_MAX) {
printk(KERN_ERR "unregister_mbx_receiver(): "
if (cmd >= MBOX_CMD_MAX) {
printk(KERN_ERR "unregister_mbox_receiver(): "
"bad cmd (0x%x)\n", cmd);
return -EINVAL;
}
if (mbx->receiver_map[cmd] != rcv) {
printk(KERN_ERR "unregister_mbx_receiver(): cmd 0x%x and "
if (mbox->receiver_map[cmd] != rcv) {
printk(KERN_ERR "unregister_mbox_receiver(): cmd 0x%x and "
"receiver function mismatch!\n", cmd);
return -EINVAL;
}
mbx->receiver_map[cmd] = NULL;
mbox->receiver_map[cmd] = NULL;
return 0;
}
/*
* IRQ disable / enable API
*/
void disable_mbx_irq(struct mbx *mbx)
void disable_mbox_irq(struct mbox *mbox)
{
disable_irq(mbx->irq);
disable_irq(mbox->irq);
}
void enable_mbx_irq(struct mbx *mbx)
void enable_mbox_irq(struct mbox *mbox)
{
enable_irq(mbx->irq);
enable_irq(mbox->irq);
}
/*
* init_seq API
*/
void mbx_init_seq(struct mbx *mbx)
void mbox_init_seq(struct mbox *mbox)
{
#ifdef MBX_USE_SEQ_BIT
#ifdef MBOX_USE_SEQ_BIT
/* backward compatibility */
mbx->seq_snd = 0x80000000;
mbox->seq_snd = 0x80000000;
/* any value other than 0 and 1 << 31 */
mbx->seq_rcv = 0xffffffff;
#endif /* MBX_USE_SEQ_BIT */
mbox->seq_rcv = 0xffffffff;
#endif /* MBOX_USE_SEQ_BIT */
}
/*
* receiver workqueue
*/
static void do_mbx(void *p)
static void do_mbox(void *p)
{
int empty = 0;
struct mbx *mbx = (struct mbx *)p;
struct mbq *mbq = &mbx->mbq;
mbx_receiver_t *receiver;
mbx_msg_t msg;
#ifdef MBX_USE_SEQ_BIT
mbx_msg_t seq;
struct mbox *mbox = (struct mbox *)p;
struct mbq *mbq = &mbox->mbq;
mbox_receiver_t *receiver;
mbox_msg_t msg;
#ifdef MBOX_USE_SEQ_BIT
mbox_msg_t seq;
#endif
disable_newmsg_irq(mbx);
disable_newmsg_irq(mbox);
if ((mbq->rp == mbq->wp) && !mbq->full)
empty = 1;
enable_newmsg_irq(mbx);
enable_newmsg_irq(mbox);
while (!empty) {
msg = mbq->msg[mbq->rp];
#ifdef MBX_USE_SEQ_BIT
#ifdef MBOX_USE_SEQ_BIT
seq = msg & (1 << 31);
if (seq == mbx->seq_rcv) {
if (seq == mbox->seq_rcv) {
printk(KERN_ERR
"mbx: illegal seq bit! ignoring this command. "
"mbox: illegal seq bit! ignoring this command. "
"(%08x)\n", msg);
goto inc;
}
mbx->seq_rcv = seq;
mbox->seq_rcv = seq;
#endif
/* call receiver function */
if ((receiver = mbx->receiver_map[(msg >> 24) & 0x7f]) == NULL)
if ((receiver = mbox->receiver_map[(msg >> 24) & 0x7f]) == NULL)
printk(KERN_ERR
"mbx: unknown message (%08x) received from "
"%s.\n", msg, mbx->name);
"mbox: unknown message (%08x) received from "
"%s.\n", msg, mbox->name);
else
receiver(msg);
#ifdef MBX_USE_SEQ_BIT
#ifdef MBOX_USE_SEQ_BIT
inc:
#endif
disable_newmsg_irq(mbx);
disable_newmsg_irq(mbox);
mbq_inc(mbq->rp);
if (mbq->rp == mbq->wp)
empty = 1;
/* if mbq has been full, now we have a room. */
if (mbq->full) {
mbq->full = 0;
enable_newmsg_irq(mbx);
enable_newmsg_irq(mbox);
}
enable_newmsg_irq(mbx);
enable_newmsg_irq(mbox);
}
}
/*
* interrupt handler
*/
static irqreturn_t mbx_int_newmsg(int irq, void *p, struct pt_regs *regs)
static irqreturn_t mbox_int_newmsg(int irq, void *p, struct pt_regs *regs)
{
struct mbx *mbx = container_of(p, struct mbx, irq_devid_newmsg);
struct mbq *mbq = &mbx->mbq;
mbx_msg_t *msg;
struct mbox *mbox = container_of(p, struct mbox, irq_devid_newmsg);
struct mbq *mbq = &mbox->mbq;
mbox_msg_t *msg;
#ifdef CONFIG_ARCH_OMAP2
/*
* mailbox IRQ can be muxed.
* if it is not a newmsg interrupt, do nothing.
*/
if (!has_newmsg_irq(mbx))
if (!has_newmsg_irq(mbox))
return IRQ_NONE;
#endif
do {
#ifdef CONFIG_ARCH_OMAP2
if (mbx_nomsg(mbx)) {
if (mbox_nomsg(mbox)) {
/* no more messages in the fifo. clear IRQ source. */
clear_newmsg_irq(mbx);
clear_newmsg_irq(mbox);
break;
}
#endif
msg = &mbq->msg[mbq->wp];
read_mbx(mbx, msg);
read_mbox(mbox, msg);
mbq_inc(mbq->wp);
if (mbq->wp == mbq->rp) { /* mbq is full */
mbq->full = 1;
disable_newmsg_irq(mbx);
disable_newmsg_irq(mbox);
break;
}
#if defined(CONFIG_ARCH_OMAP1)
......@@ -467,51 +467,51 @@ static irqreturn_t mbx_int_newmsg(int irq, void *p, struct pt_regs *regs)
} while (1);
#endif
schedule_work(&mbx->work);
schedule_work(&mbox->work);
return IRQ_HANDLED;
}
#ifdef CONFIG_ARCH_OMAP2
static irqreturn_t mbx_int_notfull(int irq, void *p, struct pt_regs *regs)
static irqreturn_t mbox_int_notfull(int irq, void *p, struct pt_regs *regs)
{
struct mbx *mbx = container_of(p, struct mbx, irq_devid_notfull);
struct mbox *mbox = container_of(p, struct mbox, irq_devid_notfull);
/*
* mailbox IRQ can be muxed.
* if it is not a notfull interrupt, we do nothing.
*/
#if 0
if (!has_notfull_irq(mbx))
if (!has_notfull_irq(mbox))
#else
if (!(has_notfull_irq(mbx) && notfull_irq_enabled(mbx)))
if (!(has_notfull_irq(mbox) && notfull_irq_enabled(mbox)))
#endif
return IRQ_NONE;
disable_notfull_irq(mbx);
disable_notfull_irq(mbox);
#if 0 /*
* note: this doesn't seeem to work as explained in the manual.
* IRQSTATUS:NOTFULL can't be cleared even we write 1 to that bit.
* It is always set when it's not full, regardless of IRQENABLE setting.
*/
clear_notfull_irq(mbx);
clear_notfull_irq(mbox);
#endif
wake_up_interruptible_all(&mbx->full_wait_q);
wake_up_interruptible_all(&mbox->full_wait_q);
return IRQ_HANDLED;
}
#endif /* CONFIG_ARCH_OMAP2 */
static int __init mbx_request_irq(struct mbx *mbx, const char *devname)
static int __init mbox_request_irq(struct mbox *mbox, const char *devname)
{
int ret;
#ifdef CONFIG_ARCH_OMAP2
enable_newmsg_irq(mbx);
enable_newmsg_irq(mbox);
#endif
ret = request_irq(mbx->irq, mbx_int_newmsg, SA_INTERRUPT | SA_SHIRQ,
devname, &mbx->irq_devid_newmsg);
ret = request_irq(mbox->irq, mbox_int_newmsg, SA_INTERRUPT | SA_SHIRQ,
devname, &mbox->irq_devid_newmsg);
if (ret) {
printk(KERN_ERR
"failed to register DSP mailbox newmsg interrupt: "
......@@ -520,8 +520,8 @@ static int __init mbx_request_irq(struct mbx *mbx, const char *devname)
}
#ifdef CONFIG_ARCH_OMAP2
ret = request_irq(mbx->irq, mbx_int_notfull, SA_INTERRUPT | SA_SHIRQ,
devname, &mbx->irq_devid_notfull);
ret = request_irq(mbox->irq, mbox_int_notfull, SA_INTERRUPT | SA_SHIRQ,
devname, &mbox->irq_devid_notfull);
if (ret) {
printk(KERN_ERR
"failed to register DSP mailbox notfull interrupt: "
......@@ -537,26 +537,26 @@ static int __init omap_mailbox_init(void)
{
int ret;
#ifdef CONFIG_ARCH_OMAP2
struct clk *mbx_ick_handle;
struct clk *mbox_ick_handle;
#endif
printk(KERN_INFO "Initializing OMAP Mailboxes\n");
#ifdef CONFIG_ARCH_OMAP2
/*
* FIXME: mbx_ick will never unsed
* FIXME: mbox_ick will never unsed
*/
mbx_ick_handle = clk_get(NULL, "mailboxes_ick");
if (IS_ERR(mbx_ick_handle)) {
mbox_ick_handle = clk_get(NULL, "mailboxes_ick");
if (IS_ERR(mbox_ick_handle)) {
printk("Could not get mailboxes_ick\n");
return -ENODEV;
} else
clk_enable(mbx_ick_handle);
clk_enable(mbox_ick_handle);
#endif
if ((ret = mbx_request_irq(&mbx_dsp, "mbx_dsp")) != 0)
if ((ret = mbox_request_irq(&mbox_dsp, "mbox_dsp")) != 0)
return ret;
#ifdef CONFIG_ARCH_OMAP2
if ((ret = mbx_request_irq(&mbx_iva, "mbx_iva")) != 0)
if ((ret = mbox_request_irq(&mbox_iva, "mbox_iva")) != 0)
return ret;
#endif
......@@ -565,10 +565,10 @@ static int __init omap_mailbox_init(void)
arch_initcall(omap_mailbox_init);
EXPORT_SYMBOL(mbx_get);
EXPORT_SYMBOL(mbx_send);
EXPORT_SYMBOL(register_mbx_receiver);
EXPORT_SYMBOL(unregister_mbx_receiver);
EXPORT_SYMBOL(disable_mbx_irq);
EXPORT_SYMBOL(enable_mbx_irq);
EXPORT_SYMBOL(mbx_init_seq);
EXPORT_SYMBOL(mbox_get);
EXPORT_SYMBOL(mbox_send);
EXPORT_SYMBOL(register_mbox_receiver);
EXPORT_SYMBOL(unregister_mbox_receiver);
EXPORT_SYMBOL(disable_mbox_irq);
EXPORT_SYMBOL(enable_mbox_irq);
EXPORT_SYMBOL(mbox_init_seq);
......@@ -3,52 +3,52 @@
#ifndef MAILBOX_H
#define MAILBOX_H
typedef u32 mbx_msg_t;
typedef void (mbx_receiver_t)(mbx_msg_t msg);
typedef u32 mbox_msg_t;
typedef void (mbox_receiver_t)(mbox_msg_t msg);
struct mbx; /* contents are private */
struct mbox; /* contents are private */
struct mbx *mbx_get(const char *id);
extern int mbx_send(struct mbx *mbx_h, mbx_msg_t msg);
extern int register_mbx_receiver(struct mbx *mbx, unsigned char cmd,
mbx_receiver_t *rcv);
extern int unregister_mbx_receiver(struct mbx *mbx, unsigned char cmd,
mbx_receiver_t *rcv);
extern void enable_mbx_irq(struct mbx *mbx);
extern void disable_mbx_irq(struct mbx *mbx);
extern void mbx_init_seq(struct mbx *mbx);
struct mbox *mbox_get(const char *id);
extern int mbox_send(struct mbox *mbox_h, mbox_msg_t msg);
extern int register_mbox_receiver(struct mbox *mbox, unsigned char cmd,
mbox_receiver_t *rcv);
extern int unregister_mbox_receiver(struct mbox *mbox, unsigned char cmd,
mbox_receiver_t *rcv);
extern void enable_mbox_irq(struct mbox *mbox);
extern void disable_mbox_irq(struct mbox *mbox);
extern void mbox_init_seq(struct mbox *mbox);
/*
* mailbox command: 0x00 - 0x7f
* when a driver wants to use mailbox, it must reserve mailbox commands here.
*/
#define MBX_CMD_MAX 0x80
#define MBOX_CMD_MAX 0x80
/* DSP Gateway */
#define MBX_CMD_DSP_WDSND 0x10
#define MBX_CMD_DSP_WDREQ 0x11
#define MBX_CMD_DSP_BKSND 0x20
#define MBX_CMD_DSP_BKREQ 0x21
#define MBX_CMD_DSP_BKYLD 0x23
#define MBX_CMD_DSP_BKSNDP 0x24
#define MBX_CMD_DSP_BKREQP 0x25
#define MBX_CMD_DSP_TCTL 0x30
#define MBX_CMD_DSP_TCTLDATA 0x31
#define MBX_CMD_DSP_POLL 0x32
#define MBX_CMD_DSP_WDT 0x50
#define MBX_CMD_DSP_RUNLEVEL 0x51
#define MBX_CMD_DSP_PM 0x52
#define MBX_CMD_DSP_SUSPEND 0x53
#define MBX_CMD_DSP_KFUNC 0x54
#define MBX_CMD_DSP_TCFG 0x60
#define MBX_CMD_DSP_TADD 0x62
#define MBX_CMD_DSP_TDEL 0x63
#define MBX_CMD_DSP_TSTOP 0x65
#define MBX_CMD_DSP_DSPCFG 0x70
#define MBX_CMD_DSP_REGRW 0x72
#define MBX_CMD_DSP_GETVAR 0x74
#define MBX_CMD_DSP_SETVAR 0x75
#define MBX_CMD_DSP_ERR 0x78
#define MBX_CMD_DSP_DBG 0x79
#define MBOX_CMD_DSP_WDSND 0x10
#define MBOX_CMD_DSP_WDREQ 0x11
#define MBOX_CMD_DSP_BKSND 0x20
#define MBOX_CMD_DSP_BKREQ 0x21
#define MBOX_CMD_DSP_BKYLD 0x23
#define MBOX_CMD_DSP_BKSNDP 0x24
#define MBOX_CMD_DSP_BKREQP 0x25
#define MBOX_CMD_DSP_TCTL 0x30
#define MBOX_CMD_DSP_TCTLDATA 0x31
#define MBOX_CMD_DSP_POLL 0x32
#define MBOX_CMD_DSP_WDT 0x50
#define MBOX_CMD_DSP_RUNLEVEL 0x51
#define MBOX_CMD_DSP_PM 0x52
#define MBOX_CMD_DSP_SUSPEND 0x53
#define MBOX_CMD_DSP_KFUNC 0x54
#define MBOX_CMD_DSP_TCFG 0x60
#define MBOX_CMD_DSP_TADD 0x62
#define MBOX_CMD_DSP_TDEL 0x63
#define MBOX_CMD_DSP_TSTOP 0x65
#define MBOX_CMD_DSP_DSPCFG 0x70
#define MBOX_CMD_DSP_REGRW 0x72
#define MBOX_CMD_DSP_GETVAR 0x74
#define MBOX_CMD_DSP_SETVAR 0x75
#define MBOX_CMD_DSP_ERR 0x78
#define MBOX_CMD_DSP_DBG 0x79
#endif /* MAILBOX_H */
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