- use device model for IRQ detection.
- use "dsp_device" as a pointer for "struct device"
- some whitespaces are cleaned up.
Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Signed-off-by: Juha Yrjola <juha.yrjola@solidboot.com>
#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
/* 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,
};
/* 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();
return 0;
}
arch_initcall(omap_init_devices);
-
extern void mblog_add(struct mbcmd *mb, arm_dsp_dir_t dir);
-extern struct platform_device dsp_device;
+extern struct device *dsp_device;
__dsp_core_enable();
#endif
cpustat.stat = CPUSTAT_RUN;
- enable_irq(INT_DSP_MMU);
+ enable_irq(dsp_mmu_irq);
}
return;
}
/* 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
#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) \
}
#endif
+extern int dsp_mmu_irq;
+
#endif /* DRIVER_DSP_COMMON_H */
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;
extern int dsp_taskmod_init(void);
extern void dsp_taskmod_exit(void);
-/*
- * device functions
- */
-static void dsp_dev_release(struct device *dev)
-{
-}
-
/*
* driver functions
*/
{
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);
#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,
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);
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);
/* 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();
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);
}
printk(KERN_DEBUG "fault address = %#08x\n",
dsp_fault_adr);
}
- enable_irq(INT_DSP_MMU);
+ enable_irq(dsp_mmu_irq);
return;
}
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);
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;
}
/*
* 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);
}
/* 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;
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();
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);
}
/* 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 */
{
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);
" %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;
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);
}
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;