blob: 5139677e426621bf55fad5a7d19c652f471d3249 [file] [log] [blame]
Tony Lindgren1dbae812005-11-10 14:26:51 +00001/*
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
Tony Lindgren1dbae812005-11-10 14:26:51 +000028#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
29
30#define OMAP2_I2C_BASE2 0x48072000
31#define OMAP2_I2C_INT2 57
32
33static struct resource i2c_resources2[] = {
34 {
35 .start = OMAP2_I2C_BASE2,
36 .end = OMAP2_I2C_BASE2 + 0x3f,
37 .flags = IORESOURCE_MEM,
38 },
39 {
40 .start = OMAP2_I2C_INT2,
41 .flags = IORESOURCE_IRQ,
42 },
43};
44
45static struct platform_device omap_i2c_device2 = {
46 .name = "i2c_omap",
47 .id = 2,
Tony Lindgren1dbae812005-11-10 14:26:51 +000048 .num_resources = ARRAY_SIZE(i2c_resources2),
49 .resource = i2c_resources2,
50};
51
52/* See also arch/arm/plat-omap/devices.c for first I2C on 24xx */
53static void omap_init_i2c(void)
54{
55 /* REVISIT: Second I2C not in use on H4? */
56 if (machine_is_omap_h4())
57 return;
58
59 omap_cfg_reg(J15_24XX_I2C2_SCL);
60 omap_cfg_reg(H19_24XX_I2C2_SDA);
61 (void) platform_device_register(&omap_i2c_device2);
62}
63
64#else
65
66static void omap_init_i2c(void) {}
67
68#endif
69
Tony Lindgren9b6553c2006-04-02 17:46:30 +010070#if defined(CONFIG_OMAP_STI)
71
72#define OMAP2_STI_BASE IO_ADDRESS(0x48068000)
73#define OMAP2_STI_CHANNEL_BASE 0x54000000
74#define OMAP2_STI_IRQ 4
75
76static struct resource sti_resources[] = {
77 {
78 .start = OMAP2_STI_BASE,
79 .end = OMAP2_STI_BASE + 0x7ff,
80 .flags = IORESOURCE_MEM,
81 },
82 {
83 .start = OMAP2_STI_CHANNEL_BASE,
84 .end = OMAP2_STI_CHANNEL_BASE + SZ_64K - 1,
85 .flags = IORESOURCE_MEM,
86 },
87 {
88 .start = OMAP2_STI_IRQ,
89 .flags = IORESOURCE_IRQ,
90 }
91};
92
93static struct platform_device sti_device = {
94 .name = "sti",
95 .id = -1,
Tony Lindgren9b6553c2006-04-02 17:46:30 +010096 .num_resources = ARRAY_SIZE(sti_resources),
97 .resource = sti_resources,
98};
99
100static inline void omap_init_sti(void)
101{
102 platform_device_register(&sti_device);
103}
104#else
105static inline void omap_init_sti(void) {}
106#endif
107
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700108#if defined(CONFIG_SPI_OMAP24XX)
109
110#include <asm/arch/mcspi.h>
111
112#define OMAP2_MCSPI1_BASE 0x48098000
113#define OMAP2_MCSPI2_BASE 0x4809a000
114
115/* FIXME: use resources instead */
116
117static struct omap2_mcspi_platform_config omap2_mcspi1_config = {
118 .base = io_p2v(OMAP2_MCSPI1_BASE),
119 .num_cs = 4,
120};
121
122struct platform_device omap2_mcspi1 = {
123 .name = "omap2_mcspi",
124 .id = 1,
125 .dev = {
126 .platform_data = &omap2_mcspi1_config,
127 },
128};
129
130static struct omap2_mcspi_platform_config omap2_mcspi2_config = {
131 .base = io_p2v(OMAP2_MCSPI2_BASE),
132 .num_cs = 2,
133};
134
135struct platform_device omap2_mcspi2 = {
136 .name = "omap2_mcspi",
137 .id = 2,
138 .dev = {
139 .platform_data = &omap2_mcspi2_config,
140 },
141};
142
143static void omap_init_mcspi(void)
144{
145 platform_device_register(&omap2_mcspi1);
146 platform_device_register(&omap2_mcspi2);
147}
148
149#else
150static inline void omap_init_mcspi(void) {}
151#endif
152
Tony Lindgren1dbae812005-11-10 14:26:51 +0000153/*-------------------------------------------------------------------------*/
154
155static int __init omap2_init_devices(void)
156{
157 /* please keep these calls, and their implementations above,
158 * in alphabetical order so they're easier to sort through.
159 */
160 omap_init_i2c();
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700161 omap_init_mcspi();
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100162 omap_init_sti();
Tony Lindgren1dbae812005-11-10 14:26:51 +0000163
164 return 0;
165}
166arch_initcall(omap2_init_devices);
167