2009-01-28 20:32:04 +01:00
|
|
|
/*
|
|
|
|
* omap iommu: omap3 device registration
|
|
|
|
*
|
|
|
|
* Copyright (C) 2008-2009 Nokia Corporation
|
|
|
|
*
|
|
|
|
* Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
|
2009-10-20 18:40:47 +02:00
|
|
|
#include <plat/iommu.h>
|
2009-01-28 20:32:04 +01:00
|
|
|
|
2009-11-22 19:11:04 +01:00
|
|
|
struct iommu_device {
|
|
|
|
resource_size_t base;
|
|
|
|
int irq;
|
|
|
|
struct iommu_platform_data pdata;
|
|
|
|
struct resource res[2];
|
2009-01-28 20:32:04 +01:00
|
|
|
};
|
|
|
|
|
2009-11-22 19:11:04 +01:00
|
|
|
static struct iommu_device devices[] = {
|
2009-01-28 20:32:04 +01:00
|
|
|
{
|
2009-11-22 19:11:04 +01:00
|
|
|
.base = 0x480bd400,
|
|
|
|
.irq = 24,
|
|
|
|
.pdata = {
|
|
|
|
.name = "isp",
|
|
|
|
.nr_tlb_entries = 8,
|
|
|
|
.clk_name = "cam_ick",
|
|
|
|
},
|
2009-01-28 20:32:04 +01:00
|
|
|
},
|
2009-05-19 08:07:55 +02:00
|
|
|
#if defined(CONFIG_MPU_BRIDGE_IOMMU)
|
2009-01-28 20:32:04 +01:00
|
|
|
{
|
2009-11-22 19:11:04 +01:00
|
|
|
.base = 0x5d000000,
|
|
|
|
.irq = 28,
|
|
|
|
.pdata = {
|
|
|
|
.name = "iva2",
|
|
|
|
.nr_tlb_entries = 32,
|
|
|
|
.clk_name = "iva2_ck",
|
|
|
|
},
|
2009-01-28 20:32:04 +01:00
|
|
|
},
|
2009-05-19 08:07:55 +02:00
|
|
|
#endif
|
2009-01-28 20:32:04 +01:00
|
|
|
};
|
2009-11-22 19:11:04 +01:00
|
|
|
#define NR_IOMMU_DEVICES ARRAY_SIZE(devices)
|
2009-01-28 20:32:04 +01:00
|
|
|
|
|
|
|
static struct platform_device *omap3_iommu_pdev[NR_IOMMU_DEVICES];
|
|
|
|
|
|
|
|
static int __init omap3_iommu_init(void)
|
|
|
|
{
|
|
|
|
int i, err;
|
2009-11-22 19:11:04 +01:00
|
|
|
struct resource res[] = {
|
|
|
|
{ .flags = IORESOURCE_MEM },
|
|
|
|
{ .flags = IORESOURCE_IRQ },
|
|
|
|
};
|
2009-01-28 20:32:04 +01:00
|
|
|
|
|
|
|
for (i = 0; i < NR_IOMMU_DEVICES; i++) {
|
|
|
|
struct platform_device *pdev;
|
2009-11-22 19:11:04 +01:00
|
|
|
const struct iommu_device *d = &devices[i];
|
2009-01-28 20:32:04 +01:00
|
|
|
|
|
|
|
pdev = platform_device_alloc("omap-iommu", i);
|
|
|
|
if (!pdev) {
|
|
|
|
err = -ENOMEM;
|
|
|
|
goto err_out;
|
|
|
|
}
|
|
|
|
|
2009-11-22 19:11:04 +01:00
|
|
|
res[0].start = d->base;
|
|
|
|
res[0].end = d->base + MMU_REG_SIZE - 1;
|
|
|
|
res[1].start = res[1].end = d->irq;
|
2009-01-28 20:32:04 +01:00
|
|
|
|
|
|
|
err = platform_device_add_resources(pdev, res,
|
|
|
|
ARRAY_SIZE(res));
|
|
|
|
if (err)
|
|
|
|
goto err_out;
|
2009-11-22 19:11:04 +01:00
|
|
|
err = platform_device_add_data(pdev, &d->pdata,
|
|
|
|
sizeof(d->pdata));
|
2009-01-28 20:32:04 +01:00
|
|
|
if (err)
|
|
|
|
goto err_out;
|
|
|
|
err = platform_device_add(pdev);
|
|
|
|
if (err)
|
|
|
|
goto err_out;
|
|
|
|
omap3_iommu_pdev[i] = pdev;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_out:
|
|
|
|
while (i--)
|
|
|
|
platform_device_put(omap3_iommu_pdev[i]);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
module_init(omap3_iommu_init);
|
|
|
|
|
|
|
|
static void __exit omap3_iommu_exit(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < NR_IOMMU_DEVICES; i++)
|
|
|
|
platform_device_unregister(omap3_iommu_pdev[i]);
|
|
|
|
}
|
|
|
|
module_exit(omap3_iommu_exit);
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Hiroshi DOYU");
|
|
|
|
MODULE_DESCRIPTION("omap iommu: omap3 device registration");
|
|
|
|
MODULE_LICENSE("GPL v2");
|