1 From 6a84082597dd322713c5d5951530e3eecb878ad4 Mon Sep 17 00:00:00 2001
2 From: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
3 Date: Wed, 28 Jan 2009 21:32:04 +0200
4 Subject: [PATCH] omap iommu: omap3 iommu device registration
6 Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
8 arch/arm/mach-omap2/omap3-iommu.c | 104 +++++++++++++++++++++++++++++++++++++
9 1 files changed, 104 insertions(+), 0 deletions(-)
10 create mode 100644 arch/arm/mach-omap2/omap3-iommu.c
12 diff --git a/arch/arm/mach-omap2/omap3-iommu.c b/arch/arm/mach-omap2/omap3-iommu.c
14 index 0000000..97481cc
16 +++ b/arch/arm/mach-omap2/omap3-iommu.c
19 + * omap iommu: omap3 device registration
21 + * Copyright (C) 2008-2009 Nokia Corporation
23 + * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
25 + * This program is free software; you can redistribute it and/or modify
26 + * it under the terms of the GNU General Public License version 2 as
27 + * published by the Free Software Foundation.
30 +#include <linux/platform_device.h>
31 +#include <linux/io.h>
33 +#include <mach/iommu.h>
35 +#define OMAP3_MMU1_BASE 0x480bd400
36 +#define OMAP3_MMU2_BASE 0x5d000000
37 +#define OMAP3_MMU1_IRQ 24
38 +#define OMAP3_MMU2_IRQ 28
40 +static struct resource omap3_iommu_res[] = {
41 + { /* Camera ISP MMU */
42 + .start = OMAP3_MMU1_BASE,
43 + .end = OMAP3_MMU1_BASE + MMU_REG_SIZE - 1,
44 + .flags = IORESOURCE_MEM,
47 + .start = OMAP3_MMU1_IRQ,
48 + .flags = IORESOURCE_IRQ,
51 + .start = OMAP3_MMU2_BASE,
52 + .end = OMAP3_MMU2_BASE + MMU_REG_SIZE - 1,
53 + .flags = IORESOURCE_MEM,
56 + .start = OMAP3_MMU2_IRQ,
57 + .flags = IORESOURCE_IRQ,
60 +#define NR_IOMMU_RES (ARRAY_SIZE(omap3_iommu_res) / 2)
62 +static const struct iommu_platform_data omap3_iommu_pdata[] __initconst = {
65 + .nr_tlb_entries = 8,
66 + .clk_name = "cam_ick",
70 + .nr_tlb_entries = 32,
71 + .clk_name = "iva2_ck",
74 +#define NR_IOMMU_DEVICES ARRAY_SIZE(omap3_iommu_pdata)
76 +static struct platform_device *omap3_iommu_pdev[NR_IOMMU_DEVICES];
78 +static int __init omap3_iommu_init(void)
82 + for (i = 0; i < NR_IOMMU_DEVICES; i++) {
83 + struct platform_device *pdev;
85 + pdev = platform_device_alloc("omap-iommu", i + 1);
88 + err = platform_device_add_resources(pdev,
89 + &omap3_iommu_res[2 * i], NR_IOMMU_RES);
92 + err = platform_device_add_data(pdev, &omap3_iommu_pdata[i],
93 + sizeof(omap3_iommu_pdata[0]));
96 + err = platform_device_add(pdev);
99 + omap3_iommu_pdev[i] = pdev;
105 + platform_device_put(omap3_iommu_pdev[i]);
108 +module_init(omap3_iommu_init);
110 +static void __exit omap3_iommu_exit(void)
114 + for (i = 0; i < NR_IOMMU_DEVICES; i++)
115 + platform_device_unregister(omap3_iommu_pdev[i]);
117 +module_exit(omap3_iommu_exit);
119 +MODULE_AUTHOR("Hiroshi DOYU");
120 +MODULE_DESCRIPTION("omap iommu: omap3 device registration");
121 +MODULE_LICENSE("GPL v2");