Loading arch/arm/mach-omap1/mailbox.c +21 −34 Original line number Diff line number Diff line /* * Mailbox reservation modules for DSP * Mailbox reservation modules for OMAP1 * * Copyright (C) 2006-2009 Nokia Corporation * Written by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com> Loading @@ -9,13 +9,10 @@ * for more details. */ #include <linux/kernel.h> #include <linux/resource.h> #include <linux/interrupt.h> #include <linux/platform_device.h> #include <linux/io.h> #include <plat/mailbox.h> #include <mach/irqs.h> #define MAILBOX_ARM2DSP1 0x00 #define MAILBOX_ARM2DSP1b 0x04 Loading Loading @@ -83,7 +80,7 @@ static int omap1_mbox_fifo_full(struct omap_mbox *mbox) struct omap_mbox1_fifo *fifo = &((struct omap_mbox1_priv *)mbox->priv)->rx_fifo; return (mbox_read_reg(fifo->flag)); return mbox_read_reg(fifo->flag); } /* irq */ Loading Loading @@ -141,47 +138,37 @@ struct omap_mbox mbox_dsp_info = { .ops = &omap1_mbox_ops, .priv = &omap1_mbox_dsp_priv, }; EXPORT_SYMBOL(mbox_dsp_info); struct omap_mbox *omap1_mboxes[] = { &mbox_dsp_info, NULL }; static int __devinit omap1_mbox_probe(struct platform_device *pdev) { struct resource *res; if (pdev->num_resources != 2) { dev_err(&pdev->dev, "invalid number of resources: %d\n", pdev->num_resources); return -ENODEV; } struct resource *mem; int ret; int i; struct omap_mbox **list; /* MBOX base */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (unlikely(!res)) { dev_err(&pdev->dev, "invalid mem resource\n"); return -ENODEV; } list = omap1_mboxes; list[0]->irq = platform_get_irq_byname(pdev, "dsp"); mbox_base = ioremap(res->start, resource_size(res)); if (!mbox_base) { dev_err(&pdev->dev, "ioremap failed\n"); return -ENODEV; } mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); mbox_base = ioremap(mem->start, resource_size(mem)); if (!mbox_base) return -ENOMEM; /* DSP IRQ */ res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (unlikely(!res)) { dev_err(&pdev->dev, "invalid irq resource\n"); ret = omap_mbox_register(&pdev->dev, list); if (ret) { iounmap(mbox_base); return -ENODEV; return ret; } mbox_dsp_info.irq = res->start; return omap_mbox_register(&pdev->dev, &mbox_dsp_info); return 0; } static int __devexit omap1_mbox_remove(struct platform_device *pdev) { omap_mbox_unregister(&mbox_dsp_info); omap_mbox_unregister(); iounmap(mbox_base); return 0; } Loading @@ -189,7 +176,7 @@ static struct platform_driver omap1_mbox_driver = { .probe = omap1_mbox_probe, .remove = __devexit_p(omap1_mbox_remove), .driver = { .name = "omap1-mailbox", .name = "omap-mailbox", }, }; Loading arch/arm/mach-omap2/devices.c +5 −1 Original line number Diff line number Diff line Loading @@ -152,10 +152,12 @@ static struct resource omap2_mbox_resources[] = { { .start = INT_24XX_MAIL_U0_MPU, .flags = IORESOURCE_IRQ, .name = "dsp", }, { .start = INT_24XX_MAIL_U3_MPU, .flags = IORESOURCE_IRQ, .name = "iva", }, }; static int omap2_mbox_resources_sz = ARRAY_SIZE(omap2_mbox_resources); Loading @@ -174,6 +176,7 @@ static struct resource omap3_mbox_resources[] = { { .start = INT_24XX_MAIL_U0_MPU, .flags = IORESOURCE_IRQ, .name = "dsp", }, }; static int omap3_mbox_resources_sz = ARRAY_SIZE(omap3_mbox_resources); Loading @@ -195,6 +198,7 @@ static struct resource omap4_mbox_resources[] = { { .start = OMAP44XX_IRQ_MAIL_U0, .flags = IORESOURCE_IRQ, .name = "mbox", }, }; static int omap4_mbox_resources_sz = ARRAY_SIZE(omap4_mbox_resources); Loading @@ -204,7 +208,7 @@ static int omap4_mbox_resources_sz = ARRAY_SIZE(omap4_mbox_resources); #endif static struct platform_device mbox_device = { .name = "omap2-mailbox", .name = "omap-mailbox", .id = -1, }; Loading arch/arm/mach-omap2/mailbox.c +82 −100 Original line number Diff line number Diff line Loading @@ -10,7 +10,6 @@ * for more details. */ #include <linux/kernel.h> #include <linux/clk.h> #include <linux/err.h> #include <linux/platform_device.h> Loading @@ -18,8 +17,6 @@ #include <plat/mailbox.h> #include <mach/irqs.h> #define DRV_NAME "omap2-mailbox" #define MAILBOX_REVISION 0x000 #define MAILBOX_SYSCONFIG 0x010 #define MAILBOX_SYSSTATUS 0x014 Loading Loading @@ -131,7 +128,7 @@ static int omap2_mbox_startup(struct omap_mbox *mbox) } l = mbox_read_reg(MAILBOX_REVISION); pr_info("omap mailbox rev %d.%d\n", (l & 0xf0) >> 4, (l & 0x0f)); pr_debug("omap mailbox rev %d.%d\n", (l & 0xf0) >> 4, (l & 0x0f)); if (cpu_is_omap44xx()) l = OMAP4_SMARTIDLE; Loading Loading @@ -283,6 +280,8 @@ static struct omap_mbox_ops omap2_mbox_ops = { */ /* FIXME: the following structs should be filled automatically by the user id */ #if defined(CONFIG_ARCH_OMAP3430) || defined(CONFIG_ARCH_OMAP2420) /* DSP */ static struct omap_mbox2_priv omap2_mbox_dsp_priv = { .tx_fifo = { Loading @@ -300,10 +299,46 @@ static struct omap_mbox2_priv omap2_mbox_dsp_priv = { .irqdisable = MAILBOX_IRQENABLE(0), }; struct omap_mbox mbox_dsp_info = { .name = "dsp", .ops = &omap2_mbox_ops, .priv = &omap2_mbox_dsp_priv, }; #endif #if defined(CONFIG_ARCH_OMAP3430) struct omap_mbox *omap3_mboxes[] = { &mbox_dsp_info, NULL }; #endif #if defined(CONFIG_ARCH_OMAP2420) /* IVA */ static struct omap_mbox2_priv omap2_mbox_iva_priv = { .tx_fifo = { .msg = MAILBOX_MESSAGE(2), .fifo_stat = MAILBOX_FIFOSTATUS(2), }, .rx_fifo = { .msg = MAILBOX_MESSAGE(3), .msg_stat = MAILBOX_MSGSTATUS(3), }, .irqenable = MAILBOX_IRQENABLE(3), .irqstatus = MAILBOX_IRQSTATUS(3), .notfull_bit = MAILBOX_IRQ_NOTFULL(2), .newmsg_bit = MAILBOX_IRQ_NEWMSG(3), .irqdisable = MAILBOX_IRQENABLE(3), }; static struct omap_mbox mbox_iva_info = { .name = "iva", .ops = &omap2_mbox_ops, .priv = &omap2_mbox_iva_priv, }; struct omap_mbox *omap2_mboxes[] = { &mbox_iva_info, &mbox_dsp_info, NULL }; #endif /* OMAP4 specific data structure. Use the cpu_is_omap4xxx() to use this*/ #if defined(CONFIG_ARCH_OMAP4) /* OMAP4 */ static struct omap_mbox2_priv omap2_mbox_1_priv = { .tx_fifo = { .msg = MAILBOX_MESSAGE(0), Loading @@ -325,14 +360,6 @@ struct omap_mbox mbox_1_info = { .ops = &omap2_mbox_ops, .priv = &omap2_mbox_1_priv, }; EXPORT_SYMBOL(mbox_1_info); struct omap_mbox mbox_dsp_info = { .name = "dsp", .ops = &omap2_mbox_ops, .priv = &omap2_mbox_dsp_priv, }; EXPORT_SYMBOL(mbox_dsp_info); static struct omap_mbox2_priv omap2_mbox_2_priv = { .tx_fifo = { Loading @@ -355,110 +382,64 @@ struct omap_mbox mbox_2_info = { .ops = &omap2_mbox_ops, .priv = &omap2_mbox_2_priv, }; EXPORT_SYMBOL(mbox_2_info); #if defined(CONFIG_ARCH_OMAP2420) /* IVA */ static struct omap_mbox2_priv omap2_mbox_iva_priv = { .tx_fifo = { .msg = MAILBOX_MESSAGE(2), .fifo_stat = MAILBOX_FIFOSTATUS(2), }, .rx_fifo = { .msg = MAILBOX_MESSAGE(3), .msg_stat = MAILBOX_MSGSTATUS(3), }, .irqenable = MAILBOX_IRQENABLE(3), .irqstatus = MAILBOX_IRQSTATUS(3), .notfull_bit = MAILBOX_IRQ_NOTFULL(2), .newmsg_bit = MAILBOX_IRQ_NEWMSG(3), .irqdisable = MAILBOX_IRQENABLE(3), }; static struct omap_mbox mbox_iva_info = { .name = "iva", .ops = &omap2_mbox_ops, .priv = &omap2_mbox_iva_priv, }; struct omap_mbox *omap4_mboxes[] = { &mbox_1_info, &mbox_2_info, NULL }; #endif static int __devinit omap2_mbox_probe(struct platform_device *pdev) { struct resource *res; struct resource *mem; int ret; struct omap_mbox **list; /* MBOX base */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (unlikely(!res)) { dev_err(&pdev->dev, "invalid mem resource\n"); return -ENODEV; } mbox_base = ioremap(res->start, resource_size(res)); if (!mbox_base) return -ENOMEM; /* DSP or IVA2 IRQ */ res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (false) ; #if defined(CONFIG_ARCH_OMAP3430) else if (cpu_is_omap3430()) { list = omap3_mboxes; if (unlikely(!res)) { dev_err(&pdev->dev, "invalid irq resource\n"); ret = -ENODEV; goto err_dsp; list[0]->irq = platform_get_irq_byname(pdev, "dsp"); } if (cpu_is_omap44xx()) { mbox_1_info.irq = res->start; ret = omap_mbox_register(&pdev->dev, &mbox_1_info); } else { mbox_dsp_info.irq = res->start; ret = omap_mbox_register(&pdev->dev, &mbox_dsp_info); } if (ret) goto err_dsp; #endif #if defined(CONFIG_ARCH_OMAP2420) else if (cpu_is_omap2420()) { list = omap2_mboxes; if (cpu_is_omap44xx()) { mbox_2_info.irq = res->start; ret = omap_mbox_register(&pdev->dev, &mbox_2_info); if (ret) { omap_mbox_unregister(&mbox_1_info); goto err_dsp; list[0]->irq = platform_get_irq_byname(pdev, "dsp"); list[1]->irq = platform_get_irq_byname(pdev, "iva"); } #endif #if defined(CONFIG_ARCH_OMAP4) else if (cpu_is_omap44xx()) { list = omap4_mboxes; list[0]->irq = list[1]->irq = platform_get_irq_byname(pdev, "mbox"); } #if defined(CONFIG_ARCH_OMAP2420) /* IVA */ if (cpu_is_omap2420()) { /* IVA IRQ */ res = platform_get_resource(pdev, IORESOURCE_IRQ, 1); if (unlikely(!res)) { dev_err(&pdev->dev, "invalid irq resource\n"); ret = -ENODEV; omap_mbox_unregister(&mbox_dsp_info); goto err_dsp; #endif else { pr_err("%s: platform not supported\n", __func__); return -ENODEV; } mbox_iva_info.irq = res->start; ret = omap_mbox_register(&pdev->dev, &mbox_iva_info); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); mbox_base = ioremap(mem->start, resource_size(mem)); if (!mbox_base) return -ENOMEM; ret = omap_mbox_register(&pdev->dev, list); if (ret) { omap_mbox_unregister(&mbox_dsp_info); goto err_dsp; } iounmap(mbox_base); return ret; } #endif return 0; err_dsp: iounmap(mbox_base); return ret; } static int __devexit omap2_mbox_remove(struct platform_device *pdev) { #if defined(CONFIG_ARCH_OMAP2420) omap_mbox_unregister(&mbox_iva_info); #endif if (cpu_is_omap44xx()) { omap_mbox_unregister(&mbox_2_info); omap_mbox_unregister(&mbox_1_info); } else omap_mbox_unregister(&mbox_dsp_info); omap_mbox_unregister(); iounmap(mbox_base); return 0; } Loading @@ -467,7 +448,7 @@ static struct platform_driver omap2_mbox_driver = { .probe = omap2_mbox_probe, .remove = __devexit_p(omap2_mbox_remove), .driver = { .name = DRV_NAME, .name = "omap-mailbox", }, }; Loading @@ -486,5 +467,6 @@ module_exit(omap2_mbox_exit); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("omap mailbox: omap2/3/4 architecture specific functions"); MODULE_AUTHOR("Hiroshi DOYU <Hiroshi.DOYU@nokia.com>, Paul Mundt"); MODULE_ALIAS("platform:"DRV_NAME); MODULE_AUTHOR("Hiroshi DOYU <Hiroshi.DOYU@nokia.com>"); MODULE_AUTHOR("Paul Mundt"); MODULE_ALIAS("platform:omap2-mailbox"); arch/arm/plat-omap/Kconfig +9 −0 Original line number Diff line number Diff line Loading @@ -88,6 +88,15 @@ config OMAP_MBOX_FWK Say Y here if you want to use OMAP Mailbox framework support for DSP, IVA1.0 and IVA2 in OMAP1/2/3. config OMAP_MBOX_KFIFO_SIZE int "Mailbox kfifo default buffer size (bytes)" depends on OMAP_MBOX_FWK default 256 help Specify the default size of mailbox's kfifo buffers (bytes). This can also be changed at runtime (via the mbox_kfifo_size module parameter). config OMAP_IOMMU tristate Loading arch/arm/plat-omap/include/plat/mailbox.h +6 −14 Original line number Diff line number Diff line Loading @@ -3,10 +3,11 @@ #ifndef MAILBOX_H #define MAILBOX_H #include <linux/wait.h> #include <linux/spinlock.h> #include <linux/workqueue.h> #include <linux/blkdev.h> #include <linux/interrupt.h> #include <linux/device.h> #include <linux/kfifo.h> typedef u32 mbox_msg_t; struct omap_mbox; Loading Loading @@ -42,7 +43,7 @@ struct omap_mbox_ops { struct omap_mbox_queue { spinlock_t lock; struct request_queue *queue; struct kfifo fifo; struct work_struct work; struct tasklet_struct tasklet; int (*callback)(void *); Loading @@ -52,19 +53,10 @@ struct omap_mbox_queue { struct omap_mbox { char *name; unsigned int irq; struct omap_mbox_queue *txq, *rxq; struct omap_mbox_ops *ops; mbox_msg_t seq_snd, seq_rcv; struct device *dev; struct omap_mbox *next; void *priv; void (*err_notify)(void); }; int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg); Loading @@ -73,8 +65,8 @@ void omap_mbox_init_seq(struct omap_mbox *); struct omap_mbox *omap_mbox_get(const char *); void omap_mbox_put(struct omap_mbox *); int omap_mbox_register(struct device *parent, struct omap_mbox *); int omap_mbox_unregister(struct omap_mbox *); int omap_mbox_register(struct device *parent, struct omap_mbox **); int omap_mbox_unregister(void); static inline void omap_mbox_save_ctx(struct omap_mbox *mbox) { Loading Loading
arch/arm/mach-omap1/mailbox.c +21 −34 Original line number Diff line number Diff line /* * Mailbox reservation modules for DSP * Mailbox reservation modules for OMAP1 * * Copyright (C) 2006-2009 Nokia Corporation * Written by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com> Loading @@ -9,13 +9,10 @@ * for more details. */ #include <linux/kernel.h> #include <linux/resource.h> #include <linux/interrupt.h> #include <linux/platform_device.h> #include <linux/io.h> #include <plat/mailbox.h> #include <mach/irqs.h> #define MAILBOX_ARM2DSP1 0x00 #define MAILBOX_ARM2DSP1b 0x04 Loading Loading @@ -83,7 +80,7 @@ static int omap1_mbox_fifo_full(struct omap_mbox *mbox) struct omap_mbox1_fifo *fifo = &((struct omap_mbox1_priv *)mbox->priv)->rx_fifo; return (mbox_read_reg(fifo->flag)); return mbox_read_reg(fifo->flag); } /* irq */ Loading Loading @@ -141,47 +138,37 @@ struct omap_mbox mbox_dsp_info = { .ops = &omap1_mbox_ops, .priv = &omap1_mbox_dsp_priv, }; EXPORT_SYMBOL(mbox_dsp_info); struct omap_mbox *omap1_mboxes[] = { &mbox_dsp_info, NULL }; static int __devinit omap1_mbox_probe(struct platform_device *pdev) { struct resource *res; if (pdev->num_resources != 2) { dev_err(&pdev->dev, "invalid number of resources: %d\n", pdev->num_resources); return -ENODEV; } struct resource *mem; int ret; int i; struct omap_mbox **list; /* MBOX base */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (unlikely(!res)) { dev_err(&pdev->dev, "invalid mem resource\n"); return -ENODEV; } list = omap1_mboxes; list[0]->irq = platform_get_irq_byname(pdev, "dsp"); mbox_base = ioremap(res->start, resource_size(res)); if (!mbox_base) { dev_err(&pdev->dev, "ioremap failed\n"); return -ENODEV; } mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); mbox_base = ioremap(mem->start, resource_size(mem)); if (!mbox_base) return -ENOMEM; /* DSP IRQ */ res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (unlikely(!res)) { dev_err(&pdev->dev, "invalid irq resource\n"); ret = omap_mbox_register(&pdev->dev, list); if (ret) { iounmap(mbox_base); return -ENODEV; return ret; } mbox_dsp_info.irq = res->start; return omap_mbox_register(&pdev->dev, &mbox_dsp_info); return 0; } static int __devexit omap1_mbox_remove(struct platform_device *pdev) { omap_mbox_unregister(&mbox_dsp_info); omap_mbox_unregister(); iounmap(mbox_base); return 0; } Loading @@ -189,7 +176,7 @@ static struct platform_driver omap1_mbox_driver = { .probe = omap1_mbox_probe, .remove = __devexit_p(omap1_mbox_remove), .driver = { .name = "omap1-mailbox", .name = "omap-mailbox", }, }; Loading
arch/arm/mach-omap2/devices.c +5 −1 Original line number Diff line number Diff line Loading @@ -152,10 +152,12 @@ static struct resource omap2_mbox_resources[] = { { .start = INT_24XX_MAIL_U0_MPU, .flags = IORESOURCE_IRQ, .name = "dsp", }, { .start = INT_24XX_MAIL_U3_MPU, .flags = IORESOURCE_IRQ, .name = "iva", }, }; static int omap2_mbox_resources_sz = ARRAY_SIZE(omap2_mbox_resources); Loading @@ -174,6 +176,7 @@ static struct resource omap3_mbox_resources[] = { { .start = INT_24XX_MAIL_U0_MPU, .flags = IORESOURCE_IRQ, .name = "dsp", }, }; static int omap3_mbox_resources_sz = ARRAY_SIZE(omap3_mbox_resources); Loading @@ -195,6 +198,7 @@ static struct resource omap4_mbox_resources[] = { { .start = OMAP44XX_IRQ_MAIL_U0, .flags = IORESOURCE_IRQ, .name = "mbox", }, }; static int omap4_mbox_resources_sz = ARRAY_SIZE(omap4_mbox_resources); Loading @@ -204,7 +208,7 @@ static int omap4_mbox_resources_sz = ARRAY_SIZE(omap4_mbox_resources); #endif static struct platform_device mbox_device = { .name = "omap2-mailbox", .name = "omap-mailbox", .id = -1, }; Loading
arch/arm/mach-omap2/mailbox.c +82 −100 Original line number Diff line number Diff line Loading @@ -10,7 +10,6 @@ * for more details. */ #include <linux/kernel.h> #include <linux/clk.h> #include <linux/err.h> #include <linux/platform_device.h> Loading @@ -18,8 +17,6 @@ #include <plat/mailbox.h> #include <mach/irqs.h> #define DRV_NAME "omap2-mailbox" #define MAILBOX_REVISION 0x000 #define MAILBOX_SYSCONFIG 0x010 #define MAILBOX_SYSSTATUS 0x014 Loading Loading @@ -131,7 +128,7 @@ static int omap2_mbox_startup(struct omap_mbox *mbox) } l = mbox_read_reg(MAILBOX_REVISION); pr_info("omap mailbox rev %d.%d\n", (l & 0xf0) >> 4, (l & 0x0f)); pr_debug("omap mailbox rev %d.%d\n", (l & 0xf0) >> 4, (l & 0x0f)); if (cpu_is_omap44xx()) l = OMAP4_SMARTIDLE; Loading Loading @@ -283,6 +280,8 @@ static struct omap_mbox_ops omap2_mbox_ops = { */ /* FIXME: the following structs should be filled automatically by the user id */ #if defined(CONFIG_ARCH_OMAP3430) || defined(CONFIG_ARCH_OMAP2420) /* DSP */ static struct omap_mbox2_priv omap2_mbox_dsp_priv = { .tx_fifo = { Loading @@ -300,10 +299,46 @@ static struct omap_mbox2_priv omap2_mbox_dsp_priv = { .irqdisable = MAILBOX_IRQENABLE(0), }; struct omap_mbox mbox_dsp_info = { .name = "dsp", .ops = &omap2_mbox_ops, .priv = &omap2_mbox_dsp_priv, }; #endif #if defined(CONFIG_ARCH_OMAP3430) struct omap_mbox *omap3_mboxes[] = { &mbox_dsp_info, NULL }; #endif #if defined(CONFIG_ARCH_OMAP2420) /* IVA */ static struct omap_mbox2_priv omap2_mbox_iva_priv = { .tx_fifo = { .msg = MAILBOX_MESSAGE(2), .fifo_stat = MAILBOX_FIFOSTATUS(2), }, .rx_fifo = { .msg = MAILBOX_MESSAGE(3), .msg_stat = MAILBOX_MSGSTATUS(3), }, .irqenable = MAILBOX_IRQENABLE(3), .irqstatus = MAILBOX_IRQSTATUS(3), .notfull_bit = MAILBOX_IRQ_NOTFULL(2), .newmsg_bit = MAILBOX_IRQ_NEWMSG(3), .irqdisable = MAILBOX_IRQENABLE(3), }; static struct omap_mbox mbox_iva_info = { .name = "iva", .ops = &omap2_mbox_ops, .priv = &omap2_mbox_iva_priv, }; struct omap_mbox *omap2_mboxes[] = { &mbox_iva_info, &mbox_dsp_info, NULL }; #endif /* OMAP4 specific data structure. Use the cpu_is_omap4xxx() to use this*/ #if defined(CONFIG_ARCH_OMAP4) /* OMAP4 */ static struct omap_mbox2_priv omap2_mbox_1_priv = { .tx_fifo = { .msg = MAILBOX_MESSAGE(0), Loading @@ -325,14 +360,6 @@ struct omap_mbox mbox_1_info = { .ops = &omap2_mbox_ops, .priv = &omap2_mbox_1_priv, }; EXPORT_SYMBOL(mbox_1_info); struct omap_mbox mbox_dsp_info = { .name = "dsp", .ops = &omap2_mbox_ops, .priv = &omap2_mbox_dsp_priv, }; EXPORT_SYMBOL(mbox_dsp_info); static struct omap_mbox2_priv omap2_mbox_2_priv = { .tx_fifo = { Loading @@ -355,110 +382,64 @@ struct omap_mbox mbox_2_info = { .ops = &omap2_mbox_ops, .priv = &omap2_mbox_2_priv, }; EXPORT_SYMBOL(mbox_2_info); #if defined(CONFIG_ARCH_OMAP2420) /* IVA */ static struct omap_mbox2_priv omap2_mbox_iva_priv = { .tx_fifo = { .msg = MAILBOX_MESSAGE(2), .fifo_stat = MAILBOX_FIFOSTATUS(2), }, .rx_fifo = { .msg = MAILBOX_MESSAGE(3), .msg_stat = MAILBOX_MSGSTATUS(3), }, .irqenable = MAILBOX_IRQENABLE(3), .irqstatus = MAILBOX_IRQSTATUS(3), .notfull_bit = MAILBOX_IRQ_NOTFULL(2), .newmsg_bit = MAILBOX_IRQ_NEWMSG(3), .irqdisable = MAILBOX_IRQENABLE(3), }; static struct omap_mbox mbox_iva_info = { .name = "iva", .ops = &omap2_mbox_ops, .priv = &omap2_mbox_iva_priv, }; struct omap_mbox *omap4_mboxes[] = { &mbox_1_info, &mbox_2_info, NULL }; #endif static int __devinit omap2_mbox_probe(struct platform_device *pdev) { struct resource *res; struct resource *mem; int ret; struct omap_mbox **list; /* MBOX base */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (unlikely(!res)) { dev_err(&pdev->dev, "invalid mem resource\n"); return -ENODEV; } mbox_base = ioremap(res->start, resource_size(res)); if (!mbox_base) return -ENOMEM; /* DSP or IVA2 IRQ */ res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (false) ; #if defined(CONFIG_ARCH_OMAP3430) else if (cpu_is_omap3430()) { list = omap3_mboxes; if (unlikely(!res)) { dev_err(&pdev->dev, "invalid irq resource\n"); ret = -ENODEV; goto err_dsp; list[0]->irq = platform_get_irq_byname(pdev, "dsp"); } if (cpu_is_omap44xx()) { mbox_1_info.irq = res->start; ret = omap_mbox_register(&pdev->dev, &mbox_1_info); } else { mbox_dsp_info.irq = res->start; ret = omap_mbox_register(&pdev->dev, &mbox_dsp_info); } if (ret) goto err_dsp; #endif #if defined(CONFIG_ARCH_OMAP2420) else if (cpu_is_omap2420()) { list = omap2_mboxes; if (cpu_is_omap44xx()) { mbox_2_info.irq = res->start; ret = omap_mbox_register(&pdev->dev, &mbox_2_info); if (ret) { omap_mbox_unregister(&mbox_1_info); goto err_dsp; list[0]->irq = platform_get_irq_byname(pdev, "dsp"); list[1]->irq = platform_get_irq_byname(pdev, "iva"); } #endif #if defined(CONFIG_ARCH_OMAP4) else if (cpu_is_omap44xx()) { list = omap4_mboxes; list[0]->irq = list[1]->irq = platform_get_irq_byname(pdev, "mbox"); } #if defined(CONFIG_ARCH_OMAP2420) /* IVA */ if (cpu_is_omap2420()) { /* IVA IRQ */ res = platform_get_resource(pdev, IORESOURCE_IRQ, 1); if (unlikely(!res)) { dev_err(&pdev->dev, "invalid irq resource\n"); ret = -ENODEV; omap_mbox_unregister(&mbox_dsp_info); goto err_dsp; #endif else { pr_err("%s: platform not supported\n", __func__); return -ENODEV; } mbox_iva_info.irq = res->start; ret = omap_mbox_register(&pdev->dev, &mbox_iva_info); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); mbox_base = ioremap(mem->start, resource_size(mem)); if (!mbox_base) return -ENOMEM; ret = omap_mbox_register(&pdev->dev, list); if (ret) { omap_mbox_unregister(&mbox_dsp_info); goto err_dsp; } iounmap(mbox_base); return ret; } #endif return 0; err_dsp: iounmap(mbox_base); return ret; } static int __devexit omap2_mbox_remove(struct platform_device *pdev) { #if defined(CONFIG_ARCH_OMAP2420) omap_mbox_unregister(&mbox_iva_info); #endif if (cpu_is_omap44xx()) { omap_mbox_unregister(&mbox_2_info); omap_mbox_unregister(&mbox_1_info); } else omap_mbox_unregister(&mbox_dsp_info); omap_mbox_unregister(); iounmap(mbox_base); return 0; } Loading @@ -467,7 +448,7 @@ static struct platform_driver omap2_mbox_driver = { .probe = omap2_mbox_probe, .remove = __devexit_p(omap2_mbox_remove), .driver = { .name = DRV_NAME, .name = "omap-mailbox", }, }; Loading @@ -486,5 +467,6 @@ module_exit(omap2_mbox_exit); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("omap mailbox: omap2/3/4 architecture specific functions"); MODULE_AUTHOR("Hiroshi DOYU <Hiroshi.DOYU@nokia.com>, Paul Mundt"); MODULE_ALIAS("platform:"DRV_NAME); MODULE_AUTHOR("Hiroshi DOYU <Hiroshi.DOYU@nokia.com>"); MODULE_AUTHOR("Paul Mundt"); MODULE_ALIAS("platform:omap2-mailbox");
arch/arm/plat-omap/Kconfig +9 −0 Original line number Diff line number Diff line Loading @@ -88,6 +88,15 @@ config OMAP_MBOX_FWK Say Y here if you want to use OMAP Mailbox framework support for DSP, IVA1.0 and IVA2 in OMAP1/2/3. config OMAP_MBOX_KFIFO_SIZE int "Mailbox kfifo default buffer size (bytes)" depends on OMAP_MBOX_FWK default 256 help Specify the default size of mailbox's kfifo buffers (bytes). This can also be changed at runtime (via the mbox_kfifo_size module parameter). config OMAP_IOMMU tristate Loading
arch/arm/plat-omap/include/plat/mailbox.h +6 −14 Original line number Diff line number Diff line Loading @@ -3,10 +3,11 @@ #ifndef MAILBOX_H #define MAILBOX_H #include <linux/wait.h> #include <linux/spinlock.h> #include <linux/workqueue.h> #include <linux/blkdev.h> #include <linux/interrupt.h> #include <linux/device.h> #include <linux/kfifo.h> typedef u32 mbox_msg_t; struct omap_mbox; Loading Loading @@ -42,7 +43,7 @@ struct omap_mbox_ops { struct omap_mbox_queue { spinlock_t lock; struct request_queue *queue; struct kfifo fifo; struct work_struct work; struct tasklet_struct tasklet; int (*callback)(void *); Loading @@ -52,19 +53,10 @@ struct omap_mbox_queue { struct omap_mbox { char *name; unsigned int irq; struct omap_mbox_queue *txq, *rxq; struct omap_mbox_ops *ops; mbox_msg_t seq_snd, seq_rcv; struct device *dev; struct omap_mbox *next; void *priv; void (*err_notify)(void); }; int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg); Loading @@ -73,8 +65,8 @@ void omap_mbox_init_seq(struct omap_mbox *); struct omap_mbox *omap_mbox_get(const char *); void omap_mbox_put(struct omap_mbox *); int omap_mbox_register(struct device *parent, struct omap_mbox *); int omap_mbox_unregister(struct omap_mbox *); int omap_mbox_register(struct device *parent, struct omap_mbox **); int omap_mbox_unregister(void); static inline void omap_mbox_save_ctx(struct omap_mbox *mbox) { Loading