From 066aa9c1e3d0af52619fe26f05810990ff381d8c Mon Sep 17 00:00:00 2001 From: Hiroshi DOYU Date: Wed, 28 Jan 2009 21:32:04 +0200 Subject: omap iommu: omap3 iommu device registration Signed-off-by: Hiroshi DOYU --- arch/arm/mach-omap2/omap3-iommu.c | 103 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 arch/arm/mach-omap2/omap3-iommu.c (limited to 'arch/arm/mach-omap2/omap3-iommu.c') diff --git a/arch/arm/mach-omap2/omap3-iommu.c b/arch/arm/mach-omap2/omap3-iommu.c new file mode 100644 index 000000000000..91ee38a485a4 --- /dev/null +++ b/arch/arm/mach-omap2/omap3-iommu.c @@ -0,0 +1,103 @@ +/* + * omap iommu: omap3 device registration + * + * Copyright (C) 2008-2009 Nokia Corporation + * + * Written by Hiroshi DOYU + * + * 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 + +#include + +#define OMAP3_MMU1_BASE 0x480bd400 +#define OMAP3_MMU2_BASE 0x5d000000 +#define OMAP3_MMU1_IRQ 24 +#define OMAP3_MMU2_IRQ 28 + + +static unsigned long iommu_base[] __initdata = { + OMAP3_MMU1_BASE, + OMAP3_MMU2_BASE, +}; + +static int iommu_irq[] __initdata = { + OMAP3_MMU1_IRQ, + OMAP3_MMU2_IRQ, +}; + +static const struct iommu_platform_data omap3_iommu_pdata[] __initconst = { + { + .name = "isp", + .nr_tlb_entries = 8, + .clk_name = "cam_ick", + }, + { + .name = "iva2", + .nr_tlb_entries = 32, + .clk_name = "iva2_ck", + }, +}; +#define NR_IOMMU_DEVICES ARRAY_SIZE(omap3_iommu_pdata) + +static struct platform_device *omap3_iommu_pdev[NR_IOMMU_DEVICES]; + +static int __init omap3_iommu_init(void) +{ + int i, err; + + for (i = 0; i < NR_IOMMU_DEVICES; i++) { + struct platform_device *pdev; + struct resource res[2]; + + pdev = platform_device_alloc("omap-iommu", i); + if (!pdev) { + err = -ENOMEM; + goto err_out; + } + + memset(res, 0, sizeof(res)); + res[0].start = iommu_base[i]; + res[0].end = iommu_base[i] + MMU_REG_SIZE - 1; + res[0].flags = IORESOURCE_MEM; + res[1].start = res[1].end = iommu_irq[i]; + res[1].flags = IORESOURCE_IRQ; + + err = platform_device_add_resources(pdev, res, + ARRAY_SIZE(res)); + if (err) + goto err_out; + err = platform_device_add_data(pdev, &omap3_iommu_pdata[i], + sizeof(omap3_iommu_pdata[0])); + 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"); -- cgit v1.2.3 From 5c651ffaee6f07aa1f5e6d0763845a2ee606b6bd Mon Sep 17 00:00:00 2001 From: Hiroshi DOYU Date: Tue, 19 May 2009 09:07:55 +0300 Subject: omap iommu: add MPU_BRIDGE_IOMMU for tidspbridge migration Currently "tidspbridge" driver uses its own mmu implementation and will migrate to use this "omap iommu" eventually. This config is provided to make this migration happen smoothly. Signed-off-by: Hiroshi DOYU --- arch/arm/mach-omap2/omap3-iommu.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/arm/mach-omap2/omap3-iommu.c') diff --git a/arch/arm/mach-omap2/omap3-iommu.c b/arch/arm/mach-omap2/omap3-iommu.c index 91ee38a485a4..194189c746c2 100644 --- a/arch/arm/mach-omap2/omap3-iommu.c +++ b/arch/arm/mach-omap2/omap3-iommu.c @@ -36,11 +36,13 @@ static const struct iommu_platform_data omap3_iommu_pdata[] __initconst = { .nr_tlb_entries = 8, .clk_name = "cam_ick", }, +#if defined(CONFIG_MPU_BRIDGE_IOMMU) { .name = "iva2", .nr_tlb_entries = 32, .clk_name = "iva2_ck", }, +#endif }; #define NR_IOMMU_DEVICES ARRAY_SIZE(omap3_iommu_pdata) -- cgit v1.2.3