Commit 48fb11a2 authored by Hiroshi DOYU's avatar Hiroshi DOYU Committed by Juha Yrjola

ARM: OMAP: DSPGW: Use device model

- use device model for IRQ detection.
- use "dsp_device" as a pointer for "struct device"
- some whitespaces are cleaned up.
Signed-off-by: default avatarHiroshi DOYU <Hiroshi.DOYU@nokia.com>
Signed-off-by: default avatarJuha Yrjola <juha.yrjola@solidboot.com>
parent bd08e6b1
......@@ -25,7 +25,51 @@
#include <asm/arch/gpio.h>
#include <asm/arch/menelaus.h>
#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
#include "../plat-omap/dsp/dsp_common.h"
static struct resource omap_dsp_resources[] = {
{
.name = "dsp_mmu",
.start = -1,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device omap_dsp_device = {
.name = "dsp",
.id = -1,
.num_resources = ARRAY_SIZE(omap_dsp_resources),
.resource = omap_dsp_resources,
};
static inline void omap_init_dsp(void)
{
struct resource *res;
int irq;
if (cpu_is_omap15xx())
irq = INT_1510_DSP_MMU;
else if (cpu_is_omap16xx())
irq = INT_1610_DSP_MMU;
else if (cpu_is_omap24xx())
irq = INT_24XX_DSP_MMU;
res = platform_get_resource_byname(&omap_dsp_device,
IORESOURCE_IRQ, "dsp_mmu");
res->start = irq;
platform_device_register(&omap_dsp_device);
}
#else
static inline void omap_init_dsp(void) { }
#endif
/*-------------------------------------------------------------------------*/
#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
#define OMAP1_I2C_BASE 0xfffb3800
#define OMAP2_I2C_BASE1 0x48070000
......@@ -48,8 +92,8 @@ static struct resource i2c_resources1[] = {
/* DMA not used; works around erratum writing to non-empty i2c fifo */
static struct platform_device omap_i2c_device1 = {
.name = "i2c_omap",
.id = 1,
.name = "i2c_omap",
.id = 1,
.num_resources = ARRAY_SIZE(i2c_resources1),
.resource = i2c_resources1,
};
......@@ -432,6 +476,7 @@ static int __init omap_init_devices(void)
/* please keep these calls, and their implementations above,
* in alphabetical order so they're easier to sort through.
*/
omap_init_dsp();
omap_init_i2c();
omap_init_kp();
omap_init_mmc();
......@@ -442,4 +487,3 @@ static int __init omap_init_devices(void)
return 0;
}
arch_initcall(omap_init_devices);
......@@ -241,4 +241,4 @@ extern char *subcmd_name(struct mbcmd *mb);
extern void mblog_add(struct mbcmd *mb, arm_dsp_dir_t dir);
extern struct platform_device dsp_device;
extern struct device *dsp_device;
......@@ -373,7 +373,7 @@ static void dsp_cpustat_update(void)
__dsp_core_enable();
#endif
cpustat.stat = CPUSTAT_RUN;
enable_irq(INT_DSP_MMU);
enable_irq(dsp_mmu_irq);
}
return;
}
......@@ -381,7 +381,7 @@ static void dsp_cpustat_update(void)
/* cpustat.req < CPUSTAT_RUN */
if (cpustat.stat == CPUSTAT_RUN) {
disable_irq(INT_DSP_MMU);
disable_irq(dsp_mmu_irq);
#ifdef CONFIG_ARCH_OMAP1
clk_disable(api_ck_handle);
#endif
......
......@@ -39,14 +39,6 @@
#define omap_set_bits_regl(val,mask,r) \
do { omap_writel((omap_readl(r) & ~(mask)) | (val), (r)); } while(0)
#if defined(CONFIG_ARCH_OMAP15XX)
#define INT_DSP_MMU INT_1510_DSP_MMU
#elif defined(CONFIG_ARCH_OMAP16XX)
#define INT_DSP_MMU INT_1610_DSP_MMU
#elif defined(CONFIG_ARCH_OMAP24XX)
#define INT_DSP_MMU INT_24XX_DSP_MMU
#endif
#define dspword_to_virt(dw) ((void *)(dspmem_base + ((dw) << 1)))
#define dspbyte_to_virt(db) ((void *)(dspmem_base + (db)))
#define virt_to_dspword(va) \
......@@ -166,4 +158,6 @@ static inline void dsp_clk_autoidle(void)
}
#endif
extern int dsp_mmu_irq;
#endif /* DRIVER_DSP_COMMON_H */
......@@ -40,6 +40,9 @@ MODULE_AUTHOR("Toshihiro Kobayashi <toshihiro.kobayashi@nokia.com>");
MODULE_DESCRIPTION("OMAP DSP driver module");
MODULE_LICENSE("GPL");
struct device *dsp_device;
int dsp_mmu_irq;
struct omap_mbox *mbox_dsp;
static struct sync_seq *mbseq;
static u16 mbseq_expect_tmp;
......@@ -390,13 +393,6 @@ extern void mblog_exit(void);
extern int dsp_taskmod_init(void);
extern void dsp_taskmod_exit(void);
/*
* device functions
*/
static void dsp_dev_release(struct device *dev)
{
}
/*
* driver functions
*/
......@@ -404,7 +400,14 @@ static int __init dsp_drv_probe(struct platform_device *pdev)
{
int ret;
printk(KERN_INFO "OMAP DSP driver initialization\n");
dev_info(&pdev->dev, "OMAP DSP driver initialization\n");
dsp_device = &pdev->dev;
dsp_mmu_irq = platform_get_irq_byname(pdev, "dsp_mmu");
if (dsp_mmu_irq < 0)
return -ENXIO;
#ifdef CONFIG_ARCH_OMAP2
clk_enable(dsp_fck_handle);
clk_enable(dsp_ick_handle);
......@@ -481,23 +484,6 @@ static int dsp_drv_resume(struct platform_device *pdev)
#define dsp_drv_resume NULL
#endif /* CONFIG_PM */
static struct resource dsp_resources[] = {
{
.start = INT_DSP_MMU,
.flags = IORESOURCE_IRQ,
},
};
struct platform_device dsp_device = {
.name = "dsp",
.id = -1,
.dev = {
.release = dsp_dev_release,
},
.num_resources = ARRAY_SIZE(&dsp_resources),
.resource = dsp_resources,
};
static struct platform_driver dsp_driver = {
.probe = dsp_drv_probe,
.remove = dsp_drv_remove,
......@@ -510,38 +496,12 @@ static struct platform_driver dsp_driver = {
static int __init omap_dsp_mod_init(void)
{
int ret;
mbox_dsp = mbox_get("DSP");
if (IS_ERR(mbox_dsp)) {
printk(KERN_ERR "failed to get mailbox handler for DSP.\n");
goto fail1;
}
ret = platform_device_register(&dsp_device);
if (ret) {
printk(KERN_ERR "failed to register the DSP device: %d\n", ret);
goto fail1;
}
ret = platform_driver_register(&dsp_driver);
if (ret) {
printk(KERN_ERR "failed to register the DSP driver: %d\n", ret);
goto fail2;
}
return 0;
fail2:
platform_device_unregister(&dsp_device);
fail1:
return -ENODEV;
return platform_driver_register(&dsp_driver);
}
static void __exit omap_dsp_mod_exit(void)
{
platform_driver_unregister(&dsp_driver);
platform_device_unregister(&dsp_device);
}
module_init(omap_dsp_mod_init);
......
......@@ -273,7 +273,7 @@ static int dsp_cfg(void)
goto out;
/* create runtime sysfs entries */
device_create_file(&dsp_device.dev, &dev_attr_loadinfo);
device_create_file(dsp_device, &dev_attr_loadinfo);
out:
dsp_mem_disable((void *)dspmem_base);
......@@ -290,7 +290,7 @@ static int dsp_uncfg(void)
/* FIXME: lock task module */
/* remove runtime sysfs entries */
device_remove_file(&dsp_device.dev, &dev_attr_loadinfo);
device_remove_file(dsp_device, &dev_attr_loadinfo);
dsp_mbox_stop();
dsp_twch_stop();
......@@ -1038,14 +1038,14 @@ out:
void __init dsp_ctl_init(void)
{
device_create_file(&dsp_device.dev, &dev_attr_ifver);
device_create_file(&dsp_device.dev, &dev_attr_cpustat);
device_create_file(&dsp_device.dev, &dev_attr_icrmask);
device_create_file(dsp_device, &dev_attr_ifver);
device_create_file(dsp_device, &dev_attr_cpustat);
device_create_file(dsp_device, &dev_attr_icrmask);
}
void dsp_ctl_exit(void)
{
device_remove_file(&dsp_device.dev, &dev_attr_ifver);
device_remove_file(&dsp_device.dev, &dev_attr_cpustat);
device_remove_file(&dsp_device.dev, &dev_attr_icrmask);
device_remove_file(dsp_device, &dev_attr_ifver);
device_remove_file(dsp_device, &dev_attr_cpustat);
device_remove_file(dsp_device, &dev_attr_icrmask);
}
......@@ -2313,7 +2313,7 @@ static void do_mmu_int(void)
printk(KERN_DEBUG "fault address = %#08x\n",
dsp_fault_adr);
}
enable_irq(INT_DSP_MMU);
enable_irq(dsp_mmu_irq);
return;
}
......@@ -2408,7 +2408,7 @@ static void do_mmu_int(void)
dsp_mmu_enable();
#endif
enable_irq(INT_DSP_MMU);
enable_irq(dsp_mmu_irq);
}
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,
struct pt_regs *regs)
{
disable_irq(INT_DSP_MMU);
disable_irq(dsp_mmu_irq);
schedule_work(&mmu_int_work);
return IRQ_HANDLED;
}
......@@ -2490,8 +2490,8 @@ int __init dsp_mem_init(void)
/*
* DSP MMU interrupt setup
*/
ret = request_irq(INT_DSP_MMU, dsp_mmu_interrupt, SA_INTERRUPT, "dsp",
&devid_mmu);
ret = request_irq(dsp_mmu_irq, dsp_mmu_interrupt, SA_INTERRUPT,
"dsp_mmu", &devid_mmu);
if (ret) {
printk(KERN_ERR
"failed to register DSP MMU interrupt: %d\n", ret);
......@@ -2499,11 +2499,11 @@ int __init dsp_mem_init(void)
}
/* MMU interrupt is not enabled until DSP runs */
disable_irq(INT_DSP_MMU);
disable_irq(dsp_mmu_irq);
device_create_file(&dsp_device.dev, &dev_attr_mmu);
device_create_file(&dsp_device.dev, &dev_attr_exmap);
device_create_file(&dsp_device.dev, &dev_attr_mempool);
device_create_file(dsp_device, &dev_attr_mmu);
device_create_file(dsp_device, &dev_attr_exmap);
device_create_file(dsp_device, &dev_attr_mempool);
return 0;
......@@ -2519,10 +2519,10 @@ fail:
void dsp_mem_exit(void)
{
free_irq(INT_DSP_MMU, &devid_mmu);
free_irq(dsp_mmu_irq, &devid_mmu);
/* recover disable_depth */
enable_irq(INT_DSP_MMU);
enable_irq(dsp_mmu_irq);
#ifdef CONFIG_ARCH_OMAP1
dsp_reset_idle_boot_base();
......@@ -2535,7 +2535,7 @@ void dsp_mem_exit(void)
dspvect_page = NULL;
}
device_remove_file(&dsp_device.dev, &dev_attr_mmu);
device_remove_file(&dsp_device.dev, &dev_attr_exmap);
device_remove_file(&dsp_device.dev, &dev_attr_mempool);
device_remove_file(dsp_device, &dev_attr_mmu);
device_remove_file(dsp_device, &dev_attr_exmap);
device_remove_file(dsp_device, &dev_attr_mempool);
}
......@@ -105,13 +105,13 @@ struct file_operations dsp_err_fops = {
/* DSP MMU */
static void dsp_err_mmu_set(unsigned long arg)
{
disable_irq(INT_DSP_MMU);
disable_irq(dsp_mmu_irq);
mmu_fadr = (u32)arg;
}
static void dsp_err_mmu_clr(void)
{
enable_irq(INT_DSP_MMU);
enable_irq(dsp_mmu_irq);
}
/* WDT */
......
......@@ -42,7 +42,7 @@ void ipbuf_stop(void)
{
int i;
device_remove_file(&dsp_device.dev, &dev_attr_ipbuf);
device_remove_file(dsp_device, &dev_attr_ipbuf);
spin_lock(&ipb_free.lock);
RESET_IPBLINK(&ipb_free);
......@@ -116,7 +116,7 @@ int ipbuf_config(u16 ln, u16 lsz, void *base)
" %d words * %d lines at 0x%p.\n",
ipbcfg.lsz, ipbcfg.ln, ipbcfg.base);
device_create_file(&dsp_device.dev, &dev_attr_ipbuf);
device_create_file(dsp_device, &dev_attr_ipbuf);
return ret;
......
......@@ -259,10 +259,10 @@ static struct device_attribute dev_attr_mblog = __ATTR_RO(mblog);
void __init mblog_init(void)
{
device_create_file(&dsp_device.dev, &dev_attr_mblog);
device_create_file(dsp_device, &dev_attr_mblog);
}
void mblog_exit(void)
{
device_remove_file(&dsp_device.dev, &dev_attr_mblog);
device_remove_file(dsp_device, &dev_attr_mblog);
}
......@@ -1811,7 +1811,7 @@ static int taskdev_init(struct taskdev *dev, char *name, unsigned char minor)
mutex_init(&dev->usecount_lock);
memcpy(&dev->fops, &dsp_task_fops, sizeof(struct file_operations));
dev->dev.parent = &dsp_device.dev;
dev->dev.parent = dsp_device;
dev->dev.bus = &dsptask_bus;
sprintf(dev->dev.bus_id, "dsptask%d", minor);
dev->dev.release = dsptask_dev_release;
......
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