[ARM] Remove asm/hardware.h, use asm/arch/hardware.h instead
[linux-2.6/libata-dev.git] / arch / arm / mach-omap1 / devices.c
blob9ad8f927ef13800e43ef201517b70ca5074c8398
1 /*
2 * linux/arch/arm/mach-omap1/devices.c
4 * OMAP1 platform device setup/initialization
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.
12 #include <linux/module.h>
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/platform_device.h>
17 #include <asm/arch/hardware.h>
18 #include <asm/io.h>
19 #include <asm/mach/map.h>
21 #include <asm/arch/tc.h>
22 #include <asm/arch/board.h>
23 #include <asm/arch/mux.h>
24 #include <asm/arch/gpio.h>
26 /*-------------------------------------------------------------------------*/
28 #if defined(CONFIG_RTC_DRV_OMAP) || defined(CONFIG_RTC_DRV_OMAP_MODULE)
30 #define OMAP_RTC_BASE 0xfffb4800
32 static struct resource rtc_resources[] = {
34 .start = OMAP_RTC_BASE,
35 .end = OMAP_RTC_BASE + 0x5f,
36 .flags = IORESOURCE_MEM,
39 .start = INT_RTC_TIMER,
40 .flags = IORESOURCE_IRQ,
43 .start = INT_RTC_ALARM,
44 .flags = IORESOURCE_IRQ,
48 static struct platform_device omap_rtc_device = {
49 .name = "omap_rtc",
50 .id = -1,
51 .num_resources = ARRAY_SIZE(rtc_resources),
52 .resource = rtc_resources,
55 static void omap_init_rtc(void)
57 (void) platform_device_register(&omap_rtc_device);
59 #else
60 static inline void omap_init_rtc(void) {}
61 #endif
63 #if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
65 #if defined(CONFIG_ARCH_OMAP15XX)
66 # define OMAP1_MBOX_SIZE 0x23
67 # define INT_DSP_MAILBOX1 INT_1510_DSP_MAILBOX1
68 #elif defined(CONFIG_ARCH_OMAP16XX)
69 # define OMAP1_MBOX_SIZE 0x2f
70 # define INT_DSP_MAILBOX1 INT_1610_DSP_MAILBOX1
71 #endif
73 #define OMAP1_MBOX_BASE IO_ADDRESS(OMAP16XX_MAILBOX_BASE)
75 static struct resource mbox_resources[] = {
77 .start = OMAP1_MBOX_BASE,
78 .end = OMAP1_MBOX_BASE + OMAP1_MBOX_SIZE,
79 .flags = IORESOURCE_MEM,
82 .start = INT_DSP_MAILBOX1,
83 .flags = IORESOURCE_IRQ,
87 static struct platform_device mbox_device = {
88 .name = "mailbox",
89 .id = -1,
90 .num_resources = ARRAY_SIZE(mbox_resources),
91 .resource = mbox_resources,
94 static inline void omap_init_mbox(void)
96 platform_device_register(&mbox_device);
98 #else
99 static inline void omap_init_mbox(void) { }
100 #endif
102 #if defined(CONFIG_OMAP_STI)
104 #define OMAP1_STI_BASE IO_ADDRESS(0xfffea000)
105 #define OMAP1_STI_CHANNEL_BASE (OMAP1_STI_BASE + 0x400)
107 static struct resource sti_resources[] = {
109 .start = OMAP1_STI_BASE,
110 .end = OMAP1_STI_BASE + SZ_1K - 1,
111 .flags = IORESOURCE_MEM,
114 .start = OMAP1_STI_CHANNEL_BASE,
115 .end = OMAP1_STI_CHANNEL_BASE + SZ_1K - 1,
116 .flags = IORESOURCE_MEM,
119 .start = INT_1610_STI,
120 .flags = IORESOURCE_IRQ,
124 static struct platform_device sti_device = {
125 .name = "sti",
126 .id = -1,
127 .num_resources = ARRAY_SIZE(sti_resources),
128 .resource = sti_resources,
131 static inline void omap_init_sti(void)
133 platform_device_register(&sti_device);
135 #else
136 static inline void omap_init_sti(void) {}
137 #endif
139 /*-------------------------------------------------------------------------*/
142 * This gets called after board-specific INIT_MACHINE, and initializes most
143 * on-chip peripherals accessible on this board (except for few like USB):
145 * (a) Does any "standard config" pin muxing needed. Board-specific
146 * code will have muxed GPIO pins and done "nonstandard" setup;
147 * that code could live in the boot loader.
148 * (b) Populating board-specific platform_data with the data drivers
149 * rely on to handle wiring variations.
150 * (c) Creating platform devices as meaningful on this board and
151 * with this kernel configuration.
153 * Claiming GPIOs, and setting their direction and initial values, is the
154 * responsibility of the device drivers. So is responding to probe().
156 * Board-specific knowlege like creating devices or pin setup is to be
157 * kept out of drivers as much as possible. In particular, pin setup
158 * may be handled by the boot loader, and drivers should expect it will
159 * normally have been done by the time they're probed.
161 static int __init omap1_init_devices(void)
163 /* please keep these calls, and their implementations above,
164 * in alphabetical order so they're easier to sort through.
167 omap_init_mbox();
168 omap_init_rtc();
169 omap_init_sti();
171 return 0;
173 arch_initcall(omap1_init_devices);