blob: e382b438c64ed5d42d49f05e1586ab03c3218aa5 [file] [log] [blame]
Tony Lindgren7c38cf02005-09-08 23:07:38 +01001/*
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
Tony Lindgren7c38cf02005-09-08 23:07:38 +010012#include <linux/module.h>
13#include <linux/kernel.h>
14#include <linux/init.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010015#include <linux/platform_device.h>
Russell Kingfced80c2008-09-06 12:10:45 +010016#include <linux/io.h>
Tony Lindgren7c38cf02005-09-08 23:07:38 +010017
Russell Kinga09e64f2008-08-05 16:14:15 +010018#include <mach/hardware.h>
Tony Lindgren7c38cf02005-09-08 23:07:38 +010019#include <asm/mach/map.h>
20
Russell Kinga09e64f2008-08-05 16:14:15 +010021#include <mach/tc.h>
22#include <mach/board.h>
23#include <mach/mux.h>
24#include <mach/gpio.h>
Tony Lindgren7c38cf02005-09-08 23:07:38 +010025
Tony Lindgren7c38cf02005-09-08 23:07:38 +010026/*-------------------------------------------------------------------------*/
27
David Brownelldb68b182006-12-06 20:38:36 -080028#if defined(CONFIG_RTC_DRV_OMAP) || defined(CONFIG_RTC_DRV_OMAP_MODULE)
Tony Lindgren7c38cf02005-09-08 23:07:38 +010029
30#define OMAP_RTC_BASE 0xfffb4800
31
32static struct resource rtc_resources[] = {
33 {
34 .start = OMAP_RTC_BASE,
35 .end = OMAP_RTC_BASE + 0x5f,
36 .flags = IORESOURCE_MEM,
37 },
38 {
39 .start = INT_RTC_TIMER,
40 .flags = IORESOURCE_IRQ,
41 },
42 {
43 .start = INT_RTC_ALARM,
44 .flags = IORESOURCE_IRQ,
45 },
46};
47
48static struct platform_device omap_rtc_device = {
49 .name = "omap_rtc",
50 .id = -1,
Tony Lindgren7c38cf02005-09-08 23:07:38 +010051 .num_resources = ARRAY_SIZE(rtc_resources),
52 .resource = rtc_resources,
53};
54
55static void omap_init_rtc(void)
56{
57 (void) platform_device_register(&omap_rtc_device);
58}
59#else
60static inline void omap_init_rtc(void) {}
61#endif
62
Tony Lindgrenc40fae952006-12-07 13:58:10 -080063#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
64
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
72
73#define OMAP1_MBOX_BASE IO_ADDRESS(OMAP16XX_MAILBOX_BASE)
74
75static struct resource mbox_resources[] = {
76 {
77 .start = OMAP1_MBOX_BASE,
78 .end = OMAP1_MBOX_BASE + OMAP1_MBOX_SIZE,
79 .flags = IORESOURCE_MEM,
80 },
81 {
82 .start = INT_DSP_MAILBOX1,
83 .flags = IORESOURCE_IRQ,
84 },
85};
86
87static struct platform_device mbox_device = {
88 .name = "mailbox",
89 .id = -1,
90 .num_resources = ARRAY_SIZE(mbox_resources),
91 .resource = mbox_resources,
92};
93
94static inline void omap_init_mbox(void)
95{
96 platform_device_register(&mbox_device);
97}
98#else
99static inline void omap_init_mbox(void) { }
100#endif
101
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100102#if defined(CONFIG_OMAP_STI)
103
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300104#define OMAP1_STI_BASE 0xfffea000
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100105#define OMAP1_STI_CHANNEL_BASE (OMAP1_STI_BASE + 0x400)
106
107static struct resource sti_resources[] = {
108 {
109 .start = OMAP1_STI_BASE,
110 .end = OMAP1_STI_BASE + SZ_1K - 1,
111 .flags = IORESOURCE_MEM,
112 },
113 {
114 .start = OMAP1_STI_CHANNEL_BASE,
115 .end = OMAP1_STI_CHANNEL_BASE + SZ_1K - 1,
116 .flags = IORESOURCE_MEM,
117 },
118 {
119 .start = INT_1610_STI,
120 .flags = IORESOURCE_IRQ,
121 }
122};
123
124static struct platform_device sti_device = {
125 .name = "sti",
126 .id = -1,
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100127 .num_resources = ARRAY_SIZE(sti_resources),
128 .resource = sti_resources,
129};
130
131static inline void omap_init_sti(void)
132{
133 platform_device_register(&sti_device);
134}
135#else
136static inline void omap_init_sti(void) {}
137#endif
Tony Lindgren7c38cf02005-09-08 23:07:38 +0100138
139/*-------------------------------------------------------------------------*/
140
141/*
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):
144 *
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.
152 *
153 * Claiming GPIOs, and setting their direction and initial values, is the
154 * responsibility of the device drivers. So is responding to probe().
155 *
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.
160 */
Tony Lindgren3179a012005-11-10 14:26:48 +0000161static int __init omap1_init_devices(void)
Tony Lindgren7c38cf02005-09-08 23:07:38 +0100162{
163 /* please keep these calls, and their implementations above,
164 * in alphabetical order so they're easier to sort through.
165 */
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800166
167 omap_init_mbox();
Tony Lindgren7c38cf02005-09-08 23:07:38 +0100168 omap_init_rtc();
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100169 omap_init_sti();
Tony Lindgren7c38cf02005-09-08 23:07:38 +0100170
171 return 0;
172}
Tony Lindgren3179a012005-11-10 14:26:48 +0000173arch_initcall(omap1_init_devices);
Tony Lindgren7c38cf02005-09-08 23:07:38 +0100174