]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/devices.c
def9e5370edfb3554f146871552f731c4b01e62a
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / devices.c
1 /*
2  * linux/arch/arm/mach-omap2/devices.c
3  *
4  * OMAP2 platform device setup/initialization
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  */
11
12 #include <linux/config.h>
13 #include <linux/module.h>
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/platform_device.h>
17
18 #include <asm/hardware.h>
19 #include <asm/io.h>
20 #include <asm/mach-types.h>
21 #include <asm/mach/map.h>
22
23 #include <asm/arch/tc.h>
24 #include <asm/arch/board.h>
25 #include <asm/arch/mux.h>
26 #include <asm/arch/gpio.h>
27
28 extern void omap_nop_release(struct device *dev);
29
30 /*-------------------------------------------------------------------------*/
31
32 #if     defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
33
34 #define OMAP2_I2C_BASE2         0x48072000
35 #define OMAP2_I2C_INT2          57
36
37 static struct resource i2c_resources2[] = {
38         {
39                 .start          = OMAP2_I2C_BASE2,
40                 .end            = OMAP2_I2C_BASE2 + 0x3f,
41                 .flags          = IORESOURCE_MEM,
42         },
43         {
44                 .start          = OMAP2_I2C_INT2,
45                 .flags          = IORESOURCE_IRQ,
46         },
47 };
48
49 static struct platform_device omap_i2c_device2 = {
50         .name           = "i2c_omap",
51         .id             = 2,
52         .dev = {
53                 .release        = omap_nop_release,
54         },
55         .num_resources  = ARRAY_SIZE(i2c_resources2),
56         .resource       = i2c_resources2,
57 };
58
59 /* See also arch/arm/plat-omap/devices.c for first I2C on 24xx */
60 static void omap_init_i2c(void)
61 {
62         /* REVISIT: Second I2C not in use on H4? */
63         if (machine_is_omap_h4())
64                 return;
65
66         omap_cfg_reg(J15_24XX_I2C2_SCL);
67         omap_cfg_reg(H19_24XX_I2C2_SDA);
68         (void) platform_device_register(&omap_i2c_device2);
69 }
70
71 #else
72
73 static void omap_init_i2c(void) {}
74
75 #endif
76
77 #if defined(CONFIG_OMAP_STI)
78
79 #define OMAP2_STI_BASE          IO_ADDRESS(0x48068000)
80 #define OMAP2_STI_CHANNEL_BASE  0x54000000
81 #define OMAP2_STI_IRQ           4
82
83 static struct resource sti_resources[] = {
84         {
85                 .start          = OMAP2_STI_BASE,
86                 .end            = OMAP2_STI_BASE + 0x7ff,
87                 .flags          = IORESOURCE_MEM,
88         },
89         {
90                 .start          = OMAP2_STI_CHANNEL_BASE,
91                 .end            = OMAP2_STI_CHANNEL_BASE + SZ_64K - 1,
92                 .flags          = IORESOURCE_MEM,
93         },
94         {
95                 .start          = OMAP2_STI_IRQ,
96                 .flags          = IORESOURCE_IRQ,
97         }
98 };
99
100 static struct platform_device sti_device = {
101         .name           = "sti",
102         .id             = -1,
103         .dev = {
104                 .release        = omap_nop_release,
105         },
106         .num_resources  = ARRAY_SIZE(sti_resources),
107         .resource       = sti_resources,
108 };
109
110 static inline void omap_init_sti(void)
111 {
112         platform_device_register(&sti_device);
113 }
114 #else
115 static inline void omap_init_sti(void) {}
116 #endif
117
118 /*-------------------------------------------------------------------------*/
119
120 static int __init omap2_init_devices(void)
121 {
122         /* please keep these calls, and their implementations above,
123          * in alphabetical order so they're easier to sort through.
124          */
125         omap_init_i2c();
126         omap_init_sti();
127
128         return 0;
129 }
130 arch_initcall(omap2_init_devices);
131