Exemplo n.º 1
0
static int __devinit omap2_mbox_probe(struct platform_device *pdev)
{
	struct resource *res;
	int ret;

	/* 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, res->end - res->start);
	if (!mbox_base)
		return -ENOMEM;

	/* DSP or IVA2 IRQ */
	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
	if (unlikely(!res)) {
		dev_err(&pdev->dev, "invalid irq resource\n");
		ret = -ENODEV;
		goto err_dsp;
	}
	mbox_dsp_info.irq = res->start;

	ret = omap_mbox_register(&pdev->dev, &mbox_dsp_info);
	if (ret)
		goto err_dsp;

#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;
			goto err_iva1;
		}
		mbox_iva_info.irq = res->start;
		ret = omap_mbox_register(&pdev->dev, &mbox_iva_info);
		if (ret)
			goto err_iva1;
	}
#endif
	return 0;

err_iva1:
	omap_mbox_unregister(&mbox_dsp_info);
err_dsp:
	iounmap(mbox_base);
	return ret;
}
Exemplo n.º 2
0
static int __devinit omap1_mbox_probe(struct platform_device *pdev)
{
	struct resource *mem;
	int ret;
	struct omap_mbox **list;

	list = omap1_mboxes;
	list[0]->irq = platform_get_irq_byname(pdev, "dsp");

	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (!mem)
		return -ENODEV;

	mbox_base = ioremap(mem->start, resource_size(mem));
	if (!mbox_base)
		return -ENOMEM;

	ret = omap_mbox_register(&pdev->dev, list);
	if (ret) {
		iounmap(mbox_base);
		return ret;
	}

	return 0;
}
Exemplo n.º 3
0
static int __devinit omap1_mbox_probe(struct platform_device *pdev)
{
	struct resource *res;
	int ret = 0;

	if (pdev->num_resources != 2) {
		dev_err(&pdev->dev, "invalid number of resources: %d\n",
			pdev->num_resources);
		return -ENODEV;
	}

	/* 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 = res->start;

	/* DSP IRQ */
	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
	if (unlikely(!res)) {
		dev_err(&pdev->dev, "invalid irq resource\n");
		return -ENODEV;
	}
	mbox_dsp_info.irq = res->start;

	return omap_mbox_register(&pdev->dev, &mbox_dsp_info);
}
Exemplo n.º 4
0
static int __devinit omap2_mbox_probe(struct platform_device *pdev)
{
	struct resource *mem;
	int ret;
	struct omap_mbox **list;

	if (false)
		;
#if defined(CONFIG_ARCH_OMAP3)
	else if (cpu_is_omap34xx()) {
		list = omap3_mboxes;

		list[0]->irq = platform_get_irq_byname(pdev, "dsp");
	}
#endif
#if defined(CONFIG_ARCH_OMAP2)
	else if (cpu_is_omap2430()) {
		list = omap2_mboxes;

		list[0]->irq = platform_get_irq_byname(pdev, "dsp");
	} else if (cpu_is_omap2420()) {
		list = omap2_mboxes;

		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");
	}
#endif
	else {
		pr_err("%s: platform not supported\n", __func__);
		return -ENODEV;
	}

	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) {
		iounmap(mbox_base);
		return ret;
	}

	return 0;
}
Exemplo n.º 5
0
static int __devinit omap2_mbox_probe(struct platform_device *pdev)
{
	struct resource *res;
	int ret;

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

	if (cpu_is_omap44xx()) {
		mbox_ctx = kzalloc(sizeof(u32) * OMAP4_MBOX_NR_REGS,
							GFP_KERNEL);
		nr_mbox_users = OMAP4_MBOX_NUM_USER;
	} else {
		mbox_ctx = kzalloc(sizeof(u32) * MBOX_NR_REGS, GFP_KERNEL);
		nr_mbox_users = MBOX_NUM_USER;
	}

	if (!mbox_ctx) {
		ret = -ENOMEM;
		goto err_dsp;
	}

	/* DSP or IVA2 IRQ */
	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);

	if (unlikely(!res)) {
		dev_err(&pdev->dev, "invalid irq resource\n");
		ret = -ENODEV;
		goto err_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;

	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;
		}
	}
#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;
		}
		mbox_iva_info.irq = res->start;
		ret = omap_mbox_register(&pdev->dev, &mbox_iva_info);
		if (ret) {
			omap_mbox_unregister(&mbox_dsp_info);
			goto err_dsp;
		}
	}
#endif
	return 0;

err_dsp:
	iounmap(mbox_base);
	return ret;
}