]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap1/devices.c
Merge with /home/tmlind/src/kernel/linux-2.6
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap1 / devices.c
1 /*
2  * linux/arch/arm/mach-omap1/devices.c
3  *
4  * OMAP1 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 /*-------------------------------------------------------------------------*/
29
30 #if     defined(CONFIG_OMAP_RTC) || defined(CONFIG_OMAP_RTC)
31
32 #define OMAP_RTC_BASE           0xfffb4800
33
34 static struct resource rtc_resources[] = {
35         {
36                 .start          = OMAP_RTC_BASE,
37                 .end            = OMAP_RTC_BASE + 0x5f,
38                 .flags          = IORESOURCE_MEM,
39         },
40         {
41                 .start          = INT_RTC_TIMER,
42                 .flags          = IORESOURCE_IRQ,
43         },
44         {
45                 .start          = INT_RTC_ALARM,
46                 .flags          = IORESOURCE_IRQ,
47         },
48 };
49
50 static struct platform_device omap_rtc_device = {
51         .name           = "omap_rtc",
52         .id             = -1,
53         .num_resources  = ARRAY_SIZE(rtc_resources),
54         .resource       = rtc_resources,
55 };
56
57 static void omap_init_rtc(void)
58 {
59         (void) platform_device_register(&omap_rtc_device);
60 }
61 #else
62 static inline void omap_init_rtc(void) {}
63 #endif
64
65 #if defined(CONFIG_OMAP_STI)
66
67 #define OMAP1_STI_BASE          IO_ADDRESS(0xfffea000)
68 #define OMAP1_STI_CHANNEL_BASE  (OMAP1_STI_BASE + 0x400)
69
70 static struct resource sti_resources[] = {
71         {
72                 .start          = OMAP1_STI_BASE,
73                 .end            = OMAP1_STI_BASE + SZ_1K - 1,
74                 .flags          = IORESOURCE_MEM,
75         },
76         {
77                 .start          = OMAP1_STI_CHANNEL_BASE,
78                 .end            = OMAP1_STI_CHANNEL_BASE + SZ_1K - 1,
79                 .flags          = IORESOURCE_MEM,
80         },
81         {
82                 .start          = INT_1610_STI,
83                 .flags          = IORESOURCE_IRQ,
84         }
85 };
86
87 static struct platform_device sti_device = {
88         .name           = "sti",
89         .id             = -1,
90         .num_resources  = ARRAY_SIZE(sti_resources),
91         .resource       = sti_resources,
92 };
93
94 static inline void omap_init_sti(void)
95 {
96         platform_device_register(&sti_device);
97 }
98 #else
99 static inline void omap_init_sti(void) {}
100 #endif
101
102 /*-------------------------------------------------------------------------*/
103
104 /*
105  * This gets called after board-specific INIT_MACHINE, and initializes most
106  * on-chip peripherals accessible on this board (except for few like USB):
107  *
108  *  (a) Does any "standard config" pin muxing needed.  Board-specific
109  *      code will have muxed GPIO pins and done "nonstandard" setup;
110  *      that code could live in the boot loader.
111  *  (b) Populating board-specific platform_data with the data drivers
112  *      rely on to handle wiring variations.
113  *  (c) Creating platform devices as meaningful on this board and
114  *      with this kernel configuration.
115  *
116  * Claiming GPIOs, and setting their direction and initial values, is the
117  * responsibility of the device drivers.  So is responding to probe().
118  *
119  * Board-specific knowlege like creating devices or pin setup is to be
120  * kept out of drivers as much as possible.  In particular, pin setup
121  * may be handled by the boot loader, and drivers should expect it will
122  * normally have been done by the time they're probed.
123  */
124 static int __init omap1_init_devices(void)
125 {
126         /* please keep these calls, and their implementations above,
127          * in alphabetical order so they're easier to sort through.
128          */
129         omap_init_rtc();
130         omap_init_sti();
131
132         return 0;
133 }
134 arch_initcall(omap1_init_devices);
135