2 * omap iommu: omap3 device registration
4 * Copyright (C) 2008-2009 Nokia Corporation
6 * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/platform_device.h>
15 #include <plat/iommu.h>
20 struct iommu_platform_data pdata
;
21 struct resource res
[2];
24 static struct iommu_device devices
[] = {
31 .clk_name
= "cam_ick",
34 #if defined(CONFIG_MPU_BRIDGE_IOMMU)
41 .clk_name
= "iva2_ck",
46 #define NR_IOMMU_DEVICES ARRAY_SIZE(devices)
48 static struct platform_device
*omap3_iommu_pdev
[NR_IOMMU_DEVICES
];
50 static int __init
omap3_iommu_init(void)
53 struct resource res
[] = {
54 { .flags
= IORESOURCE_MEM
},
55 { .flags
= IORESOURCE_IRQ
},
58 for (i
= 0; i
< NR_IOMMU_DEVICES
; i
++) {
59 struct platform_device
*pdev
;
60 const struct iommu_device
*d
= &devices
[i
];
62 pdev
= platform_device_alloc("omap-iommu", i
);
68 res
[0].start
= d
->base
;
69 res
[0].end
= d
->base
+ MMU_REG_SIZE
- 1;
70 res
[1].start
= res
[1].end
= d
->irq
;
72 err
= platform_device_add_resources(pdev
, res
,
76 err
= platform_device_add_data(pdev
, &d
->pdata
,
80 err
= platform_device_add(pdev
);
83 omap3_iommu_pdev
[i
] = pdev
;
89 platform_device_put(omap3_iommu_pdev
[i
]);
92 module_init(omap3_iommu_init
);
94 static void __exit
omap3_iommu_exit(void)
98 for (i
= 0; i
< NR_IOMMU_DEVICES
; i
++)
99 platform_device_unregister(omap3_iommu_pdev
[i
]);
101 module_exit(omap3_iommu_exit
);
103 MODULE_AUTHOR("Hiroshi DOYU");
104 MODULE_DESCRIPTION("omap iommu: omap3 device registration");
105 MODULE_LICENSE("GPL v2");