Skip to content

Commit

Permalink
Merge branch 'v2.6.35-omap-mailbox-for-next' of git://gitorious.org/~…
Browse files Browse the repository at this point in the history
…doyu/lk/mainline into omap-for-linus

Conflicts:
	arch/arm/mach-omap1/devices.c
  • Loading branch information
Tony Lindgren committed Aug 4, 2010
2 parents 80690cc + b3e6914 commit d21872b
Show file tree
Hide file tree
Showing 6 changed files with 241 additions and 279 deletions.
55 changes: 21 additions & 34 deletions arch/arm/mach-omap1/mailbox.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Mailbox reservation modules for DSP
* Mailbox reservation modules for OMAP1
*
* Copyright (C) 2006-2009 Nokia Corporation
* Written by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Expand All @@ -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
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -141,55 +138,45 @@ 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;
struct resource *mem;
int ret;
int i;
struct omap_mbox **list;

if (pdev->num_resources != 2) {
dev_err(&pdev->dev, "invalid number of resources: %d\n",
pdev->num_resources);
return -ENODEV;
}
list = omap1_mboxes;
list[0]->irq = platform_get_irq_byname(pdev, "dsp");

/* MBOX base */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (unlikely(!res)) {
dev_err(&pdev->dev, "invalid mem resource\n");
return -ENODEV;
}
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
mbox_base = ioremap(mem->start, resource_size(mem));
if (!mbox_base)
return -ENOMEM;

mbox_base = ioremap(res->start, resource_size(res));
if (!mbox_base) {
dev_err(&pdev->dev, "ioremap failed\n");
return -ENODEV;
}

/* 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;
}

static struct platform_driver omap1_mbox_driver = {
.probe = omap1_mbox_probe,
.remove = __devexit_p(omap1_mbox_remove),
.driver = {
.name = "omap1-mailbox",
.name = "omap-mailbox",
},
};

Expand Down
6 changes: 5 additions & 1 deletion arch/arm/mach-omap2/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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,
};

Expand Down
Loading

0 comments on commit d21872b

Please sign in to comment.