Commit 0a1de60c authored by Hiroshi DOYU's avatar Hiroshi DOYU Committed by Juha Yrjola

ARM: OMAP: DSPGW: Peripheral (kfunc) control

DSP needs to control some board-specific peripheral devices (GPT,
audio, mbox, etc.) through dspgw kfunc commands.
Signed-off-by: default avatarHiroshi DOYU <Hiroshi.DOYU@nokia.com>
Signed-off-by: default avatarJuha Yrjola <juha.yrjola@solidboot.com>
parent 71001a9c
...@@ -29,6 +29,10 @@ ...@@ -29,6 +29,10 @@
#include "../plat-omap/dsp/dsp_common.h" #include "../plat-omap/dsp/dsp_common.h"
static struct dsp_platform_data dsp_pdata = {
.kdev_list = LIST_HEAD_INIT(dsp_pdata.kdev_list),
};
static struct resource omap_dsp_resources[] = { static struct resource omap_dsp_resources[] = {
{ {
.name = "dsp_mmu", .name = "dsp_mmu",
...@@ -42,9 +46,11 @@ static struct platform_device omap_dsp_device = { ...@@ -42,9 +46,11 @@ static struct platform_device omap_dsp_device = {
.id = -1, .id = -1,
.num_resources = ARRAY_SIZE(omap_dsp_resources), .num_resources = ARRAY_SIZE(omap_dsp_resources),
.resource = omap_dsp_resources, .resource = omap_dsp_resources,
.dev = {
.platform_data = &dsp_pdata,
},
}; };
static inline void omap_init_dsp(void) static inline void omap_init_dsp(void)
{ {
struct resource *res; struct resource *res;
...@@ -63,12 +69,26 @@ static inline void omap_init_dsp(void) ...@@ -63,12 +69,26 @@ static inline void omap_init_dsp(void)
platform_device_register(&omap_dsp_device); platform_device_register(&omap_dsp_device);
} }
int dsp_kfunc_device_register(struct dsp_kfunc_device *kdev)
{
static DEFINE_MUTEX(dsp_pdata_lock);
mutex_init(&kdev->lock);
mutex_lock(&dsp_pdata_lock);
list_add_tail(&kdev->entry, &dsp_pdata.kdev_list);
mutex_unlock(&dsp_pdata_lock);
return 0;
}
EXPORT_SYMBOL(dsp_kfunc_device_register);
#else #else
static inline void omap_init_dsp(void) { } static inline void omap_init_dsp(void) { }
#endif #endif /* CONFIG_OMAP_DSP */
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE) #if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
#define OMAP1_I2C_BASE 0xfffb3800 #define OMAP1_I2C_BASE 0xfffb3800
......
...@@ -116,7 +116,6 @@ struct mb_exarg { ...@@ -116,7 +116,6 @@ struct mb_exarg {
u16 *argv; u16 *argv;
}; };
extern struct mbox *mbox_dsp;
extern void dsp_mbox_start(void); extern void dsp_mbox_start(void);
extern void dsp_mbox_stop(void); extern void dsp_mbox_stop(void);
extern int dsp_mbox_config(void *p); extern int dsp_mbox_config(void *p);
...@@ -240,5 +239,3 @@ extern const struct cmdinfo *cmdinfo[]; ...@@ -240,5 +239,3 @@ extern const struct cmdinfo *cmdinfo[];
extern char *subcmd_name(struct mbcmd *mb); extern char *subcmd_name(struct mbcmd *mb);
extern void mblog_add(struct mbcmd *mb, arm_dsp_dir_t dir); extern void mblog_add(struct mbcmd *mb, arm_dsp_dir_t dir);
extern struct device *dsp_device;
...@@ -373,7 +373,7 @@ static void dsp_cpustat_update(void) ...@@ -373,7 +373,7 @@ static void dsp_cpustat_update(void)
__dsp_core_enable(); __dsp_core_enable();
#endif #endif
cpustat.stat = CPUSTAT_RUN; cpustat.stat = CPUSTAT_RUN;
enable_irq(dsp_mmu_irq); enable_irq(omap_dsp->mmu_irq);
} }
return; return;
} }
...@@ -381,7 +381,7 @@ static void dsp_cpustat_update(void) ...@@ -381,7 +381,7 @@ static void dsp_cpustat_update(void)
/* cpustat.req < CPUSTAT_RUN */ /* cpustat.req < CPUSTAT_RUN */
if (cpustat.stat == CPUSTAT_RUN) { if (cpustat.stat == CPUSTAT_RUN) {
disable_irq(dsp_mmu_irq); disable_irq(omap_dsp->mmu_irq);
#ifdef CONFIG_ARCH_OMAP1 #ifdef CONFIG_ARCH_OMAP1
clk_disable(api_ck_handle); clk_disable(api_ck_handle);
#endif #endif
...@@ -568,26 +568,6 @@ void dsp_unregister_mem_cb(void) ...@@ -568,26 +568,6 @@ void dsp_unregister_mem_cb(void)
} }
#endif /* CONFIG_ARCH_OMAP1 */ #endif /* CONFIG_ARCH_OMAP1 */
/*
* Audio power control function prototypes and defaults
* (To be overridden with board specific functions)
*/
static void generic_audio_pwr_up_request(int stage)
{
printk(KERN_ERR "audio power-up request function is not defined.\n");
}
void (*omap_dsp_audio_pwr_up_request)(int stage) = generic_audio_pwr_up_request;
EXPORT_SYMBOL(omap_dsp_audio_pwr_up_request);
static void generic_audio_pwr_down_request(int stage)
{
printk(KERN_ERR "audio power-down request function is not defined.\n");
}
void (*omap_dsp_audio_pwr_down_request)(int stage) = generic_audio_pwr_down_request;
EXPORT_SYMBOL(omap_dsp_audio_pwr_down_request);
arch_initcall(omap_dsp_init); arch_initcall(omap_dsp_init);
#ifdef CONFIG_ARCH_OMAP1 #ifdef CONFIG_ARCH_OMAP1
......
...@@ -158,6 +158,49 @@ static inline void dsp_clk_autoidle(void) ...@@ -158,6 +158,49 @@ static inline void dsp_clk_autoidle(void)
} }
#endif #endif
extern int dsp_mmu_irq; struct dsp_kfunc_device {
char *name;
struct clk *fck;
struct clk *ick;;
struct mutex lock;
int enabled;
int type;
#define DSP_KFUNC_DEV_TYPE_COMMON 1
#define DSP_KFUNC_DEV_TYPE_AUDIO 2
struct list_head entry;
int (*probe)(struct dsp_kfunc_device *);
int (*remove)(struct dsp_kfunc_device *);
int (*enable)(struct dsp_kfunc_device *, int);
int (*disable)(struct dsp_kfunc_device *, int);
};
extern int dsp_kfunc_device_register(struct dsp_kfunc_device *);
struct dsp_platform_data {
struct list_head kdev_list;
};
struct omap_dsp {
struct mutex lock;
int enabled; /* stored peripheral status */
int mmu_irq;
struct omap_mbox *mbox;
struct device *dev;
struct list_head *kdev_list;
};
#if defined(CONFIG_ARCH_OMAP1)
#define command_dvfs_stop(m) (0)
#define command_dvfs_start(m) (0)
#elif defined(CONFIG_ARCH_OMAP2)
#define command_dvfs_stop(m) \
(((m)->cmd_l == KFUNC_POWER) && ((m)->data == DVFS_STOP))
#define command_dvfs_start(m) \
(((m)->cmd_l == KFUNC_POWER) && ((m)->data == DVFS_START))
#endif
extern struct omap_dsp *omap_dsp;
#endif /* DRIVER_DSP_COMMON_H */ #endif /* DRIVER_DSP_COMMON_H */
...@@ -40,10 +40,7 @@ MODULE_AUTHOR("Toshihiro Kobayashi <toshihiro.kobayashi@nokia.com>"); ...@@ -40,10 +40,7 @@ MODULE_AUTHOR("Toshihiro Kobayashi <toshihiro.kobayashi@nokia.com>");
MODULE_DESCRIPTION("OMAP DSP driver module"); MODULE_DESCRIPTION("OMAP DSP driver module");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
struct device *dsp_device; struct omap_dsp *omap_dsp;
int dsp_mmu_irq;
struct omap_mbox *mbox_dsp;
static struct sync_seq *mbseq; static struct sync_seq *mbseq;
static u16 mbseq_expect_tmp; static u16 mbseq_expect_tmp;
static u16 *mbseq_expect = &mbseq_expect_tmp; static u16 *mbseq_expect = &mbseq_expect_tmp;
...@@ -134,6 +131,98 @@ const struct cmdinfo *cmdinfo[MBOX_CMD_MAX] = { ...@@ -134,6 +131,98 @@ 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)
{
struct dsp_kfunc_device *p;
int ret, fail = 0;
mutex_lock(&dsp->lock);
list_for_each_entry(p, dsp->kdev_list, entry) {
if (p->probe == NULL)
continue;
ret = p->probe(p);
if (ret) {
printk(KERN_ERR
"probing %s failed\n", p->name);
fail++;
}
}
mutex_unlock(&dsp->lock);
pr_debug("%s() fail:%d\n", __FUNCTION__, fail);
return fail;
}
static int dsp_kfunc_remove_devices(struct omap_dsp *dsp)
{
struct dsp_kfunc_device *p;
int ret, fail = 0;
mutex_lock(&dsp->lock);
list_for_each_entry_reverse(p, dsp->kdev_list, entry) {
if (p->remove == NULL)
continue;
ret = p->remove(p);
if (ret) {
printk(KERN_ERR
"removing %s failed\n", p->name);
fail++;
}
}
mutex_unlock(&dsp->lock);
pr_debug("%s() fail:%d\n", __FUNCTION__, fail);
return fail;
}
static int dsp_kfunc_enable_devices(struct omap_dsp *dsp, int type, int stage)
{
struct dsp_kfunc_device *p;
int ret, fail = 0;
mutex_lock(&dsp->lock);
list_for_each_entry(p, dsp->kdev_list, entry) {
if ((p->type != type) || (p->enable == NULL))
continue;
ret = p->enable(p, stage);
if (ret) {
printk(KERN_ERR
"enabling %s failed\n", p->name);
fail++;
}
}
mutex_unlock(&dsp->lock);
pr_debug("%s(%d) fail:%d\n", __FUNCTION__, type, fail);
return fail;
}
static int dsp_kfunc_disable_devices(struct omap_dsp *dsp, int type, int stage)
{
struct dsp_kfunc_device *p;
int ret, fail = 0;
mutex_lock(&dsp->lock);
list_for_each_entry_reverse(p, omap_dsp->kdev_list, entry) {
if ((p->type != type) || (p->disable == NULL))
continue;
ret = p->disable(p, stage);
if (ret) {
printk(KERN_ERR
"disabling %s failed\n", p->name);
fail++;
}
}
mutex_unlock(&dsp->lock);
pr_debug("%s(%d) fail:%d\n", __FUNCTION__, type, fail);
return fail;
}
int sync_with_dsp(u16 *adr, u16 val, int try_cnt) int sync_with_dsp(u16 *adr, u16 val, int try_cnt)
{ {
int try; int try;
...@@ -145,8 +234,7 @@ int sync_with_dsp(u16 *adr, u16 val, int try_cnt) ...@@ -145,8 +234,7 @@ int sync_with_dsp(u16 *adr, u16 val, int try_cnt)
udelay(1); udelay(1);
if (*(volatile u16 *)adr == val) { if (*(volatile u16 *)adr == val) {
/* success! */ /* success! */
printk(KERN_INFO pr_info("omapdsp: sync_with_dsp(): try = %d\n", try);
"omapdsp: sync_with_dsp(): try = %d\n", try);
return 0; return 0;
} }
} }
...@@ -189,6 +277,13 @@ int __dsp_mbcmd_send_exarg(struct mbcmd *mb, struct mb_exarg *arg, ...@@ -189,6 +277,13 @@ int __dsp_mbcmd_send_exarg(struct mbcmd *mb, struct mb_exarg *arg,
{ {
int ret = 0; int ret = 0;
if (unlikely(omap_dsp->enabled == 0)) {
ret = dsp_kfunc_enable_devices(omap_dsp,
DSP_KFUNC_DEV_TYPE_COMMON, 0);
if (ret == 0)
omap_dsp->enabled = 1;
}
/* /*
* while MMU fault is set, * while MMU fault is set,
* only recovery command can be executed * only recovery command can be executed
...@@ -203,7 +298,8 @@ int __dsp_mbcmd_send_exarg(struct mbcmd *mb, struct mb_exarg *arg, ...@@ -203,7 +298,8 @@ int __dsp_mbcmd_send_exarg(struct mbcmd *mb, struct mb_exarg *arg,
if (arg) if (arg)
dsp_mem_enable(ipbuf_sys_ad); dsp_mem_enable(ipbuf_sys_ad);
ret = omap_mbox_msg_send(mbox_dsp, *(mbox_msg_t *)mb, (void*)arg); ret = omap_mbox_msg_send(omap_dsp->mbox,
*(mbox_msg_t *)mb, (void*)arg);
if (ret) if (ret)
goto out; goto out;
...@@ -268,7 +364,7 @@ static int mbsync_hold_mem_active; ...@@ -268,7 +364,7 @@ static int mbsync_hold_mem_active;
void dsp_mbox_start(void) void dsp_mbox_start(void)
{ {
omap_mbox_init_seq(mbox_dsp); omap_mbox_init_seq(omap_dsp->mbox);
mbseq_expect_tmp = 0; mbseq_expect_tmp = 0;
} }
...@@ -308,22 +404,22 @@ int dsp_mbox_config(void *p) ...@@ -308,22 +404,22 @@ int dsp_mbox_config(void *p)
static int __init dsp_mbox_init(void) static int __init dsp_mbox_init(void)
{ {
mbox_dsp->mbox = omap_mbox_get("dsp"); omap_dsp->mbox = omap_mbox_get("dsp");
if (IS_ERR(mbox_dsp)) { 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;
} }
mbox_dsp->msg_receive_cb = mbcmd_receiver; omap_dsp->mbox->msg_receive_cb = mbcmd_receiver;
mbox_dsp->msg_sender_cb = mbcmd_sender_prepare; omap_dsp->mbox->msg_sender_cb = mbcmd_sender_prepare;
return 0; return 0;
} }
static void dsp_mbox_exit(void) static void dsp_mbox_exit(void)
{ {
mbox_dsp->msg_sender_cb = NULL; omap_dsp->mbox->msg_sender_cb = NULL;
mbox_dsp->msg_receive_cb = NULL; omap_dsp->mbox->msg_receive_cb = NULL;
if (mbsync_hold_mem_active) { if (mbsync_hold_mem_active) {
dsp_mem_disable((void *)daram_base); dsp_mem_disable((void *)daram_base);
...@@ -352,24 +448,52 @@ static void mbox_kfunc_fbctl(struct mbcmd *mb) ...@@ -352,24 +448,52 @@ static void mbox_kfunc_fbctl(struct mbcmd *mb)
} }
} }
static void mbox_kfunc_audio_pwr(unsigned short data) /*
* dspgw: KFUNC message handler
*/
static void mbox_kfunc_power(unsigned short data)
{ {
int ret = -1;
switch (data) { switch (data) {
case DVFS_START: /* ACK from DSP */
/* TBD */
break;
case AUDIO_PWR_UP: case AUDIO_PWR_UP:
omap_dsp_audio_pwr_up_request(0); ret = dsp_kfunc_enable_devices(omap_dsp,
/* send back ack */ DSP_KFUNC_DEV_TYPE_AUDIO, 0);
mbcompose_send(KFUNC, KFUNC_AUDIO_PWR, AUDIO_PWR_UP); if (ret == 0)
ret++;
break; break;
case AUDIO_PWR_DOWN1: case AUDIO_PWR_DOWN: /* == AUDIO_PWR_DOWN1 */
omap_dsp_audio_pwr_down_request(1); ret = dsp_kfunc_disable_devices(omap_dsp,
DSP_KFUNC_DEV_TYPE_AUDIO, 1);
break; break;
case AUDIO_PWR_DOWN2: case AUDIO_PWR_DOWN2:
omap_dsp_audio_pwr_down_request(2); ret = dsp_kfunc_disable_devices(omap_dsp,
DSP_KFUNC_DEV_TYPE_AUDIO, 2);
break;
case DSP_PWR_DOWN:
ret = dsp_kfunc_disable_devices(omap_dsp,
DSP_KFUNC_DEV_TYPE_COMMON, 0);
if (ret == 0)
omap_dsp->enabled = 0;
break; break;
default: default:
printk(KERN_ERR printk(KERN_ERR
"mailbox: Unknown AUDIO_PWR from DSP: 0x%04x\n", data); "mailbox: Unknown PWR from DSP: 0x%04x\n", data);
break;
} }
if (unlikely(ret < 0)) {
printk(KERN_ERR "mailbox: PWR(0x%04x) failed\n", data);
return;
}
if (likely(ret == 0))
return;
mbcompose_send(KFUNC, KFUNC_POWER, data);
} }
static void mbox_kfunc(struct mbcmd *mb) static void mbox_kfunc(struct mbcmd *mb)
...@@ -378,8 +502,8 @@ static void mbox_kfunc(struct mbcmd *mb) ...@@ -378,8 +502,8 @@ static void mbox_kfunc(struct mbcmd *mb)
case KFUNC_FBCTL: case KFUNC_FBCTL:
mbox_kfunc_fbctl(mb); mbox_kfunc_fbctl(mb);
break; break;
case KFUNC_AUDIO_PWR: case KFUNC_POWER:
mbox_kfunc_audio_pwr(mb->data); mbox_kfunc_power(mb->data);
break; break;
default: default:
printk(KERN_ERR printk(KERN_ERR
...@@ -404,14 +528,34 @@ extern void dsp_taskmod_exit(void); ...@@ -404,14 +528,34 @@ extern void dsp_taskmod_exit(void);
static int __init dsp_drv_probe(struct platform_device *pdev) static int __init dsp_drv_probe(struct platform_device *pdev)
{ {
int ret; int ret;
struct omap_dsp *info;
struct dsp_platform_data *pdata = pdev->dev.platform_data;
dev_info(&pdev->dev, "OMAP DSP driver initialization\n"); dev_info(&pdev->dev, "OMAP DSP driver initialization\n");
dsp_device = &pdev->dev; info = kzalloc(sizeof(struct omap_dsp), GFP_KERNEL);
if (unlikely(info == NULL)) {
dev_dbg(&pdev->dev, "no memory for info\n");
return -ENOMEM;
}
platform_set_drvdata(pdev, info);
omap_dsp = info;
dsp_mmu_irq = platform_get_irq_byname(pdev, "dsp_mmu"); mutex_init(&info->lock);
if (dsp_mmu_irq < 0) info->dev = &pdev->dev;
return -ENXIO; info->kdev_list = &pdata->kdev_list;
ret = dsp_kfunc_probe_devices(info);
if (ret) {
ret = -ENXIO;
goto fail0;
}
info->mmu_irq = platform_get_irq_byname(pdev, "dsp_mmu");
if (unlikely(info->mmu_irq) < 0) {
ret = -ENXIO;
goto fail1;
}
#ifdef CONFIG_ARCH_OMAP2 #ifdef CONFIG_ARCH_OMAP2
clk_enable(dsp_fck_handle); clk_enable(dsp_fck_handle);
...@@ -420,37 +564,44 @@ static int __init dsp_drv_probe(struct platform_device *pdev) ...@@ -420,37 +564,44 @@ static int __init dsp_drv_probe(struct platform_device *pdev)
#endif #endif
if ((ret = dsp_ctl_core_init()) < 0) if ((ret = dsp_ctl_core_init()) < 0)
goto fail1;
if ((ret = dsp_mem_init()) < 0)
goto fail2; goto fail2;
if ((ret = dsp_mem_init()) < 0)
goto fail3;
dsp_ctl_init(); dsp_ctl_init();
mblog_init(); mblog_init();
if ((ret = dsp_taskmod_init()) < 0) if ((ret = dsp_taskmod_init()) < 0)
goto fail3;
if ((ret = dsp_mbox_init()) < 0)
goto fail4; goto fail4;
if ((ret = dsp_mbox_init()) < 0)
goto fail5;
return 0; return 0;
fail4: fail5:
dsp_taskmod_exit(); dsp_taskmod_exit();
fail3: fail4:
mblog_exit(); mblog_exit();
dsp_ctl_exit(); dsp_ctl_exit();
dsp_mem_exit(); dsp_mem_exit();
fail2: fail3:
dsp_ctl_core_exit(); dsp_ctl_core_exit();
fail1: fail2:
#ifdef CONFIG_ARCH_OMAP2 #ifdef CONFIG_ARCH_OMAP2
__dsp_per_disable(); __dsp_per_disable();
clk_disable(dsp_ick_handle); clk_disable(dsp_ick_handle);
clk_disable(dsp_fck_handle); clk_disable(dsp_fck_handle);
#endif #endif
fail1:
dsp_kfunc_remove_devices(info);
fail0:
kfree(info);
return ret; return ret;
} }
static int dsp_drv_remove(struct platform_device *pdev) static int dsp_drv_remove(struct platform_device *pdev)
{ {
struct omap_dsp *info = platform_get_drvdata(pdev);
dsp_cpustat_request(CPUSTAT_RESET); dsp_cpustat_request(CPUSTAT_RESET);
dsp_cfgstat_request(CFGSTAT_CLEAN); dsp_cfgstat_request(CFGSTAT_CLEAN);
...@@ -467,6 +618,9 @@ static int dsp_drv_remove(struct platform_device *pdev) ...@@ -467,6 +618,9 @@ static int dsp_drv_remove(struct platform_device *pdev)
clk_disable(dsp_ick_handle); clk_disable(dsp_ick_handle);
clk_disable(dsp_fck_handle); clk_disable(dsp_fck_handle);
#endif #endif
dsp_kfunc_remove_devices(info);
kfree(info);
return 0; return 0;
} }
......
...@@ -273,7 +273,7 @@ static int dsp_cfg(void) ...@@ -273,7 +273,7 @@ static int dsp_cfg(void)
goto out; goto out;
/* create runtime sysfs entries */ /* create runtime sysfs entries */
device_create_file(dsp_device, &dev_attr_loadinfo); device_create_file(omap_dsp->dev, &dev_attr_loadinfo);
out: out:
dsp_mem_disable((void *)dspmem_base); dsp_mem_disable((void *)dspmem_base);
...@@ -290,7 +290,7 @@ static int dsp_uncfg(void) ...@@ -290,7 +290,7 @@ static int dsp_uncfg(void)
/* FIXME: lock task module */ /* FIXME: lock task module */
/* remove runtime sysfs entries */ /* remove runtime sysfs entries */
device_remove_file(dsp_device, &dev_attr_loadinfo); device_remove_file(omap_dsp->dev, &dev_attr_loadinfo);
dsp_mbox_stop(); dsp_mbox_stop();
dsp_twch_stop(); dsp_twch_stop();
...@@ -1038,14 +1038,14 @@ out: ...@@ -1038,14 +1038,14 @@ out:
void __init dsp_ctl_init(void) void __init dsp_ctl_init(void)
{ {
device_create_file(dsp_device, &dev_attr_ifver); device_create_file(omap_dsp->dev, &dev_attr_ifver);
device_create_file(dsp_device, &dev_attr_cpustat); device_create_file(omap_dsp->dev, &dev_attr_cpustat);
device_create_file(dsp_device, &dev_attr_icrmask); device_create_file(omap_dsp->dev, &dev_attr_icrmask);
} }
void dsp_ctl_exit(void) void dsp_ctl_exit(void)
{ {
device_remove_file(dsp_device, &dev_attr_ifver); device_remove_file(omap_dsp->dev, &dev_attr_ifver);
device_remove_file(dsp_device, &dev_attr_cpustat); device_remove_file(omap_dsp->dev, &dev_attr_cpustat);
device_remove_file(dsp_device, &dev_attr_icrmask); device_remove_file(omap_dsp->dev, &dev_attr_icrmask);
} }
...@@ -70,15 +70,21 @@ ...@@ -70,15 +70,21 @@
#define PM_ENABLE 0x01 #define PM_ENABLE 0x01
#define KFUNC_FBCTL 0x00 #define KFUNC_FBCTL 0x00
#define KFUNC_AUDIO_PWR 0x01 #define KFUNC_POWER 0x01
#define FBCTL_UPD 0x0000 #define FBCTL_UPD 0x0000
#define FBCTL_ENABLE 0x0002 #define FBCTL_ENABLE 0x0002
#define FBCTL_DISABLE 0x0003 #define FBCTL_DISABLE 0x0003
#define AUDIO_PWR_UP 0x0000 /* KFUNC_POWER */
#define AUDIO_PWR_DOWN1 0x0001 #define AUDIO_PWR_UP 0x0000 /* ARM(exe/ack) <-> DSP(req) */
#define AUDIO_PWR_DOWN 0x0001 /* ARM(exe) <- DSP(req) */
#define AUDIO_PWR_DOWN1 AUDIO_PWR_DOWN
#define AUDIO_PWR_DOWN2 0x0002 #define AUDIO_PWR_DOWN2 0x0002
#define DSP_PWR_UP 0x0003 /* ARM(exe/snd) -> DSP(exe) */
#define DSP_PWR_DOWN 0x0004 /* ARM(exe) <- DSP(req) */
#define DVFS_START 0x0006 /* ARM(req) <-> DSP(exe/ack)*/
#define DVFS_STOP 0x0007 /* ARM(req) -> DSP(exe) */
#define TDEL_SAFE 0x0000 #define TDEL_SAFE 0x0000
#define TDEL_KILL 0x0001 #define TDEL_KILL 0x0001
......
...@@ -2313,7 +2313,7 @@ static void do_mmu_int(void) ...@@ -2313,7 +2313,7 @@ static void do_mmu_int(void)
printk(KERN_DEBUG "fault address = %#08x\n", printk(KERN_DEBUG "fault address = %#08x\n",
dsp_fault_adr); dsp_fault_adr);
} }
enable_irq(dsp_mmu_irq); enable_irq(omap_dsp->mmu_irq);
return; return;
} }
...@@ -2408,7 +2408,7 @@ static void do_mmu_int(void) ...@@ -2408,7 +2408,7 @@ static void do_mmu_int(void)
dsp_mmu_enable(); dsp_mmu_enable();
#endif #endif
enable_irq(dsp_mmu_irq); enable_irq(omap_dsp->mmu_irq);
} }
static DECLARE_WORK(mmu_int_work, (void (*)(void *))do_mmu_int, NULL); static DECLARE_WORK(mmu_int_work, (void (*)(void *))do_mmu_int, NULL);
...@@ -2420,7 +2420,7 @@ static DECLARE_WORK(mmu_int_work, (void (*)(void *))do_mmu_int, NULL); ...@@ -2420,7 +2420,7 @@ static DECLARE_WORK(mmu_int_work, (void (*)(void *))do_mmu_int, NULL);
static irqreturn_t dsp_mmu_interrupt(int irq, void *dev_id, static irqreturn_t dsp_mmu_interrupt(int irq, void *dev_id,
struct pt_regs *regs) struct pt_regs *regs)
{ {
disable_irq(dsp_mmu_irq); disable_irq(omap_dsp->mmu_irq);
schedule_work(&mmu_int_work); schedule_work(&mmu_int_work);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -2490,7 +2490,7 @@ int __init dsp_mem_init(void) ...@@ -2490,7 +2490,7 @@ int __init dsp_mem_init(void)
/* /*
* DSP MMU interrupt setup * DSP MMU interrupt setup
*/ */
ret = request_irq(dsp_mmu_irq, dsp_mmu_interrupt, SA_INTERRUPT, ret = request_irq(omap_dsp->mmu_irq, dsp_mmu_interrupt, SA_INTERRUPT,
"dsp_mmu", &devid_mmu); "dsp_mmu", &devid_mmu);
if (ret) { if (ret) {
printk(KERN_ERR printk(KERN_ERR
...@@ -2499,11 +2499,11 @@ int __init dsp_mem_init(void) ...@@ -2499,11 +2499,11 @@ int __init dsp_mem_init(void)
} }
/* MMU interrupt is not enabled until DSP runs */ /* MMU interrupt is not enabled until DSP runs */
disable_irq(dsp_mmu_irq); disable_irq(omap_dsp->mmu_irq);
device_create_file(dsp_device, &dev_attr_mmu); device_create_file(omap_dsp->dev, &dev_attr_mmu);
device_create_file(dsp_device, &dev_attr_exmap); device_create_file(omap_dsp->dev, &dev_attr_exmap);
device_create_file(dsp_device, &dev_attr_mempool); device_create_file(omap_dsp->dev, &dev_attr_mempool);
return 0; return 0;
...@@ -2519,10 +2519,10 @@ fail: ...@@ -2519,10 +2519,10 @@ fail:
void dsp_mem_exit(void) void dsp_mem_exit(void)
{ {
free_irq(dsp_mmu_irq, &devid_mmu); free_irq(omap_dsp->mmu_irq, &devid_mmu);
/* recover disable_depth */ /* recover disable_depth */
enable_irq(dsp_mmu_irq); enable_irq(omap_dsp->mmu_irq);
#ifdef CONFIG_ARCH_OMAP1 #ifdef CONFIG_ARCH_OMAP1
dsp_reset_idle_boot_base(); dsp_reset_idle_boot_base();
...@@ -2535,7 +2535,7 @@ void dsp_mem_exit(void) ...@@ -2535,7 +2535,7 @@ void dsp_mem_exit(void)
dspvect_page = NULL; dspvect_page = NULL;
} }
device_remove_file(dsp_device, &dev_attr_mmu); device_remove_file(omap_dsp->dev, &dev_attr_mmu);
device_remove_file(dsp_device, &dev_attr_exmap); device_remove_file(omap_dsp->dev, &dev_attr_exmap);
device_remove_file(dsp_device, &dev_attr_mempool); device_remove_file(omap_dsp->dev, &dev_attr_mempool);
} }
...@@ -105,13 +105,13 @@ struct file_operations dsp_err_fops = { ...@@ -105,13 +105,13 @@ struct file_operations dsp_err_fops = {
/* DSP MMU */ /* DSP MMU */
static void dsp_err_mmu_set(unsigned long arg) static void dsp_err_mmu_set(unsigned long arg)
{ {
disable_irq(dsp_mmu_irq); disable_irq(omap_dsp->mmu_irq);
mmu_fadr = (u32)arg; mmu_fadr = (u32)arg;
} }
static void dsp_err_mmu_clr(void) static void dsp_err_mmu_clr(void)
{ {
enable_irq(dsp_mmu_irq); enable_irq(omap_dsp->mmu_irq);
} }
/* WDT */ /* WDT */
......
...@@ -42,7 +42,7 @@ void ipbuf_stop(void) ...@@ -42,7 +42,7 @@ void ipbuf_stop(void)
{ {
int i; int i;
device_remove_file(dsp_device, &dev_attr_ipbuf); device_remove_file(omap_dsp->dev, &dev_attr_ipbuf);
spin_lock(&ipb_free.lock); spin_lock(&ipb_free.lock);
RESET_IPBLINK(&ipb_free); RESET_IPBLINK(&ipb_free);
...@@ -116,7 +116,7 @@ int ipbuf_config(u16 ln, u16 lsz, void *base) ...@@ -116,7 +116,7 @@ int ipbuf_config(u16 ln, u16 lsz, void *base)
" %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);
device_create_file(dsp_device, &dev_attr_ipbuf); device_create_file(omap_dsp->dev, &dev_attr_ipbuf);
return ret; return ret;
......
...@@ -61,18 +61,18 @@ struct ipbuf_head { ...@@ -61,18 +61,18 @@ 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) \
do { \ do { \
disable_mbox_irq(mbox_dsp); \ disable_irq(omap_dsp->mbox->irq); \
(ipbcfg)->bsycnt++; \ (ipbcfg)->bsycnt++; \
enable_mbox_irq(mbox_dsp); \ enable_irq(omap_dsp->mbox->irq); \
} while(0) } while(0)
#define ipb_bsycnt_dec(ipbcfg) \ #define ipb_bsycnt_dec(ipbcfg) \
do { \ do { \
disable_mbox_irq(mbox_dsp); \ disable_irq(omap_dsp->mbox->irq); \
(ipbcfg)->bsycnt--; \ (ipbcfg)->bsycnt--; \
enable_mbox_irq(mbox_dsp); \ enable_irq(omap_dsp->mbox->irq); \
} while(0) } while(0)
#define dsp_mem_enable_ipbuf() dsp_mem_enable(ipbcfg.base) #define dsp_mem_enable_ipbuf() dsp_mem_enable(ipbcfg.base)
...@@ -84,7 +84,7 @@ struct ipblink { ...@@ -84,7 +84,7 @@ struct ipblink {
u16 tail; u16 tail;
}; };
#define IPBLINK_INIT { \ #define IPBLINK_INIT { \
.lock = SPIN_LOCK_UNLOCKED, \ .lock = SPIN_LOCK_UNLOCKED, \
.top = BID_NULL, \ .top = BID_NULL, \
.tail = BID_NULL, \ .tail = BID_NULL, \
......
...@@ -47,6 +47,7 @@ char *subcmd_name(struct mbcmd *mb) ...@@ -47,6 +47,7 @@ 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":
NULL; NULL;
break; break;
case MBOX_CMD_DSP_DSPCFG: case MBOX_CMD_DSP_DSPCFG:
...@@ -259,10 +260,10 @@ static struct device_attribute dev_attr_mblog = __ATTR_RO(mblog); ...@@ -259,10 +260,10 @@ static struct device_attribute dev_attr_mblog = __ATTR_RO(mblog);
void __init mblog_init(void) void __init mblog_init(void)
{ {
device_create_file(dsp_device, &dev_attr_mblog); device_create_file(omap_dsp->dev, &dev_attr_mblog);
} }
void mblog_exit(void) void mblog_exit(void)
{ {
device_remove_file(dsp_device, &dev_attr_mblog); device_remove_file(omap_dsp->dev, &dev_attr_mblog);
} }
...@@ -1811,7 +1811,7 @@ static int taskdev_init(struct taskdev *dev, char *name, unsigned char minor) ...@@ -1811,7 +1811,7 @@ static int taskdev_init(struct taskdev *dev, char *name, unsigned char minor)
mutex_init(&dev->usecount_lock); mutex_init(&dev->usecount_lock);
memcpy(&dev->fops, &dsp_task_fops, sizeof(struct file_operations)); memcpy(&dev->fops, &dsp_task_fops, sizeof(struct file_operations));
dev->dev.parent = dsp_device; dev->dev.parent = omap_dsp->dev;
dev->dev.bus = &dsptask_bus; dev->dev.bus = &dsptask_bus;
sprintf(dev->dev.bus_id, "dsptask%d", minor); sprintf(dev->dev.bus_id, "dsptask%d", minor);
dev->dev.release = dsptask_dev_release; dev->dev.release = dsptask_dev_release;
......
...@@ -31,7 +31,4 @@ extern int omap_dsp_request_mem(void); ...@@ -31,7 +31,4 @@ extern int omap_dsp_request_mem(void);
extern int omap_dsp_release_mem(void); extern int omap_dsp_release_mem(void);
#endif #endif
extern void (*omap_dsp_audio_pwr_up_request)(int stage);
extern void (*omap_dsp_audio_pwr_down_request)(int stage);
#endif /* ASM_ARCH_DSP_COMMON_H */ #endif /* ASM_ARCH_DSP_COMMON_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